Mercurial > hg > openttd
annotate src/depend/depend.cpp @ 13697:4e2fb4386b62 draft
(svn r18222) -Codechange: make the sign list window big font aware
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 22 Nov 2009 14:40:25 +0000 |
parents | e03b0bff7b9e |
children | 5f128be91f59 |
rev | line source |
---|---|
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12216
diff
changeset
|
9 |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
10 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
11 * @file depend/depend.cpp Custom implementation of Makedepend. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
12 * |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
13 * We previously used makedepend, but that could not handle the amount of |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
14 * files we have and does not handle conditional includes in a sane manner. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
15 * This caused many link problems because not enough files were recompiled. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
16 * This has lead to the development of our own dependency generator. It is |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
17 * meant to be a substitute to the (relatively slow) dependency generation |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
18 * via gcc. It thus helps speeding up compilation. It will also ignore |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
19 * system headers making it less error prone when system headers are moved |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
20 * or renamed. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
21 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
22 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
23 #include <stdio.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
24 #include <stdlib.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
25 #include <string.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
26 #include <ctype.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
27 #include <limits.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
28 #include <unistd.h> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
29 #include <map> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
30 #include <set> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
31 #include <stack> |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
32 |
13414
e03b0bff7b9e
(svn r17923) -Feature: "port" OpenTTD to GNU/Hurd
rubidium <rubidium@openttd.org>
parents:
13182
diff
changeset
|
33 #ifndef PATH_MAX |
e03b0bff7b9e
(svn r17923) -Feature: "port" OpenTTD to GNU/Hurd
rubidium <rubidium@openttd.org>
parents:
13182
diff
changeset
|
34 # define PATH_MAX 260 |
e03b0bff7b9e
(svn r17923) -Feature: "port" OpenTTD to GNU/Hurd
rubidium <rubidium@openttd.org>
parents:
13182
diff
changeset
|
35 #endif |
e03b0bff7b9e
(svn r17923) -Feature: "port" OpenTTD to GNU/Hurd
rubidium <rubidium@openttd.org>
parents:
13182
diff
changeset
|
36 |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
37 /** Simple string comparator using strcmp as implementation */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
38 struct StringCompare { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
39 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
40 * Compare a to b using strcmp. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
41 * @param a string to compare. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
42 * @param b string to compare. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
43 * @return whether a is less than b. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
44 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
45 bool operator () (const char *a, const char *b) const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
46 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
47 return strcmp(a, b) < 0; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
48 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
49 }; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
50 /** Set of C-style strings. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
51 typedef std::set<const char*, StringCompare> StringSet; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
52 /** Mapping of C-style string to a set of C-style strings. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
53 typedef std::map<const char*, StringSet*, StringCompare> StringMap; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
54 /** Pair of C-style string and a set of C-style strings. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
55 typedef std::pair<const char*, StringSet*> StringMapItem; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
56 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
57 /** Include directory to search in. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
58 static StringSet _include_dirs; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
59 /** Files that have been parsed/handled with their dependencies. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
60 static StringMap _files; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
61 /** Dependencies of headers. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
62 static StringMap _headers; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
63 /** The current 'active' defines. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
64 static StringSet _defines; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
65 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
66 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
67 * Helper class to read a file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
68 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
69 class File { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
70 public: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
71 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
72 * Create the helper by opening the given file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
73 * @param filename the file to open |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
74 * @post the file is open; otherwise the application is killed. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
75 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
76 File(const char *filename) : filename(filename) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
77 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
78 this->fp = fopen(filename, "r"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
79 if (this->fp == NULL) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
80 fprintf(stdout, "Could not open %s for reading\n", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
81 exit(1); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
82 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
83 this->dirname = strdup(filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
84 char *last = strrchr(this->dirname, '/'); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
85 if (last != NULL) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
86 *last = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
87 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
88 *this->dirname = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
89 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
90 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
91 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
92 /** Free everything we have allocated. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
93 ~File() |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
94 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
95 fclose(this->fp); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
96 free(this->dirname); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
97 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
98 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
99 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
100 * Get a single character from the file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
101 * If we are reading beyond the end of the file '\0' is returned. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
102 * @return the read character. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
103 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
104 char GetChar() const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
105 { |
12126
2838b01593ed
(svn r16542) -Fix [FS#2971](r16307): depend failed on architectures with unsigned char
smatz <smatz@openttd.org>
parents:
12004
diff
changeset
|
106 int c = fgetc(this->fp); |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
107 return (c == EOF) ? '\0' : c; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
108 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
109 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
110 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
111 * Get the directory name of the file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
112 * @return the directory name. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
113 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
114 const char *GetDirname() const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
115 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
116 return this->dirname; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
117 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
118 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
119 private: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
120 FILE *fp; ///< The currently opened file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
121 char *dirname; ///< The directory of the file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
122 const char *filename; ///< The name of the file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
123 }; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
124 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
125 /** A token returned by the tokenizer. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
126 enum Token { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
127 TOKEN_UNKNOWN, ///< Unknown token |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
128 TOKEN_END, ///< End of document |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
129 TOKEN_EOL, ///< End of line |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
130 TOKEN_SHARP, ///< # character, usually telling something important comes. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
131 TOKEN_LOCAL, ///< Read a local include |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
132 TOKEN_GLOBAL, ///< Read a global include |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
133 TOKEN_IDENTIFIER, ///< Identifier within the data. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
134 TOKEN_DEFINE, ///< (#)define in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
135 TOKEN_IF, ///< (#)if in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
136 TOKEN_IFDEF, ///< (#)ifdef in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
137 TOKEN_IFNDEF, ///< (#)ifndef in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
138 TOKEN_ELIF, ///< (#)elif in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
139 TOKEN_ELSE, ///< (#)else in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
140 TOKEN_ENDIF, ///< (#)endif in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
141 TOKEN_UNDEF, ///< (#)undef in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
142 TOKEN_OR, ///< '||' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
143 TOKEN_AND, ///< '&&' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
144 TOKEN_DEFINED, ///< 'defined' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
145 TOKEN_OPEN, ///< '(' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
146 TOKEN_CLOSE, ///< ')' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
147 TOKEN_NOT, ///< '!' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
148 TOKEN_ZERO, ///< '0' within #if expression |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
149 TOKEN_INCLUDE, ///< (#)include in code |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
150 }; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
151 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
152 /** Mapping from a C-style keyword representation to a Token. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
153 typedef std::map<const char*, Token, StringCompare> KeywordList; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
154 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
155 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
156 * Lexer of a file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
157 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
158 class Lexer { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
159 public: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
160 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
161 * Create the lexer and fill the keywords table. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
162 * @param file the file to read from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
163 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
164 Lexer(const File *file) : file(file), current_char('\0'), string(NULL), token(TOKEN_UNKNOWN) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
165 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
166 this->keywords["define"] = TOKEN_DEFINE; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
167 this->keywords["defined"] = TOKEN_DEFINED; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
168 this->keywords["if"] = TOKEN_IF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
169 this->keywords["ifdef"] = TOKEN_IFDEF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
170 this->keywords["ifndef"] = TOKEN_IFNDEF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
171 this->keywords["include"] = TOKEN_INCLUDE; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
172 this->keywords["elif"] = TOKEN_ELIF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
173 this->keywords["else"] = TOKEN_ELSE; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
174 this->keywords["endif"] = TOKEN_ENDIF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
175 this->keywords["undef"] = TOKEN_UNDEF; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
176 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
177 /* Initialise currently read character. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
178 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
179 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
180 /* Allocate the buffer. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
181 this->buf_len = 32; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
182 this->buf = (char*)malloc(sizeof(*this->buf) * this->buf_len); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
183 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
184 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
185 /** Free everything */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
186 ~Lexer() |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
187 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
188 free(this->buf); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
189 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
190 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
191 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
192 * Read the next character into 'current_char'. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
193 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
194 void Next() |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
195 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
196 this->current_char = this->file->GetChar(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
197 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
198 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
199 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
200 * Get the current token. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
201 * @return the token. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
202 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
203 Token GetToken() const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
204 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
205 return this->token; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
206 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
207 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
208 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
209 * Read the currenty processed string. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
210 * @return the string, can be NULL. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
211 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
212 const char *GetString() const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
213 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
214 return this->string; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
215 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
216 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
217 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
218 * Perform the lexing/tokenizing of the file till we can return something |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
219 * that must be parsed. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
220 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
221 void Lex() |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
222 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
223 for (;;) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
224 free(this->string); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
225 this->string = NULL; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
226 this->token = TOKEN_UNKNOWN; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
227 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
228 switch (this->current_char) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
229 /* '\0' means End-Of-File */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
230 case '\0': this->token = TOKEN_END; return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
231 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
232 /* Skip some chars, as they don't do anything */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
233 case '\t': this->Next(); break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
234 case '\r': this->Next(); break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
235 case ' ': this->Next(); break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
236 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
237 case '\\': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
238 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
239 if (this->current_char == '\n') this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
240 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
241 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
242 case '\n': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
243 this->token = TOKEN_EOL; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
244 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
245 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
246 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
247 case '#': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
248 this->token = TOKEN_SHARP; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
249 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
250 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
251 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
252 case '"': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
253 this->ReadString('"', TOKEN_LOCAL); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
254 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
255 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
256 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
257 case '<': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
258 this->ReadString('>', TOKEN_GLOBAL); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
259 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
260 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
261 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
262 case '&': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
263 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
264 if (this->current_char == '&') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
265 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
266 this->token = TOKEN_AND; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
267 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
268 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
269 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
270 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
271 case '|': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
272 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
273 if (this->current_char == '|') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
274 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
275 this->token = TOKEN_OR; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
276 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
277 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
278 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
279 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
280 case '(': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
281 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
282 this->token = TOKEN_OPEN; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
283 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
284 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
285 case ')': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
286 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
287 this->token = TOKEN_CLOSE; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
288 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
289 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
290 case '!': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
291 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
292 if (this->current_char != '=') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
293 this->token = TOKEN_NOT; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
294 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
295 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
296 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
297 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
298 /* Possible begin of comment */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
299 case '/': |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
300 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
301 switch (this->current_char) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
302 case '*': { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
303 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
304 char previous_char = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
305 while ((this->current_char != '/' || previous_char != '*') && this->current_char != '\0') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
306 previous_char = this->current_char; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
307 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
308 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
309 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
310 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
311 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
312 case '/': while (this->current_char != '\n' && this->current_char != '\0') this->Next(); break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
313 default: break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
314 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
315 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
316 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
317 default: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
318 if (isalpha(this->current_char) || this->current_char == '_') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
319 /* If the name starts with a letter, it is an identifier */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
320 this->ReadIdentifier(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
321 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
322 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
323 if (isdigit(this->current_char)) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
324 bool zero = this->current_char == '0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
325 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
326 if (this->current_char == 'x' || this->current_char == 'X') Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
327 while (isdigit(this->current_char) || this->current_char == '.' || (this->current_char >= 'a' && this->current_char <= 'f') || (this->current_char >= 'A' && this->current_char <= 'F')) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
328 zero &= this->current_char == '0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
329 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
330 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
331 if (zero) this->token = TOKEN_ZERO; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
332 return; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
333 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
334 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
335 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
336 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
337 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
338 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
339 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
340 private: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
341 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
342 * The token based on keyword with a given name. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
343 * @param name the actual keyword. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
344 * @return the token of the keyword. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
345 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
346 Token FindKeyword(const char *name) const |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
347 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
348 KeywordList::const_iterator it = this->keywords.find(name); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
349 if (it == this->keywords.end()) return TOKEN_IDENTIFIER; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
350 return (*it).second; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
351 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
352 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
353 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
354 * Read an identifier. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
355 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
356 void ReadIdentifier() |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
357 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
358 size_t count = 0; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
359 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
360 /* Read the rest of the identifier */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
361 do { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
362 this->buf[count++] = this->current_char; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
363 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
364 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
365 if (count >= buf_len) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
366 /* Scale the buffer if required */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
367 this->buf_len *= 2; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
368 this->buf = (char *)realloc(this->buf, sizeof(*this->buf) * this->buf_len); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
369 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
370 } while ((isalpha(this->current_char) || this->current_char == '_' || isdigit(this->current_char))); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
371 this->buf[count] = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
372 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
373 free(this->string); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
374 this->string = strdup(this->buf); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
375 this->token = FindKeyword(this->string); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
376 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
377 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
378 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
379 * Read a string up to a given character, then set the given token. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
380 * @param end the 'marker' for the end of the string. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
381 * @param token the token to set after returning. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
382 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
383 void ReadString(char end, Token token) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
384 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
385 size_t count = 0; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
386 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
387 while (this->current_char != end && this->current_char != ')' && this->current_char != '\n' && this->current_char != '\0') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
388 this->buf[count++] = this->current_char; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
389 this->Next(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
390 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
391 if (count >= this->buf_len) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
392 /* Scale the buffer if required */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
393 this->buf_len *= 2; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
394 this->buf = (char *)realloc(this->buf, sizeof(*this->buf) * this->buf_len); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
395 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
396 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
397 this->buf[count] = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
398 free(this->string); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
399 this->string = strdup(this->buf); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
400 this->token = token; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
401 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
402 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
403 const File *file; ///< The file to read from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
404 char current_char; ///< The current character to process. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
405 char *string; ///< Currently processed string. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
406 Token token; ///< The current token to process. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
407 char *buf; ///< Temporary buffer. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
408 size_t buf_len; ///< Length of the temporary buffer. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
409 KeywordList keywords; ///< All keywords we know of. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
410 }; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
411 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
412 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
413 * Generate a path from a directory name and a relative filename. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
414 * If the file is not local the include directory names will be used instead |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
415 * of the passed parameter with directory name. If the file is local both will |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
416 * be queried where the parameter takes precedence. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
417 * @param dirname the directory to look in. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
418 * @param filename the file to look for. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
419 * @param local whether to look locally (in dirname) for the file. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
420 * @return the absolute path, or NULL if the file doesn't exist. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
421 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
422 const char *GeneratePath(const char *dirname, const char *filename, bool local) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
423 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
424 if (local) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
425 if (access(filename, R_OK) == 0) return strdup(filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
426 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
427 char path[PATH_MAX]; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
428 strcpy(path, dirname); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
429 const char *p = filename; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
430 /* Remove '..' from the begin of the filename. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
431 while (*p == '.') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
432 if (*(++p) == '.') { |
13182
e87f42d9eca6
(svn r17689) -Fix (r16307): depend could segfault in some case (TrueBrain)
glx <glx@openttd.org>
parents:
12778
diff
changeset
|
433 char *s = strrchr(path, '/'); |
e87f42d9eca6
(svn r17689) -Fix (r16307): depend could segfault in some case (TrueBrain)
glx <glx@openttd.org>
parents:
12778
diff
changeset
|
434 if (s != NULL) *s = '\0'; |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
435 p += 2; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
436 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
437 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
438 strcat(path, "/"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
439 strcat(path, p); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
440 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
441 if (access(path, R_OK) == 0) return strdup(path); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
442 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
443 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
444 for (StringSet::iterator it = _include_dirs.begin(); it != _include_dirs.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
445 char path[PATH_MAX]; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
446 strcpy(path, *it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
447 const char *p = filename; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
448 /* Remove '..' from the begin of the filename. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
449 while (*p == '.') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
450 if (*(++p) == '.') { |
13182
e87f42d9eca6
(svn r17689) -Fix (r16307): depend could segfault in some case (TrueBrain)
glx <glx@openttd.org>
parents:
12778
diff
changeset
|
451 char *s = strrchr(path, '/'); |
e87f42d9eca6
(svn r17689) -Fix (r16307): depend could segfault in some case (TrueBrain)
glx <glx@openttd.org>
parents:
12778
diff
changeset
|
452 if (s != NULL) *s = '\0'; |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
453 p += 2; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
454 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
455 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
456 strcat(path, "/"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
457 strcat(path, p); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
458 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
459 if (access(path, R_OK) == 0) return strdup(path); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
460 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
461 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
462 return NULL; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
463 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
464 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
465 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
466 * Try to parse a 'defined(expr)' expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
467 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
468 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
469 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
470 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
471 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
472 bool ExpressionDefined(Lexer *lexer, StringSet *defines, bool verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
473 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
474 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
475 * Try to parse a 'expr || expr' expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
476 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
477 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
478 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
479 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
480 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
481 bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
482 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
483 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
484 * Try to parse a '!expr' expression. Also parses the '(expr)', '0' and |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
485 * identifiers. Finally it also consumes any unknown tokens. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
486 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
487 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
488 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
489 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
490 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
491 bool ExpressionNot(Lexer *lexer, StringSet *defines, bool verbose) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
492 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
493 if (lexer->GetToken() == TOKEN_NOT) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
494 if (verbose) fprintf(stderr, "!"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
495 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
496 bool value = !ExpressionDefined(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
497 if (verbose) fprintf(stderr, "[%d]", value); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
498 return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
499 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
500 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
501 if (lexer->GetToken() == TOKEN_OPEN) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
502 if (verbose) fprintf(stderr, "("); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
503 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
504 bool value = ExpressionOr(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
505 if (verbose) fprintf(stderr, ")[%d]", value); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
506 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
507 return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
508 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
509 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
510 if (lexer->GetToken() == TOKEN_ZERO) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
511 if (verbose) fprintf(stderr, "0"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
512 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
513 if (verbose) fprintf(stderr, "[0]"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
514 return false; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
515 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
516 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
517 bool first = true; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
518 while (lexer->GetToken() == TOKEN_UNKNOWN || lexer->GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
519 if (verbose && first) fprintf(stderr, "<assumed true>"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
520 first = false; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
521 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
522 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
523 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
524 return true; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
525 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
526 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
527 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
528 * Try to parse a 'defined(expr)' expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
529 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
530 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
531 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
532 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
533 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
534 bool ExpressionDefined(Lexer *lexer, StringSet *defines, bool verbose) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
535 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
536 bool value = ExpressionNot(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
537 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
538 if (lexer->GetToken() != TOKEN_DEFINED) return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
539 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
540 if (verbose) fprintf(stderr, "defined"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
541 bool open = (lexer->GetToken() == TOKEN_OPEN); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
542 if (open) lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
543 if (verbose) fprintf(stderr, open ? "(" : " "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
544 if (lexer->GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
545 if (verbose) fprintf(stderr, "%s", lexer->GetString()); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
546 value = defines->find(lexer->GetString()) != defines->end(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
547 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
548 if (open) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
549 if (verbose) fprintf(stderr, ")"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
550 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
551 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
552 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
553 if (verbose) fprintf(stderr, "[%d]", value); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
554 return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
555 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
556 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
557 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
558 * Try to parse a 'expr && expr' expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
559 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
560 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
561 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
562 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
563 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
564 bool ExpressionAnd(Lexer *lexer, StringSet *defines, bool verbose) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
565 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
566 bool value = ExpressionDefined(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
567 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
568 while (true) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
569 if (lexer->GetToken() != TOKEN_AND) return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
570 if (verbose) fprintf(stderr, " && "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
571 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
572 value = value && ExpressionDefined(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
573 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
574 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
575 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
576 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
577 * Try to parse a 'expr || expr' expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
578 * @param lexer the lexer to get tokens from. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
579 * @param defines the set of known defines. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
580 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
581 * @return the value of the expression. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
582 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
583 bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
584 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
585 bool value = ExpressionAnd(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
586 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
587 while (true) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
588 if (lexer->GetToken() != TOKEN_OR) return value; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
589 if (verbose) fprintf(stderr, " || "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
590 lexer->Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
591 value = value || ExpressionAnd(lexer, defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
592 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
593 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
594 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
595 /** Enumerator to tell how long to ignore 'stuff'. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
596 enum Ignore { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
597 NOT_IGNORE, ///< No ignoring. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
598 IGNORE_UNTIL_ELSE, ///< Ignore till a #else is reached. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
599 IGNORE_UNTIL_ENDIF, ///< Ignore till a #endif is reached. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
600 }; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
601 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
602 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
603 * Scan a file for includes, defines and the lot. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
604 * @param filename the name of the file to scan. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
605 * @param ext the extension of the filename. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
606 * @param header whether the file is a header or not. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
607 * @param verbose whether to give verbose debugging information. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
608 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
609 void ScanFile(const char *filename, const char *ext, bool header, bool verbose) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
610 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
611 static StringSet defines; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
612 static std::stack<Ignore> ignore; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
613 /* Copy in the default defines (parameters of depend) */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
614 if (!header) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
615 for (StringSet::iterator it = _defines.begin(); it != _defines.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
616 defines.insert(strdup(*it)); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
617 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
618 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
619 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
620 File file(filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
621 Lexer lexer(&file); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
622 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
623 /* Start the lexing! */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
624 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
625 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
626 while (lexer.GetToken() != TOKEN_END) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
627 switch (lexer.GetToken()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
628 /* We reached the end of the file... yay, we're done! */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
629 case TOKEN_END: break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
630 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
631 /* The line started with a # (minus whitespace) */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
632 case TOKEN_SHARP: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
633 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
634 switch (lexer.GetToken()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
635 case TOKEN_INCLUDE: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
636 if (verbose) fprintf(stderr, "%s #include ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
637 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
638 switch (lexer.GetToken()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
639 case TOKEN_LOCAL: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
640 case TOKEN_GLOBAL: { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
641 if (verbose) fprintf(stderr, "%s", lexer.GetString()); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
642 if (!ignore.empty() && ignore.top() != NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
643 if (verbose) fprintf(stderr, " (ignored)"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
644 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
645 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
646 const char *h = GeneratePath(file.GetDirname(), lexer.GetString(), lexer.GetToken() == TOKEN_LOCAL); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
647 if (h != NULL) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
648 StringMap::iterator it = _headers.find(h); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
649 if (it == _headers.end()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
650 it = (_headers.insert(StringMapItem(strdup(h), new StringSet()))).first; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
651 if (verbose) fprintf(stderr, "\n"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
652 ScanFile(h, ext, true, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
653 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
654 StringMap::iterator curfile; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
655 if (header) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
656 curfile = _headers.find(filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
657 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
658 /* Replace the extension with the provided extension of '.o'. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
659 char path[PATH_MAX]; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
660 strcpy(path, filename); |
12004
c2d9b54aaa63
(svn r16410) -Fix (r16307): don't assume the extension starts with the first '.', but with the last '.'. This way depend doesn't fail if there's a dot in your path, e.g. 'gcc-4.4'.
rubidium <rubidium@openttd.org>
parents:
11907
diff
changeset
|
661 *(strrchr(path, '.')) = '\0'; |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
662 strcat(path, ext != NULL ? ext : ".o"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
663 curfile = _files.find(path); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
664 if (curfile == _files.end()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
665 curfile = (_files.insert(StringMapItem(strdup(path), new StringSet()))).first; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
666 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
667 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
668 if (it != _headers.end()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
669 for (StringSet::iterator header = it->second->begin(); header != it->second->end(); header++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
670 if (curfile->second->find(*header) == curfile->second->end()) curfile->second->insert(strdup(*header)); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
671 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
672 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
673 if (curfile->second->find(h) == curfile->second->end()) curfile->second->insert(strdup(h)); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
674 free((void*)h); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
675 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
676 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
677 /* Fall through */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
678 default: break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
679 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
680 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
681 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
682 case TOKEN_DEFINE: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
683 if (verbose) fprintf(stderr, "%s #define ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
684 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
685 if (lexer.GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
686 if (verbose) fprintf(stderr, "%s", lexer.GetString()); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
687 if (!ignore.empty() && ignore.top() != NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
688 if (verbose) fprintf(stderr, " (ignored)"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
689 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
690 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
691 if (defines.find(lexer.GetString()) == defines.end()) defines.insert(strdup(lexer.GetString())); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
692 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
693 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
694 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
695 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
696 case TOKEN_UNDEF: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
697 if (verbose) fprintf(stderr, "%s #undef ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
698 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
699 if (lexer.GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
700 if (verbose) fprintf(stderr, "%s", lexer.GetString()); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
701 if (!ignore.empty() && ignore.top() != NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
702 if (verbose) fprintf(stderr, " (ignored)"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
703 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
704 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
705 StringSet::iterator it = defines.find(lexer.GetString()); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
706 if (it != defines.end()) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
707 free((void*)*it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
708 defines.erase(it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
709 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
710 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
711 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
712 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
713 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
714 case TOKEN_ENDIF: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
715 if (verbose) fprintf(stderr, "%s #endif", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
716 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
717 if (!ignore.empty()) ignore.pop(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
718 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
719 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
720 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
721 case TOKEN_ELSE: { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
722 if (verbose) fprintf(stderr, "%s #else", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
723 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
724 Ignore last = ignore.empty() ? NOT_IGNORE : ignore.top(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
725 if (!ignore.empty()) ignore.pop(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
726 if (ignore.empty() || ignore.top() == NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
727 ignore.push(last == IGNORE_UNTIL_ELSE ? NOT_IGNORE : IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
728 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
729 ignore.push(IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
730 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
731 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
732 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
733 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
734 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
735 case TOKEN_ELIF: { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
736 if (verbose) fprintf(stderr, "%s #elif ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
737 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
738 Ignore last = ignore.empty() ? NOT_IGNORE : ignore.top(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
739 if (!ignore.empty()) ignore.pop(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
740 if (ignore.empty() || ignore.top() == NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
741 bool value = ExpressionOr(&lexer, &defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
742 ignore.push(last == IGNORE_UNTIL_ELSE ? (value ? NOT_IGNORE : IGNORE_UNTIL_ELSE) : IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
743 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
744 ignore.push(IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
745 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
746 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
747 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
748 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
749 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
750 case TOKEN_IF: { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
751 if (verbose) fprintf(stderr, "%s #if ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
752 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
753 if (ignore.empty() || ignore.top() == NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
754 bool value = ExpressionOr(&lexer, &defines, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
755 ignore.push(value ? NOT_IGNORE : IGNORE_UNTIL_ELSE); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
756 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
757 ignore.push(IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
758 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
759 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
760 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
761 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
762 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
763 case TOKEN_IFDEF: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
764 if (verbose) fprintf(stderr, "%s #ifdef ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
765 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
766 if (lexer.GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
767 bool value = defines.find(lexer.GetString()) != defines.end(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
768 if (verbose) fprintf(stderr, "%s[%d]", lexer.GetString(), value); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
769 if (ignore.empty() || ignore.top() == NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
770 ignore.push(value ? NOT_IGNORE : IGNORE_UNTIL_ELSE); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
771 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
772 ignore.push(IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
773 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
774 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
775 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
776 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
777 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
778 case TOKEN_IFNDEF: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
779 if (verbose) fprintf(stderr, "%s #ifndef ", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
780 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
781 if (lexer.GetToken() == TOKEN_IDENTIFIER) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
782 bool value = defines.find(lexer.GetString()) != defines.end(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
783 if (verbose) fprintf(stderr, "%s[%d]", lexer.GetString(), value); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
784 if (ignore.empty() || ignore.top() == NOT_IGNORE) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
785 ignore.push(!value ? NOT_IGNORE : IGNORE_UNTIL_ELSE); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
786 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
787 ignore.push(IGNORE_UNTIL_ENDIF); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
788 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
789 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
790 if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not "); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
791 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
792 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
793 default: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
794 if (verbose) fprintf(stderr, "%s #<unknown>", filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
795 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
796 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
797 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
798 if (verbose) fprintf(stderr, "\n"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
799 /* Fall through */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
800 default: |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
801 /* Ignore the rest of the garbage on this line */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
802 while (lexer.GetToken() != TOKEN_EOL && lexer.GetToken() != TOKEN_END) lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
803 lexer.Lex(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
804 break; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
805 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
806 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
807 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
808 if (!header) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
809 for (StringSet::iterator it = defines.begin(); it != defines.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
810 free((void*)*it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
811 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
812 defines.clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
813 while (!ignore.empty()) ignore.pop(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
814 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
815 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
816 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
817 /** |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
818 * Entry point. Arguably the most common function in all applications. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
819 * @param argc the number of arguments. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
820 * @param argv the actual arguments. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
821 * @return return value for the caller to tell we succeed or not. |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
822 */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
823 int main(int argc, char *argv[]) |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
824 { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
825 bool ignorenext = true; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
826 char *filename = NULL; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
827 char *ext = NULL; |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
828 char *delimiter = NULL; |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
829 bool append = false; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
830 bool verbose = false; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
831 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
832 for (int i = 0; i < argc; i++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
833 if (ignorenext) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
834 ignorenext = false; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
835 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
836 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
837 if (argv[i][0] == '-') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
838 /* Append */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
839 if (strncmp(argv[i], "-a", 2) == 0) append = true; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
840 /* Include dir */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
841 if (strncmp(argv[i], "-I", 2) == 0) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
842 if (argv[i][2] == '\0') { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
843 i++; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
844 _include_dirs.insert(strdup(argv[i])); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
845 } else { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
846 _include_dirs.insert(strdup(&argv[i][2])); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
847 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
848 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
849 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
850 /* Define */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
851 if (strncmp(argv[i], "-D", 2) == 0) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
852 char *p = strchr(argv[i], '='); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
853 if (p != NULL) *p = '\0'; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
854 _defines.insert(strdup(&argv[i][2])); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
855 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
856 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
857 /* Output file */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
858 if (strncmp(argv[i], "-f", 2) == 0) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
859 if (filename != NULL) continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
860 filename = strdup(&argv[i][2]); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
861 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
862 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
863 /* Object file extension */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
864 if (strncmp(argv[i], "-o", 2) == 0) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
865 if (ext != NULL) continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
866 ext = strdup(&argv[i][2]); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
867 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
868 } |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
869 /* Starting string delimiter */ |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
870 if (strncmp(argv[i], "-s", 2) == 0) { |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
871 if (delimiter != NULL) continue; |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
872 delimiter = strdup(&argv[i][2]); |
12216
08028442797f
(svn r16630) -Fix (r16629): forgot a continue
glx <glx@openttd.org>
parents:
12215
diff
changeset
|
873 continue; |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
874 } |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
875 /* Verbose */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
876 if (strncmp(argv[i], "-v", 2) == 0) verbose = true; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
877 continue; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
878 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
879 ScanFile(argv[i], ext, false, verbose); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
880 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
881 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
882 /* Default output file is Makefile */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
883 if (filename == NULL) filename = strdup("Makefile"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
884 |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
885 /* Default delimiter string */ |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
886 if (delimiter == NULL) delimiter = strdup("# DO NOT DELETE"); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
887 |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
888 char backup[PATH_MAX]; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
889 strcpy(backup, filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
890 strcat(backup, ".bak"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
891 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
892 char *content = NULL; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
893 long size = 0; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
894 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
895 /* Read in the current file; so we can overwrite everything from the |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
896 * end of non-depend data marker down till the end. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
897 FILE *src = fopen(filename, "rb"); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
898 if (src != NULL) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
899 fseek(src, 0, SEEK_END); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
900 size = ftell(src); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
901 rewind(src); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
902 content = (char*)malloc(size * sizeof(*content)); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
903 fread(content, 1, size, src); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
904 fclose(src); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
905 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
906 |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
907 FILE *dst = fopen(filename, "w"); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
908 bool found_delimiter = false; |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
909 |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
910 if (size != 0) { |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
911 src = fopen(backup, "wb"); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
912 fwrite(content, 1, size, src); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
913 fclose(src); |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
914 |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
915 /* Then append it to the real file. */ |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
916 src = fopen(backup, "rb"); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
917 while (fgets(content, size, src) != NULL) { |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
918 fputs(content, dst); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
919 if (!strncmp(content, delimiter, strlen(delimiter))) found_delimiter = true; |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
920 if (!append && found_delimiter) break; |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
921 } |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
922 fclose(src); |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
923 } |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
924 if (!found_delimiter) fprintf(dst, "\n%s\n", delimiter); |
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
925 |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
926 for (StringMap::iterator it = _files.begin(); it != _files.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
927 for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
928 fprintf(dst, "%s: %s\n", it->first, *h); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
929 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
930 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
931 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
932 /* Clean up our mess. */ |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
933 fclose(dst); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
934 |
12215
c9a5d02546e4
(svn r16629) -Fix: depend hang on solaris
glx <glx@openttd.org>
parents:
12126
diff
changeset
|
935 free(delimiter); |
11907
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
936 free(filename); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
937 free(ext); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
938 free(content); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
939 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
940 for (StringMap::iterator it = _files.begin(); it != _files.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
941 for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
942 free((void*)*h); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
943 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
944 it->second->clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
945 delete it->second; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
946 free((void*)it->first); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
947 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
948 _files.clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
949 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
950 for (StringMap::iterator it = _headers.begin(); it != _headers.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
951 for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
952 free((void*)*h); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
953 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
954 it->second->clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
955 delete it->second; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
956 free((void*)it->first); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
957 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
958 _headers.clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
959 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
960 for (StringSet::iterator it = _defines.begin(); it != _defines.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
961 free((void*)*it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
962 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
963 _defines.clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
964 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
965 for (StringSet::iterator it = _include_dirs.begin(); it != _include_dirs.end(); it++) { |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
966 free((void*)*it); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
967 } |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
968 _include_dirs.clear(); |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
969 |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
970 return 0; |
ae4ef10e7535
(svn r16307) -Fix: makedepend can't handle the amount of files we have and it also miss some dependencies. That's why we introduce our custom implementation of makedepend.
glx <glx@openttd.org>
parents:
diff
changeset
|
971 } |