author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
111 files changed, 4259 insertions, 1883 deletions
diff --git a/qmake/Makefile b/qmake/Makefile index 90b0f07..01bb1a1 100644 --- a/qmake/Makefile +++ b/qmake/Makefile | |||
@@ -1,33 +1,33 @@ | |||
1 | QMAKESPECSDIR=$(OPIEDIR)/mkspecs | 1 | QMAKESPECSDIR=$(OPIEDIR)/mkspecs |
2 | 2 | ||
3 | ######################################################################## | 3 | ######################################################################## |
4 | ## This file was autogenerated by configure, all changes will be lost ## | 4 | ## This file was autogenerated by configure, all changes will be lost ## |
5 | ######################################################################## | 5 | ######################################################################## |
6 | CC = gcc | 6 | CC = gcc |
7 | CXX = g++ | 7 | CXX = g++ |
8 | 8 | ||
9 | #qmake code | 9 | #qmake code |
10 | OBJS=project.o main.o makefile.o unixmake2.o unixmake.o borland_bmake.o \ | 10 | OBJS=project.o main.o makefile.o unixmake2.o unixmake.o borland_bmake.o \ |
11 | msvc_nmake.o msvc_dsp.o msvc_vcproj.o option.o winmakefile.o \ | 11 | mingw_make.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o option.o winmakefile.o \ |
12 | projectgenerator.o metrowerks_xml.o pbuilder_pbx.o msvc_objectmodel.o | 12 | projectgenerator.o metrowerks_xml.o pbuilder_pbx.o msvc_objectmodel.o |
13 | 13 | ||
14 | #qt code | 14 | #qt code |
15 | QOBJS=qstring.o qtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o \ | 15 | QOBJS=qstring.o qtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o \ |
16 | qdatastream.o qgarray.o qbuffer.o qglist.o qptrcollection.o qfile.o \ | 16 | qdatastream.o qgarray.o qbuffer.o qglist.o qptrcollection.o qfile.o \ |
17 | qfile_unix.o qregexp.o qgvector.o qgcache.o qbitarray.o qdir.o \ | 17 | qfile_unix.o qregexp.o qgvector.o qgcache.o qbitarray.o qdir.o quuid.o \ |
18 | qfileinfo_unix.o qdir_unix.o qfileinfo.o qdatetime.o qstringlist.o qmap.o \ | 18 | qfileinfo_unix.o qdir_unix.o qfileinfo.o qdatetime.o qstringlist.o qmap.o \ |
19 | qconfig.o | 19 | qconfig.o |
20 | 20 | ||
21 | CFLAGS= \ | 21 | CFLAGS= \ |
22 | -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac \ | 22 | -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac \ |
23 | -I$(OPIEDIR)/qmake/include -I$(OPIEDIR)/qmake/include/qmake -I$(QMAKESPECSDIR)/default \ | 23 | -I$(OPIEDIR)/qmake/include -I$(OPIEDIR)/qmake/include/qmake -I$(QMAKESPECSDIR)/default \ |
24 | -I$(OPIEDIR)/qmake/include/private \ | 24 | -I$(OPIEDIR)/qmake/include/private \ |
25 | -DQT_NO_TEXTCODEC -DQT_LITE_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS | 25 | -DQT_NO_TEXTCODEC -DQT_LITE_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS |
26 | CXXFLAGS= $(CFLAGS) | 26 | CXXFLAGS= $(CFLAGS) |
27 | LFLAGS= | 27 | LFLAGS= |
28 | 28 | ||
29 | qmake: $(OBJS) $(QOBJS) | 29 | qmake: $(OBJS) $(QOBJS) |
30 | $(CXX) -o $@ $(OBJS) $(QOBJS) $(LFLAGS) | 30 | $(CXX) -o $@ $(OBJS) $(QOBJS) $(LFLAGS) |
31 | $(if $(OPIEDIR),rm -f $(OPIEDIR)/bin/$@) | 31 | $(if $(OPIEDIR),rm -f $(OPIEDIR)/bin/$@) |
32 | $(if $(OPIEDIR),ln -s ../qmake/$@ $(OPIEDIR)/bin/$@) | 32 | $(if $(OPIEDIR),ln -s ../qmake/$@ $(OPIEDIR)/bin/$@) |
33 | 33 | ||
@@ -85,32 +85,35 @@ qfile_unix.o: $(OPIEDIR)/qmake/tools/qfile_unix.cpp | |||
85 | 85 | ||
86 | qregexp.o: $(OPIEDIR)/qmake/tools/qregexp.cpp | 86 | qregexp.o: $(OPIEDIR)/qmake/tools/qregexp.cpp |
87 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qregexp.cpp | 87 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qregexp.cpp |
88 | 88 | ||
89 | qgvector.o: $(OPIEDIR)/qmake/tools/qgvector.cpp | 89 | qgvector.o: $(OPIEDIR)/qmake/tools/qgvector.cpp |
90 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qgvector.cpp | 90 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qgvector.cpp |
91 | 91 | ||
92 | qgcache.o: $(OPIEDIR)/qmake/tools/qgcache.cpp | 92 | qgcache.o: $(OPIEDIR)/qmake/tools/qgcache.cpp |
93 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qgcache.cpp | 93 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qgcache.cpp |
94 | 94 | ||
95 | qbitarray.o: $(OPIEDIR)/qmake/tools/qbitarray.cpp | 95 | qbitarray.o: $(OPIEDIR)/qmake/tools/qbitarray.cpp |
96 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qbitarray.cpp | 96 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qbitarray.cpp |
97 | 97 | ||
98 | qdir.o: $(OPIEDIR)/qmake/tools/qdir.cpp | 98 | qdir.o: $(OPIEDIR)/qmake/tools/qdir.cpp |
99 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdir.cpp | 99 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdir.cpp |
100 | 100 | ||
101 | quuid.o: $(OPIEDIR)/qmake/tools/quuid.cpp | ||
102 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/quuid.cpp | ||
103 | |||
101 | qfileinfo_unix.o: $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp | 104 | qfileinfo_unix.o: $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp |
102 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp | 105 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp |
103 | 106 | ||
104 | qdir_unix.o: $(OPIEDIR)/qmake/tools/qdir_unix.cpp | 107 | qdir_unix.o: $(OPIEDIR)/qmake/tools/qdir_unix.cpp |
105 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdir_unix.cpp | 108 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdir_unix.cpp |
106 | 109 | ||
107 | qfileinfo.o: $(OPIEDIR)/qmake/tools/qfileinfo.cpp | 110 | qfileinfo.o: $(OPIEDIR)/qmake/tools/qfileinfo.cpp |
108 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qfileinfo.cpp | 111 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qfileinfo.cpp |
109 | 112 | ||
110 | qdatetime.o: $(OPIEDIR)/qmake/tools/qdatetime.cpp | 113 | qdatetime.o: $(OPIEDIR)/qmake/tools/qdatetime.cpp |
111 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdatetime.cpp | 114 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qdatetime.cpp |
112 | 115 | ||
113 | qstringlist.o: $(OPIEDIR)/qmake/tools/qstringlist.cpp | 116 | qstringlist.o: $(OPIEDIR)/qmake/tools/qstringlist.cpp |
114 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qstringlist.cpp | 117 | $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/qstringlist.cpp |
115 | 118 | ||
116 | qmap.o: $(OPIEDIR)/qmake/tools/qmap.cpp | 119 | qmap.o: $(OPIEDIR)/qmake/tools/qmap.cpp |
@@ -130,32 +133,35 @@ main.o: main.cpp project.h | |||
130 | 133 | ||
131 | option.o: option.cpp option.h | 134 | option.o: option.cpp option.h |
132 | $(CXX) -c -o $@ $(CXXFLAGS) option.cpp | 135 | $(CXX) -c -o $@ $(CXXFLAGS) option.cpp |
133 | 136 | ||
134 | makefile.o: generators/makefile.cpp | 137 | makefile.o: generators/makefile.cpp |
135 | $(CXX) -c -o $@ $(CXXFLAGS) generators/makefile.cpp | 138 | $(CXX) -c -o $@ $(CXXFLAGS) generators/makefile.cpp |
136 | 139 | ||
137 | unixmake.o: generators/unix/unixmake.cpp | 140 | unixmake.o: generators/unix/unixmake.cpp |
138 | $(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake.cpp | 141 | $(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake.cpp |
139 | 142 | ||
140 | unixmake2.o: generators/unix/unixmake2.cpp | 143 | unixmake2.o: generators/unix/unixmake2.cpp |
141 | $(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake2.cpp | 144 | $(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake2.cpp |
142 | 145 | ||
143 | borland_bmake.o: generators/win32/borland_bmake.cpp | 146 | borland_bmake.o: generators/win32/borland_bmake.cpp |
144 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/borland_bmake.cpp | 147 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/borland_bmake.cpp |
145 | 148 | ||
149 | mingw_make.o: generators/win32/mingw_make.cpp | ||
150 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/mingw_make.cpp | ||
151 | |||
146 | msvc_objectmodel.o: generators/win32/msvc_objectmodel.cpp | 152 | msvc_objectmodel.o: generators/win32/msvc_objectmodel.cpp |
147 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp | 153 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp |
148 | 154 | ||
149 | msvc_vcproj.o: generators/win32/msvc_vcproj.cpp | 155 | msvc_vcproj.o: generators/win32/msvc_vcproj.cpp |
150 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_vcproj.cpp | 156 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_vcproj.cpp |
151 | 157 | ||
152 | msvc_nmake.o: generators/win32/msvc_nmake.cpp | 158 | msvc_nmake.o: generators/win32/msvc_nmake.cpp |
153 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_nmake.cpp | 159 | $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_nmake.cpp |
154 | 160 | ||
155 | metrowerks_xml.o: generators/mac/metrowerks_xml.cpp | 161 | metrowerks_xml.o: generators/mac/metrowerks_xml.cpp |
156 | $(CXX) -c -o $@ $(CXXFLAGS) generators/mac/metrowerks_xml.cpp | 162 | $(CXX) -c -o $@ $(CXXFLAGS) generators/mac/metrowerks_xml.cpp |
157 | 163 | ||
158 | pbuilder_pbx.o: generators/mac/pbuilder_pbx.cpp | 164 | pbuilder_pbx.o: generators/mac/pbuilder_pbx.cpp |
159 | $(CXX) -c -o $@ $(CXXFLAGS) generators/mac/pbuilder_pbx.cpp | 165 | $(CXX) -c -o $@ $(CXXFLAGS) generators/mac/pbuilder_pbx.cpp |
160 | 166 | ||
161 | msvc_dsp.o: generators/win32/msvc_dsp.cpp | 167 | msvc_dsp.o: generators/win32/msvc_dsp.cpp |
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f490313..c12375d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
@@ -46,67 +46,81 @@ | |||
46 | #include <unistd.h> | 46 | #include <unistd.h> |
47 | #else | 47 | #else |
48 | #include <io.h> | 48 | #include <io.h> |
49 | #endif | 49 | #endif |
50 | #include <stdio.h> | 50 | #include <stdio.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <time.h> | 52 | #include <time.h> |
53 | #include <fcntl.h> | 53 | #include <fcntl.h> |
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
56 | 56 | ||
57 | // Well, Windows doesn't have this, so here's the macro | 57 | // Well, Windows doesn't have this, so here's the macro |
58 | #ifndef S_ISDIR | 58 | #ifndef S_ISDIR |
59 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) | 59 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | static QString mkdir_p_asstring(const QString &dir) | ||
63 | { | ||
64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; | ||
65 | if(Option::target_mode == Option::TARG_WIN_MODE) | ||
66 | ret += "$(MKDIR)"; | ||
67 | else | ||
68 | ret += "|| $(MKDIR)"; | ||
69 | ret += " \"" + dir + "\""; | ||
70 | return ret; | ||
71 | } | ||
72 | |||
62 | static bool createDir(const QString& fullPath) | 73 | static bool createDir(const QString& fullPath) |
63 | { | 74 | { |
75 | if(QFile::exists(fullPath)) | ||
76 | return FALSE; | ||
77 | |||
64 | QDir dirTmp; | 78 | QDir dirTmp; |
65 | bool ret = TRUE; | 79 | bool ret = TRUE; |
66 | QString pathComponent, tmpPath; | 80 | QString pathComponent, tmpPath; |
67 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); | 81 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); |
68 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { | 82 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { |
69 | pathComponent = *it + QDir::separator(); | 83 | pathComponent = *it + QDir::separator(); |
70 | tmpPath += pathComponent; | 84 | tmpPath += pathComponent; |
71 | if(!dirTmp.mkdir(tmpPath)) { | 85 | if(!dirTmp.mkdir(tmpPath)) { |
72 | ret = FALSE; | 86 | ret = FALSE; |
73 | // break; | 87 | // break; |
74 | } | 88 | } |
75 | } | 89 | } |
76 | return ret; | 90 | return ret; |
77 | } | 91 | } |
78 | 92 | ||
79 | 93 | ||
80 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), | 94 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), |
81 | init_already(FALSE), moc_aware(FALSE), | 95 | init_already(FALSE), moc_aware(FALSE), |
82 | no_io(FALSE), project(p) | 96 | no_io(FALSE), project(p) |
83 | { | 97 | { |
84 | } | 98 | } |
85 | 99 | ||
86 | static char *gimme_buffer(off_t s) | 100 | static char *gimme_buffer(off_t s) |
87 | { | 101 | { |
88 | static char *big_buffer = NULL; | 102 | static char *big_buffer = NULL; |
89 | static int big_buffer_size = 0; | 103 | static int big_buffer_size = 0; |
90 | if(!big_buffer || big_buffer_size < s) | 104 | if(!big_buffer || big_buffer_size < s) |
91 | big_buffer = (char *)realloc(big_buffer, s); | 105 | big_buffer = (char *)realloc(big_buffer, s); |
92 | return big_buffer; | 106 | return big_buffer; |
93 | } | 107 | } |
94 | 108 | ||
95 | bool | 109 | bool |
96 | MakefileGenerator::generateMocList(QString fn_target) | 110 | MakefileGenerator::generateMocList(const QString &fn_target) |
97 | { | 111 | { |
98 | if(!findMocDestination(fn_target).isEmpty()) | 112 | if(!findMocDestination(fn_target).isEmpty()) |
99 | return TRUE; | 113 | return TRUE; |
100 | 114 | ||
101 | QString fn_local = Option::fixPathToLocalOS(fileFixify(fn_target, QDir::currentDirPath(), Option::output_dir)); | 115 | QString fn_local = Option::fixPathToLocalOS(fileFixify(fn_target, QDir::currentDirPath(), Option::output_dir)); |
102 | 116 | ||
103 | int file = open(fn_local.latin1(), O_RDONLY); | 117 | int file = open(fn_local.latin1(), O_RDONLY); |
104 | if(file == -1) | 118 | if(file == -1) |
105 | return FALSE; | 119 | return FALSE; |
106 | 120 | ||
107 | struct stat fst; | 121 | struct stat fst; |
108 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) | 122 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) |
109 | return FALSE; //shouldn't happen | 123 | return FALSE; //shouldn't happen |
110 | char *big_buffer = gimme_buffer(fst.st_size); | 124 | char *big_buffer = gimme_buffer(fst.st_size); |
111 | 125 | ||
112 | int total_size_read; | 126 | int total_size_read; |
@@ -160,91 +174,92 @@ MakefileGenerator::generateMocList(QString fn_target) | |||
160 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); | 174 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); |
161 | if(interesting) { | 175 | if(interesting) { |
162 | int len = 0; | 176 | int len = 0; |
163 | if(!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN)) { | 177 | if(!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN)) { |
164 | if(ignore_qobject) { | 178 | if(ignore_qobject) { |
165 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); | 179 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); |
166 | interesting = FALSE; | 180 | interesting = FALSE; |
167 | } | 181 | } |
168 | len=OBJ_LEN; | 182 | len=OBJ_LEN; |
169 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { | 183 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { |
170 | len=DIS_LEN; | 184 | len=DIS_LEN; |
171 | } | 185 | } |
172 | if(SYMBOL_CHAR(*(big_buffer+x+len))) | 186 | if(SYMBOL_CHAR(*(big_buffer+x+len))) |
173 | interesting = FALSE; | 187 | interesting = FALSE; |
174 | if(interesting) { | 188 | if(interesting) { |
175 | *(big_buffer+x+len) = '\0'; | 189 | *(big_buffer+x+len) = '\0'; |
176 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), line_count, big_buffer+x); | 190 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), |
191 | line_count, big_buffer+x); | ||
177 | 192 | ||
178 | int ext_pos = fn_target.findRev('.'); | 193 | int ext_pos = fn_target.findRev('.'); |
179 | int ext_len = fn_target.length() - ext_pos; | 194 | int ext_len = fn_target.length() - ext_pos; |
180 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); | 195 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); |
181 | QString mocFile; | 196 | QString mocFile; |
182 | if(!project->isEmpty("MOC_DIR")) | 197 | if(!project->isEmpty("MOC_DIR")) |
183 | mocFile = project->first("MOC_DIR"); | 198 | mocFile = project->first("MOC_DIR"); |
184 | else if(dir_pos != -1) | 199 | else if(dir_pos != -1) |
185 | mocFile = fn_target.left(dir_pos+1); | 200 | mocFile = fn_target.left(dir_pos+1); |
186 | 201 | ||
187 | bool cpp_ext = FALSE; | 202 | bool cpp_ext = FALSE; |
188 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | 203 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
204 | cppit != Option::cpp_ext.end(); ++cppit) { | ||
189 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) | 205 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) |
190 | break; | 206 | break; |
191 | } | 207 | } |
192 | if(cpp_ext) { | 208 | if(cpp_ext) { |
193 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; | 209 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; |
194 | findDependencies(fn_target).append(mocFile); | ||
195 | project->variables()["_SRCMOC"].append(mocFile); | 210 | project->variables()["_SRCMOC"].append(mocFile); |
196 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { | 211 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { |
197 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 212 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
213 | hit != Option::h_ext.end(); ++hit) { | ||
198 | if((fn_target.right(ext_len) == (*hit))) { | 214 | if((fn_target.right(ext_len) == (*hit))) { |
199 | mocFile += Option::moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + | 215 | mocFile += Option::moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + |
200 | Option::cpp_ext.first(); | 216 | Option::cpp_ext.first(); |
201 | logicWarn(mocFile, "SOURCES"); | 217 | logicWarn(mocFile, "SOURCES"); |
202 | project->variables()["_HDRMOC"].append(mocFile); | 218 | project->variables()["_HDRMOC"].append(mocFile); |
203 | break; | 219 | break; |
204 | } | 220 | } |
205 | } | 221 | } |
206 | } | 222 | } |
207 | 223 | ||
208 | if(!mocFile.isEmpty()) { | 224 | if(!mocFile.isEmpty()) { |
209 | mocFile = Option::fixPathToTargetOS(mocFile); | 225 | mocFile = Option::fixPathToTargetOS(mocFile); |
210 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; | 226 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; |
211 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; | 227 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; |
212 | } | 228 | } |
213 | break; | 229 | break; |
214 | } | 230 | } |
215 | } | 231 | } |
216 | 232 | ||
217 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) | 233 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) |
218 | x++; | 234 | x++; |
219 | if(*(big_buffer+x) == '\n') | 235 | if(*(big_buffer+x) == '\n') |
220 | line_count++; | 236 | line_count++; |
221 | } | 237 | } |
222 | #undef OBJ_LEN | 238 | #undef OBJ_LEN |
223 | #undef DIS_LEN | 239 | #undef DIS_LEN |
224 | return TRUE; | 240 | return TRUE; |
225 | } | 241 | } |
226 | 242 | ||
227 | bool | 243 | bool |
228 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QString fn, bool recurse) | 244 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) |
229 | { | 245 | { |
230 | fn = fileFixify(fn); | 246 | QStringList &fndeps = findDependencies(f); |
231 | QStringList &fndeps = findDependencies(fn); | ||
232 | if(!fndeps.isEmpty()) | 247 | if(!fndeps.isEmpty()) |
233 | return TRUE; | 248 | return TRUE; |
234 | 249 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); | |
235 | fn = Option::fixPathToLocalOS(fn, FALSE); | 250 | fn = Option::fixPathToLocalOS(fn, FALSE); |
236 | QString fix_env_fn = Option::fixPathToLocalOS(fn); | 251 | QString fix_env_fn = Option::fixPathToLocalOS(fn); |
237 | int file = open(fix_env_fn.latin1(), O_RDONLY); | 252 | int file = open(fix_env_fn.latin1(), O_RDONLY); |
238 | if(file == -1) | 253 | if(file == -1) |
239 | return FALSE; | 254 | return FALSE; |
240 | struct stat fst; | 255 | struct stat fst; |
241 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) | 256 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) |
242 | return FALSE; //shouldn't happen | 257 | return FALSE; //shouldn't happen |
243 | 258 | ||
244 | QString fndir, fix_env_fndir; | 259 | QString fndir, fix_env_fndir; |
245 | int dl = fn.findRev(Option::dir_sep); | 260 | int dl = fn.findRev(Option::dir_sep); |
246 | if(dl != -1) | 261 | if(dl != -1) |
247 | fndir = fn.left(dl+1); | 262 | fndir = fn.left(dl+1); |
248 | dl = fix_env_fn.findRev(Option::dir_sep); | 263 | dl = fix_env_fn.findRev(Option::dir_sep); |
249 | if(dl != -1) | 264 | if(dl != -1) |
250 | fix_env_fndir = fix_env_fn.left(dl + 1); | 265 | fix_env_fndir = fix_env_fn.left(dl + 1); |
@@ -275,34 +290,36 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
275 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { | 290 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { |
276 | x += 2; | 291 | x += 2; |
277 | break; | 292 | break; |
278 | } | 293 | } |
279 | } else if(*(big_buffer + x) == '\n') { | 294 | } else if(*(big_buffer + x) == '\n') { |
280 | line_count++; | 295 | line_count++; |
281 | } | 296 | } |
282 | } | 297 | } |
283 | } | 298 | } |
284 | } | 299 | } |
285 | } | 300 | } |
286 | if(*(big_buffer + x) == '#') { | 301 | if(*(big_buffer + x) == '#') { |
287 | x++; | 302 | x++; |
288 | while(x < total_size_read && //Skip spaces after hash | 303 | while(x < total_size_read && //Skip spaces after hash |
289 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 304 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
290 | x++; | 305 | x++; |
291 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include ", 8)) { | 306 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
292 | for(x+=8; //skip spaces after keyword | 307 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || |
308 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { | ||
309 | for(x+=7; //skip spaces after keyword | ||
293 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 310 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
294 | x++); | 311 | x++); |
295 | char term = *(big_buffer + x); | 312 | char term = *(big_buffer + x); |
296 | if(term == '"'); | 313 | if(term == '"'); |
297 | else if(term == '<') | 314 | else if(term == '<') |
298 | term = '>'; | 315 | term = '>'; |
299 | else | 316 | else |
300 | continue; //wtf? | 317 | continue; //wtf? |
301 | x++; | 318 | x++; |
302 | 319 | ||
303 | int inc_len; | 320 | int inc_len; |
304 | for(inc_len = 0; *(big_buffer + x + inc_len) != term; inc_len++); | 321 | for(inc_len = 0; *(big_buffer + x + inc_len) != term; inc_len++); |
305 | *(big_buffer + x + inc_len) = '\0'; | 322 | *(big_buffer + x + inc_len) = '\0'; |
306 | inc = big_buffer + x; | 323 | inc = big_buffer + x; |
307 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { | 324 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { |
308 | for(x+=14; //skip spaces after keyword | 325 | for(x+=14; //skip spaces after keyword |
@@ -315,202 +332,256 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
315 | term = '\''; | 332 | term = '\''; |
316 | if(term != '\n') | 333 | if(term != '\n') |
317 | x++; | 334 | x++; |
318 | 335 | ||
319 | int msg_len; | 336 | int msg_len; |
320 | for(msg_len = 0; *(big_buffer + x + msg_len) != term; msg_len++); | 337 | for(msg_len = 0; *(big_buffer + x + msg_len) != term; msg_len++); |
321 | *(big_buffer + x + msg_len) = '\0'; | 338 | *(big_buffer + x + msg_len) = '\0'; |
322 | QString msg = big_buffer + x; | 339 | QString msg = big_buffer + x; |
323 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), | 340 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), |
324 | line_count, msg.latin1()); | 341 | line_count, msg.latin1()); |
325 | *(big_buffer + x + msg_len) = term; //put it back | 342 | *(big_buffer + x + msg_len) = term; //put it back |
326 | } | 343 | } |
327 | } | 344 | } |
328 | } else if(ui_file) { | 345 | } else if(ui_file) { |
329 | // skip whitespaces | 346 | // skip whitespaces |
330 | while(x < total_size_read && | 347 | while(x < total_size_read && |
331 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 348 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
332 | x++; | 349 | x++; |
333 | if(*(big_buffer + x) == '<') { | 350 | if(*(big_buffer + x) == '<') { |
334 | x++; | 351 | x++; |
335 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && | 352 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && |
336 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { | 353 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { |
337 | for(x += 12; *(big_buffer + x) != '>'; x++); | 354 | for(x += 12; *(big_buffer + x) != '>'; x++); |
338 | int inc_len = 0; | 355 | int inc_len = 0; |
339 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | 356 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); |
340 | *(big_buffer + x + inc_len) = '\0'; | 357 | *(big_buffer + x + inc_len) = '\0'; |
341 | inc = big_buffer + x; | 358 | inc = big_buffer + x; |
342 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && | 359 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
343 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { | 360 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { |
344 | for(x += 8; *(big_buffer + x) != '>'; x++) { | 361 | for(x += 8; *(big_buffer + x) != '>'; x++) { |
345 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && | 362 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && |
346 | !strncmp(big_buffer + x, "impldecl", 8)) { | 363 | !strncmp(big_buffer + x, "impldecl", 8)) { |
347 | for(x += 8; *(big_buffer + x) != '='; x++); | 364 | for(x += 8; *(big_buffer + x) != '='; x++); |
348 | if(*(big_buffer + x) != '=') | 365 | if(*(big_buffer + x) != '=') |
349 | continue; | 366 | continue; |
350 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); | 367 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); |
351 | char quote = 0; | 368 | char quote = 0; |
352 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { | 369 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { |
353 | quote = *(big_buffer + x); | 370 | quote = *(big_buffer + x); |
354 | x++; | 371 | x++; |
355 | } | 372 | } |
356 | int val_len; | 373 | int val_len; |
357 | for(val_len = 0; TRUE; val_len++) { | 374 | for(val_len = 0; TRUE; val_len++) { |
358 | if(quote) { | 375 | if(quote) { |
359 | if(*(big_buffer+x+val_len) == quote) | 376 | if(*(big_buffer+x+val_len) == quote) |
360 | break; | 377 | break; |
361 | } else if(*(big_buffer + x + val_len) == '>' || | 378 | } else if(*(big_buffer + x + val_len) == '>' || |
362 | *(big_buffer + x + val_len) == ' ') { | 379 | *(big_buffer + x + val_len) == ' ') { |
363 | break; | 380 | break; |
364 | } | 381 | } |
365 | } | 382 | } |
366 | char saved = *(big_buffer + x + val_len); | 383 | char saved = *(big_buffer + x + val_len); |
367 | *(big_buffer + x + val_len) = '\0'; | 384 | *(big_buffer + x + val_len) = '\0'; |
368 | QString where = big_buffer + x; | 385 | QString where = big_buffer + x; |
369 | *(big_buffer + x + val_len) = saved; | 386 | *(big_buffer + x + val_len) = saved; |
370 | if(where == "in implementation") { | 387 | if(where == "in implementation") { |
371 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + | 388 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + |
372 | Option::cpp_ext.first(); | 389 | Option::cpp_ext.first(); |
373 | outdeps = &findDependencies(cpp); | 390 | outdeps = &findDependencies(cpp); |
374 | } | 391 | } |
375 | } | 392 | } |
376 | } | 393 | } |
377 | int inc_len = 0; | 394 | int inc_len = 0; |
378 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | 395 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); |
379 | *(big_buffer + x + inc_len) = '\0'; | 396 | *(big_buffer + x + inc_len) = '\0'; |
380 | inc = big_buffer + x; | 397 | inc = big_buffer + x; |
381 | } | 398 | } |
382 | } | 399 | } |
383 | } | 400 | } |
384 | 401 | ||
385 | if(!inc.isEmpty()) { | 402 | if(!inc.isEmpty()) { |
403 | bool from_source_dir = TRUE; | ||
386 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), | 404 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), |
387 | line_count, inc.latin1()); | 405 | line_count, inc.latin1()); |
388 | if(!project->isEmpty("SKIP_DEPENDS")) { | 406 | if(!project->isEmpty("SKIP_DEPENDS")) { |
389 | bool found = FALSE; | 407 | bool found = FALSE; |
390 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); | 408 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); |
391 | for(QStringList::Iterator it = nodeplist.begin(); | 409 | for(QStringList::Iterator it = nodeplist.begin(); |
392 | it != nodeplist.end(); ++it) { | 410 | it != nodeplist.end(); ++it) { |
393 | QRegExp regx((*it)); | 411 | QRegExp regx((*it)); |
394 | if(regx.search(inc) != -1) { | 412 | if(regx.search(inc) != -1) { |
395 | found = TRUE; | 413 | found = TRUE; |
396 | break; | 414 | break; |
397 | } | 415 | } |
398 | } | 416 | } |
399 | if(found) | 417 | if(found) |
400 | continue; | 418 | continue; |
401 | } | 419 | } |
402 | 420 | ||
403 | QString fqn; | 421 | QString fqn; |
404 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && | 422 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && |
405 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { | 423 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { |
406 | fqn = fndir + inc; | 424 | fqn = fndir + inc; |
425 | goto handle_fqn; | ||
407 | } else { | 426 | } else { |
408 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || | 427 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || |
409 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || | 428 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || |
410 | ((Option::target_mode == Option::TARG_UNIX_MODE || | 429 | ((Option::target_mode == Option::TARG_UNIX_MODE || |
411 | Option::target_mode == Option::TARG_QNX6_MODE || | 430 | Option::target_mode == Option::TARG_QNX6_MODE || |
412 | Option::target_mode == Option::TARG_MACX_MODE) && | 431 | Option::target_mode == Option::TARG_MACX_MODE) && |
413 | inc[0] != '/')) { | 432 | inc[0] != '/')) { |
414 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 433 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
415 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && | 434 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && |
416 | !S_ISDIR(fst.st_mode)) { | 435 | !S_ISDIR(fst.st_mode)) { |
417 | fqn = mdd->real_dir + QDir::separator() + inc; | 436 | fqn = mdd->real_dir + QDir::separator() + inc; |
418 | break; | 437 | goto handle_fqn; |
419 | } | 438 | } |
420 | } | 439 | } |
421 | } | 440 | } |
422 | } | 441 | } |
423 | if(fqn.isEmpty()) { | 442 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { |
424 | //these are some hacky heuristics it will try to do on an include | 443 | //these are some hacky heuristics it will try to do on an include |
425 | //however these can be turned off at runtime, I'm not sure how | 444 | //however these can be turned off at runtime, I'm not sure how |
426 | //reliable these will be, most likely when problems arise turn it off | 445 | //reliable these will be, most likely when problems arise turn it off |
427 | //and see if they go away.. | 446 | //and see if they go away.. |
428 | if(Option::mkfile::do_dep_heuristics && depHeuristics.contains(inc)) { | 447 | if(depHeuristics.contains(inc)) { |
429 | fqn = depHeuristics[inc]; | 448 | fqn = depHeuristics[inc]; |
430 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. | 449 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. |
431 | //is it a file from a .ui? | 450 | //is it a file from a .ui? |
432 | QString inc_file = inc.section(Option::dir_sep, -1); | 451 | QString inc_file = inc.section(Option::dir_sep, -1); |
433 | int extn = inc_file.findRev('.'); | 452 | int extn = inc_file.findRev('.'); |
434 | if(extn != -1 && | 453 | if(extn != -1 && |
435 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || | 454 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || |
436 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { | 455 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { |
437 | QString uip = inc_file.left(extn) + Option::ui_ext; | 456 | QString uip = inc_file.left(extn) + Option::ui_ext; |
438 | QStringList uil = project->variables()["FORMS"]; | 457 | QStringList uil = project->variables()["FORMS"]; |
439 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { | 458 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { |
440 | if((*it).section(Option::dir_sep, -1) == uip) { | 459 | if((*it).section(Option::dir_sep, -1) == uip) { |
441 | if(!project->isEmpty("UI_DIR")) | 460 | if(!project->isEmpty("UI_DIR")) |
442 | fqn = project->first("UI_DIR"); | 461 | fqn = project->first("UI_DIR"); |
443 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 462 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
444 | fqn = project->first("UI_HEADERS_DIR"); | 463 | fqn = project->first("UI_HEADERS_DIR"); |
445 | else | 464 | else |
446 | fqn = (*it).section(Option::dir_sep, 0, -2); | 465 | fqn = (*it).section(Option::dir_sep, 0, -2); |
447 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) | 466 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) |
448 | fqn += Option::dir_sep; | 467 | fqn += Option::dir_sep; |
449 | fqn += inc_file; | 468 | fqn += inc_file; |
450 | break; | 469 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
470 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
471 | goto handle_fqn; | ||
472 | } | ||
473 | } | ||
474 | } | ||
475 | if(project->isActiveConfig("lex_included")) { //is this the lex file? | ||
476 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); | ||
477 | if(inc.endsWith(rhs)) { | ||
478 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; | ||
479 | QStringList ll = project->variables()["LEXSOURCES"]; | ||
480 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { | ||
481 | QString s = (*it), d; | ||
482 | int slsh = s.findRev(Option::dir_sep); | ||
483 | if(slsh != -1) { | ||
484 | d = s.left(slsh + 1); | ||
485 | s = s.right(s.length() - slsh - 1); | ||
486 | } | ||
487 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | ||
488 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | ||
489 | if(s == lhs) { | ||
490 | fqn = d + inc; | ||
491 | goto handle_fqn; | ||
492 | } | ||
451 | } | 493 | } |
452 | } | 494 | } |
453 | } | 495 | } |
454 | if(fqn.isEmpty()) { //is it from a .y? | 496 | { //is it from a .y? |
455 | QString rhs = Option::yacc_mod + Option::h_ext.first(); | 497 | QString rhs = Option::yacc_mod + Option::h_ext.first(); |
456 | if(inc.endsWith(rhs)) { | 498 | if(inc.endsWith(rhs)) { |
457 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; | 499 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; |
458 | QStringList yl = project->variables()["YACCSOURCES"]; | 500 | QStringList yl = project->variables()["YACCSOURCES"]; |
459 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { | 501 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { |
460 | QString s = (*it), d; | 502 | QString s = (*it), d; |
461 | int slsh = s.findRev(Option::dir_sep); | 503 | int slsh = s.findRev(Option::dir_sep); |
462 | if(slsh != -1) { | 504 | if(slsh != -1) { |
463 | d = s.left(slsh + 1); | 505 | d = s.left(slsh + 1); |
464 | s = s.right(s.length() - slsh - 1); | 506 | s = s.right(s.length() - slsh - 1); |
465 | } | 507 | } |
466 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 508 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
467 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | 509 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); |
468 | if(s == lhs) { | 510 | if(s == lhs) { |
469 | fqn = d + inc; | 511 | fqn = d + inc; |
470 | break; | 512 | goto handle_fqn; |
513 | } | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | if(mocAware() && //is it a moc file? | ||
518 | (inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::moc_ext))) { | ||
519 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; | ||
520 | for(int moc = 0; !mocs[moc].isNull(); moc++) { | ||
521 | QStringList &l = project->variables()[mocs[moc]]; | ||
522 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
523 | QString file = Option::fixPathToTargetOS((*it)); | ||
524 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { | ||
525 | fqn = (*it); | ||
526 | if(mocs[moc] == "_HDRMOC") { | ||
527 | //Since it is include, no need to link it in as well | ||
528 | project->variables()["_SRCMOC"].append((*it)); | ||
529 | l.remove(it); | ||
530 | } else if(!findMocSource(fqn).endsWith(fn)) { | ||
531 | /* Not really a very good test, but this will at least avoid | ||
532 | confusion if it really does happen (since tmake/qmake | ||
533 | previously didn't even allow this the test is mostly accurate) */ | ||
534 | warn_msg(WarnLogic, | ||
535 | "Found potential multiple MOC include %s (%s) in '%s'", | ||
536 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); | ||
537 | } | ||
538 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) | ||
539 | goto handle_fqn; | ||
471 | } | 540 | } |
472 | } | 541 | } |
473 | } | 542 | } |
474 | } | 543 | } |
475 | depHeuristics.insert(inc, fqn); | 544 | depHeuristics.insert(inc, fqn); |
476 | } | 545 | } |
477 | if(!Option::mkfile::do_dep_heuristics || fqn.isEmpty()) //I give up | ||
478 | continue; | ||
479 | } | 546 | } |
480 | 547 | handle_fqn: | |
481 | fqn = fileFixify(Option::fixPathToTargetOS(fqn, FALSE)); | 548 | if(fqn.isEmpty()) //I give up |
482 | debug_msg(4, "Resolved dependancy of %s to %s", inc.latin1(), fqn.latin1()); | 549 | continue; |
550 | fqn = Option::fixPathToTargetOS(fqn, FALSE); | ||
551 | if(from_source_dir) | ||
552 | fqn = fileFixify(fqn); | ||
553 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); | ||
483 | if(outdeps && outdeps->findIndex(fqn) == -1) | 554 | if(outdeps && outdeps->findIndex(fqn) == -1) |
484 | outdeps->append(fqn); | 555 | outdeps->append(fqn); |
485 | } | 556 | } |
486 | //read past new line now.. | 557 | //read past new line now.. |
487 | for( ; x < total_size_read && (*(big_buffer + x) != '\n'); x++); | 558 | for( ; x < total_size_read && (*(big_buffer + x) != '\n'); x++); |
488 | line_count++; | 559 | line_count++; |
489 | } | 560 | } |
490 | 561 | ||
491 | if(recurse) { | 562 | if(recurse) { |
492 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { | 563 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { |
493 | generateDependencies(dirs, (*fnit), recurse); | 564 | generateDependencies(dirs, (*fnit), recurse); |
494 | QStringList &deplist = findDependencies((*fnit)); | 565 | QStringList &deplist = findDependencies((*fnit)); |
495 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) | 566 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) |
496 | if(fndeps.findIndex((*it)) == -1) | 567 | if(fndeps.findIndex((*it)) == -1) |
497 | fndeps.append((*it)); | 568 | fndeps.append((*it)); |
498 | } | 569 | } |
499 | } | 570 | } |
500 | debug_msg(2, "Dependancies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); | 571 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); |
501 | return TRUE; | 572 | return TRUE; |
502 | } | 573 | } |
503 | 574 | ||
504 | void | 575 | void |
505 | MakefileGenerator::initOutPaths() | 576 | MakefileGenerator::initOutPaths() |
506 | { | 577 | { |
507 | if(init_opath_already) | 578 | if(init_opath_already) |
508 | return; | 579 | return; |
509 | init_opath_already = TRUE; | 580 | init_opath_already = TRUE; |
510 | QMap<QString, QStringList> &v = project->variables(); | 581 | QMap<QString, QStringList> &v = project->variables(); |
511 | if(!v.contains("QMAKE_ABSOLUTE_SOURCE_PATH")) { | 582 | if(!v.contains("QMAKE_ABSOLUTE_SOURCE_PATH")) { |
512 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && | 583 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && |
513 | v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { | 584 | v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { |
514 | QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); | 585 | QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); |
515 | root = Option::fixPathToTargetOS( root ); | 586 | root = Option::fixPathToTargetOS( root ); |
516 | if(!root.isEmpty()) { | 587 | if(!root.isEmpty()) { |
@@ -600,48 +671,52 @@ MakefileGenerator::init() | |||
600 | if(init_already) | 671 | if(init_already) |
601 | return; | 672 | return; |
602 | init_already = TRUE; | 673 | init_already = TRUE; |
603 | 674 | ||
604 | QMap<QString, QStringList> &v = project->variables(); | 675 | QMap<QString, QStringList> &v = project->variables(); |
605 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), | 676 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), |
606 | QString("HEADERS"), QString("HEADERS_ORIG"), | 677 | QString("HEADERS"), QString("HEADERS_ORIG"), |
607 | QString("LEXSOURCES"), QString("QMAKE_INTERNAL_INCLUDED_FILES"), QString::null }; | 678 | QString("LEXSOURCES"), QString("QMAKE_INTERNAL_INCLUDED_FILES"), QString::null }; |
608 | for(int y = 0; paths[y] != QString::null; y++) { | 679 | for(int y = 0; paths[y] != QString::null; y++) { |
609 | QStringList &l = v[paths[y]]; | 680 | QStringList &l = v[paths[y]]; |
610 | if(!l.isEmpty()) | 681 | if(!l.isEmpty()) |
611 | l = fileFixify(l); | 682 | l = fileFixify(l); |
612 | } | 683 | } |
613 | 684 | ||
614 | /* get deps and mocables */ | 685 | /* get deps and mocables */ |
615 | QDict<void> cache_found_files; | 686 | QDict<void> cache_found_files; |
616 | QString cache_file(Option::output_dir + QDir::separator() + ".qmake.internal.cache"); | 687 | QString cache_file(".qmake.internal.cache"); |
688 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) | ||
689 | cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); | ||
690 | if(cache_file.find(QDir::separator()) == -1) //guess they know what they are doing.. | ||
691 | cache_file.prepend(Option::output_dir + QDir::separator()); | ||
617 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | 692 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || |
618 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { | 693 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { |
619 | QPtrList<MakefileDependDir> deplist; | 694 | QPtrList<MakefileDependDir> deplist; |
620 | deplist.setAutoDelete(TRUE); | 695 | deplist.setAutoDelete(TRUE); |
621 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || Option::mkfile::do_deps) && | 696 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || Option::mkfile::do_deps) && |
622 | doDepends()) { | 697 | doDepends()) { |
623 | QStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; | 698 | QStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; |
624 | if(project->isActiveConfig("depend_includepath")) | 699 | if(project->isActiveConfig("depend_includepath")) |
625 | incDirs += v["INCLUDEPATH"]; | 700 | incDirs += v["INCLUDEPATH"]; |
626 | for(QStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) { | 701 | for(QStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) { |
627 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); | 702 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); |
628 | deplist.append(new MakefileDependDir(r.replace("\"",""), | 703 | deplist.append(new MakefileDependDir(r.replace("\"",""), |
629 | l.replace("\"",""))); | 704 | l.replace("\"",""))); |
630 | } | 705 | } |
631 | debug_msg(1, "Dependancy Directories: %s", incDirs.join(" :: ").latin1()); | 706 | debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").latin1()); |
632 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { | 707 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { |
633 | QFile cachef(cache_file); | 708 | QFile cachef(cache_file); |
634 | if(cachef.open(IO_ReadOnly | IO_Translate)) { | 709 | if(cachef.open(IO_ReadOnly | IO_Translate)) { |
635 | QFileInfo cachefi(cache_file); | 710 | QFileInfo cachefi(cache_file); |
636 | debug_msg(2, "Trying internal cache information: %s", cache_file.latin1()); | 711 | debug_msg(2, "Trying internal cache information: %s", cache_file.latin1()); |
637 | QTextStream cachet(&cachef); | 712 | QTextStream cachet(&cachef); |
638 | QString line, file; | 713 | QString line, file; |
639 | enum { CacheInfo, CacheDepend, CacheMoc } state = CacheInfo; | 714 | enum { CacheInfo, CacheDepend, CacheMoc } state = CacheInfo; |
640 | while (!cachet.eof()) { | 715 | while (!cachet.eof()) { |
641 | line = cachet.readLine().stripWhiteSpace(); | 716 | line = cachet.readLine().stripWhiteSpace(); |
642 | int sep = line.find('='); | 717 | int sep = line.find('='); |
643 | if(line == "[depend]") { | 718 | if(line == "[depend]") { |
644 | state = CacheDepend; | 719 | state = CacheDepend; |
645 | } else if(line == "[mocable]") { | 720 | } else if(line == "[mocable]") { |
646 | state = CacheMoc; | 721 | state = CacheMoc; |
647 | } else if(line == "[check]") { | 722 | } else if(line == "[check]") { |
@@ -670,33 +745,33 @@ MakefileGenerator::init() | |||
670 | } | 745 | } |
671 | if(found) { | 746 | if(found) { |
672 | for(QStringList::Iterator dep_it = files.begin(); | 747 | for(QStringList::Iterator dep_it = files.begin(); |
673 | dep_it != files.end(); ++dep_it) { | 748 | dep_it != files.end(); ++dep_it) { |
674 | if(!cache_found_files[(*dep_it)]) { | 749 | if(!cache_found_files[(*dep_it)]) { |
675 | QFileInfo fi(fileFixify((*dep_it), QDir::currentDirPath(), Option::output_dir)); | 750 | QFileInfo fi(fileFixify((*dep_it), QDir::currentDirPath(), Option::output_dir)); |
676 | if(fi.exists() && | 751 | if(fi.exists() && |
677 | fi.lastModified() < cachefi.lastModified()) { | 752 | fi.lastModified() < cachefi.lastModified()) { |
678 | cache_found_files.insert((*dep_it), (void *)1); | 753 | cache_found_files.insert((*dep_it), (void *)1); |
679 | } else { | 754 | } else { |
680 | found = FALSE; | 755 | found = FALSE; |
681 | break; | 756 | break; |
682 | } | 757 | } |
683 | } | 758 | } |
684 | } | 759 | } |
685 | if(found) { | 760 | if(found) { |
686 | debug_msg(2, "Dependancies (cached): %s -> %s", file.latin1(), | 761 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), |
687 | files.join(" :: ").latin1()); | 762 | files.join(" :: ").latin1()); |
688 | findDependencies(file) = files; | 763 | findDependencies(file) = files; |
689 | } | 764 | } |
690 | } | 765 | } |
691 | } else { | 766 | } else { |
692 | void *found = cache_found_files[file]; | 767 | void *found = cache_found_files[file]; |
693 | if(found != (void *)2) { | 768 | if(found != (void *)2) { |
694 | if(found) { | 769 | if(found) { |
695 | cache_found_files.replace(file, (void *)2); | 770 | cache_found_files.replace(file, (void *)2); |
696 | } else { | 771 | } else { |
697 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); | 772 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); |
698 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { | 773 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { |
699 | cache_found_files.insert(file, (void *)2); | 774 | cache_found_files.insert(file, (void *)2); |
700 | found = (void*)1; | 775 | found = (void*)1; |
701 | } | 776 | } |
702 | } | 777 | } |
@@ -730,147 +805,158 @@ MakefileGenerator::init() | |||
730 | } | 805 | } |
731 | cachef.close(); | 806 | cachef.close(); |
732 | } | 807 | } |
733 | } | 808 | } |
734 | } | 809 | } |
735 | if(!noIO()) { | 810 | if(!noIO()) { |
736 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), | 811 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), |
737 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), | 812 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), |
738 | QString::null }; | 813 | QString::null }; |
739 | depHeuristics.clear(); | 814 | depHeuristics.clear(); |
740 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); | 815 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); |
741 | for(int x = 0; sources[x] != QString::null; x++) { | 816 | for(int x = 0; sources[x] != QString::null; x++) { |
742 | QStringList vpath, &l = v[sources[x]]; | 817 | QStringList vpath, &l = v[sources[x]]; |
743 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 818 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
744 | if(!(*val_it).isEmpty()) { | 819 | if(!(*val_it).isEmpty()) { |
745 | QString file = Option::fixPathToLocalOS((*val_it)); | 820 | QString file = Option::fixPathToLocalOS((*val_it)); |
821 | QStringList file_list(file); | ||
746 | if(!QFile::exists(file)) { | 822 | if(!QFile::exists(file)) { |
747 | bool found = FALSE; | 823 | bool found = FALSE; |
748 | if(QDir::isRelativePath(file)) { | 824 | if(QDir::isRelativePath(file)) { |
749 | if(vpath.isEmpty()) | 825 | if(vpath.isEmpty()) |
750 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + | 826 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + |
751 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; | 827 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; |
752 | 828 | ||
753 | for(QStringList::Iterator vpath_it = vpath.begin(); | 829 | for(QStringList::Iterator vpath_it = vpath.begin(); |
754 | vpath_it != vpath.end(); ++vpath_it) { | 830 | vpath_it != vpath.end(); ++vpath_it) { |
755 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); | 831 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); |
756 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { | 832 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { |
757 | QString dir = (*vpath_it); | 833 | QString dir = (*vpath_it); |
758 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) | 834 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) |
759 | dir += Option::dir_sep; | 835 | dir += Option::dir_sep; |
760 | (*val_it) = fileFixify(dir + (*val_it)); | 836 | (*val_it) = fileFixify(dir + (*val_it)); |
761 | found = TRUE; | 837 | found = TRUE; |
762 | debug_msg(1, "Found file through vpath %s -> %s", | 838 | debug_msg(1, "Found file through vpath %s -> %s", |
763 | file.latin1(), (*val_it).latin1()); | 839 | file.latin1(), (*val_it).latin1()); |
764 | break; | 840 | break; |
765 | } | 841 | } |
766 | } | 842 | } |
767 | } | 843 | } |
768 | if(!found) { | 844 | if(!found) { |
769 | QString dir, regex = (*val_it), real_dir; | 845 | QString dir, regex = (*val_it), real_dir; |
770 | if(regex.findRev(Option::dir_sep) != -1) { | 846 | if(regex.findRev(Option::dir_sep) != -1) { |
771 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); | 847 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); |
772 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), | 848 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), |
773 | QDir::currentDirPath(), Option::output_dir); | 849 | QDir::currentDirPath(), Option::output_dir); |
774 | regex = regex.right(regex.length() - dir.length()); | 850 | regex = regex.right(regex.length() - dir.length()); |
775 | } | 851 | } |
776 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { | 852 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { |
777 | QDir d(real_dir, regex); | 853 | QDir d(real_dir, regex); |
778 | if(!d.count()) { | 854 | if(!d.count()) { |
779 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", | 855 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", |
780 | __FILE__, __LINE__, | 856 | __FILE__, __LINE__, |
781 | (*val_it).latin1(), vpath.join("::").latin1()); | 857 | (*val_it).latin1(), vpath.join("::").latin1()); |
782 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 858 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
783 | continue; | 859 | continue; |
784 | } else { | 860 | } else { |
785 | (*val_it) = dir + d[0]; | 861 | file_list.clear(); |
786 | for(int i = 1; i < (int)d.count(); i++) | 862 | for(int i = 0; i < (int)d.count(); i++) { |
787 | l.insert(val_it, dir + d[i]); | 863 | file_list.append(dir + d[i]); |
864 | if(i == (int)d.count() - 1) | ||
865 | (*val_it) = dir + d[i]; | ||
866 | else | ||
867 | l.insert(val_it, dir + d[i]); | ||
868 | } | ||
788 | } | 869 | } |
789 | } else { | 870 | } else { |
790 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", | 871 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", |
791 | __FILE__, __LINE__, | 872 | __FILE__, __LINE__, |
792 | real_dir.latin1(), QDir::separator(), regex.latin1(), | 873 | real_dir.latin1(), QDir::separator(), regex.latin1(), |
793 | real_dir.latin1()); | 874 | real_dir.latin1()); |
794 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 875 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
795 | } | 876 | } |
796 | } | 877 | } |
797 | } | 878 | } |
798 | 879 | for(QStringList::Iterator file_it = file_list.begin(); | |
799 | QString val_file = fileFixify((*val_it)); | 880 | file_it != file_list.end(); ++file_it) { |
800 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; | 881 | QString file_list_file = fileFixify((*file_it)); |
801 | if(read_cache && Option::output.name() != "-" && | 882 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; |
802 | project->isActiveConfig("qmake_cache")) { | 883 | if(read_cache && Option::output.name() != "-" && |
803 | if(!findDependencies(val_file).isEmpty()) | 884 | project->isActiveConfig("qmake_cache")) { |
804 | found_cache_dep = TRUE; | 885 | if(!findDependencies(file_list_file).isEmpty()) |
805 | if(cache_found_files[(*val_it)] == (void *)2) | 886 | found_cache_dep = TRUE; |
806 | found_cache_moc = TRUE; | 887 | if(cache_found_files[(*file_it)] == (void *)2) |
807 | if(!found_cache_moc || !found_cache_dep) | 888 | found_cache_moc = TRUE; |
808 | write_cache = TRUE; | 889 | if(!found_cache_moc || !found_cache_dep) |
809 | } | 890 | write_cache = TRUE; |
810 | if(!found_cache_dep && sources[x] != "OBJECTS") { | 891 | } |
811 | debug_msg(5, "Looking for dependancies for %s", (*val_it).latin1()); | 892 | /* Do moc before dependency checking since some includes can come from |
812 | generateDependencies(deplist, (*val_it), doDepends()); | 893 | moc_*.cpp files */ |
813 | } | 894 | if(found_cache_moc) { |
814 | if(found_cache_moc) { | 895 | QString moc = findMocDestination(file_list_file); |
815 | QString moc = findMocDestination(val_file); | 896 | if(!moc.isEmpty()) { |
816 | if(!moc.isEmpty()) { | 897 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
817 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 898 | cppit != Option::cpp_ext.end(); ++cppit) { |
818 | cppit != Option::cpp_ext.end(); ++cppit) { | 899 | if(file_list_file.endsWith((*cppit))) { |
819 | if(val_file.endsWith((*cppit))) { | 900 | QStringList &deps = findDependencies(file_list_file); |
820 | QStringList &deps = findDependencies(val_file); | 901 | if(!deps.contains(moc)) |
821 | if(!deps.contains(moc)) | 902 | deps.append(moc); |
822 | deps.append(moc); | 903 | break; |
823 | break; | 904 | } |
824 | } | 905 | } |
825 | } | 906 | } |
907 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
908 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
909 | Option::mkfile::do_mocs)) { | ||
910 | generateMocList((*file_it)); | ||
911 | } | ||
912 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
913 | debug_msg(5, "Looking for dependencies for %s", (*file_it).latin1()); | ||
914 | generateDependencies(deplist, (*file_it), doDepends()); | ||
826 | } | 915 | } |
827 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
828 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
829 | Option::mkfile::do_mocs)) { | ||
830 | generateMocList((*val_it)); | ||
831 | } | 916 | } |
832 | } | 917 | } |
833 | } | 918 | } |
834 | } | 919 | } |
835 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { | 920 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { |
836 | QFile cachef(cache_file); | 921 | QFile cachef(cache_file); |
837 | if(cachef.open(IO_WriteOnly | IO_Translate)) { | 922 | if(cachef.open(IO_WriteOnly | IO_Translate)) { |
838 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); | 923 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); |
839 | QTextStream cachet(&cachef); | 924 | QTextStream cachet(&cachef); |
840 | cachet << "[check]" << "\n" | 925 | cachet << "[check]" << "\n" |
841 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" | 926 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" |
842 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" | 927 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" |
843 | << "MOC_DIR = " << var("MOC_DIR") << "\n" | 928 | << "MOC_DIR = " << var("MOC_DIR") << "\n" |
844 | << "UI_DIR = " << var("UI_DIR") << "\n" | 929 | << "UI_DIR = " << var("UI_DIR") << "\n" |
845 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" | 930 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" |
846 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; | 931 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; |
847 | cachet << "[depend]" << endl; | 932 | cachet << "[depend]" << endl; |
848 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); | 933 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); |
849 | it != depends.end(); ++it) | 934 | it != depends.end(); ++it) |
850 | cachet << depKeyMap[it.key()] << " = " << it.data().join(" ") << endl; | 935 | cachet << depKeyMap[it.key()] << " = " << it.data().join(" ") << endl; |
851 | cachet << "[mocable]" << endl; | 936 | cachet << "[mocable]" << endl; |
852 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; | 937 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; |
853 | for(int x = 0; moc_sources[x] != QString::null; x++) { | 938 | for(int x = 0; moc_sources[x] != QString::null; x++) { |
854 | QStringList &l = v[moc_sources[x]]; | 939 | QStringList &l = v[moc_sources[x]]; |
855 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
856 | if(!(*val_it).isEmpty()) { | 941 | QString f = fileFixify((*val_it)); |
857 | mc = mocablesToMOC[(*val_it)]; | 942 | if(!f.isEmpty()) { |
943 | mc = mocablesToMOC[f]; | ||
858 | if(mc.isEmpty()) | 944 | if(mc.isEmpty()) |
859 | mc = "*qmake_ignore*"; | 945 | mc = "*qmake_ignore*"; |
860 | cachet << (*val_it) << " = " << mc << endl; | 946 | cachet << f << " = " << mc << endl; |
861 | } | 947 | } |
862 | } | 948 | } |
863 | } | 949 | } |
864 | cachef.close(); | 950 | cachef.close(); |
865 | } | 951 | } |
866 | } | 952 | } |
867 | } | 953 | } |
868 | } | 954 | } |
869 | v["OBJECTS"] = createObjectList("SOURCES") + v["OBJECTS"]; // init variables | 955 | v["OBJECTS"] = createObjectList("SOURCES") + v["OBJECTS"]; // init variables |
870 | 956 | ||
871 | //lex files | 957 | //lex files |
872 | { | 958 | { |
873 | QStringList &impls = v["LEXIMPLS"]; | 959 | QStringList &impls = v["LEXIMPLS"]; |
874 | QStringList &l = v["LEXSOURCES"]; | 960 | QStringList &l = v["LEXSOURCES"]; |
875 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 961 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
876 | QString dir; | 962 | QString dir; |
@@ -933,70 +1019,86 @@ MakefileGenerator::init() | |||
933 | if(fi.dirPath() != ".") | 1019 | if(fi.dirPath() != ".") |
934 | lexsrc.prepend(fi.dirPath() + Option::dir_sep); | 1020 | lexsrc.prepend(fi.dirPath() + Option::dir_sep); |
935 | if(v["LEXSOURCES"].findIndex(lexsrc) != -1) { | 1021 | if(v["LEXSOURCES"].findIndex(lexsrc) != -1) { |
936 | QString trg = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 1022 | QString trg = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
937 | impldeps.append(trg); | 1023 | impldeps.append(trg); |
938 | impldeps += findDependencies(lexsrc); | 1024 | impldeps += findDependencies(lexsrc); |
939 | depends[lexsrc].clear(); | 1025 | depends[lexsrc].clear(); |
940 | } | 1026 | } |
941 | } | 1027 | } |
942 | yaccdeps.clear(); | 1028 | yaccdeps.clear(); |
943 | } | 1029 | } |
944 | v["OBJECTS"] += (v["YACCOBJECTS"] = createObjectList("YACCIMPLS")); | 1030 | v["OBJECTS"] += (v["YACCOBJECTS"] = createObjectList("YACCIMPLS")); |
945 | } | 1031 | } |
946 | 1032 | ||
947 | //UI files | 1033 | //UI files |
948 | { | 1034 | { |
1035 | QStringList &includepath = project->variables()["INCLUDEPATH"]; | ||
949 | if(!project->isEmpty("UI_DIR")) | 1036 | if(!project->isEmpty("UI_DIR")) |
950 | project->variables()["INCLUDEPATH"].append(project->first("UI_DIR")); | 1037 | includepath.append(project->first("UI_DIR")); |
951 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 1038 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
952 | project->variables()["INCLUDEPATH"].append(project->first("UI_HEADERS_DIR")); | 1039 | includepath.append(project->first("UI_HEADERS_DIR")); |
953 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; | 1040 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; |
954 | QStringList &l = v["FORMS"]; | 1041 | QStringList &l = v["FORMS"]; |
955 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1042 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
956 | QString impl, decl; | 1043 | QString impl, decl; |
957 | QFileInfo fi(Option::fixPathToLocalOS((*it))); | 1044 | QFileInfo fi(Option::fixPathToLocalOS((*it))); |
958 | if ( !project->isEmpty("UI_DIR") ) { | 1045 | if ( !project->isEmpty("UI_DIR") ) { |
959 | impl = decl = project->first("UI_DIR"); | 1046 | impl = decl = project->first("UI_DIR"); |
960 | QString d = fi.dirPath(); | 1047 | QString d = fi.dirPath(); |
961 | if( d == ".") | 1048 | if( d == ".") |
962 | d = QDir::currentDirPath(); | 1049 | d = QDir::currentDirPath(); |
963 | d = fileFixify(d); | 1050 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
964 | if( !project->variables()["INCLUDEPATH"].contains(d)) | 1051 | if(!includepath.contains(d)) |
965 | project->variables()["INCLUDEPATH"].append(d); | 1052 | includepath.append(d); |
966 | } else { | 1053 | } else { |
967 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) | 1054 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) |
968 | decl = project->first("UI_HEADERS_DIR"); | 1055 | decl = project->first("UI_HEADERS_DIR"); |
969 | if ( !decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && !project->isEmpty("UI_SOURCES_DIR")) ) { | 1056 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && |
1057 | !project->isEmpty("UI_SOURCES_DIR")) ) { | ||
970 | QString d = fi.dirPath(); | 1058 | QString d = fi.dirPath(); |
971 | if( d == ".") | 1059 | if( d == ".") |
972 | d = QDir::currentDirPath(); | 1060 | d = QDir::currentDirPath(); |
973 | d = fileFixify(d); | 1061 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
974 | if( !project->variables()["INCLUDEPATH"].contains(d)) | 1062 | if(includepath.contains(d)) |
975 | project->variables()["INCLUDEPATH"].append(d); | 1063 | includepath.append(d); |
976 | } | 1064 | } |
977 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) | 1065 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) |
978 | impl = project->first("UI_SOURCES_DIR"); | 1066 | impl = project->first("UI_SOURCES_DIR"); |
979 | if(fi.dirPath() != ".") { | 1067 | if(fi.dirPath() != ".") { |
980 | if(impl.isEmpty()) | 1068 | if(impl.isEmpty()) |
981 | impl = fi.dirPath() + Option::dir_sep; | 1069 | impl = fi.dirPath() + Option::dir_sep; |
982 | if(decl.isEmpty()) | 1070 | if(decl.isEmpty()) |
983 | decl = fi.dirPath() + Option::dir_sep; | 1071 | decl = fi.dirPath() + Option::dir_sep; |
984 | } | 1072 | } |
985 | } | 1073 | } |
986 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(), | 1074 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1075 | if(!impl.isEmpty()) | ||
1076 | impl += Option::dir_sep; | ||
1077 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); | ||
1078 | if(Option::output_dir != QDir::currentDirPath() && | ||
1079 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { | ||
1080 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1081 | if(!includepath.contains(decl_fixed)) | ||
1082 | includepath.append(decl_fixed); | ||
1083 | if(!includepath.contains(decl)) | ||
1084 | project->variables()["INCLUDEPATH"].append(decl); | ||
1085 | } | ||
1086 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1087 | if(!decl.isEmpty()) | ||
1088 | decl += Option::dir_sep; | ||
987 | decl += fi.baseName(TRUE) + Option::h_ext.first(); | 1089 | decl += fi.baseName(TRUE) + Option::h_ext.first(); |
988 | logicWarn(impl, "SOURCES"); | 1090 | logicWarn(impl, "SOURCES"); |
989 | logicWarn(decl, "HEADERS"); | 1091 | logicWarn(decl, "HEADERS"); |
990 | decls.append(decl); | 1092 | decls.append(decl); |
991 | impls.append(impl); | 1093 | impls.append(impl); |
992 | findDependencies(impl).append(decl); | 1094 | findDependencies(impl).append(decl); |
993 | 1095 | ||
994 | QString mocable = Option::moc_mod + fi.baseName(TRUE) + Option::cpp_ext.first(); | 1096 | QString mocable = Option::moc_mod + fi.baseName(TRUE) + Option::cpp_ext.first(); |
995 | if(!v["MOC_DIR"].isEmpty()) | 1097 | if(!v["MOC_DIR"].isEmpty()) |
996 | mocable.prepend(v["MOC_DIR"].first()); | 1098 | mocable.prepend(v["MOC_DIR"].first()); |
997 | else if(fi.dirPath() != ".") | 1099 | else if(fi.dirPath() != ".") |
998 | mocable.prepend(fi.dirPath() + Option::dir_sep); | 1100 | mocable.prepend(fi.dirPath() + Option::dir_sep); |
999 | logicWarn(mocable, "SOURCES"); | 1101 | logicWarn(mocable, "SOURCES"); |
1000 | mocablesToMOC[cleanFilePath(decl)] = mocable; | 1102 | mocablesToMOC[cleanFilePath(decl)] = mocable; |
1001 | mocablesFromMOC[cleanFilePath(mocable)] = decl; | 1103 | mocablesFromMOC[cleanFilePath(mocable)] = decl; |
1002 | v["_UIMOC"].append(mocable); | 1104 | v["_UIMOC"].append(mocable); |
@@ -1017,35 +1119,35 @@ MakefileGenerator::init() | |||
1017 | project->first("UI_DIR")) ); | 1119 | project->first("UI_DIR")) ); |
1018 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); | 1120 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); |
1019 | } | 1121 | } |
1020 | logicWarn(imgfile, "SOURCES"); | 1122 | logicWarn(imgfile, "SOURCES"); |
1021 | if(!noIO()) { | 1123 | if(!noIO()) { |
1022 | QStringList &l = v["IMAGES"]; | 1124 | QStringList &l = v["IMAGES"]; |
1023 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1125 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1024 | if(!QFile::exists((*it))) { | 1126 | if(!QFile::exists((*it))) { |
1025 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); | 1127 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); |
1026 | continue; | 1128 | continue; |
1027 | } | 1129 | } |
1028 | findDependencies(imgfile).append(fileFixify((*it))); | 1130 | findDependencies(imgfile).append(fileFixify((*it))); |
1029 | } | 1131 | } |
1030 | } | 1132 | } |
1031 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); | 1133 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); |
1032 | } | 1134 | } |
1033 | 1135 | if(Option::output_dir != QDir::currentDirPath()) | |
1034 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 1136 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, |
1035 | project->variables()["INCLUDEPATH"].append(Option::output_dir); | 1137 | Option::output_dir)); |
1036 | 1138 | ||
1037 | //moc files | 1139 | //moc files |
1038 | if ( mocAware() ) { | 1140 | if ( mocAware() ) { |
1039 | if(!project->isEmpty("MOC_DIR")) | 1141 | if(!project->isEmpty("MOC_DIR")) |
1040 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); | 1142 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); |
1041 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); | 1143 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); |
1042 | 1144 | ||
1043 | QStringList &l = v["SRCMOC"]; | 1145 | QStringList &l = v["SRCMOC"]; |
1044 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; | 1146 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; |
1045 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 1147 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
1046 | if(!(*val_it).isEmpty()) | 1148 | if(!(*val_it).isEmpty()) |
1047 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); | 1149 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); |
1048 | } | 1150 | } |
1049 | } | 1151 | } |
1050 | } | 1152 | } |
1051 | 1153 | ||
@@ -1053,33 +1155,33 @@ bool | |||
1053 | MakefileGenerator::processPrlFile(QString &file) | 1155 | MakefileGenerator::processPrlFile(QString &file) |
1054 | { | 1156 | { |
1055 | bool ret = FALSE, try_replace_file=FALSE; | 1157 | bool ret = FALSE, try_replace_file=FALSE; |
1056 | QString prl_file; | 1158 | QString prl_file; |
1057 | if(file.endsWith(Option::prl_ext)) { | 1159 | if(file.endsWith(Option::prl_ext)) { |
1058 | try_replace_file = TRUE; | 1160 | try_replace_file = TRUE; |
1059 | prl_file = file; | 1161 | prl_file = file; |
1060 | file = ""; | 1162 | file = ""; |
1061 | } else { | 1163 | } else { |
1062 | QString tmp = file; | 1164 | QString tmp = file; |
1063 | int ext = tmp.findRev('.'); | 1165 | int ext = tmp.findRev('.'); |
1064 | if(ext != -1) | 1166 | if(ext != -1) |
1065 | tmp = tmp.left(ext); | 1167 | tmp = tmp.left(ext); |
1066 | prl_file = tmp + Option::prl_ext; | 1168 | prl_file = tmp + Option::prl_ext; |
1067 | } | 1169 | } |
1068 | prl_file = fileFixify(prl_file); | 1170 | prl_file = fileFixify(prl_file); |
1069 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && | 1171 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && |
1070 | project->isActiveConfig("qt")) { | 1172 | project->isActiveConfig("qt")) { |
1071 | QString stem = prl_file, dir, extn; | 1173 | QString stem = prl_file, dir, extn; |
1072 | int slsh = stem.findRev('/'), hadlib = 0; | 1174 | int slsh = stem.findRev('/'), hadlib = 0; |
1073 | if(slsh != -1) { | 1175 | if(slsh != -1) { |
1074 | dir = stem.left(slsh + 1); | 1176 | dir = stem.left(slsh + 1); |
1075 | stem = stem.right(stem.length() - slsh - 1); | 1177 | stem = stem.right(stem.length() - slsh - 1); |
1076 | } | 1178 | } |
1077 | if(stem.startsWith("lib")) { | 1179 | if(stem.startsWith("lib")) { |
1078 | hadlib = 1; | 1180 | hadlib = 1; |
1079 | stem = stem.right(stem.length() - 3); | 1181 | stem = stem.right(stem.length() - 3); |
1080 | } | 1182 | } |
1081 | int dot = stem.find('.'); | 1183 | int dot = stem.find('.'); |
1082 | if(dot != -1) { | 1184 | if(dot != -1) { |
1083 | extn = stem.right(stem.length() - dot); | 1185 | extn = stem.right(stem.length() - dot); |
1084 | stem = stem.left(dot); | 1186 | stem = stem.left(dot); |
1085 | } | 1187 | } |
@@ -1091,33 +1193,33 @@ MakefileGenerator::processPrlFile(QString &file) | |||
1091 | prl_file = dir; | 1193 | prl_file = dir; |
1092 | if(hadlib) | 1194 | if(hadlib) |
1093 | prl_file += "lib"; | 1195 | prl_file += "lib"; |
1094 | prl_file += stem + extn; | 1196 | prl_file += stem + extn; |
1095 | try_replace_file = TRUE; | 1197 | try_replace_file = TRUE; |
1096 | } | 1198 | } |
1097 | } | 1199 | } |
1098 | QString real_prl_file = Option::fixPathToLocalOS(prl_file); | 1200 | QString real_prl_file = Option::fixPathToLocalOS(prl_file); |
1099 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(prl_file) != -1) { | 1201 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(prl_file) != -1) { |
1100 | ret = TRUE; | 1202 | ret = TRUE; |
1101 | } else if(!real_prl_file.isEmpty() && | 1203 | } else if(!real_prl_file.isEmpty() && |
1102 | QFile::exists(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir))) { | 1204 | QFile::exists(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir))) { |
1103 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(prl_file); | 1205 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(prl_file); |
1104 | QMakeProject proj; | 1206 | QMakeProject proj; |
1105 | debug_msg(1, "Processing PRL file: %s", real_prl_file.latin1()); | 1207 | debug_msg(1, "Processing PRL file: %s", real_prl_file.latin1()); |
1106 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), | 1208 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), |
1107 | QDir::currentDirPath())) { | 1209 | QDir::currentDirPath(), TRUE)) { |
1108 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); | 1210 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); |
1109 | } else { | 1211 | } else { |
1110 | ret = TRUE; | 1212 | ret = TRUE; |
1111 | QMap<QString, QStringList> &vars = proj.variables(); | 1213 | QMap<QString, QStringList> &vars = proj.variables(); |
1112 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) | 1214 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) |
1113 | processPrlVariable(it.key(), it.data()); | 1215 | processPrlVariable(it.key(), it.data()); |
1114 | if(try_replace_file && !proj.isEmpty("QMAKE_PRL_TARGET")) { | 1216 | if(try_replace_file && !proj.isEmpty("QMAKE_PRL_TARGET")) { |
1115 | QString dir; | 1217 | QString dir; |
1116 | int slsh = real_prl_file.findRev(Option::dir_sep); | 1218 | int slsh = real_prl_file.findRev(Option::dir_sep); |
1117 | if(slsh != -1) | 1219 | if(slsh != -1) |
1118 | dir = real_prl_file.left(slsh+1); | 1220 | dir = real_prl_file.left(slsh+1); |
1119 | file = dir + proj.first("QMAKE_PRL_TARGET"); | 1221 | file = dir + proj.first("QMAKE_PRL_TARGET"); |
1120 | } | 1222 | } |
1121 | } | 1223 | } |
1122 | if(ret) | 1224 | if(ret) |
1123 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(prl_file); | 1225 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(prl_file); |
@@ -1183,77 +1285,78 @@ MakefileGenerator::writePrlFile(QTextStream &t) | |||
1183 | target = target.right(target.length() - slsh - 1); | 1285 | target = target.right(target.length() - slsh - 1); |
1184 | QString bdir = Option::output_dir; | 1286 | QString bdir = Option::output_dir; |
1185 | if(bdir.isEmpty()) | 1287 | if(bdir.isEmpty()) |
1186 | bdir = QDir::currentDirPath(); | 1288 | bdir = QDir::currentDirPath(); |
1187 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; | 1289 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; |
1188 | 1290 | ||
1189 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") | 1291 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") |
1190 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; | 1292 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; |
1191 | 1293 | ||
1192 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 1294 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
1193 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; | 1295 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; |
1194 | t << "QMAKE_PRL_TARGET = " << target << endl; | 1296 | t << "QMAKE_PRL_TARGET = " << target << endl; |
1195 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) | 1297 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) |
1196 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; | 1298 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; |
1197 | if(!project->isEmpty("CONFIG")) | 1299 | if(!project->isEmpty("CONFIG")) |
1198 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; | 1300 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; |
1301 | if(!project->isEmpty("VERSION")) | ||
1302 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; | ||
1199 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { | 1303 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { |
1200 | QStringList libs; | 1304 | QStringList libs; |
1201 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1305 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1202 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 1306 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
1203 | else | 1307 | else |
1204 | libs << "QMAKE_LIBS"; //obvious one | 1308 | libs << "QMAKE_LIBS"; //obvious one |
1205 | t << "QMAKE_PRL_LIBS = "; | 1309 | t << "QMAKE_PRL_LIBS = "; |
1206 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) | 1310 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) |
1207 | t << project->variables()[(*it)].join(" ") << " "; | 1311 | t << project->variables()[(*it)].join(" ") << " "; |
1208 | t << endl; | 1312 | t << endl; |
1209 | } | 1313 | } |
1210 | } | 1314 | } |
1211 | 1315 | ||
1212 | bool | 1316 | bool |
1213 | MakefileGenerator::write() | 1317 | MakefileGenerator::write() |
1214 | { | 1318 | { |
1215 | init(); | 1319 | init(); |
1216 | findLibraries(); | 1320 | findLibraries(); |
1217 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl | 1321 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl |
1218 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && | 1322 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && |
1219 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && | 1323 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && |
1220 | !project->isActiveConfig("plugin")) { | 1324 | !project->isActiveConfig("plugin")) { |
1221 | QString prl = var("TARGET"); | 1325 | QString prl = var("TARGET"); |
1222 | int slsh = prl.findRev(Option::dir_sep); | 1326 | int slsh = prl.findRev(Option::dir_sep); |
1223 | if(slsh != -1) | 1327 | if(slsh != -1) |
1224 | prl = prl.right(prl.length() - slsh); | 1328 | prl = prl.right(prl.length() - slsh); |
1225 | int dot = prl.find('.'); | 1329 | int dot = prl.find('.'); |
1226 | if(dot != -1) | 1330 | if(dot != -1) |
1227 | prl = prl.left(dot); | 1331 | prl = prl.left(dot); |
1228 | prl += Option::prl_ext; | 1332 | prl += Option::prl_ext; |
1229 | if(!project->isEmpty("DESTDIR")) | 1333 | if(!project->isEmpty("DESTDIR")) |
1230 | prl.prepend(var("DESTDIR")); | 1334 | prl.prepend(var("DESTDIR")); |
1231 | QString local_prl = fileFixify(prl, QDir::currentDirPath(), Option::output_dir); | 1335 | QString local_prl = Option::fixPathToLocalOS(fileFixify(prl, QDir::currentDirPath(), Option::output_dir)); |
1232 | fixEnvVariables(local_prl); | ||
1233 | QFile ft(local_prl); | 1336 | QFile ft(local_prl); |
1234 | if(ft.open(IO_WriteOnly)) { | 1337 | if(ft.open(IO_WriteOnly)) { |
1235 | project->variables()["ALL_DEPS"].append(prl); | 1338 | project->variables()["ALL_DEPS"].append(prl); |
1236 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); | 1339 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); |
1237 | QTextStream t(&ft); | 1340 | QTextStream t(&ft); |
1238 | writePrlFile(t); | 1341 | writePrlFile(t); |
1239 | ft.close(); | 1342 | ft.close(); |
1240 | } | 1343 | } |
1241 | } | 1344 | } |
1242 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && | 1345 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && |
1243 | project->isActiveConfig("link_prl")) //load up prl's | 1346 | project->isActiveConfig("link_prl")) //load up prl's' |
1244 | processPrlFiles(); | 1347 | processPrlFiles(); |
1245 | 1348 | ||
1246 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 1349 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
1247 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { | 1350 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { |
1248 | QTextStream t(&Option::output); | 1351 | QTextStream t(&Option::output); |
1249 | writeMakefile(t); | 1352 | writeMakefile(t); |
1250 | } | 1353 | } |
1251 | return TRUE; | 1354 | return TRUE; |
1252 | } | 1355 | } |
1253 | 1356 | ||
1254 | void | 1357 | void |
1255 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) | 1358 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) |
1256 | { | 1359 | { |
1257 | QStringList &objl = project->variables()[obj]; | 1360 | QStringList &objl = project->variables()[obj]; |
1258 | QStringList &srcl = project->variables()[src]; | 1361 | QStringList &srcl = project->variables()[src]; |
1259 | 1362 | ||
@@ -1289,64 +1392,80 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s | |||
1289 | } | 1392 | } |
1290 | } | 1393 | } |
1291 | if(comp.isEmpty()) { | 1394 | if(comp.isEmpty()) { |
1292 | comp = "QMAKE_RUN_CC"; | 1395 | comp = "QMAKE_RUN_CC"; |
1293 | cimp = "QMAKE_RUN_CC_IMP"; | 1396 | cimp = "QMAKE_RUN_CC_IMP"; |
1294 | } | 1397 | } |
1295 | bool use_implicit_rule = !project->isEmpty(cimp); | 1398 | bool use_implicit_rule = !project->isEmpty(cimp); |
1296 | if(use_implicit_rule) { | 1399 | if(use_implicit_rule) { |
1297 | if(!project->isEmpty("OBJECTS_DIR")) { | 1400 | if(!project->isEmpty("OBJECTS_DIR")) { |
1298 | use_implicit_rule = FALSE; | 1401 | use_implicit_rule = FALSE; |
1299 | } else { | 1402 | } else { |
1300 | int dot = (*sit).findRev('.'); | 1403 | int dot = (*sit).findRev('.'); |
1301 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1404 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1302 | use_implicit_rule = FALSE; | 1405 | use_implicit_rule = FALSE; |
1303 | } | 1406 | } |
1304 | } | 1407 | } |
1305 | if (!use_implicit_rule) { | 1408 | if (!use_implicit_rule && !project->isEmpty(comp)) { |
1306 | QString p = var(comp); | 1409 | QString p = var(comp); |
1307 | p.replace(stringSrc, (*sit)); | 1410 | p.replace(stringSrc, (*sit)); |
1308 | p.replace(stringObj, (*oit)); | 1411 | p.replace(stringObj, (*oit)); |
1309 | t << "\n\t" << p; | 1412 | t << "\n\t" << p; |
1310 | } | 1413 | } |
1311 | t << endl << endl; | 1414 | t << endl << endl; |
1312 | } | 1415 | } |
1313 | } | 1416 | } |
1314 | 1417 | ||
1315 | 1418 | ||
1316 | void | 1419 | void |
1317 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) | 1420 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) |
1318 | { | 1421 | { |
1319 | QStringList &uil = project->variables()[ui]; | 1422 | QStringList &uil = project->variables()[ui]; |
1320 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { | 1423 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { |
1321 | QString deps = findDependencies((*it)).join(" \\\n\t\t"), decl, impl; | 1424 | QString deps = findDependencies((*it)).join(" \\\n\t\t"), decl, impl; |
1322 | { | 1425 | { |
1323 | QString tmp = (*it); | 1426 | QString tmp = (*it), impl_dir, decl_dir; |
1324 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); | 1427 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); |
1428 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1429 | int dlen = decl.findRev(Option::dir_sep) + 1; | ||
1325 | tmp = (*it); | 1430 | tmp = (*it); |
1326 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); | 1431 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); |
1327 | int dlen = (*it).findRev(Option::dir_sep) + 1; | 1432 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1433 | int ilen = decl.findRev(Option::dir_sep) + 1; | ||
1328 | if(!project->isEmpty("UI_DIR")) { | 1434 | if(!project->isEmpty("UI_DIR")) { |
1435 | impl_dir = project->first("UI_DIR"); | ||
1329 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); | 1436 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); |
1330 | impl = project->first("UI_DIR") + impl.right(impl.length() - dlen); | 1437 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); |
1331 | } else { | 1438 | } else { |
1332 | if(!project->isEmpty("UI_HEADERS_DIR")) | 1439 | if(!project->isEmpty("UI_HEADERS_DIR")) { |
1440 | decl_dir = project->first("UI_HEADERS_DIR"); | ||
1333 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); | 1441 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); |
1334 | if(!project->isEmpty("UI_SOURCES_DIR")) | 1442 | } |
1335 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - dlen); | 1443 | if(!project->isEmpty("UI_SOURCES_DIR")) { |
1336 | } | 1444 | impl_dir = project->first("UI_SOURCES_DIR"); |
1445 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); | ||
1446 | } | ||
1447 | } | ||
1448 | if(decl_dir.isEmpty()) | ||
1449 | decl_dir = decl.left(dlen); | ||
1450 | if(impl_dir.isEmpty()) | ||
1451 | impl_dir = impl.left(ilen); | ||
1452 | if(!impl_dir.isEmpty()) | ||
1453 | createDir(Option::output_dir + Option::dir_sep + impl_dir); | ||
1454 | if(!decl_dir.isEmpty() && decl_dir != impl_dir) | ||
1455 | createDir(Option::output_dir + Option::dir_sep + decl_dir); | ||
1337 | } | 1456 | } |
1338 | t << decl << ": " << (*it) << " " << deps << "\n\t" | 1457 | t << decl << ": " << (*it) << " " << deps << "\n\t" |
1339 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; | 1458 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; |
1340 | 1459 | ||
1341 | QString mildDecl = decl; | 1460 | QString mildDecl = decl; |
1342 | int k = mildDecl.findRev( Option::dir_sep ); | 1461 | int k = mildDecl.findRev( Option::dir_sep ); |
1343 | if ( k != -1 ) | 1462 | if ( k != -1 ) |
1344 | mildDecl = mildDecl.mid( k + 1 ); | 1463 | mildDecl = mildDecl.mid( k + 1 ); |
1345 | 1464 | ||
1346 | t << impl << ": " << decl << " " << (*it) << " " << deps << "\n\t" | 1465 | t << impl << ": " << decl << " " << (*it) << " " << deps << "\n\t" |
1347 | << "$(UIC) " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; | 1466 | << "$(UIC) " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; |
1348 | } | 1467 | } |
1349 | } | 1468 | } |
1350 | 1469 | ||
1351 | 1470 | ||
1352 | void | 1471 | void |
@@ -1357,33 +1476,33 @@ MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString | |||
1357 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); | 1476 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); |
1358 | QString stringSrc("$src"), stringObj("$obj"); | 1477 | QString stringSrc("$src"), stringObj("$obj"); |
1359 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { | 1478 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { |
1360 | QString hdr = findMocSource((*sit)); | 1479 | QString hdr = findMocSource((*sit)); |
1361 | t << (*oit) << ": " << (*sit) << " " | 1480 | t << (*oit) << ": " << (*sit) << " " |
1362 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); | 1481 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); |
1363 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1482 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1364 | if(use_implicit_rule) { | 1483 | if(use_implicit_rule) { |
1365 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { | 1484 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { |
1366 | use_implicit_rule = FALSE; | 1485 | use_implicit_rule = FALSE; |
1367 | } else { | 1486 | } else { |
1368 | int dot = (*sit).findRev('.'); | 1487 | int dot = (*sit).findRev('.'); |
1369 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1488 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1370 | use_implicit_rule = FALSE; | 1489 | use_implicit_rule = FALSE; |
1371 | } | 1490 | } |
1372 | } | 1491 | } |
1373 | if (!use_implicit_rule) { | 1492 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1374 | QString p = var("QMAKE_RUN_CXX"); | 1493 | QString p = var("QMAKE_RUN_CXX"); |
1375 | p.replace(stringSrc, (*sit)); | 1494 | p.replace(stringSrc, (*sit)); |
1376 | p.replace(stringObj, (*oit)); | 1495 | p.replace(stringObj, (*oit)); |
1377 | t << "\n\t" << p; | 1496 | t << "\n\t" << p; |
1378 | } | 1497 | } |
1379 | t << endl << endl; | 1498 | t << endl << endl; |
1380 | } | 1499 | } |
1381 | } | 1500 | } |
1382 | 1501 | ||
1383 | 1502 | ||
1384 | void | 1503 | void |
1385 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) | 1504 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) |
1386 | { | 1505 | { |
1387 | QStringList &l = project->variables()[src]; | 1506 | QStringList &l = project->variables()[src]; |
1388 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1507 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1389 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); | 1508 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); |
@@ -1400,114 +1519,121 @@ MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) | |||
1400 | 1519 | ||
1401 | void | 1520 | void |
1402 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | 1521 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) |
1403 | { | 1522 | { |
1404 | QStringList &l = project->variables()[src]; | 1523 | QStringList &l = project->variables()[src]; |
1405 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) | 1524 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) |
1406 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." | 1525 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." |
1407 | "This can lead to link problems.\n"); | 1526 | "This can lead to link problems.\n"); |
1408 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; | 1527 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; |
1409 | if(!project->isEmpty("QMAKE_YACC_HEADER")) | 1528 | if(!project->isEmpty("QMAKE_YACC_HEADER")) |
1410 | default_out_h = project->first("QMAKE_YACC_HEADER"); | 1529 | default_out_h = project->first("QMAKE_YACC_HEADER"); |
1411 | if(!project->isEmpty("QMAKE_YACC_SOURCE")) | 1530 | if(!project->isEmpty("QMAKE_YACC_SOURCE")) |
1412 | default_out_c = project->first("QMAKE_YACC_SOURCE"); | 1531 | default_out_c = project->first("QMAKE_YACC_SOURCE"); |
1413 | QString stringBase("$base"); | 1532 | QString stringBase("$base"); |
1414 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1533 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1415 | QFileInfo fi((*it)); | 1534 | QFileInfo fi((*it)); |
1416 | QString dir = fileFixify(Option::output_dir); | 1535 | QString dir; |
1536 | if(fi.dirPath() != ".") | ||
1537 | dir = fi.dirPath() + Option::dir_sep; | ||
1538 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
1417 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1539 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1418 | dir += Option::dir_sep; | 1540 | dir += Option::dir_sep; |
1541 | |||
1419 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 1542 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
1420 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 1543 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); |
1421 | 1544 | ||
1422 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; | 1545 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; |
1423 | if(!project->isActiveConfig("yacc_no_name_mangle")) { | 1546 | if(!project->isActiveConfig("yacc_no_name_mangle")) { |
1424 | mangle = fi.baseName(TRUE); | 1547 | mangle = fi.baseName(TRUE); |
1425 | yaccflags += " -p " + mangle; | 1548 | yaccflags += " -p " + mangle; |
1426 | } | 1549 | } |
1427 | QString out_h = default_out_h, out_c = default_out_c; | 1550 | QString out_h = default_out_h, out_c = default_out_c; |
1428 | if(!mangle.isEmpty()) { | 1551 | if(!mangle.isEmpty()) { |
1429 | out_h.replace(stringBase, mangle); | 1552 | out_h.replace(stringBase, mangle); |
1430 | out_c.replace(stringBase, mangle); | 1553 | out_c.replace(stringBase, mangle); |
1431 | } | 1554 | } |
1432 | 1555 | ||
1433 | t << impl << ": " << (*it) << "\n\t" | 1556 | t << impl << ": " << (*it) << "\n\t" |
1434 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" | 1557 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" |
1435 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" | 1558 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" |
1436 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" | 1559 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" |
1437 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; | 1560 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; |
1438 | t << decl << ": " << impl << endl << endl; | 1561 | t << decl << ": " << impl << endl << endl; |
1439 | } | 1562 | } |
1440 | } | 1563 | } |
1441 | 1564 | ||
1442 | void | 1565 | void |
1443 | MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) | 1566 | MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) |
1444 | { | 1567 | { |
1445 | QStringList &l = project->variables()[src]; | 1568 | QStringList &l = project->variables()[src]; |
1446 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) | 1569 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) |
1447 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected.\n" | 1570 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected.\n" |
1448 | "This can lead to link problems.\n"); | 1571 | "This can lead to link problems.\n"); |
1449 | QString default_out_c = "lex.$base.c"; | 1572 | QString default_out_c = "lex.$base.c"; |
1450 | if(!project->isEmpty("QMAKE_LEX_SOURCE")) | 1573 | if(!project->isEmpty("QMAKE_LEX_SOURCE")) |
1451 | default_out_c = project->first("QMAKE_LEX_SOURCE"); | 1574 | default_out_c = project->first("QMAKE_LEX_SOURCE"); |
1452 | QString stringBase("$base"); | 1575 | QString stringBase("$base"); |
1453 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1576 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1454 | QFileInfo fi((*it)); | 1577 | QFileInfo fi((*it)); |
1455 | QString dir = fileFixify(Option::output_dir); | 1578 | QString dir; |
1579 | if(fi.dirPath() != ".") | ||
1580 | dir = fi.dirPath() + Option::dir_sep; | ||
1581 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
1456 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1582 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1457 | dir += Option::dir_sep; | 1583 | dir += Option::dir_sep; |
1458 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 1584 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
1459 | 1585 | ||
1460 | QString lexflags = "$(LEXFLAGS)", stub="yy"; | 1586 | QString lexflags = "$(LEXFLAGS)", stub="yy"; |
1461 | if(!project->isActiveConfig("yacc_no_name_mangle")) { | 1587 | if(!project->isActiveConfig("yacc_no_name_mangle")) { |
1462 | stub = fi.baseName(TRUE); | 1588 | stub = fi.baseName(TRUE); |
1463 | lexflags += " -P" + stub; | 1589 | lexflags += " -P" + stub; |
1464 | } | 1590 | } |
1465 | QString out_c = default_out_c; | 1591 | QString out_c = default_out_c; |
1466 | if(!stub.isEmpty()) | 1592 | if(!stub.isEmpty()) |
1467 | out_c.replace(stringBase, stub); | 1593 | out_c.replace(stringBase, stub); |
1468 | 1594 | ||
1469 | t << impl << ": " << (*it) << " " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" | 1595 | t << impl << ": " << (*it) << " " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" |
1470 | << ( "$(LEX) " + lexflags + " " ) << (*it) << "\n\t" | 1596 | << ( "$(LEX) " + lexflags + " " ) << (*it) << "\n\t" |
1471 | << "-$(DEL_FILE) " << impl << " " << "\n\t" | 1597 | << "-$(DEL_FILE) " << impl << " " << "\n\t" |
1472 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; | 1598 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; |
1473 | } | 1599 | } |
1474 | } | 1600 | } |
1475 | 1601 | ||
1476 | void | 1602 | void |
1477 | MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) | 1603 | MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) |
1478 | { | 1604 | { |
1479 | QStringList &objl = project->variables()[obj]; | 1605 | QStringList &objl = project->variables()[obj]; |
1480 | QString stringSrc("$src"); | 1606 | QString stringSrc("$src"); |
1481 | QString stringObj("$obj"); | 1607 | QString stringObj("$obj"); |
1482 | 1608 | ||
1483 | QString uidir; | 1609 | QString uidir; |
1484 | for(QStringList::Iterator oit = objl.begin(); oit != objl.end(); oit++) { | 1610 | for(QStringList::Iterator oit = objl.begin(); oit != objl.end(); oit++) { |
1485 | QString src(project->first("QMAKE_IMAGE_COLLECTION")); | 1611 | QString src(project->first("QMAKE_IMAGE_COLLECTION")); |
1486 | t << (*oit) << ": " << src; | 1612 | t << (*oit) << ": " << src; |
1487 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1613 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1488 | if(use_implicit_rule) { | 1614 | if(use_implicit_rule) { |
1489 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { | 1615 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { |
1490 | use_implicit_rule = FALSE; | 1616 | use_implicit_rule = FALSE; |
1491 | } else { | 1617 | } else { |
1492 | int dot = src.findRev('.'); | 1618 | int dot = src.findRev('.'); |
1493 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) | 1619 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) |
1494 | use_implicit_rule = FALSE; | 1620 | use_implicit_rule = FALSE; |
1495 | } | 1621 | } |
1496 | } | 1622 | } |
1497 | if(!use_implicit_rule) { | 1623 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1498 | QString p = var("QMAKE_RUN_CXX"); | 1624 | QString p = var("QMAKE_RUN_CXX"); |
1499 | p.replace( stringSrc, src); | 1625 | p.replace( stringSrc, src); |
1500 | p.replace( stringObj, (*oit)); | 1626 | p.replace( stringObj, (*oit)); |
1501 | t << "\n\t" << p; | 1627 | t << "\n\t" << p; |
1502 | } | 1628 | } |
1503 | t << endl << endl; | 1629 | t << endl << endl; |
1504 | } | 1630 | } |
1505 | } | 1631 | } |
1506 | 1632 | ||
1507 | 1633 | ||
1508 | void | 1634 | void |
1509 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) | 1635 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) |
1510 | { | 1636 | { |
1511 | QStringList &l = project->variables()[src]; | 1637 | QStringList &l = project->variables()[src]; |
1512 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1638 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1513 | QString gen = project->first("MAKEFILE_GENERATOR"); | 1639 | QString gen = project->first("MAKEFILE_GENERATOR"); |
@@ -1528,102 +1654,131 @@ MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) | |||
1528 | } | 1654 | } |
1529 | 1655 | ||
1530 | 1656 | ||
1531 | void | 1657 | void |
1532 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | 1658 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) |
1533 | { | 1659 | { |
1534 | QString all_installs, all_uninstalls; | 1660 | QString all_installs, all_uninstalls; |
1535 | QStringList &l = project->variables()[installs]; | 1661 | QStringList &l = project->variables()[installs]; |
1536 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1662 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1537 | QString pvar = (*it) + ".path"; | 1663 | QString pvar = (*it) + ".path"; |
1538 | if(project->variables()[pvar].isEmpty()) { | 1664 | if(project->variables()[pvar].isEmpty()) { |
1539 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); | 1665 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); |
1540 | continue; | 1666 | continue; |
1541 | } | 1667 | } |
1542 | 1668 | ||
1543 | bool do_default = TRUE; | 1669 | bool do_default = TRUE; |
1544 | QString target, dst="$(INSTALL_ROOT)" + Option::fixPathToTargetOS(project->variables()[pvar].first(), FALSE); | 1670 | const QString root = "$(INSTALL_ROOT)"; |
1671 | QString target, dst= fileFixify(project->variables()[pvar].first()); | ||
1672 | #ifndef Q_WS_WIN | ||
1545 | if(dst.right(1) != Option::dir_sep) | 1673 | if(dst.right(1) != Option::dir_sep) |
1546 | dst += Option::dir_sep; | 1674 | dst += Option::dir_sep; |
1547 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; | 1675 | #endif |
1548 | //other | 1676 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; |
1549 | tmp = project->variables()[(*it) + ".extra"]; | 1677 | //other |
1550 | if(!tmp.isEmpty()) { | 1678 | tmp = project->variables()[(*it) + ".extra"]; |
1679 | if(!tmp.isEmpty()) { | ||
1551 | do_default = FALSE; | 1680 | do_default = FALSE; |
1552 | if(!target.isEmpty()) | 1681 | if(!target.isEmpty()) |
1553 | target += "\n\t"; | 1682 | target += "\n\t"; |
1554 | target += tmp.join(" "); | 1683 | target += tmp.join(" "); |
1555 | } | 1684 | } |
1556 | //masks | 1685 | //masks |
1557 | tmp = project->variables()[(*it) + ".files"]; | 1686 | tmp = project->variables()[(*it) + ".files"]; |
1558 | if(!tmp.isEmpty()) { | 1687 | if(!tmp.isEmpty()) { |
1559 | if(!target.isEmpty()) | 1688 | if(!target.isEmpty()) |
1560 | target += "\n"; | 1689 | target += "\n"; |
1561 | do_default = FALSE; | 1690 | do_default = FALSE; |
1562 | for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { | 1691 | for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { |
1563 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); | 1692 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); |
1693 | QString dirstr = QDir::currentDirPath(), filestr = wild; | ||
1694 | int slsh = filestr.findRev(Option::dir_sep); | ||
1695 | if(slsh != -1) { | ||
1696 | dirstr = filestr.left(slsh+1); | ||
1697 | filestr = filestr.right(filestr.length() - slsh - 1); | ||
1698 | } | ||
1699 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | ||
1700 | dirstr += Option::dir_sep; | ||
1564 | if(QFile::exists(wild)) { //real file | 1701 | if(QFile::exists(wild)) { //real file |
1702 | QString file = wild; | ||
1565 | QFileInfo fi(wild); | 1703 | QFileInfo fi(wild); |
1566 | target += QString("\t-") + (fi.isDir() ? "$(COPY_DIR)" : "$(COPY_FILE)") + | 1704 | if(!target.isEmpty()) |
1567 | " \"" + Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + fileFixify(dst) + "\"\n"; | 1705 | target += "\t"; |
1706 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | ||
1707 | Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n"; | ||
1568 | if(!project->isActiveConfig("debug") && | 1708 | if(!project->isActiveConfig("debug") && |
1569 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1709 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1570 | target += QString("\t") + var("QMAKE_STRIP") + " \"" + fileFixify(dst + wild) + "\"\n"; | 1710 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n"; |
1571 | uninst.append(QString("-$(DEL_FILE) -r") + " \"" + fileFixify(dst + wild) + "\""); | 1711 | if(!uninst.isEmpty()) |
1712 | uninst.append("\n\t"); | ||
1713 | uninst.append( | ||
1714 | #ifdef Q_WS_WIN | ||
1715 | QString("-$(DEL_FILE)") | ||
1716 | #else | ||
1717 | QString("-$(DEL_FILE) -r") | ||
1718 | #endif | ||
1719 | + " \"" + root + fileFixify(dst + filestr) + "\""); | ||
1572 | continue; | 1720 | continue; |
1573 | } | 1721 | } |
1574 | QString dirstr = QDir::currentDirPath(), f = wild; //wild | 1722 | QDir dir(dirstr, filestr); //wild |
1575 | int slsh = f.findRev(Option::dir_sep); | ||
1576 | if(slsh != -1) { | ||
1577 | dirstr = f.left(slsh+1); | ||
1578 | f = f.right(f.length() - slsh - 1); | ||
1579 | } | ||
1580 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | ||
1581 | dirstr += Option::dir_sep; | ||
1582 | if(!uninst.isEmpty()) | ||
1583 | uninst.append("\n\t"); | ||
1584 | uninst.append(QString("-$(DEL_FILE) -r") + " " + fileFixify(dst + f) + ""); | ||
1585 | |||
1586 | QDir dir(dirstr, f); | ||
1587 | for(uint x = 0; x < dir.count(); x++) { | 1723 | for(uint x = 0; x < dir.count(); x++) { |
1588 | QString file = dir[x]; | 1724 | QString file = dir[x]; |
1589 | if(file == "." || file == "..") //blah | 1725 | if(file == "." || file == "..") //blah |
1590 | continue; | 1726 | continue; |
1727 | if(!uninst.isEmpty()) | ||
1728 | uninst.append("\n\t"); | ||
1729 | uninst.append( | ||
1730 | #ifdef Q_WS_WIN | ||
1731 | QString("-$(DEL_FILE)") | ||
1732 | #else | ||
1733 | QString("-$(DEL_FILE) -r") | ||
1734 | #endif | ||
1735 | + " \"" + root + fileFixify(dst + file) + "\""); | ||
1591 | QFileInfo fi(file); | 1736 | QFileInfo fi(file); |
1592 | target += QString("\t-") + (fi.isDir() ? "$(COPY_DIR)" : "$(COPY_FILE)") + | 1737 | if(!target.isEmpty()) |
1593 | " \"" + Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | 1738 | target += "\t"; |
1594 | "\" \"" + fileFixify(dst) + "\"\n"; | 1739 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + |
1740 | Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | ||
1741 | "\" \"" + root + fileFixify(dst) + "\"\n"; | ||
1595 | if(!project->isActiveConfig("debug") && | 1742 | if(!project->isActiveConfig("debug") && |
1596 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1743 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1597 | target += QString("\t") + var("QMAKE_STRIP") + " \"" + fileFixify(dst + file) + "\"\n"; | 1744 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + file) + "\"\n"; |
1598 | } | 1745 | } |
1599 | } | 1746 | } |
1600 | } | 1747 | } |
1601 | //default? | 1748 | //default? |
1602 | if(do_default) | 1749 | if(do_default) |
1603 | target = defaultInstall((*it)); | 1750 | target = defaultInstall((*it)); |
1604 | 1751 | ||
1605 | if(!target.isEmpty()) { | 1752 | if(!target.isEmpty()) { |
1606 | t << "install_" << (*it) << ": " << "\n\t" | 1753 | t << "install_" << (*it) << ": " << "\n\t"; |
1607 | << "@test -d " << dst << " || mkdir -p " << dst << "\n\t" | 1754 | const QStringList &dirs = project->variables()[pvar]; |
1608 | << target << endl << endl; | 1755 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { |
1756 | QString tmp_dst = fileFixify((*pit)); | ||
1757 | #ifndef Q_WS_WIN | ||
1758 | if(tmp_dst.right(1) != Option::dir_sep) | ||
1759 | tmp_dst += Option::dir_sep; | ||
1760 | #endif | ||
1761 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; | ||
1762 | } | ||
1763 | t << target << endl << endl; | ||
1609 | all_installs += QString("install_") + (*it) + " "; | 1764 | all_installs += QString("install_") + (*it) + " "; |
1610 | if(!uninst.isEmpty()) { | 1765 | if(!uninst.isEmpty()) { |
1611 | t << "uninstall_" << (*it) << ": " << "\n\t" | 1766 | t << "uninstall_" << (*it) << ": " << "\n\t" |
1612 | << uninst.join(" ") << "\n\t" | 1767 | << uninst.join("") << "\n\t" |
1613 | << "-$(DEL_DIR) \"" << dst << "\"" << endl << endl; | 1768 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; |
1614 | all_uninstalls += "uninstall_" + (*it) + " "; | 1769 | all_uninstalls += "uninstall_" + (*it) + " "; |
1615 | } | 1770 | } |
1616 | t << endl; | 1771 | t << endl; |
1617 | } else { | 1772 | } else { |
1618 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); | 1773 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); |
1619 | } | 1774 | } |
1620 | } | 1775 | } |
1621 | t << "install: all " << all_installs << "\n\n"; | 1776 | t << "install: all " << all_installs << "\n\n"; |
1622 | t << "uninstall: " << all_uninstalls << "\n\n"; | 1777 | t << "uninstall: " << all_uninstalls << "\n\n"; |
1623 | } | 1778 | } |
1624 | 1779 | ||
1625 | QString | 1780 | QString |
1626 | MakefileGenerator::var(const QString &var) | 1781 | MakefileGenerator::var(const QString &var) |
1627 | { | 1782 | { |
1628 | return val(project->variables()[var]); | 1783 | return val(project->variables()[var]); |
1629 | } | 1784 | } |
@@ -1774,48 +1929,48 @@ QString MakefileGenerator::build_args() | |||
1774 | if (!ofile.isEmpty() && ofile != project->first("QMAKE_MAKEFILE")) | 1929 | if (!ofile.isEmpty() && ofile != project->first("QMAKE_MAKEFILE")) |
1775 | ret += " -o " + ofile; | 1930 | ret += " -o " + ofile; |
1776 | 1931 | ||
1777 | //inputs | 1932 | //inputs |
1778 | QStringList files = fileFixify(Option::mkfile::project_files); | 1933 | QStringList files = fileFixify(Option::mkfile::project_files); |
1779 | ret += " " + files.join(" "); | 1934 | ret += " " + files.join(" "); |
1780 | } | 1935 | } |
1781 | return ret; | 1936 | return ret; |
1782 | } | 1937 | } |
1783 | 1938 | ||
1784 | bool | 1939 | bool |
1785 | MakefileGenerator::writeHeader(QTextStream &t) | 1940 | MakefileGenerator::writeHeader(QTextStream &t) |
1786 | { | 1941 | { |
1787 | time_t foo = time(NULL); | 1942 | time_t foo = time(NULL); |
1788 | t << "#############################################################################" << endl; | 1943 | t << "#############################################################################" << endl; |
1789 | t << "# Makefile for building: " << var("TARGET") << endl; | 1944 | t << "# Makefile for building: " << var("TARGET") << endl; |
1790 | t << "# Generated by qmake (" << qmake_version() << ") on: " << ctime(&foo); | 1945 | t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: " << ctime(&foo); |
1791 | t << "# Project: " << fileFixify(project->projectFile()) << endl; | 1946 | t << "# Project: " << fileFixify(project->projectFile()) << endl; |
1792 | t << "# Template: " << var("TEMPLATE") << endl; | 1947 | t << "# Template: " << var("TEMPLATE") << endl; |
1793 | t << "# Command: " << build_args() << endl; | 1948 | t << "# Command: " << build_args() << endl; |
1794 | t << "#############################################################################" << endl; | 1949 | t << "#############################################################################" << endl; |
1795 | t << endl; | 1950 | t << endl; |
1796 | return TRUE; | 1951 | return TRUE; |
1797 | } | 1952 | } |
1798 | 1953 | ||
1799 | 1954 | ||
1800 | //makes my life easier.. | 1955 | //makes my life easier.. |
1801 | bool | 1956 | bool |
1802 | MakefileGenerator::writeMakeQmake(QTextStream &t) | 1957 | MakefileGenerator::writeMakeQmake(QTextStream &t) |
1803 | { | 1958 | { |
1804 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); | 1959 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); |
1805 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && | 1960 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake") && |
1806 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 1961 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
1807 | QStringList files = fileFixify(Option::mkfile::project_files); | 1962 | QStringList files = fileFixify(Option::mkfile::project_files); |
1808 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" | 1963 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" |
1809 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; | 1964 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; |
1810 | } | 1965 | } |
1811 | 1966 | ||
1812 | QString pfile = project->projectFile(); | 1967 | QString pfile = project->projectFile(); |
1813 | if(pfile != "(stdin)") { | 1968 | if(pfile != "(stdin)") { |
1814 | QString qmake = build_args(); | 1969 | QString qmake = build_args(); |
1815 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { | 1970 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { |
1816 | t << ofile << ": " << fileFixify(pfile) << " "; | 1971 | t << ofile << ": " << fileFixify(pfile) << " "; |
1817 | if(Option::mkfile::do_cache) | 1972 | if(Option::mkfile::do_cache) |
1818 | t << fileFixify(Option::mkfile::cachefile) << " "; | 1973 | t << fileFixify(Option::mkfile::cachefile) << " "; |
1819 | if(!specdir().isEmpty()) | 1974 | if(!specdir().isEmpty()) |
1820 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; | 1975 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; |
1821 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" | 1976 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" |
@@ -1833,35 +1988,41 @@ MakefileGenerator::writeMakeQmake(QTextStream &t) | |||
1833 | QStringList | 1988 | QStringList |
1834 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, bool force_fix) const | 1989 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, bool force_fix) const |
1835 | { | 1990 | { |
1836 | if(files.isEmpty()) | 1991 | if(files.isEmpty()) |
1837 | return files; | 1992 | return files; |
1838 | QStringList ret; | 1993 | QStringList ret; |
1839 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { | 1994 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { |
1840 | if(!(*it).isEmpty()) | 1995 | if(!(*it).isEmpty()) |
1841 | ret << fileFixify((*it), out_dir, in_dir, force_fix); | 1996 | ret << fileFixify((*it), out_dir, in_dir, force_fix); |
1842 | } | 1997 | } |
1843 | return ret; | 1998 | return ret; |
1844 | } | 1999 | } |
1845 | 2000 | ||
1846 | QString | 2001 | QString |
1847 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const QString &in_d, bool force_fix) const | 2002 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const QString &in_d, bool force_fix) const |
1848 | { | 2003 | { |
2004 | if(file0.isEmpty()) | ||
2005 | return file0; | ||
2006 | QString key = file0; | ||
2007 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix) | ||
2008 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "-"); | ||
2009 | if(fileFixed.contains(key)) | ||
2010 | return fileFixed[key]; | ||
2011 | |||
1849 | QString file = file0; | 2012 | QString file = file0; |
1850 | if(file.isEmpty()) | ||
1851 | return file; | ||
1852 | int depth = 4; | 2013 | int depth = 4; |
1853 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 2014 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
1854 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 2015 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
1855 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) | 2016 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) |
1856 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); | 2017 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); |
1857 | else if(Option::mkfile::cachefile_depth != -1) | 2018 | else if(Option::mkfile::cachefile_depth != -1) |
1858 | depth = Option::mkfile::cachefile_depth; | 2019 | depth = Option::mkfile::cachefile_depth; |
1859 | } | 2020 | } |
1860 | 2021 | ||
1861 | QChar quote; | 2022 | QChar quote; |
1862 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { | 2023 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { |
1863 | quote = file.at(0); | 2024 | quote = file.at(0); |
1864 | file = file.mid(1, file.length() - 2); | 2025 | file = file.mid(1, file.length() - 2); |
1865 | } | 2026 | } |
1866 | QString orig_file = file; | 2027 | QString orig_file = file; |
1867 | if(!force_fix && project->isActiveConfig("no_fixpath")) { | 2028 | if(!force_fix && project->isActiveConfig("no_fixpath")) { |
@@ -1877,74 +2038,88 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1877 | QString qfile(Option::fixPathToLocalOS(file, TRUE)), in_dir(in_d), out_dir(out_d); | 2038 | QString qfile(Option::fixPathToLocalOS(file, TRUE)), in_dir(in_d), out_dir(out_d); |
1878 | { | 2039 | { |
1879 | if(out_dir.isNull()) | 2040 | if(out_dir.isNull()) |
1880 | out_dir = Option::output_dir; | 2041 | out_dir = Option::output_dir; |
1881 | if(out_dir == ".") | 2042 | if(out_dir == ".") |
1882 | out_dir = QDir::currentDirPath(); | 2043 | out_dir = QDir::currentDirPath(); |
1883 | if(in_dir.isEmpty() || in_dir == ".") | 2044 | if(in_dir.isEmpty() || in_dir == ".") |
1884 | in_dir = QDir::currentDirPath(); | 2045 | in_dir = QDir::currentDirPath(); |
1885 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { | 2046 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { |
1886 | QFileInfo in_fi(in_dir); | 2047 | QFileInfo in_fi(in_dir); |
1887 | if(!in_fi.convertToAbs()) | 2048 | if(!in_fi.convertToAbs()) |
1888 | in_dir = in_fi.filePath(); | 2049 | in_dir = in_fi.filePath(); |
1889 | QFileInfo out_fi(out_dir); | 2050 | QFileInfo out_fi(out_dir); |
1890 | if(!out_fi.convertToAbs()) | 2051 | if(!out_fi.convertToAbs()) |
1891 | out_dir = out_fi.filePath(); | 2052 | out_dir = out_fi.filePath(); |
1892 | } | 2053 | } |
2054 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), | ||
2055 | out_canonical_dir = QDir(out_dir).canonicalPath(); | ||
2056 | if(!in_canonical_dir.isEmpty()) | ||
2057 | in_dir = in_canonical_dir; | ||
2058 | if(!out_canonical_dir.isEmpty()) | ||
2059 | out_dir = out_canonical_dir; | ||
1893 | } | 2060 | } |
1894 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { | 2061 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { |
1895 | if(QDir::isRelativePath(qfile)) { | 2062 | if(QDir::isRelativePath(qfile)) { |
1896 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && | 2063 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && |
1897 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) | 2064 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1898 | file.prepend(Option::dir_sep); | 2065 | file.prepend(Option::dir_sep); |
1899 | file.prepend(in_dir); | 2066 | file.prepend(in_dir); |
1900 | } | 2067 | } |
1901 | file = Option::fixPathToTargetOS(file, FALSE); | 2068 | file = Option::fixPathToTargetOS(file, FALSE); |
2069 | if(QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE)) { | ||
2070 | QString real_file = QDir(file).canonicalPath(); | ||
2071 | if(!real_file.isEmpty()) | ||
2072 | file = real_file; | ||
2073 | } | ||
1902 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); | 2074 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); |
1903 | if(file == match_dir) { | 2075 | if(file == match_dir) { |
1904 | file = ""; | 2076 | file = ""; |
1905 | } else if(file.startsWith(match_dir) && | 2077 | } else if(file.startsWith(match_dir) && |
1906 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { | 2078 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { |
1907 | file = file.right(file.length() - (match_dir.length() + 1)); | 2079 | file = file.right(file.length() - (match_dir.length() + 1)); |
1908 | } else { | 2080 | } else { |
1909 | for(int i = 1; i <= depth; i++) { | 2081 | for(int i = 1; i <= depth; i++) { |
1910 | int sl = match_dir.findRev(Option::dir_sep); | 2082 | int sl = match_dir.findRev(Option::dir_sep); |
1911 | if(sl == -1) | 2083 | if(sl == -1) |
1912 | break; | 2084 | break; |
1913 | match_dir = match_dir.left(sl); | 2085 | match_dir = match_dir.left(sl); |
1914 | if(match_dir.isEmpty()) | 2086 | if(match_dir.isEmpty()) |
1915 | break; | 2087 | break; |
1916 | if(file.startsWith(match_dir) && | 2088 | if(file.startsWith(match_dir) && |
1917 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { | 2089 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { |
1918 | //concat | 2090 | //concat |
1919 | int remlen = file.length() - (match_dir.length() + 1); | 2091 | int remlen = file.length() - (match_dir.length() + 1); |
1920 | if (remlen < 0) | 2092 | if (remlen < 0) |
1921 | remlen = 0; | 2093 | remlen = 0; |
1922 | file = file.right(remlen); | 2094 | file = file.right(remlen); |
1923 | //prepend | 2095 | //prepend |
1924 | for(int o = 0; o < i; o++) | 2096 | for(int o = 0; o < i; o++) |
1925 | file.prepend(".." + Option::dir_sep); | 2097 | file.prepend(".." + Option::dir_sep); |
1926 | } | 2098 | } |
1927 | } | 2099 | } |
1928 | } | 2100 | } |
1929 | } | 2101 | } |
1930 | } | 2102 | } |
1931 | file = Option::fixPathToTargetOS(file, FALSE); | 2103 | file = Option::fixPathToTargetOS(file, FALSE); |
2104 | if(file.isEmpty()) | ||
2105 | file = "."; | ||
1932 | if(!quote.isNull()) | 2106 | if(!quote.isNull()) |
1933 | file = quote + file + quote; | 2107 | file = quote + file + quote; |
1934 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); | 2108 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); |
2109 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); | ||
1935 | return file; | 2110 | return file; |
1936 | } | 2111 | } |
1937 | 2112 | ||
1938 | QString | 2113 | QString |
1939 | MakefileGenerator::cleanFilePath(const QString &file) const | 2114 | MakefileGenerator::cleanFilePath(const QString &file) const |
1940 | { | 2115 | { |
1941 | return fileFixify(Option::fixPathToTargetOS(file)); | 2116 | return fileFixify(Option::fixPathToTargetOS(file)); |
1942 | } | 2117 | } |
1943 | 2118 | ||
1944 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) | 2119 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) |
1945 | { | 2120 | { |
1946 | if(!(Option::warn_level & WarnLogic)) | 2121 | if(!(Option::warn_level & WarnLogic)) |
1947 | return; | 2122 | return; |
1948 | QString file = f; | 2123 | QString file = f; |
1949 | int slsh = f.findRev(Option::dir_sep); | 2124 | int slsh = f.findRev(Option::dir_sep); |
1950 | if(slsh != -1) | 2125 | if(slsh != -1) |
@@ -2026,60 +2201,63 @@ MakefileGenerator::openOutput(QFile &file) const | |||
2026 | createDir(file.name().left(slsh)); | 2201 | createDir(file.name().left(slsh)); |
2027 | if(file.open(IO_WriteOnly | IO_Translate)) { | 2202 | if(file.open(IO_WriteOnly | IO_Translate)) { |
2028 | QFileInfo fi(Option::output); | 2203 | QFileInfo fi(Option::output); |
2029 | QString od = Option::fixPathToTargetOS((fi.isSymLink() ? fi.readLink() : fi.dirPath()) ); | 2204 | QString od = Option::fixPathToTargetOS((fi.isSymLink() ? fi.readLink() : fi.dirPath()) ); |
2030 | if(QDir::isRelativePath(od)) | 2205 | if(QDir::isRelativePath(od)) |
2031 | od.prepend(Option::output_dir); | 2206 | od.prepend(Option::output_dir); |
2032 | Option::output_dir = od; | 2207 | Option::output_dir = od; |
2033 | return TRUE; | 2208 | return TRUE; |
2034 | } | 2209 | } |
2035 | return FALSE; | 2210 | return FALSE; |
2036 | } | 2211 | } |
2037 | 2212 | ||
2038 | 2213 | ||
2039 | 2214 | ||
2040 | //Factory thing | 2215 | //Factory thing |
2041 | #include "unixmake.h" | 2216 | #include "unixmake.h" |
2042 | #include "borland_bmake.h" | ||
2043 | #include "msvc_nmake.h" | 2217 | #include "msvc_nmake.h" |
2218 | #include "borland_bmake.h" | ||
2219 | #include "mingw_make.h" | ||
2044 | #include "msvc_dsp.h" | 2220 | #include "msvc_dsp.h" |
2045 | #include "msvc_vcproj.h" | 2221 | #include "msvc_vcproj.h" |
2046 | #include "metrowerks_xml.h" | 2222 | #include "metrowerks_xml.h" |
2047 | #include "pbuilder_pbx.h" | 2223 | #include "pbuilder_pbx.h" |
2048 | #include "projectgenerator.h" | 2224 | #include "projectgenerator.h" |
2049 | 2225 | ||
2050 | MakefileGenerator * | 2226 | MakefileGenerator * |
2051 | MakefileGenerator::create(QMakeProject *proj) | 2227 | MakefileGenerator::create(QMakeProject *proj) |
2052 | { | 2228 | { |
2053 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) | 2229 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) |
2054 | return new ProjectGenerator(proj); | 2230 | return new ProjectGenerator(proj); |
2055 | 2231 | ||
2056 | MakefileGenerator *mkfile = NULL; | 2232 | MakefileGenerator *mkfile = NULL; |
2057 | QString gen = proj->first("MAKEFILE_GENERATOR"); | 2233 | QString gen = proj->first("MAKEFILE_GENERATOR"); |
2058 | if(gen.isEmpty()) { | 2234 | if(gen.isEmpty()) { |
2059 | fprintf(stderr, "No generator specified in config file: %s\n", | 2235 | fprintf(stderr, "No generator specified in config file: %s\n", |
2060 | proj->projectFile().latin1()); | 2236 | proj->projectFile().latin1()); |
2061 | } else if(gen == "UNIX") { | 2237 | } else if(gen == "UNIX") { |
2062 | mkfile = new UnixMakefileGenerator(proj); | 2238 | mkfile = new UnixMakefileGenerator(proj); |
2063 | } else if(gen == "MSVC") { | 2239 | } else if(gen == "MSVC") { |
2064 | // Visual Studio =< v6.0 | 2240 | // Visual Studio =< v6.0 |
2065 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2241 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
2066 | mkfile = new DspMakefileGenerator(proj); | 2242 | mkfile = new DspMakefileGenerator(proj); |
2067 | else | 2243 | else |
2068 | mkfile = new NmakeMakefileGenerator(proj); | 2244 | mkfile = new NmakeMakefileGenerator(proj); |
2069 | } else if(gen == "MSVC.NET") { | 2245 | } else if(gen == "MSVC.NET") { |
2070 | // Visual Studio >= v7.0 | 2246 | // Visual Studio >= v7.0 |
2071 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2247 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
2072 | mkfile = new VcprojGenerator(proj); | 2248 | mkfile = new VcprojGenerator(proj); |
2073 | else | 2249 | else |
2074 | mkfile = new NmakeMakefileGenerator(proj); | 2250 | mkfile = new NmakeMakefileGenerator(proj); |
2075 | } else if(gen == "BMAKE") { | 2251 | } else if(gen == "BMAKE") { |
2076 | mkfile = new BorlandMakefileGenerator(proj); | 2252 | mkfile = new BorlandMakefileGenerator(proj); |
2253 | } else if(gen == "MINGW") { | ||
2254 | mkfile = new MingwMakefileGenerator(proj); | ||
2077 | } else if(gen == "METROWERKS") { | 2255 | } else if(gen == "METROWERKS") { |
2078 | mkfile = new MetrowerksMakefileGenerator(proj); | 2256 | mkfile = new MetrowerksMakefileGenerator(proj); |
2079 | } else if(gen == "PROJECTBUILDER") { | 2257 | } else if(gen == "PROJECTBUILDER") { |
2080 | mkfile = new ProjectBuilderMakefileGenerator(proj); | 2258 | mkfile = new ProjectBuilderMakefileGenerator(proj); |
2081 | } else { | 2259 | } else { |
2082 | fprintf(stderr, "Unknown generator specified: %s\n", gen.latin1()); | 2260 | fprintf(stderr, "Unknown generator specified: %s\n", gen.latin1()); |
2083 | } | 2261 | } |
2084 | return mkfile; | 2262 | return mkfile; |
2085 | } | 2263 | } |
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 1d19d98..4fdabe8 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
@@ -34,63 +34,63 @@ | |||
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __MAKEFILE_H__ | 37 | #ifndef __MAKEFILE_H__ |
38 | #define __MAKEFILE_H__ | 38 | #define __MAKEFILE_H__ |
39 | 39 | ||
40 | #include "option.h" | 40 | #include "option.h" |
41 | #include "project.h" | 41 | #include "project.h" |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | 43 | ||
44 | class MakefileGenerator | 44 | class MakefileGenerator |
45 | { | 45 | { |
46 | QString spec; | 46 | QString spec; |
47 | bool init_opath_already, init_already, moc_aware, no_io; | 47 | bool init_opath_already, init_already, moc_aware, no_io; |
48 | QStringList createObjectList(const QString &var); | 48 | QStringList createObjectList(const QString &var); |
49 | QString build_args(); | 49 | QString build_args(); |
50 | QMap<QString, QString> depHeuristics, depKeyMap; | 50 | QMap<QString, QString> depHeuristics, depKeyMap, fileFixed; |
51 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; | 51 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; |
52 | QMap<QString, QStringList> depends; | 52 | QMap<QString, QStringList> depends; |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | void writeObj(QTextStream &, const QString &obj, const QString &src); | 55 | void writeObj(QTextStream &, const QString &obj, const QString &src); |
56 | void writeUicSrc(QTextStream &, const QString &ui); | 56 | void writeUicSrc(QTextStream &, const QString &ui); |
57 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); | 57 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); |
58 | void writeMocSrc(QTextStream &, const QString &src); | 58 | void writeMocSrc(QTextStream &, const QString &src); |
59 | void writeLexSrc(QTextStream &, const QString &lex); | 59 | void writeLexSrc(QTextStream &, const QString &lex); |
60 | void writeYaccSrc(QTextStream &, const QString &yac); | 60 | void writeYaccSrc(QTextStream &, const QString &yac); |
61 | void writeInstalls(QTextStream &t, const QString &installs); | 61 | void writeInstalls(QTextStream &t, const QString &installs); |
62 | void writeImageObj(QTextStream &t, const QString &obj); | 62 | void writeImageObj(QTextStream &t, const QString &obj); |
63 | void writeImageSrc(QTextStream &t, const QString &images); | 63 | void writeImageSrc(QTextStream &t, const QString &images); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | 66 | ||
67 | QMakeProject *project; | 67 | QMakeProject *project; |
68 | 68 | ||
69 | class MakefileDependDir { | 69 | class MakefileDependDir { |
70 | public: | 70 | public: |
71 | MakefileDependDir(QString r, QString l) : real_dir(r), local_dir(l) { } | 71 | MakefileDependDir(const QString &r, const QString &l) : real_dir(r), local_dir(l) { } |
72 | QString real_dir, local_dir; | 72 | QString real_dir, local_dir; |
73 | }; | 73 | }; |
74 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, QString x, bool recurse); | 74 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse); |
75 | 75 | ||
76 | QString buildArgs(); | 76 | QString buildArgs(); |
77 | 77 | ||
78 | QString specdir(); | 78 | QString specdir(); |
79 | QString cleanFilePath(const QString &file) const; | 79 | QString cleanFilePath(const QString &file) const; |
80 | bool generateMocList(QString fn); | 80 | bool generateMocList(const QString &fn); |
81 | 81 | ||
82 | QString findMocSource(const QString &moc_file) const; | 82 | QString findMocSource(const QString &moc_file) const; |
83 | QString findMocDestination(const QString &src_file) const; | 83 | QString findMocDestination(const QString &src_file) const; |
84 | QStringList &findDependencies(const QString &file); | 84 | QStringList &findDependencies(const QString &file); |
85 | 85 | ||
86 | void setNoIO(bool o); | 86 | void setNoIO(bool o); |
87 | bool noIO() const; | 87 | bool noIO() const; |
88 | 88 | ||
89 | void setMocAware(bool o); | 89 | void setMocAware(bool o); |
90 | bool mocAware() const; | 90 | bool mocAware() const; |
91 | void logicWarn(const QString &, const QString &); | 91 | void logicWarn(const QString &, const QString &); |
92 | 92 | ||
93 | virtual bool doDepends() const { return Option::mkfile::do_deps; } | 93 | virtual bool doDepends() const { return Option::mkfile::do_deps; } |
94 | bool writeHeader(QTextStream &); | 94 | bool writeHeader(QTextStream &); |
95 | virtual bool writeMakefile(QTextStream &); | 95 | virtual bool writeMakefile(QTextStream &); |
96 | virtual bool writeMakeQmake(QTextStream &); | 96 | virtual bool writeMakeQmake(QTextStream &); |
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 5ff6250..1515216 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp | |||
@@ -29,72 +29,80 @@ | |||
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "projectgenerator.h" | 38 | #include "projectgenerator.h" |
39 | #include "option.h" | 39 | #include "option.h" |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | 44 | ||
45 | QString project_builtin_regx() //calculate the builtin regular expression.. | ||
46 | { | ||
47 | QString ret; | ||
48 | QStringList builtin_exts(".c"); | ||
49 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext << ".ts"; | ||
50 | builtin_exts += Option::h_ext + Option::cpp_ext; | ||
51 | for(QStringList::Iterator ext_it = builtin_exts.begin(); | ||
52 | ext_it != builtin_exts.end(); ++ext_it) { | ||
53 | if(!ret.isEmpty()) | ||
54 | ret += "; "; | ||
55 | ret += QString("*") + (*ext_it); | ||
56 | } | ||
57 | return ret; | ||
58 | } | ||
59 | |||
60 | |||
45 | 61 | ||
46 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) | 62 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) |
47 | { | 63 | { |
48 | } | 64 | } |
49 | 65 | ||
50 | void | 66 | void |
51 | ProjectGenerator::init() | 67 | ProjectGenerator::init() |
52 | { | 68 | { |
53 | if(init_flag) | 69 | if(init_flag) |
54 | return; | 70 | return; |
55 | int file_count = 0; | 71 | int file_count = 0; |
56 | init_flag = TRUE; | 72 | init_flag = TRUE; |
57 | 73 | ||
58 | QMap<QString, QStringList> &v = project->variables(); | 74 | QMap<QString, QStringList> &v = project->variables(); |
59 | QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template; | 75 | QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template; |
60 | if(!Option::user_template_prefix.isEmpty()) | 76 | if(!Option::user_template_prefix.isEmpty()) |
61 | templ.prepend(Option::user_template_prefix); | 77 | templ.prepend(Option::user_template_prefix); |
62 | v["TEMPLATE_ASSIGN"] += templ; | 78 | v["TEMPLATE_ASSIGN"] += templ; |
63 | 79 | ||
64 | //figure out target | 80 | //figure out target |
65 | if(Option::output.name() == "-" || Option::output.name().isEmpty()) | 81 | if(Option::output.name() == "-" || Option::output.name().isEmpty()) |
66 | v["TARGET"] = QStringList("unknown"); | 82 | v["TARGET"] = QStringList("unknown"); |
67 | 83 | ||
68 | //the scary stuff | 84 | //the scary stuff |
69 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { | 85 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { |
70 | QString builtin_regex; | 86 | QString builtin_regex = project_builtin_regx(); |
71 | { //calculate the builtin regular expression.. | ||
72 | QStringList builtin_exts(".c"); | ||
73 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext; | ||
74 | builtin_exts += Option::h_ext + Option::cpp_ext; | ||
75 | for(QStringList::Iterator ext_it = builtin_exts.begin(); | ||
76 | ext_it != builtin_exts.end(); ++ext_it) { | ||
77 | if(!builtin_regex.isEmpty()) | ||
78 | builtin_regex += "; "; | ||
79 | builtin_regex += QString("*") + (*ext_it); | ||
80 | } | ||
81 | } | ||
82 | QStringList dirs = Option::projfile::project_dirs; | 87 | QStringList dirs = Option::projfile::project_dirs; |
83 | if(Option::projfile::do_pwd) | 88 | if(Option::projfile::do_pwd) { |
89 | if(!v["INCLUDEPATH"].contains(".")) | ||
90 | v["INCLUDEPATH"] += "."; | ||
84 | dirs.prepend(QDir::currentDirPath()); | 91 | dirs.prepend(QDir::currentDirPath()); |
92 | } | ||
85 | 93 | ||
86 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { | 94 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { |
87 | QString dir, regex; | 95 | QString dir, regex; |
88 | bool add_depend = FALSE; | 96 | bool add_depend = FALSE; |
89 | if(QFile::exists((*pd))) { | 97 | if(QFile::exists((*pd))) { |
90 | QFileInfo fi((*pd)); | 98 | QFileInfo fi((*pd)); |
91 | if(fi.isDir()) { | 99 | if(fi.isDir()) { |
92 | dir = (*pd); | 100 | dir = (*pd); |
93 | add_depend = TRUE; | 101 | add_depend = TRUE; |
94 | if(dir.right(1) != Option::dir_sep) | 102 | if(dir.right(1) != Option::dir_sep) |
95 | dir += Option::dir_sep; | 103 | dir += Option::dir_sep; |
96 | if(Option::projfile::do_recursive) { | 104 | if(Option::projfile::do_recursive) { |
97 | QDir d(dir); | 105 | QDir d(dir); |
98 | d.setFilter(QDir::Dirs); | 106 | d.setFilter(QDir::Dirs); |
99 | for(int i = 0; i < (int)d.count(); i++) { | 107 | for(int i = 0; i < (int)d.count(); i++) { |
100 | if(d[i] != "." && d[i] != "..") | 108 | if(d[i] != "." && d[i] != "..") |
@@ -127,35 +135,34 @@ ProjectGenerator::init() | |||
127 | for(int i = 0; i < (int)d.count(); i++) { | 135 | for(int i = 0; i < (int)d.count(); i++) { |
128 | if(d[i] != "." && d[i] != "..") | 136 | if(d[i] != "." && d[i] != "..") |
129 | dirs.append(dir + d[i] + QDir::separator() + regex); | 137 | dirs.append(dir + d[i] + QDir::separator() + regex); |
130 | } | 138 | } |
131 | } | 139 | } |
132 | QDir d(dir, regex); | 140 | QDir d(dir, regex); |
133 | for(int i = 0; i < (int)d.count(); i++) { | 141 | for(int i = 0; i < (int)d.count(); i++) { |
134 | QString file = dir + d[i]; | 142 | QString file = dir + d[i]; |
135 | if (addFile(file)) { | 143 | if (addFile(file)) { |
136 | add_depend = TRUE; | 144 | add_depend = TRUE; |
137 | file_count++; | 145 | file_count++; |
138 | } | 146 | } |
139 | } | 147 | } |
140 | } | 148 | } |
141 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { | 149 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { |
142 | QFileInfo fi(dir); | 150 | QFileInfo fi(dir); |
143 | if(fi.absFilePath() != QDir::currentDirPath()) { | 151 | if(fi.absFilePath() != QDir::currentDirPath()) |
144 | v["DEPENDPATH"] += fileFixify(dir); | 152 | v["DEPENDPATH"] += fileFixify(dir); |
145 | } | ||
146 | } | 153 | } |
147 | } | 154 | } |
148 | } | 155 | } |
149 | if(!file_count) { //shall we try a subdir? | 156 | if(!file_count) { //shall we try a subdir? |
150 | QStringList dirs = Option::projfile::project_dirs; | 157 | QStringList dirs = Option::projfile::project_dirs; |
151 | if(Option::projfile::do_pwd) | 158 | if(Option::projfile::do_pwd) |
152 | dirs.prepend("."); | 159 | dirs.prepend("."); |
153 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { | 160 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { |
154 | if(QFile::exists((*pd))) { | 161 | if(QFile::exists((*pd))) { |
155 | QString newdir = (*pd); | 162 | QString newdir = (*pd); |
156 | QFileInfo fi(newdir); | 163 | QFileInfo fi(newdir); |
157 | if(fi.isDir()) { | 164 | if(fi.isDir()) { |
158 | newdir = fileFixify(newdir); | 165 | newdir = fileFixify(newdir); |
159 | QStringList &subdirs = v["SUBDIRS"]; | 166 | QStringList &subdirs = v["SUBDIRS"]; |
160 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && | 167 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && |
161 | !subdirs.contains(newdir)) { | 168 | !subdirs.contains(newdir)) { |
@@ -228,56 +235,65 @@ ProjectGenerator::init() | |||
228 | QStringList &d = v["DEPENDPATH"]; | 235 | QStringList &d = v["DEPENDPATH"]; |
229 | for(QStringList::Iterator it = d.begin(); it != d.end(); ++it) { | 236 | for(QStringList::Iterator it = d.begin(); it != d.end(); ++it) { |
230 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); | 237 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); |
231 | deplist.append(new MakefileDependDir(r, l)); | 238 | deplist.append(new MakefileDependDir(r, l)); |
232 | } | 239 | } |
233 | } | 240 | } |
234 | QStringList &h = v["HEADERS"]; | 241 | QStringList &h = v["HEADERS"]; |
235 | bool no_qt_files = TRUE; | 242 | bool no_qt_files = TRUE; |
236 | QString srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "INTERFACES", QString::null }; | 243 | QString srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "INTERFACES", QString::null }; |
237 | for(int i = 0; !srcs[i].isNull(); i++) { | 244 | for(int i = 0; !srcs[i].isNull(); i++) { |
238 | QStringList &l = v[srcs[i]]; | 245 | QStringList &l = v[srcs[i]]; |
239 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 246 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
240 | if(generateDependencies(deplist, (*val_it), TRUE)) { | 247 | if(generateDependencies(deplist, (*val_it), TRUE)) { |
241 | QStringList &tmp = findDependencies((*val_it)); | 248 | QStringList &tmp = findDependencies((*val_it)); |
242 | if(!tmp.isEmpty()) { | 249 | if(!tmp.isEmpty()) { |
243 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { | 250 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { |
244 | QString file_no_path = (*dep_it).right( | 251 | QString file_dir = (*dep_it).section(Option::dir_sep, 0, -2), |
245 | (*dep_it).length() - ((*dep_it).findRev(Option::dir_sep)+1)); | 252 | file_no_path = (*dep_it).section(Option::dir_sep, -1); |
253 | if(!file_dir.isEmpty()) { | ||
254 | for(MakefileDependDir *mdd = deplist.first(); mdd; mdd = deplist.next()) { | ||
255 | if(mdd->local_dir == file_dir && !v["INCLUDEPATH"].contains(mdd->real_dir)) | ||
256 | v["INCLUDEPATH"] += mdd->real_dir; | ||
257 | } | ||
258 | } | ||
246 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) | 259 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) |
247 | no_qt_files = FALSE; | 260 | no_qt_files = FALSE; |
248 | QString h_ext; | 261 | QString h_ext; |
249 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 262 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
263 | hit != Option::h_ext.end(); ++hit) { | ||
250 | if((*dep_it).endsWith((*hit))) { | 264 | if((*dep_it).endsWith((*hit))) { |
251 | h_ext = (*hit); | 265 | h_ext = (*hit); |
252 | break; | 266 | break; |
253 | } | 267 | } |
254 | } | 268 | } |
255 | if(!h_ext.isEmpty()) { | 269 | if(!h_ext.isEmpty()) { |
256 | if((*dep_it).left(1).lower() == "q") { | 270 | if((*dep_it).left(1).lower() == "q") { |
257 | QString qhdr = (*dep_it).lower(); | 271 | QString qhdr = (*dep_it).lower(); |
258 | if(file_no_path == "qthread.h") | 272 | if(file_no_path == "qthread.h") |
259 | addConfig("thread"); | 273 | addConfig("thread"); |
260 | } | 274 | } |
261 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 275 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
262 | cppit != Option::cpp_ext.end(); ++cppit) { | 276 | cppit != Option::cpp_ext.end(); ++cppit) { |
263 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + (*cppit)); | 277 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + |
278 | (*cppit)); | ||
264 | if(QFile::exists(src)) { | 279 | if(QFile::exists(src)) { |
265 | bool exists = FALSE; | 280 | bool exists = FALSE; |
266 | QStringList &srcl = v["SOURCES"]; | 281 | QStringList &srcl = v["SOURCES"]; |
267 | for(QStringList::Iterator src_it = srcl.begin(); src_it != srcl.end(); ++src_it) { | 282 | for(QStringList::Iterator src_it = srcl.begin(); |
283 | src_it != srcl.end(); ++src_it) { | ||
268 | if((*src_it).lower() == src.lower()) { | 284 | if((*src_it).lower() == src.lower()) { |
269 | exists = TRUE; | 285 | exists = TRUE; |
270 | break; | 286 | break; |
271 | } | 287 | } |
272 | } | 288 | } |
273 | if(!exists) | 289 | if(!exists) |
274 | srcl.append(src); | 290 | srcl.append(src); |
275 | } | 291 | } |
276 | } | 292 | } |
277 | } else if((*dep_it).endsWith(Option::lex_ext) && | 293 | } else if((*dep_it).endsWith(Option::lex_ext) && |
278 | file_no_path.startsWith(Option::lex_mod)) { | 294 | file_no_path.startsWith(Option::lex_mod)) { |
279 | addConfig("lex_included"); | 295 | addConfig("lex_included"); |
280 | } | 296 | } |
281 | if(!h.contains((*dep_it))) { | 297 | if(!h.contains((*dep_it))) { |
282 | if(generateMocList((*dep_it)) && !findMocDestination((*dep_it)).isEmpty()) | 298 | if(generateMocList((*dep_it)) && !findMocDestination((*dep_it)).isEmpty()) |
283 | h += (*dep_it); | 299 | h += (*dep_it); |
@@ -324,40 +340,42 @@ bool | |||
324 | ProjectGenerator::writeMakefile(QTextStream &t) | 340 | ProjectGenerator::writeMakefile(QTextStream &t) |
325 | { | 341 | { |
326 | t << "######################################################################" << endl; | 342 | t << "######################################################################" << endl; |
327 | t << "# Automatically generated by qmake (" << qmake_version() << ") " << QDateTime::currentDateTime().toString() << endl; | 343 | t << "# Automatically generated by qmake (" << qmake_version() << ") " << QDateTime::currentDateTime().toString() << endl; |
328 | t << "######################################################################" << endl << endl; | 344 | t << "######################################################################" << endl << endl; |
329 | QStringList::Iterator it; | 345 | QStringList::Iterator it; |
330 | for(it = Option::before_user_vars.begin(); it != Option::before_user_vars.end(); ++it) | 346 | for(it = Option::before_user_vars.begin(); it != Option::before_user_vars.end(); ++it) |
331 | t << (*it) << endl; | 347 | t << (*it) << endl; |
332 | t << getWritableVar("TEMPLATE_ASSIGN", FALSE); | 348 | t << getWritableVar("TEMPLATE_ASSIGN", FALSE); |
333 | if(project->first("TEMPLATE_ASSIGN") == "subdirs") { | 349 | if(project->first("TEMPLATE_ASSIGN") == "subdirs") { |
334 | t << endl << "# Directories" << "\n" | 350 | t << endl << "# Directories" << "\n" |
335 | << getWritableVar("SUBDIRS"); | 351 | << getWritableVar("SUBDIRS"); |
336 | } else { | 352 | } else { |
337 | t << getWritableVar("TARGET") | 353 | t << getWritableVar("TARGET") |
338 | << getWritableVar("CONFIG", FALSE) | 354 | << getWritableVar("CONFIG", FALSE) |
339 | << getWritableVar("CONFIG_REMOVE", FALSE) | 355 | << getWritableVar("CONFIG_REMOVE", FALSE) |
340 | << getWritableVar("DEPENDPATH") << endl; | 356 | << getWritableVar("DEPENDPATH") |
357 | << getWritableVar("INCLUDEPATH") << endl; | ||
341 | 358 | ||
342 | t << "# Input" << "\n"; | 359 | t << "# Input" << "\n"; |
343 | t << getWritableVar("HEADERS") | 360 | t << getWritableVar("HEADERS") |
344 | << getWritableVar("INTERFACES") | 361 | << getWritableVar("INTERFACES") |
345 | << getWritableVar("LEXSOURCES") | 362 | << getWritableVar("LEXSOURCES") |
346 | << getWritableVar("YACCSOURCES") | 363 | << getWritableVar("YACCSOURCES") |
347 | << getWritableVar("SOURCES"); | 364 | << getWritableVar("SOURCES") |
365 | << getWritableVar("TRANSLATIONS"); | ||
348 | } | 366 | } |
349 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) | 367 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) |
350 | t << (*it) << endl; | 368 | t << (*it) << endl; |
351 | return TRUE; | 369 | return TRUE; |
352 | } | 370 | } |
353 | 371 | ||
354 | bool | 372 | bool |
355 | ProjectGenerator::addConfig(const QString &cfg, bool add) | 373 | ProjectGenerator::addConfig(const QString &cfg, bool add) |
356 | { | 374 | { |
357 | QString where = "CONFIG"; | 375 | QString where = "CONFIG"; |
358 | if(!add) | 376 | if(!add) |
359 | where = "CONFIG_REMOVE"; | 377 | where = "CONFIG_REMOVE"; |
360 | if(!project->variables()[where].contains(cfg)) { | 378 | if(!project->variables()[where].contains(cfg)) { |
361 | project->variables()[where] += cfg; | 379 | project->variables()[where] += cfg; |
362 | return TRUE; | 380 | return TRUE; |
363 | } | 381 | } |
@@ -390,32 +408,34 @@ ProjectGenerator::addFile(QString file) | |||
390 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 408 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { |
391 | if(file.endsWith((*hit))) { | 409 | if(file.endsWith((*hit))) { |
392 | where = "HEADERS"; | 410 | where = "HEADERS"; |
393 | break; | 411 | break; |
394 | } | 412 | } |
395 | } | 413 | } |
396 | } | 414 | } |
397 | if(where.isEmpty()) { | 415 | if(where.isEmpty()) { |
398 | if(file.endsWith(Option::ui_ext)) | 416 | if(file.endsWith(Option::ui_ext)) |
399 | where = "INTERFACES"; | 417 | where = "INTERFACES"; |
400 | else if(file.endsWith(".c")) | 418 | else if(file.endsWith(".c")) |
401 | where = "SOURCES"; | 419 | where = "SOURCES"; |
402 | else if(file.endsWith(Option::lex_ext)) | 420 | else if(file.endsWith(Option::lex_ext)) |
403 | where = "LEXSOURCES"; | 421 | where = "LEXSOURCES"; |
404 | else if(file.endsWith(Option::yacc_ext)) | 422 | else if(file.endsWith(Option::yacc_ext)) |
405 | where = "YACCSOURCES"; | 423 | where = "YACCSOURCES"; |
424 | else if(file.endsWith(".ts")) | ||
425 | where = "TRANSLATIONS"; | ||
406 | } | 426 | } |
407 | 427 | ||
408 | QString newfile = fileFixify(file); | 428 | QString newfile = fileFixify(file); |
409 | if(!where.isEmpty() && !project->variables()[where].contains(file)) { | 429 | if(!where.isEmpty() && !project->variables()[where].contains(file)) { |
410 | project->variables()[where] += newfile; | 430 | project->variables()[where] += newfile; |
411 | return TRUE; | 431 | return TRUE; |
412 | } | 432 | } |
413 | return FALSE; | 433 | return FALSE; |
414 | } | 434 | } |
415 | 435 | ||
416 | 436 | ||
417 | QString | 437 | QString |
418 | ProjectGenerator::getWritableVar(const QString &v, bool /*fixPath*/) | 438 | ProjectGenerator::getWritableVar(const QString &v, bool /*fixPath*/) |
419 | { | 439 | { |
420 | QStringList &vals = project->variables()[v]; | 440 | QStringList &vals = project->variables()[v]; |
421 | if(vals.isEmpty()) | 441 | if(vals.isEmpty()) |
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 7df95b2..e274481 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
@@ -59,44 +59,43 @@ UnixMakefileGenerator::init() | |||
59 | if(project->first("TEMPLATE") == "app") | 59 | if(project->first("TEMPLATE") == "app") |
60 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 60 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
61 | else if(project->first("TEMPLATE") == "lib") | 61 | else if(project->first("TEMPLATE") == "lib") |
62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
63 | else if(project->first("TEMPLATE") == "subdirs") { | 63 | else if(project->first("TEMPLATE") == "subdirs") { |
64 | MakefileGenerator::init(); | 64 | MakefileGenerator::init(); |
65 | if(project->isEmpty("MAKEFILE")) | 65 | if(project->isEmpty("MAKEFILE")) |
66 | project->variables()["MAKEFILE"].append("Makefile"); | 66 | project->variables()["MAKEFILE"].append("Makefile"); |
67 | if(project->isEmpty("QMAKE")) | 67 | if(project->isEmpty("QMAKE")) |
68 | project->variables()["QMAKE"].append("qmake"); | 68 | project->variables()["QMAKE"].append("qmake"); |
69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
71 | return; /* subdirs is done */ | 71 | return; /* subdirs is done */ |
72 | } | 72 | } |
73 | 73 | ||
74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { | 74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { |
75 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 75 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
76 | if ( os == "cygwin" ) { | ||
77 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
78 | } else { | ||
79 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); | 76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); |
77 | } else { | ||
78 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
80 | } | 79 | } |
81 | } | 80 | } |
82 | if( project->isEmpty("QMAKE_COPY_FILE") ) | 81 | if( project->isEmpty("QMAKE_COPY_FILE") ) |
83 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); | 82 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); |
84 | if( project->isEmpty("QMAKE_COPY_DIR") ) | 83 | if( project->isEmpty("QMAKE_COPY_DIR") ) |
85 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); | 84 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); |
86 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET | 85 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
87 | if(!project->isEmpty("TARGET")) { | 86 | if(!project->isEmpty("TARGET")) { |
88 | QString targ = project->first("TARGET"); | 87 | QString targ = project->first("TARGET"); |
89 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); | 88 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); |
90 | if(slsh != -1) { | 89 | if(slsh != -1) { |
91 | if(project->isEmpty("DESTDIR")) | 90 | if(project->isEmpty("DESTDIR")) |
92 | project->values("DESTDIR").append(""); | 91 | project->values("DESTDIR").append(""); |
93 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) | 92 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) |
94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; | 93 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; |
95 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); | 94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); |
96 | project->variables()["TARGET"] = targ.mid(slsh+1); | 95 | project->variables()["TARGET"] = targ.mid(slsh+1); |
97 | } | 96 | } |
98 | } | 97 | } |
99 | 98 | ||
100 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 99 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
101 | 100 | ||
102 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || | 101 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || |
@@ -125,104 +124,104 @@ UnixMakefileGenerator::init() | |||
125 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 124 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
126 | } else { | 125 | } else { |
127 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
128 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
129 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 128 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
130 | } | 129 | } |
131 | if(!project->isEmpty("QMAKE_INCREMENTAL")) | 130 | if(!project->isEmpty("QMAKE_INCREMENTAL")) |
132 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; | 131 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; |
133 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && | 132 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && |
134 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && | 133 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && |
135 | project->isActiveConfig("dll")) | 134 | project->isActiveConfig("dll")) |
136 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; | 135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; |
137 | if(!project->isEmpty("QMAKE_INCDIR")) | 136 | if(!project->isEmpty("QMAKE_INCDIR")) |
138 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 137 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
139 | if(!project->isEmpty("QMAKE_LIBDIR")) { | 138 | if(!project->isEmpty("QMAKE_LIBDIR")) { |
140 | if ( !project->isEmpty("QMAKE_RPATH") ) | 139 | if ( !project->isEmpty("QMAKE_RPATH") ) |
141 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), | 140 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), |
142 | " " + var("QMAKE_RPATH"), ""); | 141 | " " + var("QMAKE_RPATH"), ""); |
143 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); | 142 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); |
144 | } | 143 | } |
145 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { | 144 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { |
146 | if(configs.findIndex("x11lib") == -1) | 145 | if(configs.findIndex("x11lib") == -1) |
147 | configs.append("x11lib"); | 146 | configs.append("x11lib"); |
148 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | 147 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) |
149 | configs.append("x11inc"); | 148 | configs.append("x11inc"); |
150 | } | 149 | } |
151 | if ( project->isActiveConfig("x11") ) { | 150 | if ( project->isActiveConfig("x11") ) { |
152 | if(configs.findIndex("x11lib") == -1) | 151 | if(configs.findIndex("x11lib") == -1) |
153 | configs.append("x11lib"); | 152 | configs.append("x11lib"); |
154 | if(configs.findIndex("x11inc") == -1) | 153 | if(configs.findIndex("x11inc") == -1) |
155 | configs.append("x11inc"); | 154 | configs.append("x11inc"); |
156 | } | 155 | } |
157 | if ( project->isActiveConfig("qt") ) { | 156 | if ( project->isActiveConfig("qt") ) { |
158 | if ( project->isActiveConfig("accessibility" ) ) | 157 | if ( project->isActiveConfig("accessibility" ) ) |
159 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 158 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
160 | if ( project->isActiveConfig("tablet") ) | 159 | if ( project->isActiveConfig("tablet") ) |
161 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 160 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
162 | if(configs.findIndex("moc")) configs.append("moc"); | 161 | if(configs.findIndex("moc")) configs.append("moc"); |
163 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
164 | if ( !project->isActiveConfig("debug") ) | 163 | if ( !project->isActiveConfig("debug") ) |
165 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 164 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
166 | if ( !is_qt ) { | 165 | if ( !is_qt ) { |
167 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { | 166 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { |
168 | if ( !project->isEmpty("QMAKE_RPATH") ) | 167 | if ( !project->isEmpty("QMAKE_RPATH") ) |
169 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | 168 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), |
170 | " " + var("QMAKE_RPATH"), ""); | 169 | " " + var("QMAKE_RPATH"), ""); |
171 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | 170 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); |
172 | } | 171 | } |
173 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) | 172 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) |
174 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 173 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
175 | else | 174 | else |
176 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 175 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
177 | } | 176 | } |
178 | } | 177 | } |
179 | if ( project->isActiveConfig("thread") ) { | ||
180 | if(project->isActiveConfig("qt")) | ||
181 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
182 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
183 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
184 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
185 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
186 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
187 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
188 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
189 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
190 | } | ||
191 | if ( project->isActiveConfig("opengl") ) { | 178 | if ( project->isActiveConfig("opengl") ) { |
192 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
193 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) | 180 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) |
194 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); | 181 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); |
195 | if ( is_qt ) | 182 | if ( is_qt ) |
196 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; | 183 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; |
197 | else | 184 | else |
198 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 185 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
199 | } | 186 | } |
200 | if(project->isActiveConfig("global_init_link_order")) | 187 | if(project->isActiveConfig("global_init_link_order")) |
201 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
202 | if ( project->isActiveConfig("x11sm") ) | ||
203 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
204 | if ( project->isActiveConfig("dylib") ) | ||
205 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
206 | if ( project->isActiveConfig("x11inc") ) | 189 | if ( project->isActiveConfig("x11inc") ) |
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; | 190 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; |
208 | if ( project->isActiveConfig("x11lib") ) { | 191 | if ( project->isActiveConfig("x11lib") ) { |
209 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) | 192 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) |
210 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); | 193 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); |
211 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; | 194 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; |
212 | } | 195 | } |
196 | if ( project->isActiveConfig("x11sm") ) | ||
197 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
198 | if ( project->isActiveConfig("dylib") ) | ||
199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
200 | if ( project->isActiveConfig("thread") ) { | ||
201 | if(project->isActiveConfig("qt")) | ||
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
208 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
209 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
210 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
211 | } | ||
213 | if ( project->isActiveConfig("moc") ) | 212 | if ( project->isActiveConfig("moc") ) |
214 | setMocAware(TRUE); | 213 | setMocAware(TRUE); |
215 | if ( project->isEmpty("QMAKE_RUN_CC") ) | 214 | if ( project->isEmpty("QMAKE_RUN_CC") ) |
216 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); | 215 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); |
217 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | 216 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) |
218 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); | 217 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); |
219 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | 218 | if ( project->isEmpty("QMAKE_RUN_CXX") ) |
220 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); | 219 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); |
221 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | 220 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) |
222 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); | 221 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); |
223 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | 222 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); |
224 | if ( !project->isEmpty("PRECOMPH") ) { | 223 | if ( !project->isEmpty("PRECOMPH") ) { |
225 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() | 224 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() |
226 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); | 225 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); |
227 | project->variables()["SOURCES"].prepend(allmoc); | 226 | project->variables()["SOURCES"].prepend(allmoc); |
228 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; | 227 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; |
@@ -327,49 +326,133 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li | |||
327 | } | 326 | } |
328 | if(unique) { | 327 | if(unique) { |
329 | unique = FALSE; //because I'm about to just insert it myself | 328 | unique = FALSE; //because I'm about to just insert it myself |
330 | if(as_one) { | 329 | if(as_one) { |
331 | ret.append("-framework " + framework_in); | 330 | ret.append("-framework " + framework_in); |
332 | } else { | 331 | } else { |
333 | ret.append("-framework"); | 332 | ret.append("-framework"); |
334 | ret.append(framework_in); | 333 | ret.append(framework_in); |
335 | } | 334 | } |
336 | } | 335 | } |
337 | } | 336 | } |
338 | } else { | 337 | } else { |
339 | unique = (list2.findIndex((*it)) == -1); | 338 | unique = (list2.findIndex((*it)) == -1); |
340 | } | 339 | } |
341 | } else if(QFile::exists((*it))) { | 340 | } else if(QFile::exists((*it))) { |
342 | unique = (list2.findIndex((*it)) == -1); | 341 | unique = (list2.findIndex((*it)) == -1); |
343 | } | 342 | } |
344 | if(unique) | 343 | if(unique) |
345 | ret.append((*it)); | 344 | ret.append((*it)); |
346 | } | 345 | } |
347 | return ret; | 346 | return ret; |
348 | } | 347 | } |
349 | 348 | ||
350 | 349 | ||
351 | void | 350 | void |
352 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 351 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
353 | { | 352 | { |
354 | if(var == "QMAKE_PRL_LIBS") | 353 | if(var == "QMAKE_PRL_LIBS") |
355 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); | 354 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); |
356 | else | 355 | else |
357 | MakefileGenerator::processPrlVariable(var, l); | 356 | MakefileGenerator::processPrlVariable(var, l); |
358 | } | 357 | } |
359 | 358 | ||
359 | bool | ||
360 | UnixMakefileGenerator::findLibraries() | ||
361 | { | ||
362 | QPtrList<MakefileDependDir> libdirs; | ||
363 | libdirs.setAutoDelete(TRUE); | ||
364 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | ||
365 | for(int i = 0; !lflags[i].isNull(); i++) { | ||
366 | QStringList &l = project->variables()[lflags[i]]; | ||
367 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
368 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); | ||
369 | if(opt.startsWith("-")) { | ||
370 | if(opt.startsWith("-L")) { | ||
371 | QString r = opt.right(opt.length() - 2), l = r; | ||
372 | fixEnvVariables(l); | ||
373 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | ||
374 | l.replace("\"",""))); | ||
375 | } else if(opt.startsWith("-l")) { | ||
376 | stub = opt.mid(2); | ||
377 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | ||
378 | if(opt.length() > 11) { | ||
379 | opt = opt.mid(11); | ||
380 | } else { | ||
381 | ++it; | ||
382 | opt = (*it); | ||
383 | } | ||
384 | extn = ""; | ||
385 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; | ||
386 | stub = opt; | ||
387 | } | ||
388 | } else { | ||
389 | extn = dir = ""; | ||
390 | stub = opt; | ||
391 | int slsh = opt.findRev(Option::dir_sep); | ||
392 | if(slsh != -1) { | ||
393 | dir = opt.left(slsh); | ||
394 | stub = opt.mid(slsh+1); | ||
395 | } | ||
396 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); | ||
397 | if(stub_reg.exactMatch(stub)) { | ||
398 | stub = stub_reg.cap(1); | ||
399 | extn = stub_reg.cap(2); | ||
400 | } | ||
401 | } | ||
402 | if(!stub.isEmpty()) { | ||
403 | const QString modifs[] = { "-mt", QString::null }; | ||
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | ||
405 | bool found = FALSE; | ||
406 | QStringList extens; | ||
407 | if(!extn.isNull()) | ||
408 | extens << extn; | ||
409 | else | ||
410 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; | ||
411 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { | ||
412 | if(dir.isNull()) { | ||
413 | QString lib_stub; | ||
414 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
415 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + | ||
416 | modifs[modif] + "." + (*extit))) { | ||
417 | lib_stub = stub + modifs[modif]; | ||
418 | break; | ||
419 | } | ||
420 | } | ||
421 | if(!lib_stub.isNull()) { | ||
422 | (*it) = "-l" + lib_stub; | ||
423 | found = TRUE; | ||
424 | break; | ||
425 | } | ||
426 | } else { | ||
427 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { | ||
428 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); | ||
429 | found = TRUE; | ||
430 | break; | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | if(found) | ||
435 | break; | ||
436 | } | ||
437 | } | ||
438 | } | ||
439 | } | ||
440 | return FALSE; | ||
441 | } | ||
442 | |||
360 | void | 443 | void |
361 | UnixMakefileGenerator::processPrlFiles() | 444 | UnixMakefileGenerator::processPrlFiles() |
362 | { | 445 | { |
363 | QDict<void> processed; | 446 | QDict<void> processed; |
364 | QPtrList<MakefileDependDir> libdirs; | 447 | QPtrList<MakefileDependDir> libdirs; |
365 | libdirs.setAutoDelete(TRUE); | 448 | libdirs.setAutoDelete(TRUE); |
366 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 449 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
367 | for(int i = 0; !lflags[i].isNull(); i++) { | 450 | for(int i = 0; !lflags[i].isNull(); i++) { |
368 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 451 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
369 | QStringList l_out; | 452 | QStringList l_out; |
370 | QStringList &l = project->variables()[lflags[i]]; | 453 | QStringList &l = project->variables()[lflags[i]]; |
371 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 454 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
372 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); | 455 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); |
373 | QString opt = (*it).stripWhiteSpace();; | 456 | QString opt = (*it).stripWhiteSpace();; |
374 | if(opt.startsWith("-")) { | 457 | if(opt.startsWith("-")) { |
375 | if(opt.startsWith("-L")) { | 458 | if(opt.startsWith("-L")) { |
@@ -389,132 +472,133 @@ UnixMakefileGenerator::processPrlFiles() | |||
389 | prl = "-l" + reg.cap(1); | 472 | prl = "-l" + reg.cap(1); |
390 | opt = prl; | 473 | opt = prl; |
391 | processed.insert(opt, (void*)1); | 474 | processed.insert(opt, (void*)1); |
392 | ret = TRUE; | 475 | ret = TRUE; |
393 | break; | 476 | break; |
394 | } | 477 | } |
395 | } | 478 | } |
396 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 479 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
397 | if(opt.length() > 11) { | 480 | if(opt.length() > 11) { |
398 | opt = opt.mid(11); | 481 | opt = opt.mid(11); |
399 | } else { | 482 | } else { |
400 | ++it; | 483 | ++it; |
401 | opt = (*it); | 484 | opt = (*it); |
402 | } | 485 | } |
403 | QString prl = "/System/Library/Frameworks/" + opt + | 486 | QString prl = "/System/Library/Frameworks/" + opt + |
404 | ".framework/" + opt + Option::prl_ext; | 487 | ".framework/" + opt + Option::prl_ext; |
405 | if(processPrlFile(prl)) | 488 | if(processPrlFile(prl)) |
406 | ret = TRUE; | 489 | ret = TRUE; |
407 | l_out.append("-framework"); | 490 | l_out.append("-framework"); |
408 | } | 491 | } |
409 | if(!opt.isEmpty()) | 492 | if(!opt.isEmpty()) |
410 | l_out.append(opt); | 493 | l_out.append(opt); |
411 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 494 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); |
412 | } else { | 495 | } else { |
413 | if(!processed[opt] && processPrlFile(opt)) { | 496 | if(!processed[opt] && processPrlFile(opt)) { |
414 | processed.insert(opt, (void*)1); | 497 | processed.insert(opt, (void*)1); |
415 | ret = TRUE; | 498 | ret = TRUE; |
416 | } | 499 | } |
417 | if(!opt.isEmpty()) | 500 | if(!opt.isEmpty()) |
418 | l_out.append(opt); | 501 | l_out.append(opt); |
419 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 502 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); |
420 | } | 503 | } |
421 | } | 504 | } |
422 | if(ret && l != l_out) | 505 | if(ret && l != l_out) |
423 | l = l_out; | 506 | l = l_out; |
424 | else | 507 | else |
425 | break; | 508 | break; |
426 | } | 509 | } |
427 | } | 510 | } |
428 | } | 511 | } |
429 | 512 | ||
430 | QString | 513 | QString |
431 | UnixMakefileGenerator::defaultInstall(const QString &t) | 514 | UnixMakefileGenerator::defaultInstall(const QString &t) |
432 | { | 515 | { |
433 | if(t != "target" || project->first("TEMPLATE") == "subdirs") | 516 | if(t != "target" || project->first("TEMPLATE") == "subdirs") |
434 | return QString(); | 517 | return QString(); |
435 | 518 | ||
436 | bool resource = FALSE; | 519 | bool resource = FALSE; |
520 | const QString root = "$(INSTALL_ROOT)"; | ||
437 | QStringList &uninst = project->variables()[t + ".uninstall"]; | 521 | QStringList &uninst = project->variables()[t + ".uninstall"]; |
438 | QString ret, destdir=fileFixify(project->first("DESTDIR")); | 522 | QString ret, destdir=project->first("DESTDIR"); |
439 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); | 523 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); |
440 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 524 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
441 | destdir += Option::dir_sep; | 525 | destdir += Option::dir_sep; |
442 | targetdir = "$(INSTALL_ROOT)" + Option::fixPathToTargetOS(targetdir, FALSE); | 526 | targetdir = fileFixify(targetdir); |
443 | if(targetdir.right(1) != Option::dir_sep) | 527 | if(targetdir.right(1) != Option::dir_sep) |
444 | targetdir += Option::dir_sep; | 528 | targetdir += Option::dir_sep; |
445 | 529 | ||
446 | QStringList links; | 530 | QStringList links; |
447 | QString target="$(TARGET)"; | 531 | QString target="$(TARGET)"; |
448 | if(project->first("TEMPLATE") == "app") { | 532 | if(project->first("TEMPLATE") == "app") { |
449 | target = "$(QMAKE_TARGET)"; | 533 | target = "$(QMAKE_TARGET)"; |
450 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 534 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
451 | destdir += "../../../"; | 535 | destdir += "../../../"; |
452 | target += ".app"; | 536 | target += ".app"; |
453 | resource = TRUE; | 537 | resource = TRUE; |
454 | } | 538 | } |
455 | } else if(project->first("TEMPLATE") == "lib") { | 539 | } else if(project->first("TEMPLATE") == "lib") { |
456 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 540 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
457 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); | 541 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); |
458 | int slsh = dst_prl.findRev('/'); | 542 | int slsh = dst_prl.findRev('/'); |
459 | if(slsh != -1) | 543 | if(slsh != -1) |
460 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); | 544 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
461 | dst_prl = targetdir + dst_prl; | 545 | dst_prl = root + targetdir + dst_prl; |
462 | ret += "-$(COPY) " + project->first("QMAKE_INTERNAL_PRL_FILE") + " " + dst_prl; | 546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
463 | if(!uninst.isEmpty()) | 547 | if(!uninst.isEmpty()) |
464 | uninst.append("\n\t"); | 548 | uninst.append("\n\t"); |
465 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); | 549 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
466 | } | 550 | } |
467 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
468 | if ( os != "cygwin" ) { | ||
469 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { | 552 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { |
470 | if ( os == "hpux" ) { | 553 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
471 | links << "$(TARGET0)"; | ||
472 | } else { | ||
473 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; | 554 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; |
555 | } else { | ||
556 | links << "$(TARGET0)"; | ||
474 | } | 557 | } |
475 | } | 558 | } |
476 | } | 559 | } |
477 | } | 560 | } |
478 | QString src_targ = target; | 561 | QString src_targ = target; |
479 | if(!destdir.isEmpty()) | 562 | if(!destdir.isEmpty()) |
480 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); |
481 | QString dst_targ = fileFixify(targetdir + target); | 564 | QString dst_targ = root + fileFixify(targetdir + target); |
482 | if(!ret.isEmpty()) | 565 | if(!ret.isEmpty()) |
483 | ret += "\n\t"; | 566 | ret += "\n\t"; |
484 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + |
485 | src_targ + "\" \"" + dst_targ + "\""; | 568 | src_targ + "\" \"" + dst_targ + "\""; |
486 | if(!project->isEmpty("QMAKE_STRIP")) { | 569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { |
487 | ret += "\n\t-" + var("QMAKE_STRIP"); | 570 | ret += "\n\t-" + var("QMAKE_STRIP"); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | ||
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
488 | if(resource) | 573 | if(resource) |
489 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)"; | 574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; |
490 | else | 575 | else |
491 | ret += " \"" + dst_targ + "\""; | 576 | ret += " \"" + dst_targ + "\""; |
492 | } | 577 | } |
493 | if(!uninst.isEmpty()) | 578 | if(!uninst.isEmpty()) |
494 | uninst.append("\n\t"); | 579 | uninst.append("\n\t"); |
495 | if(resource) | 580 | if(resource) |
496 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | 581 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); |
497 | else | 582 | else |
498 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); | 583 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
499 | if(!links.isEmpty()) { | 584 | if(!links.isEmpty()) { |
500 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { | 585 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { |
501 | if(Option::target_mode == Option::TARG_WIN_MODE || | 586 | if(Option::target_mode == Option::TARG_WIN_MODE || |
502 | Option::target_mode == Option::TARG_MAC9_MODE) { | 587 | Option::target_mode == Option::TARG_MAC9_MODE) { |
503 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || | 588 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || |
504 | Option::target_mode == Option::TARG_MACX_MODE) { | 589 | Option::target_mode == Option::TARG_MACX_MODE) { |
505 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); | 590 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); |
506 | int lslash = link.findRev(Option::dir_sep); | 591 | int lslash = link.findRev(Option::dir_sep); |
507 | if(lslash != -1) | 592 | if(lslash != -1) |
508 | link = link.right(link.length() - (lslash + 1)); | 593 | link = link.right(link.length() - (lslash + 1)); |
509 | QString dst_link = fileFixify(targetdir + link); | 594 | QString dst_link = root + fileFixify(targetdir + link); |
510 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | 595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
511 | if(!uninst.isEmpty()) | 596 | if(!uninst.isEmpty()) |
512 | uninst.append("\n\t"); | 597 | uninst.append("\n\t"); |
513 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); | 598 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); |
514 | } | 599 | } |
515 | } | 600 | } |
516 | } | 601 | } |
517 | return ret; | 602 | return ret; |
518 | } | 603 | } |
519 | 604 | ||
520 | |||
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index e889dcc..3d00214 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h | |||
@@ -42,30 +42,31 @@ | |||
42 | class UnixMakefileGenerator : public MakefileGenerator | 42 | class UnixMakefileGenerator : public MakefileGenerator |
43 | { | 43 | { |
44 | bool init_flag, include_deps; | 44 | bool init_flag, include_deps; |
45 | bool writeMakefile(QTextStream &); | 45 | bool writeMakefile(QTextStream &); |
46 | QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2); | 46 | QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2); |
47 | 47 | ||
48 | public: | 48 | public: |
49 | UnixMakefileGenerator(QMakeProject *p); | 49 | UnixMakefileGenerator(QMakeProject *p); |
50 | ~UnixMakefileGenerator(); | 50 | ~UnixMakefileGenerator(); |
51 | 51 | ||
52 | protected: | 52 | protected: |
53 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } | 53 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } |
54 | virtual QString defaultInstall(const QString &); | 54 | virtual QString defaultInstall(const QString &); |
55 | virtual void processPrlVariable(const QString &, const QStringList &); | 55 | virtual void processPrlVariable(const QString &, const QStringList &); |
56 | virtual void processPrlFiles(); | 56 | virtual void processPrlFiles(); |
57 | 57 | ||
58 | virtual bool findLibraries(); | ||
58 | virtual void init(); | 59 | virtual void init(); |
59 | 60 | ||
60 | void writeMakeParts(QTextStream &); | 61 | void writeMakeParts(QTextStream &); |
61 | void writeSubdirs(QTextStream &, bool=TRUE); | 62 | void writeSubdirs(QTextStream &, bool=TRUE); |
62 | 63 | ||
63 | private: | 64 | private: |
64 | void init2(); | 65 | void init2(); |
65 | }; | 66 | }; |
66 | 67 | ||
67 | inline UnixMakefileGenerator::~UnixMakefileGenerator() | 68 | inline UnixMakefileGenerator::~UnixMakefileGenerator() |
68 | { } | 69 | { } |
69 | 70 | ||
70 | 71 | ||
71 | #endif /* __UNIXMAKE_H__ */ | 72 | #endif /* __UNIXMAKE_H__ */ |
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9bb6f6b..7fbb9f4 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -66,90 +66,97 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) | |||
66 | writeMakeParts(t); | 66 | writeMakeParts(t); |
67 | return MakefileGenerator::writeMakefile(t); | 67 | return MakefileGenerator::writeMakefile(t); |
68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { | 68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { |
69 | writeSubdirs(t); | 69 | writeSubdirs(t); |
70 | return TRUE; | 70 | return TRUE; |
71 | } | 71 | } |
72 | return FALSE; | 72 | return FALSE; |
73 | } | 73 | } |
74 | 74 | ||
75 | void | 75 | void |
76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) | 76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) |
77 | { | 77 | { |
78 | QString deps = fileFixify(Option::output.name()), prl; | 78 | QString deps = fileFixify(Option::output.name()), prl; |
79 | bool do_incremental = (project->isActiveConfig("incremental") && | 79 | bool do_incremental = (project->isActiveConfig("incremental") && |
80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && | 80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && |
81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || | 81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || |
82 | !project->isActiveConfig("staticlib"))), | 82 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 83 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | ||
85 | 84 | ||
86 | t << "####### Compiler, tools and options" << endl << endl; | 85 | t << "####### Compiler, tools and options" << endl << endl; |
87 | t << "CC = "; | 86 | t << "CC = "; |
88 | if (project->isActiveConfig("thread") && | 87 | if (project->isActiveConfig("thread") && |
89 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) | 88 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) |
90 | t << var("QMAKE_CC_THREAD") << endl; | 89 | t << var("QMAKE_CC_THREAD") << endl; |
91 | else | 90 | else |
92 | t << var("QMAKE_CC") << endl; | 91 | t << var("QMAKE_CC") << endl; |
93 | 92 | ||
94 | t << "CXX = "; | 93 | t << "CXX = "; |
95 | if (project->isActiveConfig("thread") && | 94 | if (project->isActiveConfig("thread") && |
96 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) | 95 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) |
97 | t << var("QMAKE_CXX_THREAD") << endl; | 96 | t << var("QMAKE_CXX_THREAD") << endl; |
98 | else | 97 | else |
99 | t << var("QMAKE_CXX") << endl; | 98 | t << var("QMAKE_CXX") << endl; |
100 | 99 | ||
101 | t << "LEX = " << var("QMAKE_LEX") << endl; | 100 | t << "LEX = " << var("QMAKE_LEX") << endl; |
102 | t << "YACC = " << var("QMAKE_YACC") << endl; | 101 | t << "YACC = " << var("QMAKE_YACC") << endl; |
103 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " | 102 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " |
104 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 103 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
105 | << varGlue("DEFINES","-D"," -D","") << endl; | 104 | << varGlue("DEFINES","-D"," -D","") << endl; |
106 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " | 105 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " |
107 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 106 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
108 | << varGlue("DEFINES","-D"," -D","") << endl; | 107 | << varGlue("DEFINES","-D"," -D","") << endl; |
109 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 108 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
110 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; | 109 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; |
111 | t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl; | 110 | t << "INCPATH = " << "-I" << specdir(); |
111 | if(!project->isActiveConfig("no_include_pwd")) { | ||
112 | QString pwd = fileFixify(QDir::currentDirPath()); | ||
113 | if(pwd.isEmpty()) | ||
114 | pwd = "."; | ||
115 | t << " -I" << pwd; | ||
116 | } | ||
117 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; | ||
112 | 118 | ||
113 | if(!project->isActiveConfig("staticlib")) { | 119 | if(!project->isActiveConfig("staticlib")) { |
114 | t << "LINK = "; | 120 | t << "LINK = "; |
115 | if (project->isActiveConfig("thread") && | 121 | if (project->isActiveConfig("thread") && |
116 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) | 122 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) |
117 | t << var("QMAKE_LINK_THREAD") << endl; | 123 | t << var("QMAKE_LINK_THREAD") << endl; |
118 | else | 124 | else |
119 | t << var("QMAKE_LINK") << endl; | 125 | t << var("QMAKE_LINK") << endl; |
120 | 126 | ||
121 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; | 127 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; |
122 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; | 128 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; |
123 | } | 129 | } |
124 | 130 | ||
125 | t << "AR = " << var("QMAKE_AR") << endl; | 131 | t << "AR = " << var("QMAKE_AR") << endl; |
126 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; | 132 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; |
127 | t << "MOC = " << var("QMAKE_MOC") << endl; | 133 | t << "MOC = " << var("QMAKE_MOC") << endl; |
128 | t << "UIC = "<< var("QMAKE_UIC") << endl; | 134 | t << "UIC = "<< var("QMAKE_UIC") << endl; |
129 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 135 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
130 | t << "TAR = "<< var("QMAKE_TAR") << endl; | 136 | t << "TAR = "<< var("QMAKE_TAR") << endl; |
131 | t << "GZIP = " << var("QMAKE_GZIP") << endl; | 137 | t << "GZIP = " << var("QMAKE_GZIP") << endl; |
132 | t << "COPY = " << var("QMAKE_COPY") << endl; | 138 | t << "COPY = " << var("QMAKE_COPY") << endl; |
133 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; | 139 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; |
134 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; | 140 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
135 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 141 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
136 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; | 142 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; |
137 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
139 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | 145 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
146 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | ||
140 | t << endl; | 147 | t << endl; |
141 | 148 | ||
142 | t << "####### Output directory" << endl << endl; | 149 | t << "####### Output directory" << endl << endl; |
143 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 150 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
144 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; | 151 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; |
145 | else | 152 | else |
146 | t << "OBJECTS_DIR = ./" << endl; | 153 | t << "OBJECTS_DIR = ./" << endl; |
147 | t << endl; | 154 | t << endl; |
148 | 155 | ||
149 | /* files */ | 156 | /* files */ |
150 | t << "####### Files" << endl << endl; | 157 | t << "####### Files" << endl << endl; |
151 | t << "HEADERS = " << varList("HEADERS") << endl; | 158 | t << "HEADERS = " << varList("HEADERS") << endl; |
152 | t << "SOURCES = " << varList("SOURCES") << endl; | 159 | t << "SOURCES = " << varList("SOURCES") << endl; |
153 | if(do_incremental) { | 160 | if(do_incremental) { |
154 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 161 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
155 | t << "OBJECTS = "; | 162 | t << "OBJECTS = "; |
@@ -199,82 +206,80 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
199 | t << "\\\n\t\t" << (*objit); | 206 | t << "\\\n\t\t" << (*objit); |
200 | } | 207 | } |
201 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! | 208 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! |
202 | t << incrs_out.join(" \\\n\t\t") << endl; | 209 | t << incrs_out.join(" \\\n\t\t") << endl; |
203 | } else if(!incrs_out.count()) { | 210 | } else if(!incrs_out.count()) { |
204 | t << endl; | 211 | t << endl; |
205 | } else { | 212 | } else { |
206 | moc_incremental = TRUE; | 213 | moc_incremental = TRUE; |
207 | t << endl; | 214 | t << endl; |
208 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; | 215 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; |
209 | } | 216 | } |
210 | } else { | 217 | } else { |
211 | t << "OBJMOC = " << objMoc << endl; | 218 | t << "OBJMOC = " << objMoc << endl; |
212 | } | 219 | } |
213 | if(do_incremental && !moc_incremental && !src_incremental) | 220 | if(do_incremental && !moc_incremental && !src_incremental) |
214 | do_incremental = FALSE; | 221 | do_incremental = FALSE; |
215 | t << "DIST = " << varList("DISTFILES") << endl; | 222 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; |
216 | t << "PRO = " << fileFixify(project->projectFile()) << endl; | ||
217 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; | 223 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
218 | t << "DESTDIR = " << var("DESTDIR") << endl; | 224 | t << "DESTDIR = " << var("DESTDIR") << endl; |
219 | t << "TARGET = " << var("TARGET") << endl; | 225 | t << "TARGET = " << var("TARGET") << endl; |
220 | if(project->isActiveConfig("plugin") ) { | 226 | if(project->isActiveConfig("plugin") ) { |
221 | t << "TARGETD = " << var("TARGET") << endl; | 227 | t << "TARGETD = " << var("TARGET") << endl; |
222 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 228 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
223 | t << "TARGETA= " << var("TARGETA") << endl; | 229 | t << "TARGETA= " << var("TARGETA") << endl; |
224 | if (os == "hpux") { | 230 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { |
225 | t << "TARGETD= " << var("TARGET_x") << endl; | ||
226 | t << "TARGET0= " << var("TARGET_") << endl; | ||
227 | } | ||
228 | else { | ||
229 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; | 231 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; |
230 | t << "TARGET0= " << var("TARGET_") << endl; | 232 | t << "TARGET0= " << var("TARGET_") << endl; |
231 | t << "TARGET1= " << var("TARGET_x") << endl; | 233 | t << "TARGET1= " << var("TARGET_x") << endl; |
232 | t << "TARGET2= " << var("TARGET_x.y") << endl; | 234 | t << "TARGET2= " << var("TARGET_x.y") << endl; |
235 | } else { | ||
236 | t << "TARGETD= " << var("TARGET_x") << endl; | ||
237 | t << "TARGET0= " << var("TARGET_") << endl; | ||
233 | } | 238 | } |
234 | } | 239 | } |
235 | t << endl; | 240 | t << endl; |
236 | 241 | ||
237 | // blasted incldues | 242 | // blasted incldues |
238 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | 243 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; |
239 | QStringList::Iterator it; | 244 | QStringList::Iterator it; |
240 | for( it = qeui.begin(); it != qeui.end(); ++it) | 245 | for( it = qeui.begin(); it != qeui.end(); ++it) |
241 | t << "include " << (*it) << endl; | 246 | t << "include " << (*it) << endl; |
242 | 247 | ||
243 | /* rules */ | 248 | /* rules */ |
244 | t << "first: all" << endl; | 249 | t << "first: all" << endl; |
245 | t << "####### Implicit rules" << endl << endl; | 250 | t << "####### Implicit rules" << endl << endl; |
246 | t << ".SUFFIXES: .c"; | 251 | t << ".SUFFIXES: .c"; |
247 | QStringList::Iterator cppit; | 252 | QStringList::Iterator cppit; |
248 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 253 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
249 | t << " " << (*cppit); | 254 | t << " " << (*cppit); |
250 | t << endl << endl; | 255 | t << endl << endl; |
251 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 256 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
252 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 257 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
253 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 258 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
254 | 259 | ||
255 | if(include_deps) { | 260 | if(include_deps) { |
256 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; | 261 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; |
257 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); | 262 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); |
258 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 263 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
259 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; | 264 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; |
260 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); | 265 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); |
261 | QString odir; | 266 | QString odir; |
262 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 267 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
263 | odir = project->first("OBJECTS_DIR"); | 268 | odir = project->first("OBJECTS_DIR"); |
264 | t << "###### Dependancies" << endl << endl; | 269 | t << "###### Dependencies" << endl << endl; |
265 | t << odir << ".deps/%.d: %.cpp\n\t" | 270 | t << odir << ".deps/%.d: %.cpp\n\t" |
266 | << "@echo Creating depend for $<" << "\n\t" | 271 | << "@echo Creating depend for $<" << "\n\t" |
267 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 272 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
268 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 273 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
269 | 274 | ||
270 | t << odir << ".deps/%.d: %.c\n\t" | 275 | t << odir << ".deps/%.d: %.c\n\t" |
271 | << "@echo Creating depend for $<" << "\n\t" | 276 | << "@echo Creating depend for $<" << "\n\t" |
272 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 277 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
273 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 278 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
274 | 279 | ||
275 | 280 | ||
276 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; | 281 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; |
277 | for(int x = 0; !src[x].isNull(); x++) { | 282 | for(int x = 0; !src[x].isNull(); x++) { |
278 | QStringList &l = project->variables()[src[x]]; | 283 | QStringList &l = project->variables()[src[x]]; |
279 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 284 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
280 | if(!(*it).isEmpty()) { | 285 | if(!(*it).isEmpty()) { |
@@ -373,46 +378,48 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
373 | incr_objs += "-L" + destdir; | 378 | incr_objs += "-L" + destdir; |
374 | } else { | 379 | } else { |
375 | if(!incr_objs.isEmpty()) | 380 | if(!incr_objs.isEmpty()) |
376 | incr_objs += " "; | 381 | incr_objs += " "; |
377 | incr_objs += "-L" + QDir::currentDirPath(); | 382 | incr_objs += "-L" + QDir::currentDirPath(); |
378 | } | 383 | } |
379 | if(!incr_objs.isEmpty()) | 384 | if(!incr_objs.isEmpty()) |
380 | incr_objs += " "; | 385 | incr_objs += " "; |
381 | incr_objs += " -l" + incr_target; | 386 | incr_objs += " -l" + incr_target; |
382 | deps.prepend(incr_target_dir + " "); | 387 | deps.prepend(incr_target_dir + " "); |
383 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 388 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
384 | } | 389 | } |
385 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 390 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
386 | << endl << endl; | 391 | << endl << endl; |
387 | 392 | ||
388 | //real target | 393 | //real target |
389 | t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; | 394 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps |
395 | << " " << var("POST_TARGETDEPS") << "\n\t"; | ||
390 | if(!destdir.isEmpty()) | 396 | if(!destdir.isEmpty()) |
391 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 397 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
392 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 398 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
393 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 399 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
394 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; | 400 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; |
395 | if(!project->isEmpty("QMAKE_POST_LINK")) | 401 | if(!project->isEmpty("QMAKE_POST_LINK")) |
396 | t << "\n\t" << var("QMAKE_POST_LINK"); | 402 | t << "\n\t" << var("QMAKE_POST_LINK"); |
397 | t << endl << endl; | 403 | t << endl << endl; |
398 | } else { | 404 | } else { |
399 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 405 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
400 | << endl << endl; | 406 | << endl << endl; |
401 | 407 | ||
402 | t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; | 408 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
409 | << var("POST_TARGETDEPS") << "\n\t"; | ||
403 | if(!destdir.isEmpty()) | 410 | if(!destdir.isEmpty()) |
404 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 411 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
405 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 412 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
406 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 413 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
407 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 414 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; |
408 | if(!project->isEmpty("QMAKE_POST_LINK")) | 415 | if(!project->isEmpty("QMAKE_POST_LINK")) |
409 | t << "\n\t" << var("QMAKE_POST_LINK"); | 416 | t << "\n\t" << var("QMAKE_POST_LINK"); |
410 | t << endl << endl; | 417 | t << endl << endl; |
411 | } | 418 | } |
412 | } else if(!project->isActiveConfig("staticlib")) { | 419 | } else if(!project->isActiveConfig("staticlib")) { |
413 | QString destdir = project->first("DESTDIR"), incr_deps; | 420 | QString destdir = project->first("DESTDIR"), incr_deps; |
414 | if(do_incremental) { | 421 | if(do_incremental) { |
415 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 422 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
416 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( | 423 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( |
417 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; | 424 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; |
418 | if(incr_target.find(Option::dir_sep) != -1) | 425 | if(incr_target.find(Option::dir_sep) != -1) |
@@ -447,170 +454,171 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
447 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 454 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
448 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << | 455 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << |
449 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; | 456 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; |
450 | //communicated below | 457 | //communicated below |
451 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 458 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
452 | if(!destdir.isEmpty()) | 459 | if(!destdir.isEmpty()) |
453 | cmd.append(" -L" + destdir); | 460 | cmd.append(" -L" + destdir); |
454 | cmd.append(" -l" + incr_target); | 461 | cmd.append(" -l" + incr_target); |
455 | deps.prepend(incr_target_dir + " "); | 462 | deps.prepend(incr_target_dir + " "); |
456 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 463 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
457 | } | 464 | } |
458 | 465 | ||
459 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") | 466 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") |
460 | << " " << var("DESTDIR_TARGET") << endl << endl; | 467 | << " " << var("DESTDIR_TARGET") << endl << endl; |
461 | 468 | ||
462 | //real target | 469 | //real target |
463 | t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << | 470 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " |
464 | var("TARGETDEPS"); | 471 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); |
465 | } else { | 472 | } else { |
466 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << | 473 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << |
467 | var("DESTDIR_TARGET") << endl << endl; | 474 | var("DESTDIR_TARGET") << endl << endl; |
468 | t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << | 475 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") |
469 | var("TARGETDEPS"); | 476 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); |
470 | } | 477 | } |
471 | if(!destdir.isEmpty()) | 478 | if(!destdir.isEmpty()) |
472 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; | 479 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; |
473 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 480 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
474 | t << "\n\t" << var("QMAKE_PRE_LINK"); | 481 | t << "\n\t" << var("QMAKE_PRE_LINK"); |
475 | 482 | ||
476 | if(project->isActiveConfig("plugin")) { | 483 | if(project->isActiveConfig("plugin")) { |
477 | t << "\n\t" | 484 | t << "\n\t" |
478 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 485 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
479 | << var("QMAKE_LINK_SHLIB_CMD"); | 486 | << var("QMAKE_LINK_SHLIB_CMD"); |
480 | if(!destdir.isEmpty()) | 487 | if(!destdir.isEmpty()) |
481 | t << "\n\t" | 488 | t << "\n\t" |
482 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); | 489 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); |
483 | if(!project->isEmpty("QMAKE_POST_LINK")) | 490 | if(!project->isEmpty("QMAKE_POST_LINK")) |
484 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; | 491 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; |
485 | t << endl << endl; | 492 | t << endl << endl; |
486 | } else if ( os == "hpux" ) { | 493 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { |
487 | t << "\n\t" | ||
488 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" | ||
489 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | ||
490 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); | ||
491 | if(!destdir.isEmpty()) | ||
492 | t << "\n\t" | ||
493 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | ||
494 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | ||
495 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | ||
496 | if(!project->isEmpty("QMAKE_POST_LINK")) | ||
497 | t << "\n\t" << var("QMAKE_POST_LINK"); | ||
498 | t << endl << endl; | ||
499 | } else { | ||
500 | t << "\n\t" | 494 | t << "\n\t" |
501 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" | 495 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" |
502 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 496 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
503 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" | 497 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" |
504 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" | 498 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" |
505 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); | 499 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); |
506 | if(!destdir.isEmpty()) | 500 | if(!destdir.isEmpty()) |
507 | t << "\n\t" | 501 | t << "\n\t" |
508 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 502 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
509 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 503 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
510 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" | 504 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" |
511 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" | 505 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" |
512 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); | 506 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); |
513 | if(!project->isEmpty("QMAKE_POST_LINK")) | 507 | if(!project->isEmpty("QMAKE_POST_LINK")) |
514 | t << "\n\t" << var("QMAKE_POST_LINK"); | 508 | t << "\n\t" << var("QMAKE_POST_LINK"); |
515 | t << endl << endl; | 509 | t << endl << endl; |
510 | } else { | ||
511 | t << "\n\t" | ||
512 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" | ||
513 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | ||
514 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); | ||
515 | if(!destdir.isEmpty()) | ||
516 | t << "\n\t" | ||
517 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | ||
518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | ||
519 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | ||
520 | if(!project->isEmpty("QMAKE_POST_LINK")) | ||
521 | t << "\n\t" << var("QMAKE_POST_LINK"); | ||
522 | t << endl << endl; | ||
516 | } | 523 | } |
517 | t << endl << endl; | 524 | t << endl << endl; |
518 | 525 | ||
519 | if (! project->isActiveConfig("plugin")) { | 526 | if (! project->isActiveConfig("plugin")) { |
520 | t << "staticlib: $(TARGETA)" << endl << endl; | 527 | t << "staticlib: $(TARGETA)" << endl << endl; |
521 | t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 528 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
522 | if(do_incremental) | 529 | if(do_incremental) |
523 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 530 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
524 | t << var("TARGETDEPS") << "\n\t" | 531 | t << var("POST_TARGETDEPS") << "\n\t" |
525 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 532 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
526 | << var("QMAKE_AR_CMD"); | 533 | << var("QMAKE_AR_CMD"); |
527 | if(do_incremental) | 534 | if(do_incremental) |
528 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 535 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
529 | if(!project->isEmpty("QMAKE_RANLIB")) | 536 | if(!project->isEmpty("QMAKE_RANLIB")) |
530 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; | 537 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; |
531 | t << endl << endl; | 538 | t << endl << endl; |
532 | } | 539 | } |
533 | } else { | 540 | } else { |
534 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " | 541 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " |
535 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" | 542 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" |
536 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 543 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
537 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 544 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
538 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; | 545 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
546 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; | ||
539 | if(!project->isEmpty("DESTDIR")) { | 547 | if(!project->isEmpty("DESTDIR")) { |
540 | QString destdir = project->first("DESTDIR"); | 548 | QString destdir = project->first("DESTDIR"); |
541 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 549 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
542 | } | 550 | } |
543 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 551 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
544 | << var("QMAKE_AR_CMD") << "\n"; | 552 | << var("QMAKE_AR_CMD") << "\n"; |
545 | if(!project->isEmpty("QMAKE_POST_LINK")) | 553 | if(!project->isEmpty("QMAKE_POST_LINK")) |
546 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 554 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
547 | if(!project->isEmpty("QMAKE_RANLIB")) | 555 | if(!project->isEmpty("QMAKE_RANLIB")) |
548 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; | 556 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; |
549 | if(!project->isEmpty("DESTDIR")) | 557 | if(!project->isEmpty("DESTDIR")) |
550 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" | 558 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" |
551 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 559 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
552 | } else { | 560 | } else { |
553 | int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 561 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
554 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 562 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], |
555 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 563 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
556 | libs.prepend("$(TARGET)"); | 564 | libs.prepend("$(TARGET)"); |
557 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); | 565 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); |
558 | libit != libs.end(); ++libit) { | 566 | libit != libs.end(); ++libit) { |
559 | QStringList build; | 567 | QStringList build; |
560 | for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 568 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
561 | build << (*objit); | 569 | build << (*objit); |
562 | QString ar; | 570 | QString ar; |
563 | if((*libit) == "$(TARGET)") { | 571 | if((*libit) == "$(TARGET)") { |
564 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " | 572 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
565 | << valList(build) << "\n\t"; | 573 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; |
566 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 574 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
567 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 575 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
568 | build.join(" ")); | 576 | build.join(" ")); |
569 | } else { | 577 | } else { |
570 | t << (*libit) << ": " << valList(build) << "\n\t"; | 578 | t << (*libit) << ": " << valList(build) << "\n\t"; |
571 | ar = "$(AR) " + (*libit) + " " + build.join(" "); | 579 | ar = "$(AR) " + (*libit) + " " + build.join(" "); |
572 | } | 580 | } |
573 | if(!project->isEmpty("DESTDIR")) { | 581 | if(!project->isEmpty("DESTDIR")) { |
574 | QString destdir = project->first("DESTDIR"); | 582 | QString destdir = project->first("DESTDIR"); |
575 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 583 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
576 | } | 584 | } |
577 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" | 585 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" |
578 | << ar << "\n"; | 586 | << ar << "\n"; |
579 | if(!project->isEmpty("QMAKE_POST_LINK")) | 587 | if(!project->isEmpty("QMAKE_POST_LINK")) |
580 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 588 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
581 | if(!project->isEmpty("QMAKE_RANLIB")) | 589 | if(!project->isEmpty("QMAKE_RANLIB")) |
582 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; | 590 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; |
583 | if(!project->isEmpty("DESTDIR")) | 591 | if(!project->isEmpty("DESTDIR")) |
584 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" | 592 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" |
585 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; | 593 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; |
586 | } | 594 | } |
587 | } | 595 | } |
588 | t << endl << endl; | 596 | t << endl << endl; |
589 | } | 597 | } |
590 | 598 | ||
591 | t << "mocables: $(SRCMOC)" << endl << endl; | 599 | t << "mocables: $(SRCMOC)" << endl << endl; |
592 | 600 | ||
593 | if(!project->isActiveConfig("no_mocdepend")) { | 601 | if(!project->isActiveConfig("no_mocdepend")) { |
594 | //this is an implicity depend on moc, so it will be built if necesary, however | 602 | //this is an implicity depend on moc, so it will be built if necesary, however |
595 | //moc itself shouldn't have this dependancy - this is a little kludgy but it is | 603 | //moc itself shouldn't have this dependency - this is a little kludgy but it is |
596 | //better than the alternative for now. | 604 | //better than the alternative for now. |
597 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 605 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); |
598 | fixEnvVariables(target); | 606 | fixEnvVariables(target); |
599 | fixEnvVariables(moc); | 607 | fixEnvVariables(moc); |
600 | if(target != moc) | 608 | if(target != moc) |
601 | t << "$(MOC): \n\t" | 609 | t << "$(MOC): \n\t" |
602 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; | 610 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; |
603 | } | 611 | } |
604 | 612 | ||
605 | writeMakeQmake(t); | 613 | writeMakeQmake(t); |
606 | 614 | ||
607 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { | 615 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { |
608 | QString pkginfo = project->first("QMAKE_PKGINFO"); | 616 | QString pkginfo = project->first("QMAKE_PKGINFO"); |
609 | QString destdir = project->first("DESTDIR"); | 617 | QString destdir = project->first("DESTDIR"); |
610 | t << pkginfo << ": " << "\n\t"; | 618 | t << pkginfo << ": " << "\n\t"; |
611 | if(!destdir.isEmpty()) | 619 | if(!destdir.isEmpty()) |
612 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 620 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
613 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" | 621 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" |
614 | << "@echo \"APPL????\" >" << pkginfo << endl; | 622 | << "@echo \"APPL????\" >" << pkginfo << endl; |
615 | } | 623 | } |
616 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { | 624 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { |
@@ -630,66 +638,105 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
630 | } | 638 | } |
631 | } | 639 | } |
632 | 640 | ||
633 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : | 641 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : |
634 | project->first("QMAKE_DISTDIR"); | 642 | project->first("QMAKE_DISTDIR"); |
635 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : | 643 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : |
636 | project->first("OBJECTS_DIR")) + ddir); | 644 | project->first("OBJECTS_DIR")) + ddir); |
637 | t << "dist: " << "\n\t" | 645 | t << "dist: " << "\n\t" |
638 | << "@mkdir -p " << ddir_c << " && " | 646 | << "@mkdir -p " << ddir_c << " && " |
639 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; | 647 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; |
640 | if(!project->isEmpty("TRANSLATIONS")) | 648 | if(!project->isEmpty("TRANSLATIONS")) |
641 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; | 649 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; |
642 | if(!project->isEmpty("FORMS")) { | 650 | if(!project->isEmpty("FORMS")) { |
643 | QStringList &forms = project->variables()["FORMS"], ui_headers; | 651 | QStringList &forms = project->variables()["FORMS"], ui_headers; |
644 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | 652 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
645 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | 653 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
646 | if(QFile::exists(ui_h) ) | 654 | if(QFile::exists(ui_h) ) |
647 | ui_headers << ui_h; | 655 | ui_headers << ui_h; |
648 | } | 656 | } |
649 | if(!ui_headers.isEmpty()) | 657 | if(!ui_headers.isEmpty()) |
650 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; | 658 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; |
651 | } | 659 | } |
652 | t << "( cd `dirname " << ddir_c << "` && " | 660 | t << "( cd `dirname " << ddir_c << "` && " |
653 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " | 661 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " |
654 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 662 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
655 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 663 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
656 | << "$(DEL_DIR) " << ddir_c | 664 | << "$(DEL_FILE) -r " << ddir_c |
657 | << endl << endl; | 665 | << endl << endl; |
658 | 666 | ||
659 | QString clean_targets; | 667 | QString clean_targets; |
660 | if(mocAware()) { | 668 | if(mocAware()) { |
661 | t << "mocclean:" << "\n"; | 669 | t << "mocclean:" << "\n"; |
662 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { | 670 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { |
663 | if(!objMoc.isEmpty()) | 671 | if(!objMoc.isEmpty()) |
664 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; | 672 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; |
665 | if(!srcMoc.isEmpty()) | 673 | if(!srcMoc.isEmpty()) |
666 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; | 674 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; |
667 | if(moc_incremental) | 675 | if(moc_incremental) |
668 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 676 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
669 | clean_targets += " mocclean"; | 677 | clean_targets += " mocclean"; |
670 | } | 678 | } |
671 | t << endl; | 679 | t << endl; |
672 | } | 680 | } |
673 | t << "uiclean:" << "\n"; | 681 | t << "uiclean:" << "\n"; |
674 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { | 682 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { |
675 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; | 683 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; |
676 | clean_targets += " uiclean"; | 684 | clean_targets += " uiclean"; |
677 | } | 685 | } |
678 | t << endl; | 686 | t << endl; |
679 | 687 | ||
688 | t << "yaccclean:" << "\n"; | ||
689 | if(!var("YACCSOURCES").isEmpty()) { | ||
690 | QStringList clean, &l = project->variables()["YACCSOURCES"]; | ||
691 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
692 | QFileInfo fi((*it)); | ||
693 | QString dir; | ||
694 | if(fi.dirPath() != ".") | ||
695 | dir = fi.dirPath() + Option::dir_sep; | ||
696 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
697 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | ||
698 | dir += Option::dir_sep; | ||
699 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | ||
700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | ||
701 | } | ||
702 | if(!clean.isEmpty()) { | ||
703 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | ||
704 | clean_targets += " yaccclean"; | ||
705 | } | ||
706 | } | ||
707 | |||
708 | t << "lexclean:" << "\n"; | ||
709 | if(!var("LEXSOURCES").isEmpty()) { | ||
710 | QStringList clean, &l = project->variables()["LEXSOURCES"]; | ||
711 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
712 | QFileInfo fi((*it)); | ||
713 | QString dir; | ||
714 | if(fi.dirPath() != ".") | ||
715 | dir = fi.dirPath() + Option::dir_sep; | ||
716 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
717 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | ||
718 | dir += Option::dir_sep; | ||
719 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | ||
720 | } | ||
721 | if(!clean.isEmpty()) { | ||
722 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | ||
723 | clean_targets += " lexclean"; | ||
724 | } | ||
725 | } | ||
726 | |||
680 | if(do_incremental) { | 727 | if(do_incremental) { |
681 | t << "incrclean:" << "\n"; | 728 | t << "incrclean:" << "\n"; |
682 | if(src_incremental) | 729 | if(src_incremental) |
683 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; | 730 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; |
684 | if(moc_incremental) | 731 | if(moc_incremental) |
685 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 732 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
686 | t << endl; | 733 | t << endl; |
687 | } | 734 | } |
688 | 735 | ||
689 | t << "clean:" << clean_targets << "\n\t"; | 736 | t << "clean:" << clean_targets << "\n\t"; |
690 | if(!project->isEmpty("OBJECTS")) | 737 | if(!project->isEmpty("OBJECTS")) |
691 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; | 738 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; |
692 | if(!project->isEmpty("IMAGES")) | 739 | if(!project->isEmpty("IMAGES")) |
693 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; | 740 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; |
694 | if(src_incremental) | 741 | if(src_incremental) |
695 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; | 742 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; |
@@ -697,34 +744,38 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
697 | << "-$(DEL_FILE) *~ core *.core" << "\n" | 744 | << "-$(DEL_FILE) *~ core *.core" << "\n" |
698 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; | 745 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; |
699 | t << "####### Sub-libraries" << endl << endl; | 746 | t << "####### Sub-libraries" << endl << endl; |
700 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { | 747 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { |
701 | QString libdir = "tmp/"; | 748 | QString libdir = "tmp/"; |
702 | if(!project->isEmpty("SUBLIBS_DIR")) | 749 | if(!project->isEmpty("SUBLIBS_DIR")) |
703 | libdir = project->first("SUBLIBS_DIR"); | 750 | libdir = project->first("SUBLIBS_DIR"); |
704 | QStringList &l = project->variables()["SUBLIBS"]; | 751 | QStringList &l = project->variables()["SUBLIBS"]; |
705 | for(it = l.begin(); it != l.end(); ++it) | 752 | for(it = l.begin(); it != l.end(); ++it) |
706 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" | 753 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" |
707 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 754 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
708 | } | 755 | } |
709 | 756 | ||
710 | QString destdir = project->first("DESTDIR"); | 757 | QString destdir = project->first("DESTDIR"); |
711 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 758 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
712 | destdir += Option::dir_sep; | 759 | destdir += Option::dir_sep; |
713 | t << "distclean: " << "clean\n\t" | 760 | t << "distclean: " << "clean\n"; |
714 | << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | 761 | if(project->first("TEMPLATE") == "app" && |
762 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | ||
763 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; | ||
764 | else | ||
765 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | ||
715 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && | 766 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && |
716 | !project->isActiveConfig("plugin")) | 767 | !project->isActiveConfig("plugin")) |
717 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " | 768 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " |
718 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; | 769 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; |
719 | t << endl << endl; | 770 | t << endl << endl; |
720 | 771 | ||
721 | if ( !project->isEmpty("PRECOMPH") ) { | 772 | if ( !project->isEmpty("PRECOMPH") ) { |
722 | QString outdir = project->first("MOC_DIR"); | 773 | QString outdir = project->first("MOC_DIR"); |
723 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); | 774 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); |
724 | t << "###### Combined headers" << endl << endl; | 775 | t << "###### Combined headers" << endl << endl; |
725 | //XXX | 776 | //XXX |
726 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " | 777 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " |
727 | << varList("HEADERS_ORIG") << "\n\t" | 778 | << varList("HEADERS_ORIG") << "\n\t" |
728 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" | 779 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" |
729 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " | 780 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " |
730 | << outdir << "allmoc.cpp" << "\n\t" | 781 | << outdir << "allmoc.cpp" << "\n\t" |
@@ -793,89 +844,89 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
793 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 844 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
794 | } | 845 | } |
795 | sd->target = "sub-" + (*it); | 846 | sd->target = "sub-" + (*it); |
796 | sd->target.replace('/', '-'); | 847 | sd->target.replace('/', '-'); |
797 | sd->target.replace('.', '_'); | 848 | sd->target.replace('.', '_'); |
798 | } | 849 | } |
799 | } | 850 | } |
800 | QPtrListIterator<SubDir> it(subdirs); | 851 | QPtrListIterator<SubDir> it(subdirs); |
801 | 852 | ||
802 | QString ofile = Option::output.name(); | 853 | QString ofile = Option::output.name(); |
803 | if(ofile.findRev(Option::dir_sep) != -1) | 854 | if(ofile.findRev(Option::dir_sep) != -1) |
804 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); | 855 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); |
805 | t << "MAKEFILE =" << var("MAKEFILE") << endl; | 856 | t << "MAKEFILE =" << var("MAKEFILE") << endl; |
806 | t << "QMAKE =" << var("QMAKE") << endl; | 857 | t << "QMAKE =" << var("QMAKE") << endl; |
807 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 858 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
808 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory | 859 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory |
809 | for( it.toFirst(); it.current(); ++it) | 860 | for( it.toFirst(); it.current(); ++it) |
810 | t << " \\\n\t\t" << it.current()->target; | 861 | t << " \\\n\t\t" << it.current()->target; |
811 | t << endl << endl; | 862 | t << endl << endl; |
812 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; | 863 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; |
813 | 864 | ||
814 | // generate target rules | 865 | // generate target rules |
815 | for( it.toFirst(); it.current(); ++it) { | 866 | for( it.toFirst(); it.current(); ++it) { |
816 | bool have_dir = !(*it)->directory.isEmpty(); | 867 | bool have_dir = !(*it)->directory.isEmpty(); |
817 | QString mkfile = (*it)->makefile, out; | 868 | QString mkfile = (*it)->makefile, out; |
818 | if(have_dir) | 869 | if(have_dir) |
819 | mkfile.prepend((*it)->directory + Option::dir_sep); | 870 | mkfile.prepend((*it)->directory + Option::dir_sep); |
820 | if(direct || (*it)->makefile != "$(MAKEFILE)") | 871 | if(direct || (*it)->makefile != "$(MAKEFILE)") |
821 | out = " -o " + (*it)->makefile; | 872 | out = " -o " + (*it)->makefile; |
822 | //qmake it | 873 | //qmake it |
823 | t << mkfile << ": " << "\n\t"; | 874 | t << mkfile << ": " << "\n\t"; |
824 | if(have_dir) | 875 | if(have_dir) |
825 | t << "cd " << (*it)->directory << " && "; | 876 | t << "cd " << (*it)->directory << " && "; |
826 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; | 877 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; |
827 | //actually compile | 878 | //actually compile |
828 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; | 879 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; |
829 | if(have_dir) | 880 | if(have_dir) |
830 | t << "cd " << (*it)->directory << " && "; | 881 | t << "cd " << (*it)->directory << " && "; |
831 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; | 882 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; |
832 | } | 883 | } |
833 | 884 | ||
834 | if (project->isActiveConfig("ordered")) { // generate dependencies | 885 | if (project->isActiveConfig("ordered")) { // generate dependencies |
835 | for( it.toFirst(); it.current(); ) { | 886 | for( it.toFirst(); it.current(); ) { |
836 | QString tar = it.current()->target; | 887 | QString tar = it.current()->target; |
837 | ++it; | 888 | ++it; |
838 | if (it.current()) | 889 | if (it.current()) |
839 | t << it.current()->target << ": " << tar << endl; | 890 | t << it.current()->target << ": " << tar << endl; |
840 | } | 891 | } |
841 | t << endl; | 892 | t << endl; |
842 | } | 893 | } |
843 | 894 | ||
844 | writeMakeQmake(t); | 895 | writeMakeQmake(t); |
845 | 896 | ||
846 | if(project->isEmpty("SUBDIRS")) { | 897 | if(project->isEmpty("SUBDIRS")) { |
847 | t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; | 898 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; |
848 | } else { | 899 | } else { |
849 | t << "all: $(SUBTARGETS)" << endl; | 900 | t << "all: $(SUBTARGETS)" << endl; |
850 | t << "qmake_all:"; | 901 | t << "qmake_all:"; |
851 | for( it.toFirst(); it.current(); ++it) { | 902 | for( it.toFirst(); it.current(); ++it) { |
852 | t << " "; | 903 | t << " "; |
853 | if(!(*it)->directory.isEmpty()) | 904 | if(!(*it)->directory.isEmpty()) |
854 | t << (*it)->directory << Option::dir_sep; | 905 | t << (*it)->directory << Option::dir_sep; |
855 | t << (*it)->makefile; | 906 | t << (*it)->makefile; |
856 | } | 907 | } |
857 | for( it.toFirst(); it.current(); ++it) { | 908 | for( it.toFirst(); it.current(); ++it) { |
858 | t << "\n\t ( "; | 909 | t << "\n\t ( "; |
859 | if(!(*it)->directory.isEmpty()) | 910 | if(!(*it)->directory.isEmpty()) |
860 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 911 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
861 | t << "grep \"^qmake_all:\" " << (*it)->makefile | 912 | t << "grep \"^qmake_all:\" " << (*it)->makefile |
862 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; | 913 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; |
863 | } | 914 | } |
864 | t << endl; | 915 | t << endl; |
865 | t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; | 916 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; |
866 | for( it.toFirst(); it.current(); ++it) { | 917 | for( it.toFirst(); it.current(); ++it) { |
867 | t << "\n\t ( "; | 918 | t << "\n\t ( "; |
868 | if(!(*it)->directory.isEmpty()) | 919 | if(!(*it)->directory.isEmpty()) |
869 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 920 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
870 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; | 921 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; |
871 | } | 922 | } |
872 | t << endl; | 923 | t << endl; |
873 | t << "distclean: qmake_all FORCE"; | 924 | t << "distclean: qmake_all FORCE"; |
874 | for( it.toFirst(); it.current(); ++it) { | 925 | for( it.toFirst(); it.current(); ++it) { |
875 | t << "\n\t ( "; | 926 | t << "\n\t ( "; |
876 | if(!(*it)->directory.isEmpty()) | 927 | if(!(*it)->directory.isEmpty()) |
877 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 928 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
878 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; | 929 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; |
879 | } | 930 | } |
880 | t << endl << endl; | 931 | t << endl << endl; |
881 | } | 932 | } |
@@ -893,69 +944,70 @@ void UnixMakefileGenerator::init2() | |||
893 | l << "0" << "0"; //make sure there are three | 944 | l << "0" << "0"; //make sure there are three |
894 | project->variables()["VER_MAJ"].append(l[0]); | 945 | project->variables()["VER_MAJ"].append(l[0]); |
895 | project->variables()["VER_MIN"].append(l[1]); | 946 | project->variables()["VER_MIN"].append(l[1]); |
896 | project->variables()["VER_PAT"].append(l[2]); | 947 | project->variables()["VER_PAT"].append(l[2]); |
897 | 948 | ||
898 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 949 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
899 | #if 0 | 950 | #if 0 |
900 | if ( project->isActiveConfig("dll") ) { | 951 | if ( project->isActiveConfig("dll") ) { |
901 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; | 952 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; |
902 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) | 953 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) |
903 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 954 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
904 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) | 955 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) |
905 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 956 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
906 | } | 957 | } |
907 | #endif | 958 | #endif |
908 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 959 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
960 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) | ||
961 | project->variables()["TARGET_EXT"].append(".exe"); | ||
909 | } else if ( project->isActiveConfig("staticlib") ) { | 962 | } else if ( project->isActiveConfig("staticlib") ) { |
910 | project->variables()["TARGET"].first().prepend("lib"); | 963 | project->variables()["TARGET"].first().prepend("lib"); |
911 | project->variables()["TARGET"].first() += ".a"; | 964 | project->variables()["TARGET"].first() += ".a"; |
912 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) | 965 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) |
913 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); | 966 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); |
914 | } else { | 967 | } else { |
915 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); | 968 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); |
916 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) | 969 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) |
917 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); | 970 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); |
918 | else | 971 | else |
919 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 972 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
920 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | ||
921 | if( project->isActiveConfig("plugin") ) { | 973 | if( project->isActiveConfig("plugin") ) { |
922 | project->variables()["TARGET_x.y.z"].append("lib" + | 974 | project->variables()["TARGET_x.y.z"].append("lib" + |
923 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); | 975 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); |
924 | if(project->isActiveConfig("lib_version_first")) | 976 | if(project->isActiveConfig("lib_version_first")) |
925 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 977 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
926 | project->first("VER_MAJ") + "." + | 978 | project->first("VER_MAJ") + "." + |
927 | project->first("QMAKE_EXTENSION_SHLIB")); | 979 | project->first("QMAKE_EXTENSION_SHLIB")); |
928 | else | 980 | else |
929 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 981 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
930 | project->first("QMAKE_EXTENSION_SHLIB") + | 982 | project->first("QMAKE_EXTENSION_SHLIB") + |
931 | "." + project->first("VER_MAJ")); | 983 | "." + project->first("VER_MAJ")); |
932 | 984 | ||
933 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 985 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
934 | if(project->isActiveConfig("qt")) | 986 | if(project->isActiveConfig("qt")) |
935 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 987 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
936 | } else if ( os == "hpux" ) { | 988 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
937 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 989 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
938 | if(project->isActiveConfig("lib_version_first")) | 990 | if(project->isActiveConfig("lib_version_first")) |
939 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + | 991 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + |
940 | project->first("TARGET")); | 992 | project->first("TARGET")); |
941 | else | 993 | else |
942 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 994 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
943 | project->first("VER_MAJ")); | 995 | project->first("VER_MAJ")); |
944 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 996 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
945 | } else if ( os == "aix" ) { | 997 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { |
946 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 998 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
947 | if(project->isActiveConfig("lib_version_first")) { | 999 | if(project->isActiveConfig("lib_version_first")) { |
948 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1000 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
949 | project->first("VER_MAJ") + "." + | 1001 | project->first("VER_MAJ") + "." + |
950 | project->first("QMAKE_EXTENSION_SHLIB")); | 1002 | project->first("QMAKE_EXTENSION_SHLIB")); |
951 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1003 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
952 | project->first("VER_MAJ") + | 1004 | project->first("VER_MAJ") + |
953 | "." + project->first("VER_MIN") + "." + | 1005 | "." + project->first("VER_MIN") + "." + |
954 | project->first("QMAKE_EXTENSION_SHLIB")); | 1006 | project->first("QMAKE_EXTENSION_SHLIB")); |
955 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1007 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
956 | project->first("VER_MAJ") + "." + | 1008 | project->first("VER_MAJ") + "." + |
957 | project->first("VER_MIN") + "." + | 1009 | project->first("VER_MIN") + "." + |
958 | project->first("VER_PAT") + "." + | 1010 | project->first("VER_PAT") + "." + |
959 | project->first("QMAKE_EXTENSION_SHLIB")); | 1011 | project->first("QMAKE_EXTENSION_SHLIB")); |
960 | } else { | 1012 | } else { |
961 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1013 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
@@ -998,34 +1050,41 @@ void UnixMakefileGenerator::init2() | |||
998 | "." + project->first("VER_MIN")); | 1050 | "." + project->first("VER_MIN")); |
999 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + | 1051 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + |
1000 | "." + | 1052 | "." + |
1001 | project->variables()[ | 1053 | project->variables()[ |
1002 | "QMAKE_EXTENSION_SHLIB"].first() + "." + | 1054 | "QMAKE_EXTENSION_SHLIB"].first() + "." + |
1003 | project->first("VER_MAJ") + "." + | 1055 | project->first("VER_MAJ") + "." + |
1004 | project->first("VER_MIN") + "." + | 1056 | project->first("VER_MIN") + "." + |
1005 | project->first("VER_PAT")); | 1057 | project->first("VER_PAT")); |
1006 | } | 1058 | } |
1007 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1059 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
1008 | } | 1060 | } |
1009 | if(project->isEmpty("QMAKE_LN_SHLIB")) | 1061 | if(project->isEmpty("QMAKE_LN_SHLIB")) |
1010 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); | 1062 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); |
1011 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); | 1063 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); |
1012 | if ( !project->variables()["DESTDIR"].isEmpty() ) | 1064 | if ( !project->variables()["DESTDIR"].isEmpty() ) |
1013 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); | 1065 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); |
1014 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() ) | 1066 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { |
1015 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | 1067 | if(project->isActiveConfig("plugin")) { |
1068 | if(!project->variables()["TARGET"].isEmpty() ) | ||
1069 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | ||
1070 | } else { | ||
1071 | if(!project->variables()["TARGET_x"].isEmpty() ) | ||
1072 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | ||
1073 | } | ||
1074 | } | ||
1016 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) | 1075 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) |
1017 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( | 1076 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( |
1018 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); | 1077 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); |
1019 | } | 1078 | } |
1020 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) | 1079 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) |
1021 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); | 1080 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); |
1022 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1081 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
1023 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; | 1082 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; |
1024 | } else if ( project->isActiveConfig("dll") ) { | 1083 | } else if ( project->isActiveConfig("dll") ) { |
1025 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; | 1084 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; |
1026 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | 1085 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; |
1027 | if ( project->isActiveConfig("plugin") ) { | 1086 | if ( project->isActiveConfig("plugin") ) { |
1028 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; | 1087 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; |
1029 | if( !project->isActiveConfig("plugin_no_soname") ) | 1088 | if( !project->isActiveConfig("plugin_no_soname") ) |
1030 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1089 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; |
1031 | } else { | 1090 | } else { |
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index ae7b47b..26eea88 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp | |||
@@ -119,69 +119,79 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
119 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 119 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
120 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 120 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
121 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 121 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
122 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 122 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
123 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 123 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
124 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 124 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
125 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 125 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
126 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 126 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
127 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 127 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
128 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | 128 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; |
129 | t << "RES_FILE =" << varList("RES_FILE") << endl; | 129 | t << "RES_FILE =" << varList("RES_FILE") << endl; |
130 | t << "COPY_FILE = " << var("QMAKE_COPY") << endl; | 130 | t << "COPY_FILE = " << var("QMAKE_COPY") << endl; |
131 | t << "COPY_DIR = " << var("QMAKE_COPY") << endl; | 131 | t << "COPY_DIR = " << var("QMAKE_COPY") << endl; |
132 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 132 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
133 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 133 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
134 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 134 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
135 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | ||
136 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | ||
135 | t << endl; | 137 | t << endl; |
136 | 138 | ||
137 | t << "####### Files" << endl << endl; | 139 | t << "####### Files" << endl << endl; |
138 | t << "HEADERS =" << varList("HEADERS") << endl; | 140 | t << "HEADERS =" << varList("HEADERS") << endl; |
139 | t << "SOURCES =" << varList("SOURCES") << endl; | 141 | t << "SOURCES =" << varList("SOURCES") << endl; |
140 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 142 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
141 | t << "FORMS =" << varList("FORMS") << endl; | 143 | t << "FORMS =" << varList("FORMS") << endl; |
142 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 144 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
143 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 145 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
144 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 146 | t << "SRCMOC =" << varList("SRCMOC") << endl; |
145 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 147 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
146 | t << "DIST =" << varList("DISTFILES") << endl; | 148 | t << "DIST =" << varList("DISTFILES") << endl; |
147 | t << "TARGET =" | 149 | t << "TARGET =" |
148 | << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")) | 150 | << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")) |
149 | << endl; | 151 | << endl; |
150 | t << endl; | 152 | t << endl; |
151 | 153 | ||
152 | t << "####### Implicit rules" << endl << endl; | 154 | t << "####### Implicit rules" << endl << endl; |
153 | t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; | 155 | t << ".SUFFIXES: .c"; |
154 | t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 156 | QStringList::Iterator cppit; |
155 | t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 157 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
156 | t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 158 | t << " " << (*cppit); |
157 | t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 159 | t << endl << endl; |
160 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | ||
161 | t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
162 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | ||
158 | 163 | ||
159 | t << "####### Build rules" << endl << endl; | 164 | t << "####### Build rules" << endl << endl; |
160 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; | 165 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; |
161 | t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); | 166 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
167 | << var("POST_TARGETDEPS"); | ||
162 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 168 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
163 | t << "\n\t" << "$(LINK) @&&|" << "\n\t" | 169 | t << "\n\t" << "$(LINK) @&&|" << "\n\t" |
164 | << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)"; | 170 | << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)"; |
165 | } else { | 171 | } else { |
166 | t << "\n\t-del $(TARGET)" | 172 | t << "\n\t-del $(TARGET)" |
167 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" | 173 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" |
168 | << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+" | 174 | << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+" |
169 | << project->variables()["OBJMOC"].join(" \\\n+"); | 175 | << project->variables()["OBJMOC"].join(" \\\n+"); |
170 | } | 176 | } |
171 | t << endl << "|" << endl; | 177 | t << endl << "|" << endl; |
178 | |||
179 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | ||
180 | t << "\t" <<var("QMAKE_POST_LINK") << endl; | ||
181 | |||
172 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 182 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
173 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 183 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
174 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
175 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 185 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; |
176 | } | 186 | } |
177 | } | 187 | } |
178 | QString targetfilename = project->variables()["TARGET"].first(); | 188 | QString targetfilename = project->variables()["TARGET"].first(); |
179 | if(project->isActiveConfig("activeqt")) { | 189 | if(project->isActiveConfig("activeqt")) { |
180 | QString version = project->variables()["VERSION"].first(); | 190 | QString version = project->variables()["VERSION"].first(); |
181 | if ( version.isEmpty() ) | 191 | if ( version.isEmpty() ) |
182 | version = "1.0"; | 192 | version = "1.0"; |
183 | 193 | ||
184 | if ( project->isActiveConfig("dll")) { | 194 | if ( project->isActiveConfig("dll")) { |
185 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); |
186 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | 196 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); |
187 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); |
@@ -200,63 +210,64 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
200 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; | 210 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; |
201 | } | 211 | } |
202 | t << "mocables: $(SRCMOC)" << endl << endl; | 212 | t << "mocables: $(SRCMOC)" << endl << endl; |
203 | 213 | ||
204 | writeMakeQmake(t); | 214 | writeMakeQmake(t); |
205 | 215 | ||
206 | t << "dist:" << "\n\t" | 216 | t << "dist:" << "\n\t" |
207 | << "$(ZIP) " << var("PROJECT") << ".zip " << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" | 217 | << "$(ZIP) " << var("PROJECT") << ".zip " << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" |
208 | << endl << endl; | 218 | << endl << endl; |
209 | 219 | ||
210 | t << "clean:\n" | 220 | t << "clean:\n" |
211 | << varGlue("OBJECTS","\t-del ","\n\t-del ","") | 221 | << varGlue("OBJECTS","\t-del ","\n\t-del ","") |
212 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 222 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") |
213 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 223 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") |
214 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 224 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") |
215 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 225 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") |
216 | << "\n\t-del $(TARGET)" | ||
217 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 226 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") |
218 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 227 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); |
219 | if ( project->isActiveConfig("activeqt")) { | 228 | if ( project->isActiveConfig("activeqt")) { |
220 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 229 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); |
221 | t << "\n\t-del tmp\\dump.*"; | 230 | t << "\n\t-del tmp\\dump.*"; |
222 | } | 231 | } |
223 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) | ||
224 | t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | ||
225 | if(!project->isEmpty("IMAGES")) | 232 | if(!project->isEmpty("IMAGES")) |
226 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 233 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); |
227 | 234 | ||
228 | // blasted user defined targets | 235 | // blasted user defined targets |
229 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 236 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
230 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 237 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { |
231 | QString targ = var((*it) + ".target"), | 238 | QString targ = var((*it) + ".target"), |
232 | cmd = var((*it) + ".commands"), deps; | 239 | cmd = var((*it) + ".commands"), deps; |
233 | if(targ.isEmpty()) | 240 | if(targ.isEmpty()) |
234 | targ = (*it); | 241 | targ = (*it); |
235 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 242 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
236 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 243 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
237 | QString dep = var((*dep_it) + ".target"); | 244 | QString dep = var((*dep_it) + ".target"); |
238 | if(dep.isEmpty()) | 245 | if(dep.isEmpty()) |
239 | dep = (*dep_it); | 246 | dep = (*dep_it); |
240 | deps += " " + dep; | 247 | deps += " " + dep; |
241 | } | 248 | } |
242 | t << "\n\n" << targ << ":" << deps << "\n\t" | 249 | t << "\n\n" << targ << ":" << deps << "\n\t" |
243 | << cmd; | 250 | << cmd; |
244 | } | 251 | } |
245 | 252 | ||
246 | t << endl << endl; | 253 | t << endl << endl; |
254 | |||
255 | t << "distclean: clean" | ||
256 | << "\n\t-del $(TARGET)" | ||
257 | << endl << endl; | ||
247 | } | 258 | } |
248 | 259 | ||
249 | void | 260 | void |
250 | BorlandMakefileGenerator::init() | 261 | BorlandMakefileGenerator::init() |
251 | { | 262 | { |
252 | if(init_flag) | 263 | if(init_flag) |
253 | return; | 264 | return; |
254 | init_flag = TRUE; | 265 | init_flag = TRUE; |
255 | 266 | ||
256 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 267 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
257 | 268 | ||
258 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 269 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
259 | if(project->first("TEMPLATE") == "app") | 270 | if(project->first("TEMPLATE") == "app") |
260 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 271 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
261 | else if(project->first("TEMPLATE") == "lib") | 272 | else if(project->first("TEMPLATE") == "lib") |
262 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 273 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
@@ -351,33 +362,33 @@ BorlandMakefileGenerator::init() | |||
351 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 362 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
352 | if ( !project->isActiveConfig("debug") ) | 363 | if ( !project->isActiveConfig("debug") ) |
353 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 364 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
354 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 365 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
355 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | 366 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
356 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 367 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
357 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | 368 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; |
358 | } | 369 | } |
359 | } else { | 370 | } else { |
360 | if(project->isActiveConfig("thread")) | 371 | if(project->isActiveConfig("thread")) |
361 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 372 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
362 | else | 373 | else |
363 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 374 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
364 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 375 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
365 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 376 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
366 | if ( hver == -1 ) | 377 | if ( hver == -1 ) |
367 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 378 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt"); |
368 | if(hver != -1) { | 379 | if(hver != -1) { |
369 | QString ver; | 380 | QString ver; |
370 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver); | 381 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver); |
371 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 382 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
372 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 383 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
373 | (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver); | 384 | (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver); |
374 | } | 385 | } |
375 | } | 386 | } |
376 | if ( project->isActiveConfig( "activeqt" ) ) { | 387 | if ( project->isActiveConfig( "activeqt" ) ) { |
377 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 388 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
378 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 389 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
379 | if ( project->isActiveConfig( "dll" ) ) | 390 | if ( project->isActiveConfig( "dll" ) ) |
380 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 391 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
381 | } | 392 | } |
382 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 393 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
383 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 394 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
@@ -413,65 +424,86 @@ BorlandMakefileGenerator::init() | |||
413 | if ( project->isActiveConfig("windows") ) { | 424 | if ( project->isActiveConfig("windows") ) { |
414 | if ( project->isActiveConfig("console") ) { | 425 | if ( project->isActiveConfig("console") ) { |
415 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 426 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
416 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 427 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
417 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 428 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
418 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 429 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
419 | } else { | 430 | } else { |
420 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 431 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; |
421 | } | 432 | } |
422 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 433 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
423 | } else { | 434 | } else { |
424 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 435 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
425 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 436 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
426 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 437 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
427 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 438 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
428 | } | 439 | } |
440 | if ( project->isActiveConfig("stl") ) { | ||
441 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | ||
442 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | ||
443 | } else { | ||
444 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | ||
445 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | ||
446 | } | ||
447 | if ( project->isActiveConfig("exceptions") ) { | ||
448 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
449 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
450 | } else { | ||
451 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
452 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
453 | } | ||
454 | if ( project->isActiveConfig("rtti") ) { | ||
455 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
456 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
457 | } else { | ||
458 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
459 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
460 | } | ||
461 | |||
429 | if ( project->isActiveConfig("thread") ) { | 462 | if ( project->isActiveConfig("thread") ) { |
430 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"]; | 463 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"]; |
431 | } else { | 464 | } else { |
432 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"]; | 465 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"]; |
433 | } | 466 | } |
434 | if ( project->isActiveConfig("moc") ) { | 467 | if ( project->isActiveConfig("moc") ) { |
435 | setMocAware(TRUE); | 468 | setMocAware(TRUE); |
436 | } | 469 | } |
437 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 470 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
438 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 471 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
439 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 472 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
440 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 473 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
441 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 474 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
442 | QStringList &gdmf = project->variables()[(*it)]; | 475 | QStringList &gdmf = project->variables()[(*it)]; |
443 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 476 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
444 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 477 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
445 | } | 478 | } |
446 | 479 | ||
447 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 480 | if ( !project->variables()["RC_FILE"].isEmpty()) { |
448 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 481 | if ( !project->variables()["RES_FILE"].isEmpty()) { |
449 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 482 | fprintf(stderr, "Both .rc and .res file specified.\n"); |
450 | fprintf(stderr, "Please specify one of them, not both."); | 483 | fprintf(stderr, "Please specify one of them, not both."); |
451 | exit(666); | 484 | exit(666); |
452 | } | 485 | } |
453 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 486 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; |
454 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | 487 | project->variables()["RES_FILE"].first().replace(".rc",".res"); |
455 | project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; | 488 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
456 | } | 489 | } |
457 | MakefileGenerator::init(); | 490 | MakefileGenerator::init(); |
458 | if ( !project->variables()["VERSION"].isEmpty()) { | 491 | if ( !project->variables()["VERSION"].isEmpty()) { |
459 | QStringList l = QStringList::split('.', project->first("VERSION")); | 492 | QStringList l = QStringList::split('.', project->first("VERSION")); |
460 | project->variables()["VER_MAJ"].append(l[0]); | 493 | project->variables()["VER_MAJ"].append(l[0]); |
461 | project->variables()["VER_MIN"].append(l[1]); | 494 | project->variables()["VER_MIN"].append(l[1]); |
462 | } | 495 | } |
463 | 496 | ||
464 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 497 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
465 | // bcc does not generate a .tds file for static libs | 498 | // bcc does not generate a .tds file for static libs |
466 | QString tdsPostfix; | 499 | QString tdsPostfix; |
467 | if ( !project->variables()["VERSION"].isEmpty() ) { | 500 | if ( !project->variables()["VERSION"].isEmpty() ) { |
468 | tdsPostfix = QStringList::split( '.', project->first("VERSION") ).join("") | 501 | tdsPostfix = QStringList::split( '.', project->first("VERSION") ).join("") |
469 | + ".tds"; | 502 | + ".tds"; |
470 | } else { | 503 | } else { |
471 | tdsPostfix = ".tds"; | 504 | tdsPostfix = ".tds"; |
472 | } | 505 | } |
473 | project->variables()["QMAKE_CLEAN"].append( | 506 | project->variables()["QMAKE_CLEAN"].append( |
474 | project->first("DESTDIR") + project->first("TARGET") + tdsPostfix ); | 507 | project->first("DESTDIR") + project->first("TARGET") + tdsPostfix ); |
475 | } | 508 | } |
476 | } | 509 | } |
477 | |||
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h index 90f8229..5ffed58 100644 --- a/qmake/generators/win32/borland_bmake.h +++ b/qmake/generators/win32/borland_bmake.h | |||
@@ -1,59 +1,58 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __BORLANDMAKE_H__ | 37 | #ifndef __BORLAND_BMAKE_H__ |
38 | #define __BORLANDMAKE_H__ | 38 | #define __BORLAND_BMAKE_H__ |
39 | 39 | ||
40 | #include "winmakefile.h" | 40 | #include "winmakefile.h" |
41 | 41 | ||
42 | class BorlandMakefileGenerator : public Win32MakefileGenerator | 42 | class BorlandMakefileGenerator : public Win32MakefileGenerator |
43 | { | 43 | { |
44 | bool init_flag; | 44 | bool init_flag; |
45 | void writeBorlandParts(QTextStream &); | 45 | void writeBorlandParts(QTextStream &); |
46 | 46 | ||
47 | bool writeMakefile(QTextStream &); | 47 | bool writeMakefile(QTextStream &); |
48 | void init(); | 48 | void init(); |
49 | 49 | ||
50 | public: | 50 | public: |
51 | BorlandMakefileGenerator(QMakeProject *p); | 51 | BorlandMakefileGenerator(QMakeProject *p); |
52 | ~BorlandMakefileGenerator(); | 52 | ~BorlandMakefileGenerator(); |
53 | }; | 53 | }; |
54 | 54 | ||
55 | inline BorlandMakefileGenerator::~BorlandMakefileGenerator() | 55 | inline BorlandMakefileGenerator::~BorlandMakefileGenerator() |
56 | { } | 56 | { } |
57 | 57 | ||
58 | 58 | #endif /* __BORLAND_BMAKE_H__ */ | |
59 | #endif /* __BORLANDMAKE_H__ */ | ||
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp new file mode 100644 index 0000000..7f58a55 --- a/dev/null +++ b/qmake/generators/win32/mingw_make.cpp | |||
@@ -0,0 +1,524 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of ________ class. | ||
5 | ** | ||
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | ||
20 | ** file in accordance with the Qt Commercial License Agreement provided | ||
21 | ** with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #include "mingw_make.h" | ||
37 | #include "option.h" | ||
38 | #include <qregexp.h> | ||
39 | #include <qdir.h> | ||
40 | #include <stdlib.h> | ||
41 | #include <time.h> | ||
42 | |||
43 | |||
44 | MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | ||
45 | { | ||
46 | Option::obj_ext = ".o"; | ||
47 | } | ||
48 | |||
49 | bool | ||
50 | MingwMakefileGenerator::writeMakefile(QTextStream &t) | ||
51 | { | ||
52 | writeHeader(t); | ||
53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | ||
54 | t << "all clean:" << "\n\t" | ||
55 | << "@echo \"Some of the required modules (" | ||
56 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | ||
57 | << "@echo \"Skipped.\"" << endl << endl; | ||
58 | writeMakeQmake(t); | ||
59 | return TRUE; | ||
60 | } | ||
61 | |||
62 | if(project->first("TEMPLATE") == "app" || | ||
63 | project->first("TEMPLATE") == "lib") { | ||
64 | writeMingwParts(t); | ||
65 | return MakefileGenerator::writeMakefile(t); | ||
66 | } | ||
67 | else if(project->first("TEMPLATE") == "subdirs") { | ||
68 | writeSubDirs(t); | ||
69 | return TRUE; | ||
70 | } | ||
71 | return FALSE; | ||
72 | } | ||
73 | |||
74 | void | ||
75 | MingwMakefileGenerator::writeMingwParts(QTextStream &t) | ||
76 | { | ||
77 | t << "####### Compiler, tools and options" << endl << endl; | ||
78 | t << "CC =" << var("QMAKE_CC") << endl; | ||
79 | t << "CXX =" << var("QMAKE_CXX") << endl; | ||
80 | t << "LEX = " << var("QMAKE_LEX") << endl; | ||
81 | t << "YACC = " << var("QMAKE_YACC") << endl; | ||
82 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | ||
83 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | ||
84 | << varGlue("DEFINES","-D"," -D","") << endl; | ||
85 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " | ||
86 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | ||
87 | << varGlue("DEFINES","-D"," -D","") << endl; | ||
88 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | ||
89 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | ||
90 | |||
91 | t << "INCPATH ="; | ||
92 | QStringList &incs = project->variables()["INCLUDEPATH"]; | ||
93 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | ||
94 | QString inc = (*incit); | ||
95 | inc.replace(QRegExp("\\\\$"), "\\\\"); | ||
96 | inc.replace(QRegExp("\""), ""); | ||
97 | t << " -I" << inc ; | ||
98 | } | ||
99 | t << " -I" << specdir() | ||
100 | << endl; | ||
101 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | ||
102 | t << "LINK =" << var("QMAKE_LINK") << endl; | ||
103 | t << "LFLAGS ="; | ||
104 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | ||
105 | t << varGlue("QMAKE_LIBDIR","-L",";","") << " "; | ||
106 | t << var("QMAKE_LFLAGS") << endl; | ||
107 | t << "LIBS =" << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; | ||
108 | } | ||
109 | else { | ||
110 | t << "LIB =" << var("QMAKE_LIB") << endl; | ||
111 | } | ||
112 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | ||
113 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | ||
114 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | ||
115 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | ||
116 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | ||
117 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | ||
118 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | ||
119 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | ||
120 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | ||
121 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | ||
122 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | ||
123 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | ||
124 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | ||
125 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | ||
126 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | ||
127 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | ||
128 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | ||
129 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | ||
130 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | ||
131 | t << endl; | ||
132 | |||
133 | t << "####### Output directory" << endl << endl; | ||
134 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | ||
135 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; | ||
136 | else | ||
137 | t << "OBJECTS_DIR = . " << endl; | ||
138 | if (! project->variables()["MOC_DIR"].isEmpty()) | ||
139 | t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl; | ||
140 | else | ||
141 | t << "MOC_DIR = . " << endl; | ||
142 | t << endl; | ||
143 | |||
144 | t << "####### Files" << endl << endl; | ||
145 | t << "HEADERS =" << varList("HEADERS") << endl; | ||
146 | t << "SOURCES =" << varList("SOURCES") << endl; | ||
147 | // t << "OBJECTS =" << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl; | ||
148 | t << "OBJECTS =" << varList("OBJECTS") << endl; | ||
149 | t << "FORMS =" << varList("FORMS") << endl; | ||
150 | t << "UICDECLS =" << varList("UICDECLS") << endl; | ||
151 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | ||
152 | t << "SRCMOC =" << varList("SRCMOC") << endl; | ||
153 | t << "OBJMOC =" << varList("OBJMOC") << endl; | ||
154 | // t << "OBJMOC =" << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl; | ||
155 | t << "DIST =" << varList("DISTFILES") << endl; | ||
156 | t << "TARGET ="; | ||
157 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | ||
158 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | ||
159 | else | ||
160 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | ||
161 | t << endl; | ||
162 | t << endl; | ||
163 | |||
164 | t << "####### Implicit rules" << endl << endl; | ||
165 | t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl; | ||
166 | t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
167 | t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
168 | t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
169 | t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
170 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | ||
171 | |||
172 | t << "####### Build rules" << endl << endl; | ||
173 | t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | ||
174 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | ||
175 | << var("POST_TARGETDEPS"); | ||
176 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | ||
177 | t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | ||
178 | } else { | ||
179 | t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)"; | ||
180 | } | ||
181 | |||
182 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | ||
183 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | ||
184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | ||
185 | t << "\n\t" << "copy $(TARGET) " << *dlldir; | ||
186 | } | ||
187 | } | ||
188 | QString targetfilename = project->variables()["TARGET"].first(); | ||
189 | if(project->isActiveConfig("activeqt")) { | ||
190 | QString version = project->variables()["VERSION"].first(); | ||
191 | if ( version.isEmpty() ) | ||
192 | version = "1.0"; | ||
193 | |||
194 | if ( project->isActiveConfig("dll")) { | ||
195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | ||
196 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | ||
197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | ||
198 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | ||
199 | } else { | ||
200 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | ||
201 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | ||
202 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | ||
203 | t << "\n\t" << "-$(TARGET) -regserver"; | ||
204 | } | ||
205 | } | ||
206 | t << endl << endl; | ||
207 | |||
208 | if(!project->variables()["RC_FILE"].isEmpty()) { | ||
209 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | ||
210 | << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl; | ||
211 | } | ||
212 | project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o"); | ||
213 | |||
214 | t << "mocables: $(SRCMOC)" << endl << endl; | ||
215 | |||
216 | t << "$(OBJECTS_DIR):" << "\n\t" | ||
217 | << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl; | ||
218 | |||
219 | t << "$(MOC_DIR):" << "\n\t" | ||
220 | << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl; | ||
221 | |||
222 | writeMakeQmake(t); | ||
223 | |||
224 | t << "dist:" << "\n\t" | ||
225 | << "$(ZIP) " << var("PROJECT") << ".zip " | ||
226 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | ||
227 | |||
228 | t << "clean:" | ||
229 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | ||
230 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | ||
231 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | ||
232 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | ||
233 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | ||
234 | << "\n\t-del $(TARGET)" | ||
235 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | ||
236 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | ||
237 | if ( project->isActiveConfig("activeqt")) { | ||
238 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | ||
239 | t << "\n\t-del tmp\\dump.*"; | ||
240 | } | ||
241 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) | ||
242 | t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | ||
243 | if(!project->isEmpty("IMAGES")) | ||
244 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | ||
245 | |||
246 | // blasted user defined targets | ||
247 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
248 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | ||
249 | QString targ = var((*it) + ".target"), | ||
250 | cmd = var((*it) + ".commands"), deps; | ||
251 | if(targ.isEmpty()) | ||
252 | targ = (*it); | ||
253 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | ||
254 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
255 | QString dep = var((*dep_it) + ".target"); | ||
256 | if(dep.isEmpty()) | ||
257 | dep = (*dep_it); | ||
258 | deps += " " + dep; | ||
259 | } | ||
260 | t << "\n\n" << targ << ":" << deps << "\n\t" | ||
261 | << cmd; | ||
262 | } | ||
263 | |||
264 | t << endl << endl; | ||
265 | } | ||
266 | |||
267 | |||
268 | void | ||
269 | MingwMakefileGenerator::init() | ||
270 | { | ||
271 | if(init_flag) | ||
272 | return; | ||
273 | init_flag = TRUE; | ||
274 | |||
275 | /* this should probably not be here, but I'm using it to wrap the .t files */ | ||
276 | if(project->first("TEMPLATE") == "app") | ||
277 | project->variables()["QMAKE_APP_FLAG"].append("1"); | ||
278 | else if(project->first("TEMPLATE") == "lib") | ||
279 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | ||
280 | else if(project->first("TEMPLATE") == "subdirs") { | ||
281 | MakefileGenerator::init(); | ||
282 | if(project->variables()["MAKEFILE"].isEmpty()) | ||
283 | project->variables()["MAKEFILE"].append("Makefile"); | ||
284 | if(project->variables()["QMAKE"].isEmpty()) | ||
285 | project->variables()["QMAKE"].append("qmake"); | ||
286 | return; | ||
287 | } | ||
288 | |||
289 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | ||
290 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | ||
291 | |||
292 | // LIBS defined in Profile comes first for gcc | ||
293 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | ||
294 | |||
295 | QString targetfilename = project->variables()["TARGET"].first(); | ||
296 | QStringList &configs = project->variables()["CONFIG"]; | ||
297 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) | ||
298 | project->variables()["DEFINES"].append("QT_DLL"); | ||
299 | if (project->isActiveConfig("qt_dll")) | ||
300 | if(configs.findIndex("qt") == -1) configs.append("qt"); | ||
301 | if ( project->isActiveConfig("qt") ) { | ||
302 | if ( project->isActiveConfig( "plugin" ) ) { | ||
303 | project->variables()["CONFIG"].append("dll"); | ||
304 | if(project->isActiveConfig("qt")) | ||
305 | project->variables()["DEFINES"].append("QT_PLUGIN"); | ||
306 | } | ||
307 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | ||
308 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | ||
309 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | ||
310 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | ||
311 | project->variables()["QMAKE_QT_DLL"].append("1"); | ||
312 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | ||
313 | project->variables()["CONFIG"].append("dll"); | ||
314 | } | ||
315 | if ( project->isActiveConfig("thread") ) | ||
316 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
317 | if ( project->isActiveConfig("accessibility" ) ) | ||
318 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | ||
319 | if ( project->isActiveConfig("tablet") ) | ||
320 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | ||
321 | } | ||
322 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | ||
323 | project->variables()["CONFIG"].remove("staticlib"); | ||
324 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | ||
325 | } else { | ||
326 | project->variables()["CONFIG"].append("staticlib"); | ||
327 | } | ||
328 | if ( project->isActiveConfig("warn_off") ) { | ||
329 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | ||
330 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | ||
331 | } else if ( project->isActiveConfig("warn_on") ) { | ||
332 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | ||
333 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | ||
334 | } | ||
335 | if ( project->isActiveConfig("debug") ) { | ||
336 | if ( project->isActiveConfig("thread") ) { | ||
337 | // use the DLL RT even here | ||
338 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | ||
339 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | ||
340 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | ||
341 | } else { | ||
342 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | ||
343 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | ||
344 | } | ||
345 | } | ||
346 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | ||
347 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | ||
348 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | ||
349 | } else { | ||
350 | if ( project->isActiveConfig("thread") ) { | ||
351 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | ||
352 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | ||
353 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | ||
354 | } else { | ||
355 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | ||
356 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | ||
357 | } | ||
358 | } | ||
359 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | ||
360 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | ||
361 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | ||
362 | } | ||
363 | |||
364 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) | ||
365 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | ||
366 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | ||
367 | project->variables()["CONFIG"].append("windows"); | ||
368 | if ( project->isActiveConfig("qt") ) { | ||
369 | project->variables()["CONFIG"].append("moc"); | ||
370 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | ||
371 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | ||
372 | if ( !project->isActiveConfig("debug") ) | ||
373 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | ||
374 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | ||
375 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | ||
376 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | ||
377 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | ||
378 | } | ||
379 | } else { | ||
380 | if(project->isActiveConfig("thread")) | ||
381 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | ||
382 | else | ||
383 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | ||
384 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | ||
385 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | ||
386 | if ( hver == -1 ) | ||
387 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | ||
388 | if(hver != -1) { | ||
389 | QString ver; | ||
390 | ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | ||
391 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | ||
392 | // @@@HGTODO maybe we must change the replace regexp if we understand what's going on | ||
393 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | ||
394 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | ||
395 | } | ||
396 | } | ||
397 | if ( project->isActiveConfig( "activeqt" ) ) { | ||
398 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | ||
399 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | ||
400 | if ( project->isActiveConfig( "dll" ) ) | ||
401 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | ||
402 | } | ||
403 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | ||
404 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | ||
405 | } | ||
406 | } | ||
407 | } | ||
408 | if ( project->isActiveConfig("opengl") ) { | ||
409 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | ||
410 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | ||
411 | } | ||
412 | if ( project->isActiveConfig("dll") ) { | ||
413 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
414 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
415 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
416 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
417 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | ||
418 | project->variables()["TARGET_EXT"].append( | ||
419 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | ||
420 | } else { | ||
421 | project->variables()["TARGET_EXT"].append(".dll"); | ||
422 | } | ||
423 | } else { | ||
424 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
425 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
426 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
427 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
428 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | ||
429 | project->variables()["TARGET_EXT"].append(".exe"); | ||
430 | } else { | ||
431 | project->variables()["TARGET_EXT"].append(".a"); | ||
432 | project->variables()["QMAKE_LFLAGS"].append("-static"); | ||
433 | if(project->variables()["TARGET"].first().left(3) != "lib") | ||
434 | project->variables()["TARGET"].first().prepend("lib"); | ||
435 | } | ||
436 | } | ||
437 | if ( project->isActiveConfig("windows") ) { | ||
438 | if ( project->isActiveConfig("console") ) { | ||
439 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
440 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
441 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
442 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
443 | } else { | ||
444 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
445 | } | ||
446 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
447 | } else { | ||
448 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
449 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
450 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
451 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
452 | } | ||
453 | |||
454 | if ( project->isActiveConfig("moc") ) | ||
455 | setMocAware(TRUE); | ||
456 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | ||
457 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | ||
458 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | ||
459 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
460 | QStringList &gdmf = project->variables()[(*it)]; | ||
461 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | ||
462 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | ||
463 | } | ||
464 | |||
465 | if ( project->isActiveConfig("dll") ) | ||
466 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a"); | ||
467 | |||
468 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
469 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE")); | ||
470 | // if(!project->isActiveConfig("incremental")) | ||
471 | //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | ||
472 | |||
473 | #if 0 | ||
474 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
475 | QString version = project->variables()["VERSION"][0]; | ||
476 | int firstDot = version.find( "." ); | ||
477 | QString major = version.left( firstDot ); | ||
478 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
479 | minor.replace( ".", "" ); | ||
480 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
481 | } | ||
482 | #endif | ||
483 | if ( !project->variables()["RC_FILE"].isEmpty()) { | ||
484 | if ( !project->variables()["RES_FILE"].isEmpty()) { | ||
485 | fprintf(stderr, "Both .rc and .res file specified.\n"); | ||
486 | fprintf(stderr, "Please specify one of them, not both."); | ||
487 | exit(666); | ||
488 | } | ||
489 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | ||
490 | project->variables()["RES_FILE"].first().replace(".rc",".o"); | ||
491 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | ||
492 | } | ||
493 | if ( !project->variables()["RES_FILE"].isEmpty()) | ||
494 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
495 | |||
496 | MakefileGenerator::init(); | ||
497 | if ( !project->variables()["VERSION"].isEmpty()) { | ||
498 | QStringList l = QStringList::split('.', project->first("VERSION")); | ||
499 | project->variables()["VER_MAJ"].append(l[0]); | ||
500 | project->variables()["VER_MIN"].append(l[1]); | ||
501 | } | ||
502 | if(project->isActiveConfig("dll")) { | ||
503 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a"); | ||
504 | } | ||
505 | } | ||
506 | |||
507 | void | ||
508 | MingwMakefileGenerator::writeSubDirs(QTextStream &t) | ||
509 | { | ||
510 | QString qs ; | ||
511 | QTextStream ts (&qs, IO_WriteOnly) ; | ||
512 | Win32MakefileGenerator::writeSubDirs( ts ) ; | ||
513 | QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ; | ||
514 | rx.setMinimal(true); | ||
515 | int pos = 0 ; | ||
516 | while ( -1 != (pos = rx.search( qs, pos))) | ||
517 | { | ||
518 | QString qsMatch = rx.cap(2); | ||
519 | qsMatch.replace("\n\t"," && \\\n\t"); | ||
520 | qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch ); | ||
521 | pos += (rx.cap(1).length()+qsMatch.length()); | ||
522 | } | ||
523 | t << qs ; | ||
524 | } | ||
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h new file mode 100644 index 0000000..c00bf1b --- a/dev/null +++ b/qmake/generators/win32/mingw_make.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of ________ class. | ||
5 | ** | ||
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | ||
20 | ** file in accordance with the Qt Commercial License Agreement provided | ||
21 | ** with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | #ifndef __MINGW_MAKE_H__ | ||
36 | #define __MINGW_MAKE_H__ | ||
37 | |||
38 | #include "winmakefile.h" | ||
39 | |||
40 | class MingwMakefileGenerator : public Win32MakefileGenerator | ||
41 | { | ||
42 | bool init_flag; | ||
43 | void writeMingwParts(QTextStream &); | ||
44 | void writeSubDirs(QTextStream &t) ; | ||
45 | |||
46 | bool writeMakefile(QTextStream &); | ||
47 | void init(); | ||
48 | |||
49 | public: | ||
50 | MingwMakefileGenerator(QMakeProject *p); | ||
51 | ~MingwMakefileGenerator(); | ||
52 | |||
53 | }; | ||
54 | |||
55 | inline MingwMakefileGenerator::~MingwMakefileGenerator() | ||
56 | { } | ||
57 | |||
58 | #endif /* __MINGW_MAKE_H__ */ | ||
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 8b08c78..3fa0496 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp | |||
@@ -495,32 +495,56 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
495 | } | 495 | } |
496 | t << endl; | 496 | t << endl; |
497 | file.close(); | 497 | file.close(); |
498 | return TRUE; | 498 | return TRUE; |
499 | } | 499 | } |
500 | 500 | ||
501 | 501 | ||
502 | 502 | ||
503 | void | 503 | void |
504 | DspMakefileGenerator::init() | 504 | DspMakefileGenerator::init() |
505 | { | 505 | { |
506 | if(init_flag) | 506 | if(init_flag) |
507 | return; | 507 | return; |
508 | QStringList::Iterator it; | 508 | QStringList::Iterator it; |
509 | init_flag = TRUE; | 509 | init_flag = TRUE; |
510 | 510 | ||
511 | const bool thread = project->isActiveConfig("thread"); | ||
512 | |||
513 | if ( project->isActiveConfig("stl") ) { | ||
514 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | ||
515 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | ||
516 | } else { | ||
517 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | ||
518 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | ||
519 | } | ||
520 | if ( project->isActiveConfig("exceptions") ) { | ||
521 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
522 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
523 | } else { | ||
524 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
525 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
526 | } | ||
527 | if ( project->isActiveConfig("rtti") ) { | ||
528 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
529 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
530 | } else { | ||
531 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
532 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
533 | } | ||
534 | |||
511 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 535 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
512 | if(project->first("TEMPLATE") == "vcapp" ) | 536 | if(project->first("TEMPLATE") == "vcapp" ) |
513 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 537 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
514 | else if(project->first("TEMPLATE") == "vclib") | 538 | else if(project->first("TEMPLATE") == "vclib") |
515 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 539 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
516 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 540 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
517 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 541 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
518 | 542 | ||
519 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 543 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
520 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 544 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
521 | 545 | ||
522 | QStringList &configs = project->variables()["CONFIG"]; | 546 | QStringList &configs = project->variables()["CONFIG"]; |
523 | if (project->isActiveConfig("shared")) | 547 | if (project->isActiveConfig("shared")) |
524 | project->variables()["DEFINES"].append("QT_DLL"); | 548 | project->variables()["DEFINES"].append("QT_DLL"); |
525 | if (project->isActiveConfig("qt_dll")) | 549 | if (project->isActiveConfig("qt_dll")) |
526 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 550 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
@@ -555,43 +579,43 @@ DspMakefileGenerator::init() | |||
555 | QString minor = version.right( version.length() - firstDot - 1 ); | 579 | QString minor = version.right( version.length() - firstDot - 1 ); |
556 | minor.replace( ".", "" ); | 580 | minor.replace( ".", "" ); |
557 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); | 581 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); |
558 | } | 582 | } |
559 | 583 | ||
560 | if ( project->isActiveConfig("qt") ) { | 584 | if ( project->isActiveConfig("qt") ) { |
561 | project->variables()["CONFIG"].append("moc"); | 585 | project->variables()["CONFIG"].append("moc"); |
562 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 586 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
563 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 587 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
564 | 588 | ||
565 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 589 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
566 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 590 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
567 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 591 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
568 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); | 592 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); |
569 | } | 593 | } |
570 | } else { | 594 | } else { |
571 | if(project->isActiveConfig("thread")) | 595 | if( thread ) |
572 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 596 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
573 | else | 597 | else |
574 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 598 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
575 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 599 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
576 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 600 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
577 | if ( hver == -1 ) | 601 | if ( hver == -1 ) |
578 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 602 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
579 | if(hver != -1) { | 603 | if(hver != -1) { |
580 | QString ver; | 604 | QString ver; |
581 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 605 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); |
582 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 606 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
583 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 607 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
584 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 608 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
585 | } | 609 | } |
586 | } | 610 | } |
587 | if ( project->isActiveConfig( "activeqt" ) ) { | 611 | if ( project->isActiveConfig( "activeqt" ) ) { |
588 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 612 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
589 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 613 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
590 | if ( project->isActiveConfig( "dll" ) ) | 614 | if ( project->isActiveConfig( "dll" ) ) |
591 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 615 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
592 | } | 616 | } |
593 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 617 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
594 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 618 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
595 | } | 619 | } |
596 | } | 620 | } |
597 | } | 621 | } |
@@ -609,33 +633,33 @@ DspMakefileGenerator::init() | |||
609 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 633 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
610 | } else { | 634 | } else { |
611 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 635 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
612 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); | 636 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); |
613 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
614 | if ( !project->first("DESTDIR").isEmpty() ) | 638 | if ( !project->first("DESTDIR").isEmpty() ) |
615 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); | 639 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); |
616 | else | 640 | else |
617 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 641 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
618 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 642 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
619 | } | 643 | } |
620 | 644 | ||
621 | if ( project->isActiveConfig("opengl") ) { | 645 | if ( project->isActiveConfig("opengl") ) { |
622 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 646 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
623 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 647 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
624 | } | 648 | } |
625 | if ( project->isActiveConfig("thread") ) { | 649 | if ( thread ) { |
626 | if(project->isActiveConfig("qt")) | 650 | if(project->isActiveConfig("qt")) |
627 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 651 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
628 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" | 652 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" |
629 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 653 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
630 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 654 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
631 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 655 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
632 | } else { | 656 | } else { |
633 | // YES we want to use the DLL even in a static build | 657 | // YES we want to use the DLL even in a static build |
634 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 658 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
635 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 659 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
636 | } | 660 | } |
637 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 661 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
638 | && project->first("TARGET") != "qtmain" ) | 662 | && project->first("TARGET") != "qtmain" ) |
639 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); | 663 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); |
640 | } | 664 | } |
641 | 665 | ||
@@ -719,223 +743,242 @@ DspMakefileGenerator::init() | |||
719 | if ( project->isActiveConfig("dll") ) { | 743 | if ( project->isActiveConfig("dll") ) { |
720 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); | 744 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); |
721 | } else { | 745 | } else { |
722 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); | 746 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); |
723 | } | 747 | } |
724 | } | 748 | } |
725 | 749 | ||
726 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
727 | 751 | ||
728 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
729 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 753 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
730 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); | 754 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); |
731 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 755 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
732 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 756 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
733 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 757 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
734 | 758 | ||
759 | processPrlFiles(); | ||
735 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 760 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
736 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 761 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
737 | QString lib = (*libit); | 762 | QString lib = (*libit); |
738 | lib.replace(QRegExp("\""), ""); | 763 | lib.replace(QRegExp("\""), ""); |
739 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); | 764 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); |
740 | } | 765 | } |
741 | 766 | ||
742 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 767 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
743 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 768 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
744 | QString inc = (*incit); | 769 | QString inc = (*incit); |
745 | inc.replace("\"", ""); | 770 | inc.replace("\"", ""); |
746 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
747 | } | 772 | } |
748 | 773 | ||
749 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); | 774 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); |
750 | if ( project->isActiveConfig("qt") ) { | 775 | if ( project->isActiveConfig("qt") ) { |
751 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); | 776 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); |
752 | } else { | 777 | } else { |
753 | project->variables()["MSVCDSP_RELDEFS"].clear(); | 778 | project->variables()["MSVCDSP_RELDEFS"].clear(); |
754 | } | 779 | } |
755 | 780 | ||
756 | QString dest; | 781 | QString dest; |
782 | QString postLinkStep; | ||
783 | QString copyDllStep; | ||
784 | QString activeQtStepPreCopyDll; | ||
785 | QString activeQtStepPostCopyDll; | ||
786 | QString activeQtStepPreCopyDllDebug; | ||
787 | QString activeQtStepPostCopyDllDebug; | ||
788 | QString activeQtStepPreCopyDllRelease; | ||
789 | QString activeQtStepPostCopyDllRelease; | ||
790 | |||
791 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | ||
792 | postLinkStep += var("QMAKE_POST_LINK"); | ||
793 | |||
757 | if ( !project->variables()["DESTDIR"].isEmpty() ) { | 794 | if ( !project->variables()["DESTDIR"].isEmpty() ) { |
758 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 795 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
759 | Option::fixPathToTargetOS(project->first("TARGET")); | 796 | Option::fixPathToTargetOS(project->first("TARGET")); |
760 | dest = project->first("TARGET"); | 797 | dest = project->first("TARGET"); |
761 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 798 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
762 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); | 799 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); |
763 | project->variables()["MSVCDSP_TARGET"].append( | 800 | project->variables()["MSVCDSP_TARGET"].append( |
764 | QString("/out:\"") + dest + "\""); | 801 | QString("/out:\"") + dest + "\""); |
765 | if ( project->isActiveConfig("dll") ) { | 802 | if ( project->isActiveConfig("dll") ) { |
766 | QString imp = dest; | 803 | QString imp = dest; |
767 | imp.replace(".dll", ".lib"); | 804 | imp.replace(".dll", ".lib"); |
768 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); | 805 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); |
769 | } | 806 | } |
770 | } | 807 | } |
771 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 808 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
772 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 809 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
773 | QString copydll = "# Begin Special Build Tool\n" | 810 | if ( dlldirs.count() ) |
774 | "TargetPath=" + dest + "\n" | 811 | copyDllStep += "\t"; |
775 | "SOURCE=$(InputPath)\n" | ||
776 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | ||
777 | "PostBuild_Cmds="; | ||
778 | |||
779 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 812 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
780 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | 813 | copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; |
781 | } | 814 | } |
782 | |||
783 | copydll += "\n# End Special Build Tool"; | ||
784 | project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll ); | ||
785 | project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll ); | ||
786 | } | 815 | } |
816 | |||
787 | if ( project->isActiveConfig("activeqt") ) { | 817 | if ( project->isActiveConfig("activeqt") ) { |
788 | QString idl = project->variables()["QMAKE_IDL"].first(); | 818 | QString idl = project->variables()["QMAKE_IDL"].first(); |
789 | QString idc = project->variables()["QMAKE_IDC"].first(); | 819 | QString idc = project->variables()["QMAKE_IDC"].first(); |
790 | QString version = project->variables()["VERSION"].first(); | 820 | QString version = project->variables()["VERSION"].first(); |
791 | if ( version.isEmpty() ) | 821 | if ( version.isEmpty() ) |
792 | version = "1.0"; | 822 | version = "1.0"; |
793 | 823 | ||
794 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); |
795 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | 825 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); |
796 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | 826 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); |
797 | if ( project->isActiveConfig( "dll" ) ) { | 827 | if ( project->isActiveConfig( "dll" ) ) { |
798 | QString regcmd = "# Begin Special Build Tool\n" | 828 | activeQtStepPreCopyDll += |
799 | "TargetPath=" + targetfilename + "\n" | 829 | "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + |
800 | "SOURCE=$(InputPath)\n" | ||
801 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | ||
802 | "PostBuild_Cmds=" + | ||
803 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | ||
804 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 830 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" |
805 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 831 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; |
806 | "\t" + idc + " %1 /regserver\n" | 832 | activeQtStepPostCopyDll += |
807 | "# End Special Build Tool"; | 833 | "\t" + idc + " %1 /regserver\n"; |
808 | 834 | ||
809 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 835 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; |
810 | project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 836 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
837 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); | ||
811 | 838 | ||
812 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 839 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; |
813 | project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 840 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
841 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | ||
814 | } else { | 842 | } else { |
815 | QString regcmd = "# Begin Special Build Tool\n" | 843 | activeQtStepPreCopyDll += |
816 | "TargetPath=" + targetfilename + "\n" | 844 | "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + |
817 | "SOURCE=$(InputPath)\n" | ||
818 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | ||
819 | "PostBuild_Cmds=" | ||
820 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | ||
821 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 845 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" |
822 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 846 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; |
823 | "\t%1 -regserver\n" | 847 | activeQtStepPostCopyDll += |
824 | "# End Special Build Tool"; | 848 | "\t%1 -regserver\n"; |
825 | 849 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; | |
826 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 850 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
827 | project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 851 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); |
828 | 852 | ||
829 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 853 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; |
830 | project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 854 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
855 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | ||
831 | } | 856 | } |
832 | 857 | ||
833 | } | 858 | } |
859 | |||
860 | |||
861 | if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { | ||
862 | project->variables()["MSVCDSP_POST_LINK_DBG"].append( | ||
863 | "# Begin Special Build Tool\n" | ||
864 | "SOURCE=$(InputPath)\n" | ||
865 | "PostBuild_Desc=Post Build Step\n" | ||
866 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" | ||
867 | "# End Special Build Tool\n" ); | ||
868 | project->variables()["MSVCDSP_POST_LINK_REL"].append( | ||
869 | "# Begin Special Build Tool\n" | ||
870 | "SOURCE=$(InputPath)\n" | ||
871 | "PostBuild_Desc=Post Build Step\n" | ||
872 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" | ||
873 | "# End Special Build Tool\n" ); | ||
874 | } | ||
875 | |||
834 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { | 876 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { |
835 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; | 877 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; |
836 | } | 878 | } |
837 | QStringList &list = project->variables()["FORMS"]; | 879 | QStringList &list = project->variables()["FORMS"]; |
838 | for( it = list.begin(); it != list.end(); ++it ) { | 880 | for( it = list.begin(); it != list.end(); ++it ) { |
839 | if ( QFile::exists( *it + ".h" ) ) | 881 | if ( QFile::exists( *it + ".h" ) ) |
840 | project->variables()["SOURCES"].append( *it + ".h" ); | 882 | project->variables()["SOURCES"].append( *it + ".h" ); |
841 | } | 883 | } |
842 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
843 | } | 885 | } |
844 | 886 | ||
845 | 887 | ||
846 | QString | 888 | QString |
847 | DspMakefileGenerator::findTemplate(QString file) | 889 | DspMakefileGenerator::findTemplate(const QString &file) |
848 | { | 890 | { |
849 | QString ret; | 891 | QString ret; |
850 | if(!QFile::exists((ret = file)) && | 892 | if(!QFile::exists((ret = file)) && |
851 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 893 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
852 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && | 894 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && |
853 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 895 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
854 | return ""; | 896 | return ""; |
855 | return ret; | 897 | return ret; |
856 | } | 898 | } |
857 | 899 | ||
858 | 900 | ||
859 | void | 901 | void |
860 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 902 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
861 | { | 903 | { |
862 | if(var == "QMAKE_PRL_DEFINES") { | 904 | if(var == "QMAKE_PRL_DEFINES") { |
863 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; | 905 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; |
864 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 906 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
865 | if(out.findIndex((*it)) == -1) | 907 | if(out.findIndex((*it)) == -1) |
866 | out.append((" /D \"" + *it + "\"")); | 908 | out.append((" /D \"" + *it + "\"")); |
867 | } | 909 | } |
868 | } else { | 910 | } else { |
869 | MakefileGenerator::processPrlVariable(var, l); | 911 | MakefileGenerator::processPrlVariable(var, l); |
870 | } | 912 | } |
871 | } | 913 | } |
872 | 914 | ||
873 | 915 | ||
874 | int | 916 | void |
875 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | 917 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, |
876 | QString filter) | 918 | const QString& filter) |
877 | { | 919 | { |
878 | if(project->isActiveConfig("flat")) | 920 | if(project->isActiveConfig("flat")) |
879 | return 0; | 921 | return; |
880 | 922 | ||
881 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); | 923 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); |
882 | file = file.section(Option::dir_sep, 0, -2); | 924 | file = file.section(Option::dir_sep, 0, -2); |
883 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) | 925 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) |
884 | file += Option::dir_sep; | 926 | file += Option::dir_sep; |
885 | if(file == currentGroup) | 927 | if(file == currentGroup) |
886 | return 0; | 928 | return; |
887 | 929 | ||
888 | if(file.isEmpty() || !QDir::isRelativePath(file)) { | 930 | if(file.isEmpty() || !QDir::isRelativePath(file)) { |
889 | endGroups(t); | 931 | endGroups(t); |
890 | return 0; | 932 | return; |
891 | } | 933 | } |
892 | if(file.startsWith(currentGroup)) | 934 | if(file.startsWith(currentGroup)) |
893 | file = file.mid(currentGroup.length()); | 935 | file = file.mid(currentGroup.length()); |
894 | else | 936 | int dirSep = currentGroup.findRev( Option::dir_sep ); |
895 | endGroups(t); | 937 | while( !file.startsWith( currentGroup ) && dirSep != -1 ) { |
896 | int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep); | 938 | currentGroup.truncate( dirSep ); |
897 | if(lvl > old_lvl) { | 939 | dirSep = currentGroup.findRev( Option::dir_sep ); |
898 | QStringList dirs = QStringList::split(Option::dir_sep, file); | 940 | if ( !file.startsWith( currentGroup ) && dirSep != -1 ) |
899 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
900 | t << "# Begin Group \"" << (*dir_it) << "\"\n" | ||
901 | << "# Prop Default_Filter \"" << filter << "\"\n"; | ||
902 | } | ||
903 | } else { | ||
904 | for(int x = old_lvl - lvl; x; x--) | ||
905 | t << "\n# End Group\n"; | 941 | t << "\n# End Group\n"; |
906 | } | 942 | } |
943 | if ( !file.startsWith( currentGroup ) ) { | ||
944 | t << "\n# End Group\n"; | ||
945 | currentGroup = ""; | ||
946 | } | ||
947 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); | ||
948 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
949 | t << "# Begin Group \"" << (*dir_it) << "\"\n" | ||
950 | << "# Prop Default_Filter \"" << filter << "\"\n"; | ||
951 | } | ||
907 | currentGroup = file; | 952 | currentGroup = file; |
908 | return lvl - old_lvl; | ||
909 | } | 953 | } |
910 | 954 | ||
911 | 955 | ||
912 | int | 956 | void |
913 | DspMakefileGenerator::endGroups(QTextStream &t) | 957 | DspMakefileGenerator::endGroups(QTextStream &t) |
914 | { | 958 | { |
915 | if(project->isActiveConfig("flat")) | 959 | if(project->isActiveConfig("flat")) |
916 | return 0; | 960 | return; |
917 | else if(currentGroup.isEmpty()) | 961 | else if(currentGroup.isEmpty()) |
918 | return 0; | 962 | return; |
919 | 963 | ||
920 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); | 964 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); |
921 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { | 965 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { |
922 | t << "\n# End Group\n"; | 966 | t << "\n# End Group\n"; |
923 | } | 967 | } |
924 | currentGroup = ""; | 968 | currentGroup = ""; |
925 | return dirs.count(); | ||
926 | } | 969 | } |
927 | 970 | ||
928 | bool | 971 | bool |
929 | DspMakefileGenerator::openOutput(QFile &file) const | 972 | DspMakefileGenerator::openOutput(QFile &file) const |
930 | { | 973 | { |
931 | QString outdir; | 974 | QString outdir; |
932 | if(!file.name().isEmpty()) { | 975 | if(!file.name().isEmpty()) { |
933 | QFileInfo fi(file); | 976 | QFileInfo fi(file); |
934 | if(fi.isDir()) | 977 | if(fi.isDir()) |
935 | outdir = file.name() + QDir::separator(); | 978 | outdir = file.name() + QDir::separator(); |
936 | } | 979 | } |
937 | if(!outdir.isEmpty() || file.name().isEmpty()) | 980 | if(!outdir.isEmpty() || file.name().isEmpty()) |
938 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); | 981 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); |
939 | if(QDir::isRelativePath(file.name())) { | 982 | if(QDir::isRelativePath(file.name())) { |
940 | QString ofile; | 983 | QString ofile; |
941 | ofile = file.name(); | 984 | ofile = file.name(); |
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h index a7fc3e7..3a7d18e 100644 --- a/qmake/generators/win32/msvc_dsp.h +++ b/qmake/generators/win32/msvc_dsp.h | |||
@@ -1,73 +1,73 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __DSPMAKE_H__ | 37 | #ifndef __MSVC_DSP_H__ |
38 | #define __DSPMAKE_H__ | 38 | #define __MSVC_DSP_H__ |
39 | 39 | ||
40 | #include "winmakefile.h" | 40 | #include "winmakefile.h" |
41 | #include <qvaluestack.h> | 41 | #include <qvaluestack.h> |
42 | 42 | ||
43 | class DspMakefileGenerator : public Win32MakefileGenerator | 43 | class DspMakefileGenerator : public Win32MakefileGenerator |
44 | { | 44 | { |
45 | QString currentGroup; | 45 | QString currentGroup; |
46 | int beginGroupForFile(QString file, QTextStream &, const QString filter=""); | 46 | void beginGroupForFile(QString file, QTextStream &, const QString& filter=""); |
47 | int endGroups(QTextStream &); | 47 | void endGroups(QTextStream &); |
48 | 48 | ||
49 | bool init_flag; | 49 | bool init_flag; |
50 | bool writeDspParts(QTextStream &); | 50 | bool writeDspParts(QTextStream &); |
51 | 51 | ||
52 | bool writeMakefile(QTextStream &); | 52 | bool writeMakefile(QTextStream &); |
53 | QString findTemplate(QString file); | 53 | QString findTemplate(const QString &file); |
54 | void init(); | 54 | void init(); |
55 | 55 | ||
56 | public: | 56 | public: |
57 | DspMakefileGenerator(QMakeProject *p); | 57 | DspMakefileGenerator(QMakeProject *p); |
58 | ~DspMakefileGenerator(); | 58 | ~DspMakefileGenerator(); |
59 | 59 | ||
60 | bool openOutput(QFile &file) const; | 60 | bool openOutput(QFile &file) const; |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | virtual void processPrlVariable(const QString &, const QStringList &); | 63 | virtual void processPrlVariable(const QString &, const QStringList &); |
64 | virtual bool findLibraries(); | 64 | virtual bool findLibraries(); |
65 | }; | 65 | }; |
66 | 66 | ||
67 | inline DspMakefileGenerator::~DspMakefileGenerator() | 67 | inline DspMakefileGenerator::~DspMakefileGenerator() |
68 | { } | 68 | { } |
69 | 69 | ||
70 | inline bool DspMakefileGenerator::findLibraries() | 70 | inline bool DspMakefileGenerator::findLibraries() |
71 | { return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); } | 71 | { return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); } |
72 | 72 | ||
73 | #endif /* __DSPMAKE_H__ */ | 73 | #endif /* __MSVC_DSP_H__ */ |
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 9cc9a69..ecef34d 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp | |||
@@ -1,56 +1,57 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "msvc_nmake.h" | 38 | #include "msvc_nmake.h" |
39 | #include "option.h" | 39 | #include "option.h" |
40 | #include <qregexp.h> | 40 | #include <qregexp.h> |
41 | #include <qdict.h> | ||
41 | #include <qdir.h> | 42 | #include <qdir.h> |
42 | #include <stdlib.h> | 43 | #include <stdlib.h> |
43 | #include <time.h> | 44 | #include <time.h> |
44 | 45 | ||
45 | 46 | ||
46 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 47 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
47 | { | 48 | { |
48 | 49 | ||
49 | } | 50 | } |
50 | 51 | ||
51 | bool | 52 | bool |
52 | NmakeMakefileGenerator::writeMakefile(QTextStream &t) | 53 | NmakeMakefileGenerator::writeMakefile(QTextStream &t) |
53 | { | 54 | { |
54 | writeHeader(t); | 55 | writeHeader(t); |
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 56 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
56 | t << "all clean:" << "\n\t" | 57 | t << "all clean:" << "\n\t" |
@@ -122,70 +123,115 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
122 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 123 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : |
123 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 124 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
124 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 125 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
125 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 126 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
126 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 127 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
127 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 128 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
128 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 129 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
129 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 130 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
130 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 131 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
131 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 132 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
132 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 133 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
133 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | 134 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; |
134 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | 135 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; |
135 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | 136 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; |
136 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | 137 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; |
137 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
139 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | ||
140 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | ||
138 | t << endl; | 141 | t << endl; |
139 | 142 | ||
140 | t << "####### Files" << endl << endl; | 143 | t << "####### Files" << endl << endl; |
141 | t << "HEADERS =" << varList("HEADERS") << endl; | 144 | t << "HEADERS =" << varList("HEADERS") << endl; |
142 | t << "SOURCES =" << varList("SOURCES") << endl; | 145 | t << "SOURCES =" << varList("SOURCES") << endl; |
143 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 146 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
144 | t << "FORMS =" << varList("FORMS") << endl; | 147 | t << "FORMS =" << varList("FORMS") << endl; |
145 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 148 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
146 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 149 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
147 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 150 | t << "SRCMOC =" << varList("SRCMOC") << endl; |
148 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 151 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
149 | t << "DIST =" << varList("DISTFILES") << endl; | 152 | t << "DIST =" << varList("DISTFILES") << endl; |
150 | t << "TARGET ="; | 153 | t << "TARGET ="; |
151 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | 154 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) |
152 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | 155 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); |
153 | else | 156 | else |
154 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 157 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); |
155 | t << endl; | 158 | t << endl; |
156 | t << endl; | 159 | t << endl; |
157 | 160 | ||
158 | t << "####### Implicit rules" << endl << endl; | 161 | t << "####### Implicit rules" << endl << endl; |
159 | t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; | 162 | t << ".SUFFIXES: .c"; |
160 | t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 163 | QStringList::Iterator cppit; |
161 | t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 164 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
162 | t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 165 | t << " " << (*cppit); |
163 | t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 166 | t << endl << endl; |
167 | if(!project->isActiveConfig("no_batch")) { | ||
168 | // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC | ||
169 | project->variables().remove("QMAKE_RUN_CXX"); | ||
170 | project->variables().remove("QMAKE_RUN_CC"); | ||
171 | |||
172 | QDict<void> source_directories; | ||
173 | source_directories.insert(".", (void*)1); | ||
174 | if(!project->isEmpty("MOC_DIR")) | ||
175 | source_directories.insert(project->first("MOC_DIR"), (void*)1); | ||
176 | if(!project->isEmpty("UI_SOURCES_DIR")) | ||
177 | source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1); | ||
178 | else if(!project->isEmpty("UI_DIR")) | ||
179 | source_directories.insert(project->first("UI_DIR"), (void*)1); | ||
180 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; | ||
181 | for(int x = 0; !srcs[x].isNull(); x++) { | ||
182 | QStringList &l = project->variables()[srcs[x]]; | ||
183 | for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) { | ||
184 | QString sep = "\\"; | ||
185 | if((*sit).find(sep) == -1) | ||
186 | sep = "/"; | ||
187 | QString dir = (*sit).section(sep, 0, -2); | ||
188 | if(!dir.isEmpty() && !source_directories[dir]) | ||
189 | source_directories.insert(dir, (void*)1); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | for(QDictIterator<void> it(source_directories); it.current(); ++it) { | ||
194 | if(it.currentKey().isEmpty()) | ||
195 | continue; | ||
196 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | ||
197 | t << "{" << it.currentKey() << "}" << (*cppit) << "{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t" | ||
198 | << var("QMAKE_RUN_CXX_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl; | ||
199 | t << "{" << it.currentKey() << "}" << ".c{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t" | ||
200 | << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl; | ||
201 | } | ||
202 | } else { | ||
203 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | ||
204 | t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
205 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | ||
206 | } | ||
164 | 207 | ||
165 | t << "####### Build rules" << endl << endl; | 208 | t << "####### Build rules" << endl << endl; |
166 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 209 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; |
167 | t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); | 210 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
211 | << var("POST_TARGETDEPS"); | ||
168 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 212 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
169 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " | 213 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " |
170 | << "$(OBJECTS) $(OBJMOC) $(LIBS)"; | 214 | << "$(OBJECTS) $(OBJMOC) $(LIBS)"; |
171 | } else { | 215 | } else { |
172 | t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " | 216 | t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " |
173 | << "$(OBJECTS) $(OBJMOC)"; | 217 | << "$(OBJECTS) $(OBJMOC)"; |
174 | } | 218 | } |
175 | t << endl << "<<" << endl; | 219 | t << endl << "<<" << endl; |
220 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | ||
221 | t << "\t" << var( "QMAKE_POST_LINK" ) << endl; | ||
176 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 222 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
177 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 223 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
178 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 224 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
179 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 225 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; |
180 | } | 226 | } |
181 | } | 227 | } |
182 | QString targetfilename = project->variables()["TARGET"].first(); | 228 | QString targetfilename = project->variables()["TARGET"].first(); |
183 | if(project->isActiveConfig("activeqt")) { | 229 | if(project->isActiveConfig("activeqt")) { |
184 | QString version = project->variables()["VERSION"].first(); | 230 | QString version = project->variables()["VERSION"].first(); |
185 | if ( version.isEmpty() ) | 231 | if ( version.isEmpty() ) |
186 | version = "1.0"; | 232 | version = "1.0"; |
187 | 233 | ||
188 | if ( project->isActiveConfig("dll")) { | 234 | if ( project->isActiveConfig("dll")) { |
189 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 235 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); |
190 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | 236 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); |
191 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 237 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); |
@@ -207,58 +253,63 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
207 | t << "mocables: $(SRCMOC)" << endl << endl; | 253 | t << "mocables: $(SRCMOC)" << endl << endl; |
208 | 254 | ||
209 | writeMakeQmake(t); | 255 | writeMakeQmake(t); |
210 | 256 | ||
211 | t << "dist:" << "\n\t" | 257 | t << "dist:" << "\n\t" |
212 | << "$(ZIP) " << var("PROJECT") << ".zip " | 258 | << "$(ZIP) " << var("PROJECT") << ".zip " |
213 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 259 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; |
214 | 260 | ||
215 | t << "clean:" | 261 | t << "clean:" |
216 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") | 262 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") |
217 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 263 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") |
218 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 264 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") |
219 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 265 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") |
220 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 266 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") |
221 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 267 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") |
222 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 268 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); |
269 | |||
223 | if ( project->isActiveConfig("activeqt")) { | 270 | if ( project->isActiveConfig("activeqt")) { |
224 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 271 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); |
225 | t << "\n\t-del tmp\\dump.*"; | 272 | t << "\n\t-del tmp\\dump.*"; |
226 | } | 273 | } |
227 | if(!project->isEmpty("IMAGES")) | 274 | if(!project->isEmpty("IMAGES")) |
228 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 275 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); |
229 | 276 | ||
230 | // blasted user defined targets | 277 | // blasted user defined targets |
231 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 278 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
232 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 279 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { |
233 | QString targ = var((*it) + ".target"), | 280 | QString targ = var((*it) + ".target"), |
234 | cmd = var((*it) + ".commands"), deps; | 281 | cmd = var((*it) + ".commands"), deps; |
235 | if(targ.isEmpty()) | 282 | if(targ.isEmpty()) |
236 | targ = (*it); | 283 | targ = (*it); |
237 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 284 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
238 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 285 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
239 | QString dep = var((*dep_it) + ".target"); | 286 | QString dep = var((*dep_it) + ".target"); |
240 | if(dep.isEmpty()) | 287 | if(dep.isEmpty()) |
241 | dep = (*dep_it); | 288 | dep = (*dep_it); |
242 | deps += " " + dep; | 289 | deps += " " + dep; |
243 | } | 290 | } |
244 | t << "\n\n" << targ << ":" << deps << "\n\t" | 291 | t << "\n\n" << targ << ":" << deps << "\n\t" |
245 | << cmd; | 292 | << cmd; |
246 | } | 293 | } |
247 | 294 | ||
248 | t << endl << endl; | 295 | t << endl << endl; |
296 | |||
297 | t << "distclean: clean" | ||
298 | << "\n\t-del $(TARGET)" | ||
299 | << endl << endl; | ||
249 | } | 300 | } |
250 | 301 | ||
251 | 302 | ||
252 | void | 303 | void |
253 | NmakeMakefileGenerator::init() | 304 | NmakeMakefileGenerator::init() |
254 | { | 305 | { |
255 | if(init_flag) | 306 | if(init_flag) |
256 | return; | 307 | return; |
257 | init_flag = TRUE; | 308 | init_flag = TRUE; |
258 | 309 | ||
259 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 310 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
260 | if(project->first("TEMPLATE") == "app") | 311 | if(project->first("TEMPLATE") == "app") |
261 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 312 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
262 | else if(project->first("TEMPLATE") == "lib") | 313 | else if(project->first("TEMPLATE") == "lib") |
263 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 314 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
264 | else if(project->first("TEMPLATE") == "subdirs") { | 315 | else if(project->first("TEMPLATE") == "subdirs") { |
@@ -418,32 +469,54 @@ NmakeMakefileGenerator::init() | |||
418 | if ( project->isActiveConfig("windows") ) { | 469 | if ( project->isActiveConfig("windows") ) { |
419 | if ( project->isActiveConfig("console") ) { | 470 | if ( project->isActiveConfig("console") ) { |
420 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 471 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
421 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 472 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
422 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 473 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
423 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 474 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
424 | } else { | 475 | } else { |
425 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 476 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; |
426 | } | 477 | } |
427 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 478 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
428 | } else { | 479 | } else { |
429 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 480 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
430 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 481 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
431 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 482 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
432 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 483 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
433 | } | 484 | } |
485 | if ( project->isActiveConfig("stl") ) { | ||
486 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | ||
487 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | ||
488 | } else { | ||
489 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | ||
490 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | ||
491 | } | ||
492 | if ( project->isActiveConfig("exceptions") ) { | ||
493 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
494 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
495 | } else { | ||
496 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
497 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
498 | } | ||
499 | if ( project->isActiveConfig("rtti") ) { | ||
500 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
501 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
502 | } else { | ||
503 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
504 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
505 | } | ||
506 | |||
434 | 507 | ||
435 | if ( project->isActiveConfig("moc") ) | 508 | if ( project->isActiveConfig("moc") ) |
436 | setMocAware(TRUE); | 509 | setMocAware(TRUE); |
437 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 510 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
438 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 511 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
439 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 512 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
440 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 513 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
441 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 514 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
442 | QStringList &gdmf = project->variables()[(*it)]; | 515 | QStringList &gdmf = project->variables()[(*it)]; |
443 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 516 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
444 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 517 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
445 | } | 518 | } |
446 | 519 | ||
447 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | 520 | if ( !project->variables()["DEF_FILE"].isEmpty() ) |
448 | project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE")); | 521 | project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE")); |
449 | if(!project->isActiveConfig("incremental")) | 522 | if(!project->isActiveConfig("incremental")) |
@@ -452,37 +525,38 @@ NmakeMakefileGenerator::init() | |||
452 | if ( !project->variables()["VERSION"].isEmpty() ) { | 525 | if ( !project->variables()["VERSION"].isEmpty() ) { |
453 | QString version = project->variables()["VERSION"][0]; | 526 | QString version = project->variables()["VERSION"][0]; |
454 | int firstDot = version.find( "." ); | 527 | int firstDot = version.find( "." ); |
455 | QString major = version.left( firstDot ); | 528 | QString major = version.left( firstDot ); |
456 | QString minor = version.right( version.length() - firstDot - 1 ); | 529 | QString minor = version.right( version.length() - firstDot - 1 ); |
457 | minor.replace( ".", "" ); | 530 | minor.replace( ".", "" ); |
458 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | 531 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); |
459 | } | 532 | } |
460 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 533 | if ( !project->variables()["RC_FILE"].isEmpty()) { |
461 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 534 | if ( !project->variables()["RES_FILE"].isEmpty()) { |
462 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 535 | fprintf(stderr, "Both .rc and .res file specified.\n"); |
463 | fprintf(stderr, "Please specify one of them, not both."); | 536 | fprintf(stderr, "Please specify one of them, not both."); |
464 | exit(666); | 537 | exit(666); |
465 | } | 538 | } |
466 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 539 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; |
467 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | 540 | project->variables()["RES_FILE"].first().replace(".rc",".res"); |
468 | project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; | 541 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
469 | } | 542 | } |
470 | if ( !project->variables()["RES_FILE"].isEmpty()) | 543 | if ( !project->variables()["RES_FILE"].isEmpty()) |
471 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | 544 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; |
472 | 545 | ||
473 | MakefileGenerator::init(); | 546 | MakefileGenerator::init(); |
474 | if ( !project->variables()["VERSION"].isEmpty()) { | 547 | if ( !project->variables()["VERSION"].isEmpty()) { |
475 | QStringList l = QStringList::split('.', project->first("VERSION")); | 548 | QStringList l = QStringList::split('.', project->first("VERSION")); |
476 | project->variables()["VER_MAJ"].append(l[0]); | 549 | project->variables()["VER_MAJ"].append(l[0]); |
477 | project->variables()["VER_MIN"].append(l[1]); | 550 | project->variables()["VER_MIN"].append(l[1]); |
478 | } | 551 | } |
552 | |||
553 | QString version = QStringList::split('.', project->first("VERSION")).join(""); | ||
479 | if(project->isActiveConfig("dll")) { | 554 | if(project->isActiveConfig("dll")) { |
480 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib"); | 555 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp"); |
481 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp"); | ||
482 | } | 556 | } |
483 | if(project->isActiveConfig("debug")) { | 557 | if(project->isActiveConfig("debug")) { |
484 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb"); | 558 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"); |
485 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk"); | 559 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); |
486 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); | 560 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); |
487 | } | 561 | } |
488 | } | 562 | } |
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index d3e170f..579fc35 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h | |||
@@ -1,59 +1,59 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __NMAKEMAKE_H__ | 37 | #ifndef __MSVC_NMAKE_H__ |
38 | #define __NMAKEMAKE_H__ | 38 | #define __MSVC_NMAKE_H__ |
39 | 39 | ||
40 | #include "winmakefile.h" | 40 | #include "winmakefile.h" |
41 | 41 | ||
42 | class NmakeMakefileGenerator : public Win32MakefileGenerator | 42 | class NmakeMakefileGenerator : public Win32MakefileGenerator |
43 | { | 43 | { |
44 | bool init_flag; | 44 | bool init_flag; |
45 | void writeNmakeParts(QTextStream &); | 45 | void writeNmakeParts(QTextStream &); |
46 | 46 | ||
47 | bool writeMakefile(QTextStream &); | 47 | bool writeMakefile(QTextStream &); |
48 | void init(); | 48 | void init(); |
49 | 49 | ||
50 | public: | 50 | public: |
51 | NmakeMakefileGenerator(QMakeProject *p); | 51 | NmakeMakefileGenerator(QMakeProject *p); |
52 | ~NmakeMakefileGenerator(); | 52 | ~NmakeMakefileGenerator(); |
53 | 53 | ||
54 | }; | 54 | }; |
55 | 55 | ||
56 | inline NmakeMakefileGenerator::~NmakeMakefileGenerator() | 56 | inline NmakeMakefileGenerator::~NmakeMakefileGenerator() |
57 | { } | 57 | { } |
58 | 58 | ||
59 | #endif /* __NMAKEMAKE_H__ */ | 59 | #endif /* __MSVC_NMAKE_H__ */ |
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index c2b9e30..7ffe4f7 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp | |||
@@ -241,53 +241,53 @@ const char* _UsePrecompiledHeader = "\n\t\t\t\tUsePrecompiledHeader=\""; | |||
241 | const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\""; | 241 | const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\""; |
242 | const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\""; | 242 | const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\""; |
243 | const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\""; | 243 | const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\""; |
244 | const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\""; | 244 | const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\""; |
245 | const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\""; | 245 | const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\""; |
246 | const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\""; | 246 | const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\""; |
247 | const char* _Version1 = "\n\tVersion=\""; | 247 | const char* _Version1 = "\n\tVersion=\""; |
248 | const char* _Version4 = "\n\t\t\t\tVersion=\""; | 248 | const char* _Version4 = "\n\t\t\t\tVersion=\""; |
249 | const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\""; | 249 | const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\""; |
250 | const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\""; | 250 | const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\""; |
251 | const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\""; | 251 | const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\""; |
252 | const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\""; | 252 | const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\""; |
253 | 253 | ||
254 | // Property name and value as Pairs --------------------------------- | 254 | // Property name and value as Pairs --------------------------------- |
255 | struct TPair { | 255 | struct TPair { |
256 | TPair( const char* n, const triState v ) : name(n), value(v) {}; | 256 | TPair( const char* n, const triState v ) : name(n), value(v) {}; |
257 | const char* name; | 257 | const char* name; |
258 | const triState value; | 258 | const triState value; |
259 | }; | 259 | }; |
260 | struct EPair { | 260 | struct EPair { |
261 | EPair( const char* n, const int v ) : name(n), value(v) {}; | 261 | EPair( const char* n, const int v ) : name(n), value(v) {}; |
262 | const char* name; | 262 | const char* name; |
263 | const int value; | 263 | const int value; |
264 | }; | 264 | }; |
265 | struct LPair { | 265 | struct LPair { |
266 | LPair( const char* n, const long v ) : name(n), value(v) {}; | 266 | LPair( const char* n, const long v ) : name(n), value(v) {}; |
267 | const char* name; | 267 | const char* name; |
268 | const long value; | 268 | const long value; |
269 | }; | 269 | }; |
270 | struct SPair { | 270 | struct SPair { |
271 | SPair( const char* n, const QString& v ) : name(n), value(v) {}; | 271 | SPair( const char* n, const QString& v ) : name(n), value(v) {}; |
272 | const char* name; | 272 | const char* name; |
273 | const QString& value; | 273 | const QString& value; |
274 | }; | 274 | }; |
275 | struct XPair { | 275 | struct XPair { |
276 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; | 276 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; |
277 | const char* name; | 277 | const char* name; |
278 | const QStringList& value; | 278 | const QStringList& value; |
279 | const char* sep; | 279 | const char* sep; |
280 | }; | 280 | }; |
281 | 281 | ||
282 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) | 282 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) |
283 | 283 | ||
284 | 284 | ||
285 | // Streaming operators for property Pairs --------------------------- | 285 | // Streaming operators for property Pairs --------------------------- |
286 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) | 286 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) |
287 | { | 287 | { |
288 | switch( prop.value ) { | 288 | switch( prop.value ) { |
289 | case _False: | 289 | case _False: |
290 | strm << prop.name << "FALSE\""; | 290 | strm << prop.name << "FALSE\""; |
291 | break; | 291 | break; |
292 | case _True: | 292 | case _True: |
293 | strm << prop.name << "TRUE\""; | 293 | strm << prop.name << "TRUE\""; |
@@ -370,33 +370,33 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
370 | SuppressStartupBanner( unset ), | 370 | SuppressStartupBanner( unset ), |
371 | TreatWChar_tAsBuiltInType( unset ), | 371 | TreatWChar_tAsBuiltInType( unset ), |
372 | TurnOffAssemblyGeneration( unset ), | 372 | TurnOffAssemblyGeneration( unset ), |
373 | UndefineAllPreprocessorDefinitions( unset ), | 373 | UndefineAllPreprocessorDefinitions( unset ), |
374 | UsePrecompiledHeader( pchGenerateAuto ), | 374 | UsePrecompiledHeader( pchGenerateAuto ), |
375 | WarnAsError( unset ), | 375 | WarnAsError( unset ), |
376 | WarningLevel( warningLevel_0 ), | 376 | WarningLevel( warningLevel_0 ), |
377 | WholeProgramOptimization( unset ) | 377 | WholeProgramOptimization( unset ) |
378 | { | 378 | { |
379 | } | 379 | } |
380 | 380 | ||
381 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | 381 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) |
382 | { | 382 | { |
383 | strm << _begTool3; | 383 | strm << _begTool3; |
384 | strm << _VCCLCompilerToolName; | 384 | strm << _VCCLCompilerToolName; |
385 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 385 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
386 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); | 386 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
387 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); | 387 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); |
388 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); | 388 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); |
389 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); | 389 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); |
390 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); | 390 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); |
391 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); | 391 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); |
392 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); | 392 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); |
393 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); | 393 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); |
394 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); | 394 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); |
395 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); | 395 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); |
396 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); | 396 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); |
397 | strm << TPair( _CompileOnly, tool.CompileOnly ); | 397 | strm << TPair( _CompileOnly, tool.CompileOnly ); |
398 | strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); | 398 | strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); |
399 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); | 399 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); |
400 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); | 400 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); |
401 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); | 401 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); |
402 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); | 402 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); |
@@ -429,78 +429,82 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
429 | strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); | 429 | strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); |
430 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); | 430 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); |
431 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); | 431 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); |
432 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); | 432 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); |
433 | strm << TPair( _StringPooling, tool.StringPooling ); | 433 | strm << TPair( _StringPooling, tool.StringPooling ); |
434 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); | 434 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); |
435 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 435 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
436 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); | 436 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); |
437 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); | 437 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); |
438 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); | 438 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); |
439 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); | 439 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); |
440 | if ( !tool.PrecompiledHeaderFile.isEmpty() || | 440 | if ( !tool.PrecompiledHeaderFile.isEmpty() || |
441 | !tool.PrecompiledHeaderThrough.isEmpty() ) | 441 | !tool.PrecompiledHeaderThrough.isEmpty() ) |
442 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); | 442 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); |
443 | strm << TPair( _WarnAsError, tool.WarnAsError ); | 443 | strm << TPair( _WarnAsError, tool.WarnAsError ); |
444 | strm << EPair( _WarningLevel, tool.WarningLevel ); | 444 | strm << EPair( _WarningLevel, tool.WarningLevel ); |
445 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); | 445 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); |
446 | strm << "/>"; | 446 | strm << "/>"; |
447 | return strm; | 447 | return strm; |
448 | } | 448 | } |
449 | 449 | ||
450 | bool VCCLCompilerTool::parseOption( const char* option ) | 450 | bool VCCLCompilerTool::parseOption( const char* option ) |
451 | { | 451 | { |
452 | // skip index 0 ('/' or '-') | 452 | // skip index 0 ('/' or '-') |
453 | char first = option[1]; | 453 | char first = option[1]; |
454 | char second = option[2]; | 454 | char second = option[2]; |
455 | char third = option[3]; | 455 | char third = option[3]; |
456 | char fourth = option[4]; | 456 | char fourth = option[4]; |
457 | bool found = TRUE; | ||
457 | 458 | ||
458 | switch ( first ) { | 459 | switch ( first ) { |
459 | case '?': | 460 | case '?': |
460 | case 'h': | 461 | case 'h': |
461 | qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); | 462 | qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); |
462 | return FALSE; | 463 | found = FALSE; |
464 | break; | ||
463 | case '@': | 465 | case '@': |
464 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); | 466 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); |
465 | return FALSE; | 467 | found = FALSE; |
468 | break; | ||
466 | case 'l': | 469 | case 'l': |
467 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); | 470 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); |
468 | return FALSE; | 471 | found = FALSE; |
469 | 472 | break; | |
470 | case 'A': | 473 | case 'A': |
471 | if ( second != 'I' ) | 474 | if ( second != 'I' ) { |
472 | return FALSE; | 475 | found = FALSE; break; |
476 | } | ||
473 | AdditionalUsingDirectories += option+2; | 477 | AdditionalUsingDirectories += option+2; |
474 | break; | 478 | break; |
475 | case 'C': | 479 | case 'C': |
476 | KeepComments = _True; | 480 | KeepComments = _True; |
477 | break; | 481 | break; |
478 | case 'D': | 482 | case 'D': |
479 | PreprocessorDefinitions += option+1; | 483 | PreprocessorDefinitions += option+1; |
480 | break; | 484 | break; |
481 | case 'E': | 485 | case 'E': |
482 | if ( second == 'H' ) { | 486 | if ( second == 'H' ) { |
483 | if ( third == 'a' || third == 'c' || third == 's' ) { | 487 | if ( third == 'a' || third == 'c' || third == 's' ) { |
484 | // ExceptionHandling must be false, or it will override | 488 | // ExceptionHandling must be false, or it will override |
485 | // with an /EHsc option | 489 | // with an /EHsc option |
486 | ExceptionHandling = _False; | 490 | ExceptionHandling = _False; |
487 | AdditionalOptions += option; | 491 | AdditionalOptions += option; |
488 | break; | 492 | break; |
489 | } | 493 | } |
490 | return FALSE; | 494 | found = FALSE; break; |
491 | } | 495 | } |
492 | GeneratePreprocessedFile = preprocessYes; | 496 | GeneratePreprocessedFile = preprocessYes; |
493 | break; | 497 | break; |
494 | case 'F': | 498 | case 'F': |
495 | if ( second <= '9' && second >= '0' ) { | 499 | if ( second <= '9' && second >= '0' ) { |
496 | AdditionalOptions += option; | 500 | AdditionalOptions += option; |
497 | break; | 501 | break; |
498 | } else { | 502 | } else { |
499 | switch ( second ) { | 503 | switch ( second ) { |
500 | case 'A': | 504 | case 'A': |
501 | if ( third == 'c' ) { | 505 | if ( third == 'c' ) { |
502 | AssemblerOutput = asmListingAsmMachine; | 506 | AssemblerOutput = asmListingAsmMachine; |
503 | if ( fourth == 's' ) | 507 | if ( fourth == 's' ) |
504 | AssemblerOutput = asmListingAsmMachineSrc; | 508 | AssemblerOutput = asmListingAsmMachineSrc; |
505 | } else if ( third == 's' ) { | 509 | } else if ( third == 's' ) { |
506 | AssemblerOutput = asmListingAsmSrc; | 510 | AssemblerOutput = asmListingAsmSrc; |
@@ -531,42 +535,42 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
531 | case 'e': | 535 | case 'e': |
532 | OutputFile = option+3; | 536 | OutputFile = option+3; |
533 | break; | 537 | break; |
534 | case 'm': | 538 | case 'm': |
535 | AdditionalOptions += option; | 539 | AdditionalOptions += option; |
536 | break; | 540 | break; |
537 | case 'o': | 541 | case 'o': |
538 | ObjectFile = option+3; | 542 | ObjectFile = option+3; |
539 | break; | 543 | break; |
540 | case 'p': | 544 | case 'p': |
541 | PrecompiledHeaderFile = option+3; | 545 | PrecompiledHeaderFile = option+3; |
542 | break; | 546 | break; |
543 | case 'x': | 547 | case 'x': |
544 | ExpandAttributedSource = _True; | 548 | ExpandAttributedSource = _True; |
545 | break; | 549 | break; |
546 | default: | 550 | default: |
547 | return FALSE; | 551 | found = FALSE; break; |
548 | } | 552 | } |
549 | } | 553 | } |
550 | break; | 554 | break; |
551 | case 'G': | 555 | case 'G': |
552 | switch ( second ) { | 556 | switch ( second ) { |
553 | case '3': | 557 | case '3': |
554 | case '4': | 558 | case '4': |
555 | qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); | 559 | qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); |
556 | return FALSE; | 560 | found = FALSE; break; |
557 | case '5': | 561 | case '5': |
558 | OptimizeForProcessor = procOptimizePentium; | 562 | OptimizeForProcessor = procOptimizePentium; |
559 | break; | 563 | break; |
560 | case '6': | 564 | case '6': |
561 | case 'B': | 565 | case 'B': |
562 | OptimizeForProcessor = procOptimizePentiumProAndAbove; | 566 | OptimizeForProcessor = procOptimizePentiumProAndAbove; |
563 | break; | 567 | break; |
564 | case 'A': | 568 | case 'A': |
565 | OptimizeForWindowsApplication = _True; | 569 | OptimizeForWindowsApplication = _True; |
566 | break; | 570 | break; |
567 | case 'F': | 571 | case 'F': |
568 | StringPooling = _True; | 572 | StringPooling = _True; |
569 | break; | 573 | break; |
570 | case 'H': | 574 | case 'H': |
571 | AdditionalOptions += option; | 575 | AdditionalOptions += option; |
572 | break; | 576 | break; |
@@ -606,85 +610,85 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
606 | break; | 610 | break; |
607 | case 'r': | 611 | case 'r': |
608 | CallingConvention = callConventionFastCall; | 612 | CallingConvention = callConventionFastCall; |
609 | break; | 613 | break; |
610 | case 's': | 614 | case 's': |
611 | // Warning: following [num] is not used, | 615 | // Warning: following [num] is not used, |
612 | // were should we put it? | 616 | // were should we put it? |
613 | BufferSecurityCheck = _True; | 617 | BufferSecurityCheck = _True; |
614 | break; | 618 | break; |
615 | case 'y': | 619 | case 'y': |
616 | EnableFunctionLevelLinking = _True; | 620 | EnableFunctionLevelLinking = _True; |
617 | break; | 621 | break; |
618 | case 'z': | 622 | case 'z': |
619 | CallingConvention = callConventionStdCall; | 623 | CallingConvention = callConventionStdCall; |
620 | break; | 624 | break; |
621 | default: | 625 | default: |
622 | return FALSE; | 626 | found = FALSE; break; |
623 | } | 627 | } |
624 | break; | 628 | break; |
625 | case 'H': | 629 | case 'H': |
626 | AdditionalOptions += option; | 630 | AdditionalOptions += option; |
627 | break; | 631 | break; |
628 | case 'I': | 632 | case 'I': |
629 | AdditionalIncludeDirectories += option+2; | 633 | AdditionalIncludeDirectories += option+2; |
630 | break; | 634 | break; |
631 | case 'L': | 635 | case 'L': |
632 | if ( second == 'D' ) { | 636 | if ( second == 'D' ) { |
633 | AdditionalOptions += option; | 637 | AdditionalOptions += option; |
634 | break; | 638 | break; |
635 | } | 639 | } |
636 | return FALSE; | 640 | found = FALSE; break; |
637 | case 'M': | 641 | case 'M': |
638 | if ( second == 'D' ) { | 642 | if ( second == 'D' ) { |
639 | RuntimeLibrary = rtMultiThreadedDLL; | 643 | RuntimeLibrary = rtMultiThreadedDLL; |
640 | if ( third == 'd' ) | 644 | if ( third == 'd' ) |
641 | RuntimeLibrary = rtMultiThreadedDebugDLL; | 645 | RuntimeLibrary = rtMultiThreadedDebugDLL; |
642 | break; | 646 | break; |
643 | } else if ( second == 'L' ) { | 647 | } else if ( second == 'L' ) { |
644 | RuntimeLibrary = rtSingleThreaded; | 648 | RuntimeLibrary = rtSingleThreaded; |
645 | if ( third == 'd' ) | 649 | if ( third == 'd' ) |
646 | RuntimeLibrary = rtSingleThreadedDebug; | 650 | RuntimeLibrary = rtSingleThreadedDebug; |
647 | break; | 651 | break; |
648 | } else if ( second == 'T' ) { | 652 | } else if ( second == 'T' ) { |
649 | RuntimeLibrary = rtMultiThreaded; | 653 | RuntimeLibrary = rtMultiThreaded; |
650 | if ( third == 'd' ) | 654 | if ( third == 'd' ) |
651 | RuntimeLibrary = rtMultiThreadedDebug; | 655 | RuntimeLibrary = rtMultiThreadedDebug; |
652 | break; | 656 | break; |
653 | } | 657 | } |
654 | return FALSE; | 658 | found = FALSE; break; |
655 | case 'O': | 659 | case 'O': |
656 | switch ( second ) { | 660 | switch ( second ) { |
657 | case '1': | 661 | case '1': |
658 | Optimization = optimizeMinSpace; | 662 | Optimization = optimizeMinSpace; |
659 | break; | 663 | break; |
660 | case '2': | 664 | case '2': |
661 | Optimization = optimizeMaxSpeed; | 665 | Optimization = optimizeMaxSpeed; |
662 | break; | 666 | break; |
663 | case 'a': | 667 | case 'a': |
664 | AdditionalOptions += option; | 668 | AdditionalOptions += option; |
665 | break; | 669 | break; |
666 | case 'b': | 670 | case 'b': |
667 | if ( third == '0' ) | 671 | if ( third == '0' ) |
668 | InlineFunctionExpansion = expandDisable; | 672 | InlineFunctionExpansion = expandDisable; |
669 | else if ( third == '1' ) | 673 | else if ( third == '1' ) |
670 | InlineFunctionExpansion = expandOnlyInline; | 674 | InlineFunctionExpansion = expandOnlyInline; |
671 | else if ( third == '2' ) | 675 | else if ( third == '2' ) |
672 | InlineFunctionExpansion = expandAnySuitable; | 676 | InlineFunctionExpansion = expandAnySuitable; |
673 | else | 677 | else |
674 | return FALSE; | 678 | found = FALSE; |
675 | break; | 679 | break; |
676 | case 'd': | 680 | case 'd': |
677 | Optimization = optimizeDisabled; | 681 | Optimization = optimizeDisabled; |
678 | break; | 682 | break; |
679 | case 'g': | 683 | case 'g': |
680 | GlobalOptimizations = _True; | 684 | GlobalOptimizations = _True; |
681 | break; | 685 | break; |
682 | case 'i': | 686 | case 'i': |
683 | EnableIntrinsicFunctions = _True; | 687 | EnableIntrinsicFunctions = _True; |
684 | break; | 688 | break; |
685 | case 'p': | 689 | case 'p': |
686 | ImproveFloatingPointConsistency = _True; | 690 | ImproveFloatingPointConsistency = _True; |
687 | if ( third == '-' ) | 691 | if ( third == '-' ) |
688 | ImproveFloatingPointConsistency = _False; | 692 | ImproveFloatingPointConsistency = _False; |
689 | break; | 693 | break; |
690 | case 's': | 694 | case 's': |
@@ -692,66 +696,66 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
692 | break; | 696 | break; |
693 | case 't': | 697 | case 't': |
694 | FavorSizeOrSpeed = favorSpeed; | 698 | FavorSizeOrSpeed = favorSpeed; |
695 | break; | 699 | break; |
696 | case 'w': | 700 | case 'w': |
697 | AdditionalOptions += option; | 701 | AdditionalOptions += option; |
698 | break; | 702 | break; |
699 | case 'x': | 703 | case 'x': |
700 | Optimization = optimizeFull; | 704 | Optimization = optimizeFull; |
701 | break; | 705 | break; |
702 | case 'y': | 706 | case 'y': |
703 | OmitFramePointers = _True; | 707 | OmitFramePointers = _True; |
704 | if ( third == '-' ) | 708 | if ( third == '-' ) |
705 | OmitFramePointers = _False; | 709 | OmitFramePointers = _False; |
706 | break; | 710 | break; |
707 | default: | 711 | default: |
708 | return FALSE; | 712 | found = FALSE; break; |
709 | } | 713 | } |
710 | break; | 714 | break; |
711 | case 'P': | 715 | case 'P': |
712 | GeneratePreprocessedFile = preprocessYes; | 716 | GeneratePreprocessedFile = preprocessYes; |
713 | break; | 717 | break; |
714 | case 'Q': | 718 | case 'Q': |
715 | if ( second == 'I' ) { | 719 | if ( second == 'I' ) { |
716 | AdditionalOptions += option; | 720 | AdditionalOptions += option; |
717 | break; | 721 | break; |
718 | } | 722 | } |
719 | return FALSE; | 723 | found = FALSE; break; |
720 | case 'R': | 724 | case 'R': |
721 | if ( second == 'T' && third == 'C' ) { | 725 | if ( second == 'T' && third == 'C' ) { |
722 | if ( fourth == '1' ) | 726 | if ( fourth == '1' ) |
723 | BasicRuntimeChecks = runtimeBasicCheckAll; | 727 | BasicRuntimeChecks = runtimeBasicCheckAll; |
724 | else if ( fourth == 'c' ) | 728 | else if ( fourth == 'c' ) |
725 | SmallerTypeCheck = _True; | 729 | SmallerTypeCheck = _True; |
726 | else if ( fourth == 's' ) | 730 | else if ( fourth == 's' ) |
727 | BasicRuntimeChecks = runtimeCheckStackFrame; | 731 | BasicRuntimeChecks = runtimeCheckStackFrame; |
728 | else if ( fourth == 'u' ) | 732 | else if ( fourth == 'u' ) |
729 | BasicRuntimeChecks = runtimeCheckUninitVariables; | 733 | BasicRuntimeChecks = runtimeCheckUninitVariables; |
730 | else | 734 | else |
731 | return FALSE; | 735 | found = FALSE; break; |
732 | } | 736 | } |
733 | break; | 737 | break; |
734 | case 'T': | 738 | case 'T': |
735 | if ( second == 'C' ) { | 739 | if ( second == 'C' ) { |
736 | CompileAs = compileAsC; | 740 | CompileAs = compileAsC; |
737 | } else if ( second == 'P' ) { | 741 | } else if ( second == 'P' ) { |
738 | CompileAs = compileAsCPlusPlus; | 742 | CompileAs = compileAsCPlusPlus; |
739 | } else { | 743 | } else { |
740 | qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" ); | 744 | qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" ); |
741 | return FALSE; | 745 | found = FALSE; break; |
742 | } | 746 | } |
743 | break; | 747 | break; |
744 | case 'U': | 748 | case 'U': |
745 | UndefinePreprocessorDefinitions += option+2; | 749 | UndefinePreprocessorDefinitions += option+2; |
746 | break; | 750 | break; |
747 | case 'V': | 751 | case 'V': |
748 | AdditionalOptions += option; | 752 | AdditionalOptions += option; |
749 | break; | 753 | break; |
750 | case 'W': | 754 | case 'W': |
751 | switch ( second ) { | 755 | switch ( second ) { |
752 | case 'a': | 756 | case 'a': |
753 | case '4': | 757 | case '4': |
754 | WarningLevel = warningLevel_4; | 758 | WarningLevel = warningLevel_4; |
755 | break; | 759 | break; |
756 | case '3': | 760 | case '3': |
757 | WarningLevel = warningLevel_3; | 761 | WarningLevel = warningLevel_3; |
@@ -765,189 +769,192 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
765 | case '0': | 769 | case '0': |
766 | WarningLevel = warningLevel_0; | 770 | WarningLevel = warningLevel_0; |
767 | break; | 771 | break; |
768 | case 'L': | 772 | case 'L': |
769 | AdditionalOptions += option; | 773 | AdditionalOptions += option; |
770 | break; | 774 | break; |
771 | case 'X': | 775 | case 'X': |
772 | WarnAsError = _True; | 776 | WarnAsError = _True; |
773 | break; | 777 | break; |
774 | case 'p': | 778 | case 'p': |
775 | if ( third == '6' && fourth == '4' ) { | 779 | if ( third == '6' && fourth == '4' ) { |
776 | Detect64BitPortabilityProblems = _True; | 780 | Detect64BitPortabilityProblems = _True; |
777 | break; | 781 | break; |
778 | } | 782 | } |
779 | // Fallthrough | 783 | // Fallthrough |
780 | default: | 784 | default: |
781 | return FALSE; | 785 | found = FALSE; break; |
782 | } | 786 | } |
783 | break; | 787 | break; |
784 | case 'X': | 788 | case 'X': |
785 | IgnoreStandardIncludePath = _True; | 789 | IgnoreStandardIncludePath = _True; |
786 | break; | 790 | break; |
787 | case 'Y': | 791 | case 'Y': |
788 | switch ( second ) { | 792 | switch ( second ) { |
789 | case '\0': | 793 | case '\0': |
790 | case '-': | 794 | case '-': |
791 | AdditionalOptions += option; | 795 | AdditionalOptions += option; |
792 | break; | 796 | break; |
793 | case 'X': | 797 | case 'X': |
794 | UsePrecompiledHeader = pchGenerateAuto; | 798 | UsePrecompiledHeader = pchGenerateAuto; |
795 | PrecompiledHeaderFile = option+3; | 799 | PrecompiledHeaderFile = option+3; |
796 | break; | 800 | break; |
797 | case 'c': | 801 | case 'c': |
798 | UsePrecompiledHeader = pchCreateUsingSpecific; | 802 | UsePrecompiledHeader = pchCreateUsingSpecific; |
799 | PrecompiledHeaderFile = option+3; | 803 | PrecompiledHeaderFile = option+3; |
800 | break; | 804 | break; |
801 | case 'd': | 805 | case 'd': |
802 | case 'l': | 806 | case 'l': |
803 | AdditionalOptions =+ option; | 807 | AdditionalOptions =+ option; |
804 | break; | 808 | break; |
805 | case 'u': | 809 | case 'u': |
806 | UsePrecompiledHeader = pchUseUsingSpecific; | 810 | UsePrecompiledHeader = pchUseUsingSpecific; |
807 | PrecompiledHeaderFile = option+3; | 811 | PrecompiledHeaderFile = option+3; |
808 | break; | 812 | break; |
809 | default: | 813 | default: |
810 | return FALSE; | 814 | found = FALSE; break; |
811 | } | 815 | } |
812 | break; | 816 | break; |
813 | case 'Z': | 817 | case 'Z': |
814 | switch ( second ) { | 818 | switch ( second ) { |
815 | case '7': | 819 | case '7': |
816 | DebugInformationFormat = debugOldStyleInfo; | 820 | DebugInformationFormat = debugOldStyleInfo; |
817 | break; | 821 | break; |
818 | case 'I': | 822 | case 'I': |
819 | DebugInformationFormat = debugEditAndContinue; | 823 | DebugInformationFormat = debugEditAndContinue; |
820 | break; | 824 | break; |
821 | case 'd': | 825 | case 'd': |
822 | DebugInformationFormat = debugLineInfoOnly; | 826 | DebugInformationFormat = debugLineInfoOnly; |
823 | break; | 827 | break; |
824 | case 'i': | 828 | case 'i': |
825 | DebugInformationFormat = debugEnabled; | 829 | DebugInformationFormat = debugEnabled; |
826 | break; | 830 | break; |
827 | case 'l': | 831 | case 'l': |
828 | DebugInformationFormat = debugEditAndContinue; | 832 | DebugInformationFormat = debugEditAndContinue; |
829 | break; | 833 | break; |
830 | case 'a': | 834 | case 'a': |
831 | DisableLanguageExtensions = _True; | 835 | DisableLanguageExtensions = _True; |
832 | break; | 836 | break; |
833 | case 'e': | 837 | case 'e': |
834 | DisableLanguageExtensions = _False; | 838 | DisableLanguageExtensions = _False; |
835 | break; | 839 | break; |
836 | case 'c': | 840 | case 'c': |
837 | if ( third == ':' ) { | 841 | if ( third == ':' ) { |
838 | if ( fourth == 'f' ) | 842 | if ( fourth == 'f' ) |
839 | ForceConformanceInForLoopScope = _True; | 843 | ForceConformanceInForLoopScope = _True; |
840 | else if ( fourth == 'w' ) | 844 | else if ( fourth == 'w' ) |
841 | TreatWChar_tAsBuiltInType = _True; | 845 | TreatWChar_tAsBuiltInType = _True; |
842 | else | 846 | else |
843 | return FALSE; | 847 | found = FALSE; |
844 | } else { | 848 | } else { |
845 | return FALSE; | 849 | found = FALSE; break; |
846 | } | 850 | } |
847 | break; | 851 | break; |
848 | case 'g': | 852 | case 'g': |
849 | case 'm': | 853 | case 'm': |
850 | case 's': | 854 | case 's': |
851 | AdditionalOptions += option; | 855 | AdditionalOptions += option; |
852 | break; | 856 | break; |
853 | case 'p': | 857 | case 'p': |
854 | switch ( third ) | 858 | switch ( third ) |
855 | { | 859 | { |
856 | case '\0': | 860 | case '\0': |
857 | case '1': | 861 | case '1': |
858 | StructMemberAlignment = alignSingleByte; | 862 | StructMemberAlignment = alignSingleByte; |
859 | if ( fourth == '6' ) | 863 | if ( fourth == '6' ) |
860 | StructMemberAlignment = alignSixteenBytes; | 864 | StructMemberAlignment = alignSixteenBytes; |
861 | break; | 865 | break; |
862 | case '2': | 866 | case '2': |
863 | StructMemberAlignment = alignTwoBytes; | 867 | StructMemberAlignment = alignTwoBytes; |
864 | break; | 868 | break; |
865 | case '4': | 869 | case '4': |
866 | StructMemberAlignment = alignFourBytes; | 870 | StructMemberAlignment = alignFourBytes; |
867 | break; | 871 | break; |
868 | case '8': | 872 | case '8': |
869 | StructMemberAlignment = alignEightBytes; | 873 | StructMemberAlignment = alignEightBytes; |
870 | break; | 874 | break; |
871 | default: | 875 | default: |
872 | return FALSE; | 876 | found = FALSE; break; |
873 | } | 877 | } |
874 | break; | 878 | break; |
875 | default: | 879 | default: |
876 | return FALSE; | 880 | found = FALSE; break; |
877 | } | 881 | } |
878 | break; | 882 | break; |
879 | case 'c': | 883 | case 'c': |
880 | if ( second == '\0' ) { | 884 | if ( second == '\0' ) { |
881 | CompileOnly = _True; | 885 | CompileOnly = _True; |
882 | } else if ( second == 'l' ) { | 886 | } else if ( second == 'l' ) { |
883 | if ( *(option+5) == 'n' ) { | 887 | if ( *(option+5) == 'n' ) { |
884 | CompileAsManaged = managedAssembly; | 888 | CompileAsManaged = managedAssembly; |
885 | TurnOffAssemblyGeneration = _True; | 889 | TurnOffAssemblyGeneration = _True; |
886 | } else { | 890 | } else { |
887 | CompileAsManaged = managedAssembly; | 891 | CompileAsManaged = managedAssembly; |
888 | } | 892 | } |
889 | } else { | 893 | } else { |
890 | return FALSE; | 894 | found = FALSE; break; |
891 | } | 895 | } |
892 | break; | 896 | break; |
893 | case 'd': | 897 | case 'd': |
894 | if ( second != 'r' ) | 898 | if ( second != 'r' ) { |
895 | return FALSE; | 899 | found = FALSE; break; |
900 | } | ||
896 | CompileAsManaged = managedAssembly; | 901 | CompileAsManaged = managedAssembly; |
897 | break; | 902 | break; |
898 | case 'n': | 903 | case 'n': |
899 | if ( second == 'o' && third == 'B' && fourth == 'o' ) { | 904 | if ( second == 'o' && third == 'B' && fourth == 'o' ) { |
900 | AdditionalOptions += "/noBool"; | 905 | AdditionalOptions += "/noBool"; |
901 | break; | 906 | break; |
902 | } | 907 | } |
903 | if ( second == 'o' && third == 'l' && fourth == 'o' ) { | 908 | if ( second == 'o' && third == 'l' && fourth == 'o' ) { |
904 | SuppressStartupBanner = _True; | 909 | SuppressStartupBanner = _True; |
905 | break; | 910 | break; |
906 | } | 911 | } |
907 | return FALSE; | 912 | found = FALSE; break; |
908 | case 's': | 913 | case 's': |
909 | if ( second == 'h' && third == 'o' && fourth == 'w' ) { | 914 | if ( second == 'h' && third == 'o' && fourth == 'w' ) { |
910 | ShowIncludes = _True; | 915 | ShowIncludes = _True; |
911 | break; | 916 | break; |
912 | } | 917 | } |
913 | return FALSE; | 918 | found = FALSE; break; |
914 | case 'u': | 919 | case 'u': |
915 | UndefineAllPreprocessorDefinitions = _True; | 920 | UndefineAllPreprocessorDefinitions = _True; |
916 | break; | 921 | break; |
917 | case 'v': | 922 | case 'v': |
918 | if ( second == 'd' || second == 'm' ) { | 923 | if ( second == 'd' || second == 'm' ) { |
919 | AdditionalOptions += option; | 924 | AdditionalOptions += option; |
920 | break; | 925 | break; |
921 | } | 926 | } |
922 | return FALSE; | 927 | found = FALSE; break; |
923 | case 'w': | 928 | case 'w': |
924 | switch ( second ) { | 929 | switch ( second ) { |
925 | case '\0': | 930 | case '\0': |
926 | WarningLevel = warningLevel_0; | 931 | WarningLevel = warningLevel_0; |
927 | break; | 932 | break; |
928 | case 'd': | 933 | case 'd': |
929 | DisableSpecificWarnings += option+3; | 934 | DisableSpecificWarnings += option+3; |
930 | break; | 935 | break; |
931 | default: | 936 | default: |
932 | AdditionalOptions += option; | 937 | AdditionalOptions += option; |
933 | } | 938 | } |
934 | break; | 939 | break; |
935 | default: | 940 | default: |
936 | return FALSE; | 941 | found = FALSE; break; |
937 | } | 942 | } |
943 | if( !found ) | ||
944 | warn_msg( WarnLogic, "Could not parse Compiler option: %s", option ); | ||
938 | return TRUE; | 945 | return TRUE; |
939 | } | 946 | } |
940 | 947 | ||
941 | // VCLinkerTool ----------------------------------------------------- | 948 | // VCLinkerTool ----------------------------------------------------- |
942 | VCLinkerTool::VCLinkerTool() | 949 | VCLinkerTool::VCLinkerTool() |
943 | :EnableCOMDATFolding( optFoldingDefault ), | 950 | :EnableCOMDATFolding( optFoldingDefault ), |
944 | GenerateDebugInformation( unset ), | 951 | GenerateDebugInformation( unset ), |
945 | GenerateMapFile( unset ), | 952 | GenerateMapFile( unset ), |
946 | HeapCommitSize( -1 ), | 953 | HeapCommitSize( -1 ), |
947 | HeapReserveSize( -1 ), | 954 | HeapReserveSize( -1 ), |
948 | IgnoreAllDefaultLibraries( unset ), | 955 | IgnoreAllDefaultLibraries( unset ), |
949 | IgnoreEmbeddedIDL( unset ), | 956 | IgnoreEmbeddedIDL( unset ), |
950 | IgnoreImportLibrary( unset ), | 957 | IgnoreImportLibrary( unset ), |
951 | LargeAddressAware( addrAwareDefault ), | 958 | LargeAddressAware( addrAwareDefault ), |
952 | LinkDLL( unset ), | 959 | LinkDLL( unset ), |
953 | LinkIncremental( linkIncrementalYes ), | 960 | LinkIncremental( linkIncrementalYes ), |
@@ -967,33 +974,33 @@ VCLinkerTool::VCLinkerTool() | |||
967 | SuppressStartupBanner( unset ), | 974 | SuppressStartupBanner( unset ), |
968 | SwapRunFromCD( unset ), | 975 | SwapRunFromCD( unset ), |
969 | SwapRunFromNet( unset ), | 976 | SwapRunFromNet( unset ), |
970 | TargetMachine( machineNotSet ), | 977 | TargetMachine( machineNotSet ), |
971 | TerminalServerAware( termSvrAwareDefault ), | 978 | TerminalServerAware( termSvrAwareDefault ), |
972 | TurnOffAssemblyGeneration( unset ), | 979 | TurnOffAssemblyGeneration( unset ), |
973 | TypeLibraryResourceID( 0 ) | 980 | TypeLibraryResourceID( 0 ) |
974 | { | 981 | { |
975 | } | 982 | } |
976 | 983 | ||
977 | QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | 984 | QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) |
978 | { | 985 | { |
979 | strm << _begTool3; | 986 | strm << _begTool3; |
980 | strm << _VCLinkerToolName; | 987 | strm << _VCLinkerToolName; |
981 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " ); | 988 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " ); |
982 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); | 989 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); |
983 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); | 990 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
984 | strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); | 991 | strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); |
985 | strm << SPair( _BaseAddress, tool.BaseAddress ); | 992 | strm << SPair( _BaseAddress, tool.BaseAddress ); |
986 | strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs ); | 993 | strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs ); |
987 | if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding ); | 994 | if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding ); |
988 | strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol ); | 995 | strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol ); |
989 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); | 996 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); |
990 | strm << SPair( _FunctionOrder, tool.FunctionOrder ); | 997 | strm << SPair( _FunctionOrder, tool.FunctionOrder ); |
991 | strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation ); | 998 | strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation ); |
992 | strm << TPair( _GenerateMapFile, tool.GenerateMapFile ); | 999 | strm << TPair( _GenerateMapFile, tool.GenerateMapFile ); |
993 | if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize ); | 1000 | if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize ); |
994 | if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize ); | 1001 | if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize ); |
995 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); | 1002 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); |
996 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); | 1003 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); |
997 | strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL ); | 1004 | strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL ); |
998 | strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary ); | 1005 | strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary ); |
999 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); | 1006 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); |
@@ -1033,85 +1040,89 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | |||
1033 | strm << SPair( _Version4, tool.Version ); | 1040 | strm << SPair( _Version4, tool.Version ); |
1034 | strm << "/>"; | 1041 | strm << "/>"; |
1035 | return strm; | 1042 | return strm; |
1036 | } | 1043 | } |
1037 | 1044 | ||
1038 | // Hashing routine to do fast option lookups ---- | 1045 | // Hashing routine to do fast option lookups ---- |
1039 | // Slightly rewritten to stop on ':' ',' and '\0' | 1046 | // Slightly rewritten to stop on ':' ',' and '\0' |
1040 | // Original routine in qtranslator.cpp ---------- | 1047 | // Original routine in qtranslator.cpp ---------- |
1041 | static uint elfHash( const char* name ) | 1048 | static uint elfHash( const char* name ) |
1042 | { | 1049 | { |
1043 | const uchar *k; | 1050 | const uchar *k; |
1044 | uint h = 0; | 1051 | uint h = 0; |
1045 | uint g; | 1052 | uint g; |
1046 | 1053 | ||
1047 | if ( name ) { | 1054 | if ( name ) { |
1048 | k = (const uchar *) name; | 1055 | k = (const uchar *) name; |
1049 | while ( (*k) && | 1056 | while ( (*k) && |
1050 | (*k)!= ':' && | 1057 | (*k)!= ':' && |
1051 | (*k)!=',' && | 1058 | (*k)!=',' && |
1052 | (*k)!=' ' ) { | 1059 | (*k)!=' ' ) { |
1053 | h = ( h << 4 ) + *k++; | 1060 | h = ( h << 4 ) + *k++; |
1054 | if ( (g = (h & 0xf0000000)) != 0 ) | 1061 | if ( (g = (h & 0xf0000000)) != 0 ) |
1055 | h ^= g >> 24; | 1062 | h ^= g >> 24; |
1056 | h &= ~g; | 1063 | h &= ~g; |
1057 | } | 1064 | } |
1058 | } | 1065 | } |
1059 | if ( !h ) | 1066 | if ( !h ) |
1060 | h = 1; | 1067 | h = 1; |
1061 | return h; | 1068 | return h; |
1062 | } | 1069 | } |
1070 | |||
1071 | //#define USE_DISPLAY_HASH | ||
1072 | #ifdef USE_DISPLAY_HASH | ||
1063 | static void displayHash( const char* str ) | 1073 | static void displayHash( const char* str ) |
1064 | { | 1074 | { |
1065 | printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str ); | 1075 | printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str ); |
1066 | } | 1076 | } |
1077 | #endif | ||
1067 | 1078 | ||
1068 | bool VCLinkerTool::parseOption( const char* option ) | 1079 | bool VCLinkerTool::parseOption( const char* option ) |
1069 | { | 1080 | { |
1070 | #if 0 | 1081 | #ifdef USE_DISPLAY_HASH |
1071 | // Main options | 1082 | // Main options |
1072 | displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); | 1083 | displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); |
1073 | displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); | 1084 | displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); |
1074 | displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); | 1085 | displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); |
1075 | displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); | 1086 | displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); |
1076 | displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); | 1087 | displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); |
1077 | displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); | 1088 | displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); |
1078 | displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); | 1089 | displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); |
1079 | displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); | 1090 | displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); |
1080 | displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); | 1091 | displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); |
1081 | displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); | 1092 | displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); |
1082 | displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); | 1093 | displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); |
1083 | displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); | 1094 | displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); |
1084 | displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); | 1095 | displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); |
1085 | displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); | 1096 | displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); |
1086 | displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); | 1097 | displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); |
1087 | displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); | 1098 | displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); |
1088 | displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); | 1099 | displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); |
1089 | displayHash( "/VXD" ); displayHash( "/WS " ); | 1100 | displayHash( "/VXD" ); displayHash( "/WS " ); |
1090 | #endif | 1101 | #endif |
1091 | #if 0 | 1102 | #ifdef USE_DISPLAY_HASH |
1092 | // Sub options | 1103 | // Sub options |
1093 | displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); | 1104 | displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); |
1094 | displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); | 1105 | displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); |
1095 | displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); | 1106 | displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); |
1096 | displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); | 1107 | displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); |
1097 | displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); | 1108 | displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); |
1098 | displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); | 1109 | displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); |
1099 | displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); | 1110 | displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); |
1100 | #endif | 1111 | #endif |
1101 | 1112 | bool found = TRUE; | |
1102 | switch ( elfHash(option) ) { | 1113 | switch ( elfHash(option) ) { |
1103 | case 0x3360dbe: // /ALIGN[:number] | 1114 | case 0x3360dbe: // /ALIGN[:number] |
1104 | case 0x1485c34: // /ALLOWBIND[:NO] | 1115 | case 0x1485c34: // /ALLOWBIND[:NO] |
1105 | case 0x6b21972: // /DEFAULTLIB:library | 1116 | case 0x6b21972: // /DEFAULTLIB:library |
1106 | case 0x396ea92: // /DRIVER[:UPONLY | :WDM] | 1117 | case 0x396ea92: // /DRIVER[:UPONLY | :WDM] |
1107 | case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] | 1118 | case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] |
1108 | case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA] | 1119 | case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA] |
1109 | case 0x33aec94: // /FIXED[:NO] | 1120 | case 0x33aec94: // /FIXED[:NO] |
1110 | case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED] | 1121 | case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED] |
1111 | case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#] | 1122 | case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#] |
1112 | case 0x0348992: // /STUB:filename | 1123 | case 0x0348992: // /STUB:filename |
1113 | case 0x0034bc4: // /VXD | 1124 | case 0x0034bc4: // /VXD |
1114 | case 0x0034c50: // /WS | 1125 | case 0x0034c50: // /WS |
1115 | AdditionalOptions += option; | 1126 | AdditionalOptions += option; |
1116 | break; | 1127 | break; |
1117 | case 0x679c075: // /ASSEMBLYMODULE:filename | 1128 | case 0x679c075: // /ASSEMBLYMODULE:filename |
@@ -1128,33 +1139,33 @@ bool VCLinkerTool::parseOption( const char* option ) | |||
1128 | break; | 1139 | break; |
1129 | case 0x3389797: // /DEBUG | 1140 | case 0x3389797: // /DEBUG |
1130 | GenerateDebugInformation = _True; | 1141 | GenerateDebugInformation = _True; |
1131 | break; | 1142 | break; |
1132 | case 0x0033896: // /DEF:filename | 1143 | case 0x0033896: // /DEF:filename |
1133 | ModuleDefinitionFile = option+5; | 1144 | ModuleDefinitionFile = option+5; |
1134 | break; | 1145 | break; |
1135 | case 0x338a069: // /DELAY:{UNLOAD | NOBIND} | 1146 | case 0x338a069: // /DELAY:{UNLOAD | NOBIND} |
1136 | // MS documentation does not specify what to do with | 1147 | // MS documentation does not specify what to do with |
1137 | // this option, so we'll put it in AdditionalOptions | 1148 | // this option, so we'll put it in AdditionalOptions |
1138 | AdditionalOptions += option; | 1149 | AdditionalOptions += option; |
1139 | break; | 1150 | break; |
1140 | case 0x06f4bf4: // /DELAYLOAD:dllname | 1151 | case 0x06f4bf4: // /DELAYLOAD:dllname |
1141 | DelayLoadDLLs += option+11; | 1152 | DelayLoadDLLs += option+11; |
1142 | break; | 1153 | break; |
1143 | // case 0x003390c: // /DLL | 1154 | // case 0x003390c: // /DLL |
1144 | // This option is not used for vcproj files | 1155 | // This option is not used for vcproj files |
1145 | //break; | 1156 | //break; |
1146 | case 0x33a3979: // /ENTRY:function | 1157 | case 0x33a3979: // /ENTRY:function |
1147 | EntryPointSymbol = option+7; | 1158 | EntryPointSymbol = option+7; |
1148 | break; | 1159 | break; |
1149 | case 0x033c960: // /HEAP:reserve[,commit] | 1160 | case 0x033c960: // /HEAP:reserve[,commit] |
1150 | { | 1161 | { |
1151 | QStringList both = QStringList::split( ",", option+6 ); | 1162 | QStringList both = QStringList::split( ",", option+6 ); |
1152 | HeapReserveSize = both[0].toLong(); | 1163 | HeapReserveSize = both[0].toLong(); |
1153 | if ( both.count() == 2 ) | 1164 | if ( both.count() == 2 ) |
1154 | HeapCommitSize = both[1].toLong(); | 1165 | HeapCommitSize = both[1].toLong(); |
1155 | } | 1166 | } |
1156 | break; | 1167 | break; |
1157 | case 0x3d91494: // /IDLOUT:[path\]filename | 1168 | case 0x3d91494: // /IDLOUT:[path\]filename |
1158 | MergedIDLBaseFileName = option+8; | 1169 | MergedIDLBaseFileName = option+8; |
1159 | break; | 1170 | break; |
1160 | case 0x345a04c: // /IGNOREIDL | 1171 | case 0x345a04c: // /IGNOREIDL |
@@ -1179,57 +1190,57 @@ bool VCLinkerTool::parseOption( const char* option ) | |||
1179 | LargeAddressAware = addrAwareNoLarge; | 1190 | LargeAddressAware = addrAwareNoLarge; |
1180 | else | 1191 | else |
1181 | LargeAddressAware = addrAwareLarge; | 1192 | LargeAddressAware = addrAwareLarge; |
1182 | break; | 1193 | break; |
1183 | case 0x0d745c8: // /LIBPATH:dir | 1194 | case 0x0d745c8: // /LIBPATH:dir |
1184 | AdditionalLibraryDirectories += option+9; | 1195 | AdditionalLibraryDirectories += option+9; |
1185 | break; | 1196 | break; |
1186 | case 0x0341877: // /LTCG[:NOSTATUS|:STATUS] | 1197 | case 0x0341877: // /LTCG[:NOSTATUS|:STATUS] |
1187 | config->WholeProgramOptimization = _True; | 1198 | config->WholeProgramOptimization = _True; |
1188 | LinkTimeCodeGeneration = _True; | 1199 | LinkTimeCodeGeneration = _True; |
1189 | if ( *(option+5) == ':' && | 1200 | if ( *(option+5) == ':' && |
1190 | *(option+6) == 'S' ) | 1201 | *(option+6) == 'S' ) |
1191 | ShowProgress = linkProgressAll; | 1202 | ShowProgress = linkProgressAll; |
1192 | break; | 1203 | break; |
1193 | case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} | 1204 | case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} |
1194 | switch ( elfHash(option+9) ) { | 1205 | switch ( elfHash(option+9) ) { |
1195 | // Very limited documentation on all options but X86, | 1206 | // Very limited documentation on all options but X86, |
1196 | // so we put the others in AdditionalOptions... | 1207 | // so we put the others in AdditionalOptions... |
1197 | case 0x0046063: // AM33 | 1208 | case 0x0046063: // AM33 |
1198 | case 0x000466d: // ARM | 1209 | case 0x000466d: // ARM |
1199 | case 0x0004795: // CEE | 1210 | case 0x0004795: // CEE |
1200 | case 0x004d494: // IA64 | 1211 | case 0x004d494: // IA64 |
1201 | case 0x0050672: // M32R | 1212 | case 0x0050672: // M32R |
1202 | case 0x0051e53: // MIPS | 1213 | case 0x0051e53: // MIPS |
1203 | case 0x51e5646: // MIPS16 | 1214 | case 0x51e5646: // MIPS16 |
1204 | case 0x1e57b05: // MIPSFPU | 1215 | case 0x1e57b05: // MIPSFPU |
1205 | case 0x57b09a6: // MIPSFPU16 | 1216 | case 0x57b09a6: // MIPSFPU16 |
1206 | case 0x5852738: // MIPSR41XX | 1217 | case 0x5852738: // MIPSR41XX |
1207 | case 0x0005543: // PPC | 1218 | case 0x0005543: // PPC |
1208 | case 0x00057b3: // SH3 | 1219 | case 0x00057b3: // SH3 |
1209 | case 0x00057b4: // SH4 | 1220 | case 0x00057b4: // SH4 |
1210 | case 0x00057b5: // SH5 | 1221 | case 0x00057b5: // SH5 |
1211 | case 0x058da12: // THUMB | 1222 | case 0x058da12: // THUMB |
1212 | case 0x96d8435: // TRICORE | 1223 | case 0x96d8435: // TRICORE |
1213 | AdditionalOptions += option; | 1224 | AdditionalOptions += option; |
1214 | break; | 1225 | break; |
1215 | case 0x0005bb6: // X86 | 1226 | case 0x0005bb6: // X86 |
1216 | TargetMachine = machineX86; | 1227 | TargetMachine = machineX86; |
1217 | break; | 1228 | break; |
1218 | default: | 1229 | default: |
1219 | return FALSE; | 1230 | found = FALSE; |
1220 | } | 1231 | } |
1221 | break; | 1232 | break; |
1222 | case 0x0034160: // /MAP[:filename] | 1233 | case 0x0034160: // /MAP[:filename] |
1223 | GenerateMapFile = _True; | 1234 | GenerateMapFile = _True; |
1224 | MapFileName = option+5; | 1235 | MapFileName = option+5; |
1225 | break; | 1236 | break; |
1226 | case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES} | 1237 | case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES} |
1227 | if ( *(option+9) == 'E' ) | 1238 | if ( *(option+9) == 'E' ) |
1228 | MapExports = _True; | 1239 | MapExports = _True; |
1229 | else if ( *(option+9) == 'L' ) | 1240 | else if ( *(option+9) == 'L' ) |
1230 | MapLines = _True; | 1241 | MapLines = _True; |
1231 | break; | 1242 | break; |
1232 | case 0x341a6b5: // /MERGE:from=to | 1243 | case 0x341a6b5: // /MERGE:from=to |
1233 | MergeSections = option+7; | 1244 | MergeSections = option+7; |
1234 | break; | 1245 | break; |
1235 | case 0x0341d8c: // /MIDL:@file | 1246 | case 0x0341d8c: // /MIDL:@file |
@@ -1262,33 +1273,33 @@ bool VCLinkerTool::parseOption( const char* option ) | |||
1262 | // [=iterations] case is not documented | 1273 | // [=iterations] case is not documented |
1263 | } | 1274 | } |
1264 | break; | 1275 | break; |
1265 | case 'R': // NOREF | 1276 | case 'R': // NOREF |
1266 | OptimizeReferences = optNoReferences; | 1277 | OptimizeReferences = optNoReferences; |
1267 | break; | 1278 | break; |
1268 | case 'I': // NOICF | 1279 | case 'I': // NOICF |
1269 | EnableCOMDATFolding = optNoFolding; | 1280 | EnableCOMDATFolding = optNoFolding; |
1270 | break; | 1281 | break; |
1271 | case 'N': // WIN98 | 1282 | case 'N': // WIN98 |
1272 | OptimizeForWindows98 = optWin98Yes; | 1283 | OptimizeForWindows98 = optWin98Yes; |
1273 | break; | 1284 | break; |
1274 | case 'W': // NOWIN98 | 1285 | case 'W': // NOWIN98 |
1275 | OptimizeForWindows98 = optWin98No; | 1286 | OptimizeForWindows98 = optWin98No; |
1276 | break; | 1287 | break; |
1277 | default: | 1288 | default: |
1278 | return FALSE; | 1289 | found = FALSE; |
1279 | } | 1290 | } |
1280 | } | 1291 | } |
1281 | break; | 1292 | break; |
1282 | case 0x34468a2: // /ORDER:@filename | 1293 | case 0x34468a2: // /ORDER:@filename |
1283 | FunctionOrder = option+8; | 1294 | FunctionOrder = option+8; |
1284 | break; | 1295 | break; |
1285 | case 0x00344a4: // /OUT:filename | 1296 | case 0x00344a4: // /OUT:filename |
1286 | OutputFile = option+5; | 1297 | OutputFile = option+5; |
1287 | break; | 1298 | break; |
1288 | case 0x0034482: // /PDB:filename | 1299 | case 0x0034482: // /PDB:filename |
1289 | ProgramDatabaseFile = option+5; | 1300 | ProgramDatabaseFile = option+5; |
1290 | break; | 1301 | break; |
1291 | case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name | 1302 | case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name |
1292 | StripPrivateSymbols = option+13; | 1303 | StripPrivateSymbols = option+13; |
1293 | break; | 1304 | break; |
1294 | case 0x6a09535: // /RELEASE | 1305 | case 0x6a09535: // /RELEASE |
@@ -1311,101 +1322,103 @@ bool VCLinkerTool::parseOption( const char* option ) | |||
1311 | SubSystem = subSystemConsole; | 1322 | SubSystem = subSystemConsole; |
1312 | break; | 1323 | break; |
1313 | case 0xbe29493: // WINDOWS | 1324 | case 0xbe29493: // WINDOWS |
1314 | SubSystem = subSystemWindows; | 1325 | SubSystem = subSystemWindows; |
1315 | break; | 1326 | break; |
1316 | // The following are undocumented, so add them to AdditionalOptions | 1327 | // The following are undocumented, so add them to AdditionalOptions |
1317 | case 0x240949e: // EFI_APPLICATION | 1328 | case 0x240949e: // EFI_APPLICATION |
1318 | case 0xe617652: // EFI_BOOT_SERVICE_DRIVER | 1329 | case 0xe617652: // EFI_BOOT_SERVICE_DRIVER |
1319 | case 0x9af477d: // EFI_ROM | 1330 | case 0x9af477d: // EFI_ROM |
1320 | case 0xd34df42: // EFI_RUNTIME_DRIVER | 1331 | case 0xd34df42: // EFI_RUNTIME_DRIVER |
1321 | case 0x5268ea5: // NATIVE | 1332 | case 0x5268ea5: // NATIVE |
1322 | case 0x05547e8: // POSIX | 1333 | case 0x05547e8: // POSIX |
1323 | case 0x2949c95: // WINDOWSCE | 1334 | case 0x2949c95: // WINDOWSCE |
1324 | AdditionalOptions += option; | 1335 | AdditionalOptions += option; |
1325 | break; | 1336 | break; |
1326 | default: | 1337 | default: |
1327 | return FALSE; | 1338 | found = FALSE; |
1328 | } | 1339 | } |
1329 | } | 1340 | } |
1330 | break; | 1341 | break; |
1331 | case 0x8b654de: // /SWAPRUN:{NET | CD} | 1342 | case 0x8b654de: // /SWAPRUN:{NET | CD} |
1332 | if ( *(option+9) == 'N' ) | 1343 | if ( *(option+9) == 'N' ) |
1333 | SwapRunFromNet = _True; | 1344 | SwapRunFromNet = _True; |
1334 | else if ( *(option+9) == 'C' ) | 1345 | else if ( *(option+9) == 'C' ) |
1335 | SwapRunFromCD = _True; | 1346 | SwapRunFromCD = _True; |
1336 | else | 1347 | else |
1337 | return FALSE; | 1348 | found = FALSE; |
1338 | break; | 1349 | break; |
1339 | case 0x34906d4: // /TLBID:id | 1350 | case 0x34906d4: // /TLBID:id |
1340 | TypeLibraryResourceID = QString( option+7 ).toLong(); | 1351 | TypeLibraryResourceID = QString( option+7 ).toLong(); |
1341 | break; | 1352 | break; |
1342 | case 0x4907494: // /TLBOUT:[path\]filename | 1353 | case 0x4907494: // /TLBOUT:[path\]filename |
1343 | TypeLibraryFile = option+8; | 1354 | TypeLibraryFile = option+8; |
1344 | break; | 1355 | break; |
1345 | case 0x976b525: // /TSAWARE[:NO] | 1356 | case 0x976b525: // /TSAWARE[:NO] |
1346 | if ( *(option+8) == ':' ) | 1357 | if ( *(option+8) == ':' ) |
1347 | TerminalServerAware = termSvrAwareNo; | 1358 | TerminalServerAware = termSvrAwareNo; |
1348 | else | 1359 | else |
1349 | TerminalServerAware = termSvrAwareYes; | 1360 | TerminalServerAware = termSvrAwareYes; |
1350 | break; | 1361 | break; |
1351 | case 0xaa67735: // /VERBOSE[:lib] | 1362 | case 0xaa67735: // /VERBOSE[:lib] |
1352 | if ( *(option+9) == ':' ) { | 1363 | if ( *(option+9) == ':' ) { |
1353 | ShowProgress = linkProgressLibs; | 1364 | ShowProgress = linkProgressLibs; |
1354 | AdditionalOptions += option; | 1365 | AdditionalOptions += option; |
1355 | } else { | 1366 | } else { |
1356 | ShowProgress = linkProgressAll; | 1367 | ShowProgress = linkProgressAll; |
1357 | } | 1368 | } |
1358 | break; | 1369 | break; |
1359 | case 0xaa77f7e: // /VERSION:major[.minor] | 1370 | case 0xaa77f7e: // /VERSION:major[.minor] |
1360 | Version = option+9; | 1371 | Version = option+9; |
1361 | break; | 1372 | break; |
1362 | default: | 1373 | default: |
1363 | return FALSE; | 1374 | found = FALSE; |
1364 | } | 1375 | } |
1365 | return TRUE; | 1376 | if( !found ) |
1377 | warn_msg( WarnLogic, "Could not parse Linker options: %s", option ); | ||
1378 | return found; | ||
1366 | } | 1379 | } |
1367 | 1380 | ||
1368 | // VCMIDLTool ------------------------------------------------------- | 1381 | // VCMIDLTool ------------------------------------------------------- |
1369 | VCMIDLTool::VCMIDLTool() | 1382 | VCMIDLTool::VCMIDLTool() |
1370 | :DefaultCharType( midlCharUnsigned ), | 1383 | :DefaultCharType( midlCharUnsigned ), |
1371 | EnableErrorChecks( midlDisableAll ), | 1384 | EnableErrorChecks( midlDisableAll ), |
1372 | ErrorCheckAllocations( unset ), | 1385 | ErrorCheckAllocations( unset ), |
1373 | ErrorCheckBounds( unset ), | 1386 | ErrorCheckBounds( unset ), |
1374 | ErrorCheckEnumRange( unset ), | 1387 | ErrorCheckEnumRange( unset ), |
1375 | ErrorCheckRefPointers( unset ), | 1388 | ErrorCheckRefPointers( unset ), |
1376 | ErrorCheckStubData( unset ), | 1389 | ErrorCheckStubData( unset ), |
1377 | GenerateStublessProxies( unset ), | 1390 | GenerateStublessProxies( unset ), |
1378 | GenerateTypeLibrary( unset ), | 1391 | GenerateTypeLibrary( unset ), |
1379 | IgnoreStandardIncludePath( unset ), | 1392 | IgnoreStandardIncludePath( unset ), |
1380 | MkTypLibCompatible( unset ), | 1393 | MkTypLibCompatible( unset ), |
1381 | StructMemberAlignment( midlAlignNotSet ), | 1394 | StructMemberAlignment( midlAlignNotSet ), |
1382 | SuppressStartupBanner( unset ), | 1395 | SuppressStartupBanner( unset ), |
1383 | TargetEnvironment( midlTargetNotSet ), | 1396 | TargetEnvironment( midlTargetNotSet ), |
1384 | ValidateParameters( unset ), | 1397 | ValidateParameters( unset ), |
1385 | WarnAsError( unset ), | 1398 | WarnAsError( unset ), |
1386 | WarningLevel( midlWarningLevel_0 ) | 1399 | WarningLevel( midlWarningLevel_0 ) |
1387 | { | 1400 | { |
1388 | } | 1401 | } |
1389 | 1402 | ||
1390 | QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool ) | 1403 | QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool ) |
1391 | { | 1404 | { |
1392 | strm << _begTool3; | 1405 | strm << _begTool3; |
1393 | strm << _VCMIDLToolName; | 1406 | strm << _VCMIDLToolName; |
1394 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 1407 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
1395 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); | 1408 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
1396 | strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions ); | 1409 | strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions ); |
1397 | strm << EPair( _DefaultCharType, tool.DefaultCharType ); | 1410 | strm << EPair( _DefaultCharType, tool.DefaultCharType ); |
1398 | strm << SPair( _DLLDataFileName, tool.DLLDataFileName ); | 1411 | strm << SPair( _DLLDataFileName, tool.DLLDataFileName ); |
1399 | strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks ); | 1412 | strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks ); |
1400 | strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations ); | 1413 | strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations ); |
1401 | strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds ); | 1414 | strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds ); |
1402 | strm << TPair( _ErrorCheckEnumRange, tool.ErrorCheckEnumRange ); | 1415 | strm << TPair( _ErrorCheckEnumRange, tool.ErrorCheckEnumRange ); |
1403 | strm << TPair( _ErrorCheckRefPointers, tool.ErrorCheckRefPointers ); | 1416 | strm << TPair( _ErrorCheckRefPointers, tool.ErrorCheckRefPointers ); |
1404 | strm << TPair( _ErrorCheckStubData, tool.ErrorCheckStubData ); | 1417 | strm << TPair( _ErrorCheckStubData, tool.ErrorCheckStubData ); |
1405 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); | 1418 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); |
1406 | strm << TPair( _GenerateStublessProxies, tool.GenerateStublessProxies ); | 1419 | strm << TPair( _GenerateStublessProxies, tool.GenerateStublessProxies ); |
1407 | strm << TPair( _GenerateTypeLibrary, tool.GenerateTypeLibrary ); | 1420 | strm << TPair( _GenerateTypeLibrary, tool.GenerateTypeLibrary ); |
1408 | strm << SPair( _HeaderFileName, tool.HeaderFileName ); | 1421 | strm << SPair( _HeaderFileName, tool.HeaderFileName ); |
1409 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); | 1422 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); |
1410 | strm << SPair( _InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName ); | 1423 | strm << SPair( _InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName ); |
1411 | strm << TPair( _MkTypLibCompatible, tool.MkTypLibCompatible ); | 1424 | strm << TPair( _MkTypLibCompatible, tool.MkTypLibCompatible ); |
@@ -1414,60 +1427,61 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool ) | |||
1414 | strm << SPair( _ProxyFileName, tool.ProxyFileName ); | 1427 | strm << SPair( _ProxyFileName, tool.ProxyFileName ); |
1415 | strm << SPair( _RedirectOutputAndErrors, tool.RedirectOutputAndErrors ); | 1428 | strm << SPair( _RedirectOutputAndErrors, tool.RedirectOutputAndErrors ); |
1416 | if ( tool.StructMemberAlignment != midlAlignNotSet) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); | 1429 | if ( tool.StructMemberAlignment != midlAlignNotSet) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); |
1417 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 1430 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
1418 | if ( tool.TargetEnvironment != midlTargetNotSet ) strm << EPair( _TargetEnvironment, tool.TargetEnvironment ); | 1431 | if ( tool.TargetEnvironment != midlTargetNotSet ) strm << EPair( _TargetEnvironment, tool.TargetEnvironment ); |
1419 | strm << SPair( _TypeLibraryName, tool.TypeLibraryName ); | 1432 | strm << SPair( _TypeLibraryName, tool.TypeLibraryName ); |
1420 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); | 1433 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); |
1421 | strm << TPair( _ValidateParameters, tool.ValidateParameters ); | 1434 | strm << TPair( _ValidateParameters, tool.ValidateParameters ); |
1422 | strm << TPair( _WarnAsError, tool.WarnAsError ); | 1435 | strm << TPair( _WarnAsError, tool.WarnAsError ); |
1423 | strm << EPair( _WarningLevel, tool.WarningLevel ); | 1436 | strm << EPair( _WarningLevel, tool.WarningLevel ); |
1424 | strm << "/>"; | 1437 | strm << "/>"; |
1425 | return strm; | 1438 | return strm; |
1426 | } | 1439 | } |
1427 | 1440 | ||
1428 | bool VCMIDLTool::parseOption( const char* option ) | 1441 | bool VCMIDLTool::parseOption( const char* option ) |
1429 | { | 1442 | { |
1430 | #if 0 | 1443 | #ifdef USE_DISPLAY_HASH |
1431 | displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" ); | 1444 | displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" ); |
1432 | displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" ); | 1445 | displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" ); |
1433 | displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" ); | 1446 | displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" ); |
1434 | displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" ); | 1447 | displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" ); |
1435 | displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" ); | 1448 | displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" ); |
1436 | displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" ); | 1449 | displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" ); |
1437 | displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" ); | 1450 | displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" ); |
1438 | displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" ); | 1451 | displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" ); |
1439 | displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" ); | 1452 | displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" ); |
1440 | displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" ); | 1453 | displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" ); |
1441 | displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" ); | 1454 | displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" ); |
1442 | displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" ); | 1455 | displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" ); |
1443 | displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" ); | 1456 | displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" ); |
1444 | displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" ); | 1457 | displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" ); |
1445 | displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" ); | 1458 | displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" ); |
1446 | displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" ); | 1459 | displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" ); |
1447 | displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" ); | 1460 | displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" ); |
1448 | displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" ); | 1461 | displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" ); |
1449 | displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" ); | 1462 | displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" ); |
1450 | displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" ); | 1463 | displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" ); |
1451 | displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" ); | 1464 | displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" ); |
1452 | displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" ); | 1465 | displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" ); |
1453 | displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" ); | 1466 | displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" ); |
1454 | displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" ); | 1467 | displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" ); |
1455 | displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" ); | 1468 | displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" ); |
1456 | displayHash( "/win32" ); displayHash( "/win64" ); | 1469 | displayHash( "/win32" ); displayHash( "/win64" ); |
1457 | #endif | 1470 | #endif |
1471 | bool found = TRUE; | ||
1458 | int offset = 0; | 1472 | int offset = 0; |
1459 | switch( elfHash(option) ) { | 1473 | switch( elfHash(option) ) { |
1460 | case 0x0000334: // /D name[=def] | 1474 | case 0x0000334: // /D name[=def] |
1461 | PreprocessorDefinitions += option+3; | 1475 | PreprocessorDefinitions += option+3; |
1462 | break; | 1476 | break; |
1463 | case 0x0000339: // /I directory-list | 1477 | case 0x0000339: // /I directory-list |
1464 | AdditionalIncludeDirectories += option+3; | 1478 | AdditionalIncludeDirectories += option+3; |
1465 | break; | 1479 | break; |
1466 | case 0x0345f96: // /Oicf | 1480 | case 0x0345f96: // /Oicf |
1467 | case 0x00345f6: // /Oif | 1481 | case 0x00345f6: // /Oif |
1468 | GenerateStublessProxies = _True; | 1482 | GenerateStublessProxies = _True; |
1469 | break; | 1483 | break; |
1470 | case 0x0000345: // /U name | 1484 | case 0x0000345: // /U name |
1471 | UndefinePreprocessorDefinitions += option+3; | 1485 | UndefinePreprocessorDefinitions += option+3; |
1472 | break; | 1486 | break; |
1473 | case 0x00034c8: // /WX | 1487 | case 0x00034c8: // /WX |
@@ -1477,85 +1491,85 @@ bool VCMIDLTool::parseOption( const char* option ) | |||
1477 | offset = 3; // Fallthrough | 1491 | offset = 3; // Fallthrough |
1478 | case 0x0003510: // /Zp {N} | 1492 | case 0x0003510: // /Zp {N} |
1479 | switch ( *(option+offset+4) ) { | 1493 | switch ( *(option+offset+4) ) { |
1480 | case '1': | 1494 | case '1': |
1481 | StructMemberAlignment = ( *(option+offset+5) == '\0' ) ? midlAlignSingleByte : midlAlignSixteenBytes; | 1495 | StructMemberAlignment = ( *(option+offset+5) == '\0' ) ? midlAlignSingleByte : midlAlignSixteenBytes; |
1482 | break; | 1496 | break; |
1483 | case '2': | 1497 | case '2': |
1484 | StructMemberAlignment = midlAlignTwoBytes; | 1498 | StructMemberAlignment = midlAlignTwoBytes; |
1485 | break; | 1499 | break; |
1486 | case '4': | 1500 | case '4': |
1487 | StructMemberAlignment = midlAlignFourBytes; | 1501 | StructMemberAlignment = midlAlignFourBytes; |
1488 | break; | 1502 | break; |
1489 | case '8': | 1503 | case '8': |
1490 | StructMemberAlignment = midlAlignEightBytes; | 1504 | StructMemberAlignment = midlAlignEightBytes; |
1491 | break; | 1505 | break; |
1492 | default: | 1506 | default: |
1493 | return FALSE; | 1507 | found = FALSE; |
1494 | } | 1508 | } |
1495 | break; | 1509 | break; |
1496 | case 0x0359e82: // /char {ascii7|signed|unsigned} | 1510 | case 0x0359e82: // /char {ascii7|signed|unsigned} |
1497 | switch( *(option+6) ) { | 1511 | switch( *(option+6) ) { |
1498 | case 'a': | 1512 | case 'a': |
1499 | DefaultCharType = midlCharAscii7; | 1513 | DefaultCharType = midlCharAscii7; |
1500 | break; | 1514 | break; |
1501 | case 's': | 1515 | case 's': |
1502 | DefaultCharType = midlCharSigned; | 1516 | DefaultCharType = midlCharSigned; |
1503 | break; | 1517 | break; |
1504 | case 'u': | 1518 | case 'u': |
1505 | DefaultCharType = midlCharUnsigned; | 1519 | DefaultCharType = midlCharUnsigned; |
1506 | break; | 1520 | break; |
1507 | default: | 1521 | default: |
1508 | return FALSE; | 1522 | found = FALSE; |
1509 | } | 1523 | } |
1510 | break; | 1524 | break; |
1511 | case 0xa766524: // /cpp_opt options | 1525 | case 0xa766524: // /cpp_opt options |
1512 | CPreprocessOptions += option+9; | 1526 | CPreprocessOptions += option+9; |
1513 | break; | 1527 | break; |
1514 | case 0xb32abf1: // /dlldata filename | 1528 | case 0xb32abf1: // /dlldata filename |
1515 | DLLDataFileName = option + 9; | 1529 | DLLDataFileName = option + 9; |
1516 | break; | 1530 | break; |
1517 | case 0x0035c56: // /env {win32|win64} | 1531 | case 0x0035c56: // /env {win32|win64} |
1518 | TargetEnvironment = ( *(option+8) == '6' ) ? midlTargetWin64 : midlTargetWin32; | 1532 | TargetEnvironment = ( *(option+8) == '6' ) ? midlTargetWin64 : midlTargetWin32; |
1519 | break; | 1533 | break; |
1520 | case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data} | 1534 | case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data} |
1521 | EnableErrorChecks = midlEnableCustom; | 1535 | EnableErrorChecks = midlEnableCustom; |
1522 | switch ( *(option+7) ) { | 1536 | switch ( *(option+7) ) { |
1523 | case 'a': | 1537 | case 'a': |
1524 | if ( *(option+10) == '\0' ) | 1538 | if ( *(option+10) == '\0' ) |
1525 | EnableErrorChecks = midlEnableAll; | 1539 | EnableErrorChecks = midlEnableAll; |
1526 | else | 1540 | else |
1527 | ErrorCheckAllocations = _True; | 1541 | ErrorCheckAllocations = _True; |
1528 | break; | 1542 | break; |
1529 | case 'b': | 1543 | case 'b': |
1530 | ErrorCheckBounds = _True; | 1544 | ErrorCheckBounds = _True; |
1531 | break; | 1545 | break; |
1532 | case 'e': | 1546 | case 'e': |
1533 | ErrorCheckEnumRange = _True; | 1547 | ErrorCheckEnumRange = _True; |
1534 | break; | 1548 | break; |
1535 | case 'n': | 1549 | case 'n': |
1536 | EnableErrorChecks = midlDisableAll; | 1550 | EnableErrorChecks = midlDisableAll; |
1537 | break; | 1551 | break; |
1538 | case 'r': | 1552 | case 'r': |
1539 | break; | ||
1540 | ErrorCheckRefPointers = _True; | 1553 | ErrorCheckRefPointers = _True; |
1541 | case 's': | ||
1542 | break; | 1554 | break; |
1555 | case 's': | ||
1543 | ErrorCheckStubData = _True; | 1556 | ErrorCheckStubData = _True; |
1557 | break; | ||
1544 | default: | 1558 | default: |
1545 | return FALSE; | 1559 | found = FALSE; |
1546 | } | 1560 | } |
1547 | break; | 1561 | break; |
1548 | case 0x5eb7af2: // /header filename | 1562 | case 0x5eb7af2: // /header filename |
1549 | offset = 5; | 1563 | offset = 5; |
1550 | case 0x0000358: // /h filename | 1564 | case 0x0000358: // /h filename |
1551 | HeaderFileName = option + offset + 3; | 1565 | HeaderFileName = option + offset + 3; |
1552 | break; | 1566 | break; |
1553 | case 0x0035ff4: // /iid filename | 1567 | case 0x0035ff4: // /iid filename |
1554 | InterfaceIdentifierFileName = option+5; | 1568 | InterfaceIdentifierFileName = option+5; |
1555 | break; | 1569 | break; |
1556 | case 0x64b7933: // /mktyplib203 | 1570 | case 0x64b7933: // /mktyplib203 |
1557 | MkTypLibCompatible = _True; | 1571 | MkTypLibCompatible = _True; |
1558 | break; | 1572 | break; |
1559 | case 0x8e0b0a2: // /no_def_idir | 1573 | case 0x8e0b0a2: // /no_def_idir |
1560 | IgnoreStandardIncludePath = _True; | 1574 | IgnoreStandardIncludePath = _True; |
1561 | break; | 1575 | break; |
@@ -1634,54 +1648,56 @@ bool VCMIDLTool::parseOption( const char* option ) | |||
1634 | case '0': | 1648 | case '0': |
1635 | WarningLevel = midlWarningLevel_0; | 1649 | WarningLevel = midlWarningLevel_0; |
1636 | break; | 1650 | break; |
1637 | case '1': | 1651 | case '1': |
1638 | WarningLevel = midlWarningLevel_1; | 1652 | WarningLevel = midlWarningLevel_1; |
1639 | break; | 1653 | break; |
1640 | case '2': | 1654 | case '2': |
1641 | WarningLevel = midlWarningLevel_2; | 1655 | WarningLevel = midlWarningLevel_2; |
1642 | break; | 1656 | break; |
1643 | case '3': | 1657 | case '3': |
1644 | WarningLevel = midlWarningLevel_3; | 1658 | WarningLevel = midlWarningLevel_3; |
1645 | break; | 1659 | break; |
1646 | case '4': | 1660 | case '4': |
1647 | WarningLevel = midlWarningLevel_4; | 1661 | WarningLevel = midlWarningLevel_4; |
1648 | break; | 1662 | break; |
1649 | default: | 1663 | default: |
1650 | return FALSE; | 1664 | found = FALSE; |
1651 | } | 1665 | } |
1652 | } | 1666 | } |
1653 | break; | 1667 | break; |
1654 | } | 1668 | } |
1669 | if( !found ) | ||
1670 | warn_msg( WarnLogic, "Could not parse MIDL option: %s", option ); | ||
1655 | return TRUE; | 1671 | return TRUE; |
1656 | } | 1672 | } |
1657 | 1673 | ||
1658 | // VCLibrarianTool -------------------------------------------------- | 1674 | // VCLibrarianTool -------------------------------------------------- |
1659 | VCLibrarianTool::VCLibrarianTool() | 1675 | VCLibrarianTool::VCLibrarianTool() |
1660 | :IgnoreAllDefaultLibraries( unset ), | 1676 | :IgnoreAllDefaultLibraries( unset ), |
1661 | SuppressStartupBanner( _True ) | 1677 | SuppressStartupBanner( _True ) |
1662 | { | 1678 | { |
1663 | } | 1679 | } |
1664 | 1680 | ||
1665 | QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) | 1681 | QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) |
1666 | { | 1682 | { |
1667 | strm << _begTool3; | 1683 | strm << _begTool3; |
1668 | strm << SPair( _ToolName, QString( "VCLibrarianTool" ) ); | 1684 | strm << SPair( _ToolName, QString( "VCLibrarianTool" ) ); |
1669 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies ); | 1685 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies ); |
1670 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); | 1686 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); |
1671 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); | 1687 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
1672 | strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); | 1688 | strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); |
1673 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); | 1689 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); |
1674 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); | 1690 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); |
1675 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); | 1691 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); |
1676 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); | 1692 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); |
1677 | strm << SPair( _OutputFile, tool.OutputFile ); | 1693 | strm << SPair( _OutputFile, tool.OutputFile ); |
1678 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 1694 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
1679 | strm << "/>"; | 1695 | strm << "/>"; |
1680 | return strm; | 1696 | return strm; |
1681 | } | 1697 | } |
1682 | 1698 | ||
1683 | // VCCustomBuildTool ------------------------------------------------ | 1699 | // VCCustomBuildTool ------------------------------------------------ |
1684 | VCCustomBuildTool::VCCustomBuildTool() | 1700 | VCCustomBuildTool::VCCustomBuildTool() |
1685 | { | 1701 | { |
1686 | ToolName = "VCCustomBuildTool"; | 1702 | ToolName = "VCCustomBuildTool"; |
1687 | } | 1703 | } |
@@ -1701,33 +1717,33 @@ QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | |||
1701 | 1717 | ||
1702 | // VCResourceCompilerTool ------------------------------------------- | 1718 | // VCResourceCompilerTool ------------------------------------------- |
1703 | VCResourceCompilerTool::VCResourceCompilerTool() | 1719 | VCResourceCompilerTool::VCResourceCompilerTool() |
1704 | : Culture( rcUseDefault ), | 1720 | : Culture( rcUseDefault ), |
1705 | IgnoreStandardIncludePath( unset ), | 1721 | IgnoreStandardIncludePath( unset ), |
1706 | ShowProgress( linkProgressNotSet ) | 1722 | ShowProgress( linkProgressNotSet ) |
1707 | { | 1723 | { |
1708 | PreprocessorDefinitions = "NDEBUG"; | 1724 | PreprocessorDefinitions = "NDEBUG"; |
1709 | } | 1725 | } |
1710 | 1726 | ||
1711 | QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) | 1727 | QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) |
1712 | { | 1728 | { |
1713 | strm << _begTool3; | 1729 | strm << _begTool3; |
1714 | strm << _VCResourceCompilerToolName; | 1730 | strm << _VCResourceCompilerToolName; |
1715 | strm << SPair( _ToolPath, tool.ToolPath ); | 1731 | strm << SPair( _ToolPath, tool.ToolPath ); |
1716 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 1732 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
1717 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); | 1733 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
1718 | if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); | 1734 | if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); |
1719 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); | 1735 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); |
1720 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); | 1736 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); |
1721 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); | 1737 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); |
1722 | strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName ); | 1738 | strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName ); |
1723 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); | 1739 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); |
1724 | strm << "/>"; | 1740 | strm << "/>"; |
1725 | return strm; | 1741 | return strm; |
1726 | } | 1742 | } |
1727 | 1743 | ||
1728 | // VCEventTool ------------------------------------------------- | 1744 | // VCEventTool ------------------------------------------------- |
1729 | QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool ) | 1745 | QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool ) |
1730 | { | 1746 | { |
1731 | strm << _begTool3; | 1747 | strm << _begTool3; |
1732 | strm << SPair( _ToolName, tool.ToolName ); | 1748 | strm << SPair( _ToolName, tool.ToolName ); |
1733 | strm << SPair( _ToolPath, tool.ToolPath ); | 1749 | strm << SPair( _ToolPath, tool.ToolPath ); |
@@ -1838,90 +1854,111 @@ void VCFilter::generateMOC( QTextStream &strm, QString str ) const | |||
1838 | strm << mocApp; | 1854 | strm << mocApp; |
1839 | strm << " " << str << " -o " << mocOutput << "\""; | 1855 | strm << " " << str << " -o " << mocOutput << "\""; |
1840 | strm << _AdditionalDependencies6; | 1856 | strm << _AdditionalDependencies6; |
1841 | strm << mocApp << "\""; | 1857 | strm << mocApp << "\""; |
1842 | strm << _Outputs6; | 1858 | strm << _Outputs6; |
1843 | strm << mocOutput << "\""; | 1859 | strm << mocOutput << "\""; |
1844 | strm << "/>"; | 1860 | strm << "/>"; |
1845 | strm << _endFileConfiguration; | 1861 | strm << _endFileConfiguration; |
1846 | } | 1862 | } |
1847 | 1863 | ||
1848 | void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | 1864 | void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const |
1849 | { | 1865 | { |
1850 | QString uicApp = Project->var("QMAKE_UIC"); | 1866 | QString uicApp = Project->var("QMAKE_UIC"); |
1851 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1867 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1852 | QString fname = str.section( '\\', -1 ); | 1868 | QString fname = str.section( '\\', -1 ); |
1853 | QString mocDir = Project->var( "MOC_DIR" ); | 1869 | QString mocDir = Project->var( "MOC_DIR" ); |
1870 | QString uiDir = Project->var( "UI_DIR" ); | ||
1871 | QString uiHeaders; | ||
1872 | QString uiSources; | ||
1873 | |||
1874 | // Determining the paths for the output files. | ||
1875 | int slash = str.findRev( '\\' ); | ||
1876 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); | ||
1877 | if( !uiDir.isEmpty() ) { | ||
1878 | uiHeaders = uiDir; | ||
1879 | uiSources = uiDir; | ||
1880 | } else { | ||
1881 | uiHeaders = Project->var( "UI_HEADERS_DIR" ); | ||
1882 | uiSources = Project->var( "UI_SOURCES_DIR" ); | ||
1883 | if( uiHeaders.isEmpty() ) | ||
1884 | uiHeaders = pname; | ||
1885 | if( uiSources.isEmpty() ) | ||
1886 | uiSources = pname; | ||
1887 | } | ||
1888 | if( !uiHeaders.endsWith( "\\" ) ) | ||
1889 | uiHeaders += "\\"; | ||
1890 | if( !uiSources.endsWith( "\\" ) ) | ||
1891 | uiSources += "\\"; | ||
1892 | |||
1893 | // Determine the file name. | ||
1854 | int dot = fname.findRev( '.' ); | 1894 | int dot = fname.findRev( '.' ); |
1855 | if( dot != -1 ) | 1895 | if( dot != -1 ) |
1856 | fname.truncate( dot ); | 1896 | fname.truncate( dot ); |
1857 | 1897 | ||
1858 | int slash = str.findRev( '\\' ); | ||
1859 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\"); | ||
1860 | |||
1861 | strm << _begFileConfiguration; | 1898 | strm << _begFileConfiguration; |
1862 | strm << _Name5; | 1899 | strm << _Name5; |
1863 | strm << Config->Name; | 1900 | strm << Config->Name; |
1864 | strm << "\">"; | 1901 | strm << "\">"; |
1865 | strm << _begTool5; | 1902 | strm << _begTool5; |
1866 | strm << _VCCustomBuildTool; | 1903 | strm << _VCCustomBuildTool; |
1867 | strm << _Description6; | 1904 | strm << _Description6; |
1868 | strm << "Uic'ing " << str << "...\""; | 1905 | strm << "Uic'ing " << str << "...\""; |
1869 | strm << _CommandLine6; | 1906 | strm << _CommandLine6; |
1870 | strm << uicApp << " " << str << " -o " << pname << fname << ".h && "; // Create .h from .ui file | 1907 | strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h && "; // Create .h from .ui file |
1871 | strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp && ";// Create .cpp from .ui file | 1908 | strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp && ";// Create .cpp from .ui file |
1872 | strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; | 1909 | strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; |
1873 | strm << _AdditionalDependencies6; | 1910 | strm << _AdditionalDependencies6; |
1874 | strm << mocApp << ";" << uicApp << "\""; | 1911 | strm << mocApp << ";" << uicApp << "\""; |
1875 | strm << _Outputs6; | 1912 | strm << _Outputs6; |
1876 | strm << pname << fname << ".h;" << pname << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; | 1913 | strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; |
1877 | strm << "/>"; | 1914 | strm << "/>"; |
1878 | strm << _endFileConfiguration; | 1915 | strm << _endFileConfiguration; |
1879 | } | 1916 | } |
1880 | 1917 | ||
1881 | QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | 1918 | QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) |
1882 | { | 1919 | { |
1883 | if ( tool.Files.count() == 0 ) | 1920 | if ( tool.Files.count() == 0 ) |
1884 | return strm; | 1921 | return strm; |
1885 | 1922 | ||
1886 | strm << _begFilter; | 1923 | strm << _begFilter; |
1887 | strm << SPair( _Name3, tool.Name ); | 1924 | strm << SPair( _Name3, tool.Name ); |
1888 | strm << TPair( _ParseFiles, tool.ParseFiles ); | 1925 | strm << TPair( _ParseFiles, tool.ParseFiles ); |
1889 | strm << SPair( _Filter, tool.Filter ); | 1926 | strm << SPair( _Filter, tool.Filter ); |
1890 | strm << ">"; | 1927 | strm << ">"; |
1891 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { | 1928 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { |
1892 | strm << _begFile; | 1929 | strm << _begFile; |
1893 | strm << SPair( _RelativePath, *it ); | 1930 | strm << SPair( _RelativePath, *it ); |
1894 | strm << ">"; | 1931 | strm << ">"; |
1895 | if ( tool.CustomBuild == moc ) | 1932 | if ( tool.CustomBuild == moc ) |
1896 | tool.generateMOC( strm, *it ); | 1933 | tool.generateMOC( strm, *it ); |
1897 | else if ( tool.CustomBuild == uic ) | 1934 | else if ( tool.CustomBuild == uic ) |
1898 | tool.generateUIC( strm, *it ); | 1935 | tool.generateUIC( strm, *it ); |
1899 | strm << _endFile; | 1936 | strm << _endFile; |
1900 | } | 1937 | } |
1901 | 1938 | ||
1902 | strm << _endFilter; | 1939 | strm << _endFilter; |
1903 | return strm; | 1940 | return strm; |
1904 | } | 1941 | } |
1905 | 1942 | ||
1906 | // VCProject -------------------------------------------------------- | 1943 | // VCProject -------------------------------------------------------- |
1907 | VCProject::VCProject() | 1944 | VCProject::VCProject() |
1908 | { | 1945 | { |
1909 | QUuid uniqueId; | ||
1910 | #if defined(Q_WS_WIN32) | 1946 | #if defined(Q_WS_WIN32) |
1911 | GUID guid; | 1947 | GUID guid; |
1948 | QUuid uniqueId; | ||
1912 | HRESULT h = CoCreateGuid( &guid ); | 1949 | HRESULT h = CoCreateGuid( &guid ); |
1913 | if ( h == S_OK ) | 1950 | if ( h == S_OK ) |
1914 | uniqueId = QUuid( guid ); | 1951 | uniqueId = QUuid( guid ); |
1915 | ProjectGUID = uniqueId.toString(); | 1952 | ProjectGUID = uniqueId.toString(); |
1916 | #else | 1953 | #else |
1917 | // Qt doesn't support GUID on other platforms yet | 1954 | // Qt doesn't support GUID on other platforms yet |
1918 | ProjectGUID = ""; | 1955 | ProjectGUID = ""; |
1919 | #endif | 1956 | #endif |
1920 | } | 1957 | } |
1921 | 1958 | ||
1922 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | 1959 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) |
1923 | { | 1960 | { |
1924 | strm << _xmlInit; | 1961 | strm << _xmlInit; |
1925 | strm << _begVisualStudioProject; | 1962 | strm << _begVisualStudioProject; |
1926 | strm << _ProjectType; | 1963 | strm << _ProjectType; |
1927 | strm << SPair( _Version1, tool.Version ); | 1964 | strm << SPair( _Version1, tool.Version ); |
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 2d09280..1dca68d 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h | |||
@@ -27,42 +27,42 @@ | |||
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | #ifndef __MSVC_OBJECTMODEL_H__ | 35 | #ifndef __MSVC_OBJECTMODEL_H__ |
36 | #define __MSVC_OBJECTMODEL_H__ | 36 | #define __MSVC_OBJECTMODEL_H__ |
37 | 37 | ||
38 | #include "project.h" | 38 | #include "project.h" |
39 | #include <qstring.h> | 39 | #include <qstring.h> |
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | This Object model is of course VERY simplyfied, | 43 | This Object model is of course VERY simplyfied, |
44 | and does not actually follow the original MSVC | 44 | and does not actually follow the original MSVC |
45 | object model. However, it fulfilles the basic | 45 | object model. However, it fulfilles the basic |
46 | needs for qmake | 46 | needs for qmake |
47 | */ | 47 | */ |
48 | 48 | ||
49 | /* | 49 | /* |
50 | If a triState value is 'unset' then the | 50 | If a triState value is 'unset' then the |
51 | corresponding property is not in the output, | 51 | corresponding property is not in the output, |
52 | forcing the tool to utilize default values. | 52 | forcing the tool to utilize default values. |
53 | False/True values will be in the output... | 53 | False/True values will be in the output... |
54 | */ | 54 | */ |
55 | enum customBuildCheck { | 55 | enum customBuildCheck { |
56 | none, | 56 | none, |
57 | moc, | 57 | moc, |
58 | uic, | 58 | uic, |
59 | lexyacc | 59 | lexyacc |
60 | }; | 60 | }; |
61 | enum triState { | 61 | enum triState { |
62 | unset = -1, | 62 | unset = -1, |
63 | _False = 0, | 63 | _False = 0, |
64 | _True = 1 | 64 | _True = 1 |
65 | }; | 65 | }; |
66 | enum addressAwarenessType { | 66 | enum addressAwarenessType { |
67 | addrAwareDefault, | 67 | addrAwareDefault, |
68 | addrAwareNoLarge, | 68 | addrAwareNoLarge, |
@@ -70,33 +70,33 @@ enum addressAwarenessType { | |||
70 | }; | 70 | }; |
71 | enum asmListingOption { | 71 | enum asmListingOption { |
72 | asmListingNone, | 72 | asmListingNone, |
73 | asmListingAssemblyOnly, | 73 | asmListingAssemblyOnly, |
74 | asmListingAsmMachineSrc, | 74 | asmListingAsmMachineSrc, |
75 | asmListingAsmMachine, | 75 | asmListingAsmMachine, |
76 | asmListingAsmSrc | 76 | asmListingAsmSrc |
77 | }; | 77 | }; |
78 | enum basicRuntimeCheckOption { | 78 | enum basicRuntimeCheckOption { |
79 | runtimeBasicCheckNone, | 79 | runtimeBasicCheckNone, |
80 | runtimeCheckStackFrame, | 80 | runtimeCheckStackFrame, |
81 | runtimeCheckUninitVariables, | 81 | runtimeCheckUninitVariables, |
82 | runtimeBasicCheckAll | 82 | runtimeBasicCheckAll |
83 | }; | 83 | }; |
84 | enum browseInfoOption { | 84 | enum browseInfoOption { |
85 | brInfoNone, | 85 | brInfoNone, |
86 | brAllInfo, | 86 | brAllInfo, |
87 | brNoLocalSymbols | 87 | brNoLocalSymbols |
88 | }; | 88 | }; |
89 | enum callingConventionOption { | 89 | enum callingConventionOption { |
90 | callConventionDefault = -1, | 90 | callConventionDefault = -1, |
91 | callConventionCDecl, | 91 | callConventionCDecl, |
92 | callConventionFastCall, | 92 | callConventionFastCall, |
93 | callConventionStdCall | 93 | callConventionStdCall |
94 | }; | 94 | }; |
95 | enum charSet { | 95 | enum charSet { |
96 | charSetNotSet, | 96 | charSetNotSet, |
97 | charSetUnicode, | 97 | charSetUnicode, |
98 | charSetMBCS | 98 | charSetMBCS |
99 | }; | 99 | }; |
100 | enum compileAsManagedOptions { | 100 | enum compileAsManagedOptions { |
101 | managedDefault = -1, | 101 | managedDefault = -1, |
102 | managedAssembly = 2 | 102 | managedAssembly = 2 |
@@ -105,39 +105,39 @@ enum CompileAsOptions{ | |||
105 | compileAsDefault, | 105 | compileAsDefault, |
106 | compileAsC, | 106 | compileAsC, |
107 | compileAsCPlusPlus | 107 | compileAsCPlusPlus |
108 | }; | 108 | }; |
109 | enum ConfigurationTypes { | 109 | enum ConfigurationTypes { |
110 | typeUnknown = 0, | 110 | typeUnknown = 0, |
111 | typeApplication = 1, | 111 | typeApplication = 1, |
112 | typeDynamicLibrary = 2, | 112 | typeDynamicLibrary = 2, |
113 | typeStaticLibrary = 4, | 113 | typeStaticLibrary = 4, |
114 | typeGeneric = 10 | 114 | typeGeneric = 10 |
115 | }; | 115 | }; |
116 | enum debugOption { | 116 | enum debugOption { |
117 | debugDisabled, | 117 | debugDisabled, |
118 | debugOldStyleInfo, | 118 | debugOldStyleInfo, |
119 | debugLineInfoOnly, | 119 | debugLineInfoOnly, |
120 | debugEnabled, | 120 | debugEnabled, |
121 | debugEditAndContinue | 121 | debugEditAndContinue |
122 | }; | 122 | }; |
123 | enum eAppProtectionOption { | 123 | enum eAppProtectionOption { |
124 | eAppProtectUnchanged, | 124 | eAppProtectUnchanged, |
125 | eAppProtectLow, | 125 | eAppProtectLow, |
126 | eAppProtectMedium, | 126 | eAppProtectMedium, |
127 | eAppProtectHigh | 127 | eAppProtectHigh |
128 | }; | 128 | }; |
129 | enum enumResourceLangID { | 129 | enum enumResourceLangID { |
130 | rcUseDefault = 0, | 130 | rcUseDefault = 0, |
131 | rcAfrikaans = 1078, | 131 | rcAfrikaans = 1078, |
132 | rcAlbanian = 1052, | 132 | rcAlbanian = 1052, |
133 | rcArabicAlgeria = 5121, | 133 | rcArabicAlgeria = 5121, |
134 | rcArabicBahrain = 15361, | 134 | rcArabicBahrain = 15361, |
135 | rcArabicEgypt = 3073, | 135 | rcArabicEgypt = 3073, |
136 | rcArabicIraq = 2049, | 136 | rcArabicIraq = 2049, |
137 | rcArabicJordan = 11265, | 137 | rcArabicJordan = 11265, |
138 | rcArabicKuwait = 13313, | 138 | rcArabicKuwait = 13313, |
139 | rcArabicLebanon = 12289, | 139 | rcArabicLebanon = 12289, |
140 | rcArabicLibya = 4097, | 140 | rcArabicLibya = 4097, |
141 | rcArabicMorocco = 6145, | 141 | rcArabicMorocco = 6145, |
142 | rcArabicOman = 8193, | 142 | rcArabicOman = 8193, |
143 | rcArabicQatar = 16385, | 143 | rcArabicQatar = 16385, |
@@ -218,213 +218,211 @@ enum enumResourceLangID { | |||
218 | rcSpanishTraditional= 1034, | 218 | rcSpanishTraditional= 1034, |
219 | rcSpanishUruguay = 14346, | 219 | rcSpanishUruguay = 14346, |
220 | rcSpanishVenezuela = 8202, | 220 | rcSpanishVenezuela = 8202, |
221 | rcSwedish = 1053, | 221 | rcSwedish = 1053, |
222 | rcThai = 1054, | 222 | rcThai = 1054, |
223 | rcTurkish = 1055, | 223 | rcTurkish = 1055, |
224 | rcUkrainian = 1058, | 224 | rcUkrainian = 1058, |
225 | rcUrdu = 1056 | 225 | rcUrdu = 1056 |
226 | }; | 226 | }; |
227 | enum enumSccEvent { | 227 | enum enumSccEvent { |
228 | eProjectInScc, | 228 | eProjectInScc, |
229 | ePreDirtyNotification | 229 | ePreDirtyNotification |
230 | }; | 230 | }; |
231 | enum favorSizeOrSpeedOption { | 231 | enum favorSizeOrSpeedOption { |
232 | favorNone, | 232 | favorNone, |
233 | favorSpeed, | 233 | favorSpeed, |
234 | favorSize | 234 | favorSize |
235 | }; | 235 | }; |
236 | enum genProxyLanguage { | 236 | enum genProxyLanguage { |
237 | genProxyNative, | 237 | genProxyNative, |
238 | genProxyManaged | 238 | genProxyManaged |
239 | }; | 239 | }; |
240 | enum inlineExpansionOption { | 240 | enum inlineExpansionOption { |
241 | expandDisable, | 241 | expandDisable, |
242 | expandOnlyInline, | 242 | expandOnlyInline, |
243 | expandAnySuitable | 243 | expandAnySuitable |
244 | }; | 244 | }; |
245 | enum linkIncrementalType { | 245 | enum linkIncrementalType { |
246 | linkIncrementalDefault, | 246 | linkIncrementalDefault, |
247 | linkIncrementalNo, | 247 | linkIncrementalNo, |
248 | linkIncrementalYes | 248 | linkIncrementalYes |
249 | }; | 249 | }; |
250 | enum linkProgressOption { | 250 | enum linkProgressOption { |
251 | linkProgressNotSet, | 251 | linkProgressNotSet, |
252 | linkProgressAll, | 252 | linkProgressAll, |
253 | linkProgressLibs | 253 | linkProgressLibs |
254 | }; | 254 | }; |
255 | enum machineTypeOption { | 255 | enum machineTypeOption { |
256 | machineNotSet, | 256 | machineNotSet, |
257 | machineX86 | 257 | machineX86 |
258 | }; | 258 | }; |
259 | enum midlCharOption { | 259 | enum midlCharOption { |
260 | midlCharUnsigned, | 260 | midlCharUnsigned, |
261 | midlCharSigned, | 261 | midlCharSigned, |
262 | midlCharAscii7 | 262 | midlCharAscii7 |
263 | }; | 263 | }; |
264 | enum midlErrorCheckOption { | 264 | enum midlErrorCheckOption { |
265 | midlEnableCustom, | 265 | midlEnableCustom, |
266 | midlDisableAll, | 266 | midlDisableAll, |
267 | midlEnableAll | 267 | midlEnableAll |
268 | }; | 268 | }; |
269 | enum midlStructMemberAlignOption { | 269 | enum midlStructMemberAlignOption { |
270 | midlAlignNotSet, | 270 | midlAlignNotSet, |
271 | midlAlignSingleByte, | 271 | midlAlignSingleByte, |
272 | midlAlignTwoBytes, | 272 | midlAlignTwoBytes, |
273 | midlAlignFourBytes, | 273 | midlAlignFourBytes, |
274 | midlAlignEightBytes, | 274 | midlAlignEightBytes, |
275 | midlAlignSixteenBytes | 275 | midlAlignSixteenBytes |
276 | }; | 276 | }; |
277 | enum midlTargetEnvironment { | 277 | enum midlTargetEnvironment { |
278 | midlTargetNotSet, | 278 | midlTargetNotSet, |
279 | midlTargetWin32, | 279 | midlTargetWin32, |
280 | midlTargetWin64 | 280 | midlTargetWin64 |
281 | }; | 281 | }; |
282 | enum midlWarningLevelOption { | 282 | enum midlWarningLevelOption { |
283 | midlWarningLevel_0, | 283 | midlWarningLevel_0, |
284 | midlWarningLevel_1, | 284 | midlWarningLevel_1, |
285 | midlWarningLevel_2, | 285 | midlWarningLevel_2, |
286 | midlWarningLevel_3, | 286 | midlWarningLevel_3, |
287 | midlWarningLevel_4 | 287 | midlWarningLevel_4 |
288 | }; | 288 | }; |
289 | enum optFoldingType { | 289 | enum optFoldingType { |
290 | optFoldingDefault, | 290 | optFoldingDefault, |
291 | optNoFolding, | 291 | optNoFolding, |
292 | optFolding | 292 | optFolding |
293 | }; | 293 | }; |
294 | enum optimizeOption { | 294 | enum optimizeOption { |
295 | optimizeDisabled, | 295 | optimizeDisabled, |
296 | optimizeMinSpace, | 296 | optimizeMinSpace, |
297 | optimizeMaxSpeed, | 297 | optimizeMaxSpeed, |
298 | optimizeFull, | 298 | optimizeFull, |
299 | optimizeCustom | 299 | optimizeCustom |
300 | }; | 300 | }; |
301 | enum optRefType { | 301 | enum optRefType { |
302 | optReferencesDefault, | 302 | optReferencesDefault, |
303 | optNoReferences, | 303 | optNoReferences, |
304 | optReferences | 304 | optReferences |
305 | }; | 305 | }; |
306 | enum optWin98Type { | 306 | enum optWin98Type { |
307 | optWin98Default, | 307 | optWin98Default, |
308 | optWin98No, | 308 | optWin98No, |
309 | optWin98Yes | 309 | optWin98Yes |
310 | }; | 310 | }; |
311 | enum pchOption { | 311 | enum pchOption { |
312 | pchNone, | 312 | pchNone, |
313 | pchCreateUsingSpecific, | 313 | pchCreateUsingSpecific, |
314 | pchGenerateAuto, | 314 | pchGenerateAuto, |
315 | pchUseUsingSpecific | 315 | pchUseUsingSpecific |
316 | }; | 316 | }; |
317 | enum preprocessOption { | 317 | enum preprocessOption { |
318 | preprocessNo, | 318 | preprocessNo, |
319 | preprocessYes, | 319 | preprocessYes, |
320 | preprocessNoLineNumbers | 320 | preprocessNoLineNumbers |
321 | }; | 321 | }; |
322 | enum ProcessorOptimizeOption { | 322 | enum ProcessorOptimizeOption { |
323 | procOptimizeBlended, | 323 | procOptimizeBlended, |
324 | procOptimizePentium, | 324 | procOptimizePentium, |
325 | procOptimizePentiumProAndAbove | 325 | procOptimizePentiumProAndAbove |
326 | }; | 326 | }; |
327 | enum RemoteDebuggerType { | 327 | enum RemoteDebuggerType { |
328 | DbgLocal, | 328 | DbgLocal, |
329 | DbgRemote, | 329 | DbgRemote, |
330 | DbgRemoteTCPIP | 330 | DbgRemoteTCPIP |
331 | }; | 331 | }; |
332 | enum runtimeLibraryOption { | 332 | enum runtimeLibraryOption { |
333 | rtMultiThreaded, | 333 | rtMultiThreaded, |
334 | rtMultiThreadedDebug, | 334 | rtMultiThreadedDebug, |
335 | rtMultiThreadedDLL, | 335 | rtMultiThreadedDLL, |
336 | rtMultiThreadedDebugDLL, | 336 | rtMultiThreadedDebugDLL, |
337 | rtSingleThreaded, | 337 | rtSingleThreaded, |
338 | rtSingleThreadedDebug | 338 | rtSingleThreadedDebug |
339 | }; | 339 | }; |
340 | enum structMemberAlignOption { | 340 | enum structMemberAlignOption { |
341 | alignNotSet, | 341 | alignNotSet, |
342 | alignSingleByte, | 342 | alignSingleByte, |
343 | alignTwoBytes, | 343 | alignTwoBytes, |
344 | alignFourBytes, | 344 | alignFourBytes, |
345 | alignEightBytes, | 345 | alignEightBytes, |
346 | alignSixteenBytes | 346 | alignSixteenBytes |
347 | }; | 347 | }; |
348 | enum subSystemOption { | 348 | enum subSystemOption { |
349 | subSystemNotSet, | 349 | subSystemNotSet, |
350 | subSystemConsole, | 350 | subSystemConsole, |
351 | subSystemWindows | 351 | subSystemWindows |
352 | }; | 352 | }; |
353 | enum termSvrAwarenessType { | 353 | enum termSvrAwarenessType { |
354 | termSvrAwareDefault, | 354 | termSvrAwareDefault, |
355 | termSvrAwareNo, | 355 | termSvrAwareNo, |
356 | termSvrAwareYes | 356 | termSvrAwareYes |
357 | }; | 357 | }; |
358 | enum toolSetType { | 358 | enum toolSetType { |
359 | toolSetUtility, | 359 | toolSetUtility, |
360 | toolSetMakefile, | 360 | toolSetMakefile, |
361 | toolSetLinker, | 361 | toolSetLinker, |
362 | toolSetLibrarian, | 362 | toolSetLibrarian, |
363 | toolSetAll | 363 | toolSetAll |
364 | }; | 364 | }; |
365 | enum TypeOfDebugger { | 365 | enum TypeOfDebugger { |
366 | DbgNativeOnly, | 366 | DbgNativeOnly, |
367 | DbgManagedOnly, | 367 | DbgManagedOnly, |
368 | DbgMixed, | 368 | DbgMixed, |
369 | DbgAuto | 369 | DbgAuto |
370 | }; | 370 | }; |
371 | enum useOfATL { | 371 | enum useOfATL { |
372 | useATLNotSet, | 372 | useATLNotSet, |
373 | useATLStatic, | 373 | useATLStatic, |
374 | useATLDynamic | 374 | useATLDynamic |
375 | }; | 375 | }; |
376 | enum useOfMfc { | 376 | enum useOfMfc { |
377 | useMfcStdWin, | 377 | useMfcStdWin, |
378 | useMfcStatic, | 378 | useMfcStatic, |
379 | useMfcDynamic | 379 | useMfcDynamic |
380 | }; | 380 | }; |
381 | enum warningLevelOption { | 381 | enum warningLevelOption { |
382 | warningLevel_0, | 382 | warningLevel_0, |
383 | warningLevel_1, | 383 | warningLevel_1, |
384 | warningLevel_2, | 384 | warningLevel_2, |
385 | warningLevel_3, | 385 | warningLevel_3, |
386 | warningLevel_4 | 386 | warningLevel_4 |
387 | }; | 387 | }; |
388 | 388 | ||
389 | class VCToolBase { | 389 | class VCToolBase { |
390 | protected: | 390 | protected: |
391 | // Functions | 391 | // Functions |
392 | VCToolBase(){}; | 392 | VCToolBase(){}; |
393 | ~VCToolBase(){}; | 393 | virtual ~VCToolBase(){} |
394 | virtual bool parseOption( const char* option ) = 0; | 394 | virtual bool parseOption( const char* option ) = 0; |
395 | public: | 395 | public: |
396 | bool parseOptions( QStringList& options ) { | 396 | void parseOptions( QStringList& options ) { |
397 | bool result = TRUE; | 397 | for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ ) |
398 | for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()) && result; it++ ) | 398 | parseOption( (*it).latin1() ); |
399 | result = parseOption( (*it).latin1() ); | ||
400 | return result; | ||
401 | } | 399 | } |
402 | }; | 400 | }; |
403 | 401 | ||
404 | class VCConfiguration; | 402 | class VCConfiguration; |
405 | class VCProject; | 403 | class VCProject; |
406 | 404 | ||
407 | class VCCLCompilerTool : public VCToolBase | 405 | class VCCLCompilerTool : public VCToolBase |
408 | { | 406 | { |
409 | public: | 407 | public: |
410 | // Functions | 408 | // Functions |
411 | VCCLCompilerTool(); | 409 | VCCLCompilerTool(); |
412 | ~VCCLCompilerTool(){}; | 410 | virtual ~VCCLCompilerTool(){} |
413 | virtual bool parseOption( const char* option ); | 411 | bool parseOption( const char* option ); |
414 | 412 | ||
415 | // Variables | 413 | // Variables |
416 | QStringList AdditionalIncludeDirectories; | 414 | QStringList AdditionalIncludeDirectories; |
417 | QStringList AdditionalOptions; | 415 | QStringList AdditionalOptions; |
418 | QStringList AdditionalUsingDirectories; | 416 | QStringList AdditionalUsingDirectories; |
419 | QString AssemblerListingLocation; | 417 | QString AssemblerListingLocation; |
420 | asmListingOption AssemblerOutput; | 418 | asmListingOption AssemblerOutput; |
421 | basicRuntimeCheckOption BasicRuntimeChecks; | 419 | basicRuntimeCheckOption BasicRuntimeChecks; |
422 | browseInfoOption BrowseInformation; | 420 | browseInfoOption BrowseInformation; |
423 | QString BrowseInformationFile; | 421 | QString BrowseInformationFile; |
424 | triState BufferSecurityCheck; | 422 | triState BufferSecurityCheck; |
425 | callingConventionOption CallingConvention; | 423 | callingConventionOption CallingConvention; |
426 | CompileAsOptions CompileAs; | 424 | CompileAsOptions CompileAs; |
427 | compileAsManagedOptions CompileAsManaged; | 425 | compileAsManagedOptions CompileAsManaged; |
428 | triState CompileOnly; | 426 | triState CompileOnly; |
429 | debugOption DebugInformationFormat; | 427 | debugOption DebugInformationFormat; |
430 | triState DefaultCharIsUnsigned; | 428 | triState DefaultCharIsUnsigned; |
@@ -467,34 +465,34 @@ public: | |||
467 | triState TreatWChar_tAsBuiltInType; | 465 | triState TreatWChar_tAsBuiltInType; |
468 | triState TurnOffAssemblyGeneration; | 466 | triState TurnOffAssemblyGeneration; |
469 | triState UndefineAllPreprocessorDefinitions; | 467 | triState UndefineAllPreprocessorDefinitions; |
470 | QStringList UndefinePreprocessorDefinitions; | 468 | QStringList UndefinePreprocessorDefinitions; |
471 | pchOption UsePrecompiledHeader; | 469 | pchOption UsePrecompiledHeader; |
472 | triState WarnAsError; | 470 | triState WarnAsError; |
473 | warningLevelOption WarningLevel; | 471 | warningLevelOption WarningLevel; |
474 | triState WholeProgramOptimization; | 472 | triState WholeProgramOptimization; |
475 | VCConfiguration* config; | 473 | VCConfiguration* config; |
476 | }; | 474 | }; |
477 | 475 | ||
478 | class VCLinkerTool : public VCToolBase | 476 | class VCLinkerTool : public VCToolBase |
479 | { | 477 | { |
480 | public: | 478 | public: |
481 | // Functions | 479 | // Functions |
482 | VCLinkerTool(); | 480 | VCLinkerTool(); |
483 | ~VCLinkerTool(){}; | 481 | virtual ~VCLinkerTool(){} |
484 | virtual bool parseOption( const char* option ); | 482 | bool parseOption( const char* option ); |
485 | 483 | ||
486 | // Variables | 484 | // Variables |
487 | QStringList AdditionalDependencies; | 485 | QStringList AdditionalDependencies; |
488 | QStringList AdditionalLibraryDirectories; | 486 | QStringList AdditionalLibraryDirectories; |
489 | QStringList AdditionalOptions; | 487 | QStringList AdditionalOptions; |
490 | QStringList AddModuleNamesToAssembly; | 488 | QStringList AddModuleNamesToAssembly; |
491 | QString BaseAddress; | 489 | QString BaseAddress; |
492 | QStringList DelayLoadDLLs; | 490 | QStringList DelayLoadDLLs; |
493 | optFoldingType EnableCOMDATFolding; | 491 | optFoldingType EnableCOMDATFolding; |
494 | QString EntryPointSymbol; | 492 | QString EntryPointSymbol; |
495 | QStringList ForceSymbolReferences; | 493 | QStringList ForceSymbolReferences; |
496 | QString FunctionOrder; | 494 | QString FunctionOrder; |
497 | triState GenerateDebugInformation; | 495 | triState GenerateDebugInformation; |
498 | triState GenerateMapFile; | 496 | triState GenerateMapFile; |
499 | long HeapCommitSize; | 497 | long HeapCommitSize; |
500 | long HeapReserveSize; | 498 | long HeapReserveSize; |
@@ -532,34 +530,34 @@ public: | |||
532 | triState SwapRunFromCD; | 530 | triState SwapRunFromCD; |
533 | triState SwapRunFromNet; | 531 | triState SwapRunFromNet; |
534 | machineTypeOption TargetMachine; | 532 | machineTypeOption TargetMachine; |
535 | termSvrAwarenessType TerminalServerAware; | 533 | termSvrAwarenessType TerminalServerAware; |
536 | triState TurnOffAssemblyGeneration; | 534 | triState TurnOffAssemblyGeneration; |
537 | QString TypeLibraryFile; | 535 | QString TypeLibraryFile; |
538 | long TypeLibraryResourceID; | 536 | long TypeLibraryResourceID; |
539 | QString Version; | 537 | QString Version; |
540 | VCConfiguration* config; | 538 | VCConfiguration* config; |
541 | }; | 539 | }; |
542 | 540 | ||
543 | class VCMIDLTool : public VCToolBase | 541 | class VCMIDLTool : public VCToolBase |
544 | { | 542 | { |
545 | public: | 543 | public: |
546 | // Functions | 544 | // Functions |
547 | VCMIDLTool(); | 545 | VCMIDLTool(); |
548 | ~VCMIDLTool(){}; | 546 | virtual ~VCMIDLTool(){} |
549 | virtual bool parseOption( const char* option ); | 547 | bool parseOption( const char* option ); |
550 | 548 | ||
551 | // Variables | 549 | // Variables |
552 | QStringList AdditionalIncludeDirectories; | 550 | QStringList AdditionalIncludeDirectories; |
553 | QStringList AdditionalOptions; | 551 | QStringList AdditionalOptions; |
554 | QStringList CPreprocessOptions; | 552 | QStringList CPreprocessOptions; |
555 | midlCharOption DefaultCharType; | 553 | midlCharOption DefaultCharType; |
556 | QString DLLDataFileName; // Should be list? | 554 | QString DLLDataFileName; // Should be list? |
557 | midlErrorCheckOption EnableErrorChecks; | 555 | midlErrorCheckOption EnableErrorChecks; |
558 | triState ErrorCheckAllocations; | 556 | triState ErrorCheckAllocations; |
559 | triState ErrorCheckBounds; | 557 | triState ErrorCheckBounds; |
560 | triState ErrorCheckEnumRange; | 558 | triState ErrorCheckEnumRange; |
561 | triState ErrorCheckRefPointers; | 559 | triState ErrorCheckRefPointers; |
562 | triState ErrorCheckStubData; | 560 | triState ErrorCheckStubData; |
563 | QStringList FullIncludePath; | 561 | QStringList FullIncludePath; |
564 | triState GenerateStublessProxies; | 562 | triState GenerateStublessProxies; |
565 | triState GenerateTypeLibrary; | 563 | triState GenerateTypeLibrary; |
@@ -574,129 +572,129 @@ public: | |||
574 | midlStructMemberAlignOption StructMemberAlignment; | 572 | midlStructMemberAlignOption StructMemberAlignment; |
575 | triState SuppressStartupBanner; | 573 | triState SuppressStartupBanner; |
576 | midlTargetEnvironment TargetEnvironment; | 574 | midlTargetEnvironment TargetEnvironment; |
577 | QString TypeLibraryName; | 575 | QString TypeLibraryName; |
578 | QStringList UndefinePreprocessorDefinitions; | 576 | QStringList UndefinePreprocessorDefinitions; |
579 | triState ValidateParameters; | 577 | triState ValidateParameters; |
580 | triState WarnAsError; | 578 | triState WarnAsError; |
581 | midlWarningLevelOption WarningLevel; | 579 | midlWarningLevelOption WarningLevel; |
582 | VCConfiguration* config; | 580 | VCConfiguration* config; |
583 | }; | 581 | }; |
584 | 582 | ||
585 | class VCLibrarianTool : public VCToolBase | 583 | class VCLibrarianTool : public VCToolBase |
586 | { | 584 | { |
587 | public: | 585 | public: |
588 | // Functions | 586 | // Functions |
589 | VCLibrarianTool(); | 587 | VCLibrarianTool(); |
590 | ~VCLibrarianTool(){}; | 588 | virtual ~VCLibrarianTool(){} |
591 | virtual bool parseOption( const char* option ){ return FALSE; }; | 589 | bool parseOption( const char* ){ return FALSE; }; |
592 | 590 | ||
593 | // Variables | 591 | // Variables |
594 | QStringList AdditionalDependencies; | 592 | QStringList AdditionalDependencies; |
595 | QStringList AdditionalLibraryDirectories; | 593 | QStringList AdditionalLibraryDirectories; |
596 | QStringList AdditionalOptions; | 594 | QStringList AdditionalOptions; |
597 | QStringList ExportNamedFunctions; | 595 | QStringList ExportNamedFunctions; |
598 | QStringList ForceSymbolReferences; | 596 | QStringList ForceSymbolReferences; |
599 | triState IgnoreAllDefaultLibraries; | 597 | triState IgnoreAllDefaultLibraries; |
600 | QStringList IgnoreDefaultLibraryNames; | 598 | QStringList IgnoreDefaultLibraryNames; |
601 | QString ModuleDefinitionFile; | 599 | QString ModuleDefinitionFile; |
602 | QString OutputFile; | 600 | QString OutputFile; |
603 | triState SuppressStartupBanner; | 601 | triState SuppressStartupBanner; |
604 | }; | 602 | }; |
605 | 603 | ||
606 | class VCCustomBuildTool : public VCToolBase | 604 | class VCCustomBuildTool : public VCToolBase |
607 | { | 605 | { |
608 | public: | 606 | public: |
609 | // Functions | 607 | // Functions |
610 | VCCustomBuildTool(); | 608 | VCCustomBuildTool(); |
611 | ~VCCustomBuildTool(){}; | 609 | virtual ~VCCustomBuildTool(){} |
612 | virtual bool parseOption( const char* option ){ return FALSE; }; | 610 | bool parseOption( const char* ){ return FALSE; }; |
613 | 611 | ||
614 | // Variables | 612 | // Variables |
615 | QStringList AdditionalDependencies; | 613 | QStringList AdditionalDependencies; |
616 | QString CommandLine; | 614 | QString CommandLine; |
617 | QString Description; | 615 | QString Description; |
618 | QString Outputs; | 616 | QString Outputs; |
619 | QString ToolName; | 617 | QString ToolName; |
620 | QString ToolPath; | 618 | QString ToolPath; |
621 | }; | 619 | }; |
622 | 620 | ||
623 | class VCResourceCompilerTool : public VCToolBase | 621 | class VCResourceCompilerTool : public VCToolBase |
624 | { | 622 | { |
625 | public: | 623 | public: |
626 | // Functions | 624 | // Functions |
627 | VCResourceCompilerTool(); | 625 | VCResourceCompilerTool(); |
628 | ~VCResourceCompilerTool(){}; | 626 | virtual ~VCResourceCompilerTool(){} |
629 | virtual bool parseOption( const char* option ){ return FALSE; }; | 627 | bool parseOption( const char* ){ return FALSE; }; |
630 | 628 | ||
631 | // Variables | 629 | // Variables |
632 | QStringList AdditionalIncludeDirectories; | 630 | QStringList AdditionalIncludeDirectories; |
633 | QStringList AdditionalOptions; | 631 | QStringList AdditionalOptions; |
634 | enumResourceLangID Culture; | 632 | enumResourceLangID Culture; |
635 | QStringList FullIncludePath; | 633 | QStringList FullIncludePath; |
636 | triState IgnoreStandardIncludePath; | 634 | triState IgnoreStandardIncludePath; |
637 | QStringList PreprocessorDefinitions; | 635 | QStringList PreprocessorDefinitions; |
638 | QString ResourceOutputFileName; | 636 | QString ResourceOutputFileName; |
639 | linkProgressOption ShowProgress; | 637 | linkProgressOption ShowProgress; |
640 | QString ToolPath; | 638 | QString ToolPath; |
641 | }; | 639 | }; |
642 | 640 | ||
643 | class VCEventTool : public VCToolBase | 641 | class VCEventTool : public VCToolBase |
644 | { | 642 | { |
645 | protected: | 643 | protected: |
646 | // Functions | 644 | // Functions |
647 | VCEventTool() : ExcludedFromBuild( unset ){}; | 645 | VCEventTool() : ExcludedFromBuild( unset ){}; |
648 | ~VCEventTool(){}; | 646 | virtual ~VCEventTool(){} |
649 | virtual bool parseOption( const char* option ){ return FALSE; }; | 647 | bool parseOption( const char* ){ return FALSE; }; |
650 | 648 | ||
651 | public: | 649 | public: |
652 | // Variables | 650 | // Variables |
653 | QString CommandLine; | 651 | QString CommandLine; |
654 | QString Description; | 652 | QString Description; |
655 | triState ExcludedFromBuild; | 653 | triState ExcludedFromBuild; |
656 | QString ToolName; | 654 | QString ToolName; |
657 | QString ToolPath; | 655 | QString ToolPath; |
658 | }; | 656 | }; |
659 | 657 | ||
660 | class VCPostBuildEventTool : public VCEventTool | 658 | class VCPostBuildEventTool : public VCEventTool |
661 | { | 659 | { |
662 | public: | 660 | public: |
663 | VCPostBuildEventTool(); | 661 | VCPostBuildEventTool(); |
664 | ~VCPostBuildEventTool(){}; | 662 | ~VCPostBuildEventTool(){} |
665 | }; | 663 | }; |
666 | 664 | ||
667 | class VCPreBuildEventTool : public VCEventTool | 665 | class VCPreBuildEventTool : public VCEventTool |
668 | { | 666 | { |
669 | public: | 667 | public: |
670 | VCPreBuildEventTool(); | 668 | VCPreBuildEventTool(); |
671 | ~VCPreBuildEventTool(){}; | 669 | ~VCPreBuildEventTool(){} |
672 | }; | 670 | }; |
673 | 671 | ||
674 | class VCPreLinkEventTool : public VCEventTool | 672 | class VCPreLinkEventTool : public VCEventTool |
675 | { | 673 | { |
676 | public: | 674 | public: |
677 | VCPreLinkEventTool(); | 675 | VCPreLinkEventTool(); |
678 | ~VCPreLinkEventTool(){}; | 676 | ~VCPreLinkEventTool(){} |
679 | }; | 677 | }; |
680 | 678 | ||
681 | class VCConfiguration | 679 | class VCConfiguration |
682 | { | 680 | { |
683 | public: | 681 | public: |
684 | // Functions | 682 | // Functions |
685 | VCConfiguration(); | 683 | VCConfiguration(); |
686 | ~VCConfiguration(){}; | 684 | ~VCConfiguration(){} |
687 | 685 | ||
688 | // Variables | 686 | // Variables |
689 | triState ATLMinimizesCRunTimeLibraryUsage; | 687 | triState ATLMinimizesCRunTimeLibraryUsage; |
690 | triState BuildBrowserInformation; | 688 | triState BuildBrowserInformation; |
691 | charSet CharacterSet; | 689 | charSet CharacterSet; |
692 | ConfigurationTypesConfigurationType; | 690 | ConfigurationTypesConfigurationType; |
693 | QString DeleteExtensionsOnClean; | 691 | QString DeleteExtensionsOnClean; |
694 | QString ImportLibrary; | 692 | QString ImportLibrary; |
695 | QString IntermediateDirectory; | 693 | QString IntermediateDirectory; |
696 | QString Name; | 694 | QString Name; |
697 | QString OutputDirectory; | 695 | QString OutputDirectory; |
698 | QString PrimaryOutput; | 696 | QString PrimaryOutput; |
699 | QString ProgramDatabase; | 697 | QString ProgramDatabase; |
700 | triState RegisterOutput; | 698 | triState RegisterOutput; |
701 | useOfATL UseOfATL; | 699 | useOfATL UseOfATL; |
702 | useOfMfc UseOfMfc; | 700 | useOfMfc UseOfMfc; |
@@ -707,52 +705,52 @@ public: | |||
707 | VCLinkerTool linker; | 705 | VCLinkerTool linker; |
708 | VCLibrarianTool librarian; | 706 | VCLibrarianTool librarian; |
709 | VCCustomBuildTool custom; | 707 | VCCustomBuildTool custom; |
710 | VCMIDLTool idl; | 708 | VCMIDLTool idl; |
711 | VCPostBuildEventTool postBuild; | 709 | VCPostBuildEventTool postBuild; |
712 | VCPreBuildEventTool preBuild; | 710 | VCPreBuildEventTool preBuild; |
713 | VCPreLinkEventTool preLink; | 711 | VCPreLinkEventTool preLink; |
714 | VCResourceCompilerTool resource; | 712 | VCResourceCompilerTool resource; |
715 | }; | 713 | }; |
716 | 714 | ||
717 | class VcprojGenerator; | 715 | class VcprojGenerator; |
718 | class VCFilter | 716 | class VCFilter |
719 | { | 717 | { |
720 | public: | 718 | public: |
721 | // Functions | 719 | // Functions |
722 | VCFilter(); | 720 | VCFilter(); |
723 | ~VCFilter(){}; | 721 | ~VCFilter(){} |
724 | void generateMOC( QTextStream &strm, QString str ) const; | 722 | void generateMOC( QTextStream &strm, QString str ) const; |
725 | void generateUIC( QTextStream &strm, const QString& str ) const; | 723 | void generateUIC( QTextStream &strm, const QString& str ) const; |
726 | 724 | ||
727 | // Variables | 725 | // Variables |
728 | QString Name; | 726 | QString Name; |
729 | QString Filter; | 727 | QString Filter; |
730 | triState ParseFiles; | 728 | triState ParseFiles; |
731 | QStringList Files; | 729 | QStringList Files; |
732 | VcprojGenerator*Project; | 730 | VcprojGenerator*Project; |
733 | VCConfiguration*Config; | 731 | VCConfiguration*Config; |
734 | customBuildCheckCustomBuild; | 732 | customBuildCheckCustomBuild; |
735 | }; | 733 | }; |
736 | 734 | ||
737 | class VCProject | 735 | class VCProject |
738 | { | 736 | { |
739 | public: | 737 | public: |
740 | // Functions | 738 | // Functions |
741 | VCProject(); | 739 | VCProject(); |
742 | ~VCProject(){}; | 740 | ~VCProject(){} |
743 | 741 | ||
744 | // Variables | 742 | // Variables |
745 | QString Name; | 743 | QString Name; |
746 | QString Version; | 744 | QString Version; |
747 | QString ProjectGUID; | 745 | QString ProjectGUID; |
748 | QString SccProjectName; | 746 | QString SccProjectName; |
749 | QString SccLocalPath; | 747 | QString SccLocalPath; |
750 | QString PlatformName; | 748 | QString PlatformName; |
751 | 749 | ||
752 | // XML sub-parts | 750 | // XML sub-parts |
753 | VCConfigurationConfiguration; | 751 | VCConfigurationConfiguration; |
754 | VCFilter SourceFiles; | 752 | VCFilter SourceFiles; |
755 | VCFilter HeaderFiles; | 753 | VCFilter HeaderFiles; |
756 | VCFilter MOCFiles; | 754 | VCFilter MOCFiles; |
757 | VCFilter UICFiles; | 755 | VCFilter UICFiles; |
758 | VCFilter FormFiles; | 756 | VCFilter FormFiles; |
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a2bb6e9..d2cbc31 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp | |||
@@ -1,200 +1,316 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Definition of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "msvc_vcproj.h" | 38 | #include "msvc_vcproj.h" |
39 | #include "option.h" | 39 | #include "option.h" |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <stdlib.h> | ||
42 | #include <qregexp.h> | 41 | #include <qregexp.h> |
42 | #include <qdict.h> | ||
43 | #include <quuid.h> | ||
44 | #include <stdlib.h> | ||
43 | 45 | ||
44 | #if defined(Q_OS_WIN32) | 46 | #if defined(Q_OS_WIN32) |
45 | #include <objbase.h> | 47 | #include <objbase.h> |
48 | #ifndef GUID_DEFINED | ||
49 | #define GUID_DEFINED | ||
50 | typedef struct _GUID | ||
51 | { | ||
52 | ulong Data1; | ||
53 | ushort Data2; | ||
54 | ushort Data3; | ||
55 | uchar Data4[8]; | ||
56 | } GUID; | ||
57 | #endif | ||
46 | #endif | 58 | #endif |
47 | 59 | ||
60 | // Flatfile Tags ---------------------------------------------------- | ||
61 | const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00"; | ||
62 | // The following UUID _may_ change for later servicepacks... | ||
63 | // If so we need to search through the registry at | ||
64 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects | ||
65 | // to find the subkey that contains a "PossibleProjectExtension" | ||
66 | // containing "vcproj"... | ||
67 | // Use the hardcoded value for now so projects generated on other | ||
68 | // platforms are actually usable. | ||
69 | const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; | ||
70 | const char* _snlProjectBeg= "\nProject(\""; | ||
71 | const char* _snlProjectMid= "\") = "; | ||
72 | const char* _snlProjectEnd= "\nEndProject"; | ||
73 | const char* _snlGlobalBeg= "\nGlobal"; | ||
74 | const char* _snlGlobalEnd= "\nEndGlobal"; | ||
75 | const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" | ||
76 | "\n\t\tConfigName.0 = Release" | ||
77 | "\n\tEndGlobalSection"; | ||
78 | const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; | ||
79 | const char* _snlProjDepEnd= "\n\tEndGlobalSection"; | ||
80 | const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; | ||
81 | const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32"; | ||
82 | const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32"; | ||
83 | const char* _snlProjConfEnd= "\n\tEndGlobalSection"; | ||
84 | const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | ||
85 | "\n\tEndGlobalSection" | ||
86 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" | ||
87 | "\n\tEndGlobalSection"; | ||
88 | // ------------------------------------------------------------------ | ||
89 | |||
48 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 90 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
49 | { | 91 | { |
50 | } | 92 | } |
51 | 93 | ||
52 | /* \internal | 94 | /* \internal |
53 | Generates a project file for the given profile. | 95 | Generates a project file for the given profile. |
54 | Options are either a Visual Studio projectfiles, or | 96 | Options are either a Visual Studio projectfiles, or |
55 | recursive projectfiles.. Maybe we can make .sln files | 97 | solutionfiles by parsing recursive projectdirectories. |
56 | someday? | ||
57 | */ | 98 | */ |
58 | bool VcprojGenerator::writeMakefile(QTextStream &t) | 99 | bool VcprojGenerator::writeMakefile(QTextStream &t) |
59 | { | 100 | { |
60 | // Check if all requirements are fullfilled | 101 | // Check if all requirements are fullfilled |
61 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 102 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 103 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 104 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
64 | return TRUE; | 105 | return TRUE; |
65 | } | 106 | } |
66 | 107 | ||
67 | // Generate full project file | 108 | // Generate project file |
68 | if(project->first("TEMPLATE") == "vcapp" || | 109 | if(project->first("TEMPLATE") == "vcapp" || |
69 | project->first("TEMPLATE") == "vclib") { | 110 | project->first("TEMPLATE") == "vclib") { |
70 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); | 111 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); |
71 | t << vcProject; | 112 | t << vcProject; |
72 | return TRUE; | 113 | return TRUE; |
73 | } else if(project->first("TEMPLATE") == "vcsubdirs") { // Generate recursive project | 114 | } |
115 | // Generate solution file | ||
116 | else if(project->first("TEMPLATE") == "vcsubdirs") { | ||
74 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); | 117 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); |
75 | writeSubDirs(t); | 118 | writeSubDirs(t); |
76 | return TRUE; | 119 | return TRUE; |
77 | } | 120 | } |
78 | return FALSE; | 121 | return FALSE; |
79 | 122 | ||
80 | } | 123 | } |
81 | 124 | ||
82 | struct VcsolutionDepend { | 125 | struct VcsolutionDepend { |
126 | QString uuid; | ||
83 | QString vcprojFile, orig_target, target; | 127 | QString vcprojFile, orig_target, target; |
128 | ::target targetType; | ||
84 | QStringList dependencies; | 129 | QStringList dependencies; |
85 | }; | 130 | }; |
86 | 131 | ||
132 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) | ||
133 | { | ||
134 | QUuid result( id ); | ||
135 | Q_LONG dataFirst = (result.data4[0] << 24) + | ||
136 | (result.data4[1] << 16) + | ||
137 | (result.data4[2] << 8) + | ||
138 | result.data4[3]; | ||
139 | Q_LONG dataLast = (result.data4[4] << 24) + | ||
140 | (result.data4[5] << 16) + | ||
141 | (result.data4[6] << 8) + | ||
142 | result.data4[7]; | ||
143 | |||
144 | if ( !(dataLast++) ) | ||
145 | dataFirst++; | ||
146 | |||
147 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); | ||
148 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); | ||
149 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); | ||
150 | result.data4[3] = uchar( dataFirst & 0xff); | ||
151 | result.data4[4] = uchar((dataLast >> 24) & 0xff); | ||
152 | result.data4[5] = uchar((dataLast >> 16) & 0xff); | ||
153 | result.data4[6] = uchar((dataLast >> 8) & 0xff); | ||
154 | result.data4[7] = uchar( dataLast & 0xff); | ||
155 | return result; | ||
156 | } | ||
157 | |||
87 | void VcprojGenerator::writeSubDirs(QTextStream &t) | 158 | void VcprojGenerator::writeSubDirs(QTextStream &t) |
88 | { | 159 | { |
89 | if(project->first("TEMPLATE") == "subdirs") { | 160 | if(project->first("TEMPLATE") == "subdirs") { |
90 | writeHeader(t); | 161 | writeHeader(t); |
91 | Win32MakefileGenerator::writeSubDirs(t); | 162 | Win32MakefileGenerator::writeSubDirs(t); |
92 | return; | 163 | return; |
93 | } | 164 | } |
94 | 165 | ||
95 | QPtrList<VcsolutionDepend> solution_depends; | 166 | t << _snlHeader; |
96 | solution_depends.setAutoDelete(TRUE); | 167 | QUuid solutionGUID; |
168 | #if defined(Q_WS_WIN32) | ||
169 | GUID guid; | ||
170 | HRESULT h = CoCreateGuid( &guid ); | ||
171 | if ( h == S_OK ) | ||
172 | solutionGUID = QUuid( guid ); | ||
173 | #else | ||
174 | // Qt doesn't support GUID on other platforms yet, | ||
175 | // so we use the all-zero uuid, and increase that. | ||
176 | #endif | ||
177 | |||
178 | |||
179 | QDict<VcsolutionDepend> solution_depends; | ||
180 | QPtrList<VcsolutionDepend> solution_cleanup; | ||
181 | solution_cleanup.setAutoDelete(TRUE); | ||
97 | QStringList subdirs = project->variables()["SUBDIRS"]; | 182 | QStringList subdirs = project->variables()["SUBDIRS"]; |
98 | QString oldpwd = QDir::currentDirPath(); | 183 | QString oldpwd = QDir::currentDirPath(); |
99 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | 184 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { |
100 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | 185 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); |
101 | if(fi.exists()) { | 186 | if(fi.exists()) { |
102 | if(fi.isDir()) { | 187 | if(fi.isDir()) { |
103 | QString profile = (*it); | 188 | QString profile = (*it); |
104 | if(!profile.endsWith(Option::dir_sep)) | 189 | if(!profile.endsWith(Option::dir_sep)) |
105 | profile += Option::dir_sep; | 190 | profile += Option::dir_sep; |
106 | profile += fi.baseName() + ".pro"; | 191 | profile += fi.baseName() + ".pro"; |
107 | subdirs.append(profile); | 192 | subdirs.append(profile); |
108 | } else { | 193 | } else { |
109 | QMakeProject tmp_proj; | 194 | QMakeProject tmp_proj; |
110 | QString dir = fi.dirPath(), fn = fi.fileName(); | 195 | QString dir = fi.dirPath(), fn = fi.fileName(); |
111 | if(!dir.isEmpty()) { | 196 | if(!dir.isEmpty()) { |
112 | if(!QDir::setCurrent(dir)) | 197 | if(!QDir::setCurrent(dir)) |
113 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | 198 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); |
114 | } | 199 | } |
115 | if(tmp_proj.read(fn, oldpwd)) { | 200 | if(tmp_proj.read(fn, oldpwd)) { |
116 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { | 201 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { |
117 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); | 202 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); |
118 | subdirs += tmp_subdirs; | 203 | subdirs += tmp_subdirs; |
119 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || | 204 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { |
120 | tmp_proj.first("TEMPLATE") == "vclib") { | 205 | // Initialize a 'fake' project to get the correct variables |
121 | QString vcproj = fi.baseName() + project->first("VCPROJ_EXTENSION"); | 206 | // and to be able to extract all the dependencies |
122 | if(QFile::exists(vcproj) || 1) { | 207 | VcprojGenerator tmp_vcproj(&tmp_proj); |
123 | VcprojGenerator tmp_dsp(&tmp_proj); | 208 | tmp_vcproj.setNoIO(TRUE); |
124 | tmp_dsp.setNoIO(TRUE); | 209 | tmp_vcproj.init(); |
125 | tmp_dsp.init(); | 210 | if(Option::debug_level) { |
126 | if(Option::debug_level) { | 211 | QMap<QString, QStringList> &vars = tmp_proj.variables(); |
127 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | 212 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); |
128 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | 213 | it != vars.end(); ++it) { |
129 | it != vars.end(); ++it) { | 214 | if(it.key().left(1) != "." && !it.data().isEmpty()) |
130 | if(it.key().left(1) != "." && !it.data().isEmpty()) | 215 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), |
131 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | 216 | it.data().join(" :: ").latin1()); |
132 | it.data().join(" :: ").latin1()); | ||
133 | } | ||
134 | } | 217 | } |
135 | VcsolutionDepend *newDep = new VcsolutionDepend; | 218 | } |
136 | newDep->vcprojFile = fileFixify(vcproj); | 219 | |
137 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); | 220 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj |
138 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); | 221 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); |
139 | if(newDep->target.endsWith(".dll")) | 222 | |
140 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | 223 | // If file doesn't exsist, then maybe the users configuration |
141 | if(!tmp_proj.isEmpty("FORMS")) | 224 | // doesn't allow it to be created. Skip to next... |
142 | newDep->dependencies << "uic.exe"; | 225 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { |
143 | { | 226 | qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); |
144 | QStringList where("QMAKE_LIBS"); | 227 | goto nextfile; // # Dirty! |
145 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 228 | } |
146 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 229 | |
147 | for(QStringList::iterator wit = where.begin(); | 230 | VcsolutionDepend *newDep = new VcsolutionDepend; |
148 | wit != where.end(); ++wit) { | 231 | newDep->vcprojFile = fileFixify(vcproj); |
149 | QStringList &l = tmp_proj.variables()[(*wit)]; | 232 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); |
150 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 233 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); |
151 | QString opt = (*it); | 234 | newDep->targetType = tmp_vcproj.projectTarget; |
152 | if(!opt.startsWith("/")) //Not a switch | 235 | { |
153 | newDep->dependencies << opt.section(Option::dir_sep, -1); | 236 | static QUuid uuid = solutionGUID; |
154 | } | 237 | uuid = increaseUUID( uuid ); |
238 | newDep->uuid = uuid.toString().upper(); | ||
239 | } | ||
240 | if(newDep->target.endsWith(".dll")) | ||
241 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | ||
242 | if(!tmp_proj.isEmpty("FORMS")) | ||
243 | newDep->dependencies << "uic.exe"; | ||
244 | { | ||
245 | QStringList where("QMAKE_LIBS"); | ||
246 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
247 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
248 | for(QStringList::iterator wit = where.begin(); | ||
249 | wit != where.end(); ++wit) { | ||
250 | QStringList &l = tmp_proj.variables()[(*wit)]; | ||
251 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
252 | QString opt = (*it); | ||
253 | if(!opt.startsWith("/")) //Not a switch | ||
254 | newDep->dependencies << opt.section(Option::dir_sep, -1); | ||
155 | } | 255 | } |
156 | } | 256 | } |
157 | solution_depends.append(newDep); | ||
158 | } | 257 | } |
258 | solution_cleanup.append(newDep); | ||
259 | solution_depends.insert(newDep->target, newDep); | ||
260 | { | ||
261 | QRegExp libVersion("[0-9]{3,3}\\.lib$"); | ||
262 | if(libVersion.search(newDep->target) != -1) | ||
263 | solution_depends.insert(newDep->target.left(newDep->target.length() - | ||
264 | libVersion.matchedLength()) + ".lib", newDep); | ||
265 | } | ||
266 | t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid | ||
267 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile | ||
268 | << "\", \"" << newDep->uuid << "\""; | ||
269 | t << _snlProjectEnd; | ||
159 | } | 270 | } |
160 | } | 271 | } |
272 | nextfile: | ||
161 | QDir::setCurrent(oldpwd); | 273 | QDir::setCurrent(oldpwd); |
162 | } | 274 | } |
163 | } | 275 | } |
164 | } | 276 | } |
165 | 277 | t << _snlGlobalBeg; | |
166 | VcsolutionDepend *vc; | 278 | t << _snlSolutionConf; |
167 | QMap<QString, int> uuids; | 279 | t << _snlProjDepBeg; |
168 | QRegExp libVersion("[0-9]{3,3}\\.lib$"); | 280 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
169 | for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { | 281 | int cnt = 0; |
170 | static int uuid = 666; | 282 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); |
171 | uuids.insert(vc->target, uuid); | 283 | dit != solution_cleanup.current()->dependencies.end(); |
172 | if(libVersion.match(vc->target) != -1) | 284 | ++dit) { |
173 | uuids.insert(vc->target.left(vc->target.length() - libVersion.matchedLength()) + ".lib", | 285 | VcsolutionDepend *vc; |
174 | uuid); | 286 | if((vc=solution_depends[*dit])) { |
175 | t << "\"" << vc->orig_target << "\" \"" << vc->vcprojFile << "\" { " << uuid << " }" << endl; | 287 | if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application) |
176 | uuid++; | 288 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; |
177 | } | 289 | } |
178 | for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { | ||
179 | int uuid = uuids[vc->target], cnt = 0; | ||
180 | for(QStringList::iterator dit = vc->dependencies.begin(); dit != vc->dependencies.end(); ++dit) { | ||
181 | if(uuids.contains((*dit))) | ||
182 | t << uuid << "." << cnt++ << " = " << uuids[(*dit)] << endl; | ||
183 | } | 290 | } |
184 | } | 291 | } |
292 | t << _snlProjDepEnd; | ||
293 | t << _snlProjConfBeg; | ||
294 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | ||
295 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1; | ||
296 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2; | ||
297 | } | ||
298 | t << _snlProjConfEnd; | ||
299 | t << _snlExtSections; | ||
300 | t << _snlGlobalEnd; | ||
185 | } | 301 | } |
186 | 302 | ||
187 | // ------------------------------------------------------------------------------------------------ | 303 | // ------------------------------------------------------------------------------------------------ |
188 | // ------------------------------------------------------------------------------------------------ | 304 | // ------------------------------------------------------------------------------------------------ |
189 | 305 | ||
190 | void VcprojGenerator::init() | 306 | void VcprojGenerator::init() |
191 | { | 307 | { |
192 | if( init_flag ) | 308 | if( init_flag ) |
193 | return; | 309 | return; |
194 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs | 310 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs |
195 | init_flag = TRUE; | 311 | init_flag = TRUE; |
196 | return; | 312 | return; |
197 | } | 313 | } |
198 | 314 | ||
199 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); | 315 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); |
200 | 316 | ||
@@ -293,141 +409,144 @@ void VcprojGenerator::initConfiguration() | |||
293 | initIDLTool(); | 409 | initIDLTool(); |
294 | 410 | ||
295 | // Own elements ----------------------------- | 411 | // Own elements ----------------------------- |
296 | QString temp = project->first("BuildBrowserInformation"); | 412 | QString temp = project->first("BuildBrowserInformation"); |
297 | switch ( projectTarget ) { | 413 | switch ( projectTarget ) { |
298 | case SharedLib: | 414 | case SharedLib: |
299 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; | 415 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; |
300 | break; | 416 | break; |
301 | case StaticLib: | 417 | case StaticLib: |
302 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; | 418 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; |
303 | break; | 419 | break; |
304 | case Application: | 420 | case Application: |
305 | default: | 421 | default: |
306 | vcProject.Configuration.ConfigurationType = typeApplication; | 422 | vcProject.Configuration.ConfigurationType = typeApplication; |
307 | break; | 423 | break; |
308 | } | 424 | } |
309 | vcProject.Configuration.Name = ( project->isActiveConfig( "release" ) ? "Release|" : "Debug|" ); | 425 | vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" ); |
310 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 426 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); |
311 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | 427 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); |
312 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? unset : temp.toShort() ); | 428 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); |
313 | temp = project->first("CharacterSet"); | 429 | temp = project->first("CharacterSet"); |
314 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? charSetNotSet : temp.toShort() ); | 430 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); |
315 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); | 431 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); |
316 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; | 432 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; |
317 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); | 433 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); |
318 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); | 434 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); |
319 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); | 435 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); |
320 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); | 436 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); |
321 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; | 437 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; |
322 | temp = project->first("UseOfATL"); | 438 | temp = project->first("UseOfATL"); |
323 | if ( !temp.isEmpty() ) | 439 | if ( !temp.isEmpty() ) |
324 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); | 440 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); |
325 | temp = project->first("UseOfMfc"); | 441 | temp = project->first("UseOfMfc"); |
326 | if ( !temp.isEmpty() ) | 442 | if ( !temp.isEmpty() ) |
327 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); | 443 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); |
328 | 444 | ||
329 | // Configuration does not need parameters from | 445 | // Configuration does not need parameters from |
330 | // these sub XML items; | 446 | // these sub XML items; |
331 | initCustomBuildTool(); | 447 | initCustomBuildTool(); |
332 | initPreBuildEventTools(); | 448 | initPreBuildEventTools(); |
333 | initPostBuildEventTools(); | 449 | initPostBuildEventTools(); |
334 | initPreLinkEventTools(); | 450 | initPreLinkEventTools(); |
335 | } | 451 | } |
336 | 452 | ||
337 | void VcprojGenerator::initCompilerTool() | 453 | void VcprojGenerator::initCompilerTool() |
338 | { | 454 | { |
339 | QString placement = project->first("OBJECTS_DIR"); | 455 | QString placement = project->first("OBJECTS_DIR"); |
340 | if ( placement.isEmpty() ) | 456 | if ( placement.isEmpty() ) |
341 | placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\"; | 457 | placement = ".\\"; |
342 | 458 | ||
343 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; | 459 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; |
344 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; | 460 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; |
345 | vcProject.Configuration.compiler.ObjectFile = placement ; | 461 | vcProject.Configuration.compiler.ObjectFile = placement ; |
346 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; | 462 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; |
347 | 463 | ||
348 | if ( project->isActiveConfig("debug") ){ | 464 | if ( project->isActiveConfig("debug") ){ |
349 | // Debug version | 465 | // Debug version |
350 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 466 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
351 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); | 467 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); |
352 | if ( project->isActiveConfig("thread") ) { | 468 | if ( project->isActiveConfig("thread") ) { |
353 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 469 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
354 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); | 470 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
355 | else | 471 | else |
356 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); | 472 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); |
357 | } else { | 473 | } else { |
358 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); | 474 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); |
359 | } | 475 | } |
360 | } else { | 476 | } else { |
361 | // Release version | 477 | // Release version |
362 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 478 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
363 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); | 479 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); |
364 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; | 480 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; |
481 | vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG"; | ||
365 | if ( project->isActiveConfig("thread") ) { | 482 | if ( project->isActiveConfig("thread") ) { |
366 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 483 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
367 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); | 484 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
368 | else | 485 | else |
369 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); | 486 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); |
370 | } else { | 487 | } else { |
371 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); | 488 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); |
372 | } | 489 | } |
373 | } | 490 | } |
374 | 491 | ||
375 | // Common for both release and debug | 492 | // Common for both release and debug |
376 | if ( project->isActiveConfig("warn_off") ) | 493 | if ( project->isActiveConfig("warn_off") ) |
377 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); | 494 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); |
378 | else | 495 | else if ( project->isActiveConfig("warn_on") ) |
379 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); | 496 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); |
380 | if ( project->isActiveConfig("windows") ) | 497 | if ( project->isActiveConfig("windows") ) |
381 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; | 498 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; |
382 | 499 | ||
383 | // Can this be set for ALL configs? | 500 | // Can this be set for ALL configs? |
384 | // If so, use qmake.conf! | 501 | // If so, use qmake.conf! |
385 | if ( projectTarget == SharedLib ) | 502 | if ( projectTarget == SharedLib ) |
386 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; | 503 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; |
387 | 504 | ||
388 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; | 505 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; |
389 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; | 506 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; |
390 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | 507 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); |
391 | } | 508 | } |
392 | 509 | ||
393 | void VcprojGenerator::initLibrarianTool() | 510 | void VcprojGenerator::initLibrarianTool() |
394 | { | 511 | { |
395 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); | 512 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); |
396 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) | 513 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) |
397 | vcProject.Configuration.librarian.OutputFile = ".\\"; | 514 | vcProject.Configuration.librarian.OutputFile = ".\\"; |
398 | 515 | ||
399 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) | 516 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) |
400 | vcProject.Configuration.librarian.OutputFile += '\\'; | 517 | vcProject.Configuration.librarian.OutputFile += '\\'; |
401 | 518 | ||
402 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); | 519 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); |
403 | } | 520 | } |
404 | 521 | ||
405 | void VcprojGenerator::initLinkerTool() | 522 | void VcprojGenerator::initLinkerTool() |
406 | { | 523 | { |
407 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); | 524 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); |
408 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | 525 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; |
409 | 526 | ||
410 | switch ( projectTarget ) { | 527 | switch ( projectTarget ) { |
411 | case Application: | 528 | case Application: |
412 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); | 529 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); |
413 | break; | 530 | break; |
414 | case SharedLib: | 531 | case SharedLib: |
415 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); | 532 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); |
416 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); | 533 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); |
417 | break; | 534 | break; |
535 | case StaticLib: //unhandled - added to remove warnings.. | ||
536 | break; | ||
418 | } | 537 | } |
419 | 538 | ||
420 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) | 539 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) |
421 | vcProject.Configuration.linker.OutputFile = ".\\"; | 540 | vcProject.Configuration.linker.OutputFile = ".\\"; |
422 | 541 | ||
423 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) | 542 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) |
424 | vcProject.Configuration.linker.OutputFile += '\\'; | 543 | vcProject.Configuration.linker.OutputFile += '\\'; |
425 | 544 | ||
426 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); | 545 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); |
427 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; | 546 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; |
428 | 547 | ||
429 | if ( project->isActiveConfig("debug") ){ | 548 | if ( project->isActiveConfig("debug") ){ |
430 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); | 549 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); |
431 | } else { | 550 | } else { |
432 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); | 551 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); |
433 | } | 552 | } |
@@ -446,50 +565,66 @@ void VcprojGenerator::initLinkerTool() | |||
446 | 565 | ||
447 | void VcprojGenerator::initIDLTool() | 566 | void VcprojGenerator::initIDLTool() |
448 | { | 567 | { |
449 | } | 568 | } |
450 | 569 | ||
451 | void VcprojGenerator::initCustomBuildTool() | 570 | void VcprojGenerator::initCustomBuildTool() |
452 | { | 571 | { |
453 | } | 572 | } |
454 | 573 | ||
455 | void VcprojGenerator::initPreBuildEventTools() | 574 | void VcprojGenerator::initPreBuildEventTools() |
456 | { | 575 | { |
457 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); | 576 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); |
458 | if( !collectionName.isEmpty() ) { | 577 | if( !collectionName.isEmpty() ) { |
459 | QStringList& list = project->variables()["IMAGES"]; | 578 | QStringList& list = project->variables()["IMAGES"]; |
460 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; | 579 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; |
461 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; | 580 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; |
462 | vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " " + list.join(" ") + " -o " + collectionName; | 581 | |
582 | QFile imgs( ".imgcol" ); | ||
583 | imgs.open( IO_WriteOnly ); | ||
584 | QTextStream s( &imgs ); | ||
585 | QStringList::ConstIterator it = list.begin(); | ||
586 | while( it!=list.end() ) { | ||
587 | s << *it << " "; | ||
588 | it++; | ||
589 | } | ||
590 | |||
591 | vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " -f .imgcol -o " + collectionName; | ||
463 | //vcProject.Configuration.preBuild.Outputs = collectionName; | 592 | //vcProject.Configuration.preBuild.Outputs = collectionName; |
464 | 593 | ||
465 | } | 594 | } |
466 | } | 595 | } |
467 | 596 | ||
468 | void VcprojGenerator::initPostBuildEventTools() | 597 | void VcprojGenerator::initPostBuildEventTools() |
469 | { | 598 | { |
599 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { | ||
600 | vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK"); | ||
601 | vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK"); | ||
602 | } | ||
470 | if( project->isActiveConfig( "activeqt" ) ) { | 603 | if( project->isActiveConfig( "activeqt" ) ) { |
471 | QString name = project->first( "QMAKE_ORIG_TARGET" ); | 604 | QString name = project->first( "QMAKE_ORIG_TARGET" ); |
472 | QString nameext = project->first( "TARGET" ); | 605 | QString nameext = project->first( "TARGET" ); |
473 | QString objdir = project->first( "OBJECTS_DIR" ); | 606 | QString objdir = project->first( "OBJECTS_DIR" ); |
474 | QString idc = project->first( "QMAKE_IDC" ); | 607 | QString idc = project->first( "QMAKE_IDC" ); |
475 | 608 | ||
476 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; | 609 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; |
610 | if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() ) | ||
611 | vcProject.Configuration.postBuild.CommandLine += " && "; | ||
477 | 612 | ||
478 | if( project->isActiveConfig( "dll" ) ) { // In process | 613 | if( project->isActiveConfig( "dll" ) ) { // In process |
479 | vcProject.Configuration.postBuild.CommandLine = | 614 | vcProject.Configuration.postBuild.CommandLine += |
480 | // call idc to generate .idl file from .dll | 615 | // call idc to generate .idl file from .dll |
481 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + | 616 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + |
482 | // call midl to create implementations of the .idl file | 617 | // call midl to create implementations of the .idl file |
483 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 618 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + |
484 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | 619 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + |
485 | objdir + "dump.midl && " + | 620 | objdir + "dump.midl && " + |
486 | // call idc to replace tlb... | 621 | // call idc to replace tlb... |
487 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 622 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + |
488 | // register server | 623 | // register server |
489 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; | 624 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; |
490 | } else { // out of process | 625 | } else { // out of process |
491 | vcProject.Configuration.postBuild.CommandLine = | 626 | vcProject.Configuration.postBuild.CommandLine = |
492 | // call application to dump idl | 627 | // call application to dump idl |
493 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + | 628 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + |
494 | // call midl to create implementations of the .idl file | 629 | // call midl to create implementations of the .idl file |
495 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 630 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + |
@@ -589,59 +724,66 @@ void VcprojGenerator::initLexYaccFiles() | |||
589 | } | 724 | } |
590 | 725 | ||
591 | void VcprojGenerator::initResourceFiles() | 726 | void VcprojGenerator::initResourceFiles() |
592 | { | 727 | { |
593 | vcProject.ResourceFiles.Name = "Resources"; | 728 | vcProject.ResourceFiles.Name = "Resources"; |
594 | vcProject.ResourceFiles.ParseFiles = _False; | 729 | vcProject.ResourceFiles.ParseFiles = _False; |
595 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; | 730 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; |
596 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; | 731 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; |
597 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; | 732 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; |
598 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; | 733 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; |
599 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; | 734 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; |
600 | vcProject.ResourceFiles.Files.sort(); | 735 | vcProject.ResourceFiles.Files.sort(); |
601 | vcProject.ResourceFiles.Project = this; | 736 | vcProject.ResourceFiles.Project = this; |
602 | vcProject.ResourceFiles.CustomBuild = none; | 737 | vcProject.ResourceFiles.CustomBuild = none; |
603 | } | 738 | } |
604 | 739 | ||
605 | /* | ||
606 | // $$MSVCPROJ_IDLSOURCES --------------------------------------------- | ||
607 | void VcprojGenerator::writeIDLs( QTextStream &t ) | ||
608 | { | ||
609 | QStringList &l = project->variables()["MSVCPROJ_IDLSOURCES"]; | ||
610 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
611 | t << "# Begin Source File" << endl << endl; | ||
612 | t << "SOURCE=" << (*it) << endl; | ||
613 | t << "# PROP Exclude_From_Build 1" << endl; | ||
614 | t << "# End Source File" << endl << endl; | ||
615 | } | ||
616 | debug_msg(3, "Generator: MSVC.NET: Added IDLs" ); | ||
617 | } | ||
618 | */ | ||
619 | |||
620 | /* \internal | 740 | /* \internal |
621 | Sets up all needed variables from the environment and all the different caches and .conf files | 741 | Sets up all needed variables from the environment and all the different caches and .conf files |
622 | */ | 742 | */ |
623 | 743 | ||
624 | void VcprojGenerator::initOld() | 744 | void VcprojGenerator::initOld() |
625 | { | 745 | { |
626 | if( init_flag ) | 746 | if( init_flag ) |
627 | return; | 747 | return; |
628 | 748 | ||
629 | init_flag = TRUE; | 749 | init_flag = TRUE; |
630 | QStringList::Iterator it; | 750 | QStringList::Iterator it; |
631 | 751 | ||
752 | if ( project->isActiveConfig("stl") ) { | ||
753 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | ||
754 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | ||
755 | } else { | ||
756 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | ||
757 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | ||
758 | } | ||
759 | if ( project->isActiveConfig("exceptions") ) { | ||
760 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
761 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
762 | } else { | ||
763 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
764 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
765 | } | ||
766 | if ( project->isActiveConfig("rtti") ) { | ||
767 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
768 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
769 | } else { | ||
770 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
771 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
772 | } | ||
773 | |||
632 | // this should probably not be here, but I'm using it to wrap the .t files | 774 | // this should probably not be here, but I'm using it to wrap the .t files |
633 | if(project->first("TEMPLATE") == "vcapp" ) | 775 | if(project->first("TEMPLATE") == "vcapp" ) |
634 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 776 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
635 | else if(project->first("TEMPLATE") == "vclib") | 777 | else if(project->first("TEMPLATE") == "vclib") |
636 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 778 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
637 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 779 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
638 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 780 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
639 | 781 | ||
640 | bool is_qt = | 782 | bool is_qt = |
641 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 783 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
642 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 784 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
643 | 785 | ||
644 | QStringList &configs = project->variables()["CONFIG"]; | 786 | QStringList &configs = project->variables()["CONFIG"]; |
645 | 787 | ||
646 | if ( project->isActiveConfig( "shared" ) ) | 788 | if ( project->isActiveConfig( "shared" ) ) |
647 | project->variables()["DEFINES"].append( "QT_DLL" ); | 789 | project->variables()["DEFINES"].append( "QT_DLL" ); |
@@ -775,67 +917,80 @@ void VcprojGenerator::initOld() | |||
775 | project->variables()["TARGET_EXT"].append(".dll"); | 917 | project->variables()["TARGET_EXT"].append(".dll"); |
776 | } | 918 | } |
777 | } | 919 | } |
778 | // EXE / LIB ----------------------------------------------------- | 920 | // EXE / LIB ----------------------------------------------------- |
779 | else { | 921 | else { |
780 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 922 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
781 | project->variables()["TARGET_EXT"].append(".exe"); | 923 | project->variables()["TARGET_EXT"].append(".exe"); |
782 | else | 924 | else |
783 | project->variables()["TARGET_EXT"].append(".lib"); | 925 | project->variables()["TARGET_EXT"].append(".lib"); |
784 | } | 926 | } |
785 | 927 | ||
786 | project->variables()["MSVCPROJ_VER"] = "7.00"; | 928 | project->variables()["MSVCPROJ_VER"] = "7.00"; |
787 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; | 929 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; |
788 | 930 | ||
789 | // INCREMENTAL:NO ------------------------------------------------ | 931 | // INCREMENTAL:NO ------------------------------------------------ |
790 | if(!project->isActiveConfig("incremental")) { | 932 | if(!project->isActiveConfig("incremental")) { |
791 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 933 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); |
792 | if ( is_qt ) | 934 | if ( is_qt ) |
793 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; | 935 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; |
794 | } | 936 | } |
795 | 937 | ||
796 | // MOC ----------------------------------------------------------- | 938 | // MOC ----------------------------------------------------------- |
797 | if ( project->isActiveConfig("moc") ) | 939 | if ( project->isActiveConfig("moc") ) |
798 | setMocAware(TRUE); | 940 | setMocAware(TRUE); |
799 | 941 | ||
800 | 942 | ||
801 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 943 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
944 | // Update -lname to name.lib, and -Ldir to | ||
945 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
946 | for( it = libList.begin(); it != libList.end(); ) { | ||
947 | QString s = *it; | ||
948 | if( s.startsWith( "-l" ) ) { | ||
949 | it = libList.remove( it ); | ||
950 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); | ||
951 | } else if( s.startsWith( "-L" ) ) { | ||
952 | it = libList.remove( it ); | ||
953 | } else { | ||
954 | it++; | ||
955 | } | ||
956 | } | ||
802 | 957 | ||
803 | // Run through all variables containing filepaths, and ----------- | 958 | // Run through all variables containing filepaths, and ----------- |
804 | // slash-slosh them correctly depending on current OS ----------- | 959 | // slash-slosh them correctly depending on current OS ----------- |
805 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 960 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
806 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 961 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
807 | for(it = l.begin(); it != l.end(); ++it) { | 962 | for(it = l.begin(); it != l.end(); ++it) { |
808 | QStringList &gdmf = project->variables()[(*it)]; | 963 | QStringList &gdmf = project->variables()[(*it)]; |
809 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 964 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
810 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 965 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
811 | } | 966 | } |
812 | 967 | ||
813 | // Get filename w/o extention ----------------------------------- | 968 | // Get filename w/o extention ----------------------------------- |
814 | QString msvcproj_project = ""; | 969 | QString msvcproj_project = ""; |
815 | QString targetfilename = ""; | 970 | QString targetfilename = ""; |
816 | if ( project->variables()["TARGET"].count() ) { | 971 | if ( project->variables()["TARGET"].count() ) { |
817 | msvcproj_project = project->variables()["TARGET"].first(); | 972 | msvcproj_project = project->variables()["TARGET"].first(); |
818 | targetfilename = msvcproj_project; | 973 | targetfilename = msvcproj_project; |
819 | } | 974 | } |
820 | 975 | ||
821 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ | 976 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ |
822 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 977 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
823 | 978 | ||
824 | // TARGET (add extention to $$TARGET) ---------------------------- | 979 | // TARGET (add extention to $$TARGET) |
825 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); | 980 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); |
826 | 981 | ||
827 | // Init base class too ------------------------------------------- | 982 | // Init base class too ------------------------------------------- |
828 | MakefileGenerator::init(); | 983 | MakefileGenerator::init(); |
829 | 984 | ||
830 | 985 | ||
831 | if ( msvcproj_project.isEmpty() ) | 986 | if ( msvcproj_project.isEmpty() ) |
832 | msvcproj_project = Option::output.name(); | 987 | msvcproj_project = Option::output.name(); |
833 | 988 | ||
834 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); | 989 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); |
835 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); | 990 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); |
836 | msvcproj_project.replace(QRegExp("-"), ""); | 991 | msvcproj_project.replace(QRegExp("-"), ""); |
837 | 992 | ||
838 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); | 993 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); |
839 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; | 994 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; |
840 | 995 | ||
841 | for(it = proj.begin(); it != proj.end(); ++it) | 996 | for(it = proj.begin(); it != proj.end(); ++it) |
@@ -854,61 +1009,67 @@ void VcprojGenerator::initOld() | |||
854 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); | 1009 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); |
855 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); | 1010 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); |
856 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); | 1011 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); |
857 | } | 1012 | } |
858 | } else { | 1013 | } else { |
859 | if ( project->isActiveConfig("dll") ) { | 1014 | if ( project->isActiveConfig("dll") ) { |
860 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); | 1015 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); |
861 | } else { | 1016 | } else { |
862 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); | 1017 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); |
863 | } | 1018 | } |
864 | } | 1019 | } |
865 | 1020 | ||
866 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- | 1021 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- |
867 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; | 1022 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; |
868 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 1023 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
869 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 1024 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
870 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 1025 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { |
871 | project->variables()["MSVCPROJ_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:"," /LIBPATH:","")); | 1026 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; |
1027 | QStringList::iterator stri; | ||
1028 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { | ||
1029 | if ( !(*stri).startsWith("/LIBPATH:") ) | ||
1030 | (*stri).prepend( "/LIBPATH:" ); | ||
1031 | } | ||
1032 | project->variables()["MSVCPROJ_LFLAGS"] += strl; | ||
1033 | } | ||
872 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 1034 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
873 | // We don't use this... Direct manipulation of compiler object | 1035 | // We don't use this... Direct manipulation of compiler object |
874 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 1036 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
875 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 1037 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
876 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 1038 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
877 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 1039 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
878 | QString inc = (*incit); | 1040 | QString inc = (*incit); |
879 | inc.replace(QRegExp("\""), ""); | 1041 | inc.replace(QRegExp("\""), ""); |
880 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); | 1042 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); |
881 | } | 1043 | } |
882 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); | 1044 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); |
883 | 1045 | ||
884 | QString dest; | 1046 | QString dest; |
885 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); | 1047 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); |
886 | if ( !project->variables()["DESTDIR"].isEmpty() ) { | 1048 | Option::fixPathToTargetOS(project->first("TARGET")); |
887 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 1049 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); |
888 | Option::fixPathToTargetOS(project->first("TARGET")); | 1050 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
889 | dest = project->first("TARGET"); | 1051 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); |
890 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 1052 | project->variables()["MSVCPROJ_TARGET"] = dest; |
891 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); | 1053 | if ( project->isActiveConfig("dll") ) { |
892 | project->variables()["MSVCPROJ_TARGET"].append( | 1054 | QString imp = project->first( "DESTDIR" ); |
893 | QString("/OUT:") + dest ); | 1055 | if( !imp.isNull() && !imp.endsWith( "\\" ) ) |
894 | if ( project->isActiveConfig("dll") ) { | 1056 | imp += "\\"; |
895 | QString imp = dest; | 1057 | imp += dest; |
896 | imp.replace(QRegExp("\\.dll"), ".lib"); | 1058 | imp.replace(QRegExp("\\.dll"), ".lib"); |
897 | project->variables()["MSVCPROJ_LIBOPTIONS"] += (QString("/IMPLIB:") + imp ); | 1059 | project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp; |
898 | } | ||
899 | } | 1060 | } |
900 | 1061 | ||
901 | // DLL COPY ------------------------------------------------------ | 1062 | // DLL COPY ------------------------------------------------------ |
902 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 1063 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
903 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 1064 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
904 | QString copydll = "# Begin Special Build Tool\n" | 1065 | QString copydll = "# Begin Special Build Tool\n" |
905 | "TargetPath=" + dest + "\n" | 1066 | "TargetPath=" + dest + "\n" |
906 | "SOURCE=$(InputPath)\n" | 1067 | "SOURCE=$(InputPath)\n" |
907 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | 1068 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" |
908 | "PostBuild_Cmds="; | 1069 | "PostBuild_Cmds="; |
909 | 1070 | ||
910 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 1071 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
911 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | 1072 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; |
912 | } | 1073 | } |
913 | 1074 | ||
914 | copydll += "\n# End Special Build Tool"; | 1075 | copydll += "\n# End Special Build Tool"; |
@@ -983,68 +1144,71 @@ void VcprojGenerator::initOld() | |||
983 | 1144 | ||
984 | bool VcprojGenerator::openOutput(QFile &file) const | 1145 | bool VcprojGenerator::openOutput(QFile &file) const |
985 | { | 1146 | { |
986 | QString outdir; | 1147 | QString outdir; |
987 | if(!file.name().isEmpty()) { | 1148 | if(!file.name().isEmpty()) { |
988 | QFileInfo fi(file); | 1149 | QFileInfo fi(file); |
989 | if(fi.isDir()) | 1150 | if(fi.isDir()) |
990 | outdir = file.name() + QDir::separator(); | 1151 | outdir = file.name() + QDir::separator(); |
991 | } | 1152 | } |
992 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 1153 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
993 | QString ext = project->first("VCPROJ_EXTENSION"); | 1154 | QString ext = project->first("VCPROJ_EXTENSION"); |
994 | if(project->first("TEMPLATE") == "vcsubdirs") | 1155 | if(project->first("TEMPLATE") == "vcsubdirs") |
995 | ext = project->first("VCSOLUTION_EXTENSION"); | 1156 | ext = project->first("VCSOLUTION_EXTENSION"); |
996 | file.setName(outdir + project->first("TARGET") + ext); | 1157 | file.setName(outdir + project->first("TARGET") + ext); |
997 | } | 1158 | } |
998 | if(QDir::isRelativePath(file.name())) { | 1159 | if(QDir::isRelativePath(file.name())) { |
999 | QString ofile; | 1160 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); |
1000 | ofile = file.name(); | ||
1001 | int slashfind = ofile.findRev('\\'); | ||
1002 | if (slashfind == -1) { | ||
1003 | ofile = ofile.replace("-", "_"); | ||
1004 | } else { | ||
1005 | int hypenfind = ofile.find('-', slashfind); | ||
1006 | while (hypenfind != -1 && slashfind < hypenfind) { | ||
1007 | ofile = ofile.replace(hypenfind, 1, "_"); | ||
1008 | hypenfind = ofile.find('-', hypenfind + 1); | ||
1009 | } | ||
1010 | } | ||
1011 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); | ||
1012 | } | 1161 | } |
1013 | return Win32MakefileGenerator::openOutput(file); | 1162 | return Win32MakefileGenerator::openOutput(file); |
1014 | } | 1163 | } |
1015 | 1164 | ||
1165 | QString VcprojGenerator::fixFilename(QString ofile) const | ||
1166 | { | ||
1167 | int slashfind = ofile.findRev('\\'); | ||
1168 | if (slashfind == -1) { | ||
1169 | ofile = ofile.replace('-', '_'); | ||
1170 | } else { | ||
1171 | int hypenfind = ofile.find('-', slashfind); | ||
1172 | while (hypenfind != -1 && slashfind < hypenfind) { | ||
1173 | ofile = ofile.replace(hypenfind, 1, '_'); | ||
1174 | hypenfind = ofile.find('-', hypenfind + 1); | ||
1175 | } | ||
1176 | } | ||
1177 | return ofile; | ||
1178 | } | ||
1179 | |||
1016 | QString VcprojGenerator::findTemplate(QString file) | 1180 | QString VcprojGenerator::findTemplate(QString file) |
1017 | { | 1181 | { |
1018 | QString ret; | 1182 | QString ret; |
1019 | if(!QFile::exists((ret = file)) && | 1183 | if(!QFile::exists((ret = file)) && |
1020 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 1184 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
1021 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && | 1185 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && |
1022 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 1186 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
1023 | return ""; | 1187 | return ""; |
1024 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); | 1188 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); |
1025 | return ret; | 1189 | return ret; |
1026 | } | 1190 | } |
1027 | 1191 | ||
1028 | 1192 | ||
1029 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1193 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) |
1030 | { | 1194 | { |
1031 | if(var == "QMAKE_PRL_DEFINES") { | 1195 | if(var == "QMAKE_PRL_DEFINES") { |
1032 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; | 1196 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; |
1033 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1197 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
1034 | if(out.findIndex((*it)) == -1) | 1198 | if(out.findIndex((*it)) == -1) |
1035 | out.append((" /D " + *it )); | 1199 | out.append((" /D " + *it )); |
1036 | } | 1200 | } |
1037 | } else { | 1201 | } else { |
1038 | MakefileGenerator::processPrlVariable(var, l); | 1202 | MakefileGenerator::processPrlVariable(var, l); |
1039 | } | 1203 | } |
1040 | } | 1204 | } |
1041 | 1205 | ||
1042 | void VcprojGenerator::outputVariables() | 1206 | void VcprojGenerator::outputVariables() |
1043 | { | 1207 | { |
1044 | #if 0 | 1208 | #if 0 |
1045 | debug_msg(3, "Generator: MSVC.NET: List of current variables:" ); | 1209 | qDebug( "Generator: MSVC.NET: List of current variables:" ); |
1046 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { | 1210 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
1047 | debug_msg(3, "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); | 1211 | qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); |
1048 | } | 1212 | } |
1049 | #endif | 1213 | #endif |
1050 | } | 1214 | } |
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 583b164..69e0c02 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h | |||
@@ -1,129 +1,115 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Definition of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __VCPROJMAKE_H__ | 37 | #ifndef __MSVC_VCPROJ_H__ |
38 | #define __VCPROJMAKE_H__ | 38 | #define __MSVC_VCPROJ_H__ |
39 | 39 | ||
40 | #include "winmakefile.h" | 40 | #include "winmakefile.h" |
41 | #include "msvc_objectmodel.h" | 41 | #include "msvc_objectmodel.h" |
42 | 42 | ||
43 | enum target { | 43 | enum target { |
44 | Application, | 44 | Application, |
45 | SharedLib, | 45 | SharedLib, |
46 | StaticLib | 46 | StaticLib |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct QUuid; | ||
49 | class VcprojGenerator : public Win32MakefileGenerator | 50 | class VcprojGenerator : public Win32MakefileGenerator |
50 | { | 51 | { |
51 | bool init_flag; | 52 | bool init_flag; |
52 | bool writeVcprojParts(QTextStream &); | 53 | bool writeVcprojParts(QTextStream &); |
53 | 54 | ||
54 | bool writeMakefile(QTextStream &); | 55 | bool writeMakefile(QTextStream &); |
55 | virtual void writeSubDirs(QTextStream &t); | 56 | virtual void writeSubDirs(QTextStream &t); |
56 | QString findTemplate(QString file); | 57 | QString findTemplate(QString file); |
57 | void init(); | 58 | void init(); |
58 | 59 | ||
59 | public: | 60 | public: |
60 | VcprojGenerator(QMakeProject *p); | 61 | VcprojGenerator(QMakeProject *p); |
61 | ~VcprojGenerator(); | 62 | ~VcprojGenerator(); |
62 | 63 | ||
63 | QString defaultMakefile() const; | 64 | QString defaultMakefile() const; |
64 | virtual bool doDepends() const { return FALSE; } //never necesary | 65 | virtual bool doDepends() const { return FALSE; } //never necesary |
65 | 66 | ||
66 | protected: | 67 | protected: |
67 | virtual bool openOutput(QFile &file) const; | 68 | virtual bool openOutput(QFile &file) const; |
68 | virtual void processPrlVariable(const QString &, const QStringList &); | 69 | virtual void processPrlVariable(const QString &, const QStringList &); |
69 | virtual bool findLibraries(); | 70 | virtual bool findLibraries(); |
70 | virtual void outputVariables(); | 71 | virtual void outputVariables(); |
72 | QString fixFilename(QString ofile) const; | ||
71 | 73 | ||
72 | void initOld(); | 74 | void initOld(); |
73 | void initProject(); | 75 | void initProject(); |
74 | void initConfiguration(); | 76 | void initConfiguration(); |
75 | void initCompilerTool(); | 77 | void initCompilerTool(); |
76 | void initLinkerTool(); | 78 | void initLinkerTool(); |
77 | void initLibrarianTool(); | 79 | void initLibrarianTool(); |
78 | void initIDLTool(); | 80 | void initIDLTool(); |
79 | void initCustomBuildTool(); | 81 | void initCustomBuildTool(); |
80 | void initPreBuildEventTools(); | 82 | void initPreBuildEventTools(); |
81 | void initPostBuildEventTools(); | 83 | void initPostBuildEventTools(); |
82 | void initPreLinkEventTools(); | 84 | void initPreLinkEventTools(); |
83 | void initSourceFiles(); | 85 | void initSourceFiles(); |
84 | void initHeaderFiles(); | 86 | void initHeaderFiles(); |
85 | void initMOCFiles(); | 87 | void initMOCFiles(); |
86 | void initUICFiles(); | 88 | void initUICFiles(); |
87 | void initFormsFiles(); | 89 | void initFormsFiles(); |
88 | void initTranslationFiles(); | 90 | void initTranslationFiles(); |
89 | void initLexYaccFiles(); | 91 | void initLexYaccFiles(); |
90 | void initResourceFiles(); | 92 | void initResourceFiles(); |
91 | 93 | ||
92 | /* | ||
93 | void writeGuid( QTextStream &t ); | ||
94 | void writeAdditionalOptions( QTextStream &t ); | ||
95 | void writeHeaders( QTextStream &t ); | ||
96 | void writeSources( QTextStream &t ); | ||
97 | void writeMocs( QTextStream &t ); | ||
98 | void writeLexs( QTextStream &t ); | ||
99 | void writeYaccs( QTextStream &t ); | ||
100 | void writePictures( QTextStream &t ); | ||
101 | void writeImages( QTextStream &t ); | ||
102 | void writeIDLs( QTextStream &t ); | ||
103 | |||
104 | void writeForms( QTextStream &t ); | ||
105 | void writeFormsSourceHeaders( QString &variable, QTextStream &t ); | ||
106 | void writeTranslations( QTextStream &t ); | ||
107 | void writeStrippedTranslations( QTextStream &t ); | ||
108 | */ | ||
109 | |||
110 | VCProject vcProject; | 94 | VCProject vcProject; |
111 | target projectTarget; | 95 | target projectTarget; |
112 | 96 | ||
97 | private: | ||
98 | QUuid increaseUUID(const QUuid &id); | ||
113 | friend class VCFilter; | 99 | friend class VCFilter; |
114 | }; | 100 | }; |
115 | 101 | ||
116 | inline VcprojGenerator::~VcprojGenerator() | 102 | inline VcprojGenerator::~VcprojGenerator() |
117 | { } | 103 | { } |
118 | 104 | ||
119 | inline QString VcprojGenerator::defaultMakefile() const | 105 | inline QString VcprojGenerator::defaultMakefile() const |
120 | { | 106 | { |
121 | return project->first("TARGET") + project->first("VCPROJ_EXTENSION"); | 107 | return project->first("TARGET") + project->first("VCPROJ_EXTENSION"); |
122 | } | 108 | } |
123 | 109 | ||
124 | inline bool VcprojGenerator::findLibraries() | 110 | inline bool VcprojGenerator::findLibraries() |
125 | { | 111 | { |
126 | return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS"); | 112 | return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS"); |
127 | } | 113 | } |
128 | 114 | ||
129 | #endif /* __VCPROJMAKE_H__ */ | 115 | #endif /* __MSVC_VCPROJ_H__ */ |
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index a07c921..bc3fed9 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp | |||
@@ -88,256 +88,296 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
88 | if(new_slsh != -1) | 88 | if(new_slsh != -1) |
89 | basename = basename.mid(new_slsh+1); | 89 | basename = basename.mid(new_slsh+1); |
90 | if(sd->profile != basename + ".pro") | 90 | if(sd->profile != basename + ".pro") |
91 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 91 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
92 | } | 92 | } |
93 | sd->target = "sub-" + (*it); | 93 | sd->target = "sub-" + (*it); |
94 | sd->target.replace('/', '-'); | 94 | sd->target.replace('/', '-'); |
95 | sd->target.replace('.', '_'); | 95 | sd->target.replace('.', '_'); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | QPtrListIterator<SubDir> it(subdirs); | 98 | QPtrListIterator<SubDir> it(subdirs); |
99 | 99 | ||
100 | if(!project->isEmpty("MAKEFILE")) | 100 | if(!project->isEmpty("MAKEFILE")) |
101 | t << "MAKEFILE=" << var("MAKEFILE") << endl; | 101 | t << "MAKEFILE=" << var("MAKEFILE") << endl; |
102 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 102 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
103 | t << "SUBTARGETS= "; | 103 | t << "SUBTARGETS= "; |
104 | for( it.toFirst(); it.current(); ++it) | 104 | for( it.toFirst(); it.current(); ++it) |
105 | t << " \\\n\t\t" << it.current()->target; | 105 | t << " \\\n\t\t" << it.current()->target; |
106 | t << endl << endl; | 106 | t << endl << endl; |
107 | t << "all: qmake_all $(SUBTARGETS)" << endl << endl; | 107 | t << "all: qmake_all $(SUBTARGETS)" << endl << endl; |
108 | 108 | ||
109 | for( it.toFirst(); it.current(); ++it) { | 109 | for( it.toFirst(); it.current(); ++it) { |
110 | bool have_dir = !(*it)->directory.isEmpty(); | 110 | bool have_dir = !(*it)->directory.isEmpty(); |
111 | 111 | ||
112 | //make the makefile | 112 | //make the makefile |
113 | QString mkfile = (*it)->makefile; | 113 | QString mkfile = (*it)->makefile; |
114 | if(have_dir) | 114 | if(have_dir) |
115 | mkfile.prepend((*it)->directory + Option::dir_sep); | 115 | mkfile.prepend((*it)->directory + Option::dir_sep); |
116 | t << mkfile << ":"; | 116 | t << mkfile << ":"; |
117 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 117 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
118 | t << " FORCE"; | 118 | t << " FORCE"; |
119 | if(have_dir) | 119 | if(have_dir) |
120 | t << "\n\t" << "cd " << (*it)->directory; | 120 | t << "\n\t" << "cd " << (*it)->directory; |
121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); | 121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); |
122 | if((*it)->makefile != "$(MAKEFILE)") | 122 | t << " -o " << (*it)->makefile; |
123 | t << " -o " << (*it)->makefile; | ||
124 | if(have_dir) { | 123 | if(have_dir) { |
125 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 124 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
126 | t << "\n\t" << "@cd .."; | 125 | t << "\n\t" << "@cd .."; |
127 | for(int i = 1; i < subLevels; i++ ) | 126 | for(int i = 1; i < subLevels; i++ ) |
128 | t << Option::dir_sep << ".."; | 127 | t << Option::dir_sep << ".."; |
129 | } | 128 | } |
130 | t << endl; | 129 | t << endl; |
131 | 130 | ||
132 | //now actually build | 131 | //now actually build |
133 | t << (*it)->target << ": " << mkfile; | 132 | t << (*it)->target << ": " << mkfile; |
134 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 133 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
135 | t << " FORCE"; | 134 | t << " FORCE"; |
136 | if(have_dir) | 135 | if(have_dir) |
137 | t << "\n\t" << "cd " << (*it)->directory; | 136 | t << "\n\t" << "cd " << (*it)->directory; |
138 | t << "\n\t" << "$(MAKE)"; | 137 | t << "\n\t" << "$(MAKE)"; |
139 | if((*it)->makefile != "$(MAKEFILE)") | 138 | t << " -f " << (*it)->makefile; |
140 | t << " -f " << (*it)->makefile; | ||
141 | if(have_dir) { | 139 | if(have_dir) { |
142 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 140 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
143 | t << "\n\t" << "@cd .."; | 141 | t << "\n\t" << "@cd .."; |
144 | for(int i = 1; i < subLevels; i++ ) | 142 | for(int i = 1; i < subLevels; i++ ) |
145 | t << Option::dir_sep << ".."; | 143 | t << Option::dir_sep << ".."; |
146 | } | 144 | } |
147 | t << endl << endl; | 145 | t << endl << endl; |
148 | } | 146 | } |
149 | 147 | ||
150 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 148 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
151 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 149 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
152 | writeMakeQmake(t); | 150 | writeMakeQmake(t); |
153 | 151 | ||
154 | t << "qmake_all:"; | 152 | t << "qmake_all:"; |
155 | if ( !subdirs.isEmpty() ) { | 153 | if ( !subdirs.isEmpty() ) { |
156 | for( it.toFirst(); it.current(); ++it) { | 154 | for( it.toFirst(); it.current(); ++it) { |
157 | QString subdir = (*it)->directory; | 155 | QString subdir = (*it)->directory; |
156 | QString profile = (*it)->profile; | ||
158 | int subLevels = subdir.contains(Option::dir_sep) + 1; | 157 | int subLevels = subdir.contains(Option::dir_sep) + 1; |
159 | t << "\n\t" | 158 | t << "\n\t" |
160 | << "cd " << subdir << "\n\t"; | 159 | << "cd " << subdir << "\n\t"; |
161 | int lastSlash = subdir.findRev(Option::dir_sep); | 160 | int lastSlash = subdir.findRev(Option::dir_sep); |
162 | if(lastSlash != -1) | 161 | if(lastSlash != -1) |
163 | subdir = subdir.mid( lastSlash + 1 ); | 162 | subdir = subdir.mid( lastSlash + 1 ); |
164 | t << "$(QMAKE) " << subdir << ".pro" | 163 | t << "$(QMAKE) " |
165 | << (!project->isEmpty("MAKEFILE") ? QString(" -o ") + var("MAKEFILE") : QString("")) | 164 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) |
165 | << " -o " << (*it)->makefile | ||
166 | << " " << buildArgs() << "\n\t" | 166 | << " " << buildArgs() << "\n\t" |
167 | << "@cd .."; | 167 | << "@cd .."; |
168 | for(int i = 1; i < subLevels; i++ ) | 168 | for(int i = 1; i < subLevels; i++ ) |
169 | t << Option::dir_sep << ".."; | 169 | t << Option::dir_sep << ".."; |
170 | } | 170 | } |
171 | } else { | 171 | } else { |
172 | // Borland make does not like empty an empty command section, so insert | 172 | // Borland make does not like empty an empty command section, so insert |
173 | // a dummy command. | 173 | // a dummy command. |
174 | t << "\n\t" << "@cd ."; | 174 | t << "\n\t" << "@cd ."; |
175 | } | 175 | } |
176 | t << endl << endl; | 176 | t << endl << endl; |
177 | 177 | ||
178 | QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null }; | 178 | QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null }; |
179 | for(int x = 0; targs[x] != QString::null; x++) { | 179 | for(int x = 0; targs[x] != QString::null; x++) { |
180 | t << targs[x] << ": qmake_all"; | 180 | t << targs[x] << ": qmake_all"; |
181 | if(targs[x] == "clean") | 181 | if(targs[x] == "clean") |
182 | t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", ""); | 182 | t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", ""); |
183 | if (!subdirs.isEmpty()) { | 183 | if (!subdirs.isEmpty()) { |
184 | for( it.toFirst(); it.current(); ++it) { | 184 | for( it.toFirst(); it.current(); ++it) { |
185 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; | 185 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; |
186 | bool have_dir = !(*it)->directory.isEmpty(); | 186 | bool have_dir = !(*it)->directory.isEmpty(); |
187 | if(have_dir) | 187 | if(have_dir) |
188 | t << "\n\t" << "cd " << (*it)->directory; | 188 | t << "\n\t" << "cd " << (*it)->directory; |
189 | QString in_file; | 189 | QString in_file = " -f " + (*it)->makefile; |
190 | if((*it)->makefile != "$(MAKEFILE)") | ||
191 | in_file = " -f " + (*it)->makefile; | ||
192 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; | 190 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; |
193 | if(have_dir) { | 191 | if(have_dir) { |
194 | t << "\n\t" << "@cd .."; | 192 | t << "\n\t" << "@cd .."; |
195 | for(int i = 1; i < subLevels; i++ ) | 193 | for(int i = 1; i < subLevels; i++ ) |
196 | t << Option::dir_sep << ".."; | 194 | t << Option::dir_sep << ".."; |
197 | } | 195 | } |
198 | } | 196 | } |
199 | } else { | 197 | } else { |
200 | // Borland make does not like empty an empty command section, so | 198 | // Borland make does not like empty an empty command section, so |
201 | // insert a dummy command. | 199 | // insert a dummy command. |
202 | t << "\n\t" << "@cd ."; | 200 | t << "\n\t" << "@cd ."; |
203 | } | 201 | } |
204 | t << endl << endl; | 202 | t << endl << endl; |
205 | } | 203 | } |
206 | 204 | ||
207 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 205 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
208 | t << "FORCE:" << endl << endl; | 206 | t << "FORCE:" << endl << endl; |
209 | } | 207 | } |
210 | 208 | ||
211 | 209 | ||
212 | int | 210 | int |
213 | Win32MakefileGenerator::findHighestVersion(const QString &d, const | 211 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) |
214 | QString &stem) | ||
215 | { | 212 | { |
216 | if(!QFile::exists(Option::fixPathToLocalOS(d))) | 213 | QString bd = Option::fixPathToLocalOS(d, TRUE); |
214 | if(!QFile::exists(bd)) | ||
217 | return -1; | 215 | return -1; |
218 | if(!project->variables()["QMAKE_" + stem.upper() + | 216 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) |
219 | "_VERSION_OVERRIDE"].isEmpty()) | 217 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); |
220 | return project->variables()["QMAKE_" + stem.upper() + | 218 | |
221 | "_VERSION_OVERRIDE"].first().toInt(); | ||
222 | QString bd = d; | ||
223 | fixEnvVariables(bd); | ||
224 | QDir dir(bd); | 219 | QDir dir(bd); |
225 | int biggest=-1; | 220 | int biggest=-1; |
226 | QStringList entries = dir.entryList(); | 221 | QStringList entries = dir.entryList(); |
227 | QRegExp regx( "(" + stem + "([0-9]*)).lib", FALSE ); | 222 | QString dllStem = stem + QTDLL_POSTFIX; |
228 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); | 223 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); |
229 | ++it) { | 224 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { |
230 | if(regx.exactMatch((*it))) | 225 | if(regx.exactMatch((*it))) |
231 | biggest = QMAX(biggest, (regx.cap(1) == stem || | 226 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || |
232 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); | 227 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); |
228 | } | ||
229 | if(dir.exists(dllStem + Option::prl_ext)) { | ||
230 | QMakeProject proj; | ||
231 | if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) { | ||
232 | if(!proj.isEmpty("QMAKE_PRL_VERSION")) | ||
233 | biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); | ||
234 | } | ||
233 | } | 235 | } |
234 | return biggest; | 236 | return biggest; |
235 | } | 237 | } |
236 | 238 | ||
237 | 239 | ||
238 | bool | 240 | bool |
239 | Win32MakefileGenerator::findLibraries(const QString &where) | 241 | Win32MakefileGenerator::findLibraries(const QString &where) |
240 | { | 242 | { |
241 | 243 | ||
242 | QStringList &l = project->variables()[where]; | 244 | QStringList &l = project->variables()[where]; |
243 | QPtrList<MakefileDependDir> dirs; | 245 | QPtrList<MakefileDependDir> dirs; |
246 | { | ||
247 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | ||
248 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | ||
249 | QString r = (*libpathit), l = r; | ||
250 | fixEnvVariables(l); | ||
251 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | ||
252 | } | ||
253 | } | ||
244 | dirs.setAutoDelete(TRUE); | 254 | dirs.setAutoDelete(TRUE); |
245 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { | 255 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { |
246 | QString opt = (*it); | 256 | QChar quote; |
247 | bool remove = FALSE; | 257 | bool modified_opt = FALSE, remove = FALSE; |
248 | if(opt.startsWith("-L") || opt.startsWith("/L")) { | 258 | QString opt = (*it).stripWhiteSpace(); |
249 | QString r = opt.right(opt.length() - 2), l = Option::fixPathToLocalOS(r); | 259 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { |
260 | quote = opt[0]; | ||
261 | opt = opt.mid(1, opt.length()-2); | ||
262 | } | ||
263 | if(opt.startsWith("/LIBPATH:")) { | ||
264 | QString r = opt.mid(9), l = Option::fixPathToLocalOS(r); | ||
265 | dirs.append(new MakefileDependDir(r.replace("\"",""), | ||
266 | l.replace("\"",""))); | ||
267 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { | ||
268 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); | ||
250 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 269 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
251 | l.replace("\"",""))); | 270 | l.replace("\"",""))); |
252 | remove = TRUE; | 271 | remove = TRUE; //we eat this switch |
253 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { | 272 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { |
254 | QString lib = opt.right(opt.length() - 2), out; | 273 | QString lib = opt.right(opt.length() - 2), out; |
255 | if(!lib.isEmpty()) { | 274 | if(!lib.isEmpty()) { |
256 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 275 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
276 | QString extension; | ||
257 | int ver = findHighestVersion(mdd->local_dir, lib); | 277 | int ver = findHighestVersion(mdd->local_dir, lib); |
258 | if(ver > 0) | 278 | if(ver > 0) |
259 | lib += QString::number(ver); | 279 | extension += QString::number(ver); |
260 | lib += ".lib"; | 280 | extension += ".lib"; |
261 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib)) { | 281 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) || |
262 | out = mdd->real_dir + Option::dir_sep + lib; | 282 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { |
283 | out = mdd->real_dir + Option::dir_sep + lib + extension; | ||
263 | break; | 284 | break; |
264 | } | 285 | } |
265 | } | 286 | } |
266 | } | 287 | } |
267 | if(out.isEmpty()) | 288 | if(out.isEmpty()) { |
268 | remove = TRUE; | 289 | remove = TRUE; //just eat it since we cannot find one.. |
269 | else | 290 | } else { |
291 | modified_opt = TRUE; | ||
270 | (*it) = out; | 292 | (*it) = out; |
293 | } | ||
271 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { | 294 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { |
272 | QString dir, file = opt; | 295 | QPtrList<MakefileDependDir> lib_dirs; |
296 | QString file = opt; | ||
273 | int slsh = file.findRev(Option::dir_sep); | 297 | int slsh = file.findRev(Option::dir_sep); |
274 | if(slsh != -1) { | 298 | if(slsh != -1) { |
275 | dir = file.left(slsh+1); | 299 | QString r = file.left(slsh+1), l = r; |
300 | fixEnvVariables(l); | ||
301 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | ||
276 | file = file.right(file.length() - slsh - 1); | 302 | file = file.right(file.length() - slsh - 1); |
277 | } | 303 | } else { |
278 | if ( !(project->variables()["QMAKE_QT_DLL"].isEmpty() && (file == "qt.lib" || file == "qt-mt.lib")) ) { | 304 | lib_dirs = dirs; |
279 | if(file.endsWith(".lib")) { | 305 | } |
280 | file = file.left(file.length() - 4); | 306 | if(file.endsWith(".lib")) { |
281 | if(!file.at(file.length()-1).isNumber()) { | 307 | file = file.left(file.length() - 4); |
282 | int ver = findHighestVersion(dir, file); | 308 | if(!file.at(file.length()-1).isNumber()) { |
309 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { | ||
310 | QString lib_tmpl(file + "%1" + ".lib"); | ||
311 | int ver = findHighestVersion(mdd->local_dir, file); | ||
283 | if(ver != -1) { | 312 | if(ver != -1) { |
284 | file = QString(dir + file + "%1" + ".lib"); | ||
285 | if(ver) | 313 | if(ver) |
286 | (*it) = file.arg(ver); | 314 | lib_tmpl = lib_tmpl.arg(ver); |
287 | else | 315 | else |
288 | (*it) = file.arg(""); | 316 | lib_tmpl = lib_tmpl.arg(""); |
317 | if(slsh != -1) { | ||
318 | QString dir = mdd->real_dir; | ||
319 | if(!dir.endsWith(Option::dir_sep)) | ||
320 | dir += Option::dir_sep; | ||
321 | lib_tmpl.prepend(dir); | ||
322 | } | ||
323 | modified_opt = TRUE; | ||
324 | (*it) = lib_tmpl; | ||
325 | break; | ||
289 | } | 326 | } |
290 | } | 327 | } |
291 | } | 328 | } |
292 | } | 329 | } |
293 | } | 330 | } |
294 | if(remove) | 331 | if(remove) { |
295 | it = l.remove(it); | 332 | it = l.remove(it); |
296 | else | 333 | } else { |
334 | if(!quote.isNull() && modified_opt) | ||
335 | (*it) = quote + (*it) + quote; | ||
297 | ++it; | 336 | ++it; |
337 | } | ||
298 | } | 338 | } |
299 | return TRUE; | 339 | return TRUE; |
300 | } | 340 | } |
301 | 341 | ||
302 | void | 342 | void |
303 | Win32MakefileGenerator::processPrlFiles() | 343 | Win32MakefileGenerator::processPrlFiles() |
304 | { | 344 | { |
305 | QDict<void> processed; | 345 | QDict<void> processed; |
306 | QPtrList<MakefileDependDir> libdirs; | 346 | QPtrList<MakefileDependDir> libdirs; |
307 | libdirs.setAutoDelete(TRUE); | 347 | libdirs.setAutoDelete(TRUE); |
308 | { | 348 | { |
309 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | 349 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; |
310 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | 350 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { |
311 | QString r = (*libpathit), l = r; | 351 | QString r = (*libpathit), l = r; |
312 | fixEnvVariables(l); | 352 | fixEnvVariables(l); |
313 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 353 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
314 | l.replace("\"",""))); | 354 | l.replace("\"",""))); |
315 | } | 355 | } |
316 | } | 356 | } |
317 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 357 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
318 | //read in any prl files included.. | 358 | //read in any prl files included.. |
319 | QStringList l_out; | 359 | QStringList l_out; |
320 | QString where = "QMAKE_LIBS"; | 360 | QString where = "QMAKE_LIBS"; |
321 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 361 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
322 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); | 362 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
323 | QStringList &l = project->variables()[where]; | 363 | QStringList &l = project->variables()[where]; |
324 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 364 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
325 | QString opt = (*it); | 365 | QString opt = (*it); |
326 | if(opt.left(1) == "/") { | 366 | if(opt.startsWith("/")) { |
327 | if(opt.left(9) == "/LIBPATH:") { | 367 | if(opt.startsWith("/LIBPATH:")) { |
328 | QString r = opt.mid(9), l = r; | 368 | QString r = opt.mid(9), l = r; |
329 | fixEnvVariables(l); | 369 | fixEnvVariables(l); |
330 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 370 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
331 | l.replace("\"",""))); | 371 | l.replace("\"",""))); |
332 | } | 372 | } |
333 | } else { | 373 | } else { |
334 | if(!processed[opt]) { | 374 | if(!processed[opt]) { |
335 | if(processPrlFile(opt)) { | 375 | if(processPrlFile(opt)) { |
336 | processed.insert(opt, (void*)1); | 376 | processed.insert(opt, (void*)1); |
337 | ret = TRUE; | 377 | ret = TRUE; |
338 | } else { | 378 | } else { |
339 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 379 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
340 | QString prl = mdd->local_dir + Option::dir_sep + opt; | 380 | QString prl = mdd->local_dir + Option::dir_sep + opt; |
341 | if(processed[prl]) { | 381 | if(processed[prl]) { |
342 | break; | 382 | break; |
343 | } else if(processPrlFile(prl)) { | 383 | } else if(processPrlFile(prl)) { |
diff --git a/qmake/include/private/qapplication_p.h b/qmake/include/private/qapplication_p.h index 6fab6b3..280992e 100644 --- a/qmake/include/private/qapplication_p.h +++ b/qmake/include/private/qapplication_p.h | |||
@@ -60,28 +60,29 @@ class QObject; | |||
60 | class QClipboard; | 60 | class QClipboard; |
61 | class QKeyEvent; | 61 | class QKeyEvent; |
62 | class QMouseEvent; | 62 | class QMouseEvent; |
63 | class QWheelEvent; | 63 | class QWheelEvent; |
64 | 64 | ||
65 | extern Q_EXPORT bool qt_modal_state(); | 65 | extern Q_EXPORT bool qt_modal_state(); |
66 | extern Q_EXPORT void qt_enter_modal( QWidget* ); | 66 | extern Q_EXPORT void qt_enter_modal( QWidget* ); |
67 | extern Q_EXPORT void qt_leave_modal( QWidget* ); | 67 | extern Q_EXPORT void qt_leave_modal( QWidget* ); |
68 | 68 | ||
69 | extern bool qt_is_gui_used; | 69 | extern bool qt_is_gui_used; |
70 | #ifndef QT_NO_CLIPBOARD | 70 | #ifndef QT_NO_CLIPBOARD |
71 | extern QClipboard *qt_clipboard; | 71 | extern QClipboard *qt_clipboard; |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) | 74 | #if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) |
75 | extern Qt::WindowsVersion qt_winver; | 75 | extern Qt::WindowsVersion qt_winver; |
76 | #elif defined (Q_OS_MAC) | ||
77 | extern Qt::MacintoshVersion qt_macver; | ||
76 | #endif | 78 | #endif |
77 | 79 | ||
78 | #if defined (Q_WS_X11) | 80 | #if defined (Q_WS_X11) |
79 | extern int qt_ncols_option; | 81 | extern int qt_ncols_option; |
80 | #endif | 82 | #endif |
81 | 83 | ||
82 | 84 | ||
83 | extern void qt_dispatchEnterLeave( QWidget*, QWidget* ); | 85 | extern void qt_dispatchEnterLeave( QWidget*, QWidget* ); |
84 | 86 | extern bool qt_tryModalHelper( QWidget *, QWidget ** = 0 ); | |
85 | |||
86 | 87 | ||
87 | #endif | 88 | #endif |
diff --git a/qmake/include/private/qcom_p.h b/qmake/include/private/qcom_p.h index 6e7e1c8..5bed8c8c 100644 --- a/qmake/include/private/qcom_p.h +++ b/qmake/include/private/qcom_p.h | |||
@@ -20,34 +20,34 @@ | |||
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QCOM_H | 36 | #ifndef QCOM_P_H |
37 | #define QCOM_H | 37 | #define QCOM_P_H |
38 | 38 | ||
39 | // | 39 | // |
40 | // W A R N I N G | 40 | // W A R N I N G |
41 | // ------------- | 41 | // ------------- |
42 | // | 42 | // |
43 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
44 | // of a number of Qt sources files. This header file may change from | 44 | // of a number of Qt sources files. This header file may change from |
45 | // version to version without notice, or even be removed. | 45 | // version to version without notice, or even be removed. |
46 | // | 46 | // |
47 | // We mean it. | 47 | // We mean it. |
48 | // | 48 | // |
49 | // | 49 | // |
50 | 50 | ||
51 | #ifndef QT_H | 51 | #ifndef QT_H |
52 | #include "qstringlist.h" | 52 | #include "qstringlist.h" |
53 | #include "quuid.h" | 53 | #include "quuid.h" |
@@ -321,17 +321,17 @@ public: \ | |||
321 | { return qt_ucm_verification_data; } \ | 321 | { return qt_ucm_verification_data; } \ |
322 | Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() | 322 | Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() |
323 | #endif | 323 | #endif |
324 | # else | 324 | # else |
325 | #define Q_EXPORT_COMPONENT() \ | 325 | #define Q_EXPORT_COMPONENT() \ |
326 | Q_UCM_VERIFICATION_DATA \ | 326 | Q_UCM_VERIFICATION_DATA \ |
327 | Q_EXTERN_C \ | 327 | Q_EXTERN_C \ |
328 | const char *qt_ucm_query_verification_data() \ | 328 | const char *qt_ucm_query_verification_data() \ |
329 | { return qt_ucm_verification_data; } \ | 329 | { return qt_ucm_verification_data; } \ |
330 | Q_EXTERN_C QUnknownInterface* ucm_instantiate() | 330 | Q_EXTERN_C QUnknownInterface* ucm_instantiate() |
331 | # endif | 331 | # endif |
332 | # define Q_EXPORT_INTERFACE() Q_EXPORT_COMPONENT() | 332 | # define Q_EXPORT_INTERFACE() Q_EXPORT_COMPONENT() |
333 | #endif | 333 | #endif |
334 | 334 | ||
335 | #endif //QT_NO_COMPONENT | 335 | #endif //QT_NO_COMPONENT |
336 | 336 | ||
337 | #endif //QCOM_H | 337 | #endif //QCOM_P_H |
diff --git a/qmake/include/private/qcomlibrary_p.h b/qmake/include/private/qcomlibrary_p.h index f52f679..3f440c0 100644 --- a/qmake/include/private/qcomlibrary_p.h +++ b/qmake/include/private/qcomlibrary_p.h | |||
@@ -20,34 +20,34 @@ | |||
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QUCOMLIBRARY_H | 36 | #ifndef QCOMLIBRARY_P_H |
37 | #define QUCOMLIBRARY_H | 37 | #define QCOMLIBRARY_P_H |
38 | 38 | ||
39 | // | 39 | // |
40 | // W A R N I N G | 40 | // W A R N I N G |
41 | // ------------- | 41 | // ------------- |
42 | // | 42 | // |
43 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
44 | // of a number of Qt sources files. This header file may change from | 44 | // of a number of Qt sources files. This header file may change from |
45 | // version to version without notice, or even be removed. | 45 | // version to version without notice, or even be removed. |
46 | // | 46 | // |
47 | // We mean it. | 47 | // We mean it. |
48 | // | 48 | // |
49 | // | 49 | // |
50 | 50 | ||
51 | #ifndef QT_H | 51 | #ifndef QT_H |
52 | #include "qcom_p.h" | 52 | #include "qcom_p.h" |
53 | #include "qlibrary.h" | 53 | #include "qlibrary.h" |
@@ -63,17 +63,17 @@ public: | |||
63 | 63 | ||
64 | bool unload(); | 64 | bool unload(); |
65 | QRESULT queryInterface( const QUuid &iid, QUnknownInterface **iface ); | 65 | QRESULT queryInterface( const QUuid &iid, QUnknownInterface **iface ); |
66 | uint qtVersion(); | 66 | uint qtVersion(); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | void createInstanceInternal(); | 69 | void createInstanceInternal(); |
70 | 70 | ||
71 | QUnknownInterface *entry; | 71 | QUnknownInterface *entry; |
72 | QLibraryInterface *libiface; | 72 | QLibraryInterface *libiface; |
73 | uint qt_version; | 73 | uint qt_version; |
74 | 74 | ||
75 | }; | 75 | }; |
76 | 76 | ||
77 | #endif //QT_NO_COMPONENT | 77 | #endif //QT_NO_COMPONENT |
78 | 78 | ||
79 | #endif // QUCOMLIBRARY_H | 79 | #endif |
diff --git a/qmake/include/private/qcomplextext_p.h b/qmake/include/private/qcomplextext_p.h index 2132522..c3aeeb1 100644 --- a/qmake/include/private/qcomplextext_p.h +++ b/qmake/include/private/qcomplextext_p.h | |||
@@ -1,55 +1,53 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Internal header file. | 4 | ** Internal header file. |
5 | ** | 5 | ** |
6 | ** Created : | 6 | ** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. |
7 | ** | ||
8 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | ||
9 | ** | 7 | ** |
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 8 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #ifndef QCOMPLEXTEXT_H | 36 | #ifndef QCOMPLEXTEXT_P_H |
39 | #define QCOMPLEXTEXT_H | 37 | #define QCOMPLEXTEXT_P_H |
40 | 38 | ||
41 | // | 39 | // |
42 | // W A R N I N G | 40 | // W A R N I N G |
43 | // ------------- | 41 | // ------------- |
44 | // | 42 | // |
45 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
46 | // of Qt Remote Control. This header file may change from version to | 44 | // of Qt Remote Control. This header file may change from version to |
47 | // version without notice, or even be removed. | 45 | // version without notice, or even be removed. |
48 | // | 46 | // |
49 | // We mean it. | 47 | // We mean it. |
50 | // | 48 | // |
51 | // | 49 | // |
52 | 50 | ||
53 | #ifndef QT_H | 51 | #ifndef QT_H |
54 | #include <qstring.h> | 52 | #include <qstring.h> |
55 | #include <qpointarray.h> | 53 | #include <qpointarray.h> |
diff --git a/qmake/include/private/qcomponentfactory_p.h b/qmake/include/private/qcomponentfactory_p.h index 1ac973f..d5c1743 100644 --- a/qmake/include/private/qcomponentfactory_p.h +++ b/qmake/include/private/qcomponentfactory_p.h | |||
@@ -22,34 +22,34 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QCOMPONENTFACTORY_H | 38 | #ifndef QCOMPONENTFACTORY_P_H |
39 | #define QCOMPONENTFACTORY_H | 39 | #define QCOMPONENTFACTORY_P_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qcom_p.h" | 42 | #include "qcom_p.h" |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | // | 45 | // |
46 | // W A R N I N G | 46 | // W A R N I N G |
47 | // ------------- | 47 | // ------------- |
48 | // | 48 | // |
49 | // This file is not part of the Qt API. It exists for the convenience | 49 | // This file is not part of the Qt API. It exists for the convenience |
50 | // of a number of Qt sources files. This header file may change from | 50 | // of a number of Qt sources files. This header file may change from |
51 | // version to version without notice, or even be removed. | 51 | // version to version without notice, or even be removed. |
52 | // | 52 | // |
53 | // We mean it. | 53 | // We mean it. |
54 | // | 54 | // |
55 | // | 55 | // |
@@ -57,17 +57,17 @@ | |||
57 | #ifndef QT_NO_COMPONENT | 57 | #ifndef QT_NO_COMPONENT |
58 | 58 | ||
59 | class Q_EXPORT QComponentFactory | 59 | class Q_EXPORT QComponentFactory |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | static QRESULT createInstance( const QString &cid, const QUuid &iid, QUnknownInterface** instance, QUnknownInterface *outer = 0 ); | 62 | static QRESULT createInstance( const QString &cid, const QUuid &iid, QUnknownInterface** instance, QUnknownInterface *outer = 0 ); |
63 | static QRESULT registerServer( const QString &filename ); | 63 | static QRESULT registerServer( const QString &filename ); |
64 | static QRESULT unregisterServer( const QString &filename ); | 64 | static QRESULT unregisterServer( const QString &filename ); |
65 | 65 | ||
66 | static bool registerComponent( const QUuid &cid, const QString &filename, const QString &name = QString::null, | 66 | static bool registerComponent( const QUuid &cid, const QString &filename, const QString &name = QString::null, |
67 | int version = 0, const QString &description = QString::null ); | 67 | int version = 0, const QString &description = QString::null ); |
68 | static bool unregisterComponent( const QUuid &cid ); | 68 | static bool unregisterComponent( const QUuid &cid ); |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif // QT_NO_COMPONENT | 71 | #endif // QT_NO_COMPONENT |
72 | 72 | ||
73 | #endif // QCOMPONENTFACTORY_H | 73 | #endif // QCOMPONENTFACTORY_P_H |
diff --git a/qmake/include/private/qcriticalsection_p.h b/qmake/include/private/qcriticalsection_p.h index 7d9feca..8dacc62 100644 --- a/qmake/include/private/qcriticalsection_p.h +++ b/qmake/include/private/qcriticalsection_p.h | |||
@@ -20,34 +20,34 @@ | |||
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QCRITICALSECTION_H | 36 | #ifndef QCRITICALSECTION_P_H |
37 | #define QCRITICALSECTION_H | 37 | #define QCRITICALSECTION_P_H |
38 | 38 | ||
39 | #ifndef QT_H | 39 | #ifndef QT_H |
40 | #endif // QT_H | 40 | #endif // QT_H |
41 | 41 | ||
42 | // | 42 | // |
43 | // W A R N I N G | 43 | // W A R N I N G |
44 | // ------------- | 44 | // ------------- |
45 | // | 45 | // |
46 | // This file is not part of the Qt API. It exists for the convenience | 46 | // This file is not part of the Qt API. It exists for the convenience |
47 | // of Qt Remote Control. This header file may change from version to | 47 | // of Qt Remote Control. This header file may change from version to |
48 | // version without notice, or even be removed. | 48 | // version without notice, or even be removed. |
49 | // | 49 | // |
50 | // We mean it. | 50 | // We mean it. |
51 | // | 51 | // |
52 | // | 52 | // |
53 | 53 | ||
diff --git a/qmake/include/private/qdir_p.h b/qmake/include/private/qdir_p.h index 35dba28..a6c7c91 100644 --- a/qmake/include/private/qdir_p.h +++ b/qmake/include/private/qdir_p.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of some private QDir functions. | 4 | ** Definition of some private QDir functions. |
5 | ** | 5 | ** |
6 | ** Created : 2000.11.06 | 6 | ** Created : 001106 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
@@ -25,51 +25,52 @@ | |||
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QDIR_P_H | 38 | #ifndef QDIR_P_H |
39 | #define QDIR_P_H | 39 | #define QDIR_P_H |
40 | 40 | ||
41 | |||
42 | // | 41 | // |
43 | // W A R N I N G | 42 | // W A R N I N G |
44 | // ------------- | 43 | // ------------- |
45 | // | 44 | // |
46 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
47 | // of qdir.cpp and qdir_*.cpp. | 46 | // of qdir.cpp and qdir_*.cpp. |
48 | // This header file may change from version to version without notice, | 47 | // This header file may change from version to version without notice, |
49 | // or even be removed. | 48 | // or even be removed. |
50 | // | 49 | // |
51 | // We mean it. | 50 | // We mean it. |
52 | // | 51 | // |
53 | // | 52 | // |
54 | 53 | ||
55 | #ifndef QT_H | 54 | #ifndef QT_H |
55 | #include "qregexp.h" | ||
56 | #include "qvaluelist.h" | ||
56 | #endif // QT_H | 57 | #endif // QT_H |
57 | 58 | ||
58 | extern QStringList qt_makeFilterList( const QString & ); | 59 | extern QValueList<QRegExp> qt_makeFilterList( const QString & ); |
59 | 60 | extern bool qt_matchFilterList( const QValueList<QRegExp> &, const QString & ); | |
60 | 61 | ||
61 | extern int qt_cmp_si_sortSpec; | 62 | extern int qt_cmp_si_sortSpec; |
62 | 63 | ||
63 | #if defined(Q_C_CALLBACKS) | 64 | #if defined(Q_C_CALLBACKS) |
64 | extern "C" { | 65 | extern "C" { |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | #ifdef Q_OS_TEMP | 68 | #ifdef Q_OS_TEMP |
68 | extern int __cdecl qt_cmp_si( const void *, const void * ); | 69 | extern int __cdecl qt_cmp_si( const void *, const void * ); |
69 | #else | 70 | #else |
70 | extern int qt_cmp_si( const void *, const void * ); | 71 | extern int qt_cmp_si( const void *, const void * ); |
71 | #endif | 72 | #endif |
72 | 73 | ||
73 | #if defined(Q_C_CALLBACKS) | 74 | #if defined(Q_C_CALLBACKS) |
74 | } | 75 | } |
75 | #endif | 76 | #endif |
diff --git a/qmake/include/private/qeffects_p.h b/qmake/include/private/qeffects_p.h index 4178b6f..3b6c212 100644 --- a/qmake/include/private/qeffects_p.h +++ b/qmake/include/private/qeffects_p.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QEffects functions | 4 | ** Definition of QEffects functions |
5 | ** | 5 | ** |
6 | ** Created : 2000.06.21 | 6 | ** Created : 000621 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the widgets module of the Qt GUI Toolkit. | 10 | ** This file is part of the widgets module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
diff --git a/qmake/include/private/qeventloop_p.h b/qmake/include/private/qeventloop_p.h index b64d0df..3a5350e 100644 --- a/qmake/include/private/qeventloop_p.h +++ b/qmake/include/private/qeventloop_p.h | |||
@@ -1,74 +1,138 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of QEventLoop class | ||
5 | ** | ||
6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the kernel module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed and/or modified under the terms of the | ||
11 | ** GNU General Public License version 2 as published by the Free Software | ||
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
13 | ** packaging of this file. | ||
14 | ** | ||
15 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
16 | ** licenses for Qt/Embedded may use this file in accordance with the | ||
17 | ** Qt Embedded Commercial License Agreement provided with the Software. | ||
18 | ** | ||
19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | ** | ||
22 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
23 | ** information about Qt Commercial License Agreements. | ||
24 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
25 | ** | ||
26 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
27 | ** not clear to you. | ||
28 | ** | ||
29 | **********************************************************************/ | ||
30 | |||
1 | #ifndef QEVENTLOOP_P_H | 31 | #ifndef QEVENTLOOP_P_H |
2 | #define QEVENTLOOP_P_H | 32 | #define QEVENTLOOP_P_H |
3 | 33 | ||
34 | // | ||
35 | // W A R N I N G | ||
36 | // ------------- | ||
37 | // | ||
38 | // This file is not part of the Qt API. This header file may | ||
39 | // change from version to version without notice, or even be | ||
40 | // removed. | ||
41 | // | ||
42 | // We mean it. | ||
43 | // | ||
44 | // | ||
45 | |||
4 | #include "qplatformdefs.h" | 46 | #include "qplatformdefs.h" |
47 | |||
48 | // SCO OpenServer redefines raise -> kill | ||
49 | #if defined(raise) | ||
50 | # undef raise | ||
51 | #endif | ||
52 | |||
5 | #include "qwindowdefs.h" | 53 | #include "qwindowdefs.h" |
6 | 54 | ||
7 | class QSocketNotifier; | 55 | class QSocketNotifier; |
8 | 56 | ||
9 | #if defined(Q_OS_UNIX) | 57 | #if defined(Q_OS_UNIX) || defined (Q_WS_WIN) |
10 | #include <qptrlist.h> | 58 | #include <qptrlist.h> |
59 | #endif // Q_OS_UNIX || Q_WS_WIN | ||
11 | 60 | ||
61 | #if defined(Q_OS_UNIX) | ||
12 | struct QSockNot | 62 | struct QSockNot |
13 | { | 63 | { |
14 | QSocketNotifier *obj; | 64 | QSocketNotifier *obj; |
15 | int fd; | 65 | int fd; |
16 | fd_set *queue; | 66 | fd_set *queue; |
17 | }; | 67 | }; |
18 | 68 | ||
19 | class QSockNotType | 69 | class QSockNotType |
20 | { | 70 | { |
21 | public: | 71 | public: |
22 | QSockNotType(); | 72 | QSockNotType(); |
23 | ~QSockNotType(); | 73 | ~QSockNotType(); |
24 | 74 | ||
25 | QPtrList<QSockNot> *list; | 75 | QPtrList<QSockNot> *list; |
26 | fd_set select_fds; | 76 | fd_set select_fds; |
27 | fd_set enabled_fds; | 77 | fd_set enabled_fds; |
28 | fd_set pending_fds; | 78 | fd_set pending_fds; |
29 | 79 | ||
30 | }; | 80 | }; |
31 | #endif // Q_OS_UNIX | 81 | #endif // Q_OS_UNIX |
32 | 82 | ||
83 | #if defined(Q_WS_WIN) | ||
84 | struct QSockNot { | ||
85 | QSocketNotifier *obj; | ||
86 | int fd; | ||
87 | }; | ||
88 | #endif // Q_WS_WIN | ||
33 | 89 | ||
34 | class QEventLoopPrivate | 90 | class QEventLoopPrivate |
35 | { | 91 | { |
36 | public: | 92 | public: |
37 | QEventLoopPrivate() | 93 | QEventLoopPrivate() |
38 | { | 94 | { |
39 | reset(); | 95 | reset(); |
40 | } | 96 | } |
41 | 97 | ||
42 | void reset() { | 98 | void reset() { |
43 | looplevel = 0; | 99 | looplevel = 0; |
44 | quitcode = 0; | 100 | quitcode = 0; |
45 | quitnow = FALSE; | 101 | quitnow = FALSE; |
46 | exitloop = FALSE; | 102 | exitloop = FALSE; |
103 | shortcut = FALSE; | ||
47 | } | 104 | } |
48 | 105 | ||
49 | int looplevel; | 106 | int looplevel; |
50 | int quitcode; | 107 | int quitcode; |
51 | bool quitnow; | 108 | unsigned int quitnow : 1; |
52 | bool exitloop; | 109 | unsigned int exitloop : 1; |
110 | unsigned int shortcut : 1; | ||
53 | 111 | ||
54 | #if defined(Q_WS_MAC) | 112 | #if defined(Q_WS_MAC) |
55 | EventLoopTimerRef select_timer; | 113 | EventLoopTimerRef select_timer; |
56 | #endif | 114 | #endif |
57 | 115 | ||
58 | #if defined(Q_WS_X11) | 116 | #if defined(Q_WS_X11) |
59 | int xfd; | 117 | int xfd; |
60 | #endif // Q_WS_X11 | 118 | #endif // Q_WS_X11 |
61 | 119 | ||
62 | #if defined(Q_OS_UNIX) | 120 | #if defined(Q_OS_UNIX) |
63 | int thread_pipe[2]; | 121 | int thread_pipe[2]; |
64 | 122 | ||
65 | // pending socket notifiers list | 123 | // pending socket notifiers list |
66 | QPtrList<QSockNot> sn_pending_list; | 124 | QPtrList<QSockNot> sn_pending_list; |
67 | // highest fd for all socket notifiers | 125 | // highest fd for all socket notifiers |
68 | int sn_highest; | 126 | int sn_highest; |
69 | // 3 socket notifier types - read, write and exception | 127 | // 3 socket notifier types - read, write and exception |
70 | QSockNotType sn_vec[3]; | 128 | QSockNotType sn_vec[3]; |
71 | #endif | 129 | #endif |
130 | |||
131 | #ifdef Q_WS_WIN | ||
132 | // pending socket notifiers list | ||
133 | QPtrList<QSockNot> sn_pending_list; | ||
134 | #endif // Q_WS_WIN | ||
135 | |||
72 | }; | 136 | }; |
73 | 137 | ||
74 | #endif // QEVENTLOOP_P_H | 138 | #endif // QEVENTLOOP_P_H |
diff --git a/qmake/include/private/qfontcodecs_p.h b/qmake/include/private/qfontcodecs_p.h index 8222f98..54b0ac1 100644 --- a/qmake/include/private/qfontcodecs_p.h +++ b/qmake/include/private/qfontcodecs_p.h | |||
@@ -38,34 +38,34 @@ | |||
38 | #ifndef QFONTCODECS_P_H | 38 | #ifndef QFONTCODECS_P_H |
39 | #define QFONTCODECS_P_H | 39 | #define QFONTCODECS_P_H |
40 | 40 | ||
41 | // | 41 | // |
42 | // W A R N I N G | 42 | // W A R N I N G |
43 | // ------------- | 43 | // ------------- |
44 | // | 44 | // |
45 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
46 | // of qfontencodings_x11.cpp and qfont_x11.cpp. This header file may | 46 | // of qfontencodings_x11.cpp and qfont_x11.cpp. This header file may |
47 | // change from version to version without notice, or even be removed. | 47 | // change from version to version without notice, or even be removed. |
48 | // | 48 | // |
49 | // We mean it. | 49 | // We mean it. |
50 | // | 50 | // |
51 | // | 51 | // |
52 | 52 | ||
53 | #ifndef QT_H | 53 | #ifndef QT_H |
54 | #include <qglobal.h> | 54 | #include "qglobal.h" |
55 | #include <qtextcodec.h> | 55 | #include "qtextcodec.h" |
56 | #endif // QT_H | 56 | #endif // QT_H |
57 | 57 | ||
58 | 58 | ||
59 | #ifndef QT_NO_CODECS | 59 | #ifndef QT_NO_CODECS |
60 | #ifndef QT_NO_BIG_CODECS | 60 | #ifndef QT_NO_BIG_CODECS |
61 | 61 | ||
62 | 62 | ||
63 | class QJpUnicodeConv; | 63 | class QJpUnicodeConv; |
64 | 64 | ||
65 | 65 | ||
66 | class QFontJis0201Codec : public QTextCodec | 66 | class QFontJis0201Codec : public QTextCodec |
67 | { | 67 | { |
68 | public: | 68 | public: |
69 | QFontJis0201Codec(); | 69 | QFontJis0201Codec(); |
70 | 70 | ||
71 | const char *name() const; | 71 | const char *name() const; |
diff --git a/qmake/include/private/qfontdata_p.h b/qmake/include/private/qfontdata_p.h index 917d14f..1eaf80c 100644 --- a/qmake/include/private/qfontdata_p.h +++ b/qmake/include/private/qfontdata_p.h | |||
@@ -149,32 +149,33 @@ class QFontStruct : public QShared | |||
149 | public: | 149 | public: |
150 | QFontStruct( const QString &key ); | 150 | QFontStruct( const QString &key ); |
151 | ~QFontStruct() { reset(); } | 151 | ~QFontStruct() { reset(); } |
152 | bool dirty() const { return hfont == 0; } | 152 | bool dirty() const { return hfont == 0; } |
153 | HDC dc() const; | 153 | HDC dc() const; |
154 | HFONT font() const { return hfont; } | 154 | HFONT font() const { return hfont; } |
155 | const TEXTMETRICA *textMetricA() const { return &tm.a; } | 155 | const TEXTMETRICA *textMetricA() const { return &tm.a; } |
156 | const TEXTMETRICW *textMetricW() const { return &tm.w; } | 156 | const TEXTMETRICW *textMetricW() const { return &tm.w; } |
157 | QString key() const { return k; } | 157 | QString key() const { return k; } |
158 | void reset(); | 158 | void reset(); |
159 | 159 | ||
160 | QStringk; | 160 | QStringk; |
161 | HDC hdc; | 161 | HDC hdc; |
162 | HFONThfont; | 162 | HFONThfont; |
163 | uintstockFont:1; | 163 | uintstockFont:1; |
164 | uintpaintDevice:1; | 164 | uintpaintDevice:1; |
165 | uint useTextOutA:1; | ||
165 | union { | 166 | union { |
166 | TEXTMETRICWw; | 167 | TEXTMETRICWw; |
167 | TEXTMETRICAa; | 168 | TEXTMETRICAa; |
168 | } tm; | 169 | } tm; |
169 | int lw; | 170 | int lw; |
170 | int cache_cost; | 171 | int cache_cost; |
171 | // friend void QFont::initFontInfo() const; | 172 | // friend void QFont::initFontInfo() const; |
172 | }; | 173 | }; |
173 | 174 | ||
174 | #endif // Q_WS_WIN | 175 | #endif // Q_WS_WIN |
175 | 176 | ||
176 | #if defined( Q_WS_MAC ) | 177 | #if defined( Q_WS_MAC ) |
177 | 178 | ||
178 | #if defined( Q_WS_MACX ) | 179 | #if defined( Q_WS_MACX ) |
179 | # define QMAC_FONT_ATSUI | 180 | # define QMAC_FONT_ATSUI |
180 | #endif | 181 | #endif |
@@ -400,33 +401,33 @@ public: | |||
400 | HFONT create( bool *stockFont, HDC hdc = 0, bool compatMode = FALSE ); | 401 | HFONT create( bool *stockFont, HDC hdc = 0, bool compatMode = FALSE ); |
401 | QFontStruct *fin; | 402 | QFontStruct *fin; |
402 | 403 | ||
403 | void buildCache( HDC hdc, const QString &str, int pos, int len, TextRun *cache ); | 404 | void buildCache( HDC hdc, const QString &str, int pos, int len, TextRun *cache ); |
404 | void drawText( HDC hdc, int x, int y, TextRun *cache ); | 405 | void drawText( HDC hdc, int x, int y, TextRun *cache ); |
405 | #endif // Q_WS_WIN | 406 | #endif // Q_WS_WIN |
406 | 407 | ||
407 | #ifdef Q_WS_QWS | 408 | #ifdef Q_WS_QWS |
408 | void load(); | 409 | void load(); |
409 | QFontStruct *fin; | 410 | QFontStruct *fin; |
410 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); | 411 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); |
411 | void drawText( QGfx *gfx, int x, int y, const TextRun *cache ); | 412 | void drawText( QGfx *gfx, int x, int y, const TextRun *cache ); |
412 | #endif | 413 | #endif |
413 | 414 | ||
414 | #if defined( Q_WS_MAC ) | 415 | #if defined( Q_WS_MAC ) |
415 | void macSetFont(QPaintDevice *); | 416 | void macSetFont(QPaintDevice *); |
416 | void drawText(int x, int y, QString s, int len, QPaintDevice *dev, const QRegion *rgn); | 417 | void drawText(int x, int y, const QString &s, int from, int len, QPaintDevice *dev, const QRegion *rgn, int dir); |
417 | void computeLineWidth(); | 418 | void computeLineWidth(); |
418 | void load(); | 419 | void load(); |
419 | QFontStruct *fin; | 420 | QFontStruct *fin; |
420 | #endif | 421 | #endif |
421 | 422 | ||
422 | }; | 423 | }; |
423 | 424 | ||
424 | inline QFontPrivate::QFontPrivate() | 425 | inline QFontPrivate::QFontPrivate() |
425 | : QShared(), exactMatch(FALSE), lineWidth(1) | 426 | : QShared(), exactMatch(FALSE), lineWidth(1) |
426 | { | 427 | { |
427 | 428 | ||
428 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) | 429 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) |
429 | fin = 0; | 430 | fin = 0; |
430 | #endif // Q_WS_WIN || Q_WS_QWS | 431 | #endif // Q_WS_WIN || Q_WS_QWS |
431 | #if defined(Q_WS_X11) | 432 | #if defined(Q_WS_X11) |
432 | x11Screen = QPaintDevice::x11AppScreen(); | 433 | x11Screen = QPaintDevice::x11AppScreen(); |
diff --git a/qmake/include/private/qgfxdriverinterface_p.h b/qmake/include/private/qgfxdriverinterface_p.h index 1782ed4..e8259ac 100644 --- a/qmake/include/private/qgfxdriverinterface_p.h +++ b/qmake/include/private/qgfxdriverinterface_p.h | |||
@@ -17,40 +17,52 @@ | |||
17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
18 | ** licenses for Qt/Embedded may use this file in accordance with the | 18 | ** licenses for Qt/Embedded may use this file in accordance with the |
19 | ** Qt Embedded Commercial License Agreement provided with the Software. | 19 | ** Qt Embedded Commercial License Agreement provided with the Software. |
20 | ** | 20 | ** |
21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
23 | ** | 23 | ** |
24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
25 | ** information about Qt Commercial License Agreements. | 25 | ** information about Qt Commercial License Agreements. |
26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
27 | ** | 27 | ** |
28 | ** Contact info@trolltech.com if any conditions of this licensing are | 28 | ** Contact info@trolltech.com if any conditions of this licensing are |
29 | ** not clear to you. | 29 | ** not clear to you. |
30 | ** | 30 | ** |
31 | **********************************************************************/ | 31 | **********************************************************************/ |
32 | 32 | ||
33 | #ifndef QGFXDRIVERINTERFACE_H | 33 | #ifndef QGFXDRIVERINTERFACE_P_H |
34 | #define QGFXDRIVERINTERFACE_H | 34 | #define QGFXDRIVERINTERFACE_P_H |
35 | |||
36 | // | ||
37 | // W A R N I N G | ||
38 | // ------------- | ||
39 | // | ||
40 | // This file is not part of the Qt API. This header file may | ||
41 | // change from version to version without notice, or even be | ||
42 | // removed. | ||
43 | // | ||
44 | // We mean it. | ||
45 | // | ||
46 | // | ||
35 | 47 | ||
36 | #ifndef QT_H | 48 | #ifndef QT_H |
37 | #include <private/qcom_p.h> | 49 | #include <private/qcom_p.h> |
38 | #endif // QT_H | 50 | #endif // QT_H |
39 | 51 | ||
40 | #ifndef QT_NO_COMPONENT | 52 | #ifndef QT_NO_COMPONENT |
41 | 53 | ||
42 | // {449EC6C6-DF3E-43E3-9E57-354A3D05AB34} | 54 | // {449EC6C6-DF3E-43E3-9E57-354A3D05AB34} |
43 | #ifndef IID_QGfxDriver | 55 | #ifndef IID_QGfxDriver |
44 | #define IID_QGfxDriver QUuid( 0x449ec6c6, 0xdf3e, 0x43e3, 0x9e, 0x57, 0x35, 0x4a, 0x3d, 0x05, 0xab, 0x34) | 56 | #define IID_QGfxDriver QUuid( 0x449ec6c6, 0xdf3e, 0x43e3, 0x9e, 0x57, 0x35, 0x4a, 0x3d, 0x05, 0xab, 0x34) |
45 | #endif | 57 | #endif |
46 | 58 | ||
47 | class QScreen; | 59 | class QScreen; |
48 | 60 | ||
49 | struct Q_EXPORT QGfxDriverInterface : public QFeatureListInterface | 61 | struct Q_EXPORT QGfxDriverInterface : public QFeatureListInterface |
50 | { | 62 | { |
51 | virtual QScreen* create( const QString& driver, int displayId ) = 0; | 63 | virtual QScreen* create( const QString& driver, int displayId ) = 0; |
52 | }; | 64 | }; |
53 | 65 | ||
54 | #endif // QT_NO_COMPONENT | 66 | #endif // QT_NO_COMPONENT |
55 | 67 | ||
56 | #endif // QGFXDRIVERINTERFACE_H | 68 | #endif // QGFXDRIVERINTERFACE_P_H |
diff --git a/qmake/include/private/qgpluginmanager_p.h b/qmake/include/private/qgpluginmanager_p.h index e0c0e78..2e4e9c5 100644 --- a/qmake/include/private/qgpluginmanager_p.h +++ b/qmake/include/private/qgpluginmanager_p.h | |||
@@ -1,53 +1,53 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QGPluginManager class | 4 | ** Definition of QGPluginManager class |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the tools module of the Qt GUI Toolkit. | 8 | ** This file is part of the tools module of the Qt GUI Toolkit. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QGPLUGINMANAGER_H | 36 | #ifndef QGPLUGINMANAGER_P_H |
37 | #define QGPLUGINMANAGER_H | 37 | #define QGPLUGINMANAGER_P_H |
38 | 38 | ||
39 | #ifndef QT_H | 39 | #ifndef QT_H |
40 | #include "qdict.h" | 40 | #include "qdict.h" |
41 | #include "qlibrary.h" | 41 | #include "qlibrary.h" |
42 | #include "quuid.h" | 42 | #include "quuid.h" |
43 | #include "qstringlist.h" | 43 | #include "qstringlist.h" |
44 | #include "qcom_p.h" | 44 | #include "qcom_p.h" |
45 | #endif // QT_H | 45 | #endif // QT_H |
46 | 46 | ||
47 | // | 47 | // |
48 | // W A R N I N G | 48 | // W A R N I N G |
49 | // ------------- | 49 | // ------------- |
50 | // | 50 | // |
51 | // This file is not part of the Qt API. It exists for the convenience | 51 | // This file is not part of the Qt API. It exists for the convenience |
52 | // of a number of Qt sources files. This header file may change from | 52 | // of a number of Qt sources files. This header file may change from |
53 | // version to version without notice, or even be removed. | 53 | // version to version without notice, or even be removed. |
@@ -91,17 +91,17 @@ protected: | |||
91 | uint casesens : 1; | 91 | uint casesens : 1; |
92 | uint autounload : 1; | 92 | uint autounload : 1; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | inline void QGPluginManager::setAutoUnload( bool unload ) | 95 | inline void QGPluginManager::setAutoUnload( bool unload ) |
96 | { | 96 | { |
97 | autounload = unload; | 97 | autounload = unload; |
98 | } | 98 | } |
99 | 99 | ||
100 | inline bool QGPluginManager::autoUnload() const | 100 | inline bool QGPluginManager::autoUnload() const |
101 | { | 101 | { |
102 | return autounload; | 102 | return autounload; |
103 | } | 103 | } |
104 | 104 | ||
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | #endif //QGPLUGINMANAGER_H | 107 | #endif //QGPLUGINMANAGER_P_H |
diff --git a/qmake/include/private/qimageformatinterface_p.h b/qmake/include/private/qimageformatinterface_p.h index 5f7601c..fd4c256 100644 --- a/qmake/include/private/qimageformatinterface_p.h +++ b/qmake/include/private/qimageformatinterface_p.h | |||
@@ -1,53 +1,53 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ??? | 4 | ** ... |
5 | ** | 5 | ** |
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 8 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QIMAGEFORMATINTERFACE_H | 36 | #ifndef QIMAGEFORMATINTERFACE_P_H |
37 | #define QIMAGEFORMATINTERFACE_H | 37 | #define QIMAGEFORMATINTERFACE_P_H |
38 | 38 | ||
39 | #ifndef QT_H | 39 | #ifndef QT_H |
40 | #include <private/qcom_p.h> | 40 | #include <private/qcom_p.h> |
41 | #endif // QT_H | 41 | #endif // QT_H |
42 | 42 | ||
43 | 43 | ||
44 | // | 44 | // |
45 | // W A R N I N G | 45 | // W A R N I N G |
46 | // ------------- | 46 | // ------------- |
47 | // | 47 | // |
48 | // This file is not part of the Qt API. It exists for the convenience | 48 | // This file is not part of the Qt API. It exists for the convenience |
49 | // of internal files. This header file may change from version to version | 49 | // of internal files. This header file may change from version to version |
50 | // without notice, or even be removed. | 50 | // without notice, or even be removed. |
51 | // | 51 | // |
52 | // We mean it. | 52 | // We mean it. |
53 | // | 53 | // |
@@ -59,17 +59,17 @@ | |||
59 | #ifndef IID_QImageFormat | 59 | #ifndef IID_QImageFormat |
60 | #define IID_QImageFormat QUuid( 0x04903f05, 0x54b1, 0x4726, 0xa8, 0x49, 0xfb, 0x5c, 0xb0, 0x97, 0xca, 0x87 ) | 60 | #define IID_QImageFormat QUuid( 0x04903f05, 0x54b1, 0x4726, 0xa8, 0x49, 0xfb, 0x5c, 0xb0, 0x97, 0xca, 0x87 ) |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | class QImage; | 63 | class QImage; |
64 | 64 | ||
65 | struct Q_EXPORT QImageFormatInterface : public QFeatureListInterface | 65 | struct Q_EXPORT QImageFormatInterface : public QFeatureListInterface |
66 | { | 66 | { |
67 | virtual QRESULT loadImage( const QString &format, const QString &filename, QImage * ) = 0; | 67 | virtual QRESULT loadImage( const QString &format, const QString &filename, QImage * ) = 0; |
68 | virtual QRESULT saveImage( const QString &format, const QString &filename, const QImage & ) = 0; | 68 | virtual QRESULT saveImage( const QString &format, const QString &filename, const QImage & ) = 0; |
69 | 69 | ||
70 | virtual QRESULT installIOHandler( const QString & ) = 0; | 70 | virtual QRESULT installIOHandler( const QString & ) = 0; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #endif // QT_NO_COMPONENT | 73 | #endif // QT_NO_COMPONENT |
74 | 74 | ||
75 | #endif // QIMAGEFORMATINTERFACE_H | 75 | #endif // QIMAGEFORMATINTERFACE_P_H |
diff --git a/qmake/include/private/qinputcontext_p.h b/qmake/include/private/qinputcontext_p.h index 9ac0d2b..4d94147 100644 --- a/qmake/include/private/qinputcontext_p.h +++ b/qmake/include/private/qinputcontext_p.h | |||
@@ -74,48 +74,51 @@ class QWSIMEvent; | |||
74 | class QInputContext | 74 | class QInputContext |
75 | { | 75 | { |
76 | public: | 76 | public: |
77 | #ifdef Q_WS_X11 | 77 | #ifdef Q_WS_X11 |
78 | QInputContext(QWidget *); // should be a toplevel widget | 78 | QInputContext(QWidget *); // should be a toplevel widget |
79 | ~QInputContext(); | 79 | ~QInputContext(); |
80 | 80 | ||
81 | void setFocus(); | 81 | void setFocus(); |
82 | void setComposePosition(int, int); | 82 | void setComposePosition(int, int); |
83 | void setComposeArea(int, int, int, int); | 83 | void setComposeArea(int, int, int, int); |
84 | void reset(); | 84 | void reset(); |
85 | 85 | ||
86 | int lookupString(XKeyEvent *, QCString &, KeySym *, Status *) const; | 86 | int lookupString(XKeyEvent *, QCString &, KeySym *, Status *) const; |
87 | void setXFontSet(const QFont &); | 87 | void setXFontSet(const QFont &); |
88 | 88 | ||
89 | void *ic; | 89 | void *ic; |
90 | QString text, lastcompose; | 90 | QString text; |
91 | QWidget *focusWidget; | 91 | QWidget *focusWidget; |
92 | bool composing; | 92 | bool composing; |
93 | QFont font; | 93 | QFont font; |
94 | XFontSet fontset; | 94 | XFontSet fontset; |
95 | QMemArray<bool> selectedChars; | 95 | QMemArray<bool> selectedChars; |
96 | #endif // Q_WS_X11 | 96 | #endif // Q_WS_X11 |
97 | 97 | ||
98 | #ifdef Q_WS_QWS | 98 | #ifdef Q_WS_QWS |
99 | static void translateIMEvent( QWSIMEvent *, QWidget * ); | 99 | static void translateIMEvent( QWSIMEvent *, QWidget * ); |
100 | static void reset(); | 100 | static void reset(); |
101 | private: | 101 | private: |
102 | static QWidget* focusWidget; | 102 | static QWidget* focusWidget; |
103 | static QString* composition; | 103 | static QString* composition; |
104 | #endif //Q_WS_QWS | 104 | #endif //Q_WS_QWS |
105 | 105 | ||
106 | #ifdef Q_WS_WIN | 106 | #ifdef Q_WS_WIN |
107 | static void init(); | 107 | static void init(); |
108 | static void shutdown(); | 108 | static void shutdown(); |
109 | 109 | ||
110 | static void TranslateMessage( const MSG *msg); | 110 | static void TranslateMessage( const MSG *msg); |
111 | static LRESULT DefWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); | 111 | static LRESULT DefWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); |
112 | 112 | ||
113 | static void setFont( const QWidget *w, const QFont & ); | 113 | static void setFont( const QWidget *w, const QFont & ); |
114 | static void setFocusHint( int x, int y, int w, int h, const QWidget *widget ); | 114 | static void setFocusHint( int x, int y, int w, int h, const QWidget *widget ); |
115 | static bool startComposition(); | 115 | static bool startComposition(); |
116 | static bool endComposition( QWidget *fw = 0 ); | 116 | static bool endComposition( QWidget *fw = 0 ); |
117 | static bool composition( LPARAM lparam ); | 117 | static bool composition( LPARAM lparam ); |
118 | |||
119 | static void accept( QWidget *fw = 0 ); | ||
120 | static void enable( bool ); | ||
118 | #endif | 121 | #endif |
119 | }; | 122 | }; |
120 | 123 | ||
121 | #endif // QINPUTCONTEXT_P_H | 124 | #endif // QINPUTCONTEXT_P_H |
diff --git a/qmake/include/private/qkbddriverinterface_p.h b/qmake/include/private/qkbddriverinterface_p.h index efc7ded..fe13487 100644 --- a/qmake/include/private/qkbddriverinterface_p.h +++ b/qmake/include/private/qkbddriverinterface_p.h | |||
@@ -17,40 +17,52 @@ | |||
17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
18 | ** licenses for Qt/Embedded may use this file in accordance with the | 18 | ** licenses for Qt/Embedded may use this file in accordance with the |
19 | ** Qt Embedded Commercial License Agreement provided with the Software. | 19 | ** Qt Embedded Commercial License Agreement provided with the Software. |
20 | ** | 20 | ** |
21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
23 | ** | 23 | ** |
24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
25 | ** information about Qt Commercial License Agreements. | 25 | ** information about Qt Commercial License Agreements. |
26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
27 | ** | 27 | ** |
28 | ** Contact info@trolltech.com if any conditions of this licensing are | 28 | ** Contact info@trolltech.com if any conditions of this licensing are |
29 | ** not clear to you. | 29 | ** not clear to you. |
30 | ** | 30 | ** |
31 | **********************************************************************/ | 31 | **********************************************************************/ |
32 | 32 | ||
33 | #ifndef QKBDDRIVERINTERFACE_H | 33 | #ifndef QKBDDRIVERINTERFACE_P_H |
34 | #define QKBDDRIVERINTERFACE_H | 34 | #define QKBDDRIVERINTERFACE_P_H |
35 | |||
36 | // | ||
37 | // W A R N I N G | ||
38 | // ------------- | ||
39 | // | ||
40 | // This file is not part of the Qt API. This header file may | ||
41 | // change from version to version without notice, or even be | ||
42 | // removed. | ||
43 | // | ||
44 | // We mean it. | ||
45 | // | ||
46 | // | ||
35 | 47 | ||
36 | #ifndef QT_H | 48 | #ifndef QT_H |
37 | #include <private/qcom_p.h> | 49 | #include <private/qcom_p.h> |
38 | #endif // QT_H | 50 | #endif // QT_H |
39 | 51 | ||
40 | #ifndef QT_NO_COMPONENT | 52 | #ifndef QT_NO_COMPONENT |
41 | 53 | ||
42 | // {C7C838EA-FC3E-4905-92AD-F479E81F1D02} | 54 | // {C7C838EA-FC3E-4905-92AD-F479E81F1D02} |
43 | #ifndef IID_QKbdDriver | 55 | #ifndef IID_QKbdDriver |
44 | #define IID_QKbdDriver QUuid( 0xc7c838ea, 0xfc3e, 0x4905, 0x92, 0xad, 0xf4, 0x79, 0xe8, 0x1f, 0x1d, 0x02) | 56 | #define IID_QKbdDriver QUuid( 0xc7c838ea, 0xfc3e, 0x4905, 0x92, 0xad, 0xf4, 0x79, 0xe8, 0x1f, 0x1d, 0x02) |
45 | #endif | 57 | #endif |
46 | 58 | ||
47 | class QWSKeyboardHandler; | 59 | class QWSKeyboardHandler; |
48 | 60 | ||
49 | struct Q_EXPORT QKbdDriverInterface : public QFeatureListInterface | 61 | struct Q_EXPORT QKbdDriverInterface : public QFeatureListInterface |
50 | { | 62 | { |
51 | virtual QWSKeyboardHandler* create( const QString& driver, const QString& device ) = 0; | 63 | virtual QWSKeyboardHandler* create( const QString& driver, const QString& device ) = 0; |
52 | }; | 64 | }; |
53 | 65 | ||
54 | #endif // QT_NO_COMPONENT | 66 | #endif // QT_NO_COMPONENT |
55 | 67 | ||
56 | #endif // QKBDDRIVERINTERFACE_H | 68 | #endif // QKBDDRIVERINTERFACE_P_H |
diff --git a/qmake/include/private/qlibrary_p.h b/qmake/include/private/qlibrary_p.h index c4dd565..1624ca5 100644 --- a/qmake/include/private/qlibrary_p.h +++ b/qmake/include/private/qlibrary_p.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of an internal QLibrary class | 4 | ** Definition of an internal QLibrary class |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
@@ -42,35 +42,32 @@ | |||
42 | // W A R N I N G | 42 | // W A R N I N G |
43 | // ------------- | 43 | // ------------- |
44 | // | 44 | // |
45 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
46 | // of the QLibrary class. This header file may change from | 46 | // of the QLibrary class. This header file may change from |
47 | // version to version without notice, or even be removed. | 47 | // version to version without notice, or even be removed. |
48 | // | 48 | // |
49 | // We mean it. | 49 | // We mean it. |
50 | // | 50 | // |
51 | // | 51 | // |
52 | 52 | ||
53 | #include "qlibrary.h" | 53 | #include "qlibrary.h" |
54 | 54 | ||
55 | #ifndef QT_NO_LIBRARY | 55 | #ifndef QT_NO_LIBRARY |
56 | 56 | ||
57 | #ifndef QT_H | 57 | #ifndef QT_H |
58 | #if defined(Q_CC_GNU) | ||
59 | #warning "avoid including header file \"qwindowdefs.h\" in directory 'tools'" | ||
60 | #endif | ||
61 | #include "qwindowdefs.h" | 58 | #include "qwindowdefs.h" |
62 | #endif // QT_H | 59 | #endif // QT_H |
63 | 60 | ||
64 | class QLibraryPrivate | 61 | class QLibraryPrivate |
65 | { | 62 | { |
66 | public: | 63 | public: |
67 | QLibraryPrivate( QLibrary *lib ); | 64 | QLibraryPrivate( QLibrary *lib ); |
68 | 65 | ||
69 | #ifdef Q_WS_WIN | 66 | #ifdef Q_WS_WIN |
70 | HINSTANCE pHnd; | 67 | HINSTANCE pHnd; |
71 | #else | 68 | #else |
72 | void *pHnd; | 69 | void *pHnd; |
73 | #endif | 70 | #endif |
74 | 71 | ||
75 | bool loadLibrary(); | 72 | bool loadLibrary(); |
76 | bool freeLibrary(); | 73 | bool freeLibrary(); |
diff --git a/qmake/include/private/qlock_p.h b/qmake/include/private/qlock_p.h new file mode 100644 index 0000000..5c261aa --- a/dev/null +++ b/qmake/include/private/qlock_p.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of QLock class. This manages interprocess locking | ||
5 | ** | ||
6 | ** Created : 20000406 | ||
7 | ** | ||
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
9 | ** | ||
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | ||
11 | ** | ||
12 | ** This file may be distributed and/or modified under the terms of the | ||
13 | ** GNU General Public License version 2 as published by the Free Software | ||
14 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
15 | ** packaging of this file. | ||
16 | ** | ||
17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
18 | ** licenses for Qt/Embedded may use this file in accordance with the | ||
19 | ** Qt Embedded Commercial License Agreement provided with the Software. | ||
20 | ** | ||
21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
23 | ** | ||
24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
25 | ** information about Qt Commercial License Agreements. | ||
26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
27 | ** | ||
28 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
29 | ** not clear to you. | ||
30 | ** | ||
31 | **********************************************************************/ | ||
32 | |||
33 | #ifndef QLOCK_P_H | ||
34 | #define QLOCK_P_H | ||
35 | |||
36 | // | ||
37 | // W A R N I N G | ||
38 | // ------------- | ||
39 | // | ||
40 | // This file is not part of the Qt API. This header file may | ||
41 | // change from version to version without notice, or even be | ||
42 | // removed. | ||
43 | // | ||
44 | // We mean it. | ||
45 | // | ||
46 | // | ||
47 | |||
48 | #ifndef QT_H | ||
49 | #include <qstring.h> | ||
50 | #endif // QT_H | ||
51 | |||
52 | class QLockData; | ||
53 | |||
54 | class QLock | ||
55 | { | ||
56 | public: | ||
57 | QLock( const QString &filename, char id, bool create = FALSE ); | ||
58 | ~QLock(); | ||
59 | |||
60 | enum Type { Read, Write }; | ||
61 | |||
62 | bool isValid() const; | ||
63 | void lock( Type type ); | ||
64 | void unlock(); | ||
65 | bool locked() const; | ||
66 | |||
67 | private: | ||
68 | Type type; | ||
69 | QLockData *data; | ||
70 | }; | ||
71 | |||
72 | |||
73 | // Nice class for ensuring the lock is released. | ||
74 | // Just create one on the stack and the lock is automatically released | ||
75 | // when QLockHolder is destructed. | ||
76 | class QLockHolder | ||
77 | { | ||
78 | public: | ||
79 | QLockHolder( QLock *l, QLock::Type type ) : qlock(l) { | ||
80 | qlock->lock( type ); | ||
81 | } | ||
82 | ~QLockHolder() { if ( locked() ) qlock->unlock(); } | ||
83 | |||
84 | void lock( QLock::Type type ) { qlock->lock( type ); } | ||
85 | void unlock() { qlock->unlock(); } | ||
86 | bool locked() const { return qlock->locked(); } | ||
87 | |||
88 | private: | ||
89 | QLock *qlock; | ||
90 | }; | ||
91 | |||
92 | #endif | ||
93 | |||
diff --git a/qmake/include/private/qmousedriverinterface_p.h b/qmake/include/private/qmousedriverinterface_p.h index fd76308..42a2e3e 100644 --- a/qmake/include/private/qmousedriverinterface_p.h +++ b/qmake/include/private/qmousedriverinterface_p.h | |||
@@ -17,40 +17,52 @@ | |||
17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
18 | ** licenses for Qt/Embedded may use this file in accordance with the | 18 | ** licenses for Qt/Embedded may use this file in accordance with the |
19 | ** Qt Embedded Commercial License Agreement provided with the Software. | 19 | ** Qt Embedded Commercial License Agreement provided with the Software. |
20 | ** | 20 | ** |
21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
23 | ** | 23 | ** |
24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
25 | ** information about Qt Commercial License Agreements. | 25 | ** information about Qt Commercial License Agreements. |
26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
27 | ** | 27 | ** |
28 | ** Contact info@trolltech.com if any conditions of this licensing are | 28 | ** Contact info@trolltech.com if any conditions of this licensing are |
29 | ** not clear to you. | 29 | ** not clear to you. |
30 | ** | 30 | ** |
31 | **********************************************************************/ | 31 | **********************************************************************/ |
32 | 32 | ||
33 | #ifndef QMOUSEDRIVERINTERFACE_H | 33 | #ifndef QMOUSEDRIVERINTERFACE_P_H |
34 | #define QMOUSEDRIVERINTERFACE_H | 34 | #define QMOUSEDRIVERINTERFACE_P_H |
35 | |||
36 | // | ||
37 | // W A R N I N G | ||
38 | // ------------- | ||
39 | // | ||
40 | // This file is not part of the Qt API. This header file may | ||
41 | // change from version to version without notice, or even be | ||
42 | // removed. | ||
43 | // | ||
44 | // We mean it. | ||
45 | // | ||
46 | // | ||
35 | 47 | ||
36 | #ifndef QT_H | 48 | #ifndef QT_H |
37 | #include <private/qcom_p.h> | 49 | #include <private/qcom_p.h> |
38 | #endif // QT_H | 50 | #endif // QT_H |
39 | 51 | ||
40 | #ifndef QT_NO_COMPONENT | 52 | #ifndef QT_NO_COMPONENT |
41 | 53 | ||
42 | // {4367CF5A-F7CE-407B-8BB6-DF19AEDA2EBB} | 54 | // {4367CF5A-F7CE-407B-8BB6-DF19AEDA2EBB} |
43 | #ifndef IID_QMouseDriver | 55 | #ifndef IID_QMouseDriver |
44 | #define IID_QMouseDriver QUuid( 0x4367cf5a, 0xf7ce, 0x407b, 0x8b, 0xb6, 0xdf, 0x19, 0xae, 0xda, 0x2e, 0xbb) | 56 | #define IID_QMouseDriver QUuid( 0x4367cf5a, 0xf7ce, 0x407b, 0x8b, 0xb6, 0xdf, 0x19, 0xae, 0xda, 0x2e, 0xbb) |
45 | #endif | 57 | #endif |
46 | 58 | ||
47 | class QWSMouseHandler; | 59 | class QWSMouseHandler; |
48 | 60 | ||
49 | struct Q_EXPORT QMouseDriverInterface : public QFeatureListInterface | 61 | struct Q_EXPORT QMouseDriverInterface : public QFeatureListInterface |
50 | { | 62 | { |
51 | virtual QWSMouseHandler* create( const QString& driver, const QString &device ) = 0; | 63 | virtual QWSMouseHandler* create( const QString& driver, const QString &device ) = 0; |
52 | }; | 64 | }; |
53 | 65 | ||
54 | #endif // QT_NO_COMPONENT | 66 | #endif // QT_NO_COMPONENT |
55 | 67 | ||
56 | #endif // QMOUSEDRIVERINTERFACE_H | 68 | #endif // QMOUSEDRIVERINTERFACE_P_H |
diff --git a/qmake/include/private/qmutexpool_p.h b/qmake/include/private/qmutexpool_p.h index 3d9fef7..fb84157 100644 --- a/qmake/include/private/qmutexpool_p.h +++ b/qmake/include/private/qmutexpool_p.h | |||
@@ -1,39 +1,75 @@ | |||
1 | #ifndef QMUTEXPOOL_H | 1 | /**************************************************************************** |
2 | #define QMUTEXPOOL_H | 2 | ** $Id$ |
3 | ** | ||
4 | ** ... | ||
5 | ** | ||
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the tools module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
20 | ** licenses may use this file in accordance with the Qt Commercial License | ||
21 | ** Agreement provided with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #ifndef QMUTEXPOOL_P_H | ||
37 | #define QMUTEXPOOL_P_H | ||
3 | 38 | ||
4 | // | 39 | // |
5 | // W A R N I N G | 40 | // W A R N I N G |
6 | // ------------- | 41 | // ------------- |
7 | // | 42 | // |
8 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
9 | // of QSettings. This header file may change from version to | 44 | // of QSettings. This header file may change from version to |
10 | // version without notice, or even be removed. | 45 | // version without notice, or even be removed. |
11 | // | 46 | // |
12 | // We mean it. | 47 | // We mean it. |
13 | // | 48 | // |
14 | // | 49 | // |
15 | 50 | ||
16 | #ifdef QT_THREAD_SUPPORT | 51 | #ifdef QT_THREAD_SUPPORT |
17 | 52 | ||
18 | #include "qmutex.h" | 53 | #include "qmutex.h" |
19 | #include "qmemarray.h" | 54 | #include "qmemarray.h" |
20 | 55 | ||
21 | class QMutexPool | 56 | class QMutexPool |
22 | { | 57 | { |
23 | public: | 58 | public: |
24 | QMutexPool( bool recursive = FALSE, int size = 17 ); | 59 | QMutexPool( bool recursive = FALSE, int size = 17 ); |
25 | ~QMutexPool(); | 60 | ~QMutexPool(); |
26 | 61 | ||
27 | QMutex *get( void *address ); | 62 | QMutex *get( void *address ); |
28 | 63 | ||
29 | private: | 64 | private: |
30 | QMutex mutex; | 65 | QMutex mutex; |
31 | QMemArray<QMutex*> mutexes; | 66 | QMutex **mutexes; |
67 | int count; | ||
32 | bool recurs; | 68 | bool recurs; |
33 | }; | 69 | }; |
34 | 70 | ||
35 | extern QMutexPool *qt_global_mutexpool; | 71 | extern QMutexPool *qt_global_mutexpool; |
36 | 72 | ||
37 | #endif // QT_THREAD_SUPPORT | 73 | #endif // QT_THREAD_SUPPORT |
38 | 74 | ||
39 | #endif // QMUTEXPOOL_H | 75 | #endif // QMUTEXPOOL_P_H |
diff --git a/qmake/include/private/qpluginmanager_p.h b/qmake/include/private/qpluginmanager_p.h index 4b64ba0..a8da10e 100644 --- a/qmake/include/private/qpluginmanager_p.h +++ b/qmake/include/private/qpluginmanager_p.h | |||
@@ -1,73 +1,73 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QPluginManager class | 4 | ** Definition of QPluginManager class |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QPLUGINMANAGER_H | 38 | #ifndef QPLUGINMANAGER_P_H |
39 | #define QPLUGINMANAGER_H | 39 | #define QPLUGINMANAGER_P_H |
40 | |||
41 | #ifndef QT_H | ||
42 | #include "qgpluginmanager_p.h" | ||
43 | #endif // QT_H | ||
44 | 40 | ||
45 | // | 41 | // |
46 | // W A R N I N G | 42 | // W A R N I N G |
47 | // ------------- | 43 | // ------------- |
48 | // | 44 | // |
49 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
50 | // of a number of Qt sources files. This header file may change from | 46 | // of a number of Qt sources files. This header file may change from |
51 | // version to version without notice, or even be removed. | 47 | // version to version without notice, or even be removed. |
52 | // | 48 | // |
53 | // We mean it. | 49 | // We mean it. |
54 | // | 50 | // |
55 | // | 51 | // |
56 | 52 | ||
53 | #ifndef QT_H | ||
54 | #include "qgpluginmanager_p.h" | ||
55 | #endif // QT_H | ||
56 | |||
57 | #ifndef QT_NO_COMPONENT | 57 | #ifndef QT_NO_COMPONENT |
58 | 58 | ||
59 | template<class Type> | 59 | template<class Type> |
60 | class QPluginManager : public QGPluginManager | 60 | class QPluginManager : public QGPluginManager |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | QPluginManager( const QUuid& id, const QStringList& paths = QString::null, const QString &suffix = QString::null, bool cs = TRUE ) | 63 | QPluginManager( const QUuid& id, const QStringList& paths = QString::null, const QString &suffix = QString::null, bool cs = TRUE ) |
64 | : QGPluginManager( id, paths, suffix, cs ) {} | 64 | : QGPluginManager( id, paths, suffix, cs ) {} |
65 | QRESULT queryInterface(const QString& feature, Type** iface) const | 65 | QRESULT queryInterface(const QString& feature, Type** iface) const |
66 | { | 66 | { |
67 | return queryUnknownInterface( feature, (QUnknownInterface**)iface ); | 67 | return queryUnknownInterface( feature, (QUnknownInterface**)iface ); |
68 | } | 68 | } |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif //QT_NO_COMPONENT | 71 | #endif //QT_NO_COMPONENT |
72 | 72 | ||
73 | #endif //QPLUGINMANAGER_H | 73 | #endif //QPLUGINMANAGER_P_H |
diff --git a/qmake/include/private/qpsprinter_p.h b/qmake/include/private/qpsprinter_p.h index 27a4968..692cb44 100644 --- a/qmake/include/private/qpsprinter_p.h +++ b/qmake/include/private/qpsprinter_p.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of internal QPSPrinter class. | 4 | ** Definition of internal QPSPrinter class. |
5 | ** QPSPrinter implements PostScript (tm) output via QPrinter. | 5 | ** QPSPrinter implements PostScript (tm) output via QPrinter. |
6 | ** | 6 | ** |
7 | ** Created : 940927 | 7 | ** Created : 940927 |
8 | ** | 8 | ** |
9 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 9 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
10 | ** | 10 | ** |
11 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 11 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
12 | ** | 12 | ** |
13 | ** This file may be distributed under the terms of the Q Public License | 13 | ** This file may be distributed under the terms of the Q Public License |
14 | ** as defined by Trolltech AS of Norway and appearing in the file | 14 | ** as defined by Trolltech AS of Norway and appearing in the file |
15 | ** LICENSE.QPL included in the packaging of this file. | 15 | ** LICENSE.QPL included in the packaging of this file. |
16 | ** | 16 | ** |
17 | ** This file may be distributed and/or modified under the terms of the | 17 | ** This file may be distributed and/or modified under the terms of the |
18 | ** GNU General Public License version 2 as published by the Free Software | 18 | ** GNU General Public License version 2 as published by the Free Software |
19 | ** Foundation and appearing in the file LICENSE.GPL included in the | 19 | ** Foundation and appearing in the file LICENSE.GPL included in the |
20 | ** packaging of this file. | 20 | ** packaging of this file. |
21 | ** | 21 | ** |
22 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 22 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
23 | ** licenses may use this file in accordance with the Qt Commercial License | 23 | ** licenses may use this file in accordance with the Qt Commercial License |
24 | ** Agreement provided with the Software. | 24 | ** Agreement provided with the Software. |
25 | ** | 25 | ** |
@@ -48,33 +48,33 @@ | |||
48 | // of qpsprinter.cpp and qprinter_x11.cpp. | 48 | // of qpsprinter.cpp and qprinter_x11.cpp. |
49 | // This header file may change from version to version without notice, | 49 | // This header file may change from version to version without notice, |
50 | // or even be removed. | 50 | // or even be removed. |
51 | // | 51 | // |
52 | // We mean it. | 52 | // We mean it. |
53 | // | 53 | // |
54 | // | 54 | // |
55 | 55 | ||
56 | 56 | ||
57 | #ifndef QT_H | 57 | #ifndef QT_H |
58 | #include "qprinter.h" | 58 | #include "qprinter.h" |
59 | #include "qtextstream.h" | 59 | #include "qtextstream.h" |
60 | #endif // QT_H | 60 | #endif // QT_H |
61 | 61 | ||
62 | #ifndef QT_NO_PRINTER | 62 | #ifndef QT_NO_PRINTER |
63 | 63 | ||
64 | struct QPSPrinterPrivate; | 64 | class QPSPrinterPrivate; |
65 | 65 | ||
66 | class Q_EXPORT QPSPrinter : public QPaintDevice | 66 | class Q_EXPORT QPSPrinter : public QPaintDevice |
67 | { | 67 | { |
68 | private: | 68 | private: |
69 | // QPrinter uses these | 69 | // QPrinter uses these |
70 | QPSPrinter( QPrinter *, int ); | 70 | QPSPrinter( QPrinter *, int ); |
71 | ~QPSPrinter(); | 71 | ~QPSPrinter(); |
72 | 72 | ||
73 | bool cmd ( int, QPainter *, QPDevCmdParam * ); | 73 | bool cmd ( int, QPainter *, QPDevCmdParam * ); |
74 | 74 | ||
75 | enum { NewPage = 100, AbortPrinting }; | 75 | enum { NewPage = 100, AbortPrinting }; |
76 | 76 | ||
77 | friend class QPrinter; | 77 | friend class QPrinter; |
78 | private: | 78 | private: |
79 | // not used by QPrinter | 79 | // not used by QPrinter |
80 | QPSPrinterPrivate *d; | 80 | QPSPrinterPrivate *d; |
diff --git a/qmake/include/private/qrichtext_p.h b/qmake/include/private/qrichtext_p.h index 8e29804..9ed87cf 100644 --- a/qmake/include/private/qrichtext_p.h +++ b/qmake/include/private/qrichtext_p.h | |||
@@ -143,52 +143,54 @@ public: | |||
143 | union { | 143 | union { |
144 | QTextFormat* format; | 144 | QTextFormat* format; |
145 | CustomData* custom; | 145 | CustomData* custom; |
146 | } d; | 146 | } d; |
147 | 147 | ||
148 | bool isAnchor() const { return ( type & Anchor) != 0; } | 148 | bool isAnchor() const { return ( type & Anchor) != 0; } |
149 | bool isLink() const { return isAnchor() && !!d.custom->anchorHref; } | 149 | bool isLink() const { return isAnchor() && !!d.custom->anchorHref; } |
150 | QString anchorName() const; | 150 | QString anchorName() const; |
151 | QString anchorHref() const; | 151 | QString anchorHref() const; |
152 | void setAnchor( const QString& name, const QString& href ); | 152 | void setAnchor( const QString& name, const QString& href ); |
153 | 153 | ||
154 | private: | 154 | private: |
155 | QTextStringChar &operator=( const QTextStringChar & ) { | 155 | QTextStringChar &operator=( const QTextStringChar & ) { |
156 | //abort(); | 156 | //abort(); |
157 | return *this; | 157 | return *this; |
158 | } | 158 | } |
159 | QTextStringChar( const QTextStringChar & ) { | ||
160 | } | ||
159 | friend class QComplexText; | 161 | friend class QComplexText; |
160 | friend class QTextParagraph; | 162 | friend class QTextParagraph; |
161 | }; | 163 | }; |
162 | 164 | ||
163 | #if defined(Q_TEMPLATEDLL) | 165 | #if defined(Q_TEMPLATEDLL) |
164 | // MOC_SKIP_BEGIN | 166 | // MOC_SKIP_BEGIN |
165 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; | 167 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; |
166 | // MOC_SKIP_END | 168 | // MOC_SKIP_END |
167 | #endif | 169 | #endif |
168 | 170 | ||
169 | class Q_EXPORT QTextString | 171 | class Q_EXPORT QTextString |
170 | { | 172 | { |
171 | public: | 173 | public: |
172 | 174 | ||
173 | QTextString(); | 175 | QTextString(); |
174 | QTextString( const QTextString &s ); | 176 | QTextString( const QTextString &s ); |
175 | virtual ~QTextString(); | 177 | virtual ~QTextString(); |
176 | 178 | ||
177 | static QString toString( const QMemArray<QTextStringChar> &data ); | 179 | static QString toString( const QMemArray<QTextStringChar> &data, bool fixspaces = TRUE ); |
178 | QString toString() const; | 180 | QString toString( bool fixspaces = TRUE ) const; |
179 | 181 | ||
180 | QTextStringChar &at( int i ) const; | 182 | QTextStringChar &at( int i ) const; |
181 | #if defined(Q_STRICT_INLINING_RULES) | 183 | #if defined(Q_STRICT_INLINING_RULES) |
182 | // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the | 184 | // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the |
183 | // implementation to be a redefinition. | 185 | // implementation to be a redefinition. |
184 | inline int length() const; | 186 | inline int length() const; |
185 | #else | 187 | #else |
186 | int length() const; | 188 | int length() const; |
187 | #endif | 189 | #endif |
188 | 190 | ||
189 | int width( int idx ) const; | 191 | int width( int idx ) const; |
190 | 192 | ||
191 | void insert( int index, const QString &s, QTextFormat *f ); | 193 | void insert( int index, const QString &s, QTextFormat *f ); |
192 | void insert( int index, const QChar *unicode, int len, QTextFormat *f ); | 194 | void insert( int index, const QChar *unicode, int len, QTextFormat *f ); |
193 | void insert( int index, QTextStringChar *c, bool doAddRefFormat = FALSE ); | 195 | void insert( int index, QTextStringChar *c, bool doAddRefFormat = FALSE ); |
194 | void truncate( int index ); | 196 | void truncate( int index ); |
@@ -273,34 +275,34 @@ public: | |||
273 | int index() const; | 275 | int index() const; |
274 | void setIndex( int index ) { gotoPosition(paragraph(), index ); } | 276 | void setIndex( int index ) { gotoPosition(paragraph(), index ); } |
275 | 277 | ||
276 | void gotoPosition( QTextParagraph* p, int index = 0); | 278 | void gotoPosition( QTextParagraph* p, int index = 0); |
277 | void gotoLeft(); | 279 | void gotoLeft(); |
278 | void gotoRight(); | 280 | void gotoRight(); |
279 | void gotoNextLetter(); | 281 | void gotoNextLetter(); |
280 | void gotoPreviousLetter(); | 282 | void gotoPreviousLetter(); |
281 | void gotoUp(); | 283 | void gotoUp(); |
282 | void gotoDown(); | 284 | void gotoDown(); |
283 | void gotoLineEnd(); | 285 | void gotoLineEnd(); |
284 | void gotoLineStart(); | 286 | void gotoLineStart(); |
285 | void gotoHome(); | 287 | void gotoHome(); |
286 | void gotoEnd(); | 288 | void gotoEnd(); |
287 | void gotoPageUp( int visibleHeight ); | 289 | void gotoPageUp( int visibleHeight ); |
288 | void gotoPageDown( int visibleHeight ); | 290 | void gotoPageDown( int visibleHeight ); |
289 | void gotoNextWord(); | 291 | void gotoNextWord( bool onlySpace = FALSE ); |
290 | void gotoPreviousWord(); | 292 | void gotoPreviousWord( bool onlySpace = FALSE ); |
291 | void gotoWordLeft(); | 293 | void gotoWordLeft(); |
292 | void gotoWordRight(); | 294 | void gotoWordRight(); |
293 | 295 | ||
294 | void insert( const QString &s, bool checkNewLine, QMemArray<QTextStringChar> *formatting = 0 ); | 296 | void insert( const QString &s, bool checkNewLine, QMemArray<QTextStringChar> *formatting = 0 ); |
295 | void splitAndInsertEmptyParagraph( bool ind = TRUE, bool updateIds = TRUE ); | 297 | void splitAndInsertEmptyParagraph( bool ind = TRUE, bool updateIds = TRUE ); |
296 | bool remove(); | 298 | bool remove(); |
297 | void indent(); | 299 | void indent(); |
298 | 300 | ||
299 | bool atParagStart(); | 301 | bool atParagStart(); |
300 | bool atParagEnd(); | 302 | bool atParagEnd(); |
301 | 303 | ||
302 | int x() const; // x in current paragraph | 304 | int x() const; // x in current paragraph |
303 | int y() const; // y in current paragraph | 305 | int y() const; // y in current paragraph |
304 | 306 | ||
305 | int globalX() const; | 307 | int globalX() const; |
306 | int globalY() const; | 308 | int globalY() const; |
@@ -313,33 +315,33 @@ public: | |||
313 | 315 | ||
314 | bool place( const QPoint &pos, QTextParagraph *s ) { return place( pos, s, FALSE ); } | 316 | bool place( const QPoint &pos, QTextParagraph *s ) { return place( pos, s, FALSE ); } |
315 | bool place( const QPoint &pos, QTextParagraph *s, bool link ); | 317 | bool place( const QPoint &pos, QTextParagraph *s, bool link ); |
316 | void restoreState(); | 318 | void restoreState(); |
317 | 319 | ||
318 | 320 | ||
319 | int nestedDepth() const { return (int)indices.count(); } //### size_t/int cast | 321 | int nestedDepth() const { return (int)indices.count(); } //### size_t/int cast |
320 | void oneUp() { if ( !indices.isEmpty() ) pop(); } | 322 | void oneUp() { if ( !indices.isEmpty() ) pop(); } |
321 | void setValid( bool b ) { valid = b; } | 323 | void setValid( bool b ) { valid = b; } |
322 | bool isValid() const { return valid; } | 324 | bool isValid() const { return valid; } |
323 | 325 | ||
324 | private: | 326 | private: |
325 | enum Operation { EnterBegin, EnterEnd, Next, Prev, Up, Down }; | 327 | enum Operation { EnterBegin, EnterEnd, Next, Prev, Up, Down }; |
326 | 328 | ||
327 | void push(); | 329 | void push(); |
328 | void pop(); | 330 | void pop(); |
329 | void processNesting( Operation op ); | 331 | bool processNesting( Operation op ); |
330 | void invalidateNested(); | 332 | void invalidateNested(); |
331 | void gotoIntoNested( const QPoint &globalPos ); | 333 | void gotoIntoNested( const QPoint &globalPos ); |
332 | 334 | ||
333 | QTextParagraph *para; | 335 | QTextParagraph *para; |
334 | int idx, tmpIndex; | 336 | int idx, tmpIndex; |
335 | int ox, oy; | 337 | int ox, oy; |
336 | QValueStack<int> indices; | 338 | QValueStack<int> indices; |
337 | QValueStack<QTextParagraph*> paras; | 339 | QValueStack<QTextParagraph*> paras; |
338 | QValueStack<int> xOffsets; | 340 | QValueStack<int> xOffsets; |
339 | QValueStack<int> yOffsets; | 341 | QValueStack<int> yOffsets; |
340 | uint valid : 1; | 342 | uint valid : 1; |
341 | 343 | ||
342 | }; | 344 | }; |
343 | 345 | ||
344 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 346 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
345 | 347 | ||
@@ -690,32 +692,33 @@ private: | |||
690 | Placement place; | 692 | Placement place; |
691 | void adjustCells( int y , int shift ); | 693 | void adjustCells( int y , int shift ); |
692 | int pageBreakFor; | 694 | int pageBreakFor; |
693 | }; | 695 | }; |
694 | #endif | 696 | #endif |
695 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 697 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
696 | 698 | ||
697 | #ifndef QT_NO_TEXTCUSTOMITEM | 699 | #ifndef QT_NO_TEXTCUSTOMITEM |
698 | class QTextTableCell; | 700 | class QTextTableCell; |
699 | class QTextParagraph; | 701 | class QTextParagraph; |
700 | #endif | 702 | #endif |
701 | 703 | ||
702 | struct Q_EXPORT QTextDocumentSelection | 704 | struct Q_EXPORT QTextDocumentSelection |
703 | { | 705 | { |
704 | QTextCursor startCursor, endCursor; | 706 | QTextCursor startCursor, endCursor; |
705 | bool swapped; | 707 | bool swapped; |
708 | Q_DUMMY_COMPARISON_OPERATOR(QTextDocumentSelection) | ||
706 | }; | 709 | }; |
707 | 710 | ||
708 | #if defined(Q_TEMPLATEDLL) | 711 | #if defined(Q_TEMPLATEDLL) |
709 | // MOC_SKIP_BEGIN | 712 | // MOC_SKIP_BEGIN |
710 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QColor>; | 713 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QColor>; |
711 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, bool>; | 714 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, bool>; |
712 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextDocumentSelection>; | 715 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextDocumentSelection>; |
713 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>; | 716 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>; |
714 | // MOC_SKIP_END | 717 | // MOC_SKIP_END |
715 | #endif | 718 | #endif |
716 | 719 | ||
717 | class Q_EXPORT QTextDocument : public QObject | 720 | class Q_EXPORT QTextDocument : public QObject |
718 | { | 721 | { |
719 | Q_OBJECT | 722 | Q_OBJECT |
720 | 723 | ||
721 | #ifndef QT_NO_TEXTCUSTOMITEM | 724 | #ifndef QT_NO_TEXTCUSTOMITEM |
@@ -826,32 +829,35 @@ public: | |||
826 | 829 | ||
827 | void setStyleSheet( QStyleSheet *s ); | 830 | void setStyleSheet( QStyleSheet *s ); |
828 | void setDefaultFormat( const QFont &font, const QColor &color ); | 831 | void setDefaultFormat( const QFont &font, const QColor &color ); |
829 | #ifndef QT_NO_MIME | 832 | #ifndef QT_NO_MIME |
830 | void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } | 833 | void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } |
831 | #endif | 834 | #endif |
832 | void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } | 835 | void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } |
833 | 836 | ||
834 | void setUnderlineLinks( bool b ); | 837 | void setUnderlineLinks( bool b ); |
835 | bool underlineLinks() const { return underlLinks; } | 838 | bool underlineLinks() const { return underlLinks; } |
836 | 839 | ||
837 | void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } | 840 | void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } |
838 | QBrush *paper() const { return backBrush; } | 841 | QBrush *paper() const { return backBrush; } |
839 | 842 | ||
840 | void doLayout( QPainter *p, int w ); | 843 | void doLayout( QPainter *p, int w ); |
841 | void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); | 844 | void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); |
845 | void eraseParagraphEmptyArea( QTextParagraph *parag, QPainter *p, const QColorGroup &cg ); | ||
846 | bool useDoubleBuffer( QTextParagraph *parag, QPainter *p ); | ||
847 | |||
842 | void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, | 848 | void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, |
843 | QPixmap *&doubleBuffer, const QColorGroup &cg, | 849 | QPixmap *&doubleBuffer, const QColorGroup &cg, |
844 | bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); | 850 | bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); |
845 | QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, | 851 | QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, |
846 | bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, | 852 | bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, |
847 | bool resetChanged = TRUE ); | 853 | bool resetChanged = TRUE ); |
848 | 854 | ||
849 | #ifndef QT_NO_TEXTCUSTOMITEM | 855 | #ifndef QT_NO_TEXTCUSTOMITEM |
850 | void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 856 | void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); |
851 | void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 857 | void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); |
852 | #endif | 858 | #endif |
853 | 859 | ||
854 | void setFlow( QTextFlow *f ); | 860 | void setFlow( QTextFlow *f ); |
855 | void takeFlow(); | 861 | void takeFlow(); |
856 | QTextFlow *flow() const { return flow_; } | 862 | QTextFlow *flow() const { return flow_; } |
857 | bool isPageBreakEnabled() const { return pages; } | 863 | bool isPageBreakEnabled() const { return pages; } |
@@ -1054,32 +1060,33 @@ public: | |||
1054 | QTextCursor *unexecute( QTextCursor *c ); | 1060 | QTextCursor *unexecute( QTextCursor *c ); |
1055 | 1061 | ||
1056 | static QByteArray readStyleInformation( QTextDocument* d, int fParag, int lParag ); | 1062 | static QByteArray readStyleInformation( QTextDocument* d, int fParag, int lParag ); |
1057 | static void writeStyleInformation( QTextDocument* d, int fParag, const QByteArray& style ); | 1063 | static void writeStyleInformation( QTextDocument* d, int fParag, const QByteArray& style ); |
1058 | 1064 | ||
1059 | private: | 1065 | private: |
1060 | int firstParag, lastParag; | 1066 | int firstParag, lastParag; |
1061 | QByteArray before; | 1067 | QByteArray before; |
1062 | QByteArray after; | 1068 | QByteArray after; |
1063 | }; | 1069 | }; |
1064 | 1070 | ||
1065 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1071 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1066 | 1072 | ||
1067 | struct Q_EXPORT QTextParagraphSelection | 1073 | struct Q_EXPORT QTextParagraphSelection |
1068 | { | 1074 | { |
1069 | int start, end; | 1075 | int start, end; |
1076 | Q_DUMMY_COMPARISON_OPERATOR(QTextParagraphSelection) | ||
1070 | }; | 1077 | }; |
1071 | 1078 | ||
1072 | struct Q_EXPORT QTextLineStart | 1079 | struct Q_EXPORT QTextLineStart |
1073 | { | 1080 | { |
1074 | QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) | 1081 | QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) |
1075 | #ifndef QT_NO_COMPLEXTEXT | 1082 | #ifndef QT_NO_COMPLEXTEXT |
1076 | , bidicontext( 0 ) | 1083 | , bidicontext( 0 ) |
1077 | #endif | 1084 | #endif |
1078 | { } | 1085 | { } |
1079 | QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), | 1086 | QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), |
1080 | w( 0 ) | 1087 | w( 0 ) |
1081 | #ifndef QT_NO_COMPLEXTEXT | 1088 | #ifndef QT_NO_COMPLEXTEXT |
1082 | , bidicontext( 0 ) | 1089 | , bidicontext( 0 ) |
1083 | #endif | 1090 | #endif |
1084 | { } | 1091 | { } |
1085 | #ifndef QT_NO_COMPLEXTEXT | 1092 | #ifndef QT_NO_COMPLEXTEXT |
@@ -1123,73 +1130,71 @@ private: | |||
1123 | 1130 | ||
1124 | #if defined(Q_TEMPLATEDLL) | 1131 | #if defined(Q_TEMPLATEDLL) |
1125 | // MOC_SKIP_BEGIN | 1132 | // MOC_SKIP_BEGIN |
1126 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextParagraphSelection>; | 1133 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextParagraphSelection>; |
1127 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextLineStart*>; | 1134 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextLineStart*>; |
1128 | // MOC_SKIP_END | 1135 | // MOC_SKIP_END |
1129 | #endif | 1136 | #endif |
1130 | 1137 | ||
1131 | class Q_EXPORT QTextParagraphData | 1138 | class Q_EXPORT QTextParagraphData |
1132 | { | 1139 | { |
1133 | public: | 1140 | public: |
1134 | QTextParagraphData() {} | 1141 | QTextParagraphData() {} |
1135 | virtual ~QTextParagraphData(); | 1142 | virtual ~QTextParagraphData(); |
1136 | virtual void join( QTextParagraphData * ); | 1143 | virtual void join( QTextParagraphData * ); |
1137 | }; | 1144 | }; |
1138 | 1145 | ||
1139 | class Q_EXPORT QTextParagraphPseudoDocument | 1146 | class QTextParagraphPseudoDocument; |
1140 | { | 1147 | |
1141 | public: | 1148 | class QSyntaxHighlighter; |
1142 | QTextParagraphPseudoDocument(); | ||
1143 | ~QTextParagraphPseudoDocument(); | ||
1144 | QRect docRect; | ||
1145 | QTextFormatter *pFormatter; | ||
1146 | QTextCommandHistory *commandHistory; | ||
1147 | int minw; | ||
1148 | int wused; | ||
1149 | }; | ||
1150 | 1149 | ||
1151 | //nase | ||
1152 | class Q_EXPORT QTextParagraph | 1150 | class Q_EXPORT QTextParagraph |
1153 | { | 1151 | { |
1154 | friend class QTextDocument; | 1152 | friend class QTextDocument; |
1155 | friend class QTextCursor; | 1153 | friend class QTextCursor; |
1154 | friend class QSyntaxHighlighter; | ||
1156 | 1155 | ||
1157 | public: | 1156 | public: |
1158 | QTextParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE ); | 1157 | QTextParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE ); |
1159 | virtual ~QTextParagraph(); | 1158 | virtual ~QTextParagraph(); |
1160 | 1159 | ||
1161 | QTextString *string() const; | 1160 | QTextString *string() const; |
1162 | QTextStringChar *at( int i ) const; // maybe remove later | 1161 | QTextStringChar *at( int i ) const; // maybe remove later |
1163 | int leftGap() const; | 1162 | int leftGap() const; |
1164 | int length() const; // maybe remove later | 1163 | int length() const; // maybe remove later |
1165 | 1164 | ||
1166 | void setListStyle( QStyleSheetItem::ListStyle ls ) { lstyle = ls; changed = TRUE; } | 1165 | void setListStyle( QStyleSheetItem::ListStyle ls ) { lstyle = ls; changed = TRUE; } |
1167 | QStyleSheetItem::ListStyle listStyle() const { return lstyle; } | 1166 | QStyleSheetItem::ListStyle listStyle() const { return lstyle; } |
1168 | void setListItem( bool li ); | 1167 | void setListItem( bool li ); |
1169 | bool isListItem() const { return litem; } | 1168 | bool isListItem() const { return litem; } |
1170 | void setListValue( int v ) { list_val = v; } | 1169 | void setListValue( int v ) { list_val = v; } |
1171 | int listValue() const { return list_val > 0 ? list_val : -1; } | 1170 | int listValue() const { return list_val > 0 ? list_val : -1; } |
1172 | 1171 | ||
1173 | void setListDepth( int depth ); | 1172 | void setListDepth( int depth ); |
1174 | int listDepth() const { return ldepth; } | 1173 | int listDepth() const { return ldepth; } |
1175 | 1174 | ||
1176 | // void setFormat( QTextFormat *fm ); | 1175 | // void setFormat( QTextFormat *fm ); |
1177 | // QTextFormat *paragFormat() const; | 1176 | // QTextFormat *paragFormat() const; |
1178 | 1177 | ||
1178 | #if defined(Q_STRICT_INLINING_RULES) | ||
1179 | // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the | ||
1180 | // implementation to be a redefinition. | ||
1181 | inline QTextDocument *document() const; | ||
1182 | #else | ||
1179 | QTextDocument *document() const; | 1183 | QTextDocument *document() const; |
1184 | #endif | ||
1180 | QTextParagraphPseudoDocument *pseudoDocument() const; | 1185 | QTextParagraphPseudoDocument *pseudoDocument() const; |
1181 | 1186 | ||
1182 | QRect rect() const; | 1187 | QRect rect() const; |
1183 | void setHeight( int h ) { r.setHeight( h ); } | 1188 | void setHeight( int h ) { r.setHeight( h ); } |
1184 | void show(); | 1189 | void show(); |
1185 | void hide(); | 1190 | void hide(); |
1186 | bool isVisible() const { return visible; } | 1191 | bool isVisible() const { return visible; } |
1187 | 1192 | ||
1188 | QTextParagraph *prev() const; | 1193 | QTextParagraph *prev() const; |
1189 | QTextParagraph *next() const; | 1194 | QTextParagraph *next() const; |
1190 | void setPrev( QTextParagraph *s ); | 1195 | void setPrev( QTextParagraph *s ); |
1191 | void setNext( QTextParagraph *s ); | 1196 | void setNext( QTextParagraph *s ); |
1192 | 1197 | ||
1193 | void insert( int index, const QString &s ); | 1198 | void insert( int index, const QString &s ); |
1194 | void insert( int index, const QChar *unicode, int len ); | 1199 | void insert( int index, const QChar *unicode, int len ); |
1195 | void append( const QString &s, bool reallyAtEnd = FALSE ); | 1200 | void append( const QString &s, bool reallyAtEnd = FALSE ); |
@@ -1583,52 +1588,64 @@ class Q_EXPORT QTextFormatCollection | |||
1583 | friend class QTextFormat; | 1588 | friend class QTextFormat; |
1584 | 1589 | ||
1585 | public: | 1590 | public: |
1586 | QTextFormatCollection(); | 1591 | QTextFormatCollection(); |
1587 | virtual ~QTextFormatCollection(); | 1592 | virtual ~QTextFormatCollection(); |
1588 | 1593 | ||
1589 | void setDefaultFormat( QTextFormat *f ); | 1594 | void setDefaultFormat( QTextFormat *f ); |
1590 | QTextFormat *defaultFormat() const; | 1595 | QTextFormat *defaultFormat() const; |
1591 | virtual QTextFormat *format( QTextFormat *f ); | 1596 | virtual QTextFormat *format( QTextFormat *f ); |
1592 | virtual QTextFormat *format( QTextFormat *of, QTextFormat *nf, int flags ); | 1597 | virtual QTextFormat *format( QTextFormat *of, QTextFormat *nf, int flags ); |
1593 | virtual QTextFormat *format( const QFont &f, const QColor &c ); | 1598 | virtual QTextFormat *format( const QFont &f, const QColor &c ); |
1594 | virtual void remove( QTextFormat *f ); | 1599 | virtual void remove( QTextFormat *f ); |
1595 | virtual QTextFormat *createFormat( const QTextFormat &f ) { return new QTextFormat( f ); } | 1600 | virtual QTextFormat *createFormat( const QTextFormat &f ) { return new QTextFormat( f ); } |
1596 | virtual QTextFormat *createFormat( const QFont &f, const QColor &c ) { return new QTextFormat( f, c, this ); } | 1601 | virtual QTextFormat *createFormat( const QFont &f, const QColor &c ) { return new QTextFormat( f, c, this ); } |
1597 | 1602 | ||
1598 | void updateDefaultFormat( const QFont &font, const QColor &c, QStyleSheet *sheet ); | 1603 | void updateDefaultFormat( const QFont &font, const QColor &c, QStyleSheet *sheet ); |
1599 | QDict<QTextFormat> dict() const { return cKey; } | ||
1600 | 1604 | ||
1601 | QPaintDevice *paintDevice() const { return paintdevice; } | 1605 | QPaintDevice *paintDevice() const { return paintdevice; } |
1602 | void setPaintDevice( QPaintDevice * ); | 1606 | void setPaintDevice( QPaintDevice * ); |
1603 | 1607 | ||
1604 | private: | 1608 | private: |
1605 | void updateKeys(); | 1609 | void updateKeys(); |
1606 | 1610 | ||
1607 | private: | 1611 | private: |
1608 | QTextFormat *defFormat, *lastFormat, *cachedFormat; | 1612 | QTextFormat *defFormat, *lastFormat, *cachedFormat; |
1609 | QDict<QTextFormat> cKey; | 1613 | QDict<QTextFormat> cKey; |
1610 | QTextFormat *cres; | 1614 | QTextFormat *cres; |
1611 | QFont cfont; | 1615 | QFont cfont; |
1612 | QColor ccol; | 1616 | QColor ccol; |
1613 | QString kof, knf; | 1617 | QString kof, knf; |
1614 | int cflags; | 1618 | int cflags; |
1615 | 1619 | ||
1616 | QPaintDevice *paintdevice; | 1620 | QPaintDevice *paintdevice; |
1617 | }; | 1621 | }; |
1618 | 1622 | ||
1623 | class Q_EXPORT QTextParagraphPseudoDocument | ||
1624 | { | ||
1625 | public: | ||
1626 | QTextParagraphPseudoDocument(); | ||
1627 | ~QTextParagraphPseudoDocument(); | ||
1628 | QRect docRect; | ||
1629 | QTextFormatter *pFormatter; | ||
1630 | QTextCommandHistory *commandHistory; | ||
1631 | int minw; | ||
1632 | int wused; | ||
1633 | QTextFormatCollection collection; | ||
1634 | }; | ||
1635 | |||
1619 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1636 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1620 | 1637 | ||
1621 | inline int QTextString::length() const | 1638 | inline int QTextString::length() const |
1622 | { | 1639 | { |
1623 | return data.size(); | 1640 | return data.size(); |
1624 | } | 1641 | } |
1625 | 1642 | ||
1626 | inline int QTextParagraph::length() const | 1643 | inline int QTextParagraph::length() const |
1627 | { | 1644 | { |
1628 | return str->length(); | 1645 | return str->length(); |
1629 | } | 1646 | } |
1630 | 1647 | ||
1631 | inline QRect QTextParagraph::rect() const | 1648 | inline QRect QTextParagraph::rect() const |
1632 | { | 1649 | { |
1633 | return r; | 1650 | return r; |
1634 | } | 1651 | } |
@@ -1815,32 +1832,38 @@ inline QString QTextDocument::originalText() const | |||
1815 | return oText; | 1832 | return oText; |
1816 | return text(); | 1833 | return text(); |
1817 | } | 1834 | } |
1818 | 1835 | ||
1819 | inline void QTextDocument::setFlow( QTextFlow *f ) | 1836 | inline void QTextDocument::setFlow( QTextFlow *f ) |
1820 | { | 1837 | { |
1821 | if ( flow_ ) | 1838 | if ( flow_ ) |
1822 | delete flow_; | 1839 | delete flow_; |
1823 | flow_ = f; | 1840 | flow_ = f; |
1824 | } | 1841 | } |
1825 | 1842 | ||
1826 | inline void QTextDocument::takeFlow() | 1843 | inline void QTextDocument::takeFlow() |
1827 | { | 1844 | { |
1828 | flow_ = 0; | 1845 | flow_ = 0; |
1829 | } | 1846 | } |
1830 | 1847 | ||
1848 | inline bool QTextDocument::useDoubleBuffer( QTextParagraph *parag, QPainter *p ) | ||
1849 | { | ||
1850 | return ( !parag->document()->parent() || parag->document()->nextDoubleBuffered ) && | ||
1851 | ( !p || !p->device() || p->device()->devType() != QInternal::Printer ); | ||
1852 | } | ||
1853 | |||
1831 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1854 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1832 | 1855 | ||
1833 | inline QColor QTextFormat::color() const | 1856 | inline QColor QTextFormat::color() const |
1834 | { | 1857 | { |
1835 | return col; | 1858 | return col; |
1836 | } | 1859 | } |
1837 | 1860 | ||
1838 | inline QFont QTextFormat::font() const | 1861 | inline QFont QTextFormat::font() const |
1839 | { | 1862 | { |
1840 | return fn; | 1863 | return fn; |
1841 | } | 1864 | } |
1842 | 1865 | ||
1843 | inline bool QTextFormat::isMisspelled() const | 1866 | inline bool QTextFormat::isMisspelled() const |
1844 | { | 1867 | { |
1845 | return missp; | 1868 | return missp; |
1846 | } | 1869 | } |
diff --git a/qmake/include/private/qsettings_p.h b/qmake/include/private/qsettings_p.h index 18d118b..095291c 100644 --- a/qmake/include/private/qsettings_p.h +++ b/qmake/include/private/qsettings_p.h | |||
@@ -81,33 +81,33 @@ public: | |||
81 | QStringList searchPaths; | 81 | QStringList searchPaths; |
82 | QMap<QString,QSettingsHeading> headings; | 82 | QMap<QString,QSettingsHeading> headings; |
83 | QString group; | 83 | QString group; |
84 | QString heading; | 84 | QString heading; |
85 | 85 | ||
86 | /*### static data brings threading trouble | 86 | /*### static data brings threading trouble |
87 | static QString *defProduct; | 87 | static QString *defProduct; |
88 | static QString *defDomain; | 88 | static QString *defDomain; |
89 | */ | 89 | */ |
90 | QValueStack<QString> groupStack; | 90 | QValueStack<QString> groupStack; |
91 | QString groupPrefix; | 91 | QString groupPrefix; |
92 | 92 | ||
93 | bool groupDirty :1; | 93 | bool groupDirty :1; |
94 | bool modified :1; | 94 | bool modified :1; |
95 | bool globalScope :1; | 95 | bool globalScope :1; |
96 | 96 | ||
97 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 97 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
98 | // system dependent implementations to use the | 98 | // system dependent implementations to use the |
99 | // system specific setting database (ie. registry on Windows) | 99 | // system specific setting database (ie. registry on Windows) |
100 | 100 | ||
101 | QSettingsSysPrivate *sysd; | 101 | QSettingsSysPrivate *sysd; |
102 | voidsysInit(); | 102 | voidsysInit(); |
103 | voidsysClear(); | 103 | voidsysClear(); |
104 | 104 | ||
105 | #if !defined(Q_NO_BOOL_TYPE) | 105 | #if !defined(Q_NO_BOOL_TYPE) |
106 | boolsysWriteEntry( const QString &, bool ); | 106 | boolsysWriteEntry( const QString &, bool ); |
107 | #endif | 107 | #endif |
108 | boolsysWriteEntry( const QString &, double ); | 108 | boolsysWriteEntry( const QString &, double ); |
109 | boolsysWriteEntry( const QString &, int ); | 109 | boolsysWriteEntry( const QString &, int ); |
110 | boolsysWriteEntry( const QString &, const QString & ); | 110 | boolsysWriteEntry( const QString &, const QString & ); |
111 | boolsysWriteEntry( const QString &, const QStringList & ); | 111 | boolsysWriteEntry( const QString &, const QStringList & ); |
112 | boolsysWriteEntry( const QString &, const QStringList &, const QChar& sep ); | 112 | boolsysWriteEntry( const QString &, const QStringList &, const QChar& sep ); |
113 | 113 | ||
diff --git a/qmake/include/private/qsharedmemory_p.h b/qmake/include/private/qsharedmemory_p.h index 4a8339d..927de89 100644 --- a/qmake/include/private/qsharedmemory_p.h +++ b/qmake/include/private/qsharedmemory_p.h | |||
@@ -1,60 +1,62 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Includes system files for shared memory | 4 | ** Includes system files for shared memory |
5 | ** | 5 | ** |
6 | ** Created : 020124 | 6 | ** Created : 020124 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed and/or modified under the terms of the | 12 | ** This file may be distributed and/or modified under the terms of the |
13 | ** GNU General Public License version 2 as published by the Free Software | 13 | ** GNU General Public License version 2 as published by the Free Software |
14 | ** Foundation and appearing in the file LICENSE.GPL included in the | 14 | ** Foundation and appearing in the file LICENSE.GPL included in the |
15 | ** packaging of this file. | 15 | ** packaging of this file. |
16 | ** | 16 | ** |
17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 17 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
18 | ** licenses for Qt/Embedded may use this file in accordance with the | 18 | ** licenses for Qt/Embedded may use this file in accordance with the |
19 | ** Qt Embedded Commercial License Agreement provided with the Software. | 19 | ** Qt Embedded Commercial License Agreement provided with the Software. |
20 | ** | 20 | ** |
21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 21 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 22 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
23 | ** | 23 | ** |
24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 24 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
25 | ** information about Qt Commercial License Agreements. | 25 | ** information about Qt Commercial License Agreements. |
26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 26 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
27 | ** | 27 | ** |
28 | ** Contact info@trolltech.com if any conditions of this licensing are | 28 | ** Contact info@trolltech.com if any conditions of this licensing are |
29 | ** not clear to you. | 29 | ** not clear to you. |
30 | ** | 30 | ** |
31 | **********************************************************************/ | 31 | **********************************************************************/ |
32 | 32 | ||
33 | #ifndef QSHAREDMEMORY_P_H | ||
34 | #define QSHAREDMEMORY_P_H | ||
35 | |||
33 | // | 36 | // |
34 | // W A R N I N G | 37 | // W A R N I N G |
35 | // ------------- | 38 | // ------------- |
36 | // | 39 | // |
37 | // This file is not part of the Qt API. It exists for the convenience | 40 | // This file is not part of the Qt API. It exists for the convenience |
38 | // of qapplication_qws.cpp and qgfxvnc_qws.cpp. This header file may | 41 | // of qapplication_qws.cpp and qgfxvnc_qws.cpp. This header file may |
39 | // change from version to version without notice, or even be removed. | 42 | // change from version to version without notice, or even be removed. |
40 | // | 43 | // |
44 | // We mean it. | ||
45 | // | ||
41 | // | 46 | // |
42 | |||
43 | #if !defined(QT_QSHM_H) | ||
44 | #define QT_QSHM_H | ||
45 | 47 | ||
46 | #include <qstring.h> | 48 | #include <qstring.h> |
47 | 49 | ||
48 | #if !defined (QT_QWS_NO_SHM) | 50 | #if !defined (QT_QWS_NO_SHM) |
49 | 51 | ||
50 | #include <sys/types.h> | 52 | #include <sys/types.h> |
51 | #include <sys/ipc.h> | 53 | #include <sys/ipc.h> |
52 | 54 | ||
53 | class QSharedMemory { | 55 | class QSharedMemory { |
54 | public: | 56 | public: |
55 | QSharedMemory(){}; | 57 | QSharedMemory(){}; |
56 | QSharedMemory(int, QString, char c = 'Q'); | 58 | QSharedMemory(int, QString, char c = 'Q'); |
57 | ~QSharedMemory(){}; | 59 | ~QSharedMemory(){}; |
58 | 60 | ||
59 | bool create(); | 61 | bool create(); |
60 | void destroy(); | 62 | void destroy(); |
@@ -68,17 +70,18 @@ public: | |||
68 | 70 | ||
69 | private: | 71 | private: |
70 | void *shmBase; | 72 | void *shmBase; |
71 | int shmSize; | 73 | int shmSize; |
72 | QString shmFile; | 74 | QString shmFile; |
73 | char character; | 75 | char character; |
74 | #if defined(QT_POSIX_QSHM) | 76 | #if defined(QT_POSIX_QSHM) |
75 | int shmFD; | 77 | int shmFD; |
76 | #else | 78 | #else |
77 | int shmId; | 79 | int shmId; |
78 | key_t key; | 80 | key_t key; |
79 | int idInitted; | 81 | int idInitted; |
80 | #endif | 82 | #endif |
81 | }; | 83 | }; |
82 | 84 | ||
83 | #endif | 85 | #endif |
86 | |||
84 | #endif | 87 | #endif |
diff --git a/qmake/include/private/qsqldriverinterface_p.h b/qmake/include/private/qsqldriverinterface_p.h index 8957b86..8a39ddf 100644 --- a/qmake/include/private/qsqldriverinterface_p.h +++ b/qmake/include/private/qsqldriverinterface_p.h | |||
@@ -1,69 +1,82 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
2 | ** | 3 | ** |
3 | ** Definition of QSqlDriverInterface class | 4 | ** Definition of QSqlDriverInterface class |
4 | ** | 5 | ** |
5 | ** Created : 2000-11-03 | 6 | ** Created : 2000-11-03 |
6 | ** | 7 | ** |
7 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
8 | ** | 9 | ** |
9 | ** This file is part of the sql module of the Qt GUI Toolkit. | 10 | ** This file is part of the sql module of the Qt GUI Toolkit. |
10 | ** | 11 | ** |
11 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
12 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
13 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
14 | ** | 15 | ** |
15 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
16 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
17 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
18 | ** packaging of this file. | 19 | ** packaging of this file. |
19 | ** | 20 | ** |
20 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
21 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
22 | ** with the Software. | 23 | ** with the Software. |
23 | ** | 24 | ** |
24 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
25 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
26 | ** | 27 | ** |
27 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
28 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
29 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
30 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
31 | ** | 32 | ** |
32 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
33 | ** not clear to you. | 34 | ** not clear to you. |
34 | ** | 35 | ** |
35 | **********************************************************************/ | 36 | **********************************************************************/ |
36 | 37 | ||
37 | #ifndef QSQLDRIVERINTERFACE_H | 38 | #ifndef QSQLDRIVERINTERFACE_H |
38 | #define QSQLDRIVERINTERFACE_H | 39 | #define QSQLDRIVERINTERFACE_H |
39 | 40 | ||
41 | // | ||
42 | // W A R N I N G | ||
43 | // ------------- | ||
44 | // | ||
45 | // This file is not part of the Qt API. This header file may | ||
46 | // change from version to version without notice, or even be | ||
47 | // removed. | ||
48 | // | ||
49 | // We mean it. | ||
50 | // | ||
51 | // | ||
52 | |||
40 | #ifndef QT_H | 53 | #ifndef QT_H |
41 | #include <private/qcom_p.h> | 54 | #include <private/qcom_p.h> |
42 | #endif // QT_H | 55 | #endif // QT_H |
43 | 56 | ||
44 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL ) | 57 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL ) |
45 | #define QM_EXPORT_SQL | 58 | #define QM_EXPORT_SQL |
46 | #else | 59 | #else |
47 | #define QM_EXPORT_SQL Q_EXPORT | 60 | #define QM_EXPORT_SQL Q_EXPORT |
48 | #endif | 61 | #endif |
49 | 62 | ||
50 | #ifndef QT_NO_SQL | 63 | #ifndef QT_NO_SQL |
51 | 64 | ||
52 | #ifndef QT_NO_COMPONENT | 65 | #ifndef QT_NO_COMPONENT |
53 | 66 | ||
54 | // {EDDD5AD5-DF3C-400c-A711-163B72FE5F61} | 67 | // {EDDD5AD5-DF3C-400c-A711-163B72FE5F61} |
55 | #ifndef IID_QSqlDriverFactory | 68 | #ifndef IID_QSqlDriverFactory |
56 | #define IID_QSqlDriverFactory QUuid(0xeddd5ad5, 0xdf3c, 0x400c, 0xa7, 0x11, 0x16, 0x3b, 0x72, 0xfe, 0x5f, 0x61) | 69 | #define IID_QSqlDriverFactory QUuid(0xeddd5ad5, 0xdf3c, 0x400c, 0xa7, 0x11, 0x16, 0x3b, 0x72, 0xfe, 0x5f, 0x61) |
57 | #endif | 70 | #endif |
58 | 71 | ||
59 | class QSqlDriver; | 72 | class QSqlDriver; |
60 | 73 | ||
61 | struct QM_EXPORT_SQL QSqlDriverFactoryInterface : public QFeatureListInterface | 74 | struct QM_EXPORT_SQL QSqlDriverFactoryInterface : public QFeatureListInterface |
62 | { | 75 | { |
63 | virtual QSqlDriver* create( const QString& name ) = 0; | 76 | virtual QSqlDriver* create( const QString& name ) = 0; |
64 | }; | 77 | }; |
65 | 78 | ||
66 | #endif //QT_NO_COMPONENT | 79 | #endif //QT_NO_COMPONENT |
67 | #endif // QT_NO_SQL | 80 | #endif // QT_NO_SQL |
68 | 81 | ||
69 | #endif // QSQLDRIVERINTERFACE_H | 82 | #endif // QSQLDRIVERINTERFACE_P_H |
diff --git a/qmake/include/private/qsqlextension_p.h b/qmake/include/private/qsqlextension_p.h index 597b266..3445b47 100644 --- a/qmake/include/private/qsqlextension_p.h +++ b/qmake/include/private/qsqlextension_p.h | |||
@@ -38,64 +38,91 @@ | |||
38 | #define QSQLEXTENSION_P_H | 38 | #define QSQLEXTENSION_P_H |
39 | 39 | ||
40 | // | 40 | // |
41 | // W A R N I N G | 41 | // W A R N I N G |
42 | // ------------- | 42 | // ------------- |
43 | // | 43 | // |
44 | // This file is not part of the Qt API. It exists for the convenience | 44 | // This file is not part of the Qt API. It exists for the convenience |
45 | // of other Qt classes. This header file may change from version to | 45 | // of other Qt classes. This header file may change from version to |
46 | // version without notice, or even be removed. | 46 | // version without notice, or even be removed. |
47 | // | 47 | // |
48 | // We mean it. | 48 | // We mean it. |
49 | // | 49 | // |
50 | // | 50 | // |
51 | 51 | ||
52 | #ifndef QT_H | 52 | #ifndef QT_H |
53 | #include "qmap.h" | 53 | #include "qmap.h" |
54 | #include "qvaluevector.h" | ||
54 | #include "qstring.h" | 55 | #include "qstring.h" |
55 | #include "qvariant.h" | 56 | #include "qvariant.h" |
57 | #include "qsql.h" | ||
56 | #endif // QT_H | 58 | #endif // QT_H |
57 | 59 | ||
58 | #ifndef QT_NO_SQL | 60 | #ifndef QT_NO_SQL |
59 | 61 | ||
60 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL ) | 62 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL ) |
61 | #define QM_EXPORT_SQL | 63 | #define QM_EXPORT_SQL |
64 | #define QM_TEMPLATE_EXTERN_SQL | ||
62 | #else | 65 | #else |
63 | #define QM_EXPORT_SQL Q_EXPORT | 66 | #define QM_EXPORT_SQL Q_EXPORT |
67 | #define QM_TEMPLATE_EXTERN_SQL Q_TEMPLATE_EXTERN | ||
64 | #endif | 68 | #endif |
65 | 69 | ||
70 | struct Param { | ||
71 | Param( const QVariant& v = QVariant(), QSql::ParameterType t = QSql::In ): value( v ), typ( t ) {} | ||
72 | QVariant value; | ||
73 | QSql::ParameterType typ; | ||
74 | Q_DUMMY_COMPARISON_OPERATOR(Param) | ||
75 | }; | ||
76 | |||
77 | struct Holder { | ||
78 | Holder( const QString& hldr = QString::null, int pos = -1 ): holderName( hldr ), holderPos( pos ) {} | ||
79 | bool operator==( const Holder& h ) const { return h.holderPos == holderPos && h.holderName == holderName; } | ||
80 | bool operator!=( const Holder& h ) const { return h.holderPos != holderPos || h.holderName != holderName; } | ||
81 | QString holderName; | ||
82 | int holderPos; | ||
83 | }; | ||
84 | |||
66 | #if defined(Q_TEMPLATEDLL) | 85 | #if defined(Q_TEMPLATEDLL) |
67 | Q_TEMPLATE_EXTERN template class QM_EXPORT_SQL QMap<QString,QVariant>; | 86 | QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QMap<QString,Param>; |
68 | Q_TEMPLATE_EXTERN template class QM_EXPORT_SQL QMap<int,QString>; | 87 | QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QMap<int,QString>; |
88 | QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QValueVector<Holder>; | ||
69 | #endif | 89 | #endif |
70 | 90 | ||
71 | class QM_EXPORT_SQL QSqlExtension { | 91 | class QM_EXPORT_SQL QSqlExtension { |
72 | public: | 92 | public: |
73 | QSqlExtension(); | 93 | QSqlExtension(); |
74 | virtual ~QSqlExtension(); | 94 | virtual ~QSqlExtension(); |
75 | virtual bool prepare( const QString& query ); | 95 | virtual bool prepare( const QString& query ); |
76 | virtual bool exec(); | 96 | virtual bool exec(); |
77 | virtual void bindValue( const QString& holder, const QVariant& value ); | 97 | virtual void bindValue( const QString& holder, const QVariant& value, QSql::ParameterType = QSql::In ); |
78 | virtual void bindValue( int pos, const QVariant& value ); | 98 | virtual void bindValue( int pos, const QVariant& value, QSql::ParameterType = QSql::In ); |
79 | virtual void addBindValue( const QVariant& value ); | 99 | virtual void addBindValue( const QVariant& value, QSql::ParameterType = QSql::In ); |
100 | virtual QVariant parameterValue( const QString& holder ); | ||
101 | virtual QVariant parameterValue( int pos ); | ||
80 | void clearValues(); | 102 | void clearValues(); |
81 | void clearIndex(); | 103 | void clearIndex(); |
82 | 104 | ||
83 | enum BindMethod { BindByPosition, BindByName }; | 105 | enum BindMethod { BindByPosition, BindByName }; |
84 | BindMethod bindMethod(); | 106 | BindMethod bindMethod(); |
85 | BindMethod bindm; | 107 | BindMethod bindm; |
86 | int bindCount; | 108 | int bindCount; |
87 | 109 | ||
88 | QMap<int, QString> index; | 110 | QMap<int, QString> index; |
89 | QMap<QString, QVariant> values; | 111 | typedef QMap<QString, Param> ValueMap; |
112 | ValueMap values; | ||
113 | |||
114 | // convenience container for QSqlQuery | ||
115 | // to map holders <-> positions | ||
116 | typedef QValueVector<Holder> HolderVector; | ||
117 | HolderVector holders; | ||
90 | }; | 118 | }; |
91 | 119 | ||
92 | class QM_EXPORT_SQL QSqlDriverExtension | 120 | class QM_EXPORT_SQL QSqlDriverExtension |
93 | { | 121 | { |
94 | public: | 122 | public: |
95 | QSqlDriverExtension(); | 123 | QSqlDriverExtension(); |
96 | virtual ~QSqlDriverExtension(); | 124 | virtual ~QSqlDriverExtension(); |
97 | virtual bool isOpen() const = 0; | 125 | virtual bool isOpen() const = 0; |
98 | }; | 126 | }; |
99 | |||
100 | #endif | 127 | #endif |
101 | #endif | 128 | #endif |
diff --git a/qmake/include/private/qstyleinterface_p.h b/qmake/include/private/qstyleinterface_p.h index 4aaedc7..24a43ad 100644 --- a/qmake/include/private/qstyleinterface_p.h +++ b/qmake/include/private/qstyleinterface_p.h | |||
@@ -20,42 +20,54 @@ | |||
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QSTYLEINTERFACE_H | 36 | #ifndef QSTYLEINTERFACE_P_H |
37 | #define QSTYLEINTERFACE_H | 37 | #define QSTYLEINTERFACE_P_H |
38 | |||
39 | // | ||
40 | // W A R N I N G | ||
41 | // ------------- | ||
42 | // | ||
43 | // This file is not part of the Qt API. This header file may | ||
44 | // change from version to version without notice, or even be | ||
45 | // removed. | ||
46 | // | ||
47 | // We mean it. | ||
48 | // | ||
49 | // | ||
38 | 50 | ||
39 | #ifndef QT_H | 51 | #ifndef QT_H |
40 | #include <private/qcom_p.h> | 52 | #include <private/qcom_p.h> |
41 | #endif // QT_H | 53 | #endif // QT_H |
42 | 54 | ||
43 | #ifndef QT_NO_STYLE | 55 | #ifndef QT_NO_STYLE |
44 | #ifndef QT_NO_COMPONENT | 56 | #ifndef QT_NO_COMPONENT |
45 | 57 | ||
46 | class QStyle; | 58 | class QStyle; |
47 | 59 | ||
48 | // {FC1B6EBE-053C-49c1-A483-C377739AB9A5} | 60 | // {FC1B6EBE-053C-49c1-A483-C377739AB9A5} |
49 | #ifndef IID_QStyleFactory | 61 | #ifndef IID_QStyleFactory |
50 | #define IID_QStyleFactory QUuid(0xfc1b6ebe, 0x53c, 0x49c1, 0xa4, 0x83, 0xc3, 0x77, 0x73, 0x9a, 0xb9, 0xa5) | 62 | #define IID_QStyleFactory QUuid(0xfc1b6ebe, 0x53c, 0x49c1, 0xa4, 0x83, 0xc3, 0x77, 0x73, 0x9a, 0xb9, 0xa5) |
51 | #endif | 63 | #endif |
52 | 64 | ||
53 | struct Q_EXPORT QStyleFactoryInterface : public QFeatureListInterface | 65 | struct Q_EXPORT QStyleFactoryInterface : public QFeatureListInterface |
54 | { | 66 | { |
55 | virtual QStyle* create( const QString& style ) = 0; | 67 | virtual QStyle* create( const QString& style ) = 0; |
56 | }; | 68 | }; |
57 | 69 | ||
58 | #endif //QT_NO_COMPONENT | 70 | #endif //QT_NO_COMPONENT |
59 | #endif //QT_NO_STYLE | 71 | #endif //QT_NO_STYLE |
60 | 72 | ||
61 | #endif //QSTYLEINTERFACE_H | 73 | #endif //QSTYLEINTERFACE_P_H |
diff --git a/qmake/include/private/qsvgdevice_p.h b/qmake/include/private/qsvgdevice_p.h index c1cc389..3407705 100644 --- a/qmake/include/private/qsvgdevice_p.h +++ b/qmake/include/private/qsvgdevice_p.h | |||
@@ -1,55 +1,55 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of the QSvgDevice class | 4 | ** Definition of the QSvgDevice class |
5 | ** | 5 | ** |
6 | ** Created : 20001024 | 6 | ** Created : 001024 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the xml module of the Qt GUI Toolkit. | 10 | ** This file is part of the xml module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | *****************************************************************************/ | 36 | *****************************************************************************/ |
37 | 37 | ||
38 | #ifndef QSVGDEVICE_H | 38 | #ifndef QSVGDEVICE_P_H |
39 | #define QSVGDEVICE_H | 39 | #define QSVGDEVICE_P_H |
40 | 40 | ||
41 | // | 41 | // |
42 | // W A R N I N G | 42 | // W A R N I N G |
43 | // ------------- | 43 | // ------------- |
44 | // | 44 | // |
45 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
46 | // of the QPicture class. This header file may change from | 46 | // of the QPicture class. This header file may change from |
47 | // version to version without notice, or even be removed. | 47 | // version to version without notice, or even be removed. |
48 | // | 48 | // |
49 | // We mean it. | 49 | // We mean it. |
50 | // | 50 | // |
51 | // | 51 | // |
52 | 52 | ||
53 | #ifndef QT_H | 53 | #ifndef QT_H |
54 | #include "qpaintdevice.h" | 54 | #include "qpaintdevice.h" |
55 | #include "qrect.h" | 55 | #include "qrect.h" |
@@ -118,17 +118,17 @@ private: | |||
118 | QSvgDeviceState *curr; | 118 | QSvgDeviceState *curr; |
119 | QPainter *pt; // used by play() et al | 119 | QPainter *pt; // used by play() et al |
120 | 120 | ||
121 | // writing | 121 | // writing |
122 | bool dirtyTransform, dirtyStyle; | 122 | bool dirtyTransform, dirtyStyle; |
123 | 123 | ||
124 | QSvgDevicePrivate *d; | 124 | QSvgDevicePrivate *d; |
125 | }; | 125 | }; |
126 | 126 | ||
127 | inline QRect QSvgDevice::boundingRect() const | 127 | inline QRect QSvgDevice::boundingRect() const |
128 | { | 128 | { |
129 | return brect; | 129 | return brect; |
130 | } | 130 | } |
131 | 131 | ||
132 | #endif // QT_NO_SVG | 132 | #endif // QT_NO_SVG |
133 | 133 | ||
134 | #endif // QSVGDEVICE_H | 134 | #endif // QSVGDEVICE_P_H |
diff --git a/qmake/include/private/qtextcodecinterface_p.h b/qmake/include/private/qtextcodecinterface_p.h index d2a2cb9..76e77f7 100644 --- a/qmake/include/private/qtextcodecinterface_p.h +++ b/qmake/include/private/qtextcodecinterface_p.h | |||
@@ -23,47 +23,45 @@ | |||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #ifndef QTEXTCODECINTERFACE_P_H | 36 | #ifndef QTEXTCODECINTERFACE_P_H |
37 | #define QTEXTCODECINTERFACE_P_H | 37 | #define QTEXTCODECINTERFACE_P_H |
38 | 38 | ||
39 | |||
40 | // | 39 | // |
41 | // W A R N I N G | 40 | // W A R N I N G |
42 | // ------------- | 41 | // ------------- |
43 | // | 42 | // |
44 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
45 | // of qpsprinter.cpp and qprinter_x11.cpp. | 44 | // of qpsprinter.cpp and qprinter_x11.cpp. |
46 | // This header file may change from version to version without notice, | 45 | // This header file may change from version to version without notice, |
47 | // or even be removed. | 46 | // or even be removed. |
48 | // | 47 | // |
49 | // We mean it. | 48 | // We mean it. |
50 | // | 49 | // |
51 | // | 50 | // |
52 | 51 | ||
53 | |||
54 | #ifndef QT_H | 52 | #ifndef QT_H |
55 | #include <private/qcom_p.h> | 53 | #include <private/qcom_p.h> |
56 | #endif // QT_H | 54 | #endif // QT_H |
57 | 55 | ||
58 | #ifndef QT_NO_TEXTCODEC | 56 | #ifndef QT_NO_TEXTCODEC |
59 | #ifndef QT_NO_COMPONENT | 57 | #ifndef QT_NO_COMPONENT |
60 | 58 | ||
61 | class QTextCodec; | 59 | class QTextCodec; |
62 | 60 | ||
63 | 61 | ||
64 | // {F55BFA60-F695-11D4-823E-009027DC0F37} | 62 | // {F55BFA60-F695-11D4-823E-009027DC0F37} |
65 | #ifndef IID_QTextCodecFactory | 63 | #ifndef IID_QTextCodecFactory |
66 | #define IID_QTextCodecFactory QUuid( 0xf55bfa60, 0xf695, 0x11d4, 0x82, 0x3e, 0x00, 0x90, 0x27, 0xdc, 0x0f, 0x37) | 64 | #define IID_QTextCodecFactory QUuid( 0xf55bfa60, 0xf695, 0x11d4, 0x82, 0x3e, 0x00, 0x90, 0x27, 0xdc, 0x0f, 0x37) |
67 | #endif | 65 | #endif |
68 | 66 | ||
69 | 67 | ||
diff --git a/qmake/include/private/qtitlebar_p.h b/qmake/include/private/qtitlebar_p.h index dabb6bf..091845f 100644 --- a/qmake/include/private/qtitlebar_p.h +++ b/qmake/include/private/qtitlebar_p.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of some Qt private functions. | 4 | ** Definition of some Qt private functions. |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the widgets module of the Qt GUI Toolkit. | 10 | ** This file is part of the widgets module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
diff --git a/qmake/include/private/qucom_p.h b/qmake/include/private/qucom_p.h index d2ff48e..6b6ad40 100644 --- a/qmake/include/private/qucom_p.h +++ b/qmake/include/private/qucom_p.h | |||
@@ -22,52 +22,52 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QUCOM_H | 38 | #ifndef QUCOM_P_H |
39 | #define QUCOM_H | 39 | #define QUCOM_P_H |
40 | |||
41 | #ifndef QT_H | ||
42 | #include <qstring.h> | ||
43 | #include "quuid.h" | ||
44 | #endif // QT_H | ||
45 | 40 | ||
46 | // | 41 | // |
47 | // W A R N I N G | 42 | // W A R N I N G |
48 | // ------------- | 43 | // ------------- |
49 | // | 44 | // |
50 | // This file is not part of the Qt API. It exists for the convenience | 45 | // This file is not part of the Qt API. It exists for the convenience |
51 | // of a number of Qt sources files. This header file may change from | 46 | // of a number of Qt sources files. This header file may change from |
52 | // version to version without notice, or even be removed. | 47 | // version to version without notice, or even be removed. |
53 | // | 48 | // |
54 | // We mean it. | 49 | // We mean it. |
55 | // | 50 | // |
56 | // | 51 | // |
57 | 52 | ||
53 | #ifndef QT_H | ||
54 | #include <qstring.h> | ||
55 | #include "quuid.h" | ||
56 | #endif // QT_H | ||
57 | |||
58 | #ifdef check | 58 | #ifdef check |
59 | #undef check | 59 | #undef check |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | struct QUObject; | 62 | struct QUObject; |
63 | struct QUInterfaceDescription; | 63 | struct QUInterfaceDescription; |
64 | struct QUnknownInterface; | 64 | struct QUnknownInterface; |
65 | struct QDispatchInterface; | 65 | struct QDispatchInterface; |
66 | 66 | ||
67 | 67 | ||
68 | struct Q_EXPORT QUBuffer | 68 | struct Q_EXPORT QUBuffer |
69 | { | 69 | { |
70 | virtual long read( char *data, ulong maxlen ) = 0; | 70 | virtual long read( char *data, ulong maxlen ) = 0; |
71 | virtual long write( const char *data, ulong len ) = 0; | 71 | virtual long write( const char *data, ulong len ) = 0; |
72 | }; | 72 | }; |
73 | 73 | ||
@@ -116,78 +116,78 @@ struct Q_EXPORT QUType_Null : public QUType | |||
116 | extern Q_EXPORT QUType_Null static_QUType_Null; | 116 | extern Q_EXPORT QUType_Null static_QUType_Null; |
117 | 117 | ||
118 | 118 | ||
119 | // The magic QUObject | 119 | // The magic QUObject |
120 | struct Q_EXPORT QUObject | 120 | struct Q_EXPORT QUObject |
121 | { | 121 | { |
122 | public: // scary MSVC bug makes this necessary | 122 | public: // scary MSVC bug makes this necessary |
123 | QUObject() : type( &static_QUType_Null ) {} | 123 | QUObject() : type( &static_QUType_Null ) {} |
124 | ~QUObject() { type->clear( this ); } | 124 | ~QUObject() { type->clear( this ); } |
125 | 125 | ||
126 | QUType *type; | 126 | QUType *type; |
127 | 127 | ||
128 | // the unavoidable union | 128 | // the unavoidable union |
129 | union | 129 | union |
130 | { | 130 | { |
131 | bool b; | 131 | bool b; |
132 | 132 | ||
133 | char c; | 133 | char c; |
134 | short s; | 134 | short s; |
135 | int i; | 135 | int i; |
136 | long l; | 136 | long l; |
137 | 137 | ||
138 | unsigned char uc; | 138 | unsigned char uc; |
139 | unsigned short us; | 139 | unsigned short us; |
140 | unsigned int ui; | 140 | unsigned int ui; |
141 | unsigned long ul; | 141 | unsigned long ul; |
142 | 142 | ||
143 | float f; | 143 | float f; |
144 | double d; | 144 | double d; |
145 | 145 | ||
146 | char byte[16]; | 146 | char byte[16]; |
147 | 147 | ||
148 | struct { | 148 | struct { |
149 | char* data; | 149 | char* data; |
150 | unsigned long size; | 150 | unsigned long size; |
151 | } bytearray; | 151 | } bytearray; |
152 | 152 | ||
153 | void* ptr; | 153 | void* ptr; |
154 | 154 | ||
155 | struct { | 155 | struct { |
156 | void *ptr; | 156 | void *ptr; |
157 | bool owner; | 157 | bool owner; |
158 | } voidstar; | 158 | } voidstar; |
159 | 159 | ||
160 | struct { | 160 | struct { |
161 | char *ptr; | 161 | char *ptr; |
162 | bool owner; | 162 | bool owner; |
163 | } charstar; | 163 | } charstar; |
164 | 164 | ||
165 | struct { | 165 | struct { |
166 | char *ptr; | 166 | char *ptr; |
167 | bool owner; | 167 | bool owner; |
168 | } utf8; | 168 | } utf8; |
169 | 169 | ||
170 | struct { | 170 | struct { |
171 | char *ptr; | 171 | char *ptr; |
172 | bool owner; | 172 | bool owner; |
173 | } local8bit; | 173 | } local8bit; |
174 | 174 | ||
175 | QUnknownInterface* iface; | 175 | QUnknownInterface* iface; |
176 | QDispatchInterface* idisp; | 176 | QDispatchInterface* idisp; |
177 | 177 | ||
178 | } payload; | 178 | } payload; |
179 | 179 | ||
180 | }; | 180 | }; |
181 | 181 | ||
182 | 182 | ||
183 | // A parameter description describes one method parameters. A | 183 | // A parameter description describes one method parameters. A |
184 | // parameter has a name, a type and a flag describing whether it's an | 184 | // parameter has a name, a type and a flag describing whether it's an |
185 | // in parameter, an out parameter, or both ways | 185 | // in parameter, an out parameter, or both ways |
186 | struct Q_EXPORT QUParameter | 186 | struct Q_EXPORT QUParameter |
187 | { | 187 | { |
188 | const char* name; | 188 | const char* name; |
189 | QUType *type; | 189 | QUType *type; |
190 | const void* typeExtra; //Usually 0, UEnum* for QUType_enum, const char* for QUType_ptr, int* for QUType_varptr | 190 | const void* typeExtra; //Usually 0, UEnum* for QUType_enum, const char* for QUType_ptr, int* for QUType_varptr |
191 | enum { In = 1, Out = 2, InOut = In | Out }; | 191 | enum { In = 1, Out = 2, InOut = In | Out }; |
192 | int inOut; | 192 | int inOut; |
193 | }; | 193 | }; |
@@ -250,33 +250,33 @@ struct Q_EXPORT QUComponentServerDescription | |||
250 | const char* vendor; | 250 | const char* vendor; |
251 | const char* release; | 251 | const char* release; |
252 | const char* info; | 252 | const char* info; |
253 | int count; | 253 | int count; |
254 | const QUComponentDescription* components; | 254 | const QUComponentDescription* components; |
255 | }; | 255 | }; |
256 | 256 | ||
257 | 257 | ||
258 | 258 | ||
259 | struct Q_EXPORT QUEnumItem // - a name/value pair | 259 | struct Q_EXPORT QUEnumItem // - a name/value pair |
260 | { | 260 | { |
261 | const char *key; | 261 | const char *key; |
262 | int value; | 262 | int value; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | struct Q_EXPORT QUEnum | 265 | struct Q_EXPORT QUEnum |
266 | { | 266 | { |
267 | const char *name; // - enumerator name | 267 | const char *name; // - enumerator name |
268 | unsigned int count; // - number of values | 268 | unsigned int count; // - number of values |
269 | const QUEnumItem *items; // - the name/value pairs | 269 | const QUEnumItem *items; // - the name/value pairs |
270 | bool set; // whether enum has to be treated as a set | 270 | bool set; // whether enum has to be treated as a set |
271 | }; | 271 | }; |
272 | 272 | ||
273 | inline bool QUType::isEqual( const QUType *t1, const QUType *t2 ) { | 273 | inline bool QUType::isEqual( const QUType *t1, const QUType *t2 ) { |
274 | return t1 == t2 || t1->uuid() == t2->uuid() || | 274 | return t1 == t2 || t1->uuid() == t2->uuid() || |
275 | *(t1->uuid()) == *(t2->uuid()); | 275 | *(t1->uuid()) == *(t2->uuid()); |
276 | } | 276 | } |
277 | 277 | ||
278 | inline bool QUType::check( QUObject* o, QUType* t ) { | 278 | inline bool QUType::check( QUObject* o, QUType* t ) { |
279 | return isEqual( o->type, t ) || t->convertFrom( o, o->type ); | 279 | return isEqual( o->type, t ) || t->convertFrom( o, o->type ); |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
@@ -383,88 +383,52 @@ struct Q_EXPORT QUType_int : public QUType | |||
383 | { | 383 | { |
384 | const QUuid *uuid() const; | 384 | const QUuid *uuid() const; |
385 | const char *desc() const; | 385 | const char *desc() const; |
386 | 386 | ||
387 | void set( QUObject *, int ); | 387 | void set( QUObject *, int ); |
388 | int &get( QUObject *o ) { return o->payload.i; } | 388 | int &get( QUObject *o ) { return o->payload.i; } |
389 | bool canConvertFrom( QUObject *, QUType * ); | 389 | bool canConvertFrom( QUObject *, QUType * ); |
390 | bool canConvertTo( QUObject *, QUType * ); | 390 | bool canConvertTo( QUObject *, QUType * ); |
391 | bool convertFrom( QUObject *, QUType * ); | 391 | bool convertFrom( QUObject *, QUType * ); |
392 | bool convertTo( QUObject *, QUType * ); | 392 | bool convertTo( QUObject *, QUType * ); |
393 | void clear( QUObject * ) {} | 393 | void clear( QUObject * ) {} |
394 | int serializeTo( QUObject *, QUBuffer * ); | 394 | int serializeTo( QUObject *, QUBuffer * ); |
395 | int serializeFrom( QUObject *, QUBuffer * ); | 395 | int serializeFrom( QUObject *, QUBuffer * ); |
396 | }; | 396 | }; |
397 | extern Q_EXPORT QUType_int static_QUType_int; | 397 | extern Q_EXPORT QUType_int static_QUType_int; |
398 | 398 | ||
399 | // {5938712A-C496-11D5-8CB2-00C0F03BC0F3} | ||
400 | extern Q_EXPORT const QUuid TID_QUType_uint; | ||
401 | struct Q_EXPORT QUType_uint : public QUType | ||
402 | { | ||
403 | const QUuid *uuid() const; | ||
404 | const char *desc() const; | ||
405 | |||
406 | void set( QUObject *, uint ); | ||
407 | uint &get( QUObject *o ) { return o->payload.ui; } | ||
408 | bool canConvertFrom( QUObject *, QUType * ); | ||
409 | bool canConvertTo( QUObject *, QUType * ); | ||
410 | bool convertFrom( QUObject *, QUType * ); | ||
411 | bool convertTo( QUObject *, QUType * ); | ||
412 | void clear( QUObject * ) {} | ||
413 | int serializeTo( QUObject *, QUBuffer * ); | ||
414 | int serializeFrom( QUObject *, QUBuffer * ); | ||
415 | }; | ||
416 | extern Q_EXPORT QUType_uint static_QUType_uint; | ||
417 | 399 | ||
418 | // {2D0974E5-0BA6-4ec2-8837-C198972CB48C} | 400 | // {2D0974E5-0BA6-4ec2-8837-C198972CB48C} |
419 | extern Q_EXPORT const QUuid TID_QUType_double; | 401 | extern Q_EXPORT const QUuid TID_QUType_double; |
420 | struct Q_EXPORT QUType_double : public QUType | 402 | struct Q_EXPORT QUType_double : public QUType |
421 | { | 403 | { |
422 | const QUuid *uuid() const; | 404 | const QUuid *uuid() const; |
423 | const char *desc() const; | 405 | const char *desc() const; |
424 | 406 | ||
425 | void set( QUObject *, double ); | 407 | void set( QUObject *, double ); |
426 | double &get( QUObject *o ) { return o->payload.d; } | 408 | double &get( QUObject *o ) { return o->payload.d; } |
427 | bool canConvertFrom( QUObject *, QUType * ); | 409 | bool canConvertFrom( QUObject *, QUType * ); |
428 | bool canConvertTo( QUObject *, QUType * ); | 410 | bool canConvertTo( QUObject *, QUType * ); |
429 | bool convertFrom( QUObject *, QUType * ); | 411 | bool convertFrom( QUObject *, QUType * ); |
430 | bool convertTo( QUObject *, QUType * ); | 412 | bool convertTo( QUObject *, QUType * ); |
431 | void clear( QUObject * ) {} | 413 | void clear( QUObject * ) {} |
432 | int serializeTo( QUObject *, QUBuffer * ); | 414 | int serializeTo( QUObject *, QUBuffer * ); |
433 | int serializeFrom( QUObject *, QUBuffer * ); | 415 | int serializeFrom( QUObject *, QUBuffer * ); |
434 | }; | 416 | }; |
435 | extern Q_EXPORT QUType_double static_QUType_double; | 417 | extern Q_EXPORT QUType_double static_QUType_double; |
436 | 418 | ||
437 | // {544C5175-6993-4486-B04D-CEC4D21BF4B9 } | ||
438 | extern Q_EXPORT const QUuid TID_QUType_float; | ||
439 | struct Q_EXPORT QUType_float : public QUType | ||
440 | { | ||
441 | const QUuid *uuid() const; | ||
442 | const char *desc() const; | ||
443 | |||
444 | void set( QUObject *, float ); | ||
445 | float &get( QUObject *o ) { return o->payload.f; } | ||
446 | bool canConvertFrom( QUObject *, QUType * ); | ||
447 | bool canConvertTo( QUObject *, QUType * ); | ||
448 | bool convertFrom( QUObject *, QUType * ); | ||
449 | bool convertTo( QUObject *, QUType * ); | ||
450 | void clear( QUObject * ) {} | ||
451 | int serializeTo( QUObject *, QUBuffer * ); | ||
452 | int serializeFrom( QUObject *, QUBuffer * ); | ||
453 | }; | ||
454 | extern Q_EXPORT QUType_float static_QUType_float; | ||
455 | 419 | ||
456 | // {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} | 420 | // {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} |
457 | extern Q_EXPORT const QUuid TID_QUType_charstar; | 421 | extern Q_EXPORT const QUuid TID_QUType_charstar; |
458 | struct Q_EXPORT QUType_charstar : public QUType | 422 | struct Q_EXPORT QUType_charstar : public QUType |
459 | { | 423 | { |
460 | const QUuid *uuid() const; | 424 | const QUuid *uuid() const; |
461 | const char *desc() const; | 425 | const char *desc() const; |
462 | 426 | ||
463 | void set( QUObject *, const char*, bool take = FALSE ); | 427 | void set( QUObject *, const char*, bool take = FALSE ); |
464 | char* get( QUObject *o ){ return o->payload.charstar.ptr; } | 428 | char* get( QUObject *o ){ return o->payload.charstar.ptr; } |
465 | bool canConvertFrom( QUObject *, QUType * ); | 429 | bool canConvertFrom( QUObject *, QUType * ); |
466 | bool canConvertTo( QUObject *, QUType * ); | 430 | bool canConvertTo( QUObject *, QUType * ); |
467 | bool convertFrom( QUObject *, QUType * ); | 431 | bool convertFrom( QUObject *, QUType * ); |
468 | bool convertTo( QUObject *, QUType * ); | 432 | bool convertTo( QUObject *, QUType * ); |
469 | void clear( QUObject * ); | 433 | void clear( QUObject * ); |
470 | int serializeTo( QUObject *, QUBuffer * ); | 434 | int serializeTo( QUObject *, QUBuffer * ); |
@@ -483,17 +447,17 @@ struct Q_EXPORT QUType_QString : public QUType | |||
483 | 447 | ||
484 | void set( QUObject *, const QString & ); | 448 | void set( QUObject *, const QString & ); |
485 | QString &get( QUObject * o ) { return *(QString*)o->payload.ptr; } | 449 | QString &get( QUObject * o ) { return *(QString*)o->payload.ptr; } |
486 | 450 | ||
487 | bool canConvertFrom( QUObject *, QUType * ); | 451 | bool canConvertFrom( QUObject *, QUType * ); |
488 | bool canConvertTo( QUObject *, QUType * ); | 452 | bool canConvertTo( QUObject *, QUType * ); |
489 | bool convertFrom( QUObject *, QUType * ); | 453 | bool convertFrom( QUObject *, QUType * ); |
490 | bool convertTo( QUObject *, QUType * ); | 454 | bool convertTo( QUObject *, QUType * ); |
491 | void clear( QUObject * ); | 455 | void clear( QUObject * ); |
492 | int serializeTo( QUObject *, QUBuffer * ); | 456 | int serializeTo( QUObject *, QUBuffer * ); |
493 | int serializeFrom( QUObject *, QUBuffer * ); | 457 | int serializeFrom( QUObject *, QUBuffer * ); |
494 | 458 | ||
495 | }; | 459 | }; |
496 | extern Q_EXPORT QUType_QString static_QUType_QString; | 460 | extern Q_EXPORT QUType_QString static_QUType_QString; |
497 | 461 | ||
498 | 462 | ||
499 | #endif // QUCOM_H | 463 | #endif // QUCOM_P_H |
diff --git a/qmake/include/private/qucomextra_p.h b/qmake/include/private/qucomextra_p.h index 3de6104..fe39692 100644 --- a/qmake/include/private/qucomextra_p.h +++ b/qmake/include/private/qucomextra_p.h | |||
@@ -22,34 +22,46 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QUCOMEXTRA_H | 38 | #ifndef QUCOMEXTRA_P_H |
39 | #define QUCOMEXTRA_H | 39 | #define QUCOMEXTRA_P_H |
40 | |||
41 | // | ||
42 | // W A R N I N G | ||
43 | // ------------- | ||
44 | // | ||
45 | // This file is not part of the Qt API. This header file may | ||
46 | // change from version to version without notice, or even be | ||
47 | // removed. | ||
48 | // | ||
49 | // We mean it. | ||
50 | // | ||
51 | // | ||
40 | 52 | ||
41 | #ifndef QT_H | 53 | #ifndef QT_H |
42 | #include <private/qucom_p.h> | 54 | #include <private/qucom_p.h> |
43 | #endif // QT_H | 55 | #endif // QT_H |
44 | 56 | ||
45 | 57 | ||
46 | class QVariant; | 58 | class QVariant; |
47 | 59 | ||
48 | #ifndef QT_NO_VARIANT | 60 | #ifndef QT_NO_VARIANT |
49 | // 6dc75d58-a1d9-4417-b591-d45c63a3a4ea | 61 | // 6dc75d58-a1d9-4417-b591-d45c63a3a4ea |
50 | extern const QUuid TID_QUType_QVariant; | 62 | extern const QUuid TID_QUType_QVariant; |
51 | 63 | ||
52 | struct Q_EXPORT QUType_QVariant : public QUType | 64 | struct Q_EXPORT QUType_QVariant : public QUType |
53 | { | 65 | { |
54 | const QUuid *uuid() const; | 66 | const QUuid *uuid() const; |
55 | const char *desc() const; | 67 | const char *desc() const; |
@@ -76,18 +88,18 @@ struct Q_EXPORT QUType_varptr : public QUType | |||
76 | const QUuid *uuid() const; | 88 | const QUuid *uuid() const; |
77 | const char *desc() const; | 89 | const char *desc() const; |
78 | 90 | ||
79 | void set( QUObject *, const void* ); | 91 | void set( QUObject *, const void* ); |
80 | void* &get( QUObject * o ) { return o->payload.ptr; } | 92 | void* &get( QUObject * o ) { return o->payload.ptr; } |
81 | bool canConvertFrom( QUObject *, QUType * ); | 93 | bool canConvertFrom( QUObject *, QUType * ); |
82 | bool canConvertTo( QUObject *, QUType * ); | 94 | bool canConvertTo( QUObject *, QUType * ); |
83 | bool convertFrom( QUObject *, QUType * ); | 95 | bool convertFrom( QUObject *, QUType * ); |
84 | bool convertTo( QUObject *, QUType * ); | 96 | bool convertTo( QUObject *, QUType * ); |
85 | void clear( QUObject * ) {} | 97 | void clear( QUObject * ) {} |
86 | int serializeTo( QUObject *, QUBuffer * ); | 98 | int serializeTo( QUObject *, QUBuffer * ); |
87 | int serializeFrom( QUObject *, QUBuffer * ); | 99 | int serializeFrom( QUObject *, QUBuffer * ); |
88 | }; | 100 | }; |
89 | extern Q_EXPORT QUType_varptr static_QUType_varptr; | 101 | extern Q_EXPORT QUType_varptr static_QUType_varptr; |
90 | 102 | ||
91 | 103 | ||
92 | #endif // QUCOMEXTRA_H | 104 | #endif // QUCOMEXTRA_P_H |
93 | 105 | ||
diff --git a/qmake/include/private/qwidgetinterface_p.h b/qmake/include/private/qwidgetinterface_p.h index 5b5776b..78e9aad 100644 --- a/qmake/include/private/qwidgetinterface_p.h +++ b/qmake/include/private/qwidgetinterface_p.h | |||
@@ -1,59 +1,73 @@ | |||
1 | /********************************************************************** | 1 | /**************************************************************************** |
2 | ** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Designer. | 4 | ** ... |
5 | ** | ||
6 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the widgets module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
5 | ** | 13 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 17 | ** packaging of this file. |
10 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
20 | ** licenses may use this file in accordance with the Qt Commercial License | ||
21 | ** Agreement provided with the Software. | ||
22 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 30 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 32 | ** not clear to you. |
18 | ** | 33 | ** |
19 | **********************************************************************/ | 34 | **********************************************************************/ |
20 | 35 | ||
21 | #ifndef QWIDGETINTERFACE_H | 36 | #ifndef QWIDGETINTERFACE_P_H |
22 | #define QWIDGETINTERFACE_H | 37 | #define QWIDGETINTERFACE_P_H |
23 | |||
24 | |||
25 | #ifndef QT_H | ||
26 | #include <private/qcom_p.h> | ||
27 | #include <qiconset.h> | ||
28 | #endif // QT_H | ||
29 | |||
30 | #ifndef QT_NO_WIDGETPLUGIN | ||
31 | 38 | ||
32 | // | 39 | // |
33 | // W A R N I N G | 40 | // W A R N I N G |
34 | // ------------- | 41 | // ------------- |
35 | // | 42 | // |
36 | // This file is not part of the Qt API. It exists for the convenience | 43 | // This file is not part of the Qt API. It exists for the convenience |
37 | // of a number of Qt sources files. This header file may change from | 44 | // of a number of Qt sources files. This header file may change from |
38 | // version to version without notice, or even be removed. | 45 | // version to version without notice, or even be removed. |
39 | // | 46 | // |
40 | // We mean it. | 47 | // We mean it. |
41 | // | 48 | // |
42 | // | 49 | // |
43 | 50 | ||
51 | #ifndef QT_H | ||
52 | #include <private/qcom_p.h> | ||
53 | #include <qiconset.h> | ||
54 | #endif // QT_H | ||
55 | |||
56 | #ifndef QT_NO_WIDGETPLUGIN | ||
57 | |||
44 | class QWidget; | 58 | class QWidget; |
45 | 59 | ||
46 | // {55184143-f18f-42c0-a8eb-71c01516019a} | 60 | // {55184143-f18f-42c0-a8eb-71c01516019a} |
47 | #ifndef IID_QWidgetFactory | 61 | #ifndef IID_QWidgetFactory |
48 | #define IID_QWidgetFactory QUuid( 0x55184143, 0xf18f, 0x42c0, 0xa8, 0xeb, 0x71, 0xc0, 0x15, 0x16, 0x1, 0x9a ) | 62 | #define IID_QWidgetFactory QUuid( 0x55184143, 0xf18f, 0x42c0, 0xa8, 0xeb, 0x71, 0xc0, 0x15, 0x16, 0x1, 0x9a ) |
49 | #endif | 63 | #endif |
50 | 64 | ||
51 | /*! To add custom widgets to the Qt Designer, implement that interface | 65 | /*! To add custom widgets to the Qt Designer, implement that interface |
52 | in your custom widget plugin. | 66 | in your custom widget plugin. |
53 | 67 | ||
54 | You also have to implement the function featureList() (\sa | 68 | You also have to implement the function featureList() (\sa |
55 | QFeatureListInterface) and return there all widgets (names of it) | 69 | QFeatureListInterface) and return there all widgets (names of it) |
56 | which this interface provides. | 70 | which this interface provides. |
57 | */ | 71 | */ |
58 | 72 | ||
59 | struct QWidgetFactoryInterface : public QFeatureListInterface | 73 | struct QWidgetFactoryInterface : public QFeatureListInterface |
@@ -79,33 +93,48 @@ public: | |||
79 | virtual QString includeFile( const QString &widget ) const = 0; | 93 | virtual QString includeFile( const QString &widget ) const = 0; |
80 | 94 | ||
81 | /*! In the implementation return the text which should be | 95 | /*! In the implementation return the text which should be |
82 | displayed as tooltip for the widget \a widget */ | 96 | displayed as tooltip for the widget \a widget */ |
83 | virtual QString toolTip( const QString &widget ) const = 0; | 97 | virtual QString toolTip( const QString &widget ) const = 0; |
84 | 98 | ||
85 | /*! In the implementation return the text which should be used for | 99 | /*! In the implementation return the text which should be used for |
86 | what's this help for the widget \a widget. */ | 100 | what's this help for the widget \a widget. */ |
87 | virtual QString whatsThis( const QString &widget ) const = 0; | 101 | virtual QString whatsThis( const QString &widget ) const = 0; |
88 | 102 | ||
89 | /*! In the implementation return TRUE here, of the \a widget | 103 | /*! In the implementation return TRUE here, of the \a widget |
90 | should be able to contain other widget in the Qt Designer, else | 104 | should be able to contain other widget in the Qt Designer, else |
91 | FALSE. */ | 105 | FALSE. */ |
92 | virtual bool isContainer( const QString &widget ) const = 0; | 106 | virtual bool isContainer( const QString &widget ) const = 0; |
93 | }; | 107 | }; |
94 | 108 | ||
95 | #if CONTAINER_CUSTOM_WIDGETS | 109 | #ifdef QT_CONTAINER_CUSTOM_WIDGETS |
96 | // {15976628-e3c3-47f4-b525-d124a3caf30e} | 110 | // {15976628-e3c3-47f4-b525-d124a3caf30e} |
97 | #ifndef IID_QWidgetContainer | 111 | #ifndef IID_QWidgetContainer |
98 | #define IID_QWidgetContainer QUuid( 0x15976628, 0xe3c3, 0x47f4, 0xb5, 0x25, 0xd1, 0x24, 0xa3, 0xca, 0xf3, 0x0e ) | 112 | #define IID_QWidgetContainer QUuid( 0x15976628, 0xe3c3, 0x47f4, 0xb5, 0x25, 0xd1, 0x24, 0xa3, 0xca, 0xf3, 0x0e ) |
99 | #endif | 113 | #endif |
100 | 114 | ||
101 | struct QWidgetContainerInterfacePrivate : public QUnknownInterface | 115 | struct QWidgetContainerInterfacePrivate : public QUnknownInterface |
102 | { | 116 | { |
103 | public: | 117 | public: |
104 | virtual QWidget *containerOfWidget( QWidget *widget ) const = 0; | 118 | virtual QWidget *containerOfWidget( const QString &f, QWidget *container ) const = 0; |
105 | virtual QWidgetList containersOf( QWidget *widget ) const = 0; | 119 | virtual bool isPassiveInteractor( const QString &f, QWidget *container ) const = 0; |
106 | virtual bool isPassiveInteractor( QWidget *widget ) const = 0; | 120 | |
121 | virtual bool supportsPages( const QString &f ) const = 0; | ||
122 | |||
123 | virtual QWidget *addPage( const QString &f, QWidget *container, | ||
124 | const QString &name, int index ) const = 0; | ||
125 | virtual void insertPage( const QString &f, QWidget *container, | ||
126 | const QString &name, int index, QWidget *page ) const = 0; | ||
127 | virtual void removePage( const QString &f, QWidget *container, int index ) const = 0; | ||
128 | virtual void movePage( const QString &f, QWidget *container, int fromIndex, int toIndex ) const = 0; | ||
129 | virtual int count( const QString &key, QWidget *container ) const = 0; | ||
130 | virtual int currentIndex( const QString &key, QWidget *container ) const = 0; | ||
131 | virtual QString pageLabel( const QString &key, QWidget *container, int index ) const = 0; | ||
132 | virtual QWidget *page( const QString &key, QWidget *container, int index ) const = 0; | ||
133 | virtual void renamePage( const QString &key, QWidget *container, | ||
134 | int index, const QString &newName ) const = 0; | ||
135 | virtual QWidgetList pages( const QString &f, QWidget *container ) const = 0; | ||
107 | }; | 136 | }; |
108 | #endif | 137 | #endif |
109 | 138 | ||
110 | #endif // QT_NO_WIDGETPLUGIN | 139 | #endif // QT_NO_WIDGETPLUGIN |
111 | #endif // QWIDGETINTERFACE_H | 140 | #endif // QWIDGETINTERFACE_P_H |
diff --git a/qmake/include/private/qwidgetresizehandler_p.h b/qmake/include/private/qwidgetresizehandler_p.h index ca229db..9297832 100644 --- a/qmake/include/private/qwidgetresizehandler_p.h +++ b/qmake/include/private/qwidgetresizehandler_p.h | |||
@@ -1,55 +1,67 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of the QWidgetResizeHandler class | 4 | ** Definition of the QWidgetResizeHandler class |
5 | ** | 5 | ** |
6 | ** Created : 001010 | 6 | ** Created : 001010 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the workspace module of the Qt GUI Toolkit. | 10 | ** This file is part of the workspace module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QWIDGETRESIZEHANDLER_H | 38 | #ifndef QWIDGETRESIZEHANDLER_P_H |
39 | #define QWIDGETRESIZEHANDLER_H | 39 | #define QWIDGETRESIZEHANDLER_P_H |
40 | |||
41 | // | ||
42 | // W A R N I N G | ||
43 | // ------------- | ||
44 | // | ||
45 | // This file is not part of the Qt API. This header file may | ||
46 | // change from version to version without notice, or even be | ||
47 | // removed. | ||
48 | // | ||
49 | // We mean it. | ||
50 | // | ||
51 | // | ||
40 | 52 | ||
41 | #ifndef QT_H | 53 | #ifndef QT_H |
42 | #include "qobject.h" | 54 | #include "qobject.h" |
43 | #endif // QT_H | 55 | #endif // QT_H |
44 | #ifndef QT_NO_RESIZEHANDLER | 56 | #ifndef QT_NO_RESIZEHANDLER |
45 | class QMouseEvent; | 57 | class QMouseEvent; |
46 | class QKeyEvent; | 58 | class QKeyEvent; |
47 | 59 | ||
48 | class Q_EXPORT QWidgetResizeHandler : public QObject | 60 | class Q_EXPORT QWidgetResizeHandler : public QObject |
49 | { | 61 | { |
50 | Q_OBJECT | 62 | Q_OBJECT |
51 | 63 | ||
52 | public: | 64 | public: |
53 | QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 ); | 65 | QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 ); |
54 | void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); } | 66 | void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); } |
55 | bool isActive() const { return active; } | 67 | bool isActive() const { return active; } |
diff --git a/qmake/include/qasciidict.h b/qmake/include/qasciidict.h index 8f344cd..ecd9c9f 100644 --- a/qmake/include/qasciidict.h +++ b/qmake/include/qasciidict.h | |||
@@ -102,17 +102,21 @@ class QAsciiDictIterator : public QGDictIterator | |||
102 | { | 102 | { |
103 | public: | 103 | public: |
104 | QAsciiDictIterator(const QAsciiDict<type> &d) | 104 | QAsciiDictIterator(const QAsciiDict<type> &d) |
105 | : QGDictIterator((QGDict &)d) {} | 105 | : QGDictIterator((QGDict &)d) {} |
106 | ~QAsciiDictIterator() {} | 106 | ~QAsciiDictIterator() {} |
107 | uint count() const { return dict->count(); } | 107 | uint count() const { return dict->count(); } |
108 | bool isEmpty() const { return dict->count() == 0; } | 108 | bool isEmpty() const { return dict->count() == 0; } |
109 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } | 109 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } |
110 | operator type *() const { return (type *)QGDictIterator::get(); } | 110 | operator type *() const { return (type *)QGDictIterator::get(); } |
111 | type *current() const { return (type *)QGDictIterator::get(); } | 111 | type *current() const { return (type *)QGDictIterator::get(); } |
112 | const char *currentKey() const { return QGDictIterator::getKeyAscii(); } | 112 | const char *currentKey() const { return QGDictIterator::getKeyAscii(); } |
113 | type *operator()() { return (type *)QGDictIterator::operator()(); } | 113 | type *operator()() { return (type *)QGDictIterator::operator()(); } |
114 | type *operator++() { return (type *)QGDictIterator::operator++(); } | 114 | type *operator++() { return (type *)QGDictIterator::operator++(); } |
115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} | 115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} |
116 | }; | 116 | }; |
117 | 117 | ||
118 | #ifdef QT_QWINEXPORT | ||
119 | #define Q_DEFINED_QASCIIDICT | ||
120 | #include "qwinexport.h" | ||
121 | #endif /* QT_QWINEXPORT */ | ||
118 | #endif // QASCIIDICT_H | 122 | #endif // QASCIIDICT_H |
diff --git a/qmake/include/qcstring.h b/qmake/include/qcstring.h index 004bb3b..6b7352a 100644 --- a/qmake/include/qcstring.h +++ b/qmake/include/qcstring.h | |||
@@ -88,35 +88,37 @@ Q_EXPORT inline char *cstrcpy( char *dst, const char *src ) | |||
88 | Q_EXPORT inline int cstrcmp( const char *str1, const char *str2 ) | 88 | Q_EXPORT inline int cstrcmp( const char *str1, const char *str2 ) |
89 | { return strcmp(str1,str2); } | 89 | { return strcmp(str1,str2); } |
90 | 90 | ||
91 | Q_EXPORT inline int cstrncmp( const char *str1, const char *str2, uint len ) | 91 | Q_EXPORT inline int cstrncmp( const char *str1, const char *str2, uint len ) |
92 | { return strncmp(str1,str2,len); } | 92 | { return strncmp(str1,str2,len); } |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | 95 | ||
96 | // qChecksum: Internet checksum | 96 | // qChecksum: Internet checksum |
97 | 97 | ||
98 | Q_EXPORT Q_UINT16 qChecksum( const char *s, uint len ); | 98 | Q_EXPORT Q_UINT16 qChecksum( const char *s, uint len ); |
99 | 99 | ||
100 | /***************************************************************************** | 100 | /***************************************************************************** |
101 | QByteArray class | 101 | QByteArray class |
102 | *****************************************************************************/ | 102 | *****************************************************************************/ |
103 | 103 | ||
104 | #ifndef QT_QWINEXPORT | ||
104 | #if defined(Q_TEMPLATEDLL) | 105 | #if defined(Q_TEMPLATEDLL) |
105 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<char>; | 106 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<char>; |
106 | #endif | 107 | #endif |
108 | #endif /* QT_QWINEXPORT */ | ||
107 | 109 | ||
108 | #if defined(Q_QDOC) | 110 | #if defined(Q_QDOC) |
109 | /* | 111 | /* |
110 | We want qdoc to document QByteArray as a real class that inherits | 112 | We want qdoc to document QByteArray as a real class that inherits |
111 | QMemArray<char> and that is inherited by QBitArray. | 113 | QMemArray<char> and that is inherited by QBitArray. |
112 | */ | 114 | */ |
113 | class QByteArray : public QMemArray<char> | 115 | class QByteArray : public QMemArray<char> |
114 | { | 116 | { |
115 | public: | 117 | public: |
116 | QByteArray(); | 118 | QByteArray(); |
117 | QByteArray( int size ); | 119 | QByteArray( int size ); |
118 | }; | 120 | }; |
119 | #else | 121 | #else |
120 | typedef QMemArray<char> QByteArray; | 122 | typedef QMemArray<char> QByteArray; |
121 | #endif | 123 | #endif |
122 | 124 | ||
@@ -219,32 +221,34 @@ public: | |||
219 | 221 | ||
220 | QCString &setStr( const char *s ); | 222 | QCString &setStr( const char *s ); |
221 | QCString &setNum( short ); | 223 | QCString &setNum( short ); |
222 | QCString &setNum( ushort ); | 224 | QCString &setNum( ushort ); |
223 | QCString &setNum( int ); | 225 | QCString &setNum( int ); |
224 | QCString &setNum( uint ); | 226 | QCString &setNum( uint ); |
225 | QCString &setNum( long ); | 227 | QCString &setNum( long ); |
226 | QCString &setNum( ulong ); | 228 | QCString &setNum( ulong ); |
227 | QCString &setNum( float, char f='g', int prec=6 ); | 229 | QCString &setNum( float, char f='g', int prec=6 ); |
228 | QCString &setNum( double, char f='g', int prec=6 ); | 230 | QCString &setNum( double, char f='g', int prec=6 ); |
229 | 231 | ||
230 | boolsetExpand( uint index, char c ); | 232 | boolsetExpand( uint index, char c ); |
231 | 233 | ||
232 | operator const char *() const; | 234 | operator const char *() const; |
233 | QCString &operator+=( const char *str ); | 235 | QCString &operator+=( const char *str ); |
234 | QCString &operator+=( char c ); | 236 | QCString &operator+=( char c ); |
237 | private: | ||
238 | intfind( const char *str, int index, bool cs, uint l ) const; | ||
235 | }; | 239 | }; |
236 | 240 | ||
237 | 241 | ||
238 | /***************************************************************************** | 242 | /***************************************************************************** |
239 | QCString stream functions | 243 | QCString stream functions |
240 | *****************************************************************************/ | 244 | *****************************************************************************/ |
241 | #ifndef QT_NO_DATASTREAM | 245 | #ifndef QT_NO_DATASTREAM |
242 | Q_EXPORT QDataStream &operator<<( QDataStream &, const QCString & ); | 246 | Q_EXPORT QDataStream &operator<<( QDataStream &, const QCString & ); |
243 | Q_EXPORT QDataStream &operator>>( QDataStream &, QCString & ); | 247 | Q_EXPORT QDataStream &operator>>( QDataStream &, QCString & ); |
244 | #endif | 248 | #endif |
245 | 249 | ||
246 | /***************************************************************************** | 250 | /***************************************************************************** |
247 | QCString inline functions | 251 | QCString inline functions |
248 | *****************************************************************************/ | 252 | *****************************************************************************/ |
249 | 253 | ||
250 | inline QCString &QCString::operator=( const QCString &s ) | 254 | inline QCString &QCString::operator=( const QCString &s ) |
@@ -375,17 +379,20 @@ Q_EXPORT inline const QCString operator+( const char *s1, const QCString &s2 ) | |||
375 | 379 | ||
376 | Q_EXPORT inline const QCString operator+( const QCString &s1, char c2 ) | 380 | Q_EXPORT inline const QCString operator+( const QCString &s1, char c2 ) |
377 | { | 381 | { |
378 | QCString tmp( s1.data() ); | 382 | QCString tmp( s1.data() ); |
379 | tmp += c2; | 383 | tmp += c2; |
380 | return tmp; | 384 | return tmp; |
381 | } | 385 | } |
382 | 386 | ||
383 | Q_EXPORT inline const QCString operator+( char c1, const QCString &s2 ) | 387 | Q_EXPORT inline const QCString operator+( char c1, const QCString &s2 ) |
384 | { | 388 | { |
385 | QCString tmp; | 389 | QCString tmp; |
386 | tmp += c1; | 390 | tmp += c1; |
387 | tmp += s2; | 391 | tmp += s2; |
388 | return tmp; | 392 | return tmp; |
389 | } | 393 | } |
390 | 394 | ||
395 | #ifdef QT_QWINEXPORT | ||
396 | #include <qwinexport.h> | ||
397 | #endif /* QT_QWINEXPORT */ | ||
391 | #endif // QCSTRING_H | 398 | #endif // QCSTRING_H |
diff --git a/qmake/include/qdict.h b/qmake/include/qdict.h index 04ae7bf..d8943ad 100644 --- a/qmake/include/qdict.h +++ b/qmake/include/qdict.h | |||
@@ -102,17 +102,21 @@ class QDictIterator : public QGDictIterator | |||
102 | { | 102 | { |
103 | public: | 103 | public: |
104 | QDictIterator(const QDict<type> &d) : QGDictIterator((QGDict &)d) { } | 104 | QDictIterator(const QDict<type> &d) : QGDictIterator((QGDict &)d) { } |
105 | ~QDictIterator() {} | 105 | ~QDictIterator() {} |
106 | uint count() const { return dict->count(); } | 106 | uint count() const { return dict->count(); } |
107 | bool isEmpty() const { return dict->count() == 0; } | 107 | bool isEmpty() const { return dict->count() == 0; } |
108 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } | 108 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } |
109 | operator type *() const { return (type *)QGDictIterator::get(); } | 109 | operator type *() const { return (type *)QGDictIterator::get(); } |
110 | type *operator*() { return (type *)QGDictIterator::get(); } | 110 | type *operator*() { return (type *)QGDictIterator::get(); } |
111 | type *current() const { return (type *)QGDictIterator::get(); } | 111 | type *current() const { return (type *)QGDictIterator::get(); } |
112 | QString currentKey() const{ return QGDictIterator::getKeyString(); } | 112 | QString currentKey() const{ return QGDictIterator::getKeyString(); } |
113 | type *operator()() { return (type *)QGDictIterator::operator()(); } | 113 | type *operator()() { return (type *)QGDictIterator::operator()(); } |
114 | type *operator++() { return (type *)QGDictIterator::operator++(); } | 114 | type *operator++() { return (type *)QGDictIterator::operator++(); } |
115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j); } | 115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j); } |
116 | }; | 116 | }; |
117 | 117 | ||
118 | #ifdef QT_QWINEXPORT | ||
119 | #define Q_DEFINED_QDICT | ||
120 | #include "qwinexport.h" | ||
121 | #endif /* QT_QWINEXPORT */ | ||
118 | #endif // QDICT_H | 122 | #endif // QDICT_H |
diff --git a/qmake/include/qdir.h b/qmake/include/qdir.h index 6e9f1ab..4b08b79 100644 --- a/qmake/include/qdir.h +++ b/qmake/include/qdir.h | |||
@@ -165,43 +165,44 @@ public: | |||
165 | bool acceptAbsPath = TRUE ); | 165 | bool acceptAbsPath = TRUE ); |
166 | 166 | ||
167 | static char separator(); | 167 | static char separator(); |
168 | 168 | ||
169 | static bool setCurrent( const QString &path ); | 169 | static bool setCurrent( const QString &path ); |
170 | static QDir current(); | 170 | static QDir current(); |
171 | static QDir home(); | 171 | static QDir home(); |
172 | static QDir root(); | 172 | static QDir root(); |
173 | static QString currentDirPath(); | 173 | static QString currentDirPath(); |
174 | static QString homeDirPath(); | 174 | static QString homeDirPath(); |
175 | static QString rootDirPath(); | 175 | static QString rootDirPath(); |
176 | 176 | ||
177 | static bool match( const QStringList &filters, const QString &fileName ); | 177 | static bool match( const QStringList &filters, const QString &fileName ); |
178 | static bool match( const QString &filter, const QString &fileName ); | 178 | static bool match( const QString &filter, const QString &fileName ); |
179 | static QString cleanDirPath( const QString &dirPath ); | 179 | static QString cleanDirPath( const QString &dirPath ); |
180 | static bool isRelativePath( const QString &path ); | 180 | static bool isRelativePath( const QString &path ); |
181 | void refresh() const; | ||
181 | 182 | ||
182 | private: | 183 | private: |
183 | #ifdef Q_OS_MAC | 184 | #ifdef Q_OS_MAC |
184 | typedef struct FSSpec FSSpec; | 185 | typedef struct FSSpec FSSpec; |
185 | static FSSpec *make_spec(const QString &); | 186 | static FSSpec *make_spec(const QString &); |
186 | #endif | 187 | #endif |
187 | void init(); | 188 | void init(); |
188 | virtual bool readDirEntries( const QString &nameFilter, | 189 | virtual bool readDirEntries( const QString &nameFilter, |
189 | int FilterSpec, int SortSpec ); | 190 | int FilterSpec, int SortSpec ); |
190 | 191 | ||
191 | static void slashify ( QString &); | 192 | static void slashify( QString & ); |
192 | 193 | ||
193 | QStringdPath; | 194 | QStringdPath; |
194 | QStringList *fList; | 195 | QStringList *fList; |
195 | QFileInfoList *fiList; | 196 | QFileInfoList *fiList; |
196 | QStringnameFilt; | 197 | QStringnameFilt; |
197 | FilterSpecfiltS; | 198 | FilterSpecfiltS; |
198 | SortSpecsortS; | 199 | SortSpecsortS; |
199 | uint dirty: 1; | 200 | uint dirty: 1; |
200 | uintallDirs : 1; | 201 | uintallDirs : 1; |
201 | }; | 202 | }; |
202 | 203 | ||
203 | 204 | ||
204 | inline QString QDir::path() const | 205 | inline QString QDir::path() const |
205 | { | 206 | { |
206 | return dPath; | 207 | return dPath; |
207 | } | 208 | } |
diff --git a/qmake/include/qfeatures.h b/qmake/include/qfeatures.h index 57502f9..270a6de 100644 --- a/qmake/include/qfeatures.h +++ b/qmake/include/qfeatures.h | |||
@@ -61,33 +61,33 @@ | |||
61 | 61 | ||
62 | // Alpha-blended cursor | 62 | // Alpha-blended cursor |
63 | //#define QT_NO_QWS_ALPHA_CURSOR | 63 | //#define QT_NO_QWS_ALPHA_CURSOR |
64 | 64 | ||
65 | // 1-bit monochrome | 65 | // 1-bit monochrome |
66 | //#define QT_NO_QWS_DEPTH_1 | 66 | //#define QT_NO_QWS_DEPTH_1 |
67 | 67 | ||
68 | // 15 or 16-bit color | 68 | // 15 or 16-bit color |
69 | //#define QT_NO_QWS_DEPTH_16 | 69 | //#define QT_NO_QWS_DEPTH_16 |
70 | 70 | ||
71 | // 24-bit color | 71 | // 24-bit color |
72 | //#define QT_NO_QWS_DEPTH_24 | 72 | //#define QT_NO_QWS_DEPTH_24 |
73 | 73 | ||
74 | // 32-bit color | 74 | // 32-bit color |
75 | //#define QT_NO_QWS_DEPTH_32 | 75 | //#define QT_NO_QWS_DEPTH_32 |
76 | 76 | ||
77 | // 4-bit greyscale | 77 | // 4-bit grayscale |
78 | //#define QT_NO_QWS_DEPTH_4 | 78 | //#define QT_NO_QWS_DEPTH_4 |
79 | 79 | ||
80 | // 8-bit color | 80 | // 8-bit color |
81 | //#define QT_NO_QWS_DEPTH_8 | 81 | //#define QT_NO_QWS_DEPTH_8 |
82 | 82 | ||
83 | // 8-bit grayscale | 83 | // 8-bit grayscale |
84 | //#define QT_NO_QWS_DEPTH_8GRAYSCALE | 84 | //#define QT_NO_QWS_DEPTH_8GRAYSCALE |
85 | 85 | ||
86 | // Favour code size over graphics speed | 86 | // Favour code size over graphics speed |
87 | //#define QT_NO_QWS_GFX_SPEED | 87 | //#define QT_NO_QWS_GFX_SPEED |
88 | 88 | ||
89 | // Console keyboard | 89 | // Console keyboard |
90 | //#define QT_NO_QWS_KEYBOARD | 90 | //#define QT_NO_QWS_KEYBOARD |
91 | 91 | ||
92 | // Linux framebuffer | 92 | // Linux framebuffer |
93 | //#define QT_NO_QWS_LINUXFB | 93 | //#define QT_NO_QWS_LINUXFB |
diff --git a/qmake/include/qgarray.h b/qmake/include/qgarray.h index 12edea6..40720a6 100644 --- a/qmake/include/qgarray.h +++ b/qmake/include/qgarray.h | |||
@@ -36,72 +36,81 @@ | |||
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QGARRAY_H | 38 | #ifndef QGARRAY_H |
39 | #define QGARRAY_H | 39 | #define QGARRAY_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qshared.h" | 42 | #include "qshared.h" |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | 45 | ||
46 | class Q_EXPORT QGArray // generic array | 46 | class Q_EXPORT QGArray // generic array |
47 | { | 47 | { |
48 | friend class QBuffer; | 48 | friend class QBuffer; |
49 | public: | 49 | public: |
50 | //### DO NOT USE THIS. IT IS PUBLIC BUT DO NOT USE IT IN NEW CODE. | 50 | //### DO NOT USE THIS. IT IS PUBLIC BUT DO NOT USE IT IN NEW CODE. |
51 | struct array_data : public QShared {// shared array | 51 | struct array_data : public QShared {// shared array |
52 | array_data(){ data=0; len=0; } | 52 | array_data():data(0),len(0) |
53 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
54 | ,maxl(0) | ||
55 | #endif | ||
56 | {} | ||
53 | char *data; // actual array data | 57 | char *data; // actual array data |
54 | uint len; | 58 | uint len; |
59 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
60 | uint maxl; | ||
61 | #endif | ||
55 | }; | 62 | }; |
56 | QGArray(); | 63 | QGArray(); |
64 | enum Optimization { MemOptim, SpeedOptim }; | ||
57 | protected: | 65 | protected: |
58 | QGArray( int, int ); // dummy; does not alloc | 66 | QGArray( int, int ); // dummy; does not alloc |
59 | QGArray( int size ); // allocate 'size' bytes | 67 | QGArray( int size ); // allocate 'size' bytes |
60 | QGArray( const QGArray &a ); // shallow copy | 68 | QGArray( const QGArray &a ); // shallow copy |
61 | virtual ~QGArray(); | 69 | virtual ~QGArray(); |
62 | 70 | ||
63 | QGArray &operator=( const QGArray &a ) { return assign( a ); } | 71 | QGArray &operator=( const QGArray &a ) { return assign( a ); } |
64 | 72 | ||
65 | virtual void detach(){ duplicate(*this); } | 73 | virtual void detach(){ duplicate(*this); } |
66 | 74 | ||
67 | // ### Qt 4.0: maybe provide two versions of data(), at(), etc. | 75 | // ### Qt 4.0: maybe provide two versions of data(), at(), etc. |
68 | char *data() const{ return shd->data; } | 76 | char *data() const{ return shd->data; } |
69 | uint nrefs() const{ return shd->count; } | 77 | uint nrefs() const{ return shd->count; } |
70 | uint size() const{ return shd->len; } | 78 | uint size() const{ return shd->len; } |
71 | boolisEqual( const QGArray &a ) const; | 79 | boolisEqual( const QGArray &a ) const; |
72 | 80 | ||
81 | boolresize( uint newsize, Optimization optim ); | ||
73 | boolresize( uint newsize ); | 82 | boolresize( uint newsize ); |
74 | 83 | ||
75 | boolfill( const char *d, int len, uint sz ); | 84 | boolfill( const char *d, int len, uint sz ); |
76 | 85 | ||
77 | QGArray &assign( const QGArray &a ); | 86 | QGArray &assign( const QGArray &a ); |
78 | QGArray &assign( const char *d, uint len ); | 87 | QGArray &assign( const char *d, uint len ); |
79 | QGArray &duplicate( const QGArray &a ); | 88 | QGArray &duplicate( const QGArray &a ); |
80 | QGArray &duplicate( const char *d, uint len ); | 89 | QGArray &duplicate( const char *d, uint len ); |
81 | voidstore( const char *d, uint len ); | 90 | voidstore( const char *d, uint len ); |
82 | 91 | ||
83 | array_data *sharedBlock() const { return shd; } | 92 | array_data *sharedBlock() const { return shd; } |
84 | voidsetSharedBlock( array_data *p ) { shd=(array_data*)p; } | 93 | voidsetSharedBlock( array_data *p ) { shd=(array_data*)p; } |
85 | 94 | ||
86 | QGArray &setRawData( const char *d, uint len ); | 95 | QGArray &setRawData( const char *d, uint len ); |
87 | voidresetRawData( const char *d, uint len ); | 96 | voidresetRawData( const char *d, uint len ); |
88 | 97 | ||
89 | int find( const char *d, uint index, uint sz ) const; | 98 | int find( const char *d, uint index, uint sz ) const; |
90 | int contains( const char *d, uint sz ) const; | 99 | int contains( const char *d, uint sz ) const; |
91 | 100 | ||
92 | voidsort( uint sz ); | 101 | voidsort( uint sz ); |
93 | int bsearch( const char *d, uint sz ) const; | 102 | int bsearch( const char *d, uint sz ) const; |
94 | 103 | ||
95 | char *at( uint index ) const; | 104 | char *at( uint index ) const; |
96 | 105 | ||
97 | boolsetExpand( uint index, const char *d, uint sz ); | 106 | boolsetExpand( uint index, const char *d, uint sz ); |
98 | 107 | ||
99 | protected: | 108 | protected: |
100 | virtual array_data *newData(); | 109 | virtual array_data *newData(); |
101 | virtual void deleteData( array_data *p ); | 110 | virtual void deleteData( array_data *p ); |
102 | 111 | ||
103 | private: | 112 | private: |
104 | static void msg_index( uint ); | 113 | static void msg_index( uint ); |
105 | array_data *shd; | 114 | array_data *shd; |
106 | }; | 115 | }; |
107 | 116 | ||
diff --git a/qmake/include/qglobal.h b/qmake/include/qglobal.h index 13cff64..d212bff 100644 --- a/qmake/include/qglobal.h +++ b/qmake/include/qglobal.h | |||
@@ -25,37 +25,37 @@ | |||
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QGLOBAL_H | 38 | #ifndef QGLOBAL_H |
39 | #define QGLOBAL_H | 39 | #define QGLOBAL_H |
40 | 40 | ||
41 | #define QT_VERSION_STR "3.1.0-b2" | 41 | #define QT_VERSION_STR "3.1.2" |
42 | /* | 42 | /* |
43 | QT_VERSION is (major << 16) + (minor << 8) + patch. | 43 | QT_VERSION is (major << 16) + (minor << 8) + patch. |
44 | */ | 44 | */ |
45 | #define QT_VERSION 0x030100 | 45 | #define QT_VERSION 0x030102 |
46 | 46 | ||
47 | /* | 47 | /* |
48 | The operating system, must be one of: (Q_OS_x) | 48 | The operating system, must be one of: (Q_OS_x) |
49 | 49 | ||
50 | MACX- Mac OS X | 50 | MACX- Mac OS X |
51 | MAC9- Mac OS 9 | 51 | MAC9- Mac OS 9 |
52 | MSDOS- MS-DOS and Windows | 52 | MSDOS- MS-DOS and Windows |
53 | OS2- OS/2 | 53 | OS2- OS/2 |
54 | OS2EMX- XFree86 on OS/2 (not PM) | 54 | OS2EMX- XFree86 on OS/2 (not PM) |
55 | WIN32- Win32 (Windows 95/98/ME and Windows NT/2000/XP) | 55 | WIN32- Win32 (Windows 95/98/ME and Windows NT/2000/XP) |
56 | CYGWIN- Cygwin | 56 | CYGWIN- Cygwin |
57 | SOLARIS- Sun Solaris | 57 | SOLARIS- Sun Solaris |
58 | HPUX- HP-UX | 58 | HPUX- HP-UX |
59 | ULTRIX- DEC Ultrix | 59 | ULTRIX- DEC Ultrix |
60 | LINUX- Linux | 60 | LINUX- Linux |
61 | FREEBSD- FreeBSD | 61 | FREEBSD- FreeBSD |
@@ -128,38 +128,38 @@ | |||
128 | #elif defined(__osf__) | 128 | #elif defined(__osf__) |
129 | # define Q_OS_OSF | 129 | # define Q_OS_OSF |
130 | #elif defined(_AIX) | 130 | #elif defined(_AIX) |
131 | # define Q_OS_AIX | 131 | # define Q_OS_AIX |
132 | #elif defined(__Lynx__) | 132 | #elif defined(__Lynx__) |
133 | # define Q_OS_LYNX | 133 | # define Q_OS_LYNX |
134 | #elif defined(__GNU_HURD__) | 134 | #elif defined(__GNU_HURD__) |
135 | # define Q_OS_HURD | 135 | # define Q_OS_HURD |
136 | #elif defined(__DGUX__) | 136 | #elif defined(__DGUX__) |
137 | # define Q_OS_DGUX | 137 | # define Q_OS_DGUX |
138 | #elif defined(__QNXNTO__) | 138 | #elif defined(__QNXNTO__) |
139 | # define Q_OS_QNX6 | 139 | # define Q_OS_QNX6 |
140 | #elif defined(__QNX__) | 140 | #elif defined(__QNX__) |
141 | # define Q_OS_QNX | 141 | # define Q_OS_QNX |
142 | #elif defined(_SEQUENT_) | 142 | #elif defined(_SEQUENT_) |
143 | # define Q_OS_DYNIX | 143 | # define Q_OS_DYNIX |
144 | #elif defined(_SCO_DS) /* SCO OpenServer 5 */ | 144 | #elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ |
145 | # define Q_OS_SCO | 145 | # define Q_OS_SCO |
146 | #elif defined(__UNIXWARE__) /* UnixWare 7 + GCC, Open UNIX 8 + GCC */ | 146 | #elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ |
147 | # define Q_OS_UNIXWARE | 147 | # define Q_OS_UNIXWARE |
148 | # define Q_OS_UNIXWARE7 | 148 | # define Q_OS_UNIXWARE7 |
149 | #elif defined(__USLC__) /* UnixWare 7 + UDK, Open UNIX 8 + OUDK */ | 149 | #elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ |
150 | # define Q_OS_UNIXWARE | 150 | # define Q_OS_UNIXWARE |
151 | # define Q_OS_UNIXWARE7 | 151 | # define Q_OS_UNIXWARE7 |
152 | #else | 152 | #else |
153 | # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" | 153 | # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | #if defined(Q_OS_MAC9) || defined(Q_OS_MACX) | 156 | #if defined(Q_OS_MAC9) || defined(Q_OS_MACX) |
157 | # define Q_OS_MAC | 157 | # define Q_OS_MAC |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | #if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN32) || defined(Q_OS_WIN64) | 160 | #if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN32) || defined(Q_OS_WIN64) |
161 | # undef Q_OS_UNIX | 161 | # undef Q_OS_UNIX |
162 | #elif !defined(Q_OS_UNIX) | 162 | #elif !defined(Q_OS_UNIX) |
163 | # define Q_OS_UNIX | 163 | # define Q_OS_UNIX |
164 | #endif | 164 | #endif |
165 | 165 | ||
@@ -212,33 +212,35 @@ | |||
212 | # define Q_NO_USING_KEYWORD | 212 | # define Q_NO_USING_KEYWORD |
213 | 213 | ||
214 | #elif defined(__MWERKS__) | 214 | #elif defined(__MWERKS__) |
215 | # define Q_CC_MWERKS | 215 | # define Q_CC_MWERKS |
216 | /* "explicit" recognized since 4.0d1 */ | 216 | /* "explicit" recognized since 4.0d1 */ |
217 | # define QMAC_PASCAL pascal | 217 | # define QMAC_PASCAL pascal |
218 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 218 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
219 | 219 | ||
220 | #elif defined(_MSC_VER) | 220 | #elif defined(_MSC_VER) |
221 | # define Q_CC_MSVC | 221 | # define Q_CC_MSVC |
222 | /* proper support of bool for _MSC_VER >= 1100 */ | 222 | /* proper support of bool for _MSC_VER >= 1100 */ |
223 | # define Q_CANNOT_DELETE_CONSTANT | 223 | # define Q_CANNOT_DELETE_CONSTANT |
224 | # define Q_INLINE_TEMPLATES inline | 224 | # define Q_INLINE_TEMPLATES inline |
225 | /* Visual C++.Net issues for _MSC_VER >= 1300 */ | 225 | /* Visual C++.Net issues for _MSC_VER >= 1300 */ |
226 | # if _MSC_VER >= 1300 | 226 | # if _MSC_VER >= 1300 |
227 | # define Q_CC_MSVC_NET | 227 | # define Q_CC_MSVC_NET |
228 | # define Q_TYPENAME | 228 | # if _MSC_VER < 1310 |
229 | # define Q_TYPENAME | ||
230 | # endif | ||
229 | # endif | 231 | # endif |
230 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 232 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
231 | 233 | ||
232 | #elif defined(__BORLANDC__) || defined(__TURBOC__) | 234 | #elif defined(__BORLANDC__) || defined(__TURBOC__) |
233 | # define Q_CC_BOR | 235 | # define Q_CC_BOR |
234 | # if __BORLANDC__ < 0x502 | 236 | # if __BORLANDC__ < 0x502 |
235 | # define Q_NO_BOOL_TYPE | 237 | # define Q_NO_BOOL_TYPE |
236 | # define Q_NO_EXPLICIT_KEYWORD | 238 | # define Q_NO_EXPLICIT_KEYWORD |
237 | # endif | 239 | # endif |
238 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 240 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
239 | 241 | ||
240 | #elif defined(__WATCOMC__) | 242 | #elif defined(__WATCOMC__) |
241 | # define Q_CC_WAT | 243 | # define Q_CC_WAT |
242 | # if defined(Q_OS_QNX4) | 244 | # if defined(Q_OS_QNX4) |
243 | /* compiler flags */ | 245 | /* compiler flags */ |
244 | # define Q_TYPENAME | 246 | # define Q_TYPENAME |
@@ -258,32 +260,36 @@ | |||
258 | # define QT_QWS_NO_SHM | 260 | # define QT_QWS_NO_SHM |
259 | # define QT_NO_QWS_MULTIPROCESS | 261 | # define QT_NO_QWS_MULTIPROCESS |
260 | # define QT_NO_SQL | 262 | # define QT_NO_SQL |
261 | # define QT_NO_QWS_CURSOR | 263 | # define QT_NO_QWS_CURSOR |
262 | # endif | 264 | # endif |
263 | 265 | ||
264 | #elif defined(__GNUC__) | 266 | #elif defined(__GNUC__) |
265 | # define Q_CC_GNU | 267 | # define Q_CC_GNU |
266 | # define Q_C_CALLBACKS | 268 | # define Q_C_CALLBACKS |
267 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 | 269 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 |
268 | # define Q_FULL_TEMPLATE_INSTANTIATION | 270 | # define Q_FULL_TEMPLATE_INSTANTIATION |
269 | # endif | 271 | # endif |
270 | /* GCC 2.95 knows "using" but does not support it correctly */ | 272 | /* GCC 2.95 knows "using" but does not support it correctly */ |
271 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 | 273 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 |
272 | # define Q_NO_USING_KEYWORD | 274 | # define Q_NO_USING_KEYWORD |
273 | # endif | 275 | # endif |
276 | /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ | ||
277 | # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 | ||
278 | # define Q_WRONG_SB_CTYPE_MACROS | ||
279 | # endif | ||
274 | # if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP) | 280 | # if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP) |
275 | # define Q_PACKED __attribute__ ((packed)) | 281 | # define Q_PACKED __attribute__ ((packed)) |
276 | # endif | 282 | # endif |
277 | # if !defined(__EXCEPTIONS) | 283 | # if !defined(__EXCEPTIONS) |
278 | # define Q_NO_EXCEPTIONS | 284 | # define Q_NO_EXCEPTIONS |
279 | # endif | 285 | # endif |
280 | 286 | ||
281 | /* IBM compiler versions are a bit messy. There are actually two products: | 287 | /* IBM compiler versions are a bit messy. There are actually two products: |
282 | the C product, and the C++ product. The C++ compiler is always packaged | 288 | the C product, and the C++ product. The C++ compiler is always packaged |
283 | with the latest version of the C compiler. Version numbers do not always | 289 | with the latest version of the C compiler. Version numbers do not always |
284 | match. This little table (I'm not sure it's accurate) should be helpful: | 290 | match. This little table (I'm not sure it's accurate) should be helpful: |
285 | 291 | ||
286 | C++ product C product | 292 | C++ product C product |
287 | 293 | ||
288 | C Set 3.1 C Compiler 3.0 | 294 | C Set 3.1 C Compiler 3.0 |
289 | ... ... | 295 | ... ... |
@@ -377,96 +383,113 @@ | |||
377 | # endif | 383 | # endif |
378 | 384 | ||
379 | /* The Portland Group compiler is based on EDG and does define __EDG__ */ | 385 | /* The Portland Group compiler is based on EDG and does define __EDG__ */ |
380 | # elif defined(__PGI) | 386 | # elif defined(__PGI) |
381 | # define Q_CC_PGI | 387 | # define Q_CC_PGI |
382 | # if !defined(__EXCEPTIONS) | 388 | # if !defined(__EXCEPTIONS) |
383 | # define Q_NO_EXCEPTIONS | 389 | # define Q_NO_EXCEPTIONS |
384 | # endif | 390 | # endif |
385 | 391 | ||
386 | /* Never tested! */ | 392 | /* Never tested! */ |
387 | # elif defined(__ghs) | 393 | # elif defined(__ghs) |
388 | # define Q_CC_GHS | 394 | # define Q_CC_GHS |
389 | 395 | ||
390 | /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ | 396 | /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ |
391 | # elif defined(__USLC__) && defined(__SCO_VERSION__) | 397 | # elif defined(__USLC__) && defined(__SCO_VERSION__) |
392 | # define Q_CC_USLC | 398 | # define Q_CC_USLC |
399 | /* The latest UDK 7.1.1b does not need this, but previous versions do */ | ||
400 | # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) | ||
401 | # define Q_INLINE_TEMPLATES inline | ||
402 | # endif | ||
393 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 403 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
394 | 404 | ||
395 | /* Never tested! */ | 405 | /* Never tested! */ |
396 | # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) | 406 | # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) |
397 | # define Q_CC_OC | 407 | # define Q_CC_OC |
398 | # define Q_NO_USING_KEYWORD | 408 | # define Q_NO_USING_KEYWORD |
399 | 409 | ||
400 | /* CDS++ is not documented to define __EDG__ or __EDG in the Reliant | 410 | /* CDS++ defines __EDG__ although this is not documented in the Reliant |
401 | documentation but we suppose it does, in any case it does follow | 411 | documentation. It also follows conventions like _BOOL and this documented */ |
402 | conventions like _BOOL */ | ||
403 | # elif defined(sinix) | 412 | # elif defined(sinix) |
404 | # define Q_CC_CDS | 413 | # define Q_CC_CDS |
405 | # define Q_NO_USING_KEYWORD | 414 | # define Q_NO_USING_KEYWORD |
406 | # if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */ | 415 | # if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */ |
407 | # define Q_NO_EXCEPTIONS | 416 | # define Q_NO_EXCEPTIONS |
408 | # endif | 417 | # endif |
409 | 418 | ||
410 | /* The MIPSpro compiler in o32 mode is based on EDG but disables features | 419 | /* The MIPSpro compiler in o32 mode is based on EDG but disables features |
411 | such as template specialization nevertheless */ | 420 | such as template specialization nevertheless */ |
412 | # elif defined(__sgi) | 421 | # elif defined(__sgi) |
413 | # define Q_CC_MIPS | 422 | # define Q_CC_MIPS |
414 | # if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */ | 423 | # if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */ |
415 | # define Q_TYPENAME | 424 | # define Q_TYPENAME |
416 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION | 425 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
417 | # define Q_STRICT_INLINING_RULES | 426 | # define Q_STRICT_INLINING_RULES |
427 | # define Q_NO_EXPLICIT_KEYWORD | ||
428 | # define Q_INLINE_TEMPLATES inline | ||
418 | # elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */ | 429 | # elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */ |
419 | # define Q_TYPENAME | 430 | # define Q_TYPENAME |
420 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION | 431 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
421 | # endif | 432 | # endif |
422 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 433 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
423 | # endif | 434 | # endif |
424 | 435 | ||
425 | /* The older UnixWare 2.X compiler? */ | 436 | /* The older UnixWare 2.X compiler? */ |
426 | #elif defined(__USLC__) && !defined(__SCO_VERSION__) | 437 | #elif defined(__USLC__) |
427 | # define Q_CC_USLC | 438 | # define Q_CC_USLC |
439 | # define Q_TYPENAME | ||
428 | # define Q_NO_BOOL_TYPE | 440 | # define Q_NO_BOOL_TYPE |
429 | # define Q_NO_EXPLICIT_KEYWORD | 441 | # define Q_NO_EXPLICIT_KEYWORD |
430 | # define Q_NO_USING_KEYWORD | 442 | # define Q_NO_USING_KEYWORD |
443 | # define Q_INLINE_TEMPLATES inline | ||
431 | 444 | ||
432 | /* Never tested! */ | 445 | /* Never tested! */ |
433 | #elif defined(__HIGHC__) | 446 | #elif defined(__HIGHC__) |
434 | # define Q_CC_HIGHC | 447 | # define Q_CC_HIGHC |
435 | 448 | ||
436 | #elif defined(__SUNPRO_CC) | 449 | #elif defined(__SUNPRO_CC) |
437 | # define Q_CC_SUN | 450 | # define Q_CC_SUN |
438 | /* 5.0 compiler or better | 451 | /* 5.0 compiler or better |
439 | 'bool' is enabled by default but can be disabled using -features=nobool | 452 | 'bool' is enabled by default but can be disabled using -features=nobool |
440 | in which case _BOOL is not defined | 453 | in which case _BOOL is not defined |
441 | this is the default in 4.2 compatibility mode triggered by -compat=4 */ | 454 | this is the default in 4.2 compatibility mode triggered by -compat=4 */ |
442 | # if __SUNPRO_CC >= 0x500 | 455 | # if __SUNPRO_CC >= 0x500 |
443 | # if !defined(_BOOL) | 456 | # if !defined(_BOOL) |
444 | # define Q_NO_BOOL_TYPE | 457 | # define Q_NO_BOOL_TYPE |
445 | # endif | 458 | # endif |
446 | # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) | 459 | # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) |
447 | # define Q_NO_USING_KEYWORD | 460 | # define Q_NO_USING_KEYWORD |
448 | # endif | 461 | # endif |
449 | # define Q_C_CALLBACKS | 462 | # define Q_C_CALLBACKS |
450 | /* 4.2 compiler or older */ | 463 | /* 4.2 compiler or older */ |
451 | # else | 464 | # else |
452 | # define Q_NO_BOOL_TYPE | 465 | # define Q_NO_BOOL_TYPE |
453 | # define Q_NO_EXPLICIT_KEYWORD | 466 | # define Q_NO_EXPLICIT_KEYWORD |
454 | # define Q_NO_USING_KEYWORD | 467 | # define Q_NO_USING_KEYWORD |
455 | # endif | 468 | # endif |
456 | 469 | ||
470 | /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant | ||
471 | documentation but nevertheless uses EDG conventions like _BOOL */ | ||
472 | #elif defined(sinix) | ||
473 | # define Q_CC_EDG | ||
474 | # define Q_CC_CDS | ||
475 | # if !defined(_BOOL) | ||
476 | # define Q_NO_BOOL_TYPE | ||
477 | # endif | ||
478 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION | ||
479 | |||
457 | #elif defined(Q_OS_HPUX) | 480 | #elif defined(Q_OS_HPUX) |
458 | /* __HP_aCC was not defined in first aCC releases */ | 481 | /* __HP_aCC was not defined in first aCC releases */ |
459 | # if defined(__HP_aCC) || __cplusplus >= 199707L | 482 | # if defined(__HP_aCC) || __cplusplus >= 199707L |
460 | # define Q_CC_HPACC | 483 | # define Q_CC_HPACC |
461 | # else | 484 | # else |
462 | # define Q_CC_HP | 485 | # define Q_CC_HP |
463 | # define Q_NO_BOOL_TYPE | 486 | # define Q_NO_BOOL_TYPE |
464 | # define Q_FULL_TEMPLATE_INSTANTIATION | 487 | # define Q_FULL_TEMPLATE_INSTANTIATION |
465 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION | 488 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
466 | # define Q_NO_EXPLICIT_KEYWORD | 489 | # define Q_NO_EXPLICIT_KEYWORD |
467 | # endif | 490 | # endif |
468 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ | 491 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
469 | 492 | ||
470 | #else | 493 | #else |
471 | # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" | 494 | # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" |
472 | #endif | 495 | #endif |
@@ -493,32 +516,33 @@ | |||
493 | #elif defined(Q_OS_MSDOS) | 516 | #elif defined(Q_OS_MSDOS) |
494 | # define Q_WS_WIN16 | 517 | # define Q_WS_WIN16 |
495 | # error "Qt requires Win32 and does not work with Windows 3.x" | 518 | # error "Qt requires Win32 and does not work with Windows 3.x" |
496 | #elif defined(_WIN32_X11_) | 519 | #elif defined(_WIN32_X11_) |
497 | # define Q_WS_X11 | 520 | # define Q_WS_X11 |
498 | #elif defined(Q_OS_WIN32) | 521 | #elif defined(Q_OS_WIN32) |
499 | # define Q_WS_WIN32 | 522 | # define Q_WS_WIN32 |
500 | # if defined(Q_OS_WIN64) | 523 | # if defined(Q_OS_WIN64) |
501 | # define Q_WS_WIN64 | 524 | # define Q_WS_WIN64 |
502 | # endif | 525 | # endif |
503 | #elif defined(Q_OS_OS2) | 526 | #elif defined(Q_OS_OS2) |
504 | # define Q_WS_PM | 527 | # define Q_WS_PM |
505 | # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" | 528 | # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" |
506 | #elif defined(Q_OS_UNIX) | 529 | #elif defined(Q_OS_UNIX) |
507 | # if defined(QWS) | 530 | # if defined(QWS) |
508 | # define Q_WS_QWS | 531 | # define Q_WS_QWS |
532 | # define QT_NO_QWS_IM | ||
509 | # elif defined(Q_OS_MACX) | 533 | # elif defined(Q_OS_MACX) |
510 | # define Q_WS_MACX | 534 | # define Q_WS_MACX |
511 | # else | 535 | # else |
512 | # define Q_WS_X11 | 536 | # define Q_WS_X11 |
513 | # endif | 537 | # endif |
514 | #endif | 538 | #endif |
515 | #if defined(Q_OS_MAC) && !defined(QMAC_PASCAL) | 539 | #if defined(Q_OS_MAC) && !defined(QMAC_PASCAL) |
516 | # define QMAC_PASCAL | 540 | # define QMAC_PASCAL |
517 | #endif | 541 | #endif |
518 | 542 | ||
519 | #if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) | 543 | #if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) |
520 | # define Q_WS_WIN | 544 | # define Q_WS_WIN |
521 | #endif | 545 | #endif |
522 | 546 | ||
523 | #if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11) | 547 | #if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11) |
524 | # define Q_WS_MAC | 548 | # define Q_WS_MAC |
@@ -732,91 +756,109 @@ class QDataStream; | |||
732 | # ifndef QMAC_NO_QUARTZ | 756 | # ifndef QMAC_NO_QUARTZ |
733 | # define QMAC_NO_QUARTZ | 757 | # define QMAC_NO_QUARTZ |
734 | # endif | 758 | # endif |
735 | # ifndef QMAC_QMENUBAR_NO_EVENT | 759 | # ifndef QMAC_QMENUBAR_NO_EVENT |
736 | # define QMAC_QMENUBAR_NO_EVENT | 760 | # define QMAC_QMENUBAR_NO_EVENT |
737 | # endif | 761 | # endif |
738 | #endif | 762 | #endif |
739 | #if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks | 763 | #if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks |
740 | # ifndef QMAC_NO_QUARTZ | 764 | # ifndef QMAC_NO_QUARTZ |
741 | # define QMAC_NO_QUARTZ | 765 | # define QMAC_NO_QUARTZ |
742 | # endif | 766 | # endif |
743 | # ifndef QMAC_QMENUBAR_NO_EVENT | 767 | # ifndef QMAC_QMENUBAR_NO_EVENT |
744 | # define QMAC_QMENUBAR_NO_EVENT | 768 | # define QMAC_QMENUBAR_NO_EVENT |
745 | # endif | 769 | # endif |
746 | #endif | 770 | #endif |
747 | 771 | ||
772 | #if !defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
773 | # define QT_NO_COP | ||
774 | #endif | ||
775 | |||
748 | #ifndef QT_H | 776 | #ifndef QT_H |
749 | #include <qfeatures.h> | 777 | #include <qfeatures.h> |
750 | #endif // QT_H | 778 | #endif // QT_H |
751 | 779 | ||
752 | 780 | ||
753 | // | 781 | // |
754 | // Create Qt DLL if QT_DLL is defined (Windows only) | 782 | // Create Qt DLL if QT_DLL is defined (Windows only) |
783 | // or QT_SHARED is defined (Kylix only) | ||
755 | // | 784 | // |
756 | 785 | ||
757 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) | 786 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) |
758 | # if defined(QT_NODLL) | 787 | # if defined(QT_NODLL) |
759 | # undef QT_MAKEDLL | 788 | # undef QT_MAKEDLL |
760 | # undef QT_DLL | 789 | # undef QT_DLL |
761 | # elif defined(QT_MAKEDLL)/* create a Qt DLL library */ | 790 | # elif defined(QT_MAKEDLL)/* create a Qt DLL library */ |
762 | # if defined(QT_DLL) | 791 | # if defined(QT_DLL) |
763 | # undef QT_DLL | 792 | # undef QT_DLL |
764 | # endif | 793 | # endif |
765 | # define Q_EXPORT __declspec(dllexport) | 794 | # define Q_EXPORT __declspec(dllexport) |
766 | # define Q_TEMPLATEDLL | 795 | # define Q_TEMPLATEDLL |
767 | # define Q_TEMPLATE_EXTERN | 796 | # define Q_TEMPLATE_EXTERN |
768 | # undef Q_DISABLE_COPY/* avoid unresolved externals */ | 797 | # undef Q_DISABLE_COPY/* avoid unresolved externals */ |
769 | # elif defined(QT_DLL) /* use a Qt DLL library */ | 798 | # elif defined(QT_DLL) /* use a Qt DLL library */ |
770 | # define Q_EXPORT __declspec(dllimport) | 799 | # define Q_EXPORT __declspec(dllimport) |
771 | # define Q_TEMPLATEDLL | 800 | # define Q_TEMPLATEDLL |
772 | # ifndef Q_TEMPLATE_EXTERN | 801 | # ifndef Q_TEMPLATE_EXTERN |
773 | # if defined(Q_CC_MSVC) | 802 | # if defined(Q_CC_MSVC_NET) |
774 | # define Q_TEMPLATE_EXTERN /*extern*/ //### too many warnings, even though disabled | 803 | # define Q_TEMPLATE_EXTERN extern |
775 | # else | 804 | # else |
776 | # define Q_TEMPLATE_EXTERN | 805 | # define Q_TEMPLATE_EXTERN |
777 | # endif | 806 | # endif |
778 | # endif | 807 | # endif |
779 | # undef Q_DISABLE_COPY /* avoid unresolved externals */ | 808 | # undef Q_DISABLE_COPY/* avoid unresolved externals */ |
809 | # endif | ||
810 | #elif defined(Q_OS_LINUX) && defined(Q_CC_BOR) | ||
811 | # if defined(QT_SHARED)/* create a Qt shared library */ | ||
812 | # define Q_EXPORT __declspec(dllexport) | ||
813 | # define Q_TEMPLATEDLL | ||
814 | # define Q_TEMPLATE_EXTERN | ||
815 | # undef Q_DISABLE_COPY/* avoid unresolved externals */ | ||
816 | # else | ||
817 | # define Q_TEMPLATEDLL | ||
818 | # define Q_TEMPLATE_EXTERN | ||
819 | # undef Q_DISABLE_COPY /* avoid unresolved externals */ | ||
780 | # endif | 820 | # endif |
781 | #else | 821 | #else |
782 | # undef QT_MAKEDLL /* ignore these for other platforms */ | 822 | # undef QT_MAKEDLL /* ignore these for other platforms */ |
783 | # undef QT_DLL | 823 | # undef QT_DLL |
784 | #endif | 824 | #endif |
785 | 825 | ||
786 | #ifndef Q_EXPORT | 826 | #ifndef Q_EXPORT |
787 | # define Q_EXPORT | 827 | # define Q_EXPORT |
788 | #endif | 828 | #endif |
789 | 829 | ||
790 | 830 | ||
791 | // | 831 | // |
792 | // Some platform specific stuff | 832 | // Some platform specific stuff |
793 | // | 833 | // |
794 | 834 | ||
795 | #if defined(Q_WS_WIN) | 835 | #if defined(Q_WS_WIN) |
796 | extern Q_EXPORT bool qt_winunicode; | 836 | extern Q_EXPORT bool qt_winunicode; |
797 | #endif | 837 | #endif |
798 | 838 | ||
799 | 839 | ||
800 | // | 840 | // |
801 | // System information | 841 | // System information |
802 | // | 842 | // |
803 | 843 | ||
804 | Q_EXPORT const char *qVersion(); | 844 | Q_EXPORT const char *qVersion(); |
805 | Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian ); | 845 | Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian ); |
806 | #if defined(Q_WS_WIN) | 846 | #if defined(Q_OS_MAC) |
847 | int qMacVersion(); | ||
848 | #elif defined(Q_WS_WIN) | ||
807 | Q_EXPORT int qWinVersion(); | 849 | Q_EXPORT int qWinVersion(); |
808 | #if defined(UNICODE) | 850 | #if defined(UNICODE) |
809 | #define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi } | 851 | #define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi } |
810 | #define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi ) | 852 | #define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi ) |
811 | #else | 853 | #else |
812 | #define QT_WA( uni, ansi ) ansi | 854 | #define QT_WA( uni, ansi ) ansi |
813 | #define QT_WA_INLINE( uni, ansi ) ansi | 855 | #define QT_WA_INLINE( uni, ansi ) ansi |
814 | #endif | 856 | #endif |
815 | #endif | 857 | #endif |
816 | 858 | ||
817 | #ifdef Q_OS_TEMP | 859 | #ifdef Q_OS_TEMP |
818 | #ifdef QT_WA | 860 | #ifdef QT_WA |
819 | #undef QT_WA | 861 | #undef QT_WA |
820 | #undef QT_WA_INLINE | 862 | #undef QT_WA_INLINE |
821 | #endif | 863 | #endif |
822 | #define QT_WA( uni, ansi ) uni | 864 | #define QT_WA( uni, ansi ) uni |
@@ -956,51 +998,68 @@ Q_EXPORT void qObsolete( const char *message ); | |||
956 | 998 | ||
957 | 999 | ||
958 | // | 1000 | // |
959 | // Install paths from configure | 1001 | // Install paths from configure |
960 | // | 1002 | // |
961 | 1003 | ||
962 | Q_EXPORT const char *qInstallPath(); | 1004 | Q_EXPORT const char *qInstallPath(); |
963 | Q_EXPORT const char *qInstallPathDocs(); | 1005 | Q_EXPORT const char *qInstallPathDocs(); |
964 | Q_EXPORT const char *qInstallPathHeaders(); | 1006 | Q_EXPORT const char *qInstallPathHeaders(); |
965 | Q_EXPORT const char *qInstallPathLibs(); | 1007 | Q_EXPORT const char *qInstallPathLibs(); |
966 | Q_EXPORT const char *qInstallPathBins(); | 1008 | Q_EXPORT const char *qInstallPathBins(); |
967 | Q_EXPORT const char *qInstallPathPlugins(); | 1009 | Q_EXPORT const char *qInstallPathPlugins(); |
968 | Q_EXPORT const char *qInstallPathData(); | 1010 | Q_EXPORT const char *qInstallPathData(); |
969 | 1011 | ||
970 | #endif // __cplusplus | 1012 | #endif // __cplusplus |
971 | 1013 | ||
1014 | // compilers which follow outdated template instantiation rules | ||
1015 | // require a class to have a comparison operator to exist when | ||
1016 | // a QValueList of this type is instantiated. It's not actually | ||
1017 | // used in the list, though. Hence the dummy implementation. | ||
1018 | // Just in case other code relies on it we better trigger a warning | ||
1019 | // mandating a real implementation. | ||
1020 | #ifdef Q_FULL_TEMPLATE_INSTANTIATION | ||
1021 | # define Q_DUMMY_COMPARISON_OPERATOR(C) \ | ||
1022 | bool operator==( const C& ) const { \ | ||
1023 | qWarning( #C"::operator==( const "#C"& ) got called." ); \ | ||
1024 | return FALSE; \ | ||
1025 | } | ||
1026 | #else | ||
1027 | # define Q_DUMMY_COMPARISON_OPERATOR(C) | ||
1028 | #endif | ||
1029 | |||
972 | #endif // QGLOBAL_H | 1030 | #endif // QGLOBAL_H |
973 | 1031 | ||
974 | // | 1032 | // |
975 | // Avoid some particularly useless warnings from some stupid compilers. | 1033 | // Avoid some particularly useless warnings from some stupid compilers. |
976 | // To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out | 1034 | // To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out |
977 | // the line "#define QT_NO_WARNINGS" | 1035 | // the line "#define QT_NO_WARNINGS" |
978 | // | 1036 | // |
979 | 1037 | ||
980 | #if !defined(QT_CC_WARNINGS) | 1038 | #if !defined(QT_CC_WARNINGS) |
981 | # define QT_NO_WARNINGS | 1039 | # define QT_NO_WARNINGS |
982 | #endif | 1040 | #endif |
983 | #if defined(QT_NO_WARNINGS) | 1041 | #if defined(QT_NO_WARNINGS) |
984 | # if defined(Q_CC_MSVC) | 1042 | # if defined(Q_CC_MSVC) |
985 | # pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data | 1043 | # pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
986 | # pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' | 1044 | # pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' |
987 | # pragma warning(disable: 4514) // unreferenced inline/local function has been removed | 1045 | # pragma warning(disable: 4514) // unreferenced inline/local function has been removed |
988 | # pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning) | 1046 | # pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning) |
989 | # pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2' | 1047 | # pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2' |
990 | # pragma warning(disable: 4706) // assignment within conditional expression | 1048 | # pragma warning(disable: 4706) // assignment within conditional expression |
991 | # pragma warning(disable: 4786) // truncating debug info after 255 characters | 1049 | # pragma warning(disable: 4786) // truncating debug info after 255 characters |
992 | # pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated | 1050 | # pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated |
993 | # pragma warning(disable: 4355) // 'this' : used in base member initializer list | 1051 | # pragma warning(disable: 4355) // 'this' : used in base member initializer list |
994 | # pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation | 1052 | # pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation |
1053 | # pragma warning(disable: 4710) // function not inlined | ||
995 | # elif defined(Q_CC_BOR) | 1054 | # elif defined(Q_CC_BOR) |
996 | # pragma option -w-inl | 1055 | # pragma option -w-inl |
997 | # pragma option -w-aus | 1056 | # pragma option -w-aus |
998 | # pragma warn -inl | 1057 | # pragma warn -inl |
999 | # pragma warn -pia | 1058 | # pragma warn -pia |
1000 | # pragma warn -ccc | 1059 | # pragma warn -ccc |
1001 | # pragma warn -rch | 1060 | # pragma warn -rch |
1002 | # pragma warn -sig | 1061 | # pragma warn -sig |
1003 | # elif defined(Q_CC_MWERKS) | 1062 | # elif defined(Q_CC_MWERKS) |
1004 | # pragma warn_possunwant off | 1063 | # pragma warn_possunwant off |
1005 | # endif | 1064 | # endif |
1006 | #endif | 1065 | #endif |
diff --git a/qmake/include/qintdict.h b/qmake/include/qintdict.h index b4cb223..0299879 100644 --- a/qmake/include/qintdict.h +++ b/qmake/include/qintdict.h | |||
@@ -98,17 +98,21 @@ template<class type> | |||
98 | class QIntDictIterator : public QGDictIterator | 98 | class QIntDictIterator : public QGDictIterator |
99 | { | 99 | { |
100 | public: | 100 | public: |
101 | QIntDictIterator(const QIntDict<type> &d) :QGDictIterator((QGDict &)d) {} | 101 | QIntDictIterator(const QIntDict<type> &d) :QGDictIterator((QGDict &)d) {} |
102 | ~QIntDictIterator() {} | 102 | ~QIntDictIterator() {} |
103 | uint count() const { return dict->count(); } | 103 | uint count() const { return dict->count(); } |
104 | bool isEmpty() const { return dict->count() == 0; } | 104 | bool isEmpty() const { return dict->count() == 0; } |
105 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } | 105 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } |
106 | operator type *() const { return (type *)QGDictIterator::get(); } | 106 | operator type *() const { return (type *)QGDictIterator::get(); } |
107 | type *current() const { return (type *)QGDictIterator::get(); } | 107 | type *current() const { return (type *)QGDictIterator::get(); } |
108 | long currentKey() const { return QGDictIterator::getKeyInt(); } | 108 | long currentKey() const { return QGDictIterator::getKeyInt(); } |
109 | type *operator()() { return (type *)QGDictIterator::operator()(); } | 109 | type *operator()() { return (type *)QGDictIterator::operator()(); } |
110 | type *operator++() { return (type *)QGDictIterator::operator++(); } | 110 | type *operator++() { return (type *)QGDictIterator::operator++(); } |
111 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} | 111 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} |
112 | }; | 112 | }; |
113 | 113 | ||
114 | #ifdef QT_QWINEXPORT | ||
115 | #define Q_DEFINED_QINTDICT | ||
116 | #include "qwinexport.h" | ||
117 | #endif /* QT_QWINEXPORT */ | ||
114 | #endif // QINTDICT_H | 118 | #endif // QINTDICT_H |
diff --git a/qmake/include/qmap.h b/qmake/include/qmap.h index 269bd6b..4bc0a2f 100644 --- a/qmake/include/qmap.h +++ b/qmake/include/qmap.h | |||
@@ -867,17 +867,21 @@ Q_INLINE_TEMPLATES QDataStream& operator>>( QDataStream& s, QMap<Key,T>& m ) { | |||
867 | break; | 867 | break; |
868 | } | 868 | } |
869 | return s; | 869 | return s; |
870 | } | 870 | } |
871 | 871 | ||
872 | 872 | ||
873 | template<class Key, class T> | 873 | template<class Key, class T> |
874 | Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QMap<Key,T>& m ) { | 874 | Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QMap<Key,T>& m ) { |
875 | s << (Q_UINT32)m.size(); | 875 | s << (Q_UINT32)m.size(); |
876 | QMapConstIterator<Key,T> it = m.begin(); | 876 | QMapConstIterator<Key,T> it = m.begin(); |
877 | for( ; it != m.end(); ++it ) | 877 | for( ; it != m.end(); ++it ) |
878 | s << it.key() << it.data(); | 878 | s << it.key() << it.data(); |
879 | return s; | 879 | return s; |
880 | } | 880 | } |
881 | #endif | 881 | #endif |
882 | 882 | ||
883 | #ifdef QT_QWINEXPORT | ||
884 | #define Q_DEFINED_QMAP | ||
885 | #include "qwinexport.h" | ||
886 | #endif /* QT_QWINEXPORT */ | ||
883 | #endif // QMAP_H | 887 | #endif // QMAP_H |
diff --git a/qmake/include/qmemarray.h b/qmake/include/qmemarray.h index a5baf99..267670d 100644 --- a/qmake/include/qmemarray.h +++ b/qmake/include/qmemarray.h | |||
@@ -30,57 +30,58 @@ | |||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QMEMARRAY_H | 38 | #ifndef QMEMARRAY_H |
39 | #define QMEMARRAY_H | 39 | #define QMEMARRAY_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qgarray.h" | 42 | #include "qgarray.h" |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | 45 | ||
46 | template<class type> | 46 | template<class type> |
47 | class QMemArray : public QGArray | 47 | class QMemArray : public QGArray |
48 | { | 48 | { |
49 | public: | 49 | public: |
50 | typedef type* Iterator; | 50 | typedef type* Iterator; |
51 | typedef const type* ConstIterator; | 51 | typedef const type* ConstIterator; |
52 | typedef type ValueType; | 52 | typedef type ValueType; |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | QMemArray( int, int ) : QGArray( 0, 0 ) {} | 55 | QMemArray( int, int ) : QGArray( 0, 0 ) {} |
56 | 56 | ||
57 | public: | 57 | public: |
58 | QMemArray() {} | 58 | QMemArray() {} |
59 | QMemArray( int size ) : QGArray(size*sizeof(type)) {} | 59 | QMemArray( int size ) : QGArray(size*sizeof(type)) {} |
60 | QMemArray( const QMemArray<type> &a ) : QGArray(a) {} | 60 | QMemArray( const QMemArray<type> &a ) : QGArray(a) {} |
61 | ~QMemArray() {} | 61 | ~QMemArray() {} |
62 | QMemArray<type> &operator=(const QMemArray<type> &a) | 62 | QMemArray<type> &operator=(const QMemArray<type> &a) |
63 | { return (QMemArray<type>&)QGArray::assign(a); } | 63 | { return (QMemArray<type>&)QGArray::assign(a); } |
64 | type *data() const{ return (type *)QGArray::data(); } | 64 | type *data() const{ return (type *)QGArray::data(); } |
65 | uint nrefs() const{ return QGArray::nrefs(); } | 65 | uint nrefs() const{ return QGArray::nrefs(); } |
66 | uint size() const{ return QGArray::size()/sizeof(type); } | 66 | uint size() const{ return QGArray::size()/sizeof(type); } |
67 | uint count() const{ return size(); } | 67 | uint count() const{ return size(); } |
68 | bool isEmpty() const{ return QGArray::size() == 0; } | 68 | bool isEmpty() const{ return QGArray::size() == 0; } |
69 | bool isNull() const{ return QGArray::data() == 0; } | 69 | bool isNull() const{ return QGArray::data() == 0; } |
70 | bool resize( uint size ){ return QGArray::resize(size*sizeof(type)); } | 70 | bool resize( uint size ){ return QGArray::resize(size*sizeof(type)); } |
71 | bool resize( uint size, Optimization optim ) { return QGArray::resize(size*sizeof(type), optim); } | ||
71 | bool truncate( uint pos ){ return QGArray::resize(pos*sizeof(type)); } | 72 | bool truncate( uint pos ){ return QGArray::resize(pos*sizeof(type)); } |
72 | bool fill( const type &d, int size = -1 ) | 73 | bool fill( const type &d, int size = -1 ) |
73 | { return QGArray::fill((char*)&d,size,sizeof(type) ); } | 74 | { return QGArray::fill((char*)&d,size,sizeof(type) ); } |
74 | void detach() { QGArray::detach(); } | 75 | void detach() { QGArray::detach(); } |
75 | QMemArray<type> copy() const | 76 | QMemArray<type> copy() const |
76 | { QMemArray<type> tmp; return tmp.duplicate(*this); } | 77 | { QMemArray<type> tmp; return tmp.duplicate(*this); } |
77 | QMemArray<type>& assign( const QMemArray<type>& a ) | 78 | QMemArray<type>& assign( const QMemArray<type>& a ) |
78 | { return (QMemArray<type>&)QGArray::assign(a); } | 79 | { return (QMemArray<type>&)QGArray::assign(a); } |
79 | QMemArray<type>& assign( const type *a, uint n ) | 80 | QMemArray<type>& assign( const type *a, uint n ) |
80 | { return (QMemArray<type>&)QGArray::assign((char*)a,n*sizeof(type)); } | 81 | { return (QMemArray<type>&)QGArray::assign((char*)a,n*sizeof(type)); } |
81 | QMemArray<type>& duplicate( const QMemArray<type>& a ) | 82 | QMemArray<type>& duplicate( const QMemArray<type>& a ) |
82 | { return (QMemArray<type>&)QGArray::duplicate(a); } | 83 | { return (QMemArray<type>&)QGArray::duplicate(a); } |
83 | QMemArray<type>& duplicate( const type *a, uint n ) | 84 | QMemArray<type>& duplicate( const type *a, uint n ) |
84 | { return (QMemArray<type>&)QGArray::duplicate((char*)a,n*sizeof(type)); } | 85 | { return (QMemArray<type>&)QGArray::duplicate((char*)a,n*sizeof(type)); } |
85 | QMemArray<type>& setRawData( const type *a, uint n ) | 86 | QMemArray<type>& setRawData( const type *a, uint n ) |
86 | { return (QMemArray<type>&)QGArray::setRawData((char*)a, | 87 | { return (QMemArray<type>&)QGArray::setRawData((char*)a, |
@@ -95,28 +96,34 @@ public: | |||
95 | int bsearch( const type &d ) const | 96 | int bsearch( const type &d ) const |
96 | { return QGArray::bsearch((const char*)&d,sizeof(type)); } | 97 | { return QGArray::bsearch((const char*)&d,sizeof(type)); } |
97 | // ### Qt 4.0: maybe provide uint overload as work-around for MSVC bug | 98 | // ### Qt 4.0: maybe provide uint overload as work-around for MSVC bug |
98 | type& operator[]( int i ) const | 99 | type& operator[]( int i ) const |
99 | { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } | 100 | { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } |
100 | type& at( uint i ) const | 101 | type& at( uint i ) const |
101 | { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } | 102 | { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } |
102 | operator const type*() const { return (const type *)QGArray::data(); } | 103 | operator const type*() const { return (const type *)QGArray::data(); } |
103 | bool operator==( const QMemArray<type> &a ) const { return isEqual(a); } | 104 | bool operator==( const QMemArray<type> &a ) const { return isEqual(a); } |
104 | bool operator!=( const QMemArray<type> &a ) const { return !isEqual(a); } | 105 | bool operator!=( const QMemArray<type> &a ) const { return !isEqual(a); } |
105 | Iterator begin() { return data(); } | 106 | Iterator begin() { return data(); } |
106 | Iterator end() { return data() + size(); } | 107 | Iterator end() { return data() + size(); } |
107 | ConstIterator begin() const { return data(); } | 108 | ConstIterator begin() const { return data(); } |
108 | ConstIterator end() const { return data() + size(); } | 109 | ConstIterator end() const { return data() + size(); } |
109 | }; | 110 | }; |
110 | 111 | ||
112 | #ifndef QT_QWINEXPORT | ||
111 | #if defined(Q_TEMPLATEDLL) | 113 | #if defined(Q_TEMPLATEDLL) |
112 | // MOC_SKIP_BEGIN | 114 | // MOC_SKIP_BEGIN |
113 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<int>; | 115 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<int>; |
114 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<bool>; | 116 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<bool>; |
115 | // MOC_SKIP_END | 117 | // MOC_SKIP_END |
116 | #endif | 118 | #endif |
119 | #endif /* QT_QWINEXPORT */ | ||
117 | 120 | ||
118 | #ifndef QT_NO_COMPAT | 121 | #ifndef QT_NO_COMPAT |
119 | #define QArray QMemArray | 122 | #define QArray QMemArray |
120 | #endif | 123 | #endif |
121 | 124 | ||
125 | #ifdef QT_QWINEXPORT | ||
126 | #define Q_DEFINED_QMEMARRAY | ||
127 | #include <qwinexport.h> | ||
128 | #endif /* QT_QWINEXPORT */ | ||
122 | #endif // QARRAY_H | 129 | #endif // QARRAY_H |
diff --git a/qmake/include/qptrlist.h b/qmake/include/qptrlist.h index 53fb605..17b5ee9 100644 --- a/qmake/include/qptrlist.h +++ b/qmake/include/qptrlist.h | |||
@@ -1,23 +1,21 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QPtrList template/macro class | 4 | ** Definition of QPtrList template/macro class |
5 | ** | 5 | ** |
6 | ** Created : | ||
7 | ** | ||
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 8 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
@@ -144,17 +142,21 @@ public: | |||
144 | 142 | ||
145 | type *current() const { return (type *)QGListIterator::get(); } | 143 | type *current() const { return (type *)QGListIterator::get(); } |
146 | type *operator()() { return (type *)QGListIterator::operator()();} | 144 | type *operator()() { return (type *)QGListIterator::operator()();} |
147 | type *operator++() { return (type *)QGListIterator::operator++(); } | 145 | type *operator++() { return (type *)QGListIterator::operator++(); } |
148 | type *operator+=(uint j) { return (type *)QGListIterator::operator+=(j);} | 146 | type *operator+=(uint j) { return (type *)QGListIterator::operator+=(j);} |
149 | type *operator--() { return (type *)QGListIterator::operator--(); } | 147 | type *operator--() { return (type *)QGListIterator::operator--(); } |
150 | type *operator-=(uint j) { return (type *)QGListIterator::operator-=(j);} | 148 | type *operator-=(uint j) { return (type *)QGListIterator::operator-=(j);} |
151 | QPtrListIterator<type>& operator=(const QPtrListIterator<type>&it) | 149 | QPtrListIterator<type>& operator=(const QPtrListIterator<type>&it) |
152 | { QGListIterator::operator=(it); return *this; } | 150 | { QGListIterator::operator=(it); return *this; } |
153 | }; | 151 | }; |
154 | 152 | ||
155 | #ifndef QT_NO_COMPAT | 153 | #ifndef QT_NO_COMPAT |
156 | #define QList QPtrList | 154 | #define QList QPtrList |
157 | #define QListIterator QPtrListIterator | 155 | #define QListIterator QPtrListIterator |
158 | #endif | 156 | #endif |
159 | 157 | ||
158 | #ifdef QT_QWINEXPORT | ||
159 | #define Q_DEFINED_QPTRLIST | ||
160 | #include "qwinexport.h" | ||
161 | #endif /* QT_QWINEXPORT */ | ||
160 | #endif // QPTRLIST_H | 162 | #endif // QPTRLIST_H |
diff --git a/qmake/include/qptrvector.h b/qmake/include/qptrvector.h index f6d9623..49b40b7 100644 --- a/qmake/include/qptrvector.h +++ b/qmake/include/qptrvector.h | |||
@@ -97,17 +97,21 @@ private: | |||
97 | 97 | ||
98 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) | 98 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) |
99 | template<> inline void QPtrVector<void>::deleteItem( QPtrCollection::Item ) | 99 | template<> inline void QPtrVector<void>::deleteItem( QPtrCollection::Item ) |
100 | { | 100 | { |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | template<class type> inline void QPtrVector<type>::deleteItem( QPtrCollection::Item d ) | 104 | template<class type> inline void QPtrVector<type>::deleteItem( QPtrCollection::Item d ) |
105 | { | 105 | { |
106 | if ( del_item ) delete (type *)d; | 106 | if ( del_item ) delete (type *)d; |
107 | } | 107 | } |
108 | 108 | ||
109 | #ifndef QT_NO_COMPAT | 109 | #ifndef QT_NO_COMPAT |
110 | #define QVector QPtrVector | 110 | #define QVector QPtrVector |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #ifdef QT_QWINEXPORT | ||
114 | #define Q_DEFINED_QPTRVECTOR | ||
115 | #include "qwinexport.h" | ||
116 | #endif /* QT_QWINEXPORT */ | ||
113 | #endif // QVECTOR_H | 117 | #endif // QVECTOR_H |
diff --git a/qmake/include/qregexp.h b/qmake/include/qregexp.h index 7bb777a..90f54bd 100644 --- a/qmake/include/qregexp.h +++ b/qmake/include/qregexp.h | |||
@@ -67,33 +67,33 @@ public: | |||
67 | void setPattern( const QString& pattern ); | 67 | void setPattern( const QString& pattern ); |
68 | bool caseSensitive() const; | 68 | bool caseSensitive() const; |
69 | void setCaseSensitive( bool sensitive ); | 69 | void setCaseSensitive( bool sensitive ); |
70 | #ifndef QT_NO_REGEXP_WILDCARD | 70 | #ifndef QT_NO_REGEXP_WILDCARD |
71 | bool wildcard() const; | 71 | bool wildcard() const; |
72 | void setWildcard( bool wildcard ); | 72 | void setWildcard( bool wildcard ); |
73 | #endif | 73 | #endif |
74 | bool minimal() const; | 74 | bool minimal() const; |
75 | void setMinimal( bool minimal ); | 75 | void setMinimal( bool minimal ); |
76 | 76 | ||
77 | bool exactMatch( const QString& str ) const; | 77 | bool exactMatch( const QString& str ) const; |
78 | #ifndef QT_NO_COMPAT | 78 | #ifndef QT_NO_COMPAT |
79 | int match( const QString& str, int index = 0, int *len = 0, | 79 | int match( const QString& str, int index = 0, int *len = 0, |
80 | bool indexIsStart = TRUE ) const; | 80 | bool indexIsStart = TRUE ) const; |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #if defined(qdoc) | 83 | #if defined(Q_QDOC) |
84 | int search( const QString& str, int offset = 0, | 84 | int search( const QString& str, int offset = 0, |
85 | CaretMode caretMode = CaretAtZero ) const; | 85 | CaretMode caretMode = CaretAtZero ) const; |
86 | int searchRev( const QString& str, int offset = -1, | 86 | int searchRev( const QString& str, int offset = -1, |
87 | CaretMode caretMode = CaretAtZero ) const; | 87 | CaretMode caretMode = CaretAtZero ) const; |
88 | #else | 88 | #else |
89 | // ### Qt 4.0: reduce these four to two functions | 89 | // ### Qt 4.0: reduce these four to two functions |
90 | int search( const QString& str, int offset = 0 ) const; | 90 | int search( const QString& str, int offset = 0 ) const; |
91 | int search( const QString& str, int offset, CaretMode caretMode ) const; | 91 | int search( const QString& str, int offset, CaretMode caretMode ) const; |
92 | int searchRev( const QString& str, int offset = -1 ) const; | 92 | int searchRev( const QString& str, int offset = -1 ) const; |
93 | int searchRev( const QString& str, int offset, CaretMode caretMode ) const; | 93 | int searchRev( const QString& str, int offset, CaretMode caretMode ) const; |
94 | #endif | 94 | #endif |
95 | int matchedLength() const; | 95 | int matchedLength() const; |
96 | #ifndef QT_NO_REGEXP_CAPTURE | 96 | #ifndef QT_NO_REGEXP_CAPTURE |
97 | int numCaptures() const; | 97 | int numCaptures() const; |
98 | QStringList capturedTexts(); | 98 | QStringList capturedTexts(); |
99 | QString cap( int nth = 0 ); | 99 | QString cap( int nth = 0 ); |
diff --git a/qmake/include/qstring.h b/qmake/include/qstring.h index 2a87a5a..c1d6740 100644 --- a/qmake/include/qstring.h +++ b/qmake/include/qstring.h | |||
@@ -1,25 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of the QString class, and related Unicode | 4 | ** Definition of the QString class, and related Unicode functions. |
5 | ** functions. | ||
6 | ** | 5 | ** |
7 | ** Created : 920609 | 6 | ** Created : 920609 |
8 | ** | 7 | ** |
9 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
10 | ** | 9 | ** |
11 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
12 | ** | 11 | ** |
13 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
14 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
15 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
16 | ** | 15 | ** |
17 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
18 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
19 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
20 | ** packaging of this file. | 19 | ** packaging of this file. |
21 | ** | 20 | ** |
22 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
23 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
24 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
25 | ** | 24 | ** |
@@ -30,32 +29,39 @@ | |||
30 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
31 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
32 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
33 | ** | 32 | ** |
34 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
35 | ** not clear to you. | 34 | ** not clear to you. |
36 | ** | 35 | ** |
37 | **********************************************************************/ | 36 | **********************************************************************/ |
38 | 37 | ||
39 | #ifndef QSTRING_H | 38 | #ifndef QSTRING_H |
40 | #define QSTRING_H | 39 | #define QSTRING_H |
41 | 40 | ||
42 | #ifndef QT_H | 41 | #ifndef QT_H |
43 | #include "qcstring.h" | 42 | #include "qcstring.h" |
44 | #endif // QT_H | 43 | #endif // QT_H |
45 | 44 | ||
45 | #ifndef QT_NO_STL | ||
46 | #include <string> | ||
47 | #if defined(Q_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS) | ||
48 | #undef _SB_CTYPE_MACROS | ||
49 | #endif | ||
50 | #endif | ||
51 | |||
46 | 52 | ||
47 | /***************************************************************************** | 53 | /***************************************************************************** |
48 | QString class | 54 | QString class |
49 | *****************************************************************************/ | 55 | *****************************************************************************/ |
50 | 56 | ||
51 | class QRegExp; | 57 | class QRegExp; |
52 | class QString; | 58 | class QString; |
53 | class QCharRef; | 59 | class QCharRef; |
54 | template <class T> class QDeepCopy; | 60 | template <class T> class QDeepCopy; |
55 | 61 | ||
56 | class Q_EXPORT QChar { | 62 | class Q_EXPORT QChar { |
57 | public: | 63 | public: |
58 | QChar(); | 64 | QChar(); |
59 | QChar( char c ); | 65 | QChar( char c ); |
60 | QChar( uchar c ); | 66 | QChar( uchar c ); |
61 | QChar( uchar c, uchar r ); | 67 | QChar( uchar c, uchar r ); |
@@ -323,85 +329,89 @@ inline bool operator<=( QChar c1, QChar c2 ) | |||
323 | return c1.ucs <= c2.ucs; | 329 | return c1.ucs <= c2.ucs; |
324 | } | 330 | } |
325 | 331 | ||
326 | inline bool operator>=( QChar c, char ch ) { return ch <= c; } | 332 | inline bool operator>=( QChar c, char ch ) { return ch <= c; } |
327 | inline bool operator>=( char ch, QChar c ) { return c <= ch; } | 333 | inline bool operator>=( char ch, QChar c ) { return c <= ch; } |
328 | inline bool operator>=( QChar c1, QChar c2 ) { return c2 <= c1; } | 334 | inline bool operator>=( QChar c1, QChar c2 ) { return c2 <= c1; } |
329 | inline bool operator<( QChar c, char ch ) { return !(ch<=c); } | 335 | inline bool operator<( QChar c, char ch ) { return !(ch<=c); } |
330 | inline bool operator<( char ch, QChar c ) { return !(c<=ch); } | 336 | inline bool operator<( char ch, QChar c ) { return !(c<=ch); } |
331 | inline bool operator<( QChar c1, QChar c2 ) { return !(c2<=c1); } | 337 | inline bool operator<( QChar c1, QChar c2 ) { return !(c2<=c1); } |
332 | inline bool operator>( QChar c, char ch ) { return !(ch>=c); } | 338 | inline bool operator>( QChar c, char ch ) { return !(ch>=c); } |
333 | inline bool operator>( char ch, QChar c ) { return !(c>=ch); } | 339 | inline bool operator>( char ch, QChar c ) { return !(c>=ch); } |
334 | inline bool operator>( QChar c1, QChar c2 ) { return !(c2>=c1); } | 340 | inline bool operator>( QChar c1, QChar c2 ) { return !(c2>=c1); } |
335 | 341 | ||
336 | // internal | 342 | // internal |
337 | struct Q_EXPORT QStringData : public QShared { | 343 | struct Q_EXPORT QStringData : public QShared { |
338 | QStringData() : | 344 | QStringData() : |
339 | QShared(), unicode(0), ascii(0), len(0), simpletext(1), maxl(0), dirty(0) { ref(); } | 345 | QShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); } |
340 | QStringData(QChar *u, uint l, uint m) : | 346 | QStringData(QChar *u, uint l, uint m) : |
341 | QShared(), unicode(u), ascii(0), len(l), simpletext(1), maxl(m), dirty(1) { } | 347 | QShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { } |
342 | ~QStringData() { if ( unicode ) delete[] ((char*)unicode); | 348 | ~QStringData() { if ( unicode ) delete[] ((char*)unicode); |
343 | if ( ascii ) delete[] ascii; } | 349 | if ( ascii ) delete[] ascii; } |
344 | 350 | ||
345 | void deleteSelf(); | 351 | void deleteSelf(); |
346 | QChar *unicode; | 352 | QChar *unicode; |
347 | char *ascii; | 353 | char *ascii; |
348 | void setDirty() { | 354 | void setDirty() { |
349 | if ( ascii ) { | 355 | if ( ascii ) { |
350 | delete [] ascii; | 356 | delete [] ascii; |
351 | ascii = 0; | 357 | ascii = 0; |
352 | } | 358 | } |
353 | dirty = 1; | 359 | issimpletext = FALSE; |
354 | } | 360 | } |
355 | #ifdef Q_OS_MAC9 | 361 | #ifdef Q_OS_MAC9 |
356 | uint len; | 362 | uint len; |
357 | #else | 363 | #else |
358 | uint len : 30; | 364 | uint len : 30; |
359 | #endif | 365 | #endif |
360 | uint simpletext : 1; | 366 | uint issimpletext : 1; |
361 | #ifdef Q_OS_MAC9 | 367 | #ifdef Q_OS_MAC9 |
362 | uint maxl; | 368 | uint maxl; |
363 | #else | 369 | #else |
364 | uint maxl : 30; | 370 | uint maxl : 30; |
365 | #endif | 371 | #endif |
366 | uint dirty : 1; | 372 | uint islatin1 : 1; |
367 | 373 | ||
368 | private: | 374 | private: |
369 | #if defined(Q_DISABLE_COPY) | 375 | #if defined(Q_DISABLE_COPY) |
370 | QStringData( const QStringData& ); | 376 | QStringData( const QStringData& ); |
371 | QStringData& operator=( const QStringData& ); | 377 | QStringData& operator=( const QStringData& ); |
372 | #endif | 378 | #endif |
373 | }; | 379 | }; |
374 | 380 | ||
375 | 381 | ||
376 | class Q_EXPORT QString | 382 | class Q_EXPORT QString |
377 | { | 383 | { |
378 | public: | 384 | public: |
379 | QString(); // make null string | 385 | QString(); // make null string |
380 | QString( QChar ); // one-char string | 386 | QString( QChar ); // one-char string |
381 | QString( const QString & ); // impl-shared copy | 387 | QString( const QString & ); // impl-shared copy |
382 | QString( const QByteArray& ); // deep copy | 388 | QString( const QByteArray& ); // deep copy |
383 | QString( const QChar* unicode, uint length ); // deep copy | 389 | QString( const QChar* unicode, uint length ); // deep copy |
384 | #ifndef QT_NO_CAST_ASCII | 390 | #ifndef QT_NO_CAST_ASCII |
385 | QString( const char *str ); // deep copy | 391 | QString( const char *str ); // deep copy |
386 | #endif | 392 | #endif |
393 | #ifndef QT_NO_STL | ||
394 | QString( const std::string& ); // deep copy | ||
395 | #endif | ||
387 | ~QString(); | 396 | ~QString(); |
388 | 397 | ||
389 | QString &operator=( const QString & ); // impl-shared copy | 398 | QString &operator=( const QString & ); // impl-shared copy |
390 | #ifndef QT_NO_CAST_ASCII | ||
391 | QString &operator=( const char * ); // deep copy | 399 | QString &operator=( const char * ); // deep copy |
400 | #ifndef QT_NO_STL | ||
401 | QString &operator=( const std::string& ); // deep copy | ||
392 | #endif | 402 | #endif |
393 | QString &operator=( const QCString& ); // deep copy | 403 | QString &operator=( const QCString& ); // deep copy |
394 | QString &operator=( QChar c ); | 404 | QString &operator=( QChar c ); |
395 | QString &operator=( char c ); | 405 | QString &operator=( char c ); |
396 | 406 | ||
397 | QT_STATIC_CONST QString null; | 407 | QT_STATIC_CONST QString null; |
398 | 408 | ||
399 | bool isNull() const; | 409 | bool isNull() const; |
400 | bool isEmpty() const; | 410 | bool isEmpty() const; |
401 | uint length() const; | 411 | uint length() const; |
402 | void truncate( uint pos ); | 412 | void truncate( uint pos ); |
403 | 413 | ||
404 | QString & fill( QChar c, int len = -1 ); | 414 | QString & fill( QChar c, int len = -1 ); |
405 | 415 | ||
406 | QString copy() const; | 416 | QString copy() const; |
407 | 417 | ||
@@ -481,39 +491,45 @@ public: | |||
481 | QString upper() const; | 491 | QString upper() const; |
482 | 492 | ||
483 | QString stripWhiteSpace() const; | 493 | QString stripWhiteSpace() const; |
484 | QString simplifyWhiteSpace() const; | 494 | QString simplifyWhiteSpace() const; |
485 | 495 | ||
486 | QString &insert( uint index, const QString & ); | 496 | QString &insert( uint index, const QString & ); |
487 | QString &insert( uint index, const QChar*, uint len ); | 497 | QString &insert( uint index, const QChar*, uint len ); |
488 | QString &insert( uint index, QChar ); | 498 | QString &insert( uint index, QChar ); |
489 | QString &insert( uint index, char c ) { return insert(index,QChar(c)); } | 499 | QString &insert( uint index, char c ) { return insert(index,QChar(c)); } |
490 | QString &append( char ); | 500 | QString &append( char ); |
491 | QString &append( QChar ); | 501 | QString &append( QChar ); |
492 | QString &append( const QString & ); | 502 | QString &append( const QString & ); |
493 | #ifndef QT_NO_CAST_ASCII | 503 | #ifndef QT_NO_CAST_ASCII |
494 | QString &append( const QByteArray & ); | 504 | QString &append( const QByteArray & ); |
495 | QString &append( const char * ); | 505 | QString &append( const char * ); |
496 | #endif | 506 | #endif |
507 | #ifndef QT_NO_STL | ||
508 | QString &append( const std::string& ); | ||
509 | #endif | ||
497 | QString &prepend( char ); | 510 | QString &prepend( char ); |
498 | QString &prepend( QChar ); | 511 | QString &prepend( QChar ); |
499 | QString &prepend( const QString & ); | 512 | QString &prepend( const QString & ); |
500 | #ifndef QT_NO_CAST_ASCII | 513 | #ifndef QT_NO_CAST_ASCII |
501 | QString &prepend( const QByteArray & ); | 514 | QString &prepend( const QByteArray & ); |
502 | QString &prepend( const char * ); | 515 | QString &prepend( const char * ); |
503 | #endif | 516 | #endif |
517 | #ifndef QT_NO_STL | ||
518 | QString &prepend( const std::string& ); | ||
519 | #endif | ||
504 | QString &remove( uint index, uint len ); | 520 | QString &remove( uint index, uint len ); |
505 | QString &remove( QChar c ); | 521 | QString &remove( QChar c ); |
506 | QString &remove( char c ) { return remove( QChar(c) ); } | 522 | QString &remove( char c ) { return remove( QChar(c) ); } |
507 | QString &remove( const QString & ); | 523 | QString &remove( const QString & ); |
508 | #ifndef QT_NO_REGEXP | 524 | #ifndef QT_NO_REGEXP |
509 | QString &remove( const QRegExp & ); | 525 | QString &remove( const QRegExp & ); |
510 | #endif | 526 | #endif |
511 | #ifndef QT_NO_CAST_ASCII | 527 | #ifndef QT_NO_CAST_ASCII |
512 | QString &remove( const char * ); | 528 | QString &remove( const char * ); |
513 | #endif | 529 | #endif |
514 | QString &replace( uint index, uint len, const QString & ); | 530 | QString &replace( uint index, uint len, const QString & ); |
515 | QString &replace( uint index, uint len, const QChar*, uint clen ); | 531 | QString &replace( uint index, uint len, const QChar*, uint clen ); |
516 | QString &replace( uint index, uint len, QChar ); | 532 | QString &replace( uint index, uint len, QChar ); |
517 | QString &replace( uint index, uint len, char c ) | 533 | QString &replace( uint index, uint len, char c ) |
518 | { return replace( index, len, QChar(c) ); } | 534 | { return replace( index, len, QChar(c) ); } |
519 | QString &replace( QChar c, const QString & ); | 535 | QString &replace( QChar c, const QString & ); |
@@ -543,110 +559,119 @@ public: | |||
543 | QString &setNum( float, char f='g', int prec=6 ); | 559 | QString &setNum( float, char f='g', int prec=6 ); |
544 | QString &setNum( double, char f='g', int prec=6 ); | 560 | QString &setNum( double, char f='g', int prec=6 ); |
545 | 561 | ||
546 | static QString number( long, int base=10 ); | 562 | static QString number( long, int base=10 ); |
547 | static QString number( ulong, int base=10); | 563 | static QString number( ulong, int base=10); |
548 | static QString number( int, int base=10 ); | 564 | static QString number( int, int base=10 ); |
549 | static QString number( uint, int base=10); | 565 | static QString number( uint, int base=10); |
550 | static QString number( double, char f='g', int prec=6 ); | 566 | static QString number( double, char f='g', int prec=6 ); |
551 | 567 | ||
552 | void setExpand( uint index, QChar c ); | 568 | void setExpand( uint index, QChar c ); |
553 | 569 | ||
554 | QString &operator+=( const QString &str ); | 570 | QString &operator+=( const QString &str ); |
555 | #ifndef QT_NO_CAST_ASCII | 571 | #ifndef QT_NO_CAST_ASCII |
556 | QString &operator+=( const QByteArray &str ); | 572 | QString &operator+=( const QByteArray &str ); |
557 | QString &operator+=( const char *str ); | 573 | QString &operator+=( const char *str ); |
558 | #endif | 574 | #endif |
575 | #ifndef QT_NO_STL | ||
576 | QString &operator+=( const std::string& ); | ||
577 | #endif | ||
559 | QString &operator+=( QChar c ); | 578 | QString &operator+=( QChar c ); |
560 | QString &operator+=( char c ); | 579 | QString &operator+=( char c ); |
561 | 580 | ||
562 | QChar at( uint i ) const | 581 | QChar at( uint i ) const |
563 | { return i < d->len ? d->unicode[i] : QChar::null; } | 582 | { return i < d->len ? d->unicode[i] : QChar::null; } |
564 | QChar operator[]( int i ) const { return at((uint)i); } | 583 | QChar operator[]( int i ) const { return at((uint)i); } |
565 | QCharRef at( uint i ); | 584 | QCharRef at( uint i ); |
566 | QCharRef operator[]( int i ); | 585 | QCharRef operator[]( int i ); |
567 | 586 | ||
568 | QChar constref(uint i) const | 587 | QChar constref(uint i) const |
569 | { return at(i); } | 588 | { return at(i); } |
570 | QChar& ref(uint i) | 589 | QChar& ref(uint i) |
571 | { // Optimized for easy-inlining by simple compilers. | 590 | { // Optimized for easy-inlining by simple compilers. |
572 | if ( d->count != 1 || i >= d->len ) | 591 | if ( d->count != 1 || i >= d->len ) |
573 | subat( i ); | 592 | subat( i ); |
574 | d->setDirty(); | 593 | d->setDirty(); |
575 | return d->unicode[i]; | 594 | return d->unicode[i]; |
576 | } | 595 | } |
577 | 596 | ||
578 | const QChar* unicode() const { return d->unicode; } | 597 | const QChar* unicode() const { return d->unicode; } |
579 | const char* ascii() const { return latin1(); } | 598 | const char* ascii() const; |
599 | static QString fromAscii(const char*, int len=-1); | ||
580 | const char* latin1() const; | 600 | const char* latin1() const; |
581 | static QString fromLatin1(const char*, int len=-1); | 601 | static QString fromLatin1(const char*, int len=-1); |
582 | QCString utf8() const; | 602 | QCString utf8() const; |
583 | static QString fromUtf8(const char*, int len=-1); | 603 | static QString fromUtf8(const char*, int len=-1); |
584 | QCString local8Bit() const; | 604 | QCString local8Bit() const; |
585 | static QString fromLocal8Bit(const char*, int len=-1); | 605 | static QString fromLocal8Bit(const char*, int len=-1); |
586 | bool operator!() const; | 606 | bool operator!() const; |
587 | #ifndef QT_NO_ASCII_CAST | 607 | #ifndef QT_NO_ASCII_CAST |
588 | operator const char *() const { return latin1(); } | 608 | operator const char *() const { return ascii(); } |
589 | #endif | 609 | #endif |
610 | #ifndef QT_NO_STL | ||
611 | operator std::string() const { return ascii() ? ascii() : ""; } | ||
612 | #endif | ||
613 | |||
590 | static QString fromUcs2( const unsigned short *ucs2 ); | 614 | static QString fromUcs2( const unsigned short *ucs2 ); |
591 | const unsigned short *ucs2() const; | 615 | const unsigned short *ucs2() const; |
592 | 616 | ||
593 | QString &setUnicode( const QChar* unicode, uint len ); | 617 | QString &setUnicode( const QChar* unicode, uint len ); |
594 | QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ); | 618 | QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ); |
619 | QString &setAscii( const char*, int len=-1 ); | ||
595 | QString &setLatin1( const char*, int len=-1 ); | 620 | QString &setLatin1( const char*, int len=-1 ); |
596 | 621 | ||
597 | int compare( const QString& s ) const; | 622 | int compare( const QString& s ) const; |
598 | static int compare( const QString& s1, const QString& s2 ) | 623 | static int compare( const QString& s1, const QString& s2 ) |
599 | { return s1.compare( s2 ); } | 624 | { return s1.compare( s2 ); } |
600 | 625 | ||
601 | int localeAwareCompare( const QString& s ) const; | 626 | int localeAwareCompare( const QString& s ) const; |
602 | static int localeAwareCompare( const QString& s1, const QString& s2 ) | 627 | static int localeAwareCompare( const QString& s1, const QString& s2 ) |
603 | { return s1.localeAwareCompare( s2 ); } | 628 | { return s1.localeAwareCompare( s2 ); } |
604 | 629 | ||
605 | #ifndef QT_NO_DATASTREAM | 630 | #ifndef QT_NO_DATASTREAM |
606 | friend Q_EXPORT QDataStream &operator>>( QDataStream &, QString & ); | 631 | friend Q_EXPORT QDataStream &operator>>( QDataStream &, QString & ); |
607 | #endif | 632 | #endif |
608 | 633 | ||
609 | void compose(); | 634 | void compose(); |
610 | 635 | ||
611 | #ifndef QT_NO_COMPAT | 636 | #ifndef QT_NO_COMPAT |
612 | const char* data() const { return latin1(); } | 637 | const char* data() const { return ascii(); } |
613 | #endif | 638 | #endif |
614 | 639 | ||
615 | bool startsWith( const QString& ) const; | 640 | bool startsWith( const QString& ) const; |
616 | bool endsWith( const QString& ) const; | 641 | bool endsWith( const QString& ) const; |
617 | 642 | ||
618 | void setLength( uint newLength ); | 643 | void setLength( uint newLength ); |
619 | 644 | ||
620 | bool simpleText() const { if ( d->dirty ) checkSimpleText(); return (bool)d->simpletext; } | 645 | bool simpleText() const { if ( !d->issimpletext ) checkSimpleText(); return (bool)d->issimpletext; } |
621 | bool isRightToLeft() const; | 646 | bool isRightToLeft() const; |
622 | 647 | ||
623 | 648 | ||
624 | private: | 649 | private: |
625 | QString( int size, bool /* dummy */ );// allocate size incl. \0 | 650 | QString( int size, bool /* dummy */ );// allocate size incl. \0 |
626 | 651 | ||
627 | void deref(); | 652 | void deref(); |
628 | void real_detach(); | 653 | void real_detach(); |
629 | void subat( uint ); | 654 | void subat( uint ); |
630 | bool findArg(int& pos, int& len) const; | 655 | bool findArg(int& pos, int& len) const; |
631 | 656 | ||
632 | void checkSimpleText() const; | 657 | void checkSimpleText() const; |
633 | 658 | ||
634 | static QChar* asciiToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); | 659 | static QChar* latin1ToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); |
635 | static QChar* asciiToUnicode( const QByteArray&, uint * len ); | 660 | static QChar* latin1ToUnicode( const QByteArray&, uint * len ); |
636 | static char* unicodeToAscii( const QChar*, uint len ); | 661 | static char* unicodeToLatin1( const QChar*, uint len ); |
637 | 662 | ||
638 | QStringData *d; | 663 | QStringData *d; |
639 | static QStringData* shared_null; | 664 | static QStringData* shared_null; |
640 | static QStringData* makeSharedNull(); | 665 | static QStringData* makeSharedNull(); |
641 | 666 | ||
642 | friend class QConstString; | 667 | friend class QConstString; |
643 | friend class QTextStream; | 668 | friend class QTextStream; |
644 | QString( QStringData* dd, bool /* dummy */ ) : d(dd) { } | 669 | QString( QStringData* dd, bool /* dummy */ ) : d(dd) { } |
645 | 670 | ||
646 | // needed for QDeepCopy | 671 | // needed for QDeepCopy |
647 | void detach(); | 672 | void detach(); |
648 | friend class QDeepCopy<QString>; | 673 | friend class QDeepCopy<QString>; |
649 | }; | 674 | }; |
650 | 675 | ||
651 | class Q_EXPORT QCharRef { | 676 | class Q_EXPORT QCharRef { |
652 | friend class QString; | 677 | friend class QString; |
@@ -781,55 +806,67 @@ inline bool QString::isEmpty() const | |||
781 | { return length() == 0; } | 806 | { return length() == 0; } |
782 | 807 | ||
783 | inline QString QString::copy() const | 808 | inline QString QString::copy() const |
784 | { return QString( *this ); } | 809 | { return QString( *this ); } |
785 | 810 | ||
786 | inline QString &QString::prepend( const QString & s ) | 811 | inline QString &QString::prepend( const QString & s ) |
787 | { return insert(0,s); } | 812 | { return insert(0,s); } |
788 | 813 | ||
789 | inline QString &QString::prepend( QChar c ) | 814 | inline QString &QString::prepend( QChar c ) |
790 | { return insert(0,c); } | 815 | { return insert(0,c); } |
791 | 816 | ||
792 | inline QString &QString::prepend( char c ) | 817 | inline QString &QString::prepend( char c ) |
793 | { return insert(0,c); } | 818 | { return insert(0,c); } |
794 | 819 | ||
795 | #ifndef QT_NO_CAST_ASCII | 820 | #ifndef QT_NO_CAST_ASCII |
796 | inline QString &QString::prepend( const QByteArray & s ) | 821 | inline QString &QString::prepend( const QByteArray & s ) |
797 | { return insert(0,s.data()); } | 822 | { return insert(0,QString(s)); } |
823 | #endif | ||
824 | |||
825 | #ifndef QT_NO_STL | ||
826 | inline QString &QString::prepend( const std::string& s ) | ||
827 | { return insert(0, s); } | ||
828 | #endif | ||
829 | |||
830 | #ifndef QT_NO_CAST_ASCII | ||
831 | inline QString &QString::operator+=( const QByteArray &s ) | ||
832 | { return operator+=(QString(s)); } | ||
798 | #endif | 833 | #endif |
799 | 834 | ||
800 | inline QString &QString::append( const QString & s ) | 835 | inline QString &QString::append( const QString & s ) |
801 | { return operator+=(s); } | 836 | { return operator+=(s); } |
802 | 837 | ||
803 | #ifndef QT_NO_CAST_ASCII | 838 | #ifndef QT_NO_CAST_ASCII |
804 | inline QString &QString::append( const QByteArray &s ) | 839 | inline QString &QString::append( const QByteArray &s ) |
805 | { return operator+=(s.data()); } | 840 | { return operator+=(s); } |
806 | 841 | ||
807 | inline QString &QString::append( const char * s ) | 842 | inline QString &QString::append( const char * s ) |
808 | { return operator+=(s); } | 843 | { return operator+=(s); } |
809 | #endif | 844 | #endif |
810 | 845 | ||
811 | inline QString &QString::append( QChar c ) | 846 | inline QString &QString::append( QChar c ) |
812 | { return operator+=(c); } | 847 | { return operator+=(c); } |
813 | 848 | ||
814 | inline QString &QString::append( char c ) | 849 | inline QString &QString::append( char c ) |
815 | { return operator+=(c); } | 850 | { return operator+=(c); } |
816 | 851 | ||
817 | #ifndef QT_NO_CAST_ASCII | 852 | #ifndef QT_NO_STL |
818 | inline QString &QString::operator+=( const QByteArray &s ) | 853 | inline QString &QString::operator+=( const std::string& s ) |
819 | { return operator+=(s.data()); } | 854 | { return operator+=(s.c_str()); } |
855 | inline QString &QString::append( const std::string& s ) | ||
856 | { return operator+=(s); } | ||
820 | #endif | 857 | #endif |
821 | 858 | ||
822 | inline QString &QString::setNum( short n, int base ) | 859 | inline QString &QString::setNum( short n, int base ) |
823 | { return setNum((long)n, base); } | 860 | { return setNum((long)n, base); } |
824 | 861 | ||
825 | inline QString &QString::setNum( ushort n, int base ) | 862 | inline QString &QString::setNum( ushort n, int base ) |
826 | { return setNum((ulong)n, base); } | 863 | { return setNum((ulong)n, base); } |
827 | 864 | ||
828 | inline QString &QString::setNum( int n, int base ) | 865 | inline QString &QString::setNum( int n, int base ) |
829 | { return setNum((long)n, base); } | 866 | { return setNum((long)n, base); } |
830 | 867 | ||
831 | inline QString &QString::setNum( uint n, int base ) | 868 | inline QString &QString::setNum( uint n, int base ) |
832 | { return setNum((ulong)n, base); } | 869 | { return setNum((ulong)n, base); } |
833 | 870 | ||
834 | inline QString &QString::setNum( float n, char f, int prec ) | 871 | inline QString &QString::setNum( float n, char f, int prec ) |
835 | { return setNum((double)n,f,prec); } | 872 | { return setNum((double)n,f,prec); } |
@@ -841,36 +878,36 @@ inline QString QString::arg(uint a, int fieldwidth, int base) const | |||
841 | { return arg((ulong)a, fieldwidth, base); } | 878 | { return arg((ulong)a, fieldwidth, base); } |
842 | 879 | ||
843 | inline QString QString::arg(short a, int fieldwidth, int base) const | 880 | inline QString QString::arg(short a, int fieldwidth, int base) const |
844 | { return arg((long)a, fieldwidth, base); } | 881 | { return arg((long)a, fieldwidth, base); } |
845 | 882 | ||
846 | inline QString QString::arg(ushort a, int fieldwidth, int base) const | 883 | inline QString QString::arg(ushort a, int fieldwidth, int base) const |
847 | { return arg((ulong)a, fieldwidth, base); } | 884 | { return arg((ulong)a, fieldwidth, base); } |
848 | 885 | ||
849 | inline int QString::find( char c, int index, bool cs ) const | 886 | inline int QString::find( char c, int index, bool cs ) const |
850 | { return find(QChar(c), index, cs); } | 887 | { return find(QChar(c), index, cs); } |
851 | 888 | ||
852 | inline int QString::findRev( char c, int index, bool cs) const | 889 | inline int QString::findRev( char c, int index, bool cs) const |
853 | { return findRev( QChar(c), index, cs ); } | 890 | { return findRev( QChar(c), index, cs ); } |
854 | 891 | ||
855 | #ifndef QT_NO_CAST_ASCII | 892 | #ifndef QT_NO_CAST_ASCII |
856 | inline int QString::find( const char* str, int index ) const | 893 | inline int QString::find( const char* str, int index ) const |
857 | { return find(QString::fromLatin1(str), index); } | 894 | { return find(QString::fromAscii(str), index); } |
858 | 895 | ||
859 | inline int QString::findRev( const char* str, int index ) const | 896 | inline int QString::findRev( const char* str, int index ) const |
860 | { return findRev(QString::fromLatin1(str), index); } | 897 | { return findRev(QString::fromAscii(str), index); } |
861 | #endif | 898 | #endif |
862 | 899 | ||
863 | 900 | ||
864 | /***************************************************************************** | 901 | /***************************************************************************** |
865 | QString non-member operators | 902 | QString non-member operators |
866 | *****************************************************************************/ | 903 | *****************************************************************************/ |
867 | 904 | ||
868 | Q_EXPORT bool operator!=( const QString &s1, const QString &s2 ); | 905 | Q_EXPORT bool operator!=( const QString &s1, const QString &s2 ); |
869 | Q_EXPORT bool operator<( const QString &s1, const QString &s2 ); | 906 | Q_EXPORT bool operator<( const QString &s1, const QString &s2 ); |
870 | Q_EXPORT bool operator<=( const QString &s1, const QString &s2 ); | 907 | Q_EXPORT bool operator<=( const QString &s1, const QString &s2 ); |
871 | Q_EXPORT bool operator==( const QString &s1, const QString &s2 ); | 908 | Q_EXPORT bool operator==( const QString &s1, const QString &s2 ); |
872 | Q_EXPORT bool operator>( const QString &s1, const QString &s2 ); | 909 | Q_EXPORT bool operator>( const QString &s1, const QString &s2 ); |
873 | Q_EXPORT bool operator>=( const QString &s1, const QString &s2 ); | 910 | Q_EXPORT bool operator>=( const QString &s1, const QString &s2 ); |
874 | #ifndef QT_NO_CAST_ASCII | 911 | #ifndef QT_NO_CAST_ASCII |
875 | Q_EXPORT bool operator!=( const QString &s1, const char *s2 ); | 912 | Q_EXPORT bool operator!=( const QString &s1, const char *s2 ); |
876 | Q_EXPORT bool operator<( const QString &s1, const char *s2 ); | 913 | Q_EXPORT bool operator<( const QString &s1, const char *s2 ); |
@@ -884,39 +921,39 @@ Q_EXPORT bool operator<=( const char *s1, const QString &s2 ); | |||
884 | Q_EXPORT bool operator==( const char *s1, const QString &s2 ); | 921 | Q_EXPORT bool operator==( const char *s1, const QString &s2 ); |
885 | //Q_EXPORT bool operator>( const char *s1, const QString &s2 ); // MSVC++ | 922 | //Q_EXPORT bool operator>( const char *s1, const QString &s2 ); // MSVC++ |
886 | Q_EXPORT bool operator>=( const char *s1, const QString &s2 ); | 923 | Q_EXPORT bool operator>=( const char *s1, const QString &s2 ); |
887 | #endif | 924 | #endif |
888 | 925 | ||
889 | Q_EXPORT inline const QString operator+( const QString &s1, const QString &s2 ) | 926 | Q_EXPORT inline const QString operator+( const QString &s1, const QString &s2 ) |
890 | { | 927 | { |
891 | QString tmp( s1 ); | 928 | QString tmp( s1 ); |
892 | tmp += s2; | 929 | tmp += s2; |
893 | return tmp; | 930 | return tmp; |
894 | } | 931 | } |
895 | 932 | ||
896 | #ifndef QT_NO_CAST_ASCII | 933 | #ifndef QT_NO_CAST_ASCII |
897 | Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 ) | 934 | Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 ) |
898 | { | 935 | { |
899 | QString tmp( s1 ); | 936 | QString tmp( s1 ); |
900 | tmp += QString::fromLatin1(s2); | 937 | tmp += QString::fromAscii(s2); |
901 | return tmp; | 938 | return tmp; |
902 | } | 939 | } |
903 | 940 | ||
904 | Q_EXPORT inline const QString operator+( const char *s1, const QString &s2 ) | 941 | Q_EXPORT inline const QString operator+( const char *s1, const QString &s2 ) |
905 | { | 942 | { |
906 | QString tmp = QString::fromLatin1( s1 ); | 943 | QString tmp = QString::fromAscii( s1 ); |
907 | tmp += s2; | 944 | tmp += s2; |
908 | return tmp; | 945 | return tmp; |
909 | } | 946 | } |
910 | #endif | 947 | #endif |
911 | 948 | ||
912 | Q_EXPORT inline const QString operator+( const QString &s1, QChar c2 ) | 949 | Q_EXPORT inline const QString operator+( const QString &s1, QChar c2 ) |
913 | { | 950 | { |
914 | QString tmp( s1 ); | 951 | QString tmp( s1 ); |
915 | tmp += c2; | 952 | tmp += c2; |
916 | return tmp; | 953 | return tmp; |
917 | } | 954 | } |
918 | 955 | ||
919 | Q_EXPORT inline const QString operator+( const QString &s1, char c2 ) | 956 | Q_EXPORT inline const QString operator+( const QString &s1, char c2 ) |
920 | { | 957 | { |
921 | QString tmp( s1 ); | 958 | QString tmp( s1 ); |
922 | tmp += c2; | 959 | tmp += c2; |
@@ -934,17 +971,21 @@ Q_EXPORT inline const QString operator+( QChar c1, const QString &s2 ) | |||
934 | Q_EXPORT inline const QString operator+( char c1, const QString &s2 ) | 971 | Q_EXPORT inline const QString operator+( char c1, const QString &s2 ) |
935 | { | 972 | { |
936 | QString tmp; | 973 | QString tmp; |
937 | tmp += c1; | 974 | tmp += c1; |
938 | tmp += s2; | 975 | tmp += s2; |
939 | return tmp; | 976 | return tmp; |
940 | } | 977 | } |
941 | 978 | ||
942 | #if defined(Q_OS_WIN32) | 979 | #if defined(Q_OS_WIN32) |
943 | extern Q_EXPORT QString qt_winQString(void*); | 980 | extern Q_EXPORT QString qt_winQString(void*); |
944 | extern Q_EXPORT const void* qt_winTchar(const QString& str, bool addnul); | 981 | extern Q_EXPORT const void* qt_winTchar(const QString& str, bool addnul); |
945 | extern Q_EXPORT void* qt_winTchar_new(const QString& str); | 982 | extern Q_EXPORT void* qt_winTchar_new(const QString& str); |
946 | extern Q_EXPORT QCString qt_winQString2MB( const QString& s, int len=-1 ); | 983 | extern Q_EXPORT QCString qt_winQString2MB( const QString& s, int len=-1 ); |
947 | extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 ); | 984 | extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 ); |
948 | #endif | 985 | #endif |
949 | 986 | ||
987 | #ifdef QT_QWINEXPORT | ||
988 | #define Q_DEFINED_QSTRING | ||
989 | #include "qwinexport.h" | ||
990 | #endif /* QT_QWINEXPORT */ | ||
950 | #endif // QSTRING_H | 991 | #endif // QSTRING_H |
diff --git a/qmake/include/qstrlist.h b/qmake/include/qstrlist.h index 86de328..b9dd753 100644 --- a/qmake/include/qstrlist.h +++ b/qmake/include/qstrlist.h | |||
@@ -32,36 +32,38 @@ | |||
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QSTRLIST_H | 38 | #ifndef QSTRLIST_H |
39 | #define QSTRLIST_H | 39 | #define QSTRLIST_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qstring.h" | 42 | #include "qstring.h" |
43 | #include "qptrlist.h" | 43 | #include "qptrlist.h" |
44 | #include "qdatastream.h" | 44 | #include "qdatastream.h" |
45 | #endif // QT_H | 45 | #endif // QT_H |
46 | 46 | ||
47 | 47 | ||
48 | #ifndef QT_QWINEXPORT | ||
48 | #if defined(Q_TEMPLATEDLL) | 49 | #if defined(Q_TEMPLATEDLL) |
49 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<char>; | 50 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<char>; |
50 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrListIterator<char>; | 51 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrListIterator<char>; |
51 | #endif | 52 | #endif |
53 | #endif /* QT_QWINEXPORT */ | ||
52 | 54 | ||
53 | #if defined(Q_QDOC) | 55 | #if defined(Q_QDOC) |
54 | class QStrListIterator : public QPtrListIterator<char> | 56 | class QStrListIterator : public QPtrListIterator<char> |
55 | { | 57 | { |
56 | }; | 58 | }; |
57 | #else | 59 | #else |
58 | typedef QPtrListIterator<char> QStrListIterator; | 60 | typedef QPtrListIterator<char> QStrListIterator; |
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | class Q_EXPORT QStrList : public QPtrList<char> | 63 | class Q_EXPORT QStrList : public QPtrList<char> |
62 | { | 64 | { |
63 | public: | 65 | public: |
64 | QStrList( bool deepCopies=TRUE ) { dc = deepCopies; del_item = deepCopies; } | 66 | QStrList( bool deepCopies=TRUE ) { dc = deepCopies; del_item = deepCopies; } |
65 | QStrList( const QStrList & ); | 67 | QStrList( const QStrList & ); |
66 | ~QStrList() { clear(); } | 68 | ~QStrList() { clear(); } |
67 | QStrList& operator=( const QStrList & ); | 69 | QStrList& operator=( const QStrList & ); |
diff --git a/qmake/include/qtextcodec.h b/qmake/include/qtextcodec.h index 149b5cb..995e434 100644 --- a/qmake/include/qtextcodec.h +++ b/qmake/include/qtextcodec.h | |||
@@ -62,53 +62,67 @@ public: | |||
62 | 62 | ||
63 | class Q_EXPORT QTextCodec { | 63 | class Q_EXPORT QTextCodec { |
64 | public: | 64 | public: |
65 | virtual ~QTextCodec(); | 65 | virtual ~QTextCodec(); |
66 | 66 | ||
67 | #ifndef QT_NO_CODECS | 67 | #ifndef QT_NO_CODECS |
68 | static QTextCodec* loadCharmap(QIODevice*); | 68 | static QTextCodec* loadCharmap(QIODevice*); |
69 | static QTextCodec* loadCharmapFile(QString filename); | 69 | static QTextCodec* loadCharmapFile(QString filename); |
70 | #endif //QT_NO_CODECS | 70 | #endif //QT_NO_CODECS |
71 | static QTextCodec* codecForMib(int mib); | 71 | static QTextCodec* codecForMib(int mib); |
72 | static QTextCodec* codecForName(const char* hint, int accuracy=0); | 72 | static QTextCodec* codecForName(const char* hint, int accuracy=0); |
73 | static QTextCodec* codecForContent(const char* chars, int len); | 73 | static QTextCodec* codecForContent(const char* chars, int len); |
74 | static QTextCodec* codecForIndex(int i); | 74 | static QTextCodec* codecForIndex(int i); |
75 | static QTextCodec* codecForLocale(); | 75 | static QTextCodec* codecForLocale(); |
76 | static void setCodecForLocale(QTextCodec *c); | 76 | static void setCodecForLocale(QTextCodec *c); |
77 | 77 | ||
78 | static QTextCodec* codecForTr(); | ||
79 | static void setCodecForTr(QTextCodec *c); | ||
80 | static QTextCodec* codecForCStrings(); | ||
81 | static void setCodecForCStrings(QTextCodec *c); | ||
82 | |||
78 | static void deleteAllCodecs(); | 83 | static void deleteAllCodecs(); |
79 | 84 | ||
80 | static const char* locale(); | 85 | static const char* locale(); |
81 | 86 | ||
82 | virtual const char* name() const = 0; | 87 | virtual const char* name() const = 0; |
83 | virtual const char* mimeName() const; | 88 | virtual const char* mimeName() const; |
84 | virtual int mibEnum() const = 0; | 89 | virtual int mibEnum() const = 0; |
85 | 90 | ||
86 | virtual QTextDecoder* makeDecoder() const; | 91 | virtual QTextDecoder* makeDecoder() const; |
87 | virtual QTextEncoder* makeEncoder() const; | 92 | virtual QTextEncoder* makeEncoder() const; |
88 | 93 | ||
89 | virtual QString toUnicode(const char* chars, int len) const; | 94 | virtual QString toUnicode(const char* chars, int len) const; |
90 | virtual QCString fromUnicode(const QString& uc, int& lenInOut) const; | 95 | virtual QCString fromUnicode(const QString& uc, int& lenInOut) const; |
91 | 96 | ||
92 | QCString fromUnicode(const QString& uc) const; | 97 | QCString fromUnicode(const QString& uc) const; |
93 | QString toUnicode(const QByteArray&, int len) const; | 98 | QString toUnicode(const QByteArray&, int len) const; |
94 | QString toUnicode(const QByteArray&) const; | 99 | QString toUnicode(const QByteArray&) const; |
95 | QString toUnicode(const QCString&, int len) const; | 100 | QString toUnicode(const QCString&, int len) const; |
96 | QString toUnicode(const QCString&) const; | 101 | QString toUnicode(const QCString&) const; |
97 | QString toUnicode(const char* chars) const; | 102 | QString toUnicode(const char* chars) const; |
98 | virtual bool canEncode( QChar ) const; | 103 | virtual bool canEncode( QChar ) const; |
99 | virtual bool canEncode( const QString& ) const; | 104 | virtual bool canEncode( const QString& ) const; |
100 | 105 | ||
101 | virtual int heuristicContentMatch(const char* chars, int len) const = 0; | 106 | virtual int heuristicContentMatch(const char* chars, int len) const = 0; |
102 | virtual int heuristicNameMatch(const char* hint) const; | 107 | virtual int heuristicNameMatch(const char* hint) const; |
103 | 108 | ||
104 | virtual QByteArray fromUnicode(const QString& uc, int from, int len) const; | 109 | virtual QByteArray fromUnicode(const QString& uc, int from, int len) const; |
105 | virtual unsigned short characterFromUnicode(const QString &str, int pos) const; | 110 | virtual unsigned short characterFromUnicode(const QString &str, int pos) const; |
106 | 111 | ||
107 | protected: | 112 | protected: |
108 | QTextCodec(); | 113 | QTextCodec(); |
109 | static int simpleHeuristicNameMatch(const char* name, const char* hint); | 114 | static int simpleHeuristicNameMatch(const char* name, const char* hint); |
110 | 115 | ||
116 | private: | ||
117 | static QTextCodec *cftr; | ||
118 | static QTextCodec *cfcs; | ||
111 | friend class QFont; | 119 | friend class QFont; |
112 | }; | 120 | }; |
121 | |||
122 | inline QTextCodec* QTextCodec::codecForTr() { return cftr; } | ||
123 | inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } | ||
124 | inline QTextCodec* QTextCodec::codecForCStrings() { return cfcs; } | ||
125 | inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { cfcs = c; } | ||
126 | |||
113 | #endif // QT_NO_TEXTCODEC | 127 | #endif // QT_NO_TEXTCODEC |
114 | #endif // QTEXTCODEC_H | 128 | #endif // QTEXTCODEC_H |
diff --git a/qmake/include/qtl.h b/qmake/include/qtl.h index 346cecc..25631fd 100644 --- a/qmake/include/qtl.h +++ b/qmake/include/qtl.h | |||
@@ -76,32 +76,33 @@ inline OutputIterator qCopy( InputIterator _begin, InputIterator _end, | |||
76 | *_dest++ = *_begin++; | 76 | *_dest++ = *_begin++; |
77 | return _dest; | 77 | return _dest; |
78 | } | 78 | } |
79 | 79 | ||
80 | template <class BiIterator, class BiOutputIterator> | 80 | template <class BiIterator, class BiOutputIterator> |
81 | inline BiOutputIterator qCopyBackward( BiIterator _begin, BiIterator _end, | 81 | inline BiOutputIterator qCopyBackward( BiIterator _begin, BiIterator _end, |
82 | BiOutputIterator _dest ) | 82 | BiOutputIterator _dest ) |
83 | { | 83 | { |
84 | while ( _begin != _end ) | 84 | while ( _begin != _end ) |
85 | *--_dest = *--_end; | 85 | *--_dest = *--_end; |
86 | return _dest; | 86 | return _dest; |
87 | } | 87 | } |
88 | 88 | ||
89 | template <class InputIterator1, class InputIterator2> | 89 | template <class InputIterator1, class InputIterator2> |
90 | inline bool qEqual( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2 ) | 90 | inline bool qEqual( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2 ) |
91 | { | 91 | { |
92 | // ### compare using !(*first1 == *first2) in Qt 4.0 | ||
92 | for ( ; first1 != last1; ++first1, ++first2 ) | 93 | for ( ; first1 != last1; ++first1, ++first2 ) |
93 | if ( *first1 != *first2 ) | 94 | if ( *first1 != *first2 ) |
94 | return FALSE; | 95 | return FALSE; |
95 | return TRUE; | 96 | return TRUE; |
96 | } | 97 | } |
97 | 98 | ||
98 | template <class ForwardIterator, class T> | 99 | template <class ForwardIterator, class T> |
99 | inline void qFill( ForwardIterator first, ForwardIterator last, const T& val ) | 100 | inline void qFill( ForwardIterator first, ForwardIterator last, const T& val ) |
100 | { | 101 | { |
101 | for ( ; first != last; ++first ) | 102 | for ( ; first != last; ++first ) |
102 | *first = val; | 103 | *first = val; |
103 | } | 104 | } |
104 | 105 | ||
105 | #if 0 | 106 | #if 0 |
106 | template <class BiIterator, class OutputIterator> | 107 | template <class BiIterator, class OutputIterator> |
107 | inline OutputIterator qReverseCopy( BiIterator _begin, BiIterator _end, | 108 | inline OutputIterator qReverseCopy( BiIterator _begin, BiIterator _end, |
diff --git a/qmake/include/quuid.h b/qmake/include/quuid.h index 591d2f1..664c149 100644 --- a/qmake/include/quuid.h +++ b/qmake/include/quuid.h | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QUuid class | 4 | ** Definition of QUuid class |
5 | ** | 5 | ** |
6 | ** Created: 010523 | 6 | ** Created : 010523 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2001 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -40,33 +40,33 @@ | |||
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include <qstring.h> | 42 | #include <qstring.h> |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | #include <string.h> | 45 | #include <string.h> |
46 | 46 | ||
47 | #if defined(Q_OS_WIN32) | 47 | #if defined(Q_OS_WIN32) |
48 | #ifndef GUID_DEFINED | 48 | #ifndef GUID_DEFINED |
49 | #define GUID_DEFINED | 49 | #define GUID_DEFINED |
50 | typedef struct _GUID | 50 | typedef struct _GUID |
51 | { | 51 | { |
52 | ulong Data1; | 52 | ulong Data1; |
53 | ushort Data2; | 53 | ushort Data2; |
54 | ushort Data3; | 54 | ushort Data3; |
55 | uchar Data4[ 8 ]; | 55 | uchar Data4[ 8 ]; |
56 | } GUID; | 56 | } GUID, *REFGUID, *LPGUID; |
57 | #endif | 57 | #endif |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | struct Q_EXPORT QUuid | 60 | struct Q_EXPORT QUuid |
61 | { | 61 | { |
62 | QUuid() | 62 | QUuid() |
63 | { | 63 | { |
64 | memset( this, 0, sizeof(QUuid) ); | 64 | memset( this, 0, sizeof(QUuid) ); |
65 | } | 65 | } |
66 | QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 ) | 66 | QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 ) |
67 | { | 67 | { |
68 | data1 = l; | 68 | data1 = l; |
69 | data2 = w1; | 69 | data2 = w1; |
70 | data3 = w2; | 70 | data3 = w2; |
71 | data4[0] = b1; | 71 | data4[0] = b1; |
72 | data4[1] = b2; | 72 | data4[1] = b2; |
diff --git a/qmake/include/qvaluelist.h b/qmake/include/qvaluelist.h index 54f7aec..f5cd7bb 100644 --- a/qmake/include/qvaluelist.h +++ b/qmake/include/qvaluelist.h | |||
@@ -649,17 +649,21 @@ Q_INLINE_TEMPLATES QDataStream& operator>>( QDataStream& s, QValueList<T>& l ) | |||
649 | if ( s.atEnd() ) | 649 | if ( s.atEnd() ) |
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | return s; | 652 | return s; |
653 | } | 653 | } |
654 | 654 | ||
655 | template <class T> | 655 | template <class T> |
656 | Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QValueList<T>& l ) | 656 | Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QValueList<T>& l ) |
657 | { | 657 | { |
658 | s << (Q_UINT32)l.size(); | 658 | s << (Q_UINT32)l.size(); |
659 | QValueListConstIterator<T> it = l.begin(); | 659 | QValueListConstIterator<T> it = l.begin(); |
660 | for( ; it != l.end(); ++it ) | 660 | for( ; it != l.end(); ++it ) |
661 | s << *it; | 661 | s << *it; |
662 | return s; | 662 | return s; |
663 | } | 663 | } |
664 | #endif // QT_NO_DATASTREAM | 664 | #endif // QT_NO_DATASTREAM |
665 | #ifdef QT_QWINEXPORT | ||
666 | #define Q_DEFINED_QVALUELIST | ||
667 | #include "qwinexport.h" | ||
668 | #endif /* QT_QWINEXPORT */ | ||
665 | #endif // QVALUELIST_H | 669 | #endif // QVALUELIST_H |
diff --git a/qmake/include/qvaluestack.h b/qmake/include/qvaluestack.h index 7e9bc48..c3f966e 100644 --- a/qmake/include/qvaluestack.h +++ b/qmake/include/qvaluestack.h | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QValueStack class | 4 | ** Definition of QValueStack class |
5 | ** | 5 | ** |
6 | ** Created : 990925 | 6 | ** Created : 990925 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -41,24 +41,24 @@ | |||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qvaluelist.h" | 42 | #include "qvaluelist.h" |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | 45 | ||
46 | template<class T> | 46 | template<class T> |
47 | class QValueStack : public QValueList<T> | 47 | class QValueStack : public QValueList<T> |
48 | { | 48 | { |
49 | public: | 49 | public: |
50 | QValueStack() {} | 50 | QValueStack() {} |
51 | ~QValueStack() {} | 51 | ~QValueStack() {} |
52 | void push( const T& d ) { append(d); } | 52 | void push( const T& d ) { append(d); } |
53 | T pop() | 53 | T pop() |
54 | { | 54 | { |
55 | T elem( this->last() ); | 55 | T elem( this->last() ); |
56 | if ( !this->isEmpty() ) | 56 | if ( !this->isEmpty() ) |
57 | remove( this->fromLast() ); | 57 | this->remove( this->fromLast() ); |
58 | return elem; | 58 | return elem; |
59 | } | 59 | } |
60 | T& top() { return this->last(); } | 60 | T& top() { return this->last(); } |
61 | const T& top() const { return this->last(); } | 61 | const T& top() const { return this->last(); } |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #endif | 64 | #endif |
diff --git a/qmake/main.cpp b/qmake/main.cpp index eed1697..cc2d08a 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp | |||
@@ -47,34 +47,39 @@ | |||
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #include <sys/types.h> | 48 | #include <sys/types.h> |
49 | #include <sys/stat.h> | 49 | #include <sys/stat.h> |
50 | 50 | ||
51 | // for Borland, main is defined to qMain which breaks qmake | 51 | // for Borland, main is defined to qMain which breaks qmake |
52 | #undef main | 52 | #undef main |
53 | 53 | ||
54 | int main(int argc, char **argv) | 54 | int main(int argc, char **argv) |
55 | { | 55 | { |
56 | /* parse command line */ | 56 | /* parse command line */ |
57 | if(!Option::parseCommandLine(argc, argv)) | 57 | if(!Option::parseCommandLine(argc, argv)) |
58 | return 666; | 58 | return 666; |
59 | 59 | ||
60 | QDir sunworkshop42workaround = QDir::current(); | 60 | QDir sunworkshop42workaround = QDir::current(); |
61 | QString oldpwd = sunworkshop42workaround.currentDirPath(); | 61 | QString oldpwd = sunworkshop42workaround.currentDirPath(); |
62 | Option::output_dir = oldpwd; //for now this is the output dir | 62 | Option::output_dir = oldpwd; //for now this is the output dir |
63 | if(Option::output_dir.right(1) != QString(QChar(QDir::separator()))) | 63 | #ifdef Q_WS_WIN |
64 | Option::output_dir += QDir::separator(); | 64 | if ( !(Option::output_dir.length() == 3 && Option::output_dir[0].isLetter() && Option::output_dir.endsWith(":/") ) ) |
65 | #endif | ||
66 | { | ||
67 | if(Option::output_dir.right(1) != QString(QChar(QDir::separator()))) | ||
68 | Option::output_dir += QDir::separator(); | ||
69 | } | ||
65 | QMakeProject proj; | 70 | QMakeProject proj; |
66 | int exit_val = 0; | 71 | int exit_val = 0; |
67 | QStringList files; | 72 | QStringList files; |
68 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) | 73 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) |
69 | files << "(*hack*)"; //we don't even use files, but we do the for() body once | 74 | files << "(*hack*)"; //we don't even use files, but we do the for() body once |
70 | else | 75 | else |
71 | files = Option::mkfile::project_files; | 76 | files = Option::mkfile::project_files; |
72 | for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) { | 77 | for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) { |
73 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 78 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
74 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 79 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
75 | QString fn = (*pfile); | 80 | QString fn = (*pfile); |
76 | 81 | ||
77 | //setup pwd properly | 82 | //setup pwd properly |
78 | debug_msg(1, "Resetting dir to: %s", oldpwd.latin1()); | 83 | debug_msg(1, "Resetting dir to: %s", oldpwd.latin1()); |
79 | QDir::setCurrent(oldpwd); //reset the old pwd | 84 | QDir::setCurrent(oldpwd); //reset the old pwd |
80 | int di = fn.findRev(Option::dir_sep); | 85 | int di = fn.findRev(Option::dir_sep); |
diff --git a/qmake/option.cpp b/qmake/option.cpp index 34b3ee2..8b7e5e8 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp | |||
@@ -69,159 +69,161 @@ QStringList Option::after_user_vars; | |||
69 | QString Option::user_template; | 69 | QString Option::user_template; |
70 | QString Option::user_template_prefix; | 70 | QString Option::user_template_prefix; |
71 | #if defined(Q_OS_WIN32) | 71 | #if defined(Q_OS_WIN32) |
72 | Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; | 72 | Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; |
73 | #elif defined(Q_OS_MAC9) | 73 | #elif defined(Q_OS_MAC9) |
74 | Option::TARG_MODE Option::target_mode = Option::TARG_MAC9_MODE; | 74 | Option::TARG_MODE Option::target_mode = Option::TARG_MAC9_MODE; |
75 | #elif defined(Q_OS_MACX) | 75 | #elif defined(Q_OS_MACX) |
76 | Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; | 76 | Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; |
77 | #elif defined(Q_OS_QNX6) | 77 | #elif defined(Q_OS_QNX6) |
78 | Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; | 78 | Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; |
79 | #else | 79 | #else |
80 | Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; | 80 | Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | //QMAKE_GENERATE_PROJECT stuff | 83 | //QMAKE_GENERATE_PROJECT stuff |
84 | bool Option::projfile::do_pwd = TRUE; | 84 | bool Option::projfile::do_pwd = TRUE; |
85 | bool Option::projfile::do_recursive = FALSE; | 85 | bool Option::projfile::do_recursive = TRUE; |
86 | QStringList Option::projfile::project_dirs; | 86 | QStringList Option::projfile::project_dirs; |
87 | 87 | ||
88 | //QMAKE_GENERATE_MAKEFILE stuff | 88 | //QMAKE_GENERATE_MAKEFILE stuff |
89 | QString Option::mkfile::qmakespec; | 89 | QString Option::mkfile::qmakespec; |
90 | int Option::mkfile::cachefile_depth = -1; | 90 | int Option::mkfile::cachefile_depth = -1; |
91 | bool Option::mkfile::do_deps = TRUE; | 91 | bool Option::mkfile::do_deps = TRUE; |
92 | bool Option::mkfile::do_mocs = TRUE; | 92 | bool Option::mkfile::do_mocs = TRUE; |
93 | bool Option::mkfile::do_dep_heuristics = TRUE; | 93 | bool Option::mkfile::do_dep_heuristics = TRUE; |
94 | bool Option::mkfile::do_preprocess = FALSE; | 94 | bool Option::mkfile::do_preprocess = FALSE; |
95 | bool Option::mkfile::do_cache = TRUE; | 95 | bool Option::mkfile::do_cache = TRUE; |
96 | QString Option::mkfile::cachefile; | 96 | QString Option::mkfile::cachefile; |
97 | QStringList Option::mkfile::project_files; | 97 | QStringList Option::mkfile::project_files; |
98 | QString Option::mkfile::qmakespec_commandline; | 98 | QString Option::mkfile::qmakespec_commandline; |
99 | 99 | ||
100 | static Option::QMAKE_MODE default_mode(QString progname) | ||
101 | { | ||
102 | int s = progname.findRev(Option::dir_sep); | ||
103 | if(s != -1) | ||
104 | progname = progname.right(progname.length() - (s + 1)); | ||
105 | if(progname == "qmakegen") | ||
106 | return Option::QMAKE_GENERATE_PROJECT; | ||
107 | return Option::QMAKE_GENERATE_MAKEFILE; | ||
108 | } | ||
109 | |||
110 | QString project_builtin_regx(); | ||
100 | bool usage(const char *a0) | 111 | bool usage(const char *a0) |
101 | { | 112 | { |
102 | fprintf(stdout, "Usage: %s [mode] [options] [files]\n" | 113 | fprintf(stdout, "Usage: %s [mode] [options] [files]\n" |
103 | "\n" | 114 | "\n" |
104 | " QMake has two modes, one mode for generating project files based on\n" | 115 | " QMake has two modes, one mode for generating project files based on\n" |
105 | "some heuristics, and the other for generating makefiles. Normally you\n" | 116 | "some heuristics, and the other for generating makefiles. Normally you\n" |
106 | "shouldn't need to specify a mode, as makefile generation is the default\n" | 117 | "shouldn't need to specify a mode, as makefile generation is the default\n" |
107 | "mode for qmake, but you may use this to test qmake on an existing project\n" | 118 | "mode for qmake, but you may use this to test qmake on an existing project\n" |
108 | "\n" | 119 | "\n" |
109 | "Mode:\n" | 120 | "Mode:\n" |
110 | "\t-project Put qmake into project file generation mode\n" | 121 | "\t-project Put qmake into project file generation mode%s\n" |
111 | "\t In this mode qmake interprets files as files to\n" | 122 | "\t In this mode qmake interprets files as files to\n" |
112 | "\t be built,\n" | 123 | "\t be built,\n" |
113 | "\t defaults to *.cpp; *.l; *.y; *.ui\n" | 124 | "\t defaults to %s\n" |
114 | "\t-makefile Put qmake into makefile generation mode (default)\n" | 125 | "\t-makefile Put qmake into makefile generation mode%s\n" |
115 | "\t In this mode qmake interprets files as project files to\n" | 126 | "\t In this mode qmake interprets files as project files to\n" |
116 | "\t be processed, if skipped qmake will try to find a project\n" | 127 | "\t be processed, if skipped qmake will try to find a project\n" |
117 | "\t file in your current working directory\n" | 128 | "\t file in your current working directory\n" |
118 | "\n" | 129 | "\n" |
119 | "Warnings Options:\n" | 130 | "Warnings Options:\n" |
120 | "\t-Wnone Turn off all warnings\n" | 131 | "\t-Wnone Turn off all warnings\n" |
121 | "\t-Wall Turn on all warnings\n" | 132 | "\t-Wall Turn on all warnings\n" |
122 | "\t-Wparser Turn on parser warnings\n" | 133 | "\t-Wparser Turn on parser warnings\n" |
123 | "\t-Wlogic Turn on logic warnings\n" | 134 | "\t-Wlogic Turn on logic warnings\n" |
124 | "\n" | 135 | "\n" |
125 | "Options:\n" | 136 | "Options:\n" |
126 | "\t * You can place any variable assignment in options and it will be *\n" | 137 | "\t * You can place any variable assignment in options and it will be *\n" |
127 | "\t * processed as if it was in [files]. These assignments will be parsed *\n" | 138 | "\t * processed as if it was in [files]. These assignments will be parsed *\n" |
128 | "\t * before [files]. *\n" | 139 | "\t * before [files]. *\n" |
129 | "\t-o file Write output to file\n" | 140 | "\t-o file Write output to file\n" |
130 | "\t-unix Run in unix mode\n" | 141 | "\t-unix Run in unix mode\n" |
131 | "\t-win32 Run in win32 mode\n" | 142 | "\t-win32 Run in win32 mode\n" |
132 | "\t-macx Run in Mac OS X mode\n" | 143 | "\t-macx Run in Mac OS X mode\n" |
133 | "\t-d Increase debug level\n" | 144 | "\t-d Increase debug level\n" |
134 | "\t-t templ Overrides TEMPLATE as templ\n" | 145 | "\t-t templ Overrides TEMPLATE as templ\n" |
135 | "\t-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value\n" | 146 | "\t-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value\n" |
136 | "\t-help This help\n" | 147 | "\t-help This help\n" |
137 | "\t-v Version information\n" | 148 | "\t-v Version information\n" |
138 | "\t-after All variable assignments after this will be\n" | 149 | "\t-after All variable assignments after this will be\n" |
139 | "\t parsed after [files] [makefile mode only]\n" | 150 | "\t parsed after [files]\n" |
140 | "\t-cache file Use file as cache [makefile mode only]\n" | 151 | "\t-cache file Use file as cache [makefile mode only]\n" |
141 | "\t-spec spec Use spec as QMAKESPEC [makefile mode only]\n" | 152 | "\t-spec spec Use spec as QMAKESPEC [makefile mode only]\n" |
142 | "\t-nocache Don't use a cache file [makefile mode only]\n" | 153 | "\t-nocache Don't use a cache file [makefile mode only]\n" |
143 | "\t-nodepend Don't generate dependencies [makefile mode only]\n" | 154 | "\t-nodepend Don't generate dependencies [makefile mode only]\n" |
144 | "\t-nomoc Don't generate moc targets [makefile mode only]\n" | 155 | "\t-nomoc Don't generate moc targets [makefile mode only]\n" |
145 | "\t-nopwd Don't look for files in pwd [ project mode only]\n" | 156 | "\t-nopwd Don't look for files in pwd [ project mode only]\n" |
146 | "\t-r Recursive search [ project mode only]\n" | 157 | "\t-norecursive Don't do a recursive search [ project mode only]\n" |
147 | ,a0); | 158 | ,a0, |
159 | default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", project_builtin_regx().latin1(), | ||
160 | default_mode(a0) == Option::QMAKE_GENERATE_MAKEFILE ? " (default)" : ""); | ||
148 | return FALSE; | 161 | return FALSE; |
149 | } | 162 | } |
150 | static Option::QMAKE_MODE default_mode(QString progname) | ||
151 | { | ||
152 | int s = progname.findRev(Option::dir_sep); | ||
153 | if(s != -1) | ||
154 | progname = progname.right(progname.length() - (s + 1)); | ||
155 | if(progname == "qmakegen") | ||
156 | return Option::QMAKE_GENERATE_PROJECT; | ||
157 | return Option::QMAKE_GENERATE_MAKEFILE; | ||
158 | } | ||
159 | |||
160 | 163 | ||
161 | bool | 164 | bool |
162 | Option::parseCommandLine(int argc, char **argv) | 165 | Option::internalParseCommandLine(int argc, char **argv, int skip) |
163 | { | 166 | { |
164 | bool before = TRUE; | 167 | bool before = TRUE; |
165 | for(int x = 1; x < argc; x++) { | 168 | for(int x = skip; x < argc; x++) { |
166 | if(*argv[x] == '-' && strlen(argv[x]) > 1) { /* options */ | 169 | if(*argv[x] == '-' && strlen(argv[x]) > 1) { /* options */ |
167 | QString opt = argv[x] + 1; | 170 | QString opt = argv[x] + 1; |
168 | 171 | ||
169 | //first param is a mode, or we default | 172 | //first param is a mode, or we default |
170 | if(x == 1) { | 173 | if(x == 1) { |
171 | bool specified = TRUE; | 174 | bool specified = TRUE; |
172 | if(opt == "project") { | 175 | if(opt == "project") { |
173 | Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT; | 176 | Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT; |
174 | } else if(opt == "prl") { | 177 | } else if(opt == "prl") { |
175 | Option::mkfile::do_deps = FALSE; | 178 | Option::mkfile::do_deps = FALSE; |
176 | Option::mkfile::do_mocs = FALSE; | 179 | Option::mkfile::do_mocs = FALSE; |
177 | Option::qmake_mode = Option::QMAKE_GENERATE_PRL; | 180 | Option::qmake_mode = Option::QMAKE_GENERATE_PRL; |
178 | } else if(opt == "makefile") { | 181 | } else if(opt == "makefile") { |
179 | Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; | 182 | Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; |
180 | } else { | 183 | } else { |
181 | specified = FALSE; | 184 | specified = FALSE; |
182 | Option::qmake_mode = default_mode(argv[0]); | ||
183 | } | 185 | } |
184 | if(specified) | 186 | if(specified) |
185 | continue; | 187 | continue; |
186 | } | 188 | } |
187 | //all modes | 189 | //all modes |
188 | if(opt == "o" || opt == "output") { | 190 | if(opt == "o" || opt == "output") { |
189 | Option::output.setName(argv[++x]); | 191 | Option::output.setName(argv[++x]); |
190 | } else if(opt == "after") { | 192 | } else if(opt == "after") { |
191 | before = FALSE; | 193 | before = FALSE; |
192 | } else if(opt == "t" || opt == "template") { | 194 | } else if(opt == "t" || opt == "template") { |
193 | Option::user_template = argv[++x]; | 195 | Option::user_template = argv[++x]; |
194 | } else if(opt == "tp" || opt == "template_prefix") { | 196 | } else if(opt == "tp" || opt == "template_prefix") { |
195 | Option::user_template_prefix = argv[++x]; | 197 | Option::user_template_prefix = argv[++x]; |
196 | } else if(opt == "mac9") { | 198 | } else if(opt == "mac9") { |
197 | Option::target_mode = TARG_MAC9_MODE; | 199 | Option::target_mode = TARG_MAC9_MODE; |
198 | } else if(opt == "macx") { | 200 | } else if(opt == "macx") { |
199 | Option::target_mode = TARG_MACX_MODE; | 201 | Option::target_mode = TARG_MACX_MODE; |
200 | } else if(opt == "unix") { | 202 | } else if(opt == "unix") { |
201 | Option::target_mode = TARG_UNIX_MODE; | 203 | Option::target_mode = TARG_UNIX_MODE; |
202 | } else if(opt == "win32") { | 204 | } else if(opt == "win32") { |
203 | Option::target_mode = TARG_WIN_MODE; | 205 | Option::target_mode = TARG_WIN_MODE; |
204 | } else if(opt == "d") { | 206 | } else if(opt == "d") { |
205 | Option::debug_level++; | 207 | Option::debug_level++; |
206 | } else if(opt == "version" || opt == "v" || opt == "-version") { | 208 | } else if(opt == "version" || opt == "v" || opt == "-version") { |
207 | fprintf(stderr, "Qmake version: %s\n", qmake_version()); | 209 | fprintf(stderr, "Qmake version: %s (Qt %s)\n", qmake_version(), QT_VERSION_STR); |
208 | fprintf(stderr, "Qmake is free software from Trolltech AS.\n"); | 210 | fprintf(stderr, "Qmake is free software from Trolltech AS.\n"); |
209 | return FALSE; | 211 | return FALSE; |
210 | } else if(opt == "h" || opt == "help") { | 212 | } else if(opt == "h" || opt == "help") { |
211 | return usage(argv[0]); | 213 | return FALSE; |
212 | } else if(opt == "Wall") { | 214 | } else if(opt == "Wall") { |
213 | Option::warn_level |= WarnAll; | 215 | Option::warn_level |= WarnAll; |
214 | } else if(opt == "Wparser") { | 216 | } else if(opt == "Wparser") { |
215 | Option::warn_level |= WarnParser; | 217 | Option::warn_level |= WarnParser; |
216 | } else if(opt == "Wlogic") { | 218 | } else if(opt == "Wlogic") { |
217 | Option::warn_level |= WarnLogic; | 219 | Option::warn_level |= WarnLogic; |
218 | } else if(opt == "Wnone") { | 220 | } else if(opt == "Wnone") { |
219 | Option::warn_level = WarnNone; | 221 | Option::warn_level = WarnNone; |
220 | } else { | 222 | } else { |
221 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 223 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
222 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 224 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
223 | if(opt == "nodepend") { | 225 | if(opt == "nodepend") { |
224 | Option::mkfile::do_deps = FALSE; | 226 | Option::mkfile::do_deps = FALSE; |
225 | } else if(opt == "nomoc") { | 227 | } else if(opt == "nomoc") { |
226 | Option::mkfile::do_mocs = FALSE; | 228 | Option::mkfile::do_mocs = FALSE; |
227 | } else if(opt == "nocache") { | 229 | } else if(opt == "nocache") { |
@@ -231,92 +233,145 @@ Option::parseCommandLine(int argc, char **argv) | |||
231 | } else if(opt == "E") { | 233 | } else if(opt == "E") { |
232 | Option::mkfile::do_preprocess = TRUE; | 234 | Option::mkfile::do_preprocess = TRUE; |
233 | } else if(opt == "cache") { | 235 | } else if(opt == "cache") { |
234 | Option::mkfile::cachefile = argv[++x]; | 236 | Option::mkfile::cachefile = argv[++x]; |
235 | } else if(opt == "platform" || opt == "spec") { | 237 | } else if(opt == "platform" || opt == "spec") { |
236 | Option::mkfile::qmakespec = argv[++x]; | 238 | Option::mkfile::qmakespec = argv[++x]; |
237 | Option::mkfile::qmakespec_commandline = argv[x]; | 239 | Option::mkfile::qmakespec_commandline = argv[x]; |
238 | } else { | 240 | } else { |
239 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); | 241 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); |
240 | return usage(argv[0]); | 242 | return usage(argv[0]); |
241 | } | 243 | } |
242 | } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { | 244 | } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { |
243 | if(opt == "nopwd") { | 245 | if(opt == "nopwd") { |
244 | Option::projfile::do_pwd = FALSE; | 246 | Option::projfile::do_pwd = FALSE; |
245 | } else if(opt == "r") { | 247 | } else if(opt == "r") { |
246 | Option::projfile::do_recursive = TRUE; | 248 | Option::projfile::do_recursive = TRUE; |
249 | } else if(opt == "norecursive") { | ||
250 | Option::projfile::do_recursive = FALSE; | ||
247 | } else { | 251 | } else { |
248 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); | 252 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); |
249 | return usage(argv[0]); | 253 | return FALSE; |
250 | } | 254 | } |
251 | } | 255 | } |
252 | } | 256 | } |
253 | } else { | 257 | } else { |
254 | if(x == 1) | ||
255 | Option::qmake_mode = default_mode(argv[0]); | ||
256 | |||
257 | QString arg = argv[x]; | 258 | QString arg = argv[x]; |
258 | if(arg.find('=') != -1) { | 259 | if(arg.find('=') != -1) { |
259 | if(before) | 260 | if(before) |
260 | Option::before_user_vars.append(arg); | 261 | Option::before_user_vars.append(arg); |
261 | else | 262 | else |
262 | Option::after_user_vars.append(arg); | 263 | Option::after_user_vars.append(arg); |
263 | } else { | 264 | } else { |
264 | QFileInfo fi(arg); | 265 | QFileInfo fi(arg); |
265 | if(!fi.convertToAbs()) //strange | 266 | if(!fi.convertToAbs()) //strange |
266 | arg = fi.filePath(); | 267 | arg = fi.filePath(); |
267 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 268 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
268 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) | 269 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) |
269 | Option::mkfile::project_files.append(arg); | 270 | Option::mkfile::project_files.append(arg); |
270 | else | 271 | else |
271 | Option::projfile::project_dirs.append(arg); | 272 | Option::projfile::project_dirs.append(arg); |
272 | } | 273 | } |
273 | } | 274 | } |
274 | } | 275 | } |
276 | return TRUE; | ||
277 | } | ||
278 | |||
279 | |||
280 | bool | ||
281 | Option::parseCommandLine(int argc, char **argv) | ||
282 | { | ||
283 | Option::moc_mod = "moc_"; | ||
284 | Option::lex_mod = "_lex"; | ||
285 | Option::yacc_mod = "_yacc"; | ||
286 | Option::prl_ext = ".prl"; | ||
287 | Option::prf_ext = ".prf"; | ||
288 | Option::ui_ext = ".ui"; | ||
289 | Option::h_ext << ".h" << ".hpp" << ".hh" << ".H" << ".hxx"; | ||
290 | Option::moc_ext = ".moc"; | ||
291 | Option::cpp_ext << ".cpp" << ".cc" << ".cxx" << ".C"; | ||
292 | Option::lex_ext = ".l"; | ||
293 | Option::yacc_ext = ".y"; | ||
294 | |||
275 | if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) | 295 | if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) |
276 | Option::qmake_mode = default_mode(argv[0]); | 296 | Option::qmake_mode = default_mode(argv[0]); |
297 | if(const char *envflags = getenv("QMAKEFLAGS")) { | ||
298 | int env_argc = 0, env_size = 0, currlen=0; | ||
299 | char quote = 0, **env_argv = NULL; | ||
300 | for(int i = 0; envflags[i]; i++) { | ||
301 | if(!quote && (envflags[i] == '\'' || envflags[i] == '"')) { | ||
302 | quote = envflags[i]; | ||
303 | } else if(envflags[i] == quote) { | ||
304 | quote = 0; | ||
305 | } else if(!quote && envflags[i] == ' ') { | ||
306 | if(currlen && env_argv && env_argv[env_argc]) { | ||
307 | env_argv[env_argc][currlen] = '\0'; | ||
308 | currlen = 0; | ||
309 | env_argc++; | ||
310 | } | ||
311 | } else { | ||
312 | if(!env_argv || env_argc > env_size) { | ||
313 | env_argv = (char **)realloc(env_argv, sizeof(char *)*(env_size+=10)); | ||
314 | for(int i2 = env_argc; i2 < env_size; i2++) | ||
315 | env_argv[i2] = NULL; | ||
316 | } | ||
317 | if(!env_argv[env_argc]) { | ||
318 | currlen = 0; | ||
319 | env_argv[env_argc] = (char*)malloc(255); | ||
320 | } | ||
321 | if(currlen < 255) | ||
322 | env_argv[env_argc][currlen++] = envflags[i]; | ||
323 | } | ||
324 | } | ||
325 | if(env_argv[env_argc]) { | ||
326 | env_argv[env_argc][currlen] = '\0'; | ||
327 | currlen = 0; | ||
328 | env_argc++; | ||
329 | } | ||
330 | internalParseCommandLine(env_argc, env_argv); | ||
331 | for(int i2 = 0; i2 < env_size; i2++) { | ||
332 | if(env_argv[i2]) | ||
333 | free(env_argv[i2]); | ||
334 | } | ||
335 | free(env_argv); | ||
336 | } | ||
337 | if(!internalParseCommandLine(argc, argv, 1)) | ||
338 | return usage(argv[0]); | ||
277 | 339 | ||
278 | //last chance for defaults | 340 | //last chance for defaults |
279 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 341 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
280 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 342 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
281 | if(Option::mkfile::qmakespec.isNull() || Option::mkfile::qmakespec.isEmpty()) | 343 | if(Option::mkfile::qmakespec.isNull() || Option::mkfile::qmakespec.isEmpty()) |
282 | Option::mkfile::qmakespec = getenv("QMAKESPEC"); | 344 | Option::mkfile::qmakespec = getenv("QMAKESPEC"); |
283 | 345 | ||
284 | //try REALLY hard to do it for them, lazy.. | 346 | //try REALLY hard to do it for them, lazy.. |
285 | if(Option::mkfile::project_files.isEmpty()) { | 347 | if(Option::mkfile::project_files.isEmpty()) { |
286 | QString proj = QDir::currentDirPath(); | 348 | QString pwd = QDir::currentDirPath(), |
287 | proj = proj.right(proj.length() - (proj.findRev('/') + 1)) + ".pro"; | 349 | proj = pwd + "/" + pwd.right(pwd.length() - (pwd.findRev('/') + 1)) + ".pro"; |
288 | if(QFile::exists(proj)) | 350 | if(QFile::exists(proj)) { |
289 | Option::mkfile::project_files.append(proj); | 351 | Option::mkfile::project_files.append(proj); |
290 | else | 352 | } else { //last try.. |
291 | return usage(argv[0]); | 353 | QDir d(pwd, "*.pro"); |
354 | if(d.count() != 1) | ||
355 | return usage(argv[0]); | ||
356 | Option::mkfile::project_files.append(pwd + "/" + d[0]); | ||
357 | } | ||
292 | } | 358 | } |
293 | } | 359 | } |
294 | 360 | ||
295 | //defaults for globals | 361 | //defaults for globals |
296 | Option::moc_mod = "moc_"; | ||
297 | Option::lex_mod = "_lex"; | ||
298 | Option::yacc_mod = "_yacc"; | ||
299 | Option::prl_ext = ".prl"; | ||
300 | Option::prf_ext = ".prf"; | ||
301 | Option::ui_ext = ".ui"; | ||
302 | Option::h_ext << ".h" << ".hpp" << ".hh" << ".H" << ".hxx"; | ||
303 | Option::moc_ext = ".moc"; | ||
304 | Option::cpp_ext << ".cpp" << ".cc" << ".cxx" << ".C"; | ||
305 | Option::lex_ext = ".l"; | ||
306 | Option::yacc_ext = ".y"; | ||
307 | if(Option::target_mode == Option::TARG_WIN_MODE) { | 362 | if(Option::target_mode == Option::TARG_WIN_MODE) { |
308 | Option::dir_sep = "\\"; | 363 | Option::dir_sep = "\\"; |
309 | Option::obj_ext = ".obj"; | 364 | Option::obj_ext = ".obj"; |
310 | } else { | 365 | } else { |
311 | if(Option::target_mode == Option::TARG_MAC9_MODE) | 366 | if(Option::target_mode == Option::TARG_MAC9_MODE) |
312 | Option::dir_sep = ":"; | 367 | Option::dir_sep = ":"; |
313 | else | 368 | else |
314 | Option::dir_sep = "/"; | 369 | Option::dir_sep = "/"; |
315 | Option::obj_ext = ".o"; | 370 | Option::obj_ext = ".o"; |
316 | } | 371 | } |
317 | return TRUE; | 372 | return TRUE; |
318 | } | 373 | } |
319 | 374 | ||
320 | bool Option::postProcessProject(QMakeProject *project) | 375 | bool Option::postProcessProject(QMakeProject *project) |
321 | { | 376 | { |
322 | Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; | 377 | Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; |
@@ -373,39 +428,39 @@ static QString fixPath(QString x) | |||
373 | x = dir + fi.fileName(); | 428 | x = dir + fi.fileName(); |
374 | } | 429 | } |
375 | #endif | 430 | #endif |
376 | return QDir::cleanDirPath(x); | 431 | return QDir::cleanDirPath(x); |
377 | } | 432 | } |
378 | 433 | ||
379 | 434 | ||
380 | QString | 435 | QString |
381 | Option::fixPathToTargetOS(const QString& in, bool fix_env, bool canonical) | 436 | Option::fixPathToTargetOS(const QString& in, bool fix_env, bool canonical) |
382 | { | 437 | { |
383 | QString tmp(in); | 438 | QString tmp(in); |
384 | if(fix_env) | 439 | if(fix_env) |
385 | fixEnvVariables(tmp); | 440 | fixEnvVariables(tmp); |
386 | if(canonical) | 441 | if(canonical) |
387 | tmp = fixPath(tmp); | 442 | tmp = fixPath(tmp); |
388 | QString rep; | 443 | QString rep; |
389 | if(Option::target_mode == TARG_MAC9_MODE) | 444 | if(Option::target_mode == TARG_MAC9_MODE) |
390 | rep = "[/\\\\]"; | 445 | tmp = tmp.replace('/', Option::dir_sep).replace('\\', Option::dir_sep); |
391 | else if(Option::target_mode == TARG_WIN_MODE) | 446 | else if(Option::target_mode == TARG_WIN_MODE) |
392 | rep = "[/]"; | 447 | tmp = tmp.replace('/', Option::dir_sep); |
393 | else | 448 | else |
394 | rep = "[\\\\]"; | 449 | tmp = tmp.replace('\\', Option::dir_sep); |
395 | return tmp.replace(QRegExp(rep), Option::dir_sep); | 450 | return tmp; |
396 | } | 451 | } |
397 | 452 | ||
398 | QString | 453 | QString |
399 | Option::fixPathToLocalOS(const QString& in, bool fix_env, bool canonical) | 454 | Option::fixPathToLocalOS(const QString& in, bool fix_env, bool canonical) |
400 | { | 455 | { |
401 | QString tmp(in); | 456 | QString tmp(in); |
402 | if(fix_env) | 457 | if(fix_env) |
403 | fixEnvVariables(tmp); | 458 | fixEnvVariables(tmp); |
404 | if(canonical) | 459 | if(canonical) |
405 | tmp = fixPath(tmp); | 460 | tmp = fixPath(tmp); |
406 | #if defined(Q_OS_WIN32) | 461 | #if defined(Q_OS_WIN32) |
407 | return tmp.replace('/', '\\'); | 462 | return tmp.replace('/', '\\'); |
408 | #else | 463 | #else |
409 | return tmp.replace('\\', '/'); | 464 | return tmp.replace('\\', '/'); |
410 | #endif | 465 | #endif |
411 | } | 466 | } |
diff --git a/qmake/option.h b/qmake/option.h index 9a5a85a..8bd348e 100644 --- a/qmake/option.h +++ b/qmake/option.h | |||
@@ -30,33 +30,33 @@ | |||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __OPTION_H__ | 37 | #ifndef __OPTION_H__ |
38 | #define __OPTION_H__ | 38 | #define __OPTION_H__ |
39 | 39 | ||
40 | #include "project.h" | 40 | #include "project.h" |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qstringlist.h> | 42 | #include <qstringlist.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | 44 | ||
45 | #define QMAKE_VERSION_MAJOR 1 | 45 | #define QMAKE_VERSION_MAJOR 1 |
46 | #define QMAKE_VERSION_MINOR 4 | 46 | #define QMAKE_VERSION_MINOR 5 |
47 | #define QMAKE_VERSION_PATCH 0 | 47 | #define QMAKE_VERSION_PATCH 0 |
48 | const char *qmake_version(); | 48 | const char *qmake_version(); |
49 | 49 | ||
50 | void fixEnvVariables(QString &x); | 50 | void fixEnvVariables(QString &x); |
51 | void debug_msg(int level, const char *fmt, ...); | 51 | void debug_msg(int level, const char *fmt, ...); |
52 | enum QMakeWarn { | 52 | enum QMakeWarn { |
53 | WarnNone = 0x00, | 53 | WarnNone = 0x00, |
54 | WarnParser = 0x01, | 54 | WarnParser = 0x01, |
55 | WarnLogic = 0x02, | 55 | WarnLogic = 0x02, |
56 | WarnAll = 0xFF | 56 | WarnAll = 0xFF |
57 | }; | 57 | }; |
58 | void warn_msg(QMakeWarn t, const char *fmt, ...); | 58 | void warn_msg(QMakeWarn t, const char *fmt, ...); |
59 | 59 | ||
60 | struct Option | 60 | struct Option |
61 | { | 61 | { |
62 | //simply global convenience | 62 | //simply global convenience |
@@ -103,20 +103,23 @@ struct Option | |||
103 | static QStringList project_dirs; | 103 | static QStringList project_dirs; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | //QMAKE_GENERATE_MAKEFILE options | 106 | //QMAKE_GENERATE_MAKEFILE options |
107 | struct mkfile { | 107 | struct mkfile { |
108 | static QString qmakespec; | 108 | static QString qmakespec; |
109 | static bool do_cache; | 109 | static bool do_cache; |
110 | static bool do_deps; | 110 | static bool do_deps; |
111 | static bool do_mocs; | 111 | static bool do_mocs; |
112 | static bool do_dep_heuristics; | 112 | static bool do_dep_heuristics; |
113 | static bool do_preprocess; | 113 | static bool do_preprocess; |
114 | static QString cachefile; | 114 | static QString cachefile; |
115 | static int cachefile_depth; | 115 | static int cachefile_depth; |
116 | static QStringList project_files; | 116 | static QStringList project_files; |
117 | static QString qmakespec_commandline; | 117 | static QString qmakespec_commandline; |
118 | }; | 118 | }; |
119 | |||
120 | private: | ||
121 | static bool internalParseCommandLine(int, char **, int=0); | ||
119 | }; | 122 | }; |
120 | 123 | ||
121 | 124 | ||
122 | #endif /* __OPTION_H__ */ | 125 | #endif /* __OPTION_H__ */ |
diff --git a/qmake/project.cpp b/qmake/project.cpp index 44eb503..834823d 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp | |||
@@ -53,35 +53,40 @@ | |||
53 | #else | 53 | #else |
54 | #define QT_POPEN popen | 54 | #define QT_POPEN popen |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | struct parser_info { | 57 | struct parser_info { |
58 | QString file; | 58 | QString file; |
59 | int line_no; | 59 | int line_no; |
60 | } parser; | 60 | } parser; |
61 | static void qmake_error_msg(const char *msg) | 61 | static void qmake_error_msg(const char *msg) |
62 | { | 62 | { |
63 | fprintf(stderr, "%s:%d: %s\n", parser.file.latin1(), parser.line_no, msg); | 63 | fprintf(stderr, "%s:%d: %s\n", parser.file.latin1(), parser.line_no, msg); |
64 | } | 64 | } |
65 | 65 | ||
66 | static QString varMap(const QString &x) | 66 | static QString varMap(const QString &x) |
67 | { | 67 | { |
68 | QString ret(x); | 68 | QString ret(x); |
69 | ret.replace(QRegExp("^TMAKE"), "QMAKE"); | 69 | if(ret.startsWith("TMAKE")) //tmake no more! |
70 | ret = "QMAKE" + ret.mid(5); | ||
70 | if(ret == "INTERFACES") | 71 | if(ret == "INTERFACES") |
71 | ret = "FORMS"; | 72 | ret = "FORMS"; |
73 | if(ret == "QMAKE_POST_BUILD") | ||
74 | ret = "QMAKE_POST_LINK"; | ||
75 | if(ret == "TARGETDEPS") | ||
76 | ret = "POST_TARGETDEPS"; | ||
72 | return ret; | 77 | return ret; |
73 | } | 78 | } |
74 | 79 | ||
75 | static QStringList split_arg_list(const QString ¶ms) | 80 | static QStringList split_arg_list(const QString ¶ms) |
76 | { | 81 | { |
77 | QStringList args; | 82 | QStringList args; |
78 | int last = 0, parens = 0; | 83 | int last = 0, parens = 0; |
79 | QChar quote = 0; | 84 | QChar quote = 0; |
80 | for(int x = 0; x < (int)params.length(); x++) { | 85 | for(int x = 0; x < (int)params.length(); x++) { |
81 | if(params[x] == ')') { | 86 | if(params[x] == ')') { |
82 | parens--; | 87 | parens--; |
83 | } else if(params[x] == '(') { | 88 | } else if(params[x] == '(') { |
84 | parens++; | 89 | parens++; |
85 | } else if(params[x] == quote) { | 90 | } else if(params[x] == quote) { |
86 | quote = 0; | 91 | quote = 0; |
87 | } else if(params[x] == '\'' || params[x] == '"') { | 92 | } else if(params[x] == '\'' || params[x] == '"') { |
@@ -93,91 +98,97 @@ static QStringList split_arg_list(const QString ¶ms) | |||
93 | } | 98 | } |
94 | if(last != (int)params.length()) | 99 | if(last != (int)params.length()) |
95 | args << params.mid(last); | 100 | args << params.mid(last); |
96 | return args; | 101 | return args; |
97 | } | 102 | } |
98 | 103 | ||
99 | static QStringList split_value_list(const QString &vals, bool do_semicolon=FALSE) | 104 | static QStringList split_value_list(const QString &vals, bool do_semicolon=FALSE) |
100 | { | 105 | { |
101 | int last = 0; | 106 | int last = 0; |
102 | QStringList ret; | 107 | QStringList ret; |
103 | QValueStack<QChar> quote; | 108 | QValueStack<QChar> quote; |
104 | for(int x = 0; x < (int)vals.length(); x++) { | 109 | for(int x = 0; x < (int)vals.length(); x++) { |
105 | if(!quote.isEmpty() && vals[x] == quote.top()) { | 110 | if(!quote.isEmpty() && vals[x] == quote.top()) { |
106 | quote.pop(); | 111 | quote.pop(); |
107 | } else if(vals[x] == '\'' || vals[x] == '"') { | 112 | } else if(vals[x] == '\'' || vals[x] == '"') { |
108 | quote.push(vals[x]); | 113 | quote.push(vals[x]); |
109 | } else if(quote.isEmpty() && | 114 | } else if(quote.isEmpty() && |
110 | ((do_semicolon && vals[x] == ';') || vals[x] == ' ')) { | 115 | ((do_semicolon && vals[x] == ';') || vals[x] == ' ')) { |
111 | ret << vals.mid(last, x - last); | 116 | ret << vals.mid(last, x - last); |
112 | last = x+1; | 117 | last = x+1; |
113 | } | 118 | } |
114 | } | 119 | } |
115 | if(last != (int)vals.length()) | 120 | if(last != (int)vals.length()) |
116 | ret << vals.mid(last); | 121 | ret << vals.mid(last); |
117 | return ret; | 122 | return ret; |
118 | } | 123 | } |
119 | 124 | ||
120 | QMakeProject::QMakeProject() | 125 | QMakeProject::QMakeProject() |
121 | { | 126 | { |
122 | } | 127 | } |
123 | 128 | ||
124 | bool | 129 | bool |
125 | QMakeProject::parse(QString t, QMap<QString, QStringList> &place) | 130 | QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place) |
126 | { | 131 | { |
127 | QString s = t.simplifyWhiteSpace(); | 132 | QString s = t.simplifyWhiteSpace(); |
128 | s.replace(QRegExp("#.*$"), ""); /* bye comments */ | 133 | int hash_mark = s.find('#'); |
134 | if(hash_mark != -1) //good bye comments | ||
135 | s = s.left(hash_mark); | ||
129 | if(s.isEmpty()) /* blank_line */ | 136 | if(s.isEmpty()) /* blank_line */ |
130 | return TRUE; | 137 | return TRUE; |
131 | 138 | ||
132 | if(s.stripWhiteSpace().left(1) == "}") { | 139 | if(s.stripWhiteSpace().left(1) == "}") { |
133 | debug_msg(1, "Project Parser: %s:%d : Leaving block %d", parser.file.latin1(), | 140 | debug_msg(1, "Project Parser: %s:%d : Leaving block %d", parser.file.latin1(), |
134 | parser.line_no, scope_block); | 141 | parser.line_no, scope_block); |
135 | test_status = ((scope_flag & (0x01 << scope_block)) ? TestFound : TestSeek); | 142 | test_status = ((scope_flag & (0x01 << scope_block)) ? TestFound : TestSeek); |
136 | scope_block--; | 143 | scope_block--; |
137 | s = s.mid(1).stripWhiteSpace(); | 144 | s = s.mid(1).stripWhiteSpace(); |
138 | if(s.isEmpty()) | 145 | if(s.isEmpty()) |
139 | return TRUE; | 146 | return TRUE; |
140 | } | 147 | } |
141 | if(!(scope_flag & (0x01 << scope_block))) { | 148 | if(!(scope_flag & (0x01 << scope_block))) { |
142 | /* adjust scope for each block which appears on a single line */ | 149 | /* adjust scope for each block which appears on a single line */ |
143 | for(int i = (s.contains('{')-s.contains('}')); i; i--) | 150 | for(int i = (s.contains('{')-s.contains('}')); i; i--) |
144 | scope_flag &= ~(0x01 << (++scope_block)); | 151 | scope_flag &= ~(0x01 << (++scope_block)); |
145 | debug_msg(1, "Project Parser: %s:%d : Ignored due to block being false.", | 152 | debug_msg(1, "Project Parser: %s:%d : Ignored due to block being false.", |
146 | parser.file.latin1(), parser.line_no); | 153 | parser.file.latin1(), parser.line_no); |
147 | return TRUE; | 154 | return TRUE; |
148 | } | 155 | } |
149 | 156 | ||
150 | QString scope, var, op; | 157 | QString scope, var, op; |
151 | QStringList val; | 158 | QStringList val; |
152 | #define SKIP_WS(d) while(*d && (*d == ' ' || *d == '\t')) d++ | 159 | #define SKIP_WS(d) while(*d && (*d == ' ' || *d == '\t')) d++ |
153 | const char *d = s.latin1(); | 160 | const char *d = s.latin1(); |
154 | SKIP_WS(d); | 161 | SKIP_WS(d); |
155 | bool scope_failed = FALSE, else_line = FALSE, or_op=FALSE; | 162 | bool scope_failed = FALSE, else_line = FALSE, or_op=FALSE; |
156 | int parens = 0, scope_count=0; | 163 | int parens = 0, scope_count=0; |
157 | while(*d && *d != '=') { | 164 | while(*d) { |
158 | if((*d == '+' || *d == '-' || *d == '*' || *d == '~')) { | 165 | if(!parens) { |
159 | if(*(d+1) == '=') { | 166 | if(*d == '=') |
160 | break; | 167 | break; |
161 | } else if(*(d+1) == ' ') { | 168 | if(*d == '+' || *d == '-' || *d == '*' || *d == '~') { |
162 | const char *k = d + 1; | 169 | if(*(d+1) == '=') { |
163 | SKIP_WS(k); | 170 | break; |
164 | if(*k == '=') { | 171 | } else if(*(d+1) == ' ') { |
165 | QString msg; | 172 | const char *k = d + 1; |
166 | qmake_error_msg(*d + "must be followed immediatly by ="); | 173 | SKIP_WS(k); |
167 | return FALSE; | 174 | if(*k == '=') { |
175 | QString msg; | ||
176 | qmake_error_msg(*d + "must be followed immediately by ="); | ||
177 | return FALSE; | ||
178 | } | ||
168 | } | 179 | } |
169 | } | 180 | } |
170 | } | 181 | } |
171 | 182 | ||
172 | if ( *d == '(' ) | 183 | if ( *d == '(' ) |
173 | ++parens; | 184 | ++parens; |
174 | else if ( *d == ')' ) | 185 | else if ( *d == ')' ) |
175 | --parens; | 186 | --parens; |
176 | 187 | ||
177 | if(!parens && (*d == ':' || *d == '{' || *d == ')' || *d == '|')) { | 188 | if(!parens && (*d == ':' || *d == '{' || *d == ')' || *d == '|')) { |
178 | scope_count++; | 189 | scope_count++; |
179 | scope = var.stripWhiteSpace(); | 190 | scope = var.stripWhiteSpace(); |
180 | if ( *d == ')' ) | 191 | if ( *d == ')' ) |
181 | scope += *d; /* need this */ | 192 | scope += *d; /* need this */ |
182 | var = ""; | 193 | var = ""; |
183 | 194 | ||
@@ -204,33 +215,33 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place) | |||
204 | if(rparen == -1) { | 215 | if(rparen == -1) { |
205 | QCString error; | 216 | QCString error; |
206 | error.sprintf("Function missing right paren: %s ('%s')", | 217 | error.sprintf("Function missing right paren: %s ('%s')", |
207 | comp_scope.latin1(), s.latin1()); | 218 | comp_scope.latin1(), s.latin1()); |
208 | qmake_error_msg(error); | 219 | qmake_error_msg(error); |
209 | return FALSE; | 220 | return FALSE; |
210 | } | 221 | } |
211 | QString func = comp_scope.left(lparen); | 222 | QString func = comp_scope.left(lparen); |
212 | test = doProjectTest(func, comp_scope.mid(lparen+1, rparen - lparen - 1), place); | 223 | test = doProjectTest(func, comp_scope.mid(lparen+1, rparen - lparen - 1), place); |
213 | if ( *d == ')' && !*(d+1) ) { | 224 | if ( *d == ')' && !*(d+1) ) { |
214 | if(invert_test) | 225 | if(invert_test) |
215 | test = !test; | 226 | test = !test; |
216 | test_status = (test ? TestFound : TestSeek); | 227 | test_status = (test ? TestFound : TestSeek); |
217 | return TRUE; /* assume we are done */ | 228 | return TRUE; /* assume we are done */ |
218 | } | 229 | } |
219 | } else { | 230 | } else { |
220 | test = isActiveConfig(comp_scope.stripWhiteSpace()); | 231 | test = isActiveConfig(comp_scope.stripWhiteSpace(), TRUE); |
221 | } | 232 | } |
222 | if(invert_test) | 233 | if(invert_test) |
223 | test = !test; | 234 | test = !test; |
224 | } | 235 | } |
225 | } | 236 | } |
226 | if(!test && !scope_failed) | 237 | if(!test && !scope_failed) |
227 | debug_msg(1, "Project Parser: %s:%d : Test (%s) failed.", parser.file.latin1(), | 238 | debug_msg(1, "Project Parser: %s:%d : Test (%s) failed.", parser.file.latin1(), |
228 | parser.line_no, scope.latin1()); | 239 | parser.line_no, scope.latin1()); |
229 | if(test == or_op) | 240 | if(test == or_op) |
230 | scope_failed = !test; | 241 | scope_failed = !test; |
231 | or_op = (*d == '|'); | 242 | or_op = (*d == '|'); |
232 | if(*d == '{') { /* scoping block */ | 243 | if(*d == '{') { /* scoping block */ |
233 | if(!scope_failed) | 244 | if(!scope_failed) |
234 | scope_flag |= (0x01 << (++scope_block)); | 245 | scope_flag |= (0x01 << (++scope_block)); |
235 | else | 246 | else |
236 | scope_flag &= ~(0x01 << (++scope_block)); | 247 | scope_flag &= ~(0x01 << (++scope_block)); |
@@ -274,33 +285,33 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place) | |||
274 | doVariableReplace(vals, place); | 285 | doVariableReplace(vals, place); |
275 | 286 | ||
276 | var = var.stripWhiteSpace(); | 287 | var = var.stripWhiteSpace(); |
277 | #undef SKIP_WS | 288 | #undef SKIP_WS |
278 | 289 | ||
279 | if(!var.isEmpty() && Option::mkfile::do_preprocess) { | 290 | if(!var.isEmpty() && Option::mkfile::do_preprocess) { |
280 | static QString last_file("*none*"); | 291 | static QString last_file("*none*"); |
281 | if(parser.file != last_file) { | 292 | if(parser.file != last_file) { |
282 | fprintf(stderr, "#file %s:%d\n", parser.file.latin1(), parser.line_no); | 293 | fprintf(stderr, "#file %s:%d\n", parser.file.latin1(), parser.line_no); |
283 | last_file = parser.file; | 294 | last_file = parser.file; |
284 | } | 295 | } |
285 | fprintf(stderr, "%s %s %s\n", var.latin1(), op.latin1(), vals.latin1()); | 296 | fprintf(stderr, "%s %s %s\n", var.latin1(), op.latin1(), vals.latin1()); |
286 | } | 297 | } |
287 | var = varMap(var); //backwards compatability | 298 | var = varMap(var); //backwards compatability |
288 | 299 | ||
289 | /* vallist is the broken up list of values */ | 300 | /* vallist is the broken up list of values */ |
290 | QStringList vallist = split_value_list(vals, (var == "DEPENDPATH" || var == "INCLUDEPATH")); | 301 | QStringList vallist = split_value_list(vals, (var == "DEPENDPATH" || var == "INCLUDEPATH")); |
291 | if(!vallist.grep("=").isEmpty()) | 302 | if(!vallist.grep("=").isEmpty()) |
292 | warn_msg(WarnParser, "Detected possible line continuation: {%s} %s:%d", | 303 | warn_msg(WarnParser, "Detected possible line continuation: {%s} %s:%d", |
293 | var.latin1(), parser.file.latin1(), parser.line_no); | 304 | var.latin1(), parser.file.latin1(), parser.line_no); |
294 | 305 | ||
295 | QStringList &varlist = place[var]; /* varlist is the list in the symbol table */ | 306 | QStringList &varlist = place[var]; /* varlist is the list in the symbol table */ |
296 | debug_msg(1, "Project Parser: %s:%d :%s: :%s: (%s)", parser.file.latin1(), parser.line_no, | 307 | debug_msg(1, "Project Parser: %s:%d :%s: :%s: (%s)", parser.file.latin1(), parser.line_no, |
297 | var.latin1(), op.latin1(), vallist.join(" :: ").latin1()); | 308 | var.latin1(), op.latin1(), vallist.join(" :: ").latin1()); |
298 | 309 | ||
299 | /* now do the operation */ | 310 | /* now do the operation */ |
300 | if(op == "~=") { | 311 | if(op == "~=") { |
301 | if(vallist.count() != 1) { | 312 | if(vallist.count() != 1) { |
302 | qmake_error_msg("~= operator only accepts one right hand paramater ('" + | 313 | qmake_error_msg("~= operator only accepts one right hand paramater ('" + |
303 | s + "')"); | 314 | s + "')"); |
304 | return FALSE; | 315 | return FALSE; |
305 | } | 316 | } |
306 | QString val(vallist.first()); | 317 | QString val(vallist.first()); |
@@ -342,146 +353,147 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place) | |||
342 | if((*valit).isEmpty()) | 353 | if((*valit).isEmpty()) |
343 | continue; | 354 | continue; |
344 | if((op == "*=" && !(*varlist.find((*valit)))) || | 355 | if((op == "*=" && !(*varlist.find((*valit)))) || |
345 | op == "=" || op == "+=") | 356 | op == "=" || op == "+=") |
346 | varlist.append((*valit)); | 357 | varlist.append((*valit)); |
347 | else if(op == "-=") | 358 | else if(op == "-=") |
348 | varlist.remove((*valit)); | 359 | varlist.remove((*valit)); |
349 | } | 360 | } |
350 | } | 361 | } |
351 | if(var == "REQUIRES") /* special case to get communicated to backends! */ | 362 | if(var == "REQUIRES") /* special case to get communicated to backends! */ |
352 | doProjectCheckReqs(vallist, place); | 363 | doProjectCheckReqs(vallist, place); |
353 | 364 | ||
354 | return TRUE; | 365 | return TRUE; |
355 | } | 366 | } |
356 | 367 | ||
357 | bool | 368 | bool |
358 | QMakeProject::read(QString file, QMap<QString, QStringList> &place) | 369 | QMakeProject::read(const QString &file, QMap<QString, QStringList> &place) |
359 | { | 370 | { |
360 | parser_info pi = parser; | 371 | parser_info pi = parser; |
361 | /* scope blocks start at true */ | 372 | /* scope blocks start at true */ |
362 | test_status = TestNone; | 373 | test_status = TestNone; |
363 | scope_flag = 0x01; | 374 | scope_flag = 0x01; |
364 | scope_block = 0; | 375 | scope_block = 0; |
365 | 376 | ||
366 | file = Option::fixPathToLocalOS(file); | 377 | QString filename = Option::fixPathToLocalOS(file); |
367 | doVariableReplace(file, place); | 378 | doVariableReplace(filename, place); |
368 | bool ret = FALSE, using_stdin = FALSE; | 379 | bool ret = FALSE, using_stdin = FALSE; |
369 | QFile qfile; | 380 | QFile qfile; |
370 | if(!strcmp(file, "-")) { | 381 | if(!strcmp(filename, "-")) { |
371 | qfile.setName(""); | 382 | qfile.setName(""); |
372 | ret = qfile.open(IO_ReadOnly, stdin); | 383 | ret = qfile.open(IO_ReadOnly, stdin); |
373 | using_stdin = TRUE; | 384 | using_stdin = TRUE; |
374 | } else { | 385 | } else { |
375 | qfile.setName(file); | 386 | qfile.setName(filename); |
376 | ret = qfile.open(IO_ReadOnly); | 387 | ret = qfile.open(IO_ReadOnly); |
377 | } | 388 | } |
378 | if ( ret ) { | 389 | if ( ret ) { |
379 | QTextStream t( &qfile ); | 390 | QTextStream t( &qfile ); |
380 | QString s, line; | 391 | QString s, line; |
381 | parser.file = file; | 392 | parser.file = filename; |
382 | parser.line_no = 0; | 393 | parser.line_no = 0; |
383 | while ( !t.eof() ) { | 394 | while ( !t.eof() ) { |
384 | parser.line_no++; | 395 | parser.line_no++; |
385 | line = t.readLine().stripWhiteSpace(); | 396 | line = t.readLine().stripWhiteSpace(); |
386 | int prelen = line.length(); | 397 | int prelen = line.length(); |
387 | line.replace(QRegExp("#.*$"), ""); // bye comments | 398 | { |
399 | int hash_mark = line.find('#'); | ||
400 | if(hash_mark != -1) //bye comments | ||
401 | line = line.left(hash_mark); | ||
402 | } | ||
388 | if(!line.isEmpty() && line.right(1) == "\\") { | 403 | if(!line.isEmpty() && line.right(1) == "\\") { |
389 | line.truncate(line.length() - 1); | 404 | line.truncate(line.length() - 1); |
390 | s += line + " "; | 405 | s += line + " "; |
391 | } else if(!line.isEmpty() || (line.isEmpty() && !prelen)) { | 406 | } else if(!line.isEmpty() || (line.isEmpty() && !prelen)) { |
392 | if(s.isEmpty() && line.isEmpty()) | 407 | if(s.isEmpty() && line.isEmpty()) |
393 | continue; | 408 | continue; |
394 | if(!line.isEmpty()) | 409 | if(!line.isEmpty()) |
395 | s += line; | 410 | s += line; |
396 | if(!s.isEmpty()) { | 411 | if(!s.isEmpty()) { |
397 | if(!(ret = parse(s, place))) | 412 | if(!(ret = parse(s, place))) |
398 | break; | 413 | break; |
399 | s = ""; | 414 | s = ""; |
400 | } | 415 | } |
401 | } | 416 | } |
402 | } | 417 | } |
403 | if(!using_stdin) | 418 | if(!using_stdin) |
404 | qfile.close(); | 419 | qfile.close(); |
405 | } | 420 | } |
406 | parser = pi; | 421 | parser = pi; |
407 | return ret; | 422 | return ret; |
408 | } | 423 | } |
409 | 424 | ||
410 | bool | 425 | bool |
411 | QMakeProject::read(QString project, QString) | 426 | QMakeProject::read(const QString &project, const QString &, bool just_project) |
412 | { | 427 | { |
428 | if(just_project) { //nothing more, nothing less | ||
429 | pfile = project; | ||
430 | if(pfile != "-" && !QFile::exists(pfile) && pfile.right(4) != ".pro") | ||
431 | pfile += ".pro"; | ||
432 | return read(pfile, vars); | ||
433 | } | ||
434 | |||
413 | if(cfile.isEmpty()) { | 435 | if(cfile.isEmpty()) { |
414 | // hack to get the Option stuff in there | 436 | // hack to get the Option stuff in there |
415 | base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; | 437 | base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; |
416 | base_vars["QMAKE_EXT_H"] = Option::h_ext; | 438 | base_vars["QMAKE_EXT_H"] = Option::h_ext; |
439 | if(!Option::user_template_prefix.isEmpty()) | ||
440 | base_vars["TEMPLATE_PREFIX"] = Option::user_template_prefix; | ||
417 | 441 | ||
418 | /* parse the cache */ | 442 | /* parse the cache */ |
419 | if(Option::mkfile::do_cache) { | 443 | if(Option::mkfile::do_cache) { |
420 | if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified | 444 | if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified |
421 | QString dir = QDir::convertSeparators(Option::output_dir); | 445 | QString dir = QDir::convertSeparators(Option::output_dir); |
422 | while(!QFile::exists((Option::mkfile::cachefile = dir + | 446 | while(!QFile::exists((Option::mkfile::cachefile = dir + |
423 | QDir::separator() + ".qmake.cache"))) { | 447 | QDir::separator() + ".qmake.cache"))) { |
424 | dir = dir.left(dir.findRev(QDir::separator())); | 448 | dir = dir.left(dir.findRev(QDir::separator())); |
425 | if(dir.isEmpty() || dir.find(QDir::separator()) == -1) { | 449 | if(dir.isEmpty() || dir.find(QDir::separator()) == -1) { |
426 | Option::mkfile::cachefile = ""; | 450 | Option::mkfile::cachefile = ""; |
427 | break; | 451 | break; |
428 | } | 452 | } |
429 | if(Option::mkfile::cachefile_depth == -1) | 453 | if(Option::mkfile::cachefile_depth == -1) |
430 | Option::mkfile::cachefile_depth = 1; | 454 | Option::mkfile::cachefile_depth = 1; |
431 | else | 455 | else |
432 | Option::mkfile::cachefile_depth++; | 456 | Option::mkfile::cachefile_depth++; |
433 | } | 457 | } |
434 | } | 458 | } |
435 | if(!Option::mkfile::cachefile.isEmpty()) { | 459 | if(!Option::mkfile::cachefile.isEmpty()) { |
436 | read(Option::mkfile::cachefile, cache); | 460 | read(Option::mkfile::cachefile, cache); |
437 | if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) | 461 | if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) |
438 | Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); | 462 | Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); |
439 | } | 463 | } |
440 | } | 464 | } |
441 | /* parse mkspec */ | 465 | /* parse mkspec */ |
442 | QStringList mkspec_roots; | 466 | QStringList mkspec_roots; |
443 | /* prefer $QTDIR if it is set */ | 467 | /* prefer $QTDIR if it is set */ |
444 | /* prefer QMAKESPECSDIR -cl */ | 468 | if (getenv("QTDIR")) |
445 | |||
446 | if (getenv("QTDIR")) { | ||
447 | mkspec_roots << getenv("QTDIR"); | 469 | mkspec_roots << getenv("QTDIR"); |
448 | } | ||
449 | mkspec_roots << qInstallPathData(); | 470 | mkspec_roots << qInstallPathData(); |
450 | |||
451 | if (Option::mkfile::qmakespec.isEmpty() && getenv("QMAKESPECSDIR")){ | ||
452 | QString mkspec = QString(getenv("QMAKESPECSDIR")) + QDir::separator() + | ||
453 | QDir::separator() + "default"; | ||
454 | if(QFile::exists(mkspec)) | ||
455 | Option::mkfile::qmakespec = mkspec; | ||
456 | } | ||
457 | |||
458 | if(Option::mkfile::qmakespec.isEmpty()) { | 471 | if(Option::mkfile::qmakespec.isEmpty()) { |
459 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { | 472 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { |
460 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + | 473 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + |
461 | QDir::separator() + "default"; | 474 | QDir::separator() + "default"; |
462 | if(QFile::exists(mkspec)) { | 475 | if(QFile::exists(mkspec)) { |
463 | Option::mkfile::qmakespec = mkspec; | 476 | Option::mkfile::qmakespec = mkspec; |
464 | break; | 477 | break; |
465 | } | 478 | } |
466 | } | 479 | } |
467 | } | 480 | if(Option::mkfile::qmakespec.isEmpty()) { |
468 | 481 | fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n"); | |
469 | if(Option::mkfile::qmakespec.isEmpty()) { | 482 | return FALSE; |
470 | fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n"); | 483 | } |
471 | return FALSE; | ||
472 | } | 484 | } |
473 | 485 | ||
474 | if(QDir::isRelativePath(Option::mkfile::qmakespec)) { | 486 | if(QDir::isRelativePath(Option::mkfile::qmakespec)) { |
475 | bool found_mkspec = FALSE; | 487 | bool found_mkspec = FALSE; |
476 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { | 488 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { |
477 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + | 489 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + |
478 | QDir::separator() + Option::mkfile::qmakespec; | 490 | QDir::separator() + Option::mkfile::qmakespec; |
479 | if(QFile::exists(mkspec)) { | 491 | if(QFile::exists(mkspec)) { |
480 | found_mkspec = TRUE; | 492 | found_mkspec = TRUE; |
481 | Option::mkfile::qmakespec = mkspec; | 493 | Option::mkfile::qmakespec = mkspec; |
482 | break; | 494 | break; |
483 | } | 495 | } |
484 | } | 496 | } |
485 | if(!found_mkspec) { | 497 | if(!found_mkspec) { |
486 | fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n", | 498 | fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n", |
487 | mkspec_roots.join("\n\t").latin1()); | 499 | mkspec_roots.join("\n\t").latin1()); |
@@ -531,142 +543,155 @@ QMakeProject::read(QString project, QString) | |||
531 | for(QStringList::Iterator it = Option::after_user_vars.begin(); | 543 | for(QStringList::Iterator it = Option::after_user_vars.begin(); |
532 | it != Option::after_user_vars.end(); ++it) { | 544 | it != Option::after_user_vars.end(); ++it) { |
533 | if(!parse((*it), vars)) { | 545 | if(!parse((*it), vars)) { |
534 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); | 546 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); |
535 | return FALSE; | 547 | return FALSE; |
536 | } | 548 | } |
537 | parser.line_no++; | 549 | parser.line_no++; |
538 | } | 550 | } |
539 | 551 | ||
540 | /* now let the user override the template from an option.. */ | 552 | /* now let the user override the template from an option.. */ |
541 | if(!Option::user_template.isEmpty()) { | 553 | if(!Option::user_template.isEmpty()) { |
542 | debug_msg(1, "Overriding TEMPLATE (%s) with: %s", vars["TEMPLATE"].first().latin1(), Option::user_template.latin1()); | 554 | debug_msg(1, "Overriding TEMPLATE (%s) with: %s", vars["TEMPLATE"].first().latin1(), Option::user_template.latin1()); |
543 | vars["TEMPLATE"].clear(); | 555 | vars["TEMPLATE"].clear(); |
544 | vars["TEMPLATE"].append(Option::user_template); | 556 | vars["TEMPLATE"].append(Option::user_template); |
545 | } | 557 | } |
546 | 558 | ||
547 | if(vars["TEMPLATE"].isEmpty()) | 559 | QStringList &templ = vars["TEMPLATE"]; |
548 | vars["TEMPLATE"].append(QString("app")); | 560 | if(templ.isEmpty()) |
549 | else | 561 | templ.append(QString("app")); |
550 | vars["TEMPLATE"].first().replace(QRegExp("\\.t$"), ""); | 562 | else if(vars["TEMPLATE"].first().endsWith(".t")) |
551 | if(!Option::user_template_prefix.isEmpty()) | 563 | templ = QStringList(templ.first().left(templ.first().length() - 2)); |
552 | vars["TEMPLATE"].first().prepend(Option::user_template_prefix); | 564 | if ( !Option::user_template_prefix.isEmpty() ) { |
565 | templ.first().prepend(Option::user_template_prefix); | ||
566 | } | ||
553 | 567 | ||
554 | if(vars["TARGET"].isEmpty()) { | 568 | if(vars["TARGET"].isEmpty()) { |
555 | // ### why not simply use: | 569 | // ### why not simply use: |
556 | // QFileInfo fi(pfile); | 570 | // QFileInfo fi(pfile); |
557 | // fi.baseName(); | 571 | // fi.baseName(); |
558 | QString tmp = pfile; | 572 | QString tmp = pfile; |
559 | if(tmp.findRev('/') != -1) | 573 | if(tmp.findRev('/') != -1) |
560 | tmp = tmp.right( tmp.length() - tmp.findRev('/') - 1 ); | 574 | tmp = tmp.right( tmp.length() - tmp.findRev('/') - 1 ); |
561 | if(tmp.findRev('.') != -1) | 575 | if(tmp.findRev('.') != -1) |
562 | tmp = tmp.left(tmp.findRev('.')); | 576 | tmp = tmp.left(tmp.findRev('.')); |
563 | vars["TARGET"].append(tmp); | 577 | vars["TARGET"].append(tmp); |
564 | } | 578 | } |
565 | 579 | ||
566 | QString test_version = getenv("QTESTVERSION"); | 580 | QString test_version = getenv("QTESTVERSION"); |
567 | if (!test_version.isEmpty()) { | 581 | if (!test_version.isEmpty()) { |
568 | QString s = vars["TARGET"].first(); | 582 | QString s = vars["TARGET"].first(); |
569 | if (s == "qt" || s == "qt-mt" || s == "qte" || s == "qte-mt") { | 583 | if (s == "qt" || s == "qt-mt" || s == "qte" || s == "qte-mt") { |
570 | QString &ver = vars["VERSION"].first(); | 584 | QString &ver = vars["VERSION"].first(); |
571 | // fprintf(stderr,"Current QT version number: " + ver + "\n"); | 585 | // fprintf(stderr,"Current QT version number: " + ver + "\n"); |
572 | if (ver != "" && ver != test_version) { | 586 | if (ver != "" && ver != test_version) { |
573 | ver = test_version; | 587 | ver = test_version; |
574 | fprintf(stderr,"Changed QT version number to " + test_version + "!\n"); | 588 | fprintf(stderr,"Changed QT version number to " + test_version + "!\n"); |
575 | } | 589 | } |
576 | } | 590 | } |
577 | } | 591 | } |
578 | return TRUE; | 592 | return TRUE; |
579 | } | 593 | } |
580 | 594 | ||
581 | bool | 595 | bool |
582 | QMakeProject::isActiveConfig(const QString &x) | 596 | QMakeProject::isActiveConfig(const QString &x, bool regex) |
583 | { | 597 | { |
584 | if(x.isEmpty()) | 598 | if(x.isEmpty()) |
585 | return TRUE; | 599 | return TRUE; |
586 | 600 | ||
587 | QRegExp re(x, FALSE, TRUE); | 601 | if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || |
588 | if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || Option::target_mode == Option::TARG_UNIX_MODE) && | 602 | Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix") |
589 | x == "unix") | ||
590 | return TRUE; | 603 | return TRUE; |
591 | else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") | 604 | else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") |
592 | return TRUE; | 605 | return TRUE; |
593 | else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") | 606 | else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") |
594 | return TRUE; | 607 | return TRUE; |
595 | else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") | 608 | else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") |
596 | return TRUE; | 609 | return TRUE; |
597 | else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && | 610 | else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && |
598 | x == "mac") | 611 | x == "mac") |
599 | return TRUE; | 612 | return TRUE; |
600 | else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") | 613 | else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") |
601 | return TRUE; | 614 | return TRUE; |
602 | 615 | ||
603 | 616 | ||
617 | QRegExp re(x, FALSE, TRUE); | ||
604 | QString spec = Option::mkfile::qmakespec.right(Option::mkfile::qmakespec.length() - | 618 | QString spec = Option::mkfile::qmakespec.right(Option::mkfile::qmakespec.length() - |
605 | (Option::mkfile::qmakespec.findRev(QDir::separator())+1)); | 619 | (Option::mkfile::qmakespec.findRev(QDir::separator())+1)); |
606 | if(re.exactMatch(spec)) | 620 | if((regex && re.exactMatch(spec)) || (!regex && spec == x)) |
607 | return TRUE; | 621 | return TRUE; |
608 | #ifdef Q_OS_UNIX | 622 | #ifdef Q_OS_UNIX |
609 | else if(spec == "default") { | 623 | else if(spec == "default") { |
610 | static char *buffer = NULL; | 624 | static char *buffer = NULL; |
611 | if(!buffer) | 625 | if(!buffer) |
612 | buffer = (char *)malloc(1024); | 626 | buffer = (char *)malloc(1024); |
613 | int l = readlink(Option::mkfile::qmakespec, buffer, 1024); | 627 | int l = readlink(Option::mkfile::qmakespec, buffer, 1024); |
614 | if(l != -1) { | 628 | if(l != -1) { |
615 | buffer[l] = '\0'; | 629 | buffer[l] = '\0'; |
616 | QString r = buffer; | 630 | QString r = buffer; |
617 | if(r.findRev('/') != -1) | 631 | if(r.findRev('/') != -1) |
618 | r = r.mid(r.findRev('/') + 1); | 632 | r = r.mid(r.findRev('/') + 1); |
619 | if(re.exactMatch(r)) | 633 | if((regex && re.exactMatch(r)) || (!regex && r == x)) |
620 | return TRUE; | 634 | return TRUE; |
621 | } | 635 | } |
622 | } | 636 | } |
623 | #endif | 637 | #endif |
624 | 638 | ||
625 | 639 | ||
626 | QStringList &configs = vars["CONFIG"]; | 640 | QStringList &configs = vars["CONFIG"]; |
627 | for(QStringList::Iterator it = configs.begin(); it != configs.end(); ++it) { | 641 | for(QStringList::Iterator it = configs.begin(); it != configs.end(); ++it) { |
642 | if((regex && re.exactMatch((*it))) || (!regex && (*it) == x)) | ||
628 | if(re.exactMatch((*it))) | 643 | if(re.exactMatch((*it))) |
629 | return TRUE; | 644 | return TRUE; |
630 | } | 645 | } |
631 | return FALSE; | 646 | return FALSE; |
632 | } | 647 | } |
633 | 648 | ||
634 | bool | 649 | bool |
635 | QMakeProject::doProjectTest(QString func, const QString ¶ms, QMap<QString, QStringList> &place) | 650 | QMakeProject::doProjectTest(const QString& func, const QString ¶ms, QMap<QString, QStringList> &place) |
636 | { | 651 | { |
637 | QStringList args = split_arg_list(params); | 652 | QStringList args = split_arg_list(params); |
638 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { | 653 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { |
639 | QString tmp = (*arit).stripWhiteSpace(); | 654 | QString tmp = (*arit).stripWhiteSpace(); |
640 | if((tmp[0] == '\'' || tmp[0] == '"') && tmp.right(1) == tmp.left(1)) | 655 | if((tmp[0] == '\'' || tmp[0] == '"') && tmp.right(1) == tmp.left(1)) |
641 | tmp = tmp.mid(1, tmp.length() - 2); | 656 | tmp = tmp.mid(1, tmp.length() - 2); |
642 | } | 657 | } |
643 | return doProjectTest(func.stripWhiteSpace(), args, place); | 658 | return doProjectTest(func.stripWhiteSpace(), args, place); |
644 | } | 659 | } |
645 | 660 | ||
646 | bool | 661 | bool |
647 | QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStringList> &place) | 662 | QMakeProject::doProjectTest(const QString& func, QStringList args, QMap<QString, QStringList> &place) |
648 | { | 663 | { |
649 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { | 664 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { |
650 | (*arit) = (*arit).stripWhiteSpace(); // blah, get rid of space | 665 | (*arit) = (*arit).stripWhiteSpace(); // blah, get rid of space |
651 | doVariableReplace((*arit), place); | 666 | doVariableReplace((*arit), place); |
652 | } | 667 | } |
653 | debug_msg(1, "Running project test: %s( %s )", func.latin1(), args.join("::").latin1()); | 668 | debug_msg(1, "Running project test: %s( %s )", func.latin1(), args.join("::").latin1()); |
654 | 669 | ||
655 | if(func == "requires") { | 670 | if(func == "requires") { |
656 | return doProjectCheckReqs(args, place); | 671 | return doProjectCheckReqs(args, place); |
672 | } else if(func == "equals") { | ||
673 | if(args.count() != 2) { | ||
674 | fprintf(stderr, "%s:%d: equals(variable, value) requires two arguments.\n", parser.file.latin1(), | ||
675 | parser.line_no); | ||
676 | return FALSE; | ||
677 | } | ||
678 | QString value = args[1]; | ||
679 | if((value.left(1) == "\"" || value.left(1) == "'") && value.right(1) == value.left(1)) | ||
680 | value = value.mid(1, value.length()-2); | ||
681 | return vars[args[0]].join(" ") == value; | ||
657 | } else if(func == "exists") { | 682 | } else if(func == "exists") { |
658 | if(args.count() != 1) { | 683 | if(args.count() != 1) { |
659 | fprintf(stderr, "%s:%d: exists(file) requires one argument.\n", parser.file.latin1(), | 684 | fprintf(stderr, "%s:%d: exists(file) requires one argument.\n", parser.file.latin1(), |
660 | parser.line_no); | 685 | parser.line_no); |
661 | return FALSE; | 686 | return FALSE; |
662 | } | 687 | } |
663 | QString file = args.first(); | 688 | QString file = args.first(); |
664 | file = Option::fixPathToLocalOS(file); | 689 | file = Option::fixPathToLocalOS(file); |
665 | doVariableReplace(file, place); | 690 | doVariableReplace(file, place); |
666 | 691 | ||
667 | if(QFile::exists(file)) | 692 | if(QFile::exists(file)) |
668 | return TRUE; | 693 | return TRUE; |
669 | //regular expression I guess | 694 | //regular expression I guess |
670 | QString dirstr = QDir::currentDirPath(); | 695 | QString dirstr = QDir::currentDirPath(); |
671 | int slsh = file.findRev(Option::dir_sep); | 696 | int slsh = file.findRev(Option::dir_sep); |
672 | if(slsh != -1) { | 697 | if(slsh != -1) { |
@@ -678,33 +703,33 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin | |||
678 | } else if(func == "system") { | 703 | } else if(func == "system") { |
679 | if(args.count() != 1) { | 704 | if(args.count() != 1) { |
680 | fprintf(stderr, "%s:%d: system(exec) requires one argument.\n", parser.file.latin1(), | 705 | fprintf(stderr, "%s:%d: system(exec) requires one argument.\n", parser.file.latin1(), |
681 | parser.line_no); | 706 | parser.line_no); |
682 | return FALSE; | 707 | return FALSE; |
683 | } | 708 | } |
684 | return system(args.first().latin1()) == 0; | 709 | return system(args.first().latin1()) == 0; |
685 | } else if(func == "contains") { | 710 | } else if(func == "contains") { |
686 | if(args.count() != 2) { | 711 | if(args.count() != 2) { |
687 | fprintf(stderr, "%s:%d: contains(var, val) requires two arguments.\n", parser.file.latin1(), | 712 | fprintf(stderr, "%s:%d: contains(var, val) requires two arguments.\n", parser.file.latin1(), |
688 | parser.line_no); | 713 | parser.line_no); |
689 | return FALSE; | 714 | return FALSE; |
690 | } | 715 | } |
691 | QRegExp regx(args[1]); | 716 | QRegExp regx(args[1]); |
692 | QStringList &l = place[args[0]]; | 717 | QStringList &l = place[args[0]]; |
693 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 718 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
694 | if(regx.exactMatch((*it))) | 719 | if(regx.exactMatch((*it))) |
695 | return TRUE; | 720 | return TRUE; |
696 | } | 721 | } |
697 | return FALSE; | 722 | return FALSE; |
698 | } else if(func == "infile") { | 723 | } else if(func == "infile") { |
699 | if(args.count() < 2 || args.count() > 3) { | 724 | if(args.count() < 2 || args.count() > 3) { |
700 | fprintf(stderr, "%s:%d: infile(file, var, val) requires at least 2 arguments.\n", | 725 | fprintf(stderr, "%s:%d: infile(file, var, val) requires at least 2 arguments.\n", |
701 | parser.file.latin1(), parser.line_no); | 726 | parser.file.latin1(), parser.line_no); |
702 | return FALSE; | 727 | return FALSE; |
703 | } | 728 | } |
704 | QMakeProject proj; | 729 | QMakeProject proj; |
705 | QString file = args[0]; | 730 | QString file = args[0]; |
706 | doVariableReplace(file, place); | 731 | doVariableReplace(file, place); |
707 | fixEnvVariables(file); | 732 | fixEnvVariables(file); |
708 | int di = file.findRev(Option::dir_sep); | 733 | int di = file.findRev(Option::dir_sep); |
709 | QDir sunworkshop42workaround = QDir::current(); | 734 | QDir sunworkshop42workaround = QDir::current(); |
710 | QString oldpwd = sunworkshop42workaround.currentDirPath(); | 735 | QString oldpwd = sunworkshop42workaround.currentDirPath(); |
@@ -792,46 +817,54 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin | |||
792 | } | 817 | } |
793 | } | 818 | } |
794 | if(!found) { | 819 | if(!found) { |
795 | printf("Project LOAD(): Feature %s cannot be found.\n", args.first().latin1()); | 820 | printf("Project LOAD(): Feature %s cannot be found.\n", args.first().latin1()); |
796 | exit(3); | 821 | exit(3); |
797 | } | 822 | } |
798 | } | 823 | } |
799 | } | 824 | } |
800 | } | 825 | } |
801 | 826 | ||
802 | debug_msg(1, "Project Parser: %s'ing file %s.", func.latin1(), file.latin1()); | 827 | debug_msg(1, "Project Parser: %s'ing file %s.", func.latin1(), file.latin1()); |
803 | parser_info pi = parser; | 828 | parser_info pi = parser; |
804 | int sb = scope_block; | 829 | int sb = scope_block; |
805 | int sf = scope_flag; | 830 | int sf = scope_flag; |
806 | TestStatus sc = test_status; | 831 | TestStatus sc = test_status; |
807 | bool r = read(file.latin1(), place); | 832 | bool r = read(file.latin1(), place); |
808 | if(r) | 833 | if(r) |
809 | vars["QMAKE_INTERNAL_INCLUDED_FILES"].append(file); | 834 | vars["QMAKE_INTERNAL_INCLUDED_FILES"].append(file); |
835 | else | ||
836 | warn_msg(WarnParser, "%s:%d: Failure to include file %s.", | ||
837 | pi.file.latin1(), pi.line_no, file.latin1()); | ||
810 | parser = pi; | 838 | parser = pi; |
811 | test_status = sc; | 839 | test_status = sc; |
812 | scope_flag = sf; | 840 | scope_flag = sf; |
813 | scope_block = sb; | 841 | scope_block = sb; |
814 | return r; | 842 | return r; |
815 | } else if(func == "error" || func == "message") { | 843 | } else if(func == "error" || func == "message") { |
816 | if(args.count() != 1) { | 844 | if(args.count() != 1) { |
817 | fprintf(stderr, "%s:%d: %s(message) requires one argument.\n", parser.file.latin1(), | 845 | fprintf(stderr, "%s:%d: %s(message) requires one argument.\n", parser.file.latin1(), |
818 | parser.line_no, func.latin1()); | 846 | parser.line_no, func.latin1()); |
819 | return FALSE; | 847 | return FALSE; |
820 | } | 848 | } |
821 | QString msg = args.first(); | 849 | QString msg = args.first(); |
850 | if((msg.startsWith("\"") || msg.startsWith("'")) && msg.endsWith(msg.left(1))) | ||
851 | msg = msg.mid(1, msg.length()-2); | ||
852 | msg.replace(QString("${QMAKE_FILE}"), parser.file.latin1()); | ||
853 | msg.replace(QString("${QMAKE_LINE_NUMBER}"), QString::number(parser.line_no)); | ||
854 | msg.replace(QString("${QMAKE_DATE}"), QDateTime::currentDateTime().toString()); | ||
822 | doVariableReplace(msg, place); | 855 | doVariableReplace(msg, place); |
823 | fixEnvVariables(msg); | 856 | fixEnvVariables(msg); |
824 | printf("Project %s: %s\n", func.upper().latin1(), msg.latin1()); | 857 | printf("Project %s: %s\n", func.upper().latin1(), msg.latin1()); |
825 | if(func == "message") | 858 | if(func == "message") |
826 | return TRUE; | 859 | return TRUE; |
827 | exit(2); | 860 | exit(2); |
828 | } else { | 861 | } else { |
829 | fprintf(stderr, "%s:%d: Unknown test function: %s\n", parser.file.latin1(), parser.line_no, | 862 | fprintf(stderr, "%s:%d: Unknown test function: %s\n", parser.file.latin1(), parser.line_no, |
830 | func.latin1()); | 863 | func.latin1()); |
831 | } | 864 | } |
832 | return FALSE; | 865 | return FALSE; |
833 | } | 866 | } |
834 | 867 | ||
835 | bool | 868 | bool |
836 | QMakeProject::doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place) | 869 | QMakeProject::doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place) |
837 | { | 870 | { |
@@ -844,151 +877,201 @@ QMakeProject::doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringL | |||
844 | if(invert_test) | 877 | if(invert_test) |
845 | chk = chk.right(chk.length() - 1); | 878 | chk = chk.right(chk.length() - 1); |
846 | 879 | ||
847 | bool test; | 880 | bool test; |
848 | int lparen = chk.find('('); | 881 | int lparen = chk.find('('); |
849 | if(lparen != -1) { /* if there is an lparen in the chk, it IS a function */ | 882 | if(lparen != -1) { /* if there is an lparen in the chk, it IS a function */ |
850 | int rparen = chk.findRev(')'); | 883 | int rparen = chk.findRev(')'); |
851 | if(rparen == -1) { | 884 | if(rparen == -1) { |
852 | QCString error; | 885 | QCString error; |
853 | error.sprintf("Function (in REQUIRES) missing right paren: %s", chk.latin1()); | 886 | error.sprintf("Function (in REQUIRES) missing right paren: %s", chk.latin1()); |
854 | qmake_error_msg(error); | 887 | qmake_error_msg(error); |
855 | } else { | 888 | } else { |
856 | QString func = chk.left(lparen); | 889 | QString func = chk.left(lparen); |
857 | test = doProjectTest(func, chk.mid(lparen+1, rparen - lparen - 1), place); | 890 | test = doProjectTest(func, chk.mid(lparen+1, rparen - lparen - 1), place); |
858 | } | 891 | } |
859 | } else { | 892 | } else { |
860 | test = isActiveConfig(chk); | 893 | test = isActiveConfig(chk, TRUE); |
861 | } | 894 | } |
862 | if(invert_test) { | 895 | if(invert_test) { |
863 | chk.prepend("!"); | 896 | chk.prepend("!"); |
864 | test = !test; | 897 | test = !test; |
865 | } | 898 | } |
866 | if(!test) { | 899 | if(!test) { |
867 | debug_msg(1, "Project Parser: %s:%d Failed test: REQUIRES = %s", | 900 | debug_msg(1, "Project Parser: %s:%d Failed test: REQUIRES = %s", |
868 | parser.file.latin1(), parser.line_no, chk.latin1()); | 901 | parser.file.latin1(), parser.line_no, chk.latin1()); |
869 | place["QMAKE_FAILED_REQUIREMENTS"].append(chk); | 902 | place["QMAKE_FAILED_REQUIREMENTS"].append(chk); |
870 | ret = FALSE; | 903 | ret = FALSE; |
871 | } | 904 | } |
872 | } | 905 | } |
873 | return ret; | 906 | return ret; |
874 | } | 907 | } |
875 | 908 | ||
876 | 909 | ||
877 | QString | 910 | QString |
878 | QMakeProject::doVariableReplace(QString &str, const QMap<QString, QStringList> &place) | 911 | QMakeProject::doVariableReplace(QString &str, const QMap<QString, QStringList> &place) |
879 | { | 912 | { |
880 | for(int x = 0, rep; x < 5; x++) { | 913 | for(int var_begin, var_last=0; (var_begin = str.find("$$", var_last)) != -1; var_last = var_begin) { |
881 | QRegExp reg_var; | 914 | if(var_begin >= int( str.length() + 2 ) ) { |
882 | reg_var.setMinimal(TRUE); | 915 | break; |
883 | if( x == 0 ) //function blocked out by {}'s | 916 | } else if(var_begin != 0 && str[var_begin-1] == '\\') { |
884 | reg_var = QRegExp("\\$\\$\\{([a-zA-Z0-9_]*)\\((\\(.|(.*)\\)*)\\)\\}"); | 917 | str.replace(var_begin-1, 1, ""); |
885 | else if( x == 1 ) //variables blocked out by {}'s | 918 | var_begin += 1; |
886 | reg_var = QRegExp("\\$\\$\\{([a-zA-Z0-9_\\.-]*)\\}"); | 919 | continue; |
887 | else if(x == 2) //environment | 920 | } |
888 | reg_var = QRegExp("\\$\\$\\(([a-zA-Z0-9_\\.-]*)\\)"); | 921 | |
889 | else if(x == 3) //function | 922 | int var_incr = var_begin + 2; |
890 | reg_var = QRegExp("\\$\\$([a-zA-Z0-9_]*)\\((\\(.|(.*)\\)*)\\)"); | 923 | bool in_braces = FALSE, as_env = FALSE; |
891 | else if(x == 4) //normal variable | 924 | if(str[var_incr] == '{') { |
892 | reg_var = QRegExp("\\$\\$([a-zA-Z0-9_\\.-]*)"); | 925 | in_braces = TRUE; |
893 | while((rep = reg_var.search(str)) != -1) { | 926 | var_incr++; |
894 | QString replacement; | 927 | while(var_incr < int( str.length() ) && |
895 | if(x == 2) {//environment | 928 | (str[var_incr] == ' ' || str[var_incr] == '\t' || str[var_incr] == '\n')) |
896 | replacement = getenv(reg_var.cap(1)); | 929 | var_incr++; |
897 | } else if(x == 0 || x == 3) { //function | 930 | } |
898 | QStringList args = split_arg_list(reg_var.cap(2)); | 931 | if(str[var_incr] == '(') { |
899 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { | 932 | as_env = TRUE; |
900 | (*arit) = (*arit).stripWhiteSpace(); // blah, get rid of space | 933 | var_incr++; |
901 | doVariableReplace((*arit), place); | 934 | } |
902 | } | 935 | QString val, args; |
903 | debug_msg(1, "Running function: %s( %s )", reg_var.cap(1).latin1(), args.join("::").latin1()); | 936 | while(var_incr < int( str.length() ) && |
904 | if(reg_var.cap(1).lower() == "member") { | 937 | (str[var_incr].isLetter() || str[var_incr].isNumber() || str[var_incr] == '.' || str[var_incr] == '_')) |
905 | if(args.count() < 1 || args.count() > 2) { | 938 | val += str[var_incr++]; |
906 | fprintf(stderr, "%s:%d: member(var, place) requires two arguments.\n", | 939 | if(as_env) { |
907 | parser.file.latin1(), parser.line_no); | 940 | if(str[var_incr] != ')') { |
908 | } else { | 941 | var_incr++; |
909 | uint pos = 0; | 942 | warn_msg(WarnParser, "%s:%d: Unterminated env-variable replacement '%s' (%s)", |
910 | if(args.count() == 2) | 943 | parser.file.latin1(), parser.line_no, |
911 | pos = args[1].toInt(); | 944 | str.mid(var_begin, QMAX(var_incr - var_begin, int(str.length()))).latin1(), str.latin1()); |
912 | const QStringList &var = place[varMap(args.first())]; | 945 | var_begin += var_incr; |
913 | if(var.count() >= pos) | 946 | continue; |
914 | replacement = var[pos]; | 947 | } |
915 | } | 948 | var_incr++; |
916 | } else if(reg_var.cap(1).lower() == "list") { | 949 | } else if(str[var_incr] == '(') { //args |
917 | if(args.count() != 1) { | 950 | for(int parens = 0; var_incr < int( str.length() ); var_incr++) { |
918 | fprintf(stderr, "%s:%d: list(vals) requires one" | 951 | if(str[var_incr] == '(') { |
919 | "argument.\n", parser.file.latin1(), parser.line_no); | 952 | parens++; |
920 | } else { | 953 | if(parens == 1) |
921 | static int x = 0; | 954 | continue; |
922 | replacement.sprintf(".QMAKE_INTERNAL_TMP_VAR_%d", x++); | 955 | } else if(str[var_incr] == ')') { |
923 | (*((QMap<QString, QStringList>*)&place))[replacement] = split_value_list(args.first()); | 956 | parens--; |
924 | } | 957 | if(!parens) { |
925 | } else if(reg_var.cap(1).lower() == "join") { | 958 | var_incr++; |
926 | if(args.count() < 1 || args.count() > 4) { | 959 | break; |
927 | fprintf(stderr, "%s:%d: join(var, glue, before, after) requires four" | ||
928 | "arguments.\n", parser.file.latin1(), parser.line_no); | ||
929 | } else { | ||
930 | QString glue, before, after; | ||
931 | if(args.count() >= 2) | ||
932 | glue = args[1].replace("\"", "" ); | ||
933 | if(args.count() >= 3) | ||
934 | before = args[2].replace("\"", "" ); | ||
935 | if(args.count() == 4) | ||
936 | after = args[3].replace("\"", "" ); | ||
937 | const QStringList &var = place[varMap(args.first())]; | ||
938 | if(!var.isEmpty()) | ||
939 | replacement = before + var.join(glue) + after; | ||
940 | } | 960 | } |
941 | } else if(reg_var.cap(1).lower() == "find") { | 961 | } |
942 | if(args.count() != 2) { | 962 | args += str[var_incr]; |
943 | fprintf(stderr, "%s:%d find(var, str) requires two arguments\n", | 963 | } |
944 | parser.file.latin1(), parser.line_no); | 964 | } |
945 | } else { | 965 | if(var_incr > int( str.length() ) || (in_braces && str[var_incr] != '}')) { |
946 | QRegExp regx(args[1]); | 966 | var_incr++; |
947 | const QStringList &var = place[varMap(args.first())]; | 967 | warn_msg(WarnParser, "%s:%d: Unterminated variable replacement '%s' (%s)", |
948 | for(QStringList::ConstIterator vit = var.begin(); | 968 | parser.file.latin1(), parser.line_no, |
949 | vit != var.end(); ++vit) { | 969 | str.mid(var_begin, QMAX(var_incr - var_begin, int( str.length() ))).latin1(), str.latin1()); |
950 | if(regx.search(*vit) != -1) { | 970 | var_begin += var_incr; |
951 | if(!replacement.isEmpty()) | 971 | continue; |
952 | replacement += " "; | 972 | } else if(in_braces) { |
953 | replacement += (*vit); | 973 | var_incr++; |
954 | } | 974 | } |
975 | |||
976 | QString replacement; | ||
977 | if(as_env) { | ||
978 | replacement = getenv(val); | ||
979 | } else if(args.isEmpty()) { | ||
980 | if(val.left(1) == ".") | ||
981 | replacement = ""; | ||
982 | else if(val == "LITERAL_WHITESPACE") | ||
983 | replacement = "\t"; | ||
984 | else | ||
985 | replacement = place[varMap(val)].join(" "); | ||
986 | } else { | ||
987 | QStringList arg_list = split_arg_list(args); | ||
988 | for(QStringList::Iterator arit = arg_list.begin(); arit != arg_list.end(); ++arit) { | ||
989 | (*arit) = (*arit).stripWhiteSpace(); // blah, get rid of space | ||
990 | doVariableReplace((*arit), place); | ||
991 | } | ||
992 | debug_msg(1, "Running function: %s( %s )", val.latin1(), arg_list.join("::").latin1()); | ||
993 | if(val.lower() == "member") { | ||
994 | if(arg_list.count() < 1 || arg_list.count() > 2) { | ||
995 | fprintf(stderr, "%s:%d: member(var, place) requires two arguments.\n", | ||
996 | parser.file.latin1(), parser.line_no); | ||
997 | } else { | ||
998 | uint pos = 0; | ||
999 | if(arg_list.count() == 2) | ||
1000 | pos = arg_list[1].toInt(); | ||
1001 | const QStringList &var = place[varMap(arg_list.first())]; | ||
1002 | if(var.count() >= pos) | ||
1003 | replacement = var[pos]; | ||
1004 | } | ||
1005 | } else if(val.lower() == "list") { | ||
1006 | static int x = 0; | ||
1007 | replacement.sprintf(".QMAKE_INTERNAL_TMP_VAR_%d", x++); | ||
1008 | QStringList &lst = (*((QMap<QString, QStringList>*)&place))[replacement]; | ||
1009 | lst.clear(); | ||
1010 | for(QStringList::ConstIterator arg_it = arg_list.begin(); | ||
1011 | arg_it != arg_list.end(); ++arg_it) | ||
1012 | lst += split_value_list((*arg_it)); | ||
1013 | } else if(val.lower() == "join") { | ||
1014 | if(arg_list.count() < 1 || arg_list.count() > 4) { | ||
1015 | fprintf(stderr, "%s:%d: join(var, glue, before, after) requires four" | ||
1016 | "arguments.\n", parser.file.latin1(), parser.line_no); | ||
1017 | } else { | ||
1018 | QString glue, before, after; | ||
1019 | if(arg_list.count() >= 2) | ||
1020 | glue = arg_list[1].replace("\"", "" ); | ||
1021 | if(arg_list.count() >= 3) | ||
1022 | before = arg_list[2].replace("\"", "" ); | ||
1023 | if(arg_list.count() == 4) | ||
1024 | after = arg_list[3].replace("\"", "" ); | ||
1025 | const QStringList &var = place[varMap(arg_list.first())]; | ||
1026 | if(!var.isEmpty()) | ||
1027 | replacement = before + var.join(glue) + after; | ||
1028 | } | ||
1029 | } else if(val.lower() == "find") { | ||
1030 | if(arg_list.count() != 2) { | ||
1031 | fprintf(stderr, "%s:%d find(var, str) requires two arguments\n", | ||
1032 | parser.file.latin1(), parser.line_no); | ||
1033 | } else { | ||
1034 | QRegExp regx(arg_list[1]); | ||
1035 | const QStringList &var = place[varMap(arg_list.first())]; | ||
1036 | for(QStringList::ConstIterator vit = var.begin(); | ||
1037 | vit != var.end(); ++vit) { | ||
1038 | if(regx.search(*vit) != -1) { | ||
1039 | if(!replacement.isEmpty()) | ||
1040 | replacement += " "; | ||
1041 | replacement += (*vit); | ||
955 | } | 1042 | } |
956 | } | 1043 | } |
957 | } else if(reg_var.cap(1).lower() == "system") { | 1044 | } |
958 | if(args.count() != 1) { | 1045 | } else if(val.lower() == "system") { |
959 | fprintf(stderr, "%s:%d system(execut) requires one argument\n", | 1046 | if(arg_list.count() != 1) { |
960 | parser.file.latin1(), parser.line_no); | 1047 | fprintf(stderr, "%s:%d system(execut) requires one argument\n", |
961 | } else { | 1048 | parser.file.latin1(), parser.line_no); |
962 | char buff[256]; | 1049 | } else { |
963 | FILE *proc = QT_POPEN(args.join(" ").latin1(), "r"); | 1050 | char buff[256]; |
964 | while(proc && !feof(proc)) { | 1051 | FILE *proc = QT_POPEN(arg_list.join(" ").latin1(), "r"); |
965 | int read_in = fread(buff, 1, 255, proc); | 1052 | while(proc && !feof(proc)) { |
966 | if(!read_in) | 1053 | int read_in = fread(buff, 1, 255, proc); |
967 | break; | 1054 | if(!read_in) |
968 | for(int i = 0; i < read_in; i++) { | 1055 | break; |
969 | if(buff[i] == '\n' || buff[i] == '\t') | 1056 | for(int i = 0; i < read_in; i++) { |
970 | buff[i] = ' '; | 1057 | if(buff[i] == '\n' || buff[i] == '\t') |
971 | } | 1058 | buff[i] = ' '; |
972 | buff[read_in] = '\0'; | ||
973 | replacement += buff; | ||
974 | } | 1059 | } |
1060 | buff[read_in] = '\0'; | ||
1061 | replacement += buff; | ||
975 | } | 1062 | } |
976 | } else { | ||
977 | fprintf(stderr, "%s:%d: Unknown replace function: %s\n", | ||
978 | parser.file.latin1(), parser.line_no, reg_var.cap(1).latin1()); | ||
979 | } | 1063 | } |
980 | } else { //variable | 1064 | } else { |
981 | if(reg_var.cap(1).left(1) == ".") | 1065 | fprintf(stderr, "%s:%d: Unknown replace function: %s\n", |
982 | replacement = ""; | 1066 | parser.file.latin1(), parser.line_no, val.latin1()); |
983 | else if(reg_var.cap(1) == "LITERAL_WHITESPACE") | ||
984 | replacement = "\t"; | ||
985 | else | ||
986 | replacement = place[varMap(reg_var.cap(1))].join(" "); | ||
987 | } | 1067 | } |
988 | debug_msg(2, "Project parser: %d (%s) :: %s -> %s", x, str.latin1(), | ||
989 | reg_var.capturedTexts().join("::").latin1(), replacement.latin1()); | ||
990 | str.replace(rep, reg_var.matchedLength(), replacement); | ||
991 | } | 1068 | } |
1069 | //actually do replacement now.. | ||
1070 | int mlen = var_incr - var_begin; | ||
1071 | debug_msg(2, "Project Parser [var replace]: '%s' :: %s -> %s", str.latin1(), | ||
1072 | str.mid(var_begin, mlen).latin1(), replacement.latin1()); | ||
1073 | str.replace(var_begin, mlen, replacement); | ||
1074 | var_begin += replacement.length(); | ||
992 | } | 1075 | } |
993 | return str; | 1076 | return str; |
994 | } | 1077 | } |
diff --git a/qmake/project.h b/qmake/project.h index 201e63c..ec19f0c 100644 --- a/qmake/project.h +++ b/qmake/project.h | |||
@@ -1,88 +1,88 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #ifndef __QMAKE_H__ | 37 | #ifndef __PROJECT_H__ |
38 | #define __QMAKE_H__ | 38 | #define __PROJECT_H__ |
39 | 39 | ||
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qmap.h> | 42 | #include <qmap.h> |
43 | 43 | ||
44 | class QMakeProject | 44 | class QMakeProject |
45 | { | 45 | { |
46 | enum TestStatus { TestNone, TestFound, TestSeek } test_status; | 46 | enum TestStatus { TestNone, TestFound, TestSeek } test_status; |
47 | int scope_block, scope_flag; | 47 | int scope_block, scope_flag; |
48 | 48 | ||
49 | QString pfile, cfile; | 49 | QString pfile, cfile; |
50 | QMap<QString, QStringList> vars, base_vars, cache; | 50 | QMap<QString, QStringList> vars, base_vars, cache; |
51 | bool parse(QString text, QMap<QString, QStringList> &place); | 51 | bool parse(const QString &text, QMap<QString, QStringList> &place); |
52 | bool doProjectTest(QString func, const QString ¶ms, QMap<QString, QStringList> &place); | 52 | bool doProjectTest(const QString &func, const QString ¶ms, QMap<QString, QStringList> &place); |
53 | bool doProjectTest(QString func, QStringList args, QMap<QString, QStringList> &place); | 53 | bool doProjectTest(const QString &func, QStringList args, QMap<QString, QStringList> &place); |
54 | bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place); | 54 | bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place); |
55 | QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place); | 55 | QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place); |
56 | 56 | ||
57 | public: | 57 | public: |
58 | QMakeProject(); | 58 | QMakeProject(); |
59 | 59 | ||
60 | bool read(QString project, QString pwd); | 60 | bool read(const QString &project, const QString &pwd, bool just_project=FALSE); |
61 | QString projectFile(); | 61 | QString projectFile(); |
62 | QString configFile(); | 62 | QString configFile(); |
63 | 63 | ||
64 | bool isEmpty(const QString &v); | 64 | bool isEmpty(const QString &v); |
65 | QStringList &values(const QString &v); | 65 | QStringList &values(const QString &v); |
66 | QString first(const QString &v); | 66 | QString first(const QString &v); |
67 | QMap<QString, QStringList> &variables(); | 67 | QMap<QString, QStringList> &variables(); |
68 | bool isActiveConfig(const QString &x); | 68 | bool isActiveConfig(const QString &x, bool regex=FALSE); |
69 | 69 | ||
70 | protected: | 70 | protected: |
71 | friend class MakefileGenerator; | 71 | friend class MakefileGenerator; |
72 | bool read(QString file, QMap<QString, QStringList> &place); | 72 | bool read(const QString &file, QMap<QString, QStringList> &place); |
73 | 73 | ||
74 | }; | 74 | }; |
75 | 75 | ||
76 | inline QString QMakeProject::projectFile() | 76 | inline QString QMakeProject::projectFile() |
77 | { | 77 | { |
78 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) | 78 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) |
79 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 | 79 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 |
80 | if (pfile == "-") | 80 | if (pfile == "-") |
81 | return QString("(stdin)"); | 81 | return QString("(stdin)"); |
82 | else | 82 | else |
83 | return pfile; | 83 | return pfile; |
84 | #else | 84 | #else |
85 | return pfile == "-" ? QString("(stdin)") : pfile; | 85 | return pfile == "-" ? QString("(stdin)") : pfile; |
86 | #endif | 86 | #endif |
87 | } | 87 | } |
88 | 88 | ||
@@ -98,17 +98,17 @@ inline QStringList &QMakeProject::values(const QString &v) | |||
98 | inline QString QMakeProject::first(const QString &v) | 98 | inline QString QMakeProject::first(const QString &v) |
99 | { | 99 | { |
100 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) | 100 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) |
101 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 | 101 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 |
102 | if (isEmpty(v)) | 102 | if (isEmpty(v)) |
103 | return QString(""); | 103 | return QString(""); |
104 | else | 104 | else |
105 | return vars[v].first(); | 105 | return vars[v].first(); |
106 | #else | 106 | #else |
107 | return isEmpty(v) ? QString("") : vars[v].first(); | 107 | return isEmpty(v) ? QString("") : vars[v].first(); |
108 | #endif | 108 | #endif |
109 | } | 109 | } |
110 | 110 | ||
111 | inline QMap<QString, QStringList> &QMakeProject::variables() | 111 | inline QMap<QString, QStringList> &QMakeProject::variables() |
112 | { return vars; } | 112 | { return vars; } |
113 | 113 | ||
114 | #endif /* __QMAKE_H__ */ | 114 | #endif /* __PROJECT_H__ */ |
diff --git a/qmake/tools/qbitarray.cpp b/qmake/tools/qbitarray.cpp index 4f4e14b..1aaf963 100644 --- a/qmake/tools/qbitarray.cpp +++ b/qmake/tools/qbitarray.cpp | |||
@@ -184,33 +184,34 @@ void QBitArray::pad0() | |||
184 | uint sz = size(); | 184 | uint sz = size(); |
185 | if ( sz && sz%8 ) | 185 | if ( sz && sz%8 ) |
186 | *(data()+sz/8) &= (1 << (sz%8)) - 1; | 186 | *(data()+sz/8) &= (1 << (sz%8)) - 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | /*! | 190 | /*! |
191 | \fn uint QBitArray::size() const | 191 | \fn uint QBitArray::size() const |
192 | 192 | ||
193 | Returns the bit array's size (number of bits). | 193 | Returns the bit array's size (number of bits). |
194 | 194 | ||
195 | \sa resize() | 195 | \sa resize() |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! | 198 | /*! |
199 | Resizes the bit array to \a size bits and returns TRUE if the bit | 199 | Resizes the bit array to \a size bits and returns TRUE if the bit |
200 | array could be resized; otherwise returns FALSE. | 200 | array could be resized; otherwise returns FALSE. The array becomes |
201 | a null array if \a size == 0. | ||
201 | 202 | ||
202 | If the array is expanded, the new bits are set to 0. | 203 | If the array is expanded, the new bits are set to 0. |
203 | 204 | ||
204 | \sa size() | 205 | \sa size() |
205 | */ | 206 | */ |
206 | 207 | ||
207 | bool QBitArray::resize( uint size ) | 208 | bool QBitArray::resize( uint size ) |
208 | { | 209 | { |
209 | uint s = this->size(); | 210 | uint s = this->size(); |
210 | if ( !QByteArray::resize( (size+7)/8 ) ) | 211 | if ( !QByteArray::resize( (size+7)/8 ) ) |
211 | return FALSE; // cannot resize | 212 | return FALSE; // cannot resize |
212 | SHBLOCK->nbits = size; | 213 | SHBLOCK->nbits = size; |
213 | if ( size != 0 ) { // not null array | 214 | if ( size != 0 ) { // not null array |
214 | int ds = (int)(size+7)/8 - (int)(s+7)/8;// number of bytes difference | 215 | int ds = (int)(size+7)/8 - (int)(s+7)/8;// number of bytes difference |
215 | if ( ds > 0 ) // expanding array | 216 | if ( ds > 0 ) // expanding array |
216 | memset( data() + (s+7)/8, 0, ds );// reset new data | 217 | memset( data() + (s+7)/8, 0, ds );// reset new data |
diff --git a/qmake/tools/qbuffer.cpp b/qmake/tools/qbuffer.cpp index b213dd9..0fc90e4 100644 --- a/qmake/tools/qbuffer.cpp +++ b/qmake/tools/qbuffer.cpp | |||
@@ -183,34 +183,34 @@ bool QBuffer::setBuffer( QByteArray buf ) | |||
183 | \i \c IO_Truncate truncates the buffer. | 183 | \i \c IO_Truncate truncates the buffer. |
184 | \endlist | 184 | \endlist |
185 | 185 | ||
186 | \sa close(), isOpen() | 186 | \sa close(), isOpen() |
187 | */ | 187 | */ |
188 | 188 | ||
189 | bool QBuffer::open( int m ) | 189 | bool QBuffer::open( int m ) |
190 | { | 190 | { |
191 | if ( isOpen() ) { // buffer already open | 191 | if ( isOpen() ) { // buffer already open |
192 | #if defined(QT_CHECK_STATE) | 192 | #if defined(QT_CHECK_STATE) |
193 | qWarning( "QBuffer::open: Buffer already open" ); | 193 | qWarning( "QBuffer::open: Buffer already open" ); |
194 | #endif | 194 | #endif |
195 | return FALSE; | 195 | return FALSE; |
196 | } | 196 | } |
197 | setMode( m ); | 197 | setMode( m ); |
198 | if ( m & IO_Truncate ) { // truncate buffer | 198 | if ( m & IO_Truncate ) { // truncate buffer |
199 | a.resize( 0 ); | 199 | a.resize( 1 ); |
200 | a_len = 0; | 200 | a_len = 1; |
201 | } | 201 | } |
202 | if ( m & IO_Append ) { // append to end of buffer | 202 | if ( m & IO_Append ) { // append to end of buffer |
203 | ioIndex = a.size(); | 203 | ioIndex = a.size(); |
204 | } else { | 204 | } else { |
205 | ioIndex = 0; | 205 | ioIndex = 0; |
206 | } | 206 | } |
207 | a_inc = 16; | 207 | a_inc = 16; |
208 | setState( IO_Open ); | 208 | setState( IO_Open ); |
209 | setStatus( 0 ); | 209 | setStatus( 0 ); |
210 | return TRUE; | 210 | return TRUE; |
211 | } | 211 | } |
212 | 212 | ||
213 | /*! | 213 | /*! |
214 | \reimp | 214 | \reimp |
215 | 215 | ||
216 | Closes an open buffer. | 216 | Closes an open buffer. |
diff --git a/qmake/tools/qcomlibrary.cpp b/qmake/tools/qcomlibrary.cpp index a7162fc..2a1b75a 100644 --- a/qmake/tools/qcomlibrary.cpp +++ b/qmake/tools/qcomlibrary.cpp | |||
@@ -50,32 +50,36 @@ | |||
50 | #ifndef QT_DEBUG_COMPONENT | 50 | #ifndef QT_DEBUG_COMPONENT |
51 | # if defined(QT_DEBUG) | 51 | # if defined(QT_DEBUG) |
52 | # define QT_DEBUG_COMPONENT 1 | 52 | # define QT_DEBUG_COMPONENT 1 |
53 | # endif | 53 | # endif |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | 56 | ||
57 | QComLibrary::QComLibrary( const QString &filename ) | 57 | QComLibrary::QComLibrary( const QString &filename ) |
58 | : QLibrary( filename ), entry( 0 ), libiface( 0 ), qt_version( 0 ) | 58 | : QLibrary( filename ), entry( 0 ), libiface( 0 ), qt_version( 0 ) |
59 | { | 59 | { |
60 | } | 60 | } |
61 | 61 | ||
62 | QComLibrary::~QComLibrary() | 62 | QComLibrary::~QComLibrary() |
63 | { | 63 | { |
64 | if ( autoUnload() ) | 64 | if ( autoUnload() ) |
65 | unload(); | 65 | unload(); |
66 | if ( libiface ) | ||
67 | libiface->release(); | ||
68 | if ( entry ) | ||
69 | entry->release(); | ||
66 | } | 70 | } |
67 | 71 | ||
68 | bool QComLibrary::unload() | 72 | bool QComLibrary::unload() |
69 | { | 73 | { |
70 | if ( libiface ) { | 74 | if ( libiface ) { |
71 | libiface->cleanup(); | 75 | libiface->cleanup(); |
72 | if ( !libiface->canUnload() ) | 76 | if ( !libiface->canUnload() ) |
73 | return FALSE; | 77 | return FALSE; |
74 | libiface->release(); | 78 | libiface->release(); |
75 | libiface = 0; | 79 | libiface = 0; |
76 | } | 80 | } |
77 | int refs = entry ? entry->release() : 0; | 81 | int refs = entry ? entry->release() : 0; |
78 | if ( refs ) | 82 | if ( refs ) |
79 | return FALSE; | 83 | return FALSE; |
80 | 84 | ||
81 | entry = 0; | 85 | entry = 0; |
@@ -378,55 +382,53 @@ void QComLibrary::createInstanceInternal() | |||
378 | { | 382 | { |
379 | if ( library().isEmpty() ) | 383 | if ( library().isEmpty() ) |
380 | return; | 384 | return; |
381 | 385 | ||
382 | QFileInfo fileinfo( library() ); | 386 | QFileInfo fileinfo( library() ); |
383 | QString lastModified = fileinfo.lastModified().toString(); | 387 | QString lastModified = fileinfo.lastModified().toString(); |
384 | QString regkey = QString("/Qt Plugins %1.%2/%3") | 388 | QString regkey = QString("/Qt Plugins %1.%2/%3") |
385 | .arg( ( QT_VERSION & 0xff0000 ) >> 16 ) | 389 | .arg( ( QT_VERSION & 0xff0000 ) >> 16 ) |
386 | .arg( ( QT_VERSION & 0xff00 ) >> 8 ) | 390 | .arg( ( QT_VERSION & 0xff00 ) >> 8 ) |
387 | .arg( library() ); | 391 | .arg( library() ); |
388 | QStringList reg; | 392 | QStringList reg; |
389 | uint flags = 0; | 393 | uint flags = 0; |
390 | QCString key; | 394 | QCString key; |
391 | bool query_done = FALSE; | 395 | bool query_done = FALSE; |
392 | bool warn_mismatch = TRUE; | 396 | bool warn_mismatch = TRUE; |
393 | 397 | ||
394 | if ( ! query_done ) { | ||
395 | |||
396 | #ifdef QT_THREAD_SUPPORT | 398 | #ifdef QT_THREAD_SUPPORT |
397 | QMutexLocker locker( qt_global_mutexpool->get( &cache ) ); | 399 | QMutexLocker locker( qt_global_mutexpool ? |
400 | qt_global_mutexpool->get( &cache ) : 0 ); | ||
398 | #endif // QT_THREAD_SUPPORT | 401 | #endif // QT_THREAD_SUPPORT |
399 | 402 | ||
400 | if ( ! cache ) { | 403 | if ( ! cache ) { |
401 | cache = new QSettings; | 404 | cache = new QSettings; |
402 | cache->insertSearchPath( QSettings::Windows, "/Trolltech" ); | 405 | cache->insertSearchPath( QSettings::Windows, "/Trolltech" ); |
403 | cleanup_cache.set( &cache ); | 406 | cleanup_cache.set( &cache ); |
404 | } | 407 | } |
405 | 408 | ||
406 | reg = cache->readListEntry( regkey ); | 409 | reg = cache->readListEntry( regkey ); |
407 | if ( reg.count() == 4 ) { | 410 | if ( reg.count() == 4 ) { |
408 | // check timestamp | 411 | // check timestamp |
409 | if ( lastModified == reg[3] ) { | 412 | if ( lastModified == reg[3] ) { |
410 | qt_version = reg[0].toUInt(0, 16); | 413 | qt_version = reg[0].toUInt(0, 16); |
411 | flags = reg[1].toUInt(0, 16); | 414 | flags = reg[1].toUInt(0, 16); |
412 | key = reg[2].latin1(); | 415 | key = reg[2].latin1(); |
413 | 416 | ||
414 | query_done = TRUE; | 417 | query_done = TRUE; |
415 | warn_mismatch = FALSE; | 418 | warn_mismatch = FALSE; |
416 | } | ||
417 | } | 419 | } |
418 | } | 420 | } |
419 | 421 | ||
420 | #if defined(Q_OS_UNIX) | 422 | #if defined(Q_OS_UNIX) |
421 | if ( ! query_done ) { | 423 | if ( ! query_done ) { |
422 | // get the query information directly from the plugin without loading | 424 | // get the query information directly from the plugin without loading |
423 | if ( qt_unix_query( library(), &qt_version, &flags, &key ) ) { | 425 | if ( qt_unix_query( library(), &qt_version, &flags, &key ) ) { |
424 | // info read succesfully from library | 426 | // info read succesfully from library |
425 | query_done = TRUE; | 427 | query_done = TRUE; |
426 | } | 428 | } |
427 | } | 429 | } |
428 | #else // !Q_OS_UNIX | 430 | #else // !Q_OS_UNIX |
429 | if ( ! query_done ) { | 431 | if ( ! query_done ) { |
430 | // get the query information by loading the plugin | 432 | // get the query information by loading the plugin |
431 | if ( !isLoaded() ) { | 433 | if ( !isLoaded() ) { |
432 | Q_ASSERT( entry == 0 ); | 434 | Q_ASSERT( entry == 0 ); |
@@ -448,37 +450,32 @@ void QComLibrary::createInstanceInternal() | |||
448 | &qt_version, &flags, &key ) ) { | 450 | &qt_version, &flags, &key ) ) { |
449 | qt_version = flags = 0; | 451 | qt_version = flags = 0; |
450 | key = "unknown"; | 452 | key = "unknown"; |
451 | } else { | 453 | } else { |
452 | query_done = TRUE; | 454 | query_done = TRUE; |
453 | } | 455 | } |
454 | } | 456 | } |
455 | #endif // Q_OS_UNIX | 457 | #endif // Q_OS_UNIX |
456 | 458 | ||
457 | QStringList queried; | 459 | QStringList queried; |
458 | queried << QString::number( qt_version,16 ) | 460 | queried << QString::number( qt_version,16 ) |
459 | << QString::number( flags, 16 ) | 461 | << QString::number( flags, 16 ) |
460 | << key | 462 | << key |
461 | << lastModified; | 463 | << lastModified; |
462 | 464 | ||
463 | if ( queried != reg ) { | 465 | if ( queried != reg ) { |
464 | |||
465 | #ifdef QT_THREAD_SUPPORT | ||
466 | QMutexLocker locker( qt_global_mutexpool->get( &cache ) ); | ||
467 | #endif // QT_THREAD_SUPPORT | ||
468 | |||
469 | cache->writeEntry( regkey, queried ); | 466 | cache->writeEntry( regkey, queried ); |
470 | // delete the cache, which forces the settings to be written | 467 | // delete the cache, which forces the settings to be written |
471 | delete cache; | 468 | delete cache; |
472 | cache = 0; | 469 | cache = 0; |
473 | } | 470 | } |
474 | 471 | ||
475 | if ( ! query_done ) { | 472 | if ( ! query_done ) { |
476 | if ( warn_mismatch ) { | 473 | if ( warn_mismatch ) { |
477 | qWarning( "Conflict in %s:\n Plugin cannot be queried successfully!", | 474 | qWarning( "Conflict in %s:\n Plugin cannot be queried successfully!", |
478 | (const char*) QFile::encodeName( library() ) ); | 475 | (const char*) QFile::encodeName( library() ) ); |
479 | } | 476 | } |
480 | unload(); | 477 | unload(); |
481 | return; | 478 | return; |
482 | } | 479 | } |
483 | 480 | ||
484 | if ( ! qt_verify( library(), qt_version, flags, key, warn_mismatch ) ) { | 481 | if ( ! qt_verify( library(), qt_version, flags, key, warn_mismatch ) ) { |
diff --git a/qmake/tools/qconfig.cpp b/qmake/tools/qconfig.cpp index 433827c..5297a4e 100644 --- a/qmake/tools/qconfig.cpp +++ b/qmake/tools/qconfig.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | /* Install paths from configure */ | 1 | /* Install paths from configure */ |
2 | 2 | ||
3 | static const char QT_INSTALL_PREFIX [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; | 3 | static const char QT_INSTALL_PREFIX [256] = "/opt/qt-x11-free-3.1.2"; |
4 | static const char QT_INSTALL_BINS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/bin"; | 4 | static const char QT_INSTALL_BINS [256] = "/opt/qt-x11-free-3.1.2/bin"; |
5 | static const char QT_INSTALL_DOCS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/doc"; | 5 | static const char QT_INSTALL_DOCS [256] = "/opt/qt-x11-free-3.1.2/doc"; |
6 | static const char QT_INSTALL_HEADERS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/include"; | 6 | static const char QT_INSTALL_HEADERS[256] = "/opt/qt-x11-free-3.1.2/include"; |
7 | static const char QT_INSTALL_LIBS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/lib"; | 7 | static const char QT_INSTALL_LIBS [256] = "/opt/qt-x11-free-3.1.2/lib"; |
8 | static const char QT_INSTALL_PLUGINS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/plugins"; | 8 | static const char QT_INSTALL_PLUGINS[256] = "/opt/qt-x11-free-3.1.2/plugins"; |
9 | static const char QT_INSTALL_DATA [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; | 9 | static const char QT_INSTALL_DATA [256] = "/opt/qt-x11-free-3.1.2"; |
10 | 10 | ||
11 | const char *qInstallPath() { return QT_INSTALL_PREFIX; } | 11 | const char *qInstallPath() { return QT_INSTALL_PREFIX; } |
12 | const char *qInstallPathDocs() { return QT_INSTALL_DOCS; } | 12 | const char *qInstallPathDocs() { return QT_INSTALL_DOCS; } |
13 | const char *qInstallPathHeaders() { return QT_INSTALL_HEADERS; } | 13 | const char *qInstallPathHeaders() { return QT_INSTALL_HEADERS; } |
14 | const char *qInstallPathLibs() { return QT_INSTALL_LIBS; } | 14 | const char *qInstallPathLibs() { return QT_INSTALL_LIBS; } |
15 | const char *qInstallPathBins() { return QT_INSTALL_BINS; } | 15 | const char *qInstallPathBins() { return QT_INSTALL_BINS; } |
16 | const char *qInstallPathPlugins() { return QT_INSTALL_PLUGINS; } | 16 | const char *qInstallPathPlugins() { return QT_INSTALL_PLUGINS; } |
17 | const char *qInstallPathData() { return QT_INSTALL_DATA; } | 17 | const char *qInstallPathData() { return QT_INSTALL_DATA; } |
diff --git a/qmake/tools/qcriticalsection_p.cpp b/qmake/tools/qcriticalsection_p.cpp index 60fc8bd..c375730 100644 --- a/qmake/tools/qcriticalsection_p.cpp +++ b/qmake/tools/qcriticalsection_p.cpp | |||
@@ -1,23 +1,21 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QCriticalSection class | 4 | ** Implementation of QCriticalSection class |
5 | ** | 5 | ** |
6 | ** Created : | ||
7 | ** | ||
8 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 8 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
diff --git a/qmake/tools/qcstring.cpp b/qmake/tools/qcstring.cpp index cf1b853..4651b97 100644 --- a/qmake/tools/qcstring.cpp +++ b/qmake/tools/qcstring.cpp | |||
@@ -128,32 +128,43 @@ char *qstrdup( const char *src ) | |||
128 | \a src or \a dst is 0, returns 0 immediately. | 128 | \a src or \a dst is 0, returns 0 immediately. |
129 | 129 | ||
130 | \sa qstrcpy() | 130 | \sa qstrcpy() |
131 | */ | 131 | */ |
132 | 132 | ||
133 | char *qstrncpy( char *dst, const char *src, uint len ) | 133 | char *qstrncpy( char *dst, const char *src, uint len ) |
134 | { | 134 | { |
135 | if ( !src || !dst ) | 135 | if ( !src || !dst ) |
136 | return 0; | 136 | return 0; |
137 | strncpy( dst, src, len ); | 137 | strncpy( dst, src, len ); |
138 | if ( len > 0 ) | 138 | if ( len > 0 ) |
139 | dst[len-1] = '\0'; | 139 | dst[len-1] = '\0'; |
140 | return dst; | 140 | return dst; |
141 | } | 141 | } |
142 | 142 | ||
143 | /*! | 143 | /*! |
144 | \fn uint qstrlen( const char *str ); | ||
145 | |||
146 | \relates QCString | ||
147 | |||
148 | A safe strlen function. | ||
149 | |||
150 | Returns the number of characters that precede the terminating '\0'. | ||
151 | or 0 if \a str is 0. | ||
152 | */ | ||
153 | |||
154 | /*! | ||
144 | \fn int qstrcmp( const char *str1, const char *str2 ); | 155 | \fn int qstrcmp( const char *str1, const char *str2 ); |
145 | 156 | ||
146 | \relates QCString | 157 | \relates QCString |
147 | 158 | ||
148 | A safe strcmp() function. | 159 | A safe strcmp() function. |
149 | 160 | ||
150 | Compares \a str1 and \a str2. Returns a negative value if \a str1 | 161 | Compares \a str1 and \a str2. Returns a negative value if \a str1 |
151 | is less than \a str2, 0 if \a str1 is equal to \a str2 or a | 162 | is less than \a str2, 0 if \a str1 is equal to \a str2 or a |
152 | positive value if \a str1 is greater than \a str2. | 163 | positive value if \a str1 is greater than \a str2. |
153 | 164 | ||
154 | Special case I: Returns 0 if \a str1 and \a str2 are both 0. | 165 | Special case I: Returns 0 if \a str1 and \a str2 are both 0. |
155 | 166 | ||
156 | Special case II: Returns a random nonzero value if \a str1 is 0 | 167 | Special case II: Returns a random nonzero value if \a str1 is 0 |
157 | or \a str2 is 0 (but not both). | 168 | or \a str2 is 0 (but not both). |
158 | 169 | ||
159 | \sa qstrncmp() qstricmp() qstrnicmp() | 170 | \sa qstrncmp() qstricmp() qstrnicmp() |
@@ -286,64 +297,71 @@ static void createCRC16Table() // build CRC16 lookup table | |||
286 | } | 297 | } |
287 | } | 298 | } |
288 | 299 | ||
289 | /*! | 300 | /*! |
290 | \relates QMemArray | 301 | \relates QMemArray |
291 | 302 | ||
292 | Returns the CRC-16 checksum of \a len bytes starting at \a data. | 303 | Returns the CRC-16 checksum of \a len bytes starting at \a data. |
293 | 304 | ||
294 | The checksum is independent of the byte order (endianness). | 305 | The checksum is independent of the byte order (endianness). |
295 | */ | 306 | */ |
296 | 307 | ||
297 | Q_UINT16 qChecksum( const char *data, uint len ) | 308 | Q_UINT16 qChecksum( const char *data, uint len ) |
298 | { | 309 | { |
299 | if ( !crc_tbl_init ) { // create lookup table | 310 | if ( !crc_tbl_init ) { // create lookup table |
300 | 311 | ||
301 | #ifdef QT_THREAD_SUPPORT | 312 | #ifdef QT_THREAD_SUPPORT |
302 | QMutexLocker locker( qt_global_mutexpool->get( &crc_tbl_init ) ); | 313 | QMutexLocker locker( qt_global_mutexpool ? |
314 | qt_global_mutexpool->get( &crc_tbl_init ) : 0 ); | ||
303 | #endif // QT_THREAD_SUPPORT | 315 | #endif // QT_THREAD_SUPPORT |
304 | 316 | ||
305 | if ( !crc_tbl_init ) { | 317 | if ( !crc_tbl_init ) { |
306 | createCRC16Table(); | 318 | createCRC16Table(); |
307 | crc_tbl_init = TRUE; | 319 | crc_tbl_init = TRUE; |
308 | } | 320 | } |
309 | } | 321 | } |
310 | register Q_UINT16 crc = 0xffff; | 322 | register Q_UINT16 crc = 0xffff; |
311 | uchar c; | 323 | uchar c; |
312 | uchar *p = (uchar *)data; | 324 | uchar *p = (uchar *)data; |
313 | while ( len-- ) { | 325 | while ( len-- ) { |
314 | c = *p++; | 326 | c = *p++; |
315 | crc = ( (crc >> 4) & 0x0fff ) ^ crc_tbl[((crc ^ c) & 15)]; | 327 | crc = ( (crc >> 4) & 0x0fff ) ^ crc_tbl[((crc ^ c) & 15)]; |
316 | c >>= 4; | 328 | c >>= 4; |
317 | crc = ( (crc >> 4) & 0x0fff ) ^ crc_tbl[((crc ^ c) & 15)]; | 329 | crc = ( (crc >> 4) & 0x0fff ) ^ crc_tbl[((crc ^ c) & 15)]; |
318 | } | 330 | } |
319 | return ~crc & 0xffff; | 331 | return ~crc & 0xffff; |
320 | } | 332 | } |
321 | 333 | ||
322 | /*! \fn QByteArray qCompress( const QByteArray& data) | 334 | /*! |
323 | \relates QByteArray | 335 | \fn QByteArray qCompress( const QByteArray& data ) |
324 | \overload | 336 | |
337 | \relates QByteArray | ||
338 | |||
339 | Compresses the array \a data and returns the compressed byte | ||
340 | array. | ||
341 | |||
342 | \sa qUncompress() | ||
325 | */ | 343 | */ |
326 | 344 | ||
327 | /*! | 345 | /*! |
328 | \relates QByteArray | 346 | \relates QByteArray |
329 | 347 | ||
330 | Compresses the array \a data which is \a nbytes long and returns the | 348 | \overload |
331 | compressed byte array. | ||
332 | 349 | ||
333 | \sa qUncompress() | 350 | Compresses the array \a data which is \a nbytes long and returns the |
351 | compressed byte array. | ||
334 | */ | 352 | */ |
335 | 353 | ||
336 | #ifndef QT_NO_COMPRESS | 354 | #ifndef QT_NO_COMPRESS |
337 | QByteArray qCompress( const uchar* data, int nbytes ) | 355 | QByteArray qCompress( const uchar* data, int nbytes ) |
338 | { | 356 | { |
339 | if ( nbytes == 0 ) { | 357 | if ( nbytes == 0 ) { |
340 | QByteArray tmp( 4 ); | 358 | QByteArray tmp( 4 ); |
341 | tmp.fill( 0 ); | 359 | tmp.fill( 0 ); |
342 | return tmp; | 360 | return tmp; |
343 | } | 361 | } |
344 | if ( !data ) { | 362 | if ( !data ) { |
345 | #if defined(QT_CHECK_RANGE) | 363 | #if defined(QT_CHECK_RANGE) |
346 | qWarning( "qCompress: data is NULL." ); | 364 | qWarning( "qCompress: data is NULL." ); |
347 | #endif | 365 | #endif |
348 | return QByteArray(); | 366 | return QByteArray(); |
349 | } | 367 | } |
@@ -366,46 +384,58 @@ QByteArray qCompress( const uchar* data, int nbytes ) | |||
366 | case Z_MEM_ERROR: | 384 | case Z_MEM_ERROR: |
367 | #if defined(QT_CHECK_RANGE) | 385 | #if defined(QT_CHECK_RANGE) |
368 | qWarning( "qCompress: Z_MEM_ERROR: Not enough memory." ); | 386 | qWarning( "qCompress: Z_MEM_ERROR: Not enough memory." ); |
369 | #endif | 387 | #endif |
370 | bazip.resize( 0 ); | 388 | bazip.resize( 0 ); |
371 | break; | 389 | break; |
372 | case Z_BUF_ERROR: | 390 | case Z_BUF_ERROR: |
373 | len *= 2; | 391 | len *= 2; |
374 | break; | 392 | break; |
375 | } | 393 | } |
376 | } while ( res == Z_BUF_ERROR ); | 394 | } while ( res == Z_BUF_ERROR ); |
377 | 395 | ||
378 | return bazip; | 396 | return bazip; |
379 | } | 397 | } |
380 | #endif | 398 | #endif |
381 | 399 | ||
382 | /*! \fn QByteArray qUncompress( const QByteArray& data ) | 400 | /*! |
383 | \relates QByteArray | 401 | \fn QByteArray qUncompress( const QByteArray& data ) |
384 | \overload | 402 | |
403 | \relates QByteArray | ||
404 | |||
405 | Uncompresses the array \a data and returns the uncompressed byte | ||
406 | array. | ||
407 | |||
408 | Returns an empty QByteArray if the input data was corrupt. | ||
409 | \omit | ||
410 | ADD THE FOLLOWING FOR Qt 4.0 | ||
411 | This function will uncompress data compressed with qCompress() | ||
412 | from this and any earlier Qt version, back to Qt 3.1 when this | ||
413 | feature was added. | ||
414 | \endomit | ||
415 | |||
416 | \sa qCompress() | ||
385 | */ | 417 | */ |
386 | 418 | ||
387 | /*! | 419 | /*! |
388 | \relates QByteArray | 420 | \relates QByteArray |
389 | |||
390 | Uncompresses the array \a data which is \a nbytes long and returns | ||
391 | the uncompressed byte array. | ||
392 | 421 | ||
393 | Returns an empty QByteArray if the input data was corrupt. | 422 | \overload |
394 | 423 | ||
395 | \sa qCompress() | 424 | Uncompresses the array \a data which is \a nbytes long and returns |
425 | the uncompressed byte array. | ||
396 | */ | 426 | */ |
397 | 427 | ||
398 | #ifndef QT_NO_COMPRESS | 428 | #ifndef QT_NO_COMPRESS |
399 | QByteArray qUncompress( const uchar* data, int nbytes ) | 429 | QByteArray qUncompress( const uchar* data, int nbytes ) |
400 | { | 430 | { |
401 | if ( !data ) { | 431 | if ( !data ) { |
402 | #if defined(QT_CHECK_RANGE) | 432 | #if defined(QT_CHECK_RANGE) |
403 | qWarning( "qUncompress: data is NULL." ); | 433 | qWarning( "qUncompress: data is NULL." ); |
404 | #endif | 434 | #endif |
405 | return QByteArray(); | 435 | return QByteArray(); |
406 | } | 436 | } |
407 | if ( nbytes <= 4 ) { | 437 | if ( nbytes <= 4 ) { |
408 | #if defined(QT_CHECK_RANGE) | 438 | #if defined(QT_CHECK_RANGE) |
409 | if ( nbytes < 4 || ( data[0]!=0 || data[1]!=0 || data[2]!=0 || data[3]!=0 ) ) | 439 | if ( nbytes < 4 || ( data[0]!=0 || data[1]!=0 || data[2]!=0 || data[3]!=0 ) ) |
410 | qWarning( "qUncompress: Input data is corrupted." ); | 440 | qWarning( "qUncompress: Input data is corrupted." ); |
411 | #endif | 441 | #endif |
@@ -923,39 +953,43 @@ int QCString::find( char c, int index, bool cs ) const | |||
923 | \overload | 953 | \overload |
924 | 954 | ||
925 | Finds the first occurrence of the string \a str, starting at | 955 | Finds the first occurrence of the string \a str, starting at |
926 | position \a index. | 956 | position \a index. |
927 | 957 | ||
928 | The search is case sensitive if \a cs is TRUE, or case insensitive | 958 | The search is case sensitive if \a cs is TRUE, or case insensitive |
929 | if \a cs is FALSE. | 959 | if \a cs is FALSE. |
930 | 960 | ||
931 | Returns the position of \a str, or -1 if \a str could not be | 961 | Returns the position of \a str, or -1 if \a str could not be |
932 | found. | 962 | found. |
933 | 963 | ||
934 | \sa \link #asciinotion Note on character comparisons \endlink | 964 | \sa \link #asciinotion Note on character comparisons \endlink |
935 | */ | 965 | */ |
936 | 966 | ||
937 | int QCString::find( const char *str, int index, bool cs ) const | 967 | int QCString::find( const char *str, int index, bool cs ) const |
938 | { | 968 | { |
969 | return find( str, index, cs, length() ); | ||
970 | } | ||
971 | |||
972 | int QCString::find( const char *str, int index, bool cs, uint l ) const | ||
973 | { | ||
939 | if ( (uint)index >= size() ) | 974 | if ( (uint)index >= size() ) |
940 | return -1; | 975 | return -1; |
941 | if ( !str ) | 976 | if ( !str ) |
942 | return -1; | 977 | return -1; |
943 | if ( !*str ) | 978 | if ( !*str ) |
944 | return index; | 979 | return index; |
945 | const uint l = length(); | ||
946 | const uint sl = qstrlen( str ); | 980 | const uint sl = qstrlen( str ); |
947 | if ( sl + index > l ) | 981 | if ( sl + index > l ) |
948 | return -1; | 982 | return -1; |
949 | 983 | ||
950 | if ( sl == 1 ) | 984 | if ( sl == 1 ) |
951 | return find( *str, index, cs ); | 985 | return find( *str, index, cs ); |
952 | 986 | ||
953 | /* | 987 | /* |
954 | See QString::find() for details. | 988 | See QString::find() for details. |
955 | */ | 989 | */ |
956 | const char* needle = str; | 990 | const char* needle = str; |
957 | const char* haystack = data() + index; | 991 | const char* haystack = data() + index; |
958 | const char* end = data() + (l-sl); | 992 | const char* end = data() + (l-sl); |
959 | const uint sl_minus_1 = sl-1; | 993 | const uint sl_minus_1 = sl-1; |
960 | uint hashNeedle = 0, hashHaystack = 0,i; | 994 | uint hashNeedle = 0, hashHaystack = 0,i; |
961 | 995 | ||
@@ -1139,54 +1173,54 @@ int QCString::contains( char c, bool cs ) const | |||
1139 | Returns the number of times \a str occurs in the string. | 1173 | Returns the number of times \a str occurs in the string. |
1140 | 1174 | ||
1141 | The match is case sensitive if \a cs is TRUE, or case insensitive | 1175 | The match is case sensitive if \a cs is TRUE, or case insensitive |
1142 | if \a cs if FALSE. | 1176 | if \a cs if FALSE. |
1143 | 1177 | ||
1144 | This function counts overlapping substrings, for example, "banana" | 1178 | This function counts overlapping substrings, for example, "banana" |
1145 | contains two occurrences of "ana". | 1179 | contains two occurrences of "ana". |
1146 | 1180 | ||
1147 | \sa findRev() | 1181 | \sa findRev() |
1148 | \link #asciinotion Note on character comparisons \endlink | 1182 | \link #asciinotion Note on character comparisons \endlink |
1149 | */ | 1183 | */ |
1150 | 1184 | ||
1151 | int QCString::contains( const char *str, bool cs ) const | 1185 | int QCString::contains( const char *str, bool cs ) const |
1152 | { | 1186 | { |
1153 | int count = 0; | 1187 | int count = 0; |
1154 | int i = -1; | 1188 | int i = -1; |
1189 | uint l = length(); | ||
1155 | // use find for the faster hashing algorithm | 1190 | // use find for the faster hashing algorithm |
1156 | while ( ( i = find ( str, i+1, cs ) ) != -1 ) | 1191 | while ( ( i = find ( str, i+1, cs, l ) ) != -1 ) |
1157 | count++; | 1192 | count++; |
1158 | return count; | 1193 | return count; |
1159 | } | 1194 | } |
1160 | 1195 | ||
1161 | /*! | 1196 | /*! |
1162 | Returns a substring that contains the \a len leftmost characters | 1197 | Returns a substring that contains the \a len leftmost characters |
1163 | of the string. | 1198 | of the string. |
1164 | 1199 | ||
1165 | The whole string is returned if \a len exceeds the length of the | 1200 | The whole string is returned if \a len exceeds the length of the |
1166 | string. | 1201 | string. |
1167 | 1202 | ||
1168 | Example: | 1203 | Example: |
1169 | \code | 1204 | \code |
1170 | QCString s = "Pineapple"; | 1205 | QCString s = "Pineapple"; |
1171 | QCString t = s.left( 4 ); // t == "Pine" | 1206 | QCString t = s.left( 4 ); // t == "Pine" |
1172 | \endcode | 1207 | \endcode |
1173 | 1208 | ||
1174 | \sa right(), mid() | 1209 | \sa right(), mid() |
1175 | */ | 1210 | */ |
1176 | |||
1177 | QCString QCString::left( uint len ) const | 1211 | QCString QCString::left( uint len ) const |
1178 | { | 1212 | { |
1179 | if ( isEmpty() ) { | 1213 | if ( isEmpty() ) { |
1180 | QCString empty; | 1214 | QCString empty; |
1181 | return empty; | 1215 | return empty; |
1182 | } else if ( len >= size() ) { | 1216 | } else if ( len >= size() ) { |
1183 | QCString same( data() ); | 1217 | QCString same( data() ); |
1184 | return same; | 1218 | return same; |
1185 | } else { | 1219 | } else { |
1186 | QCString s( len+1 ); | 1220 | QCString s( len+1 ); |
1187 | strncpy( s.data(), data(), len ); | 1221 | strncpy( s.data(), data(), len ); |
1188 | *(s.data()+len) = '\0'; | 1222 | *(s.data()+len) = '\0'; |
1189 | return s; | 1223 | return s; |
1190 | } | 1224 | } |
1191 | } | 1225 | } |
1192 | 1226 | ||
@@ -1484,40 +1518,42 @@ QCString QCString::simplifyWhiteSpace() const | |||
1484 | s.insert( 2, "don't "); // s == "I don't like fish" | 1518 | s.insert( 2, "don't "); // s == "I don't like fish" |
1485 | 1519 | ||
1486 | s = "x"; // index 01234 | 1520 | s = "x"; // index 01234 |
1487 | s.insert( 3, "yz" ); // s == "x yz" | 1521 | s.insert( 3, "yz" ); // s == "x yz" |
1488 | \endcode | 1522 | \endcode |
1489 | */ | 1523 | */ |
1490 | 1524 | ||
1491 | QCString &QCString::insert( uint index, const char *s ) | 1525 | QCString &QCString::insert( uint index, const char *s ) |
1492 | { | 1526 | { |
1493 | int len = qstrlen(s); | 1527 | int len = qstrlen(s); |
1494 | if ( len == 0 ) | 1528 | if ( len == 0 ) |
1495 | return *this; | 1529 | return *this; |
1496 | uint olen = length(); | 1530 | uint olen = length(); |
1497 | int nlen = olen + len; | 1531 | int nlen = olen + len; |
1498 | if ( index >= olen ) { // insert after end of string | 1532 | if ( index >= olen ) { // insert after end of string |
1499 | detach(); | 1533 | detach(); |
1500 | if ( QByteArray::resize(nlen+index-olen+1) ) { | 1534 | if ( QByteArray::resize(nlen+index-olen+1, QByteArray::SpeedOptim ) ) { |
1501 | memset( data()+olen, ' ', index-olen ); | 1535 | memset( data()+olen, ' ', index-olen ); |
1502 | memcpy( data()+index, s, len+1 ); | 1536 | memcpy( data()+index, s, len+1 ); |
1503 | } | 1537 | } |
1504 | } else if ( QByteArray::resize(nlen+1) ) {// normal insert | 1538 | } else { |
1505 | detach(); | 1539 | detach(); |
1506 | memmove( data()+index+len, data()+index, olen-index+1 ); | 1540 | if ( QByteArray::resize(nlen+1, QByteArray::SpeedOptim ) ) {// normal insert |
1507 | memcpy( data()+index, s, len ); | 1541 | memmove( data()+index+len, data()+index, olen-index+1 ); |
1542 | memcpy( data()+index, s, len ); | ||
1543 | } | ||
1508 | } | 1544 | } |
1509 | return *this; | 1545 | return *this; |
1510 | } | 1546 | } |
1511 | 1547 | ||
1512 | /*! | 1548 | /*! |
1513 | Inserts character \a c into the string at position \a index and | 1549 | Inserts character \a c into the string at position \a index and |
1514 | returns a reference to the string. | 1550 | returns a reference to the string. |
1515 | 1551 | ||
1516 | If \a index is beyond the end of the string, the string is | 1552 | If \a index is beyond the end of the string, the string is |
1517 | padded with spaces (ASCII 32) to length \a index and then \a c | 1553 | padded with spaces (ASCII 32) to length \a index and then \a c |
1518 | is appended. | 1554 | is appended. |
1519 | 1555 | ||
1520 | Example: | 1556 | Example: |
1521 | \code | 1557 | \code |
1522 | QCString s = "Yes"; | 1558 | QCString s = "Yes"; |
1523 | s.insert( 3, '!'); // s == "Yes!" | 1559 | s.insert( 3, '!'); // s == "Yes!" |
@@ -1556,33 +1592,33 @@ QCString &QCString::insert( uint index, char c ) // insert char | |||
1556 | \endcode | 1592 | \endcode |
1557 | 1593 | ||
1558 | \sa insert(), replace() | 1594 | \sa insert(), replace() |
1559 | */ | 1595 | */ |
1560 | 1596 | ||
1561 | QCString &QCString::remove( uint index, uint len ) | 1597 | QCString &QCString::remove( uint index, uint len ) |
1562 | { | 1598 | { |
1563 | uint olen = length(); | 1599 | uint olen = length(); |
1564 | if ( index + len >= olen ) { // range problems | 1600 | if ( index + len >= olen ) { // range problems |
1565 | if ( index < olen ) { // index ok | 1601 | if ( index < olen ) { // index ok |
1566 | detach(); | 1602 | detach(); |
1567 | resize( index+1 ); | 1603 | resize( index+1 ); |
1568 | } | 1604 | } |
1569 | } else if ( len != 0 ) { | 1605 | } else if ( len != 0 ) { |
1570 | detach(); | 1606 | detach(); |
1571 | memmove( data()+index, data()+index+len, olen-index-len+1 ); | 1607 | memmove( data()+index, data()+index+len, olen-index-len+1 ); |
1572 | QByteArray::resize(olen-len+1); | 1608 | QByteArray::resize(olen-len+1, QByteArray::SpeedOptim ); |
1573 | } | 1609 | } |
1574 | return *this; | 1610 | return *this; |
1575 | } | 1611 | } |
1576 | 1612 | ||
1577 | /*! | 1613 | /*! |
1578 | Replaces \a len characters from the string, starting at position | 1614 | Replaces \a len characters from the string, starting at position |
1579 | \a index, with \a str, and returns a reference to the string. | 1615 | \a index, with \a str, and returns a reference to the string. |
1580 | 1616 | ||
1581 | If \a index is out of range, nothing is removed and \a str is | 1617 | If \a index is out of range, nothing is removed and \a str is |
1582 | appended at the end of the string. If \a index is valid, but \a | 1618 | appended at the end of the string. If \a index is valid, but \a |
1583 | index + \a len is larger than the length of the string, \a str | 1619 | index + \a len is larger than the length of the string, \a str |
1584 | replaces the rest of the string from position \a index. | 1620 | replaces the rest of the string from position \a index. |
1585 | 1621 | ||
1586 | \code | 1622 | \code |
1587 | QCString s = "Say yes!"; | 1623 | QCString s = "Say yes!"; |
1588 | s.replace( 4, 3, "NO" ); // s == "Say NO!" | 1624 | s.replace( 4, 3, "NO" ); // s == "Say NO!" |
@@ -1618,88 +1654,89 @@ QCString &QCString::replace( char c, const char *after ) | |||
1618 | str[1] = '\0'; | 1654 | str[1] = '\0'; |
1619 | return replace( str, after ); | 1655 | return replace( str, after ); |
1620 | } | 1656 | } |
1621 | 1657 | ||
1622 | /*! \overload | 1658 | /*! \overload |
1623 | 1659 | ||
1624 | Replaces every occurrence of the string \a before in the string | 1660 | Replaces every occurrence of the string \a before in the string |
1625 | with the string \a after. Returns a reference to the string. | 1661 | with the string \a after. Returns a reference to the string. |
1626 | 1662 | ||
1627 | Example: | 1663 | Example: |
1628 | \code | 1664 | \code |
1629 | QCString s = "Greek is Greek"; | 1665 | QCString s = "Greek is Greek"; |
1630 | s.replace( "Greek", "English" ); | 1666 | s.replace( "Greek", "English" ); |
1631 | // s == "English is English" | 1667 | // s == "English is English" |
1632 | \endcode | 1668 | \endcode |
1633 | */ | 1669 | */ |
1670 | |||
1634 | QCString &QCString::replace( const char *before, const char *after ) | 1671 | QCString &QCString::replace( const char *before, const char *after ) |
1635 | { | 1672 | { |
1636 | if ( before == after || isNull() ) | 1673 | if ( before == after || isNull() ) |
1637 | return *this; | 1674 | return *this; |
1638 | 1675 | ||
1639 | detach(); | 1676 | detach(); |
1640 | 1677 | ||
1641 | int index = 0; | 1678 | int index = 0; |
1642 | const int bl = before ? strlen( before ) : 0; | 1679 | const int bl = before ? strlen( before ) : 0; |
1643 | const int al = after ? strlen( after ) : 0; | 1680 | const int al = after ? strlen( after ) : 0; |
1644 | char *d = data(); | 1681 | char *d = data(); |
1645 | uint len = length(); | 1682 | uint len = length(); |
1646 | 1683 | ||
1647 | if ( bl == al ) { | 1684 | if ( bl == al ) { |
1648 | if ( bl ) { | 1685 | if ( bl ) { |
1649 | while( (index = find( before, index ) ) != -1 ) { | 1686 | while( (index = find( before, index, TRUE, len ) ) != -1 ) { |
1650 | memcpy( d+index, after, al ); | 1687 | memcpy( d+index, after, al ); |
1651 | index += bl; | 1688 | index += bl; |
1652 | } | 1689 | } |
1653 | } | 1690 | } |
1654 | } else if ( al < bl ) { | 1691 | } else if ( al < bl ) { |
1655 | uint to = 0; | 1692 | uint to = 0; |
1656 | uint movestart = 0; | 1693 | uint movestart = 0; |
1657 | uint num = 0; | 1694 | uint num = 0; |
1658 | while( (index = find( before, index ) ) != -1 ) { | 1695 | while( (index = find( before, index, TRUE, len ) ) != -1 ) { |
1659 | if ( num ) { | 1696 | if ( num ) { |
1660 | int msize = index - movestart; | 1697 | int msize = index - movestart; |
1661 | if ( msize > 0 ) { | 1698 | if ( msize > 0 ) { |
1662 | memmove( d + to, d + movestart, msize ); | 1699 | memmove( d + to, d + movestart, msize ); |
1663 | to += msize; | 1700 | to += msize; |
1664 | } | 1701 | } |
1665 | } else { | 1702 | } else { |
1666 | to = index; | 1703 | to = index; |
1667 | } | 1704 | } |
1668 | if ( al ) { | 1705 | if ( al ) { |
1669 | memcpy( d + to, after, al ); | 1706 | memcpy( d + to, after, al ); |
1670 | to += al; | 1707 | to += al; |
1671 | } | 1708 | } |
1672 | index += bl; | 1709 | index += bl; |
1673 | movestart = index; | 1710 | movestart = index; |
1674 | num++; | 1711 | num++; |
1675 | } | 1712 | } |
1676 | if ( num ) { | 1713 | if ( num ) { |
1677 | int msize = len - movestart; | 1714 | int msize = len - movestart; |
1678 | if ( msize > 0 ) | 1715 | if ( msize > 0 ) |
1679 | memmove( d + to, d + movestart, msize ); | 1716 | memmove( d + to, d + movestart, msize ); |
1680 | resize( len - num*(bl-al) + 1 ); | 1717 | resize( len - num*(bl-al) + 1 ); |
1681 | } | 1718 | } |
1682 | } else { | 1719 | } else { |
1683 | // the most complex case. We don't want to loose performance by doing repeated | 1720 | // the most complex case. We don't want to loose performance by doing repeated |
1684 | // copies and reallocs of the string. | 1721 | // copies and reallocs of the string. |
1685 | while( index != -1 ) { | 1722 | while( index != -1 ) { |
1686 | uint indices[4096]; | 1723 | uint indices[4096]; |
1687 | uint pos = 0; | 1724 | uint pos = 0; |
1688 | while( pos < 4095 ) { | 1725 | while( pos < 4095 ) { |
1689 | index = find(before, index); | 1726 | index = find(before, index, TRUE, len); |
1690 | if ( index == -1 ) | 1727 | if ( index == -1 ) |
1691 | break; | 1728 | break; |
1692 | indices[pos++] = index; | 1729 | indices[pos++] = index; |
1693 | index += bl; | 1730 | index += bl; |
1694 | // avoid infinite loop | 1731 | // avoid infinite loop |
1695 | if ( !bl ) | 1732 | if ( !bl ) |
1696 | index++; | 1733 | index++; |
1697 | } | 1734 | } |
1698 | if ( !pos ) | 1735 | if ( !pos ) |
1699 | break; | 1736 | break; |
1700 | 1737 | ||
1701 | // we have a table of replacement positions, use them for fast replacing | 1738 | // we have a table of replacement positions, use them for fast replacing |
1702 | int adjust = pos*(al-bl); | 1739 | int adjust = pos*(al-bl); |
1703 | // index has to be adjusted in case we get back into the loop above. | 1740 | // index has to be adjusted in case we get back into the loop above. |
1704 | if ( index != -1 ) | 1741 | if ( index != -1 ) |
1705 | index += adjust; | 1742 | index += adjust; |
@@ -1750,109 +1787,109 @@ QCString &QCString::replace( char c1, char c2 ) | |||
1750 | /*! | 1787 | /*! |
1751 | \overload | 1788 | \overload |
1752 | 1789 | ||
1753 | Finds the first occurrence of the regular expression \a rx, | 1790 | Finds the first occurrence of the regular expression \a rx, |
1754 | starting at position \a index. | 1791 | starting at position \a index. |
1755 | 1792 | ||
1756 | Returns the position of the next match, or -1 if \a rx was not | 1793 | Returns the position of the next match, or -1 if \a rx was not |
1757 | found. | 1794 | found. |
1758 | 1795 | ||
1759 | \warning If you want to apply this function repeatedly to the same | 1796 | \warning If you want to apply this function repeatedly to the same |
1760 | string it is more efficient to convert the string to a QString and | 1797 | string it is more efficient to convert the string to a QString and |
1761 | apply the function to that. | 1798 | apply the function to that. |
1762 | */ | 1799 | */ |
1763 | 1800 | ||
1764 | int QCString::find( const QRegExp& rx, int index ) const | 1801 | int QCString::find( const QRegExp& rx, int index ) const |
1765 | { | 1802 | { |
1766 | QString d = QString::fromLatin1( data() ); | 1803 | QString d = QString::fromAscii( data() ); |
1767 | return d.find( rx, index ); | 1804 | return d.find( rx, index ); |
1768 | } | 1805 | } |
1769 | 1806 | ||
1770 | /*! | 1807 | /*! |
1771 | \overload | 1808 | \overload |
1772 | 1809 | ||
1773 | Finds the first occurrence of the regular expression \a rx, | 1810 | Finds the first occurrence of the regular expression \a rx, |
1774 | starting at position \a index and searching backwards. | 1811 | starting at position \a index and searching backwards. |
1775 | 1812 | ||
1776 | Returns the position of the next match (backwards), or -1 if \a rx | 1813 | Returns the position of the next match (backwards), or -1 if \a rx |
1777 | was not found. | 1814 | was not found. |
1778 | 1815 | ||
1779 | \warning If you want to apply this function repeatedly to the same | 1816 | \warning If you want to apply this function repeatedly to the same |
1780 | string it is more efficient to convert the string to a QString and | 1817 | string it is more efficient to convert the string to a QString and |
1781 | apply the function to that. | 1818 | apply the function to that. |
1782 | */ | 1819 | */ |
1783 | 1820 | ||
1784 | int QCString::findRev( const QRegExp& rx, int index ) const | 1821 | int QCString::findRev( const QRegExp& rx, int index ) const |
1785 | { | 1822 | { |
1786 | QString d = QString::fromLatin1( data() ); | 1823 | QString d = QString::fromAscii( data() ); |
1787 | return d.findRev( rx, index ); | 1824 | return d.findRev( rx, index ); |
1788 | } | 1825 | } |
1789 | 1826 | ||
1790 | /*! | 1827 | /*! |
1791 | \overload | 1828 | \overload |
1792 | 1829 | ||
1793 | Counts the number of overlapping occurrences of \a rx in the string. | 1830 | Counts the number of overlapping occurrences of \a rx in the string. |
1794 | 1831 | ||
1795 | Example: | 1832 | Example: |
1796 | \code | 1833 | \code |
1797 | QString s = "banana and panama"; | 1834 | QString s = "banana and panama"; |
1798 | QRegExp r = QRegExp( "a[nm]a", TRUE, FALSE ); | 1835 | QRegExp r = QRegExp( "a[nm]a", TRUE, FALSE ); |
1799 | s.contains( r ); // 4 matches | 1836 | s.contains( r ); // 4 matches |
1800 | \endcode | 1837 | \endcode |
1801 | 1838 | ||
1802 | \sa find(), findRev() | 1839 | \sa find(), findRev() |
1803 | 1840 | ||
1804 | \warning If you want to apply this function repeatedly to the same | 1841 | \warning If you want to apply this function repeatedly to the same |
1805 | string it is more efficient to convert the string to a QString and | 1842 | string it is more efficient to convert the string to a QString and |
1806 | apply the function to that. | 1843 | apply the function to that. |
1807 | */ | 1844 | */ |
1808 | 1845 | ||
1809 | int QCString::contains( const QRegExp &rx ) const | 1846 | int QCString::contains( const QRegExp &rx ) const |
1810 | { | 1847 | { |
1811 | QString d = QString::fromLatin1( data() ); | 1848 | QString d = QString::fromAscii( data() ); |
1812 | return d.contains( rx ); | 1849 | return d.contains( rx ); |
1813 | } | 1850 | } |
1814 | 1851 | ||
1815 | 1852 | ||
1816 | /*! | 1853 | /*! |
1817 | \overload | 1854 | \overload |
1818 | 1855 | ||
1819 | Replaces every occurrence of \a rx in the string with \a str. | 1856 | Replaces every occurrence of \a rx in the string with \a str. |
1820 | Returns a reference to the string. | 1857 | Returns a reference to the string. |
1821 | 1858 | ||
1822 | Example: | 1859 | Example: |
1823 | \code | 1860 | \code |
1824 | QString s = "banana"; | 1861 | QString s = "banana"; |
1825 | s.replace( QRegExp("a.*a"), "" ); // becomes "b" | 1862 | s.replace( QRegExp("a.*a"), "" ); // becomes "b" |
1826 | 1863 | ||
1827 | s = "banana"; | 1864 | s = "banana"; |
1828 | s.replace( QRegExp("^[bn]a"), "X" ); // becomes "Xnana" | 1865 | s.replace( QRegExp("^[bn]a"), "X" ); // becomes "Xnana" |
1829 | 1866 | ||
1830 | s = "banana"; | 1867 | s = "banana"; |
1831 | s.replace( QRegExp("^[bn]a"), "" ); // becomes "nana" | 1868 | s.replace( QRegExp("^[bn]a"), "" ); // becomes "nana" |
1832 | \endcode | 1869 | \endcode |
1833 | 1870 | ||
1834 | \warning If you want to apply this function repeatedly to the same | 1871 | \warning If you want to apply this function repeatedly to the same |
1835 | string it is more efficient to convert the string to a QString and | 1872 | string it is more efficient to convert the string to a QString and |
1836 | apply the function to that. | 1873 | apply the function to that. |
1837 | */ | 1874 | */ |
1838 | 1875 | ||
1839 | QCString &QCString::replace( const QRegExp &rx, const char *str ) | 1876 | QCString &QCString::replace( const QRegExp &rx, const char *str ) |
1840 | { | 1877 | { |
1841 | QString d = QString::fromLatin1( data() ); | 1878 | QString d = QString::fromAscii( data() ); |
1842 | QString r = QString::fromLatin1( str ); | 1879 | QString r = QString::fromAscii( str ); |
1843 | d.replace( rx, r ); | 1880 | d.replace( rx, r ); |
1844 | setStr( d.ascii() ); | 1881 | setStr( d.ascii() ); |
1845 | return *this; | 1882 | return *this; |
1846 | } | 1883 | } |
1847 | #endif //QT_NO_REGEXP | 1884 | #endif //QT_NO_REGEXP |
1848 | 1885 | ||
1849 | /*! | 1886 | /*! |
1850 | Returns the string converted to a \c long value. | 1887 | Returns the string converted to a \c long value. |
1851 | 1888 | ||
1852 | If \a ok is not 0: \a *ok is set to FALSE if the string is not a | 1889 | If \a ok is not 0: \a *ok is set to FALSE if the string is not a |
1853 | number, or if it has trailing garbage; otherwise \a *ok is set to | 1890 | number, or if it has trailing garbage; otherwise \a *ok is set to |
1854 | TRUE. | 1891 | TRUE. |
1855 | */ | 1892 | */ |
1856 | 1893 | ||
1857 | long QCString::toLong( bool *ok ) const | 1894 | long QCString::toLong( bool *ok ) const |
1858 | { | 1895 | { |
@@ -2186,49 +2223,49 @@ bool QCString::setExpand( uint index, char c ) | |||
2186 | 2223 | ||
2187 | Appends string \a str to the string and returns a reference to the | 2224 | Appends string \a str to the string and returns a reference to the |
2188 | string. Equivalent to operator+=(). | 2225 | string. Equivalent to operator+=(). |
2189 | */ | 2226 | */ |
2190 | 2227 | ||
2191 | /*! | 2228 | /*! |
2192 | Appends string \a str to the string and returns a reference to the string. | 2229 | Appends string \a str to the string and returns a reference to the string. |
2193 | */ | 2230 | */ |
2194 | 2231 | ||
2195 | QCString& QCString::operator+=( const char *str ) | 2232 | QCString& QCString::operator+=( const char *str ) |
2196 | { | 2233 | { |
2197 | if ( !str ) | 2234 | if ( !str ) |
2198 | return *this; // nothing to append | 2235 | return *this; // nothing to append |
2199 | detach(); | 2236 | detach(); |
2200 | uint len1 = length(); | 2237 | uint len1 = length(); |
2201 | uint len2 = qstrlen(str); | 2238 | uint len2 = qstrlen(str); |
2202 | if ( !QByteArray::resize( len1 + len2 + 1 ) ) | 2239 | if ( !QByteArray::resize( len1 + len2 + 1, QByteArray::SpeedOptim ) ) |
2203 | return *this; // no memory | 2240 | return *this; // no memory |
2204 | memcpy( data() + len1, str, len2 + 1 ); | 2241 | memcpy( data() + len1, str, len2 + 1 ); |
2205 | return *this; | 2242 | return *this; |
2206 | } | 2243 | } |
2207 | 2244 | ||
2208 | /*! | 2245 | /*! |
2209 | \overload | 2246 | \overload |
2210 | 2247 | ||
2211 | Appends character \a c to the string and returns a reference to the string. | 2248 | Appends character \a c to the string and returns a reference to the string. |
2212 | */ | 2249 | */ |
2213 | 2250 | ||
2214 | QCString &QCString::operator+=( char c ) | 2251 | QCString &QCString::operator+=( char c ) |
2215 | { | 2252 | { |
2216 | detach(); | 2253 | detach(); |
2217 | uint len = length(); | 2254 | uint len = length(); |
2218 | if ( !QByteArray::resize( len + 2 ) ) | 2255 | if ( !QByteArray::resize( len + 2, QByteArray::SpeedOptim ) ) |
2219 | return *this; // no memory | 2256 | return *this; // no memory |
2220 | *(data() + len) = c; | 2257 | *(data() + len) = c; |
2221 | *(data() + len+1) = '\0'; | 2258 | *(data() + len+1) = '\0'; |
2222 | return *this; | 2259 | return *this; |
2223 | } | 2260 | } |
2224 | 2261 | ||
2225 | 2262 | ||
2226 | /***************************************************************************** | 2263 | /***************************************************************************** |
2227 | QCString stream functions | 2264 | QCString stream functions |
2228 | *****************************************************************************/ | 2265 | *****************************************************************************/ |
2229 | #ifndef QT_NO_DATASTREAM | 2266 | #ifndef QT_NO_DATASTREAM |
2230 | /*! | 2267 | /*! |
2231 | \relates QCString | 2268 | \relates QCString |
2232 | 2269 | ||
2233 | Writes string \a str to the stream \a s. | 2270 | Writes string \a str to the stream \a s. |
2234 | 2271 | ||
diff --git a/qmake/tools/qdatastream.cpp b/qmake/tools/qdatastream.cpp index 9c573c7..51a1448 100644 --- a/qmake/tools/qdatastream.cpp +++ b/qmake/tools/qdatastream.cpp | |||
@@ -737,34 +737,42 @@ QDataStream &QDataStream::readBytes( char *&s, uint &l ) | |||
737 | 737 | ||
738 | 738 | ||
739 | /*! | 739 | /*! |
740 | Reads \a len bytes from the stream into \a s and returns a | 740 | Reads \a len bytes from the stream into \a s and returns a |
741 | reference to the stream. | 741 | reference to the stream. |
742 | 742 | ||
743 | The buffer \a s must be preallocated. The data is \e not encoded. | 743 | The buffer \a s must be preallocated. The data is \e not encoded. |
744 | 744 | ||
745 | \sa readBytes(), QIODevice::readBlock(), writeRawBytes() | 745 | \sa readBytes(), QIODevice::readBlock(), writeRawBytes() |
746 | */ | 746 | */ |
747 | 747 | ||
748 | QDataStream &QDataStream::readRawBytes( char *s, uint len ) | 748 | QDataStream &QDataStream::readRawBytes( char *s, uint len ) |
749 | { | 749 | { |
750 | CHECK_STREAM_PRECOND | 750 | CHECK_STREAM_PRECOND |
751 | if ( printable ) { // printable data | 751 | if ( printable ) { // printable data |
752 | register Q_INT8 *p = (Q_INT8*)s; | 752 | register Q_INT8 *p = (Q_INT8*)s; |
753 | while ( len-- ) | 753 | if ( version() < 4 ) { |
754 | *this >> *p++; | 754 | while ( len-- ) { |
755 | Q_INT32 tmp; | ||
756 | *this >> tmp; | ||
757 | *p++ = tmp; | ||
758 | } | ||
759 | } else { | ||
760 | while ( len-- ) | ||
761 | *this >> *p++; | ||
762 | } | ||
755 | } else { // read data char array | 763 | } else { // read data char array |
756 | dev->readBlock( s, len ); | 764 | dev->readBlock( s, len ); |
757 | } | 765 | } |
758 | return *this; | 766 | return *this; |
759 | } | 767 | } |
760 | 768 | ||
761 | 769 | ||
762 | /***************************************************************************** | 770 | /***************************************************************************** |
763 | QDataStream write functions | 771 | QDataStream write functions |
764 | *****************************************************************************/ | 772 | *****************************************************************************/ |
765 | 773 | ||
766 | 774 | ||
767 | /*! | 775 | /*! |
768 | \overload QDataStream &QDataStream::operator<<( Q_UINT8 i ) | 776 | \overload QDataStream &QDataStream::operator<<( Q_UINT8 i ) |
769 | 777 | ||
770 | Writes an unsigned byte, \a i, to the stream and returns a | 778 | Writes an unsigned byte, \a i, to the stream and returns a |
@@ -999,26 +1007,32 @@ QDataStream &QDataStream::writeBytes(const char *s, uint len) | |||
999 | writeRawBytes( s, len ); | 1007 | writeRawBytes( s, len ); |
1000 | return *this; | 1008 | return *this; |
1001 | } | 1009 | } |
1002 | 1010 | ||
1003 | 1011 | ||
1004 | /*! | 1012 | /*! |
1005 | Writes \a len bytes from \a s to the stream and returns a | 1013 | Writes \a len bytes from \a s to the stream and returns a |
1006 | reference to the stream. The data is \e not encoded. | 1014 | reference to the stream. The data is \e not encoded. |
1007 | 1015 | ||
1008 | \sa writeBytes(), QIODevice::writeBlock(), readRawBytes() | 1016 | \sa writeBytes(), QIODevice::writeBlock(), readRawBytes() |
1009 | */ | 1017 | */ |
1010 | 1018 | ||
1011 | QDataStream &QDataStream::writeRawBytes( const char *s, uint len ) | 1019 | QDataStream &QDataStream::writeRawBytes( const char *s, uint len ) |
1012 | { | 1020 | { |
1013 | CHECK_STREAM_PRECOND | 1021 | CHECK_STREAM_PRECOND |
1014 | if ( printable ) { // write printable | 1022 | if ( printable ) { // write printable |
1015 | register Q_INT8 *p = (Q_INT8*)s; | 1023 | if ( version() < 4 ) { |
1016 | while ( len-- ) | 1024 | register char *p = (char *)s; |
1017 | *this << *p++; | 1025 | while ( len-- ) |
1026 | *this << *p++; | ||
1027 | } else { | ||
1028 | register Q_INT8 *p = (Q_INT8*)s; | ||
1029 | while ( len-- ) | ||
1030 | *this << *p++; | ||
1031 | } | ||
1018 | } else { // write data char array | 1032 | } else { // write data char array |
1019 | dev->writeBlock( s, len ); | 1033 | dev->writeBlock( s, len ); |
1020 | } | 1034 | } |
1021 | return *this; | 1035 | return *this; |
1022 | } | 1036 | } |
1023 | 1037 | ||
1024 | #endif // QT_NO_DATASTREAM | 1038 | #endif // QT_NO_DATASTREAM |
diff --git a/qmake/tools/qdatetime.cpp b/qmake/tools/qdatetime.cpp index 93e40a8..3137877 100644 --- a/qmake/tools/qdatetime.cpp +++ b/qmake/tools/qdatetime.cpp | |||
@@ -1,54 +1,53 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of date and time classes | 4 | ** Implementation of date and time classes |
5 | ** | 5 | ** |
6 | ** Created : 940124 | 6 | ** Created : 940124 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | // Get the system specific includes and defines | ||
39 | #include "qplatformdefs.h" | 38 | #include "qplatformdefs.h" |
40 | 39 | ||
41 | #include "qdatetime.h" | 40 | #include "qdatetime.h" |
42 | #include "qdatastream.h" | 41 | #include "qdatastream.h" |
43 | #include "qregexp.h" | 42 | #include "qregexp.h" |
44 | 43 | ||
45 | #include <stdio.h> | 44 | #include <stdio.h> |
46 | #ifndef Q_OS_TEMP | 45 | #ifndef Q_OS_TEMP |
47 | #include <time.h> | 46 | #include <time.h> |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | #if defined(Q_OS_WIN32) | 49 | #if defined(Q_OS_WIN32) |
51 | #include <windows.h> | 50 | #include <windows.h> |
52 | #endif | 51 | #endif |
53 | 52 | ||
54 | static const uint FIRST_DAY = 2361222;// Julian day for 1752-09-14 | 53 | static const uint FIRST_DAY = 2361222;// Julian day for 1752-09-14 |
@@ -882,32 +881,38 @@ QDate QDate::addMonths( int nmonths ) const | |||
882 | return date; | 881 | return date; |
883 | 882 | ||
884 | } | 883 | } |
885 | 884 | ||
886 | /*! | 885 | /*! |
887 | Returns a QDate object containing a date \a nyears later than the | 886 | Returns a QDate object containing a date \a nyears later than the |
888 | date of this object (or earlier if \a nyears is negative). | 887 | date of this object (or earlier if \a nyears is negative). |
889 | 888 | ||
890 | \sa addDays(), addMonths() | 889 | \sa addDays(), addMonths() |
891 | */ | 890 | */ |
892 | 891 | ||
893 | QDate QDate::addYears( int nyears ) const | 892 | QDate QDate::addYears( int nyears ) const |
894 | { | 893 | { |
895 | int y, m, d; | 894 | int y, m, d; |
896 | julianToGregorian( jd, y, m, d ); | 895 | julianToGregorian( jd, y, m, d ); |
897 | y += nyears; | 896 | y += nyears; |
897 | |||
898 | QDate tmp(y,m,1); | ||
899 | |||
900 | if( d > tmp.daysInMonth() ) | ||
901 | d = tmp.daysInMonth(); | ||
902 | |||
898 | QDate date(y, m, d); | 903 | QDate date(y, m, d); |
899 | return date; | 904 | return date; |
900 | } | 905 | } |
901 | 906 | ||
902 | 907 | ||
903 | 908 | ||
904 | /*! | 909 | /*! |
905 | Returns the number of days from this date to \a d (which is | 910 | Returns the number of days from this date to \a d (which is |
906 | negative if \a d is earlier than this date). | 911 | negative if \a d is earlier than this date). |
907 | 912 | ||
908 | Example: | 913 | Example: |
909 | \code | 914 | \code |
910 | QDate d1( 1995, 5, 17 ); // May 17th 1995 | 915 | QDate d1( 1995, 5, 17 ); // May 17th 1995 |
911 | QDate d2( 1995, 5, 20 ); // May 20th 1995 | 916 | QDate d2( 1995, 5, 20 ); // May 20th 1995 |
912 | d1.daysTo( d2 ); // returns 3 | 917 | d1.daysTo( d2 ); // returns 3 |
913 | d2.daysTo( d1 ); // returns -3 | 918 | d2.daysTo( d1 ); // returns -3 |
@@ -977,39 +982,51 @@ QDate QDate::currentDate() | |||
977 | TimeSpec \a ts. The default TimeSpec is LocalTime. | 982 | TimeSpec \a ts. The default TimeSpec is LocalTime. |
978 | 983 | ||
979 | \sa QTime::currentTime(), QDateTime::currentDateTime(), Qt::TimeSpec | 984 | \sa QTime::currentTime(), QDateTime::currentDateTime(), Qt::TimeSpec |
980 | */ | 985 | */ |
981 | QDate QDate::currentDate( Qt::TimeSpec ts ) | 986 | QDate QDate::currentDate( Qt::TimeSpec ts ) |
982 | { | 987 | { |
983 | QDate d; | 988 | QDate d; |
984 | #if defined(Q_OS_WIN32) | 989 | #if defined(Q_OS_WIN32) |
985 | SYSTEMTIME t; | 990 | SYSTEMTIME t; |
986 | memset( &t, 0, sizeof(SYSTEMTIME) ); | 991 | memset( &t, 0, sizeof(SYSTEMTIME) ); |
987 | if ( ts == Qt::LocalTime ) | 992 | if ( ts == Qt::LocalTime ) |
988 | GetLocalTime( &t ); | 993 | GetLocalTime( &t ); |
989 | else | 994 | else |
990 | GetSystemTime( &t ); | 995 | GetSystemTime( &t ); |
991 | d.jd = gregorianToJulian( t.wYear, t.wMonth, t.wDay ); | 996 | d.jd = gregorianToJulian( t.wYear, t.wMonth, t.wDay ); |
992 | #else | 997 | #else |
998 | // posix compliant system | ||
993 | time_t ltime; | 999 | time_t ltime; |
994 | time( <ime ); | 1000 | time( <ime ); |
995 | tm *t; | 1001 | tm *t; |
1002 | |||
1003 | # if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) | ||
1004 | // use the reentrant versions of localtime() and gmtime() where available | ||
1005 | tm res; | ||
1006 | if ( ts == Qt::LocalTime ) | ||
1007 | t = localtime_r( <ime, &res ); | ||
1008 | else | ||
1009 | t = gmtime_r( <ime, &res ); | ||
1010 | # else | ||
996 | if ( ts == Qt::LocalTime ) | 1011 | if ( ts == Qt::LocalTime ) |
997 | t = localtime( <ime ); | 1012 | t = localtime( <ime ); |
998 | else | 1013 | else |
999 | t = gmtime( <ime ); | 1014 | t = gmtime( <ime ); |
1015 | # endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS | ||
1016 | |||
1000 | d.jd = gregorianToJulian( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday ); | 1017 | d.jd = gregorianToJulian( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday ); |
1001 | #endif | 1018 | #endif |
1002 | return d; | 1019 | return d; |
1003 | } | 1020 | } |
1004 | 1021 | ||
1005 | #ifndef QT_NO_DATESTRING | 1022 | #ifndef QT_NO_DATESTRING |
1006 | /*! | 1023 | /*! |
1007 | Returns the QDate represented by the string \a s, using the format | 1024 | Returns the QDate represented by the string \a s, using the format |
1008 | \a f, or an invalid date if the string cannot be parsed. | 1025 | \a f, or an invalid date if the string cannot be parsed. |
1009 | 1026 | ||
1010 | Note for \c Qt::TextDate: It is recommended that you use the | 1027 | Note for \c Qt::TextDate: It is recommended that you use the |
1011 | English short month names (e.g. "Jan"). Although localized month | 1028 | English short month names (e.g. "Jan"). Although localized month |
1012 | names can also be used, they depend on the user's locale settings. | 1029 | names can also be used, they depend on the user's locale settings. |
1013 | 1030 | ||
1014 | \warning \c Qt::LocalDate cannot be used here. | 1031 | \warning \c Qt::LocalDate cannot be used here. |
1015 | */ | 1032 | */ |
@@ -1542,33 +1559,33 @@ int QTime::msecsTo( const QTime &t ) const | |||
1542 | 1559 | ||
1543 | /*! | 1560 | /*! |
1544 | \fn bool QTime::operator>( const QTime &t ) const | 1561 | \fn bool QTime::operator>( const QTime &t ) const |
1545 | 1562 | ||
1546 | Returns TRUE if this time is later than \a t; otherwise returns FALSE. | 1563 | Returns TRUE if this time is later than \a t; otherwise returns FALSE. |
1547 | */ | 1564 | */ |
1548 | 1565 | ||
1549 | /*! | 1566 | /*! |
1550 | \fn bool QTime::operator>=( const QTime &t ) const | 1567 | \fn bool QTime::operator>=( const QTime &t ) const |
1551 | 1568 | ||
1552 | Returns TRUE if this time is later than or equal to \a t; | 1569 | Returns TRUE if this time is later than or equal to \a t; |
1553 | otherwise returns FALSE. | 1570 | otherwise returns FALSE. |
1554 | */ | 1571 | */ |
1555 | 1572 | ||
1556 | 1573 | ||
1557 | 1574 | ||
1558 | /*! | 1575 | /*! |
1559 | \overload | 1576 | \overload |
1560 | 1577 | ||
1561 | Returns the current time as reported by the system clock. | 1578 | Returns the current time as reported by the system clock. |
1562 | 1579 | ||
1563 | Note that the accuracy depends on the accuracy of the underlying | 1580 | Note that the accuracy depends on the accuracy of the underlying |
1564 | operating system; not all systems provide 1-millisecond accuracy. | 1581 | operating system; not all systems provide 1-millisecond accuracy. |
1565 | */ | 1582 | */ |
1566 | 1583 | ||
1567 | QTime QTime::currentTime() | 1584 | QTime QTime::currentTime() |
1568 | { | 1585 | { |
1569 | return currentTime( Qt::LocalTime ); | 1586 | return currentTime( Qt::LocalTime ); |
1570 | } | 1587 | } |
1571 | 1588 | ||
1572 | /*! | 1589 | /*! |
1573 | Returns the current time as reported by the system clock, for the | 1590 | Returns the current time as reported by the system clock, for the |
1574 | TimeSpec \a ts. The default TimeSpec is LocalTime. | 1591 | TimeSpec \a ts. The default TimeSpec is LocalTime. |
@@ -1640,48 +1657,59 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts ) | |||
1640 | #if defined(QT_CHECK_NULL) | 1657 | #if defined(QT_CHECK_NULL) |
1641 | qWarning( "QTime::currentTime(QTime *): Null pointer not allowed" ); | 1658 | qWarning( "QTime::currentTime(QTime *): Null pointer not allowed" ); |
1642 | #endif | 1659 | #endif |
1643 | return FALSE; | 1660 | return FALSE; |
1644 | } | 1661 | } |
1645 | 1662 | ||
1646 | #if defined(Q_OS_WIN32) | 1663 | #if defined(Q_OS_WIN32) |
1647 | SYSTEMTIME t; | 1664 | SYSTEMTIME t; |
1648 | if ( ts == Qt::LocalTime ) { | 1665 | if ( ts == Qt::LocalTime ) { |
1649 | GetLocalTime( &t ); | 1666 | GetLocalTime( &t ); |
1650 | } else { | 1667 | } else { |
1651 | GetSystemTime( &t ); | 1668 | GetSystemTime( &t ); |
1652 | } | 1669 | } |
1653 | ct->ds = (uint)( MSECS_PER_HOUR*t.wHour + MSECS_PER_MIN*t.wMinute + | 1670 | ct->ds = (uint)( MSECS_PER_HOUR*t.wHour + MSECS_PER_MIN*t.wMinute + |
1654 | 1000*t.wSecond + t.wMilliseconds ); | 1671 | 1000*t.wSecond + t.wMilliseconds ); |
1655 | #elif defined(Q_OS_UNIX) | 1672 | #elif defined(Q_OS_UNIX) |
1673 | // posix compliant system | ||
1656 | struct timeval tv; | 1674 | struct timeval tv; |
1657 | gettimeofday( &tv, 0 ); | 1675 | gettimeofday( &tv, 0 ); |
1658 | time_t ltime = tv.tv_sec; | 1676 | time_t ltime = tv.tv_sec; |
1659 | tm *t; | 1677 | tm *t; |
1660 | if ( ts == Qt::LocalTime ) { | 1678 | |
1679 | # if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) | ||
1680 | // use the reentrant versions of localtime() and gmtime() where available | ||
1681 | tm res; | ||
1682 | if ( ts == Qt::LocalTime ) | ||
1683 | t = localtime_r( <ime, &res ); | ||
1684 | else | ||
1685 | t = gmtime_r( <ime, &res ); | ||
1686 | # else | ||
1687 | if ( ts == Qt::LocalTime ) | ||
1661 | t = localtime( <ime ); | 1688 | t = localtime( <ime ); |
1662 | } else { | 1689 | else |
1663 | t = gmtime( <ime ); | 1690 | t = gmtime( <ime ); |
1664 | } | 1691 | # endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS |
1692 | |||
1665 | ct->ds = (uint)( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + | 1693 | ct->ds = (uint)( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + |
1666 | 1000 * t->tm_sec + tv.tv_usec / 1000 ); | 1694 | 1000 * t->tm_sec + tv.tv_usec / 1000 ); |
1667 | #else | 1695 | #else |
1668 | time_t ltime; // no millisecond resolution | 1696 | time_t ltime; // no millisecond resolution |
1669 | ::time( <ime ); | 1697 | ::time( <ime ); |
1670 | tm *t; | 1698 | tm *t; |
1671 | if ( ts == Qt::LocalTime ) | 1699 | if ( ts == Qt::LocalTime ) |
1672 | localtime( <ime ); | 1700 | localtime( <ime ); |
1673 | else | 1701 | else |
1674 | gmtime( <ime ); | 1702 | gmtime( <ime ); |
1675 | ct->ds = (uint) ( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + | 1703 | ct->ds = (uint) ( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + |
1676 | 1000 * t->tm_sec ); | 1704 | 1000 * t->tm_sec ); |
1677 | #endif | 1705 | #endif |
1678 | // 00:00.00 to 00:00.59.999 is considered as "midnight or right after" | 1706 | // 00:00.00 to 00:00.59.999 is considered as "midnight or right after" |
1679 | return ct->ds < (uint) MSECS_PER_MIN; | 1707 | return ct->ds < (uint) MSECS_PER_MIN; |
1680 | } | 1708 | } |
1681 | 1709 | ||
1682 | /*! | 1710 | /*! |
1683 | \overload | 1711 | \overload |
1684 | 1712 | ||
1685 | Returns TRUE if the specified time is valid; otherwise returns | 1713 | Returns TRUE if the specified time is valid; otherwise returns |
1686 | FALSE. | 1714 | FALSE. |
1687 | 1715 | ||
@@ -1693,35 +1721,35 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts ) | |||
1693 | QTime::isValid(21, 10, 30); // returns TRUE | 1721 | QTime::isValid(21, 10, 30); // returns TRUE |
1694 | QTime::isValid(22, 5, 62); // returns FALSE | 1722 | QTime::isValid(22, 5, 62); // returns FALSE |
1695 | \endcode | 1723 | \endcode |
1696 | */ | 1724 | */ |
1697 | 1725 | ||
1698 | bool QTime::isValid( int h, int m, int s, int ms ) | 1726 | bool QTime::isValid( int h, int m, int s, int ms ) |
1699 | { | 1727 | { |
1700 | return (uint)h < 24 && (uint)m < 60 && (uint)s < 60 && (uint)ms < 1000; | 1728 | return (uint)h < 24 && (uint)m < 60 && (uint)s < 60 && (uint)ms < 1000; |
1701 | } | 1729 | } |
1702 | 1730 | ||
1703 | 1731 | ||
1704 | /*! | 1732 | /*! |
1705 | Sets this time to the current time. This is practical for timing: | 1733 | Sets this time to the current time. This is practical for timing: |
1706 | 1734 | ||
1707 | \code | 1735 | \code |
1708 | QTime t; | 1736 | QTime t; |
1709 | t.start(); // start clock | 1737 | t.start(); |
1710 | ... // some lengthy task | 1738 | some_lengthy_task(); |
1711 | qDebug( "%d\n", t.elapsed() ); // prints the number of msecs elapsed | 1739 | qDebug( "Time elapsed: %d ms", t.elapsed() ); |
1712 | \endcode | 1740 | \endcode |
1713 | 1741 | ||
1714 | \sa restart(), elapsed(), currentTime() | 1742 | \sa restart(), elapsed(), currentTime() |
1715 | */ | 1743 | */ |
1716 | 1744 | ||
1717 | void QTime::start() | 1745 | void QTime::start() |
1718 | { | 1746 | { |
1719 | *this = currentTime(); | 1747 | *this = currentTime(); |
1720 | } | 1748 | } |
1721 | 1749 | ||
1722 | /*! | 1750 | /*! |
1723 | Sets this time to the current time and returns the number of | 1751 | Sets this time to the current time and returns the number of |
1724 | milliseconds that have elapsed since the last time start() or | 1752 | milliseconds that have elapsed since the last time start() or |
1725 | restart() was called. | 1753 | restart() was called. |
1726 | 1754 | ||
1727 | This function is guaranteed to be atomic and is thus very handy | 1755 | This function is guaranteed to be atomic and is thus very handy |
@@ -1947,42 +1975,60 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC ) | |||
1947 | /*! | 1975 | /*! |
1948 | Sets the date and time to \a ts time (\c Qt::LocalTime or \c | 1976 | Sets the date and time to \a ts time (\c Qt::LocalTime or \c |
1949 | Qt::UTC) given the number of seconds that have passed since | 1977 | Qt::UTC) given the number of seconds that have passed since |
1950 | 1970-01-01T00:00:00, Coordinated Universal Time (UTC). On systems | 1978 | 1970-01-01T00:00:00, Coordinated Universal Time (UTC). On systems |
1951 | that do not support timezones this function will behave as if | 1979 | that do not support timezones this function will behave as if |
1952 | local time were UTC. | 1980 | local time were UTC. |
1953 | 1981 | ||
1954 | On Windows, only a subset of \a secsSince1Jan1970UTC values are | 1982 | On Windows, only a subset of \a secsSince1Jan1970UTC values are |
1955 | supported, as Windows starts counting from 1980. | 1983 | supported, as Windows starts counting from 1980. |
1956 | 1984 | ||
1957 | \sa toTime_t() | 1985 | \sa toTime_t() |
1958 | */ | 1986 | */ |
1959 | void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts ) | 1987 | void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts ) |
1960 | { | 1988 | { |
1961 | time_t tmp = (time_t) secsSince1Jan1970UTC; | 1989 | time_t tmp = (time_t) secsSince1Jan1970UTC; |
1962 | tm *brokenDown = 0; | 1990 | tm *brokenDown = 0; |
1991 | |||
1992 | #if defined(Q_OS_UNIX) && defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) | ||
1993 | // posix compliant system | ||
1994 | // use the reentrant versions of localtime() and gmtime() where available | ||
1995 | tm res; | ||
1996 | if ( ts == Qt::LocalTime ) | ||
1997 | brokenDown = localtime_r( &tmp, &res ); | ||
1998 | if ( !brokenDown ) { | ||
1999 | brokenDown = gmtime_r( &tmp, &res ); | ||
2000 | if ( !brokenDown ) { | ||
2001 | d.jd = QDate::gregorianToJulian( 1970, 1, 1 ); | ||
2002 | t.ds = 0; | ||
2003 | return; | ||
2004 | } | ||
2005 | } | ||
2006 | #else | ||
1963 | if ( ts == Qt::LocalTime ) | 2007 | if ( ts == Qt::LocalTime ) |
1964 | brokenDown = localtime( &tmp ); | 2008 | brokenDown = localtime( &tmp ); |
1965 | if ( !brokenDown ) { | 2009 | if ( !brokenDown ) { |
1966 | brokenDown = gmtime( &tmp ); | 2010 | brokenDown = gmtime( &tmp ); |
1967 | if ( !brokenDown ) { | 2011 | if ( !brokenDown ) { |
1968 | d.jd = QDate::gregorianToJulian( 1970, 1, 1 ); | 2012 | d.jd = QDate::gregorianToJulian( 1970, 1, 1 ); |
1969 | t.ds = 0; | 2013 | t.ds = 0; |
1970 | return; | 2014 | return; |
1971 | } | 2015 | } |
1972 | } | 2016 | } |
2017 | #endif | ||
2018 | |||
1973 | d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900, | 2019 | d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900, |
1974 | brokenDown->tm_mon + 1, | 2020 | brokenDown->tm_mon + 1, |
1975 | brokenDown->tm_mday ); | 2021 | brokenDown->tm_mday ); |
1976 | t.ds = MSECS_PER_HOUR * brokenDown->tm_hour + | 2022 | t.ds = MSECS_PER_HOUR * brokenDown->tm_hour + |
1977 | MSECS_PER_MIN * brokenDown->tm_min + | 2023 | MSECS_PER_MIN * brokenDown->tm_min + |
1978 | 1000 * brokenDown->tm_sec; | 2024 | 1000 * brokenDown->tm_sec; |
1979 | } | 2025 | } |
1980 | #ifndef QT_NO_DATESTRING | 2026 | #ifndef QT_NO_DATESTRING |
1981 | #ifndef QT_NO_SPRINTF | 2027 | #ifndef QT_NO_SPRINTF |
1982 | /*! | 2028 | /*! |
1983 | \overload | 2029 | \overload |
1984 | 2030 | ||
1985 | Returns the datetime as a string. The \a f parameter determines | 2031 | Returns the datetime as a string. The \a f parameter determines |
1986 | the format of the string. | 2032 | the format of the string. |
1987 | 2033 | ||
1988 | If \a f is \c Qt::TextDate, the string format is "Wed May 20 | 2034 | If \a f is \c Qt::TextDate, the string format is "Wed May 20 |
@@ -2287,33 +2333,33 @@ bool QDateTime::operator>( const QDateTime &dt ) const | |||
2287 | } | 2333 | } |
2288 | 2334 | ||
2289 | /*! | 2335 | /*! |
2290 | Returns TRUE if this datetime is later than or equal to \a dt; | 2336 | Returns TRUE if this datetime is later than or equal to \a dt; |
2291 | otherwise returns FALSE. | 2337 | otherwise returns FALSE. |
2292 | */ | 2338 | */ |
2293 | 2339 | ||
2294 | bool QDateTime::operator>=( const QDateTime &dt ) const | 2340 | bool QDateTime::operator>=( const QDateTime &dt ) const |
2295 | { | 2341 | { |
2296 | if ( d > dt.d ) | 2342 | if ( d > dt.d ) |
2297 | return TRUE; | 2343 | return TRUE; |
2298 | return d == dt.d ? t >= dt.t : FALSE; | 2344 | return d == dt.d ? t >= dt.t : FALSE; |
2299 | } | 2345 | } |
2300 | 2346 | ||
2301 | /*! | 2347 | /*! |
2302 | \overload | 2348 | \overload |
2303 | 2349 | ||
2304 | Returns the current datetime, as reported by the system clock. | 2350 | Returns the current datetime, as reported by the system clock. |
2305 | 2351 | ||
2306 | \sa QDate::currentDate(), QTime::currentTime() | 2352 | \sa QDate::currentDate(), QTime::currentTime() |
2307 | */ | 2353 | */ |
2308 | 2354 | ||
2309 | QDateTime QDateTime::currentDateTime() | 2355 | QDateTime QDateTime::currentDateTime() |
2310 | { | 2356 | { |
2311 | return currentDateTime( Qt::LocalTime ); | 2357 | return currentDateTime( Qt::LocalTime ); |
2312 | } | 2358 | } |
2313 | 2359 | ||
2314 | /*! | 2360 | /*! |
2315 | Returns the current datetime, as reported by the system clock, for the | 2361 | Returns the current datetime, as reported by the system clock, for the |
2316 | TimeSpec \a ts. The default TimeSpec is LocalTime. | 2362 | TimeSpec \a ts. The default TimeSpec is LocalTime. |
2317 | 2363 | ||
2318 | \sa QDate::currentDate(), QTime::currentTime(), Qt::TimeSpec | 2364 | \sa QDate::currentDate(), QTime::currentTime(), Qt::TimeSpec |
2319 | */ | 2365 | */ |
diff --git a/qmake/tools/qdir.cpp b/qmake/tools/qdir.cpp index 418ea49..5714878 100644 --- a/qmake/tools/qdir.cpp +++ b/qmake/tools/qdir.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QDir class | 4 | ** Implementation of QDir class |
5 | ** | 5 | ** |
6 | ** Created : 950427 | 6 | ** Created : 950427 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -30,39 +30,44 @@ | |||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qplatformdefs.h" | 38 | #include "qplatformdefs.h" |
39 | #include "qdir.h" | 39 | #include "qdir.h" |
40 | 40 | ||
41 | #ifndef QT_NO_DIR | 41 | #ifndef QT_NO_DIR |
42 | #include <private/qdir_p.h> | 42 | #include <private/qdir_p.h> |
43 | #include "qfileinfo.h" | 43 | #include "qfileinfo.h" |
44 | #include "qregexp.h" | 44 | #include "qregexp.h" |
45 | #include "qstringlist.h" | 45 | #include "qstringlist.h" |
46 | #include <stdlib.h> | 46 | #include <limits.h> |
47 | #include <ctype.h> | ||
48 | 47 | ||
48 | #if defined(Q_FS_FAT) && !defined(Q_OS_UNIX) | ||
49 | const bool CaseSensitiveFS = FALSE; | ||
50 | #else | ||
51 | const bool CaseSensitiveFS = TRUE; | ||
52 | #endif | ||
49 | 53 | ||
50 | 54 | ||
51 | /*! | 55 | /*! |
52 | \class QDir | 56 | \class QDir |
57 | \reentrant | ||
53 | \brief The QDir class provides access to directory structures and their contents in a platform-independent way. | 58 | \brief The QDir class provides access to directory structures and their contents in a platform-independent way. |
54 | 59 | ||
55 | \ingroup io | 60 | \ingroup io |
56 | \mainclass | 61 | \mainclass |
57 | 62 | ||
58 | A QDir is used to manipulate path names, access information | 63 | A QDir is used to manipulate path names, access information |
59 | regarding paths and files, and manipulate the underlying file | 64 | regarding paths and files, and manipulate the underlying file |
60 | system. | 65 | system. |
61 | 66 | ||
62 | A QDir can point to a file using either a relative or an absolute | 67 | A QDir can point to a file using either a relative or an absolute |
63 | path. Absolute paths begin with the directory separator "/" | 68 | path. Absolute paths begin with the directory separator "/" |
64 | (optionally preceded by a drive specification under Windows). If | 69 | (optionally preceded by a drive specification under Windows). If |
65 | you always use "/" as a directory separator, Qt will translate | 70 | you always use "/" as a directory separator, Qt will translate |
66 | your paths to conform to the underlying operating system. Relative | 71 | your paths to conform to the underlying operating system. Relative |
67 | file names begin with a directory name or a file name and specify | 72 | file names begin with a directory name or a file name and specify |
68 | a path relative to the current directory. | 73 | a path relative to the current directory. |
@@ -217,32 +222,40 @@ QDir::QDir( const QString &path, const QString &nameFilter, | |||
217 | 222 | ||
218 | \sa operator=() | 223 | \sa operator=() |
219 | */ | 224 | */ |
220 | 225 | ||
221 | QDir::QDir( const QDir &d ) | 226 | QDir::QDir( const QDir &d ) |
222 | { | 227 | { |
223 | dPath = d.dPath; | 228 | dPath = d.dPath; |
224 | fList = 0; | 229 | fList = 0; |
225 | fiList = 0; | 230 | fiList = 0; |
226 | nameFilt = d.nameFilt; | 231 | nameFilt = d.nameFilt; |
227 | dirty = TRUE; | 232 | dirty = TRUE; |
228 | allDirs = d.allDirs; | 233 | allDirs = d.allDirs; |
229 | filtS = d.filtS; | 234 | filtS = d.filtS; |
230 | sortS = d.sortS; | 235 | sortS = d.sortS; |
231 | } | 236 | } |
232 | 237 | ||
238 | /*! | ||
239 | Refreshes the directory information. | ||
240 | */ | ||
241 | void QDir::refresh() const | ||
242 | { | ||
243 | QDir* that = (QDir*) this; | ||
244 | that->dirty = TRUE; | ||
245 | } | ||
233 | 246 | ||
234 | void QDir::init() | 247 | void QDir::init() |
235 | { | 248 | { |
236 | fList = 0; | 249 | fList = 0; |
237 | fiList = 0; | 250 | fiList = 0; |
238 | nameFilt = QString::fromLatin1("*"); | 251 | nameFilt = QString::fromLatin1("*"); |
239 | dirty = TRUE; | 252 | dirty = TRUE; |
240 | allDirs = FALSE; | 253 | allDirs = FALSE; |
241 | filtS = All; | 254 | filtS = All; |
242 | sortS = SortSpec(Name | IgnoreCase); | 255 | sortS = SortSpec(Name | IgnoreCase); |
243 | } | 256 | } |
244 | 257 | ||
245 | /*! | 258 | /*! |
246 | Destroys the QDir frees up its resources. | 259 | Destroys the QDir frees up its resources. |
247 | */ | 260 | */ |
248 | 261 | ||
@@ -369,36 +382,62 @@ QString QDir::filePath( const QString &fileName, | |||
369 | 382 | ||
370 | If \a acceptAbsPath is TRUE a \a fileName starting with a | 383 | If \a acceptAbsPath is TRUE a \a fileName starting with a |
371 | separator "/" will be returned without change. If \a acceptAbsPath | 384 | separator "/" will be returned without change. If \a acceptAbsPath |
372 | is FALSE an absolute path will be prepended to the fileName and | 385 | is FALSE an absolute path will be prepended to the fileName and |
373 | the resultant string returned. | 386 | the resultant string returned. |
374 | 387 | ||
375 | \sa filePath() | 388 | \sa filePath() |
376 | */ | 389 | */ |
377 | 390 | ||
378 | QString QDir::absFilePath( const QString &fileName, | 391 | QString QDir::absFilePath( const QString &fileName, |
379 | bool acceptAbsPath ) const | 392 | bool acceptAbsPath ) const |
380 | { | 393 | { |
381 | if ( acceptAbsPath && !isRelativePath( fileName ) ) | 394 | if ( acceptAbsPath && !isRelativePath( fileName ) ) |
382 | return fileName; | 395 | return fileName; |
383 | 396 | ||
384 | QString tmp = absPath(); | 397 | QString tmp = absPath(); |
385 | if ( tmp.isEmpty() || (tmp[(int)tmp.length()-1] != '/' && !!fileName && | 398 | #ifdef Q_OS_WIN32 |
386 | fileName[0] != '/') ) | 399 | if ( fileName[0].isLetter() && fileName[1] == ':' ) { |
387 | tmp += '/'; | 400 | int drv = fileName.upper()[0].latin1() - 'A' + 1; |
388 | tmp += fileName; | 401 | if ( _getdrive() != drv ) { |
402 | if ( qt_winunicode ) { | ||
403 | TCHAR buf[PATH_MAX]; | ||
404 | ::_tgetdcwd( drv, buf, PATH_MAX ); | ||
405 | tmp.setUnicodeCodes( (ushort*)buf, ::_tcslen(buf) ); | ||
406 | } else { | ||
407 | char buf[PATH_MAX]; | ||
408 | ::_getdcwd( drv, buf, PATH_MAX ); | ||
409 | tmp = buf; | ||
410 | } | ||
411 | if ( !tmp.endsWith("\\") ) | ||
412 | tmp += "\\"; | ||
413 | tmp += fileName.right( fileName.length() - 2 ); | ||
414 | int x; | ||
415 | for ( x = 0; x < (int) tmp.length(); x++ ) { | ||
416 | if ( tmp[x] == '\\' ) | ||
417 | tmp[x] = '/'; | ||
418 | } | ||
419 | } | ||
420 | } else | ||
421 | #endif | ||
422 | { | ||
423 | if ( tmp.isEmpty() || (tmp[(int)tmp.length()-1] != '/' && !!fileName && | ||
424 | fileName[0] != '/') ) | ||
425 | tmp += '/'; | ||
426 | tmp += fileName; | ||
427 | } | ||
389 | return tmp; | 428 | return tmp; |
390 | } | 429 | } |
391 | 430 | ||
392 | 431 | ||
393 | /*! | 432 | /*! |
394 | Returns \a pathName with the '/' separators converted to | 433 | Returns \a pathName with the '/' separators converted to |
395 | separators that are appropriate for the underlying operating | 434 | separators that are appropriate for the underlying operating |
396 | system. | 435 | system. |
397 | 436 | ||
398 | On Windows, convertSeparators("c:/winnt/system32") returns | 437 | On Windows, convertSeparators("c:/winnt/system32") returns |
399 | "c:\winnt\system32". | 438 | "c:\winnt\system32". |
400 | 439 | ||
401 | The returned string may be the same as the argument on some | 440 | The returned string may be the same as the argument on some |
402 | operating systems, for example on Unix. | 441 | operating systems, for example on Unix. |
403 | */ | 442 | */ |
404 | 443 | ||
@@ -921,48 +960,50 @@ QDir &QDir::operator=( const QString &path ) | |||
921 | return *this; | 960 | return *this; |
922 | } | 961 | } |
923 | 962 | ||
924 | 963 | ||
925 | /*! | 964 | /*! |
926 | \fn bool QDir::operator!=( const QDir &d ) const | 965 | \fn bool QDir::operator!=( const QDir &d ) const |
927 | 966 | ||
928 | Returns TRUE if directory \a d and this directory have different | 967 | Returns TRUE if directory \a d and this directory have different |
929 | paths or different sort or filter settings; otherwise returns | 968 | paths or different sort or filter settings; otherwise returns |
930 | FALSE. | 969 | FALSE. |
931 | 970 | ||
932 | Example: | 971 | Example: |
933 | \code | 972 | \code |
934 | // The current directory is "/usr/local" | 973 | // The current directory is "/usr/local" |
935 | QDir d1( "/usr/local/bin" ); | 974 | QDir d1( "/usr/local/bin" ); |
936 | QDir d2( "bin" ); | 975 | QDir d2( "bin" ); |
937 | if ( d1 != d2 ) qDebug( "They differ\n" ); // This is printed | 976 | if ( d1 != d2 ) |
977 | qDebug( "They differ" ); | ||
938 | \endcode | 978 | \endcode |
939 | */ | 979 | */ |
940 | 980 | ||
941 | /*! | 981 | /*! |
942 | Returns TRUE if directory \a d and this directory have the same | 982 | Returns TRUE if directory \a d and this directory have the same |
943 | path and their sort and filter settings are the same; otherwise | 983 | path and their sort and filter settings are the same; otherwise |
944 | returns FALSE. | 984 | returns FALSE. |
945 | 985 | ||
946 | Example: | 986 | Example: |
947 | \code | 987 | \code |
948 | // The current directory is "/usr/local" | 988 | // The current directory is "/usr/local" |
949 | QDir d1( "/usr/local/bin" ); | 989 | QDir d1( "/usr/local/bin" ); |
950 | QDir d2( "bin" ); | 990 | QDir d2( "bin" ); |
951 | d2.convertToAbs(); | 991 | d2.convertToAbs(); |
952 | if ( d1 == d2 ) qDebug( "They're the same\n" ); // This is printed | 992 | if ( d1 == d2 ) |
993 | qDebug( "They're the same" ); | ||
953 | \endcode | 994 | \endcode |
954 | */ | 995 | */ |
955 | 996 | ||
956 | bool QDir::operator==( const QDir &d ) const | 997 | bool QDir::operator==( const QDir &d ) const |
957 | { | 998 | { |
958 | return dPath == d.dPath && | 999 | return dPath == d.dPath && |
959 | nameFilt == d.nameFilt && | 1000 | nameFilt == d.nameFilt && |
960 | allDirs == d.allDirs && | 1001 | allDirs == d.allDirs && |
961 | filtS == d.filtS && | 1002 | filtS == d.filtS && |
962 | sortS == d.sortS; | 1003 | sortS == d.sortS; |
963 | } | 1004 | } |
964 | 1005 | ||
965 | 1006 | ||
966 | /*! | 1007 | /*! |
967 | Removes the file, \a fileName. | 1008 | Removes the file, \a fileName. |
968 | 1009 | ||
@@ -1074,94 +1115,101 @@ QDir QDir::home() | |||
1074 | \sa rootDirPath() drives() | 1115 | \sa rootDirPath() drives() |
1075 | */ | 1116 | */ |
1076 | 1117 | ||
1077 | QDir QDir::root() | 1118 | QDir QDir::root() |
1078 | { | 1119 | { |
1079 | return QDir( rootDirPath() ); | 1120 | return QDir( rootDirPath() ); |
1080 | } | 1121 | } |
1081 | 1122 | ||
1082 | /*! | 1123 | /*! |
1083 | \fn QString QDir::homeDirPath() | 1124 | \fn QString QDir::homeDirPath() |
1084 | 1125 | ||
1085 | Returns the absolute path of the user's home directory. | 1126 | Returns the absolute path of the user's home directory. |
1086 | 1127 | ||
1087 | \sa home() | 1128 | \sa home() |
1088 | */ | 1129 | */ |
1089 | 1130 | ||
1090 | QStringList qt_makeFilterList( const QString &filter ) | 1131 | QValueList<QRegExp> qt_makeFilterList( const QString &filter ) |
1091 | { | 1132 | { |
1133 | QValueList<QRegExp> regExps; | ||
1092 | if ( filter.isEmpty() ) | 1134 | if ( filter.isEmpty() ) |
1093 | return QStringList(); | 1135 | return regExps; |
1094 | 1136 | ||
1095 | QChar sep( ';' ); | 1137 | QChar sep( ';' ); |
1096 | int i = filter.find( sep, 0 ); | 1138 | int i = filter.find( sep, 0 ); |
1097 | if ( i == -1 && filter.find( ' ', 0 ) != -1 ) | 1139 | if ( i == -1 && filter.find( ' ', 0 ) != -1 ) |
1098 | sep = QChar( ' ' ); | 1140 | sep = QChar( ' ' ); |
1099 | 1141 | ||
1100 | QStringList list = QStringList::split( sep, filter ); | 1142 | QStringList list = QStringList::split( sep, filter ); |
1101 | QStringList::Iterator it = list.begin(); | 1143 | QStringList::Iterator it = list.begin(); |
1102 | QStringList list2; | 1144 | while ( it != list.end() ) { |
1145 | regExps << QRegExp( (*it).stripWhiteSpace(), CaseSensitiveFS, TRUE ); | ||
1146 | ++it; | ||
1147 | } | ||
1148 | return regExps; | ||
1149 | } | ||
1103 | 1150 | ||
1104 | for ( ; it != list.end(); ++it ) { | 1151 | bool qt_matchFilterList( const QValueList<QRegExp>& filters, |
1105 | QString s = *it; | 1152 | const QString &fileName ) |
1106 | list2 << s.stripWhiteSpace(); | 1153 | { |
1154 | QValueList<QRegExp>::ConstIterator rit = filters.begin(); | ||
1155 | while ( rit != filters.end() ) { | ||
1156 | if ( (*rit).exactMatch(fileName) ) | ||
1157 | return TRUE; | ||
1158 | ++rit; | ||
1107 | } | 1159 | } |
1108 | return list2; | 1160 | return FALSE; |
1109 | } | 1161 | } |
1110 | 1162 | ||
1163 | |||
1111 | /*! | 1164 | /*! |
1112 | \overload | 1165 | \overload |
1113 | 1166 | ||
1114 | Returns TRUE if the \a fileName matches any of the wildcard (glob) | 1167 | Returns TRUE if the \a fileName matches any of the wildcard (glob) |
1115 | patterns in the list of \a filters; otherwise returns FALSE. | 1168 | patterns in the list of \a filters; otherwise returns FALSE. |
1116 | 1169 | ||
1117 | (See \link qregexp.html#wildcard-matching QRegExp wildcard | 1170 | (See \link qregexp.html#wildcard-matching QRegExp wildcard |
1118 | matching.\endlink) | 1171 | matching.\endlink) |
1119 | \sa QRegExp::match() | 1172 | \sa QRegExp::match() |
1120 | */ | 1173 | */ |
1121 | 1174 | ||
1122 | bool QDir::match( const QStringList &filters, const QString &fileName ) | 1175 | bool QDir::match( const QStringList &filters, const QString &fileName ) |
1123 | { | 1176 | { |
1124 | QStringList::ConstIterator sit = filters.begin(); | 1177 | QStringList::ConstIterator sit = filters.begin(); |
1125 | while ( sit != filters.end() ) { | 1178 | while ( sit != filters.end() ) { |
1126 | #if defined(Q_FS_FAT) && !defined(Q_OS_UNIX) | 1179 | QRegExp rx( *sit, CaseSensitiveFS, TRUE ); |
1127 | QRegExp rx( *sit, FALSE, TRUE ); // The FAT FS is not case sensitive.. | ||
1128 | #else | ||
1129 | QRegExp rx( *sit, TRUE, TRUE ); // ..while others are. | ||
1130 | #endif | ||
1131 | if ( rx.exactMatch(fileName) ) | 1180 | if ( rx.exactMatch(fileName) ) |
1132 | return TRUE; | 1181 | return TRUE; |
1133 | ++sit; | 1182 | ++sit; |
1134 | } | 1183 | } |
1135 | return FALSE; | 1184 | return FALSE; |
1136 | } | 1185 | } |
1137 | 1186 | ||
1138 | /*! | 1187 | /*! |
1139 | Returns TRUE if the \a fileName matches the wildcard (glob) | 1188 | Returns TRUE if the \a fileName matches the wildcard (glob) |
1140 | pattern \a filter; otherwise returns FALSE. The \a filter may | 1189 | pattern \a filter; otherwise returns FALSE. The \a filter may |
1141 | contain multiple patterns separated by spaces or semicolons. | 1190 | contain multiple patterns separated by spaces or semicolons. |
1142 | 1191 | ||
1143 | (See \link qregexp.html#wildcard-matching QRegExp wildcard | 1192 | (See \link qregexp.html#wildcard-matching QRegExp wildcard |
1144 | matching.\endlink) | 1193 | matching.\endlink) |
1145 | \sa QRegExp::match() | 1194 | \sa QRegExp::match() |
1146 | */ | 1195 | */ |
1147 | 1196 | ||
1148 | bool QDir::match( const QString &filter, const QString &fileName ) | 1197 | bool QDir::match( const QString &filter, const QString &fileName ) |
1149 | { | 1198 | { |
1150 | QStringList lst = qt_makeFilterList( filter ); | 1199 | return qt_matchFilterList( qt_makeFilterList(filter), fileName ); |
1151 | return match( lst, fileName ); | ||
1152 | } | 1200 | } |
1153 | 1201 | ||
1154 | 1202 | ||
1155 | /*! | 1203 | /*! |
1156 | Removes all multiple directory separators "/" and resolves any | 1204 | Removes all multiple directory separators "/" and resolves any |
1157 | "."s or ".."s found in the path, \a filePath. | 1205 | "."s or ".."s found in the path, \a filePath. |
1158 | 1206 | ||
1159 | Symbolic links are kept. This function does not return the | 1207 | Symbolic links are kept. This function does not return the |
1160 | canonical path, but rather the simplest version of the input. | 1208 | canonical path, but rather the simplest version of the input. |
1161 | For example, "./local" becomes "local", "local/../bin" becomes | 1209 | For example, "./local" becomes "local", "local/../bin" becomes |
1162 | "bin" and "/local/usr/../bin" becomes "/local/bin". | 1210 | "bin" and "/local/usr/../bin" becomes "/local/bin". |
1163 | 1211 | ||
1164 | \sa absPath() canonicalPath() | 1212 | \sa absPath() canonicalPath() |
1165 | */ | 1213 | */ |
1166 | 1214 | ||
1167 | QString QDir::cleanDirPath( const QString &filePath ) | 1215 | QString QDir::cleanDirPath( const QString &filePath ) |
diff --git a/qmake/tools/qdir_unix.cpp b/qmake/tools/qdir_unix.cpp index 57fe3c5..6a7adda 100644 --- a/qmake/tools/qdir_unix.cpp +++ b/qmake/tools/qdir_unix.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QDir class | 4 | ** Implementation of QDir class |
5 | ** | 5 | ** |
6 | ** Created : 950628 | 6 | ** Created : 950628 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses for Unix/X11 or for Qt/Embedded may use this file in accordance | 22 | ** licenses for Unix/X11 or for Qt/Embedded may use this file in accordance |
23 | ** with the Qt Commercial License Agreement provided with the Software. | 23 | ** with the Qt Commercial License Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -38,77 +38,78 @@ | |||
38 | #include "qplatformdefs.h" | 38 | #include "qplatformdefs.h" |
39 | #include "qdir.h" | 39 | #include "qdir.h" |
40 | 40 | ||
41 | #ifndef QT_NO_DIR | 41 | #ifndef QT_NO_DIR |
42 | 42 | ||
43 | #include "qdir_p.h" | 43 | #include "qdir_p.h" |
44 | #include "qfileinfo.h" | 44 | #include "qfileinfo.h" |
45 | #include "qregexp.h" | 45 | #include "qregexp.h" |
46 | #include "qstringlist.h" | 46 | #include "qstringlist.h" |
47 | 47 | ||
48 | #ifdef QT_THREAD_SUPPORT | 48 | #ifdef QT_THREAD_SUPPORT |
49 | # include <private/qmutexpool_p.h> | 49 | # include <private/qmutexpool_p.h> |
50 | #endif // QT_THREAD_SUPPORT | 50 | #endif // QT_THREAD_SUPPORT |
51 | 51 | ||
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | #include <limits.h> | 53 | #include <limits.h> |
54 | #include <errno.h> | ||
54 | 55 | ||
55 | 56 | ||
56 | void QDir::slashify( QString& ) | 57 | void QDir::slashify( QString& ) |
57 | { | 58 | { |
58 | } | 59 | } |
59 | 60 | ||
60 | QString QDir::homeDirPath() | 61 | QString QDir::homeDirPath() |
61 | { | 62 | { |
62 | QString d; | 63 | QString d; |
63 | d = QFile::decodeName(getenv("HOME")); | 64 | d = QFile::decodeName(getenv("HOME")); |
64 | slashify( d ); | 65 | slashify( d ); |
65 | if ( d.isNull() ) | 66 | if ( d.isNull() ) |
66 | d = rootDirPath(); | 67 | d = rootDirPath(); |
67 | return d; | 68 | return d; |
68 | } | 69 | } |
69 | 70 | ||
70 | QString QDir::canonicalPath() const | 71 | QString QDir::canonicalPath() const |
71 | { | 72 | { |
72 | QString r; | 73 | QString r; |
73 | |||
74 | char cur[PATH_MAX+1]; | 74 | char cur[PATH_MAX+1]; |
75 | if ( ::getcwd( cur, PATH_MAX ) ) | 75 | if ( ::getcwd( cur, PATH_MAX ) ) { |
76 | if ( ::chdir(QFile::encodeName(dPath)) >= 0 ) { | 76 | char tmp[PATH_MAX+1]; |
77 | char tmp[PATH_MAX+1]; | 77 | if( ::realpath( QFile::encodeName( dPath ), tmp ) ) |
78 | if ( ::getcwd( tmp, PATH_MAX ) ) | 78 | r = QFile::decodeName( tmp ); |
79 | r = QFile::decodeName(tmp); | 79 | slashify( r ); |
80 | ::chdir( cur ); | 80 | |
81 | } | 81 | // always make sure we go back to the current dir |
82 | 82 | ::chdir( cur ); | |
83 | slashify( r ); | 83 | } |
84 | return r; | 84 | return r; |
85 | } | 85 | } |
86 | 86 | ||
87 | bool QDir::mkdir( const QString &dirName, bool acceptAbsPath ) const | 87 | bool QDir::mkdir( const QString &dirName, bool acceptAbsPath ) const |
88 | { | 88 | { |
89 | #if defined(Q_OS_MACX) // Mac X doesn't support trailing /'s | 89 | #if defined(Q_OS_MACX) // Mac X doesn't support trailing /'s |
90 | QString name = dirName; | 90 | QString name = dirName; |
91 | if (dirName[dirName.length() - 1] == "/") | 91 | if (dirName[dirName.length() - 1] == "/") |
92 | name = dirName.left( dirName.length() - 1 ); | 92 | name = dirName.left( dirName.length() - 1 ); |
93 | return ::mkdir( QFile::encodeName(filePath(name,acceptAbsPath)), 0777 ) | 93 | int status = |
94 | == 0; | 94 | ::mkdir( QFile::encodeName(filePath(name,acceptAbsPath)), 0777 ); |
95 | #else | 95 | #else |
96 | return ::mkdir( QFile::encodeName(filePath(dirName,acceptAbsPath)), 0777 ) | 96 | int status = |
97 | == 0; | 97 | ::mkdir( QFile::encodeName(filePath(dirName,acceptAbsPath)), 0777 ); |
98 | #endif | 98 | #endif |
99 | return status == 0; | ||
99 | } | 100 | } |
100 | 101 | ||
101 | bool QDir::rmdir( const QString &dirName, bool acceptAbsPath ) const | 102 | bool QDir::rmdir( const QString &dirName, bool acceptAbsPath ) const |
102 | { | 103 | { |
103 | return ::rmdir( QFile::encodeName(filePath(dirName,acceptAbsPath)) ) == 0; | 104 | return ::rmdir( QFile::encodeName(filePath(dirName,acceptAbsPath)) ) == 0; |
104 | } | 105 | } |
105 | 106 | ||
106 | bool QDir::isReadable() const | 107 | bool QDir::isReadable() const |
107 | { | 108 | { |
108 | return ::access( QFile::encodeName(dPath), R_OK | X_OK ) == 0; | 109 | return ::access( QFile::encodeName(dPath), R_OK | X_OK ) == 0; |
109 | } | 110 | } |
110 | 111 | ||
111 | bool QDir::isRoot() const | 112 | bool QDir::isRoot() const |
112 | { | 113 | { |
113 | return dPath == QString::fromLatin1("/"); | 114 | return dPath == QString::fromLatin1("/"); |
114 | } | 115 | } |
@@ -173,60 +174,64 @@ bool QDir::isRelativePath( const QString &path ) | |||
173 | 174 | ||
174 | bool QDir::readDirEntries( const QString &nameFilter, | 175 | bool QDir::readDirEntries( const QString &nameFilter, |
175 | int filterSpec, int sortSpec ) | 176 | int filterSpec, int sortSpec ) |
176 | { | 177 | { |
177 | int i; | 178 | int i; |
178 | if ( !fList ) { | 179 | if ( !fList ) { |
179 | fList = new QStringList; | 180 | fList = new QStringList; |
180 | Q_CHECK_PTR( fList ); | 181 | Q_CHECK_PTR( fList ); |
181 | fiList = new QFileInfoList; | 182 | fiList = new QFileInfoList; |
182 | Q_CHECK_PTR( fiList ); | 183 | Q_CHECK_PTR( fiList ); |
183 | fiList->setAutoDelete( TRUE ); | 184 | fiList->setAutoDelete( TRUE ); |
184 | } else { | 185 | } else { |
185 | fList->clear(); | 186 | fList->clear(); |
186 | fiList->clear(); | 187 | fiList->clear(); |
187 | } | 188 | } |
188 | 189 | ||
189 | QStringList filters = qt_makeFilterList( nameFilter ); | 190 | QValueList<QRegExp> filters = qt_makeFilterList( nameFilter ); |
190 | 191 | ||
191 | bool doDirs = (filterSpec & Dirs)!= 0; | 192 | bool doDirs = (filterSpec & Dirs)!= 0; |
192 | bool doFiles = (filterSpec & Files)!= 0; | 193 | bool doFiles = (filterSpec & Files)!= 0; |
193 | bool noSymLinks = (filterSpec & NoSymLinks) != 0; | 194 | bool noSymLinks = (filterSpec & NoSymLinks) != 0; |
194 | bool doReadable = (filterSpec & Readable)!= 0; | 195 | bool doReadable = (filterSpec & Readable)!= 0; |
195 | bool doWritable = (filterSpec & Writable)!= 0; | 196 | bool doWritable = (filterSpec & Writable)!= 0; |
196 | bool doExecable = (filterSpec & Executable) != 0; | 197 | bool doExecable = (filterSpec & Executable) != 0; |
197 | bool doHidden = (filterSpec & Hidden)!= 0; | 198 | bool doHidden = (filterSpec & Hidden)!= 0; |
198 | bool doSystem = (filterSpec & System) != 0; | 199 | bool doSystem = (filterSpec & System) != 0; |
199 | 200 | ||
200 | #if defined(Q_OS_OS2EMX) | ||
201 | //QRegExp wc( nameFilter, FALSE, TRUE );// wild card, case insensitive | ||
202 | #else | ||
203 | //QRegExp wc( nameFilter, TRUE, TRUE );// wild card, case sensitive | ||
204 | #endif | ||
205 | QFileInfo fi; | 201 | QFileInfo fi; |
206 | DIR *dir; | 202 | DIR *dir; |
207 | dirent *file; | 203 | dirent *file; |
208 | 204 | ||
209 | dir = opendir( QFile::encodeName(dPath) ); | 205 | dir = opendir( QFile::encodeName(dPath) ); |
210 | if ( !dir ) | 206 | if ( !dir ) |
211 | return FALSE; // cannot read the directory | 207 | return FALSE; // cannot read the directory |
212 | 208 | ||
213 | while ( (file = readdir(dir)) ) { | 209 | #if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) |
210 | union { | ||
211 | struct dirent mt_file; | ||
212 | char b[sizeof(struct dirent) + MAXNAMLEN + 1]; | ||
213 | } u; | ||
214 | while ( readdir_r(dir, &u.mt_file, &file ) == 0 && file ) | ||
215 | #else | ||
216 | while ( (file = readdir(dir)) ) | ||
217 | #endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS | ||
218 | { | ||
214 | QString fn = QFile::decodeName(file->d_name); | 219 | QString fn = QFile::decodeName(file->d_name); |
215 | fi.setFile( *this, fn ); | 220 | fi.setFile( *this, fn ); |
216 | if ( !match( filters, fn ) && !(allDirs && fi.isDir()) ) | 221 | if ( !qt_matchFilterList(filters, fn) && !(allDirs && fi.isDir()) ) |
217 | continue; | 222 | continue; |
218 | if ( (doDirs && fi.isDir()) || (doFiles && fi.isFile()) || | 223 | if ( (doDirs && fi.isDir()) || (doFiles && fi.isFile()) || |
219 | (doSystem && (!fi.isFile() && !fi.isDir())) ) { | 224 | (doSystem && (!fi.isFile() && !fi.isDir())) ) { |
220 | if ( noSymLinks && fi.isSymLink() ) | 225 | if ( noSymLinks && fi.isSymLink() ) |
221 | continue; | 226 | continue; |
222 | if ( (filterSpec & RWEMask) != 0 ) | 227 | if ( (filterSpec & RWEMask) != 0 ) |
223 | if ( (doReadable && !fi.isReadable()) || | 228 | if ( (doReadable && !fi.isReadable()) || |
224 | (doWritable && !fi.isWritable()) || | 229 | (doWritable && !fi.isWritable()) || |
225 | (doExecable && !fi.isExecutable()) ) | 230 | (doExecable && !fi.isExecutable()) ) |
226 | continue; | 231 | continue; |
227 | if ( !doHidden && fn[0] == '.' && | 232 | if ( !doHidden && fn[0] == '.' && |
228 | fn != QString::fromLatin1(".") | 233 | fn != QString::fromLatin1(".") |
229 | && fn != QString::fromLatin1("..") ) | 234 | && fn != QString::fromLatin1("..") ) |
230 | continue; | 235 | continue; |
231 | fiList->append( new QFileInfo( fi ) ); | 236 | fiList->append( new QFileInfo( fi ) ); |
232 | } | 237 | } |
@@ -263,29 +268,30 @@ bool QDir::readDirEntries( const QString &nameFilter, | |||
263 | nameFilter == nameFilt ) | 268 | nameFilter == nameFilt ) |
264 | dirty = FALSE; | 269 | dirty = FALSE; |
265 | else | 270 | else |
266 | dirty = TRUE; | 271 | dirty = TRUE; |
267 | return TRUE; | 272 | return TRUE; |
268 | } | 273 | } |
269 | 274 | ||
270 | const QFileInfoList * QDir::drives() | 275 | const QFileInfoList * QDir::drives() |
271 | { | 276 | { |
272 | // at most one instance of QFileInfoList is leaked, and this variable | 277 | // at most one instance of QFileInfoList is leaked, and this variable |
273 | // points to that list | 278 | // points to that list |
274 | static QFileInfoList * knownMemoryLeak = 0; | 279 | static QFileInfoList * knownMemoryLeak = 0; |
275 | 280 | ||
276 | if ( !knownMemoryLeak ) { | 281 | if ( !knownMemoryLeak ) { |
277 | 282 | ||
278 | #ifdef QT_THREAD_SUPPORT | 283 | #ifdef QT_THREAD_SUPPORT |
279 | QMutexLocker locker( qt_global_mutexpool->get( &knownMemoryLeak ) ); | 284 | QMutexLocker locker( qt_global_mutexpool ? |
285 | qt_global_mutexpool->get( &knownMemoryLeak ) : 0 ); | ||
280 | #endif // QT_THREAD_SUPPORT | 286 | #endif // QT_THREAD_SUPPORT |
281 | 287 | ||
282 | if ( !knownMemoryLeak ) { | 288 | if ( !knownMemoryLeak ) { |
283 | knownMemoryLeak = new QFileInfoList; | 289 | knownMemoryLeak = new QFileInfoList; |
284 | // non-win32 versions both use just one root directory | 290 | // non-win32 versions both use just one root directory |
285 | knownMemoryLeak->append( new QFileInfo( rootDirPath() ) ); | 291 | knownMemoryLeak->append( new QFileInfo( rootDirPath() ) ); |
286 | } | 292 | } |
287 | } | 293 | } |
288 | 294 | ||
289 | return knownMemoryLeak; | 295 | return knownMemoryLeak; |
290 | } | 296 | } |
291 | #endif //QT_NO_DIR | 297 | #endif //QT_NO_DIR |
diff --git a/qmake/tools/qfile.cpp b/qmake/tools/qfile.cpp index a578b49..c088b55 100644 --- a/qmake/tools/qfile.cpp +++ b/qmake/tools/qfile.cpp | |||
@@ -75,33 +75,33 @@ extern bool qt_file_access( const QString& fn, int t ); | |||
75 | ungetch() and putch(). | 75 | ungetch() and putch(). |
76 | 76 | ||
77 | The size of the file is returned by size(). You can get the | 77 | The size of the file is returned by size(). You can get the |
78 | current file position or move to a new file position using the | 78 | current file position or move to a new file position using the |
79 | at() functions. If you've reached the end of the file, atEnd() | 79 | at() functions. If you've reached the end of the file, atEnd() |
80 | returns TRUE. The file handle is returned by handle(). | 80 | returns TRUE. The file handle is returned by handle(). |
81 | 81 | ||
82 | Here is a code fragment that uses QTextStream to read a text file | 82 | Here is a code fragment that uses QTextStream to read a text file |
83 | line by line. It prints each line with a line number. | 83 | line by line. It prints each line with a line number. |
84 | \code | 84 | \code |
85 | QStringList lines; | 85 | QStringList lines; |
86 | QFile file( "file.txt" ); | 86 | QFile file( "file.txt" ); |
87 | if ( file.open( IO_ReadOnly ) ) { | 87 | if ( file.open( IO_ReadOnly ) ) { |
88 | QTextStream stream( &file ); | 88 | QTextStream stream( &file ); |
89 | QString line; | 89 | QString line; |
90 | int i = 1; | 90 | int i = 1; |
91 | while ( !stream.eof() ) { | 91 | while ( !stream.atEnd() ) { |
92 | line = stream.readLine(); // line of text excluding '\n' | 92 | line = stream.readLine(); // line of text excluding '\n' |
93 | printf( "%3d: %s\n", i++, line.latin1() ); | 93 | printf( "%3d: %s\n", i++, line.latin1() ); |
94 | lines += line; | 94 | lines += line; |
95 | } | 95 | } |
96 | file.close(); | 96 | file.close(); |
97 | } | 97 | } |
98 | \endcode | 98 | \endcode |
99 | 99 | ||
100 | Writing text is just as easy. The following example shows how to | 100 | Writing text is just as easy. The following example shows how to |
101 | write the data we read into the string list from the previous | 101 | write the data we read into the string list from the previous |
102 | example: | 102 | example: |
103 | \code | 103 | \code |
104 | QFile file( "file.txt" ); | 104 | QFile file( "file.txt" ); |
105 | if ( file.open( IO_WriteOnly ) ) { | 105 | if ( file.open( IO_WriteOnly ) ) { |
106 | QTextStream stream( &file ); | 106 | QTextStream stream( &file ); |
107 | for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) | 107 | for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) |
@@ -277,32 +277,33 @@ bool QFile::remove() | |||
277 | 277 | ||
278 | close() also flushes the file buffer. | 278 | close() also flushes the file buffer. |
279 | */ | 279 | */ |
280 | 280 | ||
281 | void QFile::flush() | 281 | void QFile::flush() |
282 | { | 282 | { |
283 | if ( isOpen() && fh ) // can only flush open/buffered | 283 | if ( isOpen() && fh ) // can only flush open/buffered |
284 | fflush( fh ); // file | 284 | fflush( fh ); // file |
285 | } | 285 | } |
286 | 286 | ||
287 | /*! \reimp | 287 | /*! \reimp |
288 | \fn QIODevice::Offset QFile::at() const | 288 | \fn QIODevice::Offset QFile::at() const |
289 | */ | 289 | */ |
290 | 290 | ||
291 | /*! | 291 | /*! |
292 | Returns TRUE if the end of file has been reached; otherwise returns FALSE. | 292 | Returns TRUE if the end of file has been reached; otherwise returns FALSE. |
293 | If QFile has not been open()'d, then the behavior is undefined. | ||
293 | 294 | ||
294 | \sa size() | 295 | \sa size() |
295 | */ | 296 | */ |
296 | 297 | ||
297 | bool QFile::atEnd() const | 298 | bool QFile::atEnd() const |
298 | { | 299 | { |
299 | if ( !isOpen() ) { | 300 | if ( !isOpen() ) { |
300 | #if defined(QT_CHECK_STATE) | 301 | #if defined(QT_CHECK_STATE) |
301 | qWarning( "QFile::atEnd: File is not open" ); | 302 | qWarning( "QFile::atEnd: File is not open" ); |
302 | #endif | 303 | #endif |
303 | return FALSE; | 304 | return FALSE; |
304 | } | 305 | } |
305 | if ( isDirectAccess() && !isTranslated() ) { | 306 | if ( isDirectAccess() && !isTranslated() ) { |
306 | if ( at() < length ) | 307 | if ( at() < length ) |
307 | return FALSE; | 308 | return FALSE; |
308 | } | 309 | } |
diff --git a/qmake/tools/qfile_unix.cpp b/qmake/tools/qfile_unix.cpp index 2d5a856..460bf06 100644 --- a/qmake/tools/qfile_unix.cpp +++ b/qmake/tools/qfile_unix.cpp | |||
@@ -422,37 +422,40 @@ bool QFile::open( int m, int f ) | |||
422 | ioIndex = 0; | 422 | ioIndex = 0; |
423 | } | 423 | } |
424 | resetStatus(); | 424 | resetStatus(); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | return TRUE; | 427 | return TRUE; |
428 | } | 428 | } |
429 | 429 | ||
430 | /*! | 430 | /*! |
431 | Returns the file size. | 431 | Returns the file size. |
432 | \sa at() | 432 | \sa at() |
433 | */ | 433 | */ |
434 | 434 | ||
435 | QIODevice::Offset QFile::size() const | 435 | QIODevice::Offset QFile::size() const |
436 | { | 436 | { |
437 | struct stat st; | 437 | struct stat st; |
438 | int ret = 0; | ||
438 | if ( isOpen() ) { | 439 | if ( isOpen() ) { |
439 | ::fstat( fh ? fileno(fh) : fd, &st ); | 440 | ret = ::fstat( fh ? fileno(fh) : fd, &st ); |
440 | } else { | 441 | } else { |
441 | ::stat( QFile::encodeName(fn), &st ); | 442 | ret = ::stat( QFile::encodeName(fn), &st ); |
442 | } | 443 | } |
444 | if ( ret == -1 ) | ||
445 | return 0; | ||
443 | #if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET) | 446 | #if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET) |
444 | return (uint)st.st_size > UINT_MAX ? UINT_MAX : (QIODevice::Offset)st.st_size; | 447 | return (uint)st.st_size > UINT_MAX ? UINT_MAX : (QIODevice::Offset)st.st_size; |
445 | #else | 448 | #else |
446 | return st.st_size; | 449 | return st.st_size; |
447 | #endif | 450 | #endif |
448 | } | 451 | } |
449 | 452 | ||
450 | 453 | ||
451 | /*! | 454 | /*! |
452 | \overload | 455 | \overload |
453 | 456 | ||
454 | Sets the file index to \a pos. Returns TRUE if successful; | 457 | Sets the file index to \a pos. Returns TRUE if successful; |
455 | otherwise returns FALSE. | 458 | otherwise returns FALSE. |
456 | 459 | ||
457 | Example: | 460 | Example: |
458 | \code | 461 | \code |
@@ -525,33 +528,33 @@ Q_LONG QFile::readBlock( char *p, Q_ULONG len ) | |||
525 | #endif | 528 | #endif |
526 | #if defined(QT_CHECK_STATE) | 529 | #if defined(QT_CHECK_STATE) |
527 | if ( !isOpen() ) { | 530 | if ( !isOpen() ) { |
528 | qWarning( "QFile::readBlock: File not open" ); | 531 | qWarning( "QFile::readBlock: File not open" ); |
529 | return -1; | 532 | return -1; |
530 | } | 533 | } |
531 | if ( !isReadable() ) { | 534 | if ( !isReadable() ) { |
532 | qWarning( "QFile::readBlock: Read operation not permitted" ); | 535 | qWarning( "QFile::readBlock: Read operation not permitted" ); |
533 | return -1; | 536 | return -1; |
534 | } | 537 | } |
535 | #endif | 538 | #endif |
536 | Q_ULONG nread = 0; // number of bytes read | 539 | Q_ULONG nread = 0; // number of bytes read |
537 | if ( !ungetchBuffer.isEmpty() ) { | 540 | if ( !ungetchBuffer.isEmpty() ) { |
538 | // need to add these to the returned string. | 541 | // need to add these to the returned string. |
539 | uint l = ungetchBuffer.length(); | 542 | uint l = ungetchBuffer.length(); |
540 | while( nread < l ) { | 543 | while( nread < l ) { |
541 | *p = ungetchBuffer[ l - nread - 1 ]; | 544 | *p = ungetchBuffer.at( l - nread - 1 ); |
542 | p++; | 545 | p++; |
543 | nread++; | 546 | nread++; |
544 | } | 547 | } |
545 | ungetchBuffer.truncate( l - nread ); | 548 | ungetchBuffer.truncate( l - nread ); |
546 | } | 549 | } |
547 | 550 | ||
548 | if ( nread < len ) { | 551 | if ( nread < len ) { |
549 | if ( isRaw() ) { // raw file | 552 | if ( isRaw() ) { // raw file |
550 | nread += ::read( fd, p, len-nread ); | 553 | nread += ::read( fd, p, len-nread ); |
551 | if ( len && nread <= 0 ) { | 554 | if ( len && nread <= 0 ) { |
552 | nread = 0; | 555 | nread = 0; |
553 | setStatus(IO_ReadError); | 556 | setStatus(IO_ReadError); |
554 | } | 557 | } |
555 | } else { // buffered file | 558 | } else { // buffered file |
556 | nread += fread( p, 1, len-nread, fh ); | 559 | nread += fread( p, 1, len-nread, fh ); |
557 | if ( (uint)nread != len ) { | 560 | if ( (uint)nread != len ) { |
@@ -616,33 +619,35 @@ Q_LONG QFile::writeBlock( const char *p, Q_ULONG len ) | |||
616 | ioIndex = (Offset)::fseek( fh, 0, SEEK_CUR ); | 619 | ioIndex = (Offset)::fseek( fh, 0, SEEK_CUR ); |
617 | #endif | 620 | #endif |
618 | } | 621 | } |
619 | } else { | 622 | } else { |
620 | if ( !isSequentialAccess() ) | 623 | if ( !isSequentialAccess() ) |
621 | ioIndex += nwritten; | 624 | ioIndex += nwritten; |
622 | } | 625 | } |
623 | if ( ioIndex > length ) // update file length | 626 | if ( ioIndex > length ) // update file length |
624 | length = ioIndex; | 627 | length = ioIndex; |
625 | return nwritten; | 628 | return nwritten; |
626 | } | 629 | } |
627 | 630 | ||
628 | /*! | 631 | /*! |
629 | Returns the file handle of the file. | 632 | Returns the file handle of the file. |
630 | 633 | ||
631 | This is a small positive integer, suitable for use with C library | 634 | This is a small positive integer, suitable for use with C library |
632 | functions such as fdopen() and fcntl(), as well as with QSocketNotifier. | 635 | functions such as fdopen() and fcntl(). On systems that use file |
636 | descriptors for sockets (ie. Unix systems, but not Windows) the handle | ||
637 | can be used with QSocketNotifier as well. | ||
633 | 638 | ||
634 | If the file is not open or there is an error, handle() returns -1. | 639 | If the file is not open or there is an error, handle() returns -1. |
635 | 640 | ||
636 | \sa QSocketNotifier | 641 | \sa QSocketNotifier |
637 | */ | 642 | */ |
638 | 643 | ||
639 | int QFile::handle() const | 644 | int QFile::handle() const |
640 | { | 645 | { |
641 | if ( !isOpen() ) | 646 | if ( !isOpen() ) |
642 | return -1; | 647 | return -1; |
643 | else if ( fh ) | 648 | else if ( fh ) |
644 | return fileno( fh ); | 649 | return fileno( fh ); |
645 | else | 650 | else |
646 | return fd; | 651 | return fd; |
647 | } | 652 | } |
648 | 653 | ||
diff --git a/qmake/tools/qfileinfo.cpp b/qmake/tools/qfileinfo.cpp index 3af7932..a78f4fa 100644 --- a/qmake/tools/qfileinfo.cpp +++ b/qmake/tools/qfileinfo.cpp | |||
@@ -622,38 +622,40 @@ QDateTime QFileInfo::lastRead() const | |||
622 | } | 622 | } |
623 | 623 | ||
624 | #ifndef QT_NO_DIR | 624 | #ifndef QT_NO_DIR |
625 | 625 | ||
626 | /*! | 626 | /*! |
627 | Returns the absolute path including the file name. | 627 | Returns the absolute path including the file name. |
628 | 628 | ||
629 | The absolute path name consists of the full path and the file | 629 | The absolute path name consists of the full path and the file |
630 | name. On Unix this will always begin with the root, '/', | 630 | name. On Unix this will always begin with the root, '/', |
631 | directory. On Windows this will always begin 'D:/' where D is a | 631 | directory. On Windows this will always begin 'D:/' where D is a |
632 | drive letter, except for network shares that are not mapped to a | 632 | drive letter, except for network shares that are not mapped to a |
633 | drive letter, in which case the path will begin '//sharename/'. | 633 | drive letter, in which case the path will begin '//sharename/'. |
634 | 634 | ||
635 | This function returns the same as filePath(), unless isRelative() | 635 | This function returns the same as filePath(), unless isRelative() |
636 | is TRUE. | 636 | is TRUE. |
637 | 637 | ||
638 | If the QFileInfo is empty it returns QDir::currentDirPath(). | ||
639 | |||
638 | This function can be time consuming under Unix (in the order of | 640 | This function can be time consuming under Unix (in the order of |
639 | milliseconds). | 641 | milliseconds). |
640 | 642 | ||
641 | \sa isRelative(), filePath() | 643 | \sa isRelative(), filePath() |
642 | */ | 644 | */ |
643 | QString QFileInfo::absFilePath() const | 645 | QString QFileInfo::absFilePath() const |
644 | { | 646 | { |
645 | QString tmp; | 647 | QString tmp; |
646 | if ( QDir::isRelativePath(fn) | 648 | if ( QDir::isRelativePath(fn) |
647 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) | 649 | #if defined(Q_OS_WIN32) |
648 | && fn[1] != ':' | 650 | && fn[1] != ':' |
649 | #endif | 651 | #endif |
650 | ) { | 652 | ) { |
651 | tmp = QDir::currentDirPath(); | 653 | tmp = QDir::currentDirPath(); |
652 | tmp += '/'; | 654 | tmp += '/'; |
653 | } | 655 | } |
654 | tmp += fn; | 656 | tmp += fn; |
655 | makeAbs( tmp ); | 657 | makeAbs( tmp ); |
656 | return QDir::cleanDirPath( tmp ); | 658 | return QDir::cleanDirPath( tmp ); |
657 | } | 659 | } |
658 | 660 | ||
659 | #endif | 661 | #endif |
diff --git a/qmake/tools/qfileinfo_unix.cpp b/qmake/tools/qfileinfo_unix.cpp index f7c3a97..364f219 100644 --- a/qmake/tools/qfileinfo_unix.cpp +++ b/qmake/tools/qfileinfo_unix.cpp | |||
@@ -201,35 +201,35 @@ uint QFileInfo::groupId() const | |||
201 | return nobodyID; | 201 | return nobodyID; |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | /*! | 205 | /*! |
206 | Tests for file permissions. The \a permissionSpec argument can be | 206 | Tests for file permissions. The \a permissionSpec argument can be |
207 | several flags of type \c PermissionSpec OR-ed together to check | 207 | several flags of type \c PermissionSpec OR-ed together to check |
208 | for permission combinations. | 208 | for permission combinations. |
209 | 209 | ||
210 | On systems where files do not have permissions this function | 210 | On systems where files do not have permissions this function |
211 | always returns TRUE. | 211 | always returns TRUE. |
212 | 212 | ||
213 | Example: | 213 | Example: |
214 | \code | 214 | \code |
215 | QFileInfo fi( "/tmp/archive.tar.gz" ); | 215 | QFileInfo fi( "/tmp/archive.tar.gz" ); |
216 | if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) ) | 216 | if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) ) |
217 | qWarning( "I can change the file; my group can read the file."); | 217 | qWarning( "I can change the file; my group can read the file" ); |
218 | if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) ) | 218 | if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) ) |
219 | qWarning( "The group or others can change the file!" ); | 219 | qWarning( "The group or others can change the file" ); |
220 | \endcode | 220 | \endcode |
221 | 221 | ||
222 | \sa isReadable(), isWritable(), isExecutable() | 222 | \sa isReadable(), isWritable(), isExecutable() |
223 | */ | 223 | */ |
224 | 224 | ||
225 | bool QFileInfo::permission( int permissionSpec ) const | 225 | bool QFileInfo::permission( int permissionSpec ) const |
226 | { | 226 | { |
227 | if ( !fic || !cache ) | 227 | if ( !fic || !cache ) |
228 | doStat(); | 228 | doStat(); |
229 | if ( fic ) { | 229 | if ( fic ) { |
230 | uint mask = 0; | 230 | uint mask = 0; |
231 | if ( permissionSpec & ReadUser ) | 231 | if ( permissionSpec & ReadUser ) |
232 | mask |= S_IRUSR; | 232 | mask |= S_IRUSR; |
233 | if ( permissionSpec & WriteUser ) | 233 | if ( permissionSpec & WriteUser ) |
234 | mask |= S_IWUSR; | 234 | mask |= S_IWUSR; |
235 | if ( permissionSpec & ExeUser ) | 235 | if ( permissionSpec & ExeUser ) |
diff --git a/qmake/tools/qgarray.cpp b/qmake/tools/qgarray.cpp index 45c45ce..0a522e4 100644 --- a/qmake/tools/qgarray.cpp +++ b/qmake/tools/qgarray.cpp | |||
@@ -22,47 +22,57 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qglobal.h" // needed to define Q_WS_WIN | 38 | #include "qglobal.h" |
39 | #ifdef Q_WS_WIN | 39 | #if defined(Q_CC_BOR) |
40 | #include "qt_windows.h" // needed for bsearch on some platforms | 40 | // needed for qsort() because of a std namespace problem on Borland |
41 | # include "qplatformdefs.h" | ||
42 | #elif defined(Q_WS_WIN) | ||
43 | // needed for bsearch on some platforms | ||
44 | # include "qt_windows.h" | ||
41 | #endif | 45 | #endif |
42 | 46 | ||
43 | #define QGARRAY_CPP | 47 | #define QGARRAY_CPP |
44 | #include "qgarray.h" | 48 | #include "qgarray.h" |
45 | #include <stdlib.h> | 49 | #include <stdlib.h> |
46 | #include <string.h> | 50 | #include <string.h> |
47 | 51 | ||
48 | #ifdef QT_THREAD_SUPPORT | 52 | #ifdef QT_THREAD_SUPPORT |
49 | # include <private/qmutexpool_p.h> | 53 | # include <private/qmutexpool_p.h> |
50 | #endif // QT_THREAD_SUPPORT | 54 | #endif // QT_THREAD_SUPPORT |
51 | 55 | ||
52 | #define USE_MALLOC // comment to use new/delete | 56 | /* |
57 | If USE_MALLOC isn't defined, we use new[] and delete[] to allocate | ||
58 | memory. The documentation for QMemArray<T>::assign() explicitly | ||
59 | mentions that the array is freed using free(), so don't mess around | ||
60 | with USE_MALLOC unless you know what you're doing. | ||
61 | */ | ||
62 | #define USE_MALLOC | ||
53 | 63 | ||
54 | #undef NEW | 64 | #undef NEW |
55 | #undef DELETE | 65 | #undef DELETE |
56 | 66 | ||
57 | #if defined(USE_MALLOC) | 67 | #if defined(USE_MALLOC) |
58 | #define NEW(type,size)((type*)malloc(size*sizeof(type))) | 68 | #define NEW(type,size)((type*)malloc(size*sizeof(type))) |
59 | #define DELETE(array)(free((char*)array)) | 69 | #define DELETE(array)(free((char*)array)) |
60 | #else | 70 | #else |
61 | #define NEW(type,size)(new type[size]) | 71 | #define NEW(type,size)(new type[size]) |
62 | #define DELETE(array)(delete[] array) | 72 | #define DELETE(array)(delete[] array) |
63 | #define DONT_USE_REALLOC // comment to use realloc() | 73 | #define DONT_USE_REALLOC // comment to use realloc() |
64 | #endif | 74 | #endif |
65 | 75 | ||
66 | /*! | 76 | /*! |
67 | \class QShared qshared.h | 77 | \class QShared qshared.h |
68 | \reentrant | 78 | \reentrant |
@@ -122,33 +132,37 @@ QGArray::QGArray( int, int ) | |||
122 | */ | 132 | */ |
123 | 133 | ||
124 | QGArray::QGArray( int size ) | 134 | QGArray::QGArray( int size ) |
125 | { | 135 | { |
126 | if ( size < 0 ) { | 136 | if ( size < 0 ) { |
127 | #if defined(QT_CHECK_RANGE) | 137 | #if defined(QT_CHECK_RANGE) |
128 | qWarning( "QGArray: Cannot allocate array with negative length" ); | 138 | qWarning( "QGArray: Cannot allocate array with negative length" ); |
129 | #endif | 139 | #endif |
130 | size = 0; | 140 | size = 0; |
131 | } | 141 | } |
132 | shd = newData(); | 142 | shd = newData(); |
133 | Q_CHECK_PTR( shd ); | 143 | Q_CHECK_PTR( shd ); |
134 | if ( size == 0 ) // zero length | 144 | if ( size == 0 ) // zero length |
135 | return; | 145 | return; |
136 | shd->data = NEW(char,size); | 146 | shd->data = NEW(char,size); |
137 | Q_CHECK_PTR( shd->data ); | 147 | Q_CHECK_PTR( shd->data ); |
138 | shd->len = size; | 148 | shd->len = |
149 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
150 | shd->maxl = | ||
151 | #endif | ||
152 | size; | ||
139 | } | 153 | } |
140 | 154 | ||
141 | /*! | 155 | /*! |
142 | Constructs a shallow copy of \a a. | 156 | Constructs a shallow copy of \a a. |
143 | */ | 157 | */ |
144 | 158 | ||
145 | QGArray::QGArray( const QGArray &a ) | 159 | QGArray::QGArray( const QGArray &a ) |
146 | { | 160 | { |
147 | shd = a.shd; | 161 | shd = a.shd; |
148 | shd->ref(); | 162 | shd->ref(); |
149 | } | 163 | } |
150 | 164 | ||
151 | /*! | 165 | /*! |
152 | Dereferences the array data and deletes it if this was the last | 166 | Dereferences the array data and deletes it if this was the last |
153 | reference. | 167 | reference. |
154 | */ | 168 | */ |
@@ -199,61 +213,96 @@ QGArray::~QGArray() | |||
199 | /*! | 213 | /*! |
200 | Returns TRUE if this array is equal to \a a, otherwise FALSE. | 214 | Returns TRUE if this array is equal to \a a, otherwise FALSE. |
201 | The comparison is bitwise, of course. | 215 | The comparison is bitwise, of course. |
202 | */ | 216 | */ |
203 | 217 | ||
204 | bool QGArray::isEqual( const QGArray &a ) const | 218 | bool QGArray::isEqual( const QGArray &a ) const |
205 | { | 219 | { |
206 | if ( size() != a.size() ) // different size | 220 | if ( size() != a.size() ) // different size |
207 | return FALSE; | 221 | return FALSE; |
208 | if ( data() == a.data() ) // has same data | 222 | if ( data() == a.data() ) // has same data |
209 | return TRUE; | 223 | return TRUE; |
210 | return (size() ? memcmp( data(), a.data(), size() ) : 0) == 0; | 224 | return (size() ? memcmp( data(), a.data(), size() ) : 0) == 0; |
211 | } | 225 | } |
212 | 226 | ||
213 | 227 | ||
214 | /*! | 228 | /*! |
215 | Resizes the array to \a newsize bytes. | 229 | Resizes the array to \a newsize bytes. \a optim is either |
230 | MemOptim (the default) or SpeedOptim. | ||
216 | */ | 231 | */ |
217 | 232 | bool QGArray::resize( uint newsize, Optimization optim ) | |
218 | bool QGArray::resize( uint newsize ) | ||
219 | { | 233 | { |
220 | if ( newsize == shd->len ) // nothing to do | 234 | #ifndef QT_QGARRAY_SPEED_OPTIM |
235 | Q_UNUSED(optim); | ||
236 | #endif | ||
237 | |||
238 | if ( newsize == shd->len | ||
239 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
240 | && newsize == shd->maxl | ||
241 | #endif | ||
242 | ) // nothing to do | ||
221 | return TRUE; | 243 | return TRUE; |
222 | if ( newsize == 0 ) { // remove array | 244 | if ( newsize == 0 ) { // remove array |
223 | duplicate( 0, 0 ); | 245 | duplicate( 0, 0 ); |
224 | return TRUE; | 246 | return TRUE; |
225 | } | 247 | } |
248 | |||
249 | uint newmaxl = newsize; | ||
250 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
251 | if ( optim == SpeedOptim ) { | ||
252 | if ( newsize <= shd->maxl && | ||
253 | ( newsize * 4 > shd->maxl || shd->maxl <= 4 ) ) { | ||
254 | shd->len = newsize; | ||
255 | return TRUE; | ||
256 | } | ||
257 | newmaxl = 4; | ||
258 | while ( newmaxl < newsize ) | ||
259 | newmaxl *= 2; | ||
260 | // try to spare some memory | ||
261 | if ( newmaxl >= 1024 * 1024 && newsize <= newmaxl - (newmaxl >> 2) ) | ||
262 | newmaxl -= newmaxl >> 2; | ||
263 | } | ||
264 | shd->maxl = newmaxl; | ||
265 | #endif | ||
266 | |||
226 | if ( shd->data ) { // existing data | 267 | if ( shd->data ) { // existing data |
227 | #if defined(DONT_USE_REALLOC) | 268 | #if defined(DONT_USE_REALLOC) |
228 | char *newdata = NEW(char,newsize);// manual realloc | 269 | char *newdata = NEW(char,newsize);// manual realloc |
229 | memcpy( newdata, shd->data, QMIN(shd->len,newsize) ); | 270 | memcpy( newdata, shd->data, QMIN(shd->len,newmaxl) ); |
230 | DELETE(shd->data); | 271 | DELETE(shd->data); |
231 | shd->data = newdata; | 272 | shd->data = newdata; |
232 | #else | 273 | #else |
233 | shd->data = (char *)realloc( shd->data, newsize ); | 274 | shd->data = (char *)realloc( shd->data, newmaxl ); |
234 | #endif | 275 | #endif |
235 | } else { | 276 | } else { |
236 | shd->data = NEW(char,newsize); | 277 | shd->data = NEW(char,newmaxl); |
237 | } | 278 | } |
238 | if ( !shd->data ) // no memory | 279 | if ( !shd->data ) // no memory |
239 | return FALSE; | 280 | return FALSE; |
240 | shd->len = newsize; | 281 | shd->len = newsize; |
241 | return TRUE; | 282 | return TRUE; |
242 | } | 283 | } |
243 | 284 | ||
285 | /*!\overload | ||
286 | */ | ||
287 | bool QGArray::resize( uint newsize ) | ||
288 | { | ||
289 | return resize( newsize, MemOptim ); | ||
290 | } | ||
291 | |||
292 | |||
244 | /*! | 293 | /*! |
245 | Fills the array with the repeated occurrences of \a d, which is | 294 | Fills the array with the repeated occurrences of \a d, which is |
246 | \a sz bytes long. | 295 | \a sz bytes long. |
247 | If \a len is specified as different from -1, then the array will be | 296 | If \a len is specified as different from -1, then the array will be |
248 | resized to \a len*sz before it is filled. | 297 | resized to \a len*sz before it is filled. |
249 | 298 | ||
250 | Returns TRUE if successful, or FALSE if the memory cannot be allocated | 299 | Returns TRUE if successful, or FALSE if the memory cannot be allocated |
251 | (only when \a len != -1). | 300 | (only when \a len != -1). |
252 | 301 | ||
253 | \sa resize() | 302 | \sa resize() |
254 | */ | 303 | */ |
255 | 304 | ||
256 | bool QGArray::fill( const char *d, int len, uint sz ) | 305 | bool QGArray::fill( const char *d, int len, uint sz ) |
257 | { | 306 | { |
258 | if ( len < 0 ) | 307 | if ( len < 0 ) |
259 | len = shd->len/sz; // default: use array length | 308 | len = shd->len/sz; // default: use array length |
@@ -306,33 +355,37 @@ QGArray &QGArray::assign( const QGArray &a ) | |||
306 | Returns a reference to this array. | 355 | Returns a reference to this array. |
307 | 356 | ||
308 | Do not delete \a d later, because QGArray takes care of that. | 357 | Do not delete \a d later, because QGArray takes care of that. |
309 | */ | 358 | */ |
310 | 359 | ||
311 | QGArray &QGArray::assign( const char *d, uint len ) | 360 | QGArray &QGArray::assign( const char *d, uint len ) |
312 | { | 361 | { |
313 | if ( shd->count > 1 ) { // disconnect this | 362 | if ( shd->count > 1 ) { // disconnect this |
314 | shd->count--; | 363 | shd->count--; |
315 | shd = newData(); | 364 | shd = newData(); |
316 | Q_CHECK_PTR( shd ); | 365 | Q_CHECK_PTR( shd ); |
317 | } else { | 366 | } else { |
318 | if ( shd->data ) | 367 | if ( shd->data ) |
319 | DELETE(shd->data); | 368 | DELETE(shd->data); |
320 | } | 369 | } |
321 | shd->data = (char *)d; | 370 | shd->data = (char *)d; |
322 | shd->len = len; | 371 | shd->len = |
372 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
373 | shd->maxl = | ||
374 | #endif | ||
375 | len; | ||
323 | return *this; | 376 | return *this; |
324 | } | 377 | } |
325 | 378 | ||
326 | /*! | 379 | /*! |
327 | Deep copy. Dereference the current array and obtains a copy of the data | 380 | Deep copy. Dereference the current array and obtains a copy of the data |
328 | contained in \a a instead. Returns a reference to this array. | 381 | contained in \a a instead. Returns a reference to this array. |
329 | \sa assign(), operator=() | 382 | \sa assign(), operator=() |
330 | */ | 383 | */ |
331 | 384 | ||
332 | QGArray &QGArray::duplicate( const QGArray &a ) | 385 | QGArray &QGArray::duplicate( const QGArray &a ) |
333 | { | 386 | { |
334 | if ( a.shd == shd ) { // a.duplicate(a) ! | 387 | if ( a.shd == shd ) { // a.duplicate(a) ! |
335 | if ( shd->count > 1 ) { | 388 | if ( shd->count > 1 ) { |
336 | shd->count--; | 389 | shd->count--; |
337 | register array_data *n = newData(); | 390 | register array_data *n = newData(); |
338 | Q_CHECK_PTR( n ); | 391 | Q_CHECK_PTR( n ); |
@@ -351,33 +404,37 @@ QGArray &QGArray::duplicate( const QGArray &a ) | |||
351 | char *oldptr = 0; | 404 | char *oldptr = 0; |
352 | if ( shd->count > 1 ) { // disconnect this | 405 | if ( shd->count > 1 ) { // disconnect this |
353 | shd->count--; | 406 | shd->count--; |
354 | shd = newData(); | 407 | shd = newData(); |
355 | Q_CHECK_PTR( shd ); | 408 | Q_CHECK_PTR( shd ); |
356 | } else { // delete after copy was made | 409 | } else { // delete after copy was made |
357 | oldptr = shd->data; | 410 | oldptr = shd->data; |
358 | } | 411 | } |
359 | if ( a.shd->len ) { // duplicate data | 412 | if ( a.shd->len ) { // duplicate data |
360 | shd->data = NEW(char,a.shd->len); | 413 | shd->data = NEW(char,a.shd->len); |
361 | Q_CHECK_PTR( shd->data ); | 414 | Q_CHECK_PTR( shd->data ); |
362 | if ( shd->data ) | 415 | if ( shd->data ) |
363 | memcpy( shd->data, a.shd->data, a.shd->len ); | 416 | memcpy( shd->data, a.shd->data, a.shd->len ); |
364 | } else { | 417 | } else { |
365 | shd->data = 0; | 418 | shd->data = 0; |
366 | } | 419 | } |
367 | shd->len = a.shd->len; | 420 | shd->len = |
421 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
422 | shd->maxl = | ||
423 | #endif | ||
424 | a.shd->len; | ||
368 | if ( oldptr ) | 425 | if ( oldptr ) |
369 | DELETE(oldptr); | 426 | DELETE(oldptr); |
370 | return *this; | 427 | return *this; |
371 | } | 428 | } |
372 | 429 | ||
373 | /*! | 430 | /*! |
374 | \overload | 431 | \overload |
375 | Deep copy. Dereferences the current array and obtains a copy of | 432 | Deep copy. Dereferences the current array and obtains a copy of |
376 | \a len characters from array data \a d instead. Returns a reference | 433 | \a len characters from array data \a d instead. Returns a reference |
377 | to this array. | 434 | to this array. |
378 | \sa assign(), operator=() | 435 | \sa assign(), operator=() |
379 | */ | 436 | */ |
380 | 437 | ||
381 | QGArray &QGArray::duplicate( const char *d, uint len ) | 438 | QGArray &QGArray::duplicate( const char *d, uint len ) |
382 | { | 439 | { |
383 | char *data; | 440 | char *data; |
@@ -389,33 +446,37 @@ QGArray &QGArray::duplicate( const char *d, uint len ) | |||
389 | memcpy( shd->data, d, len );// use same buffer | 446 | memcpy( shd->data, d, len );// use same buffer |
390 | return *this; | 447 | return *this; |
391 | } | 448 | } |
392 | data = NEW(char,len); | 449 | data = NEW(char,len); |
393 | Q_CHECK_PTR( data ); | 450 | Q_CHECK_PTR( data ); |
394 | memcpy( data, d, len ); | 451 | memcpy( data, d, len ); |
395 | } | 452 | } |
396 | if ( shd->count > 1 ) { // detach | 453 | if ( shd->count > 1 ) { // detach |
397 | shd->count--; | 454 | shd->count--; |
398 | shd = newData(); | 455 | shd = newData(); |
399 | Q_CHECK_PTR( shd ); | 456 | Q_CHECK_PTR( shd ); |
400 | } else { // just a single reference | 457 | } else { // just a single reference |
401 | if ( shd->data ) | 458 | if ( shd->data ) |
402 | DELETE(shd->data); | 459 | DELETE(shd->data); |
403 | } | 460 | } |
404 | shd->data = data; | 461 | shd->data = data; |
405 | shd->len = len; | 462 | shd->len = |
463 | #ifdef QT_QGARRAY_SPEED_OPTIM | ||
464 | shd->maxl = | ||
465 | #endif | ||
466 | len; | ||
406 | return *this; | 467 | return *this; |
407 | } | 468 | } |
408 | 469 | ||
409 | /*! | 470 | /*! |
410 | Resizes this array to \a len bytes and copies the \a len bytes at | 471 | Resizes this array to \a len bytes and copies the \a len bytes at |
411 | address \a d into it. | 472 | address \a d into it. |
412 | 473 | ||
413 | \warning This function disregards the reference count mechanism. If | 474 | \warning This function disregards the reference count mechanism. If |
414 | other QGArrays reference the same data as this, all will be updated. | 475 | other QGArrays reference the same data as this, all will be updated. |
415 | */ | 476 | */ |
416 | 477 | ||
417 | void QGArray::store( const char *d, uint len ) | 478 | void QGArray::store( const char *d, uint len ) |
418 | { // store, but not deref | 479 | { // store, but not deref |
419 | resize( len ); | 480 | resize( len ); |
420 | memcpy( shd->data, d, len ); | 481 | memcpy( shd->data, d, len ); |
421 | } | 482 | } |
@@ -646,51 +707,53 @@ static int cmp_arr( const void *n1, const void *n2 ) | |||
646 | 707 | ||
647 | #if defined(Q_C_CALLBACKS) | 708 | #if defined(Q_C_CALLBACKS) |
648 | } | 709 | } |
649 | #endif | 710 | #endif |
650 | 711 | ||
651 | /*! | 712 | /*! |
652 | Sorts the first \a sz items of the array. | 713 | Sorts the first \a sz items of the array. |
653 | */ | 714 | */ |
654 | 715 | ||
655 | void QGArray::sort( uint sz ) | 716 | void QGArray::sort( uint sz ) |
656 | { | 717 | { |
657 | int numItems = size() / sz; | 718 | int numItems = size() / sz; |
658 | if ( numItems < 2 ) | 719 | if ( numItems < 2 ) |
659 | return; | 720 | return; |
660 | 721 | ||
661 | #ifdef QT_THREAD_SUPPORT | 722 | #ifdef QT_THREAD_SUPPORT |
662 | QMutexLocker locker( qt_global_mutexpool->get( &cmp_item_size ) ); | 723 | QMutexLocker locker( qt_global_mutexpool ? |
724 | qt_global_mutexpool->get( &cmp_item_size ) : 0 ); | ||
663 | #endif // QT_THREAD_SUPPORT | 725 | #endif // QT_THREAD_SUPPORT |
664 | 726 | ||
665 | cmp_item_size = sz; | 727 | cmp_item_size = sz; |
666 | qsort( shd->data, numItems, sz, cmp_arr ); | 728 | qsort( shd->data, numItems, sz, cmp_arr ); |
667 | } | 729 | } |
668 | 730 | ||
669 | /*! | 731 | /*! |
670 | Binary search; assumes that \a d is a sorted array of size \a sz. | 732 | Binary search; assumes that \a d is a sorted array of size \a sz. |
671 | */ | 733 | */ |
672 | 734 | ||
673 | int QGArray::bsearch( const char *d, uint sz ) const | 735 | int QGArray::bsearch( const char *d, uint sz ) const |
674 | { | 736 | { |
675 | int numItems = size() / sz; | 737 | int numItems = size() / sz; |
676 | if ( !numItems ) | 738 | if ( !numItems ) |
677 | return -1; | 739 | return -1; |
678 | 740 | ||
679 | #ifdef QT_THREAD_SUPPORT | 741 | #ifdef QT_THREAD_SUPPORT |
680 | QMutexLocker locker( qt_global_mutexpool->get( &cmp_item_size ) ); | 742 | QMutexLocker locker( qt_global_mutexpool ? |
743 | qt_global_mutexpool->get( &cmp_item_size ) : 0 ); | ||
681 | #endif // QT_THREAD_SUPPORT | 744 | #endif // QT_THREAD_SUPPORT |
682 | 745 | ||
683 | cmp_item_size = sz; | 746 | cmp_item_size = sz; |
684 | char* r = (char*)::bsearch( d, shd->data, numItems, sz, cmp_arr ); | 747 | char* r = (char*)::bsearch( d, shd->data, numItems, sz, cmp_arr ); |
685 | if ( !r ) | 748 | if ( !r ) |
686 | return -1; | 749 | return -1; |
687 | while( (r >= shd->data + sz) && (cmp_arr( r - sz, d ) == 0) ) | 750 | while( (r >= shd->data + sz) && (cmp_arr( r - sz, d ) == 0) ) |
688 | r -= sz;// search to first of equal elements; bsearch is undef | 751 | r -= sz;// search to first of equal elements; bsearch is undef |
689 | return (int)(( r - shd->data ) / sz); | 752 | return (int)(( r - shd->data ) / sz); |
690 | } | 753 | } |
691 | 754 | ||
692 | 755 | ||
693 | /*! | 756 | /*! |
694 | \fn char *QGArray::at( uint index ) const | 757 | \fn char *QGArray::at( uint index ) const |
695 | 758 | ||
696 | Returns a pointer to the byte at offset \a index in the array. | 759 | Returns a pointer to the byte at offset \a index in the array. |
diff --git a/qmake/tools/qgdict.cpp b/qmake/tools/qgdict.cpp index c431ff8..3d49fc7 100644 --- a/qmake/tools/qgdict.cpp +++ b/qmake/tools/qgdict.cpp | |||
@@ -191,33 +191,36 @@ QDataStream& QGDict::write( QDataStream &s, QPtrCollection::Item ) const | |||
191 | Constructs a dictionary. | 191 | Constructs a dictionary. |
192 | 192 | ||
193 | \a len is the initial size of the dictionary. | 193 | \a len is the initial size of the dictionary. |
194 | The key type is \a kt which may be \c StringKey, \c AsciiKey, | 194 | The key type is \a kt which may be \c StringKey, \c AsciiKey, |
195 | \c IntKey or \c PtrKey. The case-sensitivity of lookups is set with | 195 | \c IntKey or \c PtrKey. The case-sensitivity of lookups is set with |
196 | \a caseSensitive. Keys are copied if \a copyKeys is TRUE. | 196 | \a caseSensitive. Keys are copied if \a copyKeys is TRUE. |
197 | */ | 197 | */ |
198 | 198 | ||
199 | QGDict::QGDict( uint len, KeyType kt, bool caseSensitive, bool copyKeys ) | 199 | QGDict::QGDict( uint len, KeyType kt, bool caseSensitive, bool copyKeys ) |
200 | { | 200 | { |
201 | init( len, kt, caseSensitive, copyKeys ); | 201 | init( len, kt, caseSensitive, copyKeys ); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | void QGDict::init( uint len, KeyType kt, bool caseSensitive, bool copyKeys ) | 205 | void QGDict::init( uint len, KeyType kt, bool caseSensitive, bool copyKeys ) |
206 | { | 206 | { |
207 | vec = new QBaseBucket *[vlen = len]; // allocate hash table | 207 | vlen = len; |
208 | if ( vlen == 0 ) | ||
209 | vlen = 17; | ||
210 | vec = new QBaseBucket *[vlen]; | ||
208 | Q_CHECK_PTR( vec ); | 211 | Q_CHECK_PTR( vec ); |
209 | memset( (char*)vec, 0, vlen*sizeof(QBaseBucket*) ); | 212 | memset( (char*)vec, 0, vlen*sizeof(QBaseBucket*) ); |
210 | numItems = 0; | 213 | numItems = 0; |
211 | iterators = 0; | 214 | iterators = 0; |
212 | // The caseSensitive and copyKey options don't make sense for | 215 | // The caseSensitive and copyKey options don't make sense for |
213 | // all dict types. | 216 | // all dict types. |
214 | switch ( (keytype = (uint)kt) ) { | 217 | switch ( (keytype = (uint)kt) ) { |
215 | case StringKey: | 218 | case StringKey: |
216 | cases = caseSensitive; | 219 | cases = caseSensitive; |
217 | copyk = FALSE; | 220 | copyk = FALSE; |
218 | break; | 221 | break; |
219 | case AsciiKey: | 222 | case AsciiKey: |
220 | cases = caseSensitive; | 223 | cases = caseSensitive; |
221 | copyk = copyKeys; | 224 | copyk = copyKeys; |
222 | break; | 225 | break; |
223 | default: | 226 | default: |
diff --git a/qmake/tools/qglist.cpp b/qmake/tools/qglist.cpp index 155d585..bd27f8a 100644 --- a/qmake/tools/qglist.cpp +++ b/qmake/tools/qglist.cpp | |||
@@ -316,38 +316,34 @@ bool QGList::operator==( const QGList &list ) const | |||
316 | /*! | 316 | /*! |
317 | Returns the node at position \a index. Sets this node to current. | 317 | Returns the node at position \a index. Sets this node to current. |
318 | */ | 318 | */ |
319 | 319 | ||
320 | QLNode *QGList::locate( uint index ) | 320 | QLNode *QGList::locate( uint index ) |
321 | { | 321 | { |
322 | if ( index == (uint)curIndex ) // current node ? | 322 | if ( index == (uint)curIndex ) // current node ? |
323 | return curNode; | 323 | return curNode; |
324 | if ( !curNode && firstNode ) { // set current node | 324 | if ( !curNode && firstNode ) { // set current node |
325 | curNode = firstNode; | 325 | curNode = firstNode; |
326 | curIndex = 0; | 326 | curIndex = 0; |
327 | } | 327 | } |
328 | register QLNode *node; | 328 | register QLNode *node; |
329 | int distance = index - curIndex; // node distance to cur node | 329 | int distance = index - curIndex; // node distance to cur node |
330 | bool forward; // direction to traverse | 330 | bool forward; // direction to traverse |
331 | 331 | ||
332 | if ( index >= numNodes ) { | 332 | if ( index >= numNodes ) |
333 | #if defined(QT_CHECK_RANGE) | ||
334 | qWarning( "QGList::locate: Index %d out of range", index ); | ||
335 | #endif | ||
336 | return 0; | 333 | return 0; |
337 | } | ||
338 | 334 | ||
339 | if ( distance < 0 ) | 335 | if ( distance < 0 ) |
340 | distance = -distance; | 336 | distance = -distance; |
341 | if ( (uint)distance < index && (uint)distance < numNodes - index ) { | 337 | if ( (uint)distance < index && (uint)distance < numNodes - index ) { |
342 | node = curNode; // start from current node | 338 | node = curNode; // start from current node |
343 | forward = index > (uint)curIndex; | 339 | forward = index > (uint)curIndex; |
344 | } else if ( index < numNodes - index ) {// start from first node | 340 | } else if ( index < numNodes - index ) {// start from first node |
345 | node = firstNode; | 341 | node = firstNode; |
346 | distance = index; | 342 | distance = index; |
347 | forward = TRUE; | 343 | forward = TRUE; |
348 | } else { // start from last node | 344 | } else { // start from last node |
349 | node = lastNode; | 345 | node = lastNode; |
350 | distance = numNodes - index - 1; | 346 | distance = numNodes - index - 1; |
351 | if ( distance < 0 ) | 347 | if ( distance < 0 ) |
352 | distance = 0; | 348 | distance = 0; |
353 | forward = FALSE; | 349 | forward = FALSE; |
diff --git a/qmake/tools/qglobal.cpp b/qmake/tools/qglobal.cpp index 47cd6bd..342005d 100644 --- a/qmake/tools/qglobal.cpp +++ b/qmake/tools/qglobal.cpp | |||
@@ -136,33 +136,54 @@ bool qSysInfo( int *wordSize, bool *bigEndian ) | |||
136 | be32 = FALSE; | 136 | be32 = FALSE; |
137 | else | 137 | else |
138 | be32 = !be16; | 138 | be32 = !be16; |
139 | 139 | ||
140 | if ( be16 != be32 ) { // strange machine! | 140 | if ( be16 != be32 ) { // strange machine! |
141 | #if defined(QT_CHECK_RANGE) | 141 | #if defined(QT_CHECK_RANGE) |
142 | qFatal( "qSysInfo: Inconsistent system byte order" ); | 142 | qFatal( "qSysInfo: Inconsistent system byte order" ); |
143 | #endif | 143 | #endif |
144 | return FALSE; | 144 | return FALSE; |
145 | } | 145 | } |
146 | 146 | ||
147 | *bigEndian = si_bigEndian = be32; | 147 | *bigEndian = si_bigEndian = be32; |
148 | si_alreadyDone = TRUE; | 148 | si_alreadyDone = TRUE; |
149 | return TRUE; | 149 | return TRUE; |
150 | } | 150 | } |
151 | 151 | ||
152 | #if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) | 152 | #if !defined(QWS) && defined(Q_OS_MAC) |
153 | |||
154 | #include "qt_mac.h" | ||
155 | |||
156 | int qMacVersion() | ||
157 | { | ||
158 | static int macver = Qt::MV_Unknown; | ||
159 | static bool first = TRUE; | ||
160 | if(first) { | ||
161 | first = FALSE; | ||
162 | long gestalt_version; | ||
163 | if(Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { | ||
164 | if(gestalt_version >= 0x1020 && gestalt_version < 0x1030) | ||
165 | macver = Qt::MV_10_DOT_2; | ||
166 | else if(gestalt_version >= 0x1010 && gestalt_version < 0x1020) | ||
167 | macver = Qt::MV_10_DOT_1; | ||
168 | } | ||
169 | } | ||
170 | return macver; | ||
171 | } | ||
172 | Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion(); | ||
173 | #elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) | ||
153 | bool qt_winunicode; | 174 | bool qt_winunicode; |
154 | 175 | ||
155 | #include "qt_windows.h" | 176 | #include "qt_windows.h" |
156 | 177 | ||
157 | int qWinVersion() | 178 | int qWinVersion() |
158 | { | 179 | { |
159 | #ifndef VER_PLATFORM_WIN32s | 180 | #ifndef VER_PLATFORM_WIN32s |
160 | #define VER_PLATFORM_WIN32s 0 | 181 | #define VER_PLATFORM_WIN32s 0 |
161 | #endif | 182 | #endif |
162 | #ifndef VER_PLATFORM_WIN32_WINDOWS | 183 | #ifndef VER_PLATFORM_WIN32_WINDOWS |
163 | #define VER_PLATFORM_WIN32_WINDOWS 1 | 184 | #define VER_PLATFORM_WIN32_WINDOWS 1 |
164 | #endif | 185 | #endif |
165 | #ifndef VER_PLATFORM_WIN32_NT | 186 | #ifndef VER_PLATFORM_WIN32_NT |
166 | #define VER_PLATFORM_WIN32_NT 2 | 187 | #define VER_PLATFORM_WIN32_NT 2 |
167 | #endif | 188 | #endif |
168 | 189 | ||
@@ -308,49 +329,61 @@ Qt::WindowsVersion qt_winver = (Qt::WindowsVersion)qWinVersion(); | |||
308 | \warning The internal buffer is limited to 8196 bytes (including | 329 | \warning The internal buffer is limited to 8196 bytes (including |
309 | the '\0'-terminator). | 330 | the '\0'-terminator). |
310 | 331 | ||
311 | \warning Passing (const char *)0 as argument to qFatal might lead | 332 | \warning Passing (const char *)0 as argument to qFatal might lead |
312 | to crashes on certain platforms due to the platforms printf implementation. | 333 | to crashes on certain platforms due to the platforms printf implementation. |
313 | 334 | ||
314 | \sa qDebug(), qWarning(), qInstallMsgHandler(), | 335 | \sa qDebug(), qWarning(), qInstallMsgHandler(), |
315 | \link debug.html Debugging\endlink | 336 | \link debug.html Debugging\endlink |
316 | */ | 337 | */ |
317 | 338 | ||
318 | 339 | ||
319 | static QtMsgHandler handler = 0; // pointer to debug handler | 340 | static QtMsgHandler handler = 0; // pointer to debug handler |
320 | static const int QT_BUFFER_LENGTH = 8196;// internal buffer length | 341 | static const int QT_BUFFER_LENGTH = 8196;// internal buffer length |
321 | 342 | ||
322 | 343 | ||
323 | #ifdef Q_OS_MAC | 344 | #ifdef Q_OS_MAC |
324 | const unsigned char * p_str(const char * c, int len=-1) | 345 | QString cfstring2qstring(CFStringRef str) |
346 | { | ||
347 | CFIndex length = CFStringGetLength(str); | ||
348 | if(const UniChar *chars = CFStringGetCharactersPtr(str)) | ||
349 | return QString((QChar *)chars, length); | ||
350 | UniChar *buffer = (UniChar*)malloc(length * sizeof(UniChar)); | ||
351 | CFStringGetCharacters(str, CFRangeMake(0, length), buffer); | ||
352 | QString ret((QChar *)buffer, length); | ||
353 | free(buffer); | ||
354 | return ret; | ||
355 | } | ||
356 | |||
357 | unsigned char * p_str(const char * c, int len=-1) | ||
325 | { | 358 | { |
326 | const int maxlen = 255; | 359 | const int maxlen = 255; |
327 | if(len == -1) | 360 | if(len == -1) |
328 | len = qstrlen(c); | 361 | len = qstrlen(c); |
329 | if(len > maxlen) { | 362 | if(len > maxlen) { |
330 | qWarning( "p_str len must never exceed %d", maxlen ); | 363 | qWarning( "p_str len must never exceed %d", maxlen ); |
331 | len = maxlen; | 364 | len = maxlen; |
332 | } | 365 | } |
333 | unsigned char *ret = (unsigned char*)malloc(len+2); | 366 | unsigned char *ret = (unsigned char*)malloc(len+2); |
334 | *ret=len; | 367 | *ret=len; |
335 | memcpy(((char *)ret)+1,c,len); | 368 | memcpy(((char *)ret)+1,c,len); |
336 | *(ret+len+1) = '\0'; | 369 | *(ret+len+1) = '\0'; |
337 | return ret; | 370 | return ret; |
338 | } | 371 | } |
339 | 372 | ||
340 | const unsigned char * p_str(const QString &s) | 373 | unsigned char * p_str(const QString &s) |
341 | { | 374 | { |
342 | return p_str(s, s.length()); | 375 | return p_str(s, s.length()); |
343 | } | 376 | } |
344 | 377 | ||
345 | QCString p2qstring(const unsigned char *c) { | 378 | QCString p2qstring(const unsigned char *c) { |
346 | char *arr = (char *)malloc(c[0] + 1); | 379 | char *arr = (char *)malloc(c[0] + 1); |
347 | memcpy(arr, c+1, c[0]); | 380 | memcpy(arr, c+1, c[0]); |
348 | arr[c[0]] = '\0'; | 381 | arr[c[0]] = '\0'; |
349 | QCString ret = arr; | 382 | QCString ret = arr; |
350 | delete arr; | 383 | delete arr; |
351 | return ret; | 384 | return ret; |
352 | } | 385 | } |
353 | #endif | 386 | #endif |
354 | 387 | ||
355 | 388 | ||
356 | #ifdef Q_CC_MWERKS | 389 | #ifdef Q_CC_MWERKS |
@@ -628,44 +661,44 @@ void qSystemWarning( const char* msg, int code ) | |||
628 | 661 | ||
629 | If \c b is zero, the Q_ASSERT statement will output the following | 662 | If \c b is zero, the Q_ASSERT statement will output the following |
630 | message using the qWarning() function: | 663 | message using the qWarning() function: |
631 | \code | 664 | \code |
632 | ASSERT: "b == 0" in div.cpp (9) | 665 | ASSERT: "b == 0" in div.cpp (9) |
633 | \endcode | 666 | \endcode |
634 | 667 | ||
635 | \sa qWarning(), \link debug.html Debugging\endlink | 668 | \sa qWarning(), \link debug.html Debugging\endlink |
636 | */ | 669 | */ |
637 | 670 | ||
638 | 671 | ||
639 | /*! | 672 | /*! |
640 | \fn void Q_CHECK_PTR( void *p ) | 673 | \fn void Q_CHECK_PTR( void *p ) |
641 | 674 | ||
642 | \relates QApplication | 675 | \relates QApplication |
643 | 676 | ||
644 | If \a p is null, a fatal messages says that the program ran out of | 677 | If \a p is 0, a fatal messages says that the program ran out of |
645 | memory and exits. If \e p is not null, nothing happens. | 678 | memory and exits. If \e p is not 0, nothing happens. |
646 | 679 | ||
647 | This is really a macro defined in \c qglobal.h. | 680 | This is really a macro defined in \c qglobal.h. |
648 | 681 | ||
649 | Example: | 682 | Example: |
650 | \code | 683 | \code |
651 | int *a; | 684 | int *a; |
652 | 685 | ||
653 | Q_CHECK_PTR( a = new int[80] ); // WRONG! | 686 | Q_CHECK_PTR( a = new int[80] ); // WRONG! |
654 | 687 | ||
655 | a = new int[80]; // Right | 688 | a = new (nothrow) int[80]; // Right |
656 | Q_CHECK_PTR( a ); | 689 | Q_CHECK_PTR( a ); |
657 | \endcode | 690 | \endcode |
658 | 691 | ||
659 | \sa qFatal(), \link debug.html Debugging\endlink | 692 | \sa qFatal(), \link debug.html Debugging\endlink |
660 | */ | 693 | */ |
661 | 694 | ||
662 | 695 | ||
663 | // | 696 | // |
664 | // The Q_CHECK_PTR macro calls this function to check if an allocation went ok. | 697 | // The Q_CHECK_PTR macro calls this function to check if an allocation went ok. |
665 | // | 698 | // |
666 | #if (QT_VERSION-0 >= 0x040000) | 699 | #if (QT_VERSION-0 >= 0x040000) |
667 | #if defined(Q_CC_GNU) | 700 | #if defined(Q_CC_GNU) |
668 | #warning "Change Q_CHECK_PTR to '{if ((p)==0) qt_check_pointer(__FILE__,__LINE__);}'" | 701 | #warning "Change Q_CHECK_PTR to '{if ((p)==0) qt_check_pointer(__FILE__,__LINE__);}'" |
669 | #warning "No need for qt_check_pointer() to return a value - make it void!" | 702 | #warning "No need for qt_check_pointer() to return a value - make it void!" |
670 | #endif | 703 | #endif |
671 | #endif | 704 | #endif |
diff --git a/qmake/tools/qgpluginmanager.cpp b/qmake/tools/qgpluginmanager.cpp index 46c85f5..72246ac 100644 --- a/qmake/tools/qgpluginmanager.cpp +++ b/qmake/tools/qgpluginmanager.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QGPluginManager class | 4 | ** Implementation of QGPluginManager class |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the tools module of the Qt GUI Toolkit. | 8 | ** This file is part of the tools module of the Qt GUI Toolkit. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
20 | ** licenses may use this file in accordance with the Qt Commercial License | 20 | ** licenses may use this file in accordance with the Qt Commercial License |
21 | ** Agreement provided with the Software. | 21 | ** Agreement provided with the Software. |
22 | ** | 22 | ** |
@@ -462,33 +462,33 @@ bool QGPluginManager::addLibrary( QLibrary* lib ) | |||
462 | QComponentInformationInterface *cpiFace = 0; | 462 | QComponentInformationInterface *cpiFace = 0; |
463 | iFace->queryInterface( IID_QFeatureList, (QUnknownInterface**)&fliFace ); | 463 | iFace->queryInterface( IID_QFeatureList, (QUnknownInterface**)&fliFace ); |
464 | if ( !fliFace ) | 464 | if ( !fliFace ) |
465 | plugin->queryInterface( IID_QFeatureList, (QUnknownInterface**)&fliFace ); | 465 | plugin->queryInterface( IID_QFeatureList, (QUnknownInterface**)&fliFace ); |
466 | if ( !fliFace ) { | 466 | if ( !fliFace ) { |
467 | iFace->queryInterface( IID_QComponentInformation, (QUnknownInterface**)&cpiFace ); | 467 | iFace->queryInterface( IID_QComponentInformation, (QUnknownInterface**)&cpiFace ); |
468 | if ( !cpiFace ) | 468 | if ( !cpiFace ) |
469 | plugin->queryInterface( IID_QComponentInformation, (QUnknownInterface**)&cpiFace ); | 469 | plugin->queryInterface( IID_QComponentInformation, (QUnknownInterface**)&cpiFace ); |
470 | } | 470 | } |
471 | QStringList fl; | 471 | QStringList fl; |
472 | if ( fliFace ) | 472 | if ( fliFace ) |
473 | // Map all found features to the library | 473 | // Map all found features to the library |
474 | fl = fliFace->featureList(); | 474 | fl = fliFace->featureList(); |
475 | else if ( cpiFace ) | 475 | else if ( cpiFace ) |
476 | fl << cpiFace->name(); | 476 | fl << cpiFace->name(); |
477 | 477 | ||
478 | for ( QStringList::Iterator f = fl.begin(); f != fl.end(); f++ ) { | 478 | for ( QStringList::Iterator f = fl.begin(); f != fl.end(); ++f ) { |
479 | QLibrary *old = plugDict[*f]; | 479 | QLibrary *old = plugDict[*f]; |
480 | if ( !old ) { | 480 | if ( !old ) { |
481 | useful = TRUE; | 481 | useful = TRUE; |
482 | plugDict.replace( *f, plugin ); | 482 | plugDict.replace( *f, plugin ); |
483 | } else { | 483 | } else { |
484 | // we have old *and* plugin, which one to pick? | 484 | // we have old *and* plugin, which one to pick? |
485 | QComLibrary* first = (QComLibrary*)old; | 485 | QComLibrary* first = (QComLibrary*)old; |
486 | QComLibrary* second = (QComLibrary*)plugin; | 486 | QComLibrary* second = (QComLibrary*)plugin; |
487 | bool takeFirst = TRUE; | 487 | bool takeFirst = TRUE; |
488 | if ( first->qtVersion() != QT_VERSION ) { | 488 | if ( first->qtVersion() != QT_VERSION ) { |
489 | if ( second->qtVersion() == QT_VERSION ) | 489 | if ( second->qtVersion() == QT_VERSION ) |
490 | takeFirst = FALSE; | 490 | takeFirst = FALSE; |
491 | else if ( second->qtVersion() < QT_VERSION && | 491 | else if ( second->qtVersion() < QT_VERSION && |
492 | first->qtVersion() > QT_VERSION ) | 492 | first->qtVersion() > QT_VERSION ) |
493 | takeFirst = FALSE; | 493 | takeFirst = FALSE; |
494 | } | 494 | } |
diff --git a/qmake/tools/qgvector.cpp b/qmake/tools/qgvector.cpp index 1985f03..3c903ed 100644 --- a/qmake/tools/qgvector.cpp +++ b/qmake/tools/qgvector.cpp | |||
@@ -22,32 +22,38 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qglobal.h" | ||
39 | #if defined(Q_CC_BOR) | ||
40 | // needed for qsort() because of a std namespace problem on Borland | ||
41 | #include "qplatformdefs.h" | ||
42 | #endif | ||
43 | |||
38 | #define QGVECTOR_CPP | 44 | #define QGVECTOR_CPP |
39 | #include "qgvector.h" | 45 | #include "qgvector.h" |
40 | #include "qglist.h" | 46 | #include "qglist.h" |
41 | #include "qstring.h" | 47 | #include "qstring.h" |
42 | #include "qdatastream.h" | 48 | #include "qdatastream.h" |
43 | #include <stdlib.h> | 49 | #include <stdlib.h> |
44 | 50 | ||
45 | #ifdef QT_THREAD_SUPPORT | 51 | #ifdef QT_THREAD_SUPPORT |
46 | # include <private/qmutexpool_p.h> | 52 | # include <private/qmutexpool_p.h> |
47 | #endif // QT_THREAD_SUPPORT | 53 | #endif // QT_THREAD_SUPPORT |
48 | 54 | ||
49 | #define USE_MALLOC // comment to use new/delete | 55 | #define USE_MALLOC // comment to use new/delete |
50 | 56 | ||
51 | #undef NEW | 57 | #undef NEW |
52 | #undef DELETE | 58 | #undef DELETE |
53 | 59 | ||
@@ -380,33 +386,34 @@ void QGVector::sort() // sort vector | |||
380 | Item tmp; | 386 | Item tmp; |
381 | for (;;) { // put all zero elements behind | 387 | for (;;) { // put all zero elements behind |
382 | while ( start < end && *start != 0 ) | 388 | while ( start < end && *start != 0 ) |
383 | start++; | 389 | start++; |
384 | while ( end > start && *end == 0 ) | 390 | while ( end > start && *end == 0 ) |
385 | end--; | 391 | end--; |
386 | if ( start < end ) { | 392 | if ( start < end ) { |
387 | tmp = *start; | 393 | tmp = *start; |
388 | *start = *end; | 394 | *start = *end; |
389 | *end = tmp; | 395 | *end = tmp; |
390 | } else { | 396 | } else { |
391 | break; | 397 | break; |
392 | } | 398 | } |
393 | } | 399 | } |
394 | 400 | ||
395 | #ifdef QT_THREAD_SUPPORT | 401 | #ifdef QT_THREAD_SUPPORT |
396 | QMutexLocker locker( qt_global_mutexpool->get( &sort_vec ) ); | 402 | QMutexLocker locker( qt_global_mutexpool ? |
403 | qt_global_mutexpool->get( &sort_vec ) : 0 ); | ||
397 | #endif // QT_THREAD_SUPPORT | 404 | #endif // QT_THREAD_SUPPORT |
398 | 405 | ||
399 | sort_vec = (QGVector*)this; | 406 | sort_vec = (QGVector*)this; |
400 | qsort( vec, count(), sizeof(Item), cmp_vec ); | 407 | qsort( vec, count(), sizeof(Item), cmp_vec ); |
401 | sort_vec = 0; | 408 | sort_vec = 0; |
402 | } | 409 | } |
403 | 410 | ||
404 | int QGVector::bsearch( Item d ) const // binary search; when sorted | 411 | int QGVector::bsearch( Item d ) const // binary search; when sorted |
405 | { | 412 | { |
406 | if ( !len ) | 413 | if ( !len ) |
407 | return -1; | 414 | return -1; |
408 | if ( !d ) { | 415 | if ( !d ) { |
409 | #if defined(QT_CHECK_NULL) | 416 | #if defined(QT_CHECK_NULL) |
410 | qWarning( "QGVector::bsearch: Cannot search for null object" ); | 417 | qWarning( "QGVector::bsearch: Cannot search for null object" ); |
411 | #endif | 418 | #endif |
412 | return -1; | 419 | return -1; |
diff --git a/qmake/tools/qlibrary.cpp b/qmake/tools/qlibrary.cpp index 564db30..be1d54b 100644 --- a/qmake/tools/qlibrary.cpp +++ b/qmake/tools/qlibrary.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QLibrary class | 4 | ** Implementation of QLibrary class |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -58,33 +58,33 @@ | |||
58 | #if defined(Q_WS_WIN) && !defined(QT_MAKEDLL) | 58 | #if defined(Q_WS_WIN) && !defined(QT_MAKEDLL) |
59 | #define QT_NO_LIBRARY_UNLOAD | 59 | #define QT_NO_LIBRARY_UNLOAD |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) | 62 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) |
63 | : pHnd( 0 ), library( lib ) | 63 | : pHnd( 0 ), library( lib ) |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | /*! | 68 | /*! |
69 | \class QLibrary qlibrary.h | 69 | \class QLibrary qlibrary.h |
70 | \reentrant | 70 | \reentrant |
71 | \brief The QLibrary class provides a wrapper for handling shared libraries. | 71 | \brief The QLibrary class provides a wrapper for handling shared libraries. |
72 | 72 | ||
73 | \mainclass | 73 | \mainclass |
74 | \group plugins | 74 | \ingroup plugins |
75 | 75 | ||
76 | An instance of a QLibrary object can handle a single shared | 76 | An instance of a QLibrary object can handle a single shared |
77 | library and provide access to the functionality in the library in | 77 | library and provide access to the functionality in the library in |
78 | a platform independent way. If the library is a component server, | 78 | a platform independent way. If the library is a component server, |
79 | QLibrary provides access to the exported component and can | 79 | QLibrary provides access to the exported component and can |
80 | directly query this component for interfaces. | 80 | directly query this component for interfaces. |
81 | 81 | ||
82 | QLibrary ensures that the shared library is loaded and stays in | 82 | QLibrary ensures that the shared library is loaded and stays in |
83 | memory whilst it is in use. QLibrary can also unload the library | 83 | memory whilst it is in use. QLibrary can also unload the library |
84 | on destruction and release unused resources. | 84 | on destruction and release unused resources. |
85 | 85 | ||
86 | A typical use of QLibrary is to resolve an exported symbol in a | 86 | A typical use of QLibrary is to resolve an exported symbol in a |
87 | shared object, and to call the function that this symbol | 87 | shared object, and to call the function that this symbol |
88 | represents. This is called "explicit linking" in contrast to | 88 | represents. This is called "explicit linking" in contrast to |
89 | "implicit linking", which is done by the link step in the build | 89 | "implicit linking", which is done by the link step in the build |
90 | process when linking an executable against a library. | 90 | process when linking an executable against a library. |
@@ -313,31 +313,32 @@ void QLibrary::setAutoUnload( bool enabled ) | |||
313 | will set \e str to "mylib.dll" on Windows, and "libmylib.so" on Linux. | 313 | will set \e str to "mylib.dll" on Windows, and "libmylib.so" on Linux. |
314 | */ | 314 | */ |
315 | QString QLibrary::library() const | 315 | QString QLibrary::library() const |
316 | { | 316 | { |
317 | if ( libfile.isEmpty() ) | 317 | if ( libfile.isEmpty() ) |
318 | return libfile; | 318 | return libfile; |
319 | 319 | ||
320 | QString filename = libfile; | 320 | QString filename = libfile; |
321 | 321 | ||
322 | #if defined(Q_WS_WIN) | 322 | #if defined(Q_WS_WIN) |
323 | if ( filename.findRev( '.' ) <= filename.findRev( '/' ) ) | 323 | if ( filename.findRev( '.' ) <= filename.findRev( '/' ) ) |
324 | filename += ".dll"; | 324 | filename += ".dll"; |
325 | #elif defined(Q_OS_MACX) | 325 | #elif defined(Q_OS_MACX) |
326 | if ( filename.find( ".dylib" ) == -1 ) | 326 | if ( filename.find( ".dylib" ) == -1 ) |
327 | filename += ".dylib"; | 327 | filename += ".dylib"; |
328 | #else | 328 | #else |
329 | if ( filename.find( ".so" ) == -1 ) { | 329 | QString filter = ".so"; |
330 | if ( filename.find(filter) == -1 ) { | ||
330 | const int x = filename.findRev( "/" ); | 331 | const int x = filename.findRev( "/" ); |
331 | if ( x != -1 ) { | 332 | if ( x != -1 ) { |
332 | QString path = filename.left( x + 1 ); | 333 | QString path = filename.left( x + 1 ); |
333 | QString file = filename.right( filename.length() - x - 1 ); | 334 | QString file = filename.right( filename.length() - x - 1 ); |
334 | filename = QString( "%1lib%2.so" ).arg( path ).arg( file ); | 335 | filename = QString( "%1lib%2.%3" ).arg( path ).arg( file ).arg( filter ); |
335 | } else { | 336 | } else { |
336 | filename = QString( "lib%1.so" ).arg( filename ); | 337 | filename = QString( "lib%1.%2" ).arg( filename ).arg( filter ); |
337 | } | 338 | } |
338 | } | 339 | } |
339 | #endif | 340 | #endif |
340 | 341 | ||
341 | return filename; | 342 | return filename; |
342 | } | 343 | } |
343 | #endif //QT_NO_LIBRARY | 344 | #endif //QT_NO_LIBRARY |
diff --git a/qmake/tools/qlibrary_unix.cpp b/qmake/tools/qlibrary_unix.cpp index f0fbdf6..12b9310 100644 --- a/qmake/tools/qlibrary_unix.cpp +++ b/qmake/tools/qlibrary_unix.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QLibraryPrivate class | 4 | ** Implementation of QLibraryPrivate class |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
@@ -40,33 +40,50 @@ | |||
40 | 40 | ||
41 | #ifndef QT_NO_LIBRARY | 41 | #ifndef QT_NO_LIBRARY |
42 | 42 | ||
43 | #if defined(QT_AOUT_UNDERSCORE) | 43 | #if defined(QT_AOUT_UNDERSCORE) |
44 | #include <string.h> | 44 | #include <string.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | /* | 47 | /* |
48 | The platform dependent implementations of | 48 | The platform dependent implementations of |
49 | - loadLibrary | 49 | - loadLibrary |
50 | - freeLibrary | 50 | - freeLibrary |
51 | - resolveSymbol | 51 | - resolveSymbol |
52 | 52 | ||
53 | It's not too hard to guess what the functions do. | 53 | It's not too hard to guess what the functions do. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #if defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit | 56 | #if defined(Q_OS_MAC) |
57 | |||
58 | bool QLibraryPrivate::loadLibrary() | ||
59 | { | ||
60 | return FALSE; | ||
61 | } | ||
62 | |||
63 | bool QLibraryPrivate::freeLibrary() | ||
64 | { | ||
65 | return FALSE; | ||
66 | } | ||
67 | |||
68 | void* QLibraryPrivate::resolveSymbol( const char* ) | ||
69 | { | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | #elif defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit | ||
57 | 74 | ||
58 | bool QLibraryPrivate::loadLibrary() | 75 | bool QLibraryPrivate::loadLibrary() |
59 | { | 76 | { |
60 | if ( pHnd ) | 77 | if ( pHnd ) |
61 | return TRUE; | 78 | return TRUE; |
62 | 79 | ||
63 | QString filename = library->library(); | 80 | QString filename = library->library(); |
64 | 81 | ||
65 | pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); | 82 | pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); |
66 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 83 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
67 | if ( !pHnd ) | 84 | if ( !pHnd ) |
68 | qWarning( "%s: failed to load library!", filename.latin1() ); | 85 | qWarning( "%s: failed to load library!", filename.latin1() ); |
69 | #endif | 86 | #endif |
70 | return pHnd != 0; | 87 | return pHnd != 0; |
71 | } | 88 | } |
72 | 89 | ||
diff --git a/qmake/tools/qmutex_unix.cpp b/qmake/tools/qmutex_unix.cpp index c861b2d..3eb59cf 100644 --- a/qmake/tools/qmutex_unix.cpp +++ b/qmake/tools/qmutex_unix.cpp | |||
@@ -30,34 +30,35 @@ | |||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #if defined(QT_THREAD_SUPPORT) | 38 | #if defined(QT_THREAD_SUPPORT) |
39 | 39 | ||
40 | #include "qplatformdefs.h" | 40 | #include "qplatformdefs.h" |
41 | 41 | ||
42 | typedef pthread_mutex_t Q_MUTEX_T; | 42 | typedef pthread_mutex_t Q_MUTEX_T; |
43 | 43 | ||
44 | // POSIX threads mutex types | 44 | // POSIX threads mutex types |
45 | #if ((defined(PTHREAD_MUTEX_RECURSIVE) && defined(PTHREAD_MUTEX_DEFAULT)) || \ | 45 | #if ((defined(PTHREAD_MUTEX_RECURSIVE) && defined(PTHREAD_MUTEX_DEFAULT)) || \ |
46 | defined(Q_OS_FREEBSD)) && !defined(Q_OS_UNIXWARE) && !defined(Q_OS_SOLARIS) | 46 | defined(Q_OS_FREEBSD)) && !defined(Q_OS_UNIXWARE) && !defined(Q_OS_SOLARIS) && \ |
47 | // POSIX 1003.1c-1995 - We love this OS | 47 | !defined(Q_OS_MAC) |
48 | // POSIX 1003.1c-1995 - We love this OS | ||
48 | # define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_settype((a), (b)) | 49 | # define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_settype((a), (b)) |
49 | # if defined(QT_CHECK_RANGE) | 50 | # if defined(QT_CHECK_RANGE) |
50 | # define Q_NORMAL_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK | 51 | # define Q_NORMAL_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK |
51 | # else | 52 | # else |
52 | # define Q_NORMAL_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT | 53 | # define Q_NORMAL_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT |
53 | # endif | 54 | # endif |
54 | # define Q_RECURSIVE_MUTEX_TYPE PTHREAD_MUTEX_RECURSIVE | 55 | # define Q_RECURSIVE_MUTEX_TYPE PTHREAD_MUTEX_RECURSIVE |
55 | #elif defined(MUTEX_NONRECURSIVE_NP) && defined(MUTEX_RECURSIVE_NP) | 56 | #elif defined(MUTEX_NONRECURSIVE_NP) && defined(MUTEX_RECURSIVE_NP) |
56 | // POSIX 1003.4a pthreads draft extensions | 57 | // POSIX 1003.4a pthreads draft extensions |
57 | # define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_setkind_np((a), (b)); | 58 | # define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_setkind_np((a), (b)); |
58 | # define Q_NORMAL_MUTEX_TYPE MUTEX_NONRECURSIVE_NP | 59 | # define Q_NORMAL_MUTEX_TYPE MUTEX_NONRECURSIVE_NP |
59 | # define Q_RECURSIVE_MUTEX_TYPE MUTEX_RECURSIVE_NP | 60 | # define Q_RECURSIVE_MUTEX_TYPE MUTEX_RECURSIVE_NP |
60 | #else | 61 | #else |
61 | // Unknown mutex types - skip them | 62 | // Unknown mutex types - skip them |
62 | # define Q_MUTEX_SET_TYPE(a, b) | 63 | # define Q_MUTEX_SET_TYPE(a, b) |
63 | # undef Q_NORMAL_MUTEX_TYPE | 64 | # undef Q_NORMAL_MUTEX_TYPE |
@@ -648,33 +649,34 @@ bool QMutex::tryLock() | |||
648 | waitcondition.wait( locker.mutex() ); | 649 | waitcondition.wait( locker.mutex() ); |
649 | 650 | ||
650 | ... | 651 | ... |
651 | ... | 652 | ... |
652 | ... | 653 | ... |
653 | } | 654 | } |
654 | }; | 655 | }; |
655 | \endcode | 656 | \endcode |
656 | 657 | ||
657 | \sa QMutex, QWaitCondition | 658 | \sa QMutex, QWaitCondition |
658 | */ | 659 | */ |
659 | 660 | ||
660 | /*! | 661 | /*! |
661 | \fn QMutexLocker::QMutexLocker( QMutex *mutex ) | 662 | \fn QMutexLocker::QMutexLocker( QMutex *mutex ) |
662 | 663 | ||
663 | Constructs a QMutexLocker and locks \a mutex. The mutex will be | 664 | Constructs a QMutexLocker and locks \a mutex. The mutex will be |
664 | unlocked when the QMutexLocker is destroyed. | 665 | unlocked when the QMutexLocker is destroyed. If \a mutex is zero, |
666 | QMutexLocker does nothing. | ||
665 | 667 | ||
666 | \sa QMutex::lock() | 668 | \sa QMutex::lock() |
667 | */ | 669 | */ |
668 | 670 | ||
669 | /*! | 671 | /*! |
670 | \fn QMutexLocker::~QMutexLocker() | 672 | \fn QMutexLocker::~QMutexLocker() |
671 | 673 | ||
672 | Destroys the QMutexLocker and unlocks the mutex which was locked | 674 | Destroys the QMutexLocker and unlocks the mutex which was locked |
673 | in the constructor. | 675 | in the constructor. |
674 | 676 | ||
675 | \sa QMutexLocker::QMutexLocker(), QMutex::unlock() | 677 | \sa QMutexLocker::QMutexLocker(), QMutex::unlock() |
676 | */ | 678 | */ |
677 | 679 | ||
678 | /*! | 680 | /*! |
679 | \fn QMutex *QMutexLocker::mutex() const | 681 | \fn QMutex *QMutexLocker::mutex() const |
680 | 682 | ||
diff --git a/qmake/tools/qmutexpool.cpp b/qmake/tools/qmutexpool.cpp index 9ed2829..a8e7402 100644 --- a/qmake/tools/qmutexpool.cpp +++ b/qmake/tools/qmutexpool.cpp | |||
@@ -1,40 +1,59 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** ... | ||
5 | ** | ||
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the tools module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
20 | ** licenses may use this file in accordance with the Qt Commercial License | ||
21 | ** Agreement provided with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
1 | #include "qmutexpool_p.h" | 36 | #include "qmutexpool_p.h" |
2 | 37 | ||
3 | #ifdef QT_THREAD_SUPPORT | 38 | #ifdef QT_THREAD_SUPPORT |
4 | 39 | ||
5 | #include <qthread.h> | 40 | #include <qthread.h> |
6 | #include <stdio.h> | ||
7 | 41 | ||
8 | QMutexPool *qt_global_mutexpool = 0; | 42 | QMutexPool *qt_global_mutexpool = 0; |
9 | 43 | ||
10 | // this is an internal class used only for inititalizing the global mutexpool | ||
11 | class QGlobalMutexPoolInitializer | ||
12 | { | ||
13 | public: | ||
14 | inline QGlobalMutexPoolInitializer() | ||
15 | { | ||
16 | /* | ||
17 | Purify will report a leak here. However, this mutex pool must be alive | ||
18 | until *everything* in Qt has been destructed. Unfortunately there is | ||
19 | no way to guarantee this, so we never destroy this mutex pool. | ||
20 | */ | ||
21 | qt_global_mutexpool = new QMutexPool( TRUE ); | ||
22 | } | ||
23 | }; | ||
24 | QGlobalMutexPoolInitializer qt_global_mutexpool_initializer; | ||
25 | 44 | ||
26 | /*! | 45 | /*! |
27 | \class QMutexPool qmutexpool_p.h | 46 | \class QMutexPool qmutexpool_p.h |
28 | \brief The QMutexPool class provides a pool of QMutex objects. | 47 | \brief The QMutexPool class provides a pool of QMutex objects. |
29 | 48 | ||
30 | \internal | 49 | \internal |
31 | 50 | ||
32 | \ingroup thread | 51 | \ingroup thread |
33 | 52 | ||
34 | QMutexPool is a convenience class that provides access to a fixed | 53 | QMutexPool is a convenience class that provides access to a fixed |
35 | number of QMutex objects. | 54 | number of QMutex objects. |
36 | 55 | ||
37 | Typical use of a QMutexPool is in situations where it is not | 56 | Typical use of a QMutexPool is in situations where it is not |
38 | possible or feasible to use one QMutex for every protected object. | 57 | possible or feasible to use one QMutex for every protected object. |
39 | The mutex pool will return a mutex based on the address of the | 58 | The mutex pool will return a mutex based on the address of the |
40 | object that needs protection. | 59 | object that needs protection. |
@@ -72,59 +91,62 @@ QGlobalMutexPoolInitializer qt_global_mutexpool_initializer; | |||
72 | 91 | ||
73 | This function will safely calculate the square of a number, since | 92 | This function will safely calculate the square of a number, since |
74 | it uses a mutex from a QMutexPool. The mutex is locked and | 93 | it uses a mutex from a QMutexPool. The mutex is locked and |
75 | unlocked automatically by the QMutexLocker class. See the | 94 | unlocked automatically by the QMutexLocker class. See the |
76 | QMutexLocker documentation for more details. | 95 | QMutexLocker documentation for more details. |
77 | */ | 96 | */ |
78 | 97 | ||
79 | /*! | 98 | /*! |
80 | Constructs a QMutexPool, reserving space for \a size QMutexes. If | 99 | Constructs a QMutexPool, reserving space for \a size QMutexes. If |
81 | \a recursive is TRUE, all QMutexes in the pool will be recursive | 100 | \a recursive is TRUE, all QMutexes in the pool will be recursive |
82 | mutexes; otherwise they will all be non-recursive (the default). | 101 | mutexes; otherwise they will all be non-recursive (the default). |
83 | 102 | ||
84 | The QMutexes are created when needed, and deleted when the | 103 | The QMutexes are created when needed, and deleted when the |
85 | QMutexPool is destructed. | 104 | QMutexPool is destructed. |
86 | */ | 105 | */ |
87 | QMutexPool::QMutexPool( bool recursive, int size ) | 106 | QMutexPool::QMutexPool( bool recursive, int size ) |
88 | : mutex( FALSE ), mutexes( size ), recurs( recursive ) | 107 | : mutex( FALSE ), count( size ), recurs( recursive ) |
89 | { | 108 | { |
90 | mutexes.fill( 0 ); | 109 | mutexes = new QMutex*[count]; |
110 | for ( int index = 0; index < count; ++index ) { | ||
111 | mutexes[index] = 0; | ||
112 | } | ||
91 | } | 113 | } |
92 | 114 | ||
93 | /*! | 115 | /*! |
94 | Destructs a QMutexPool. All QMutexes that were created by the pool | 116 | Destructs a QMutexPool. All QMutexes that were created by the pool |
95 | are deleted. | 117 | are deleted. |
96 | */ | 118 | */ |
97 | QMutexPool::~QMutexPool() | 119 | QMutexPool::~QMutexPool() |
98 | { | 120 | { |
99 | QMutexLocker locker( &mutex ); | 121 | QMutexLocker locker( &mutex ); |
100 | QMutex **d = mutexes.data(); | 122 | for ( int index = 0; index < count; ++index ) { |
101 | for ( int index = 0; (uint) index < mutexes.size(); index++ ) { | 123 | delete mutexes[index]; |
102 | delete d[index]; | 124 | mutexes[index] = 0; |
103 | d[index] = 0; | ||
104 | } | 125 | } |
126 | delete [] mutexes; | ||
127 | mutexes = 0; | ||
105 | } | 128 | } |
106 | 129 | ||
107 | /*! | 130 | /*! |
108 | Returns a QMutex from the pool. QMutexPool uses the value \a | 131 | Returns a QMutex from the pool. QMutexPool uses the value \a |
109 | address to determine which mutex is retured from the pool. | 132 | address to determine which mutex is retured from the pool. |
110 | */ | 133 | */ |
111 | QMutex *QMutexPool::get( void *address ) | 134 | QMutex *QMutexPool::get( void *address ) |
112 | { | 135 | { |
113 | QMutex **d = mutexes.data(); | 136 | int index = (int) ( (unsigned long) address % count ); |
114 | int index = (int)( (ulong) address % mutexes.size() ); | ||
115 | 137 | ||
116 | if ( ! d[index] ) { | 138 | if ( ! mutexes[index] ) { |
117 | // mutex not created, create one | 139 | // mutex not created, create one |
118 | 140 | ||
119 | QMutexLocker locker( &mutex ); | 141 | QMutexLocker locker( &mutex ); |
120 | // we need to check once again that the mutex hasn't been created, since | 142 | // we need to check once again that the mutex hasn't been created, since |
121 | // 2 threads could be trying to create a mutex as the same index... | 143 | // 2 threads could be trying to create a mutex as the same index... |
122 | if ( ! d[index] ) { | 144 | if ( ! mutexes[index] ) { |
123 | d[index] = new QMutex( recurs ); | 145 | mutexes[index] = new QMutex( recurs ); |
124 | } | 146 | } |
125 | } | 147 | } |
126 | 148 | ||
127 | return d[index]; | 149 | return mutexes[index]; |
128 | } | 150 | } |
129 | 151 | ||
130 | #endif | 152 | #endif |
diff --git a/qmake/tools/qregexp.cpp b/qmake/tools/qregexp.cpp index 500efed..0c1f060 100644 --- a/qmake/tools/qregexp.cpp +++ b/qmake/tools/qregexp.cpp | |||
@@ -250,41 +250,41 @@ | |||
250 | \row \i <b>\\n</b> | 250 | \row \i <b>\\n</b> |
251 | \i This matches the ASCII line feed character (LF, 0x0A, Unix newline). | 251 | \i This matches the ASCII line feed character (LF, 0x0A, Unix newline). |
252 | \row \i <b>\\r</b> | 252 | \row \i <b>\\r</b> |
253 | \i This matches the ASCII carriage return character (CR, 0x0D). | 253 | \i This matches the ASCII carriage return character (CR, 0x0D). |
254 | \row \i <b>\\t</b> | 254 | \row \i <b>\\t</b> |
255 | \i This matches the ASCII horizontal tab character (HT, 0x09). | 255 | \i This matches the ASCII horizontal tab character (HT, 0x09). |
256 | \row \i <b>\\v</b> | 256 | \row \i <b>\\v</b> |
257 | \i This matches the ASCII vertical tab character (VT, 0x0B). | 257 | \i This matches the ASCII vertical tab character (VT, 0x0B). |
258 | \row \i <b>\\xhhhh</b> | 258 | \row \i <b>\\xhhhh</b> |
259 | \i This matches the Unicode character corresponding to the | 259 | \i This matches the Unicode character corresponding to the |
260 | hexadecimal number hhhh (between 0x0000 and 0xFFFF). \0ooo | 260 | hexadecimal number hhhh (between 0x0000 and 0xFFFF). \0ooo |
261 | (i.e., \zero ooo) matches the ASCII/Latin-1 character | 261 | (i.e., \zero ooo) matches the ASCII/Latin-1 character |
262 | corresponding to the octal number ooo (between 0 and 0377). | 262 | corresponding to the octal number ooo (between 0 and 0377). |
263 | \row \i <b>. (dot)</b> | 263 | \row \i <b>. (dot)</b> |
264 | \i This matches any character (including newline). | 264 | \i This matches any character (including newline). |
265 | \row \i <b>\\d</b> | 265 | \row \i <b>\\d</b> |
266 | \i This matches a digit (see QChar::isDigit()). | 266 | \i This matches a digit (QChar::isDigit()). |
267 | \row \i <b>\\D</b> | 267 | \row \i <b>\\D</b> |
268 | \i This matches a non-digit. | 268 | \i This matches a non-digit. |
269 | \row \i <b>\\s</b> | 269 | \row \i <b>\\s</b> |
270 | \i This matches a whitespace (see QChar::isSpace()). | 270 | \i This matches a whitespace (QChar::isSpace()). |
271 | \row \i <b>\\S</b> | 271 | \row \i <b>\\S</b> |
272 | \i This matches a non-whitespace. | 272 | \i This matches a non-whitespace. |
273 | \row \i <b>\\w</b> | 273 | \row \i <b>\\w</b> |
274 | \i This matches a word character (see QChar::isLetterOrNumber()). | 274 | \i This matches a word character (QChar::isLetterOrNumber() or '_'). |
275 | \row \i <b>\\W</b> | 275 | \row \i <b>\\W</b> |
276 | \i This matches a non-word character. | 276 | \i This matches a non-word character. |
277 | \row \i <b>\\n</b> | 277 | \row \i <b>\\n</b> |
278 | \i The n-th \link #capturing-text backreference \endlink, | 278 | \i The n-th \link #capturing-text backreference \endlink, |
279 | e.g. \1, \2, etc. | 279 | e.g. \1, \2, etc. |
280 | \endtable | 280 | \endtable |
281 | 281 | ||
282 | \e {Note that the C++ compiler transforms backslashes in strings | 282 | \e {Note that the C++ compiler transforms backslashes in strings |
283 | so to include a <b>\\</b> in a regexp you will need to enter it | 283 | so to include a <b>\\</b> in a regexp you will need to enter it |
284 | twice, i.e. <b>\\\\</b>.} | 284 | twice, i.e. <b>\\\\</b>.} |
285 | 285 | ||
286 | \target sets-of-characters | 286 | \target sets-of-characters |
287 | \section1 Sets of Characters | 287 | \section1 Sets of Characters |
288 | 288 | ||
289 | Square brackets are used to match any character in the set of | 289 | Square brackets are used to match any character in the set of |
290 | characters contained within the square brackets. All the character | 290 | characters contained within the square brackets. All the character |
@@ -534,33 +534,40 @@ | |||
534 | does not have an equivalent to Perl's \c{/m} option, but this | 534 | does not have an equivalent to Perl's \c{/m} option, but this |
535 | can be emulated in various ways for example by splitting the input | 535 | can be emulated in various ways for example by splitting the input |
536 | into lines or by looping with a regexp that searches for newlines. | 536 | into lines or by looping with a regexp that searches for newlines. |
537 | 537 | ||
538 | Because QRegExp is string oriented there are no \A, \Z or \z | 538 | Because QRegExp is string oriented there are no \A, \Z or \z |
539 | assertions. The \G assertion is not supported but can be emulated | 539 | assertions. The \G assertion is not supported but can be emulated |
540 | in a loop. | 540 | in a loop. |
541 | 541 | ||
542 | Perl's $& is cap(0) or capturedTexts()[0]. There are no QRegExp | 542 | Perl's $& is cap(0) or capturedTexts()[0]. There are no QRegExp |
543 | equivalents for $`, $' or $+. Perl's capturing variables, $1, $2, | 543 | equivalents for $`, $' or $+. Perl's capturing variables, $1, $2, |
544 | ... correspond to cap(1) or capturedTexts()[1], cap(2) or | 544 | ... correspond to cap(1) or capturedTexts()[1], cap(2) or |
545 | capturedTexts()[2], etc. | 545 | capturedTexts()[2], etc. |
546 | 546 | ||
547 | To substitute a pattern use QString::replace(). | 547 | To substitute a pattern use QString::replace(). |
548 | 548 | ||
549 | Perl's extended \c{/x} syntax is not supported, nor are | 549 | Perl's extended \c{/x} syntax is not supported, nor are |
550 | regexp comments (?#comment) or directives, e.g. (?i). | 550 | directives, e.g. (?i), or regexp comments, e.g. (?#comment). On |
551 | the other hand, C++'s rules for literal strings can be used to | ||
552 | achieve the same: | ||
553 | \code | ||
554 | QRegExp mark( "\\b" // word boundary | ||
555 | "[Mm]ark" // the word we want to match | ||
556 | ); | ||
557 | \endcode | ||
551 | 558 | ||
552 | Both zero-width positive and zero-width negative lookahead | 559 | Both zero-width positive and zero-width negative lookahead |
553 | assertions (?=pattern) and (?!pattern) are supported with the same | 560 | assertions (?=pattern) and (?!pattern) are supported with the same |
554 | syntax as Perl. Perl's lookbehind assertions, "independent" | 561 | syntax as Perl. Perl's lookbehind assertions, "independent" |
555 | subexpressions and conditional expressions are not supported. | 562 | subexpressions and conditional expressions are not supported. |
556 | 563 | ||
557 | Non-capturing parentheses are also supported, with the same | 564 | Non-capturing parentheses are also supported, with the same |
558 | (?:pattern) syntax. | 565 | (?:pattern) syntax. |
559 | 566 | ||
560 | See QStringList::split() and QStringList::join() for equivalents | 567 | See QStringList::split() and QStringList::join() for equivalents |
561 | to Perl's split and join functions. | 568 | to Perl's split and join functions. |
562 | 569 | ||
563 | Note: because C++ transforms \\'s they must be written \e twice in | 570 | Note: because C++ transforms \\'s they must be written \e twice in |
564 | code, e.g. <b>\\b</b> must be written <b>\\\\b</b>. | 571 | code, e.g. <b>\\b</b> must be written <b>\\\\b</b>. |
565 | 572 | ||
566 | \target code-examples | 573 | \target code-examples |
@@ -664,37 +671,37 @@ | |||
664 | address and country. Unfortunately the regexp is rather long and | 671 | address and country. Unfortunately the regexp is rather long and |
665 | not very versatile -- the code will break if we add any more | 672 | not very versatile -- the code will break if we add any more |
666 | fields. A simpler and better solution is to look for the | 673 | fields. A simpler and better solution is to look for the |
667 | separator, '\t' in this case, and take the surrounding text. The | 674 | separator, '\t' in this case, and take the surrounding text. The |
668 | QStringList split() function can take a separator string or regexp | 675 | QStringList split() function can take a separator string or regexp |
669 | as an argument and split a string accordingly. | 676 | as an argument and split a string accordingly. |
670 | 677 | ||
671 | \code | 678 | \code |
672 | QStringList field = QStringList::split( "\t", str ); | 679 | QStringList field = QStringList::split( "\t", str ); |
673 | \endcode | 680 | \endcode |
674 | 681 | ||
675 | Here field[0] is the company, field[1] the web address and so on. | 682 | Here field[0] is the company, field[1] the web address and so on. |
676 | 683 | ||
677 | To imitate the matching of a shell we can use wildcard mode. | 684 | To imitate the matching of a shell we can use wildcard mode. |
678 | 685 | ||
679 | \code | 686 | \code |
680 | QRegExp rx( "*.html" ); // invalid regexp: * doesn't quantify anything | 687 | QRegExp rx( "*.html" ); // invalid regexp: * doesn't quantify anything |
681 | rx.setWildcard( TRUE ); // now it's a valid wildcard regexp | 688 | rx.setWildcard( TRUE ); // now it's a valid wildcard regexp |
682 | rx.search( "index.html" ); // returns 0 (matched at position 0) | 689 | rx.exactMatch( "index.html" ); // returns TRUE |
683 | rx.search( "default.htm" ); // returns -1 (no match) | 690 | rx.exactMatch( "default.htm" ); // returns FALSE |
684 | rx.search( "readme.txt" ); // returns -1 (no match) | 691 | rx.exactMatch( "readme.txt" ); // returns FALSE |
685 | \endcode | 692 | \endcode |
686 | 693 | ||
687 | Wildcard matching can be convenient because of its simplicity, but | 694 | Wildcard matching can be convenient because of its simplicity, but |
688 | any wildcard regexp can be defined using full regexps, e.g. | 695 | any wildcard regexp can be defined using full regexps, e.g. |
689 | <b>.*\.html$</b>. Notice that we can't match both \c .html and \c | 696 | <b>.*\.html$</b>. Notice that we can't match both \c .html and \c |
690 | .htm files with a wildcard unless we use <b>*.htm*</b> which will | 697 | .htm files with a wildcard unless we use <b>*.htm*</b> which will |
691 | also match 'test.html.bak'. A full regexp gives us the precision | 698 | also match 'test.html.bak'. A full regexp gives us the precision |
692 | we need, <b>.*\\.html?$</b>. | 699 | we need, <b>.*\\.html?$</b>. |
693 | 700 | ||
694 | QRegExp can match case insensitively using setCaseSensitive(), and | 701 | QRegExp can match case insensitively using setCaseSensitive(), and |
695 | can use non-greedy matching, see setMinimal(). By default QRegExp | 702 | can use non-greedy matching, see setMinimal(). By default QRegExp |
696 | uses full regexps but this can be changed with setWildcard(). | 703 | uses full regexps but this can be changed with setWildcard(). |
697 | Searching can be forward with search() or backward with | 704 | Searching can be forward with search() or backward with |
698 | searchRev(). Captured text can be accessed using capturedTexts() | 705 | searchRev(). Captured text can be accessed using capturedTexts() |
699 | which returns a string list of all captured strings, or using | 706 | which returns a string list of all captured strings, or using |
700 | cap() which returns the captured string for the given index. The | 707 | cap() which returns the captured string for the given index. The |
@@ -702,32 +709,37 @@ | |||
702 | string where the match was made (or -1 if there was no match). | 709 | string where the match was made (or -1 if there was no match). |
703 | 710 | ||
704 | \sa QRegExpValidator QString QStringList | 711 | \sa QRegExpValidator QString QStringList |
705 | 712 | ||
706 | \target member-function-documentation | 713 | \target member-function-documentation |
707 | */ | 714 | */ |
708 | 715 | ||
709 | const int NumBadChars = 64; | 716 | const int NumBadChars = 64; |
710 | #define BadChar( ch ) ( (ch).unicode() % NumBadChars ) | 717 | #define BadChar( ch ) ( (ch).unicode() % NumBadChars ) |
711 | 718 | ||
712 | const int NoOccurrence = INT_MAX; | 719 | const int NoOccurrence = INT_MAX; |
713 | const int EmptyCapture = INT_MAX; | 720 | const int EmptyCapture = INT_MAX; |
714 | const int InftyLen = INT_MAX; | 721 | const int InftyLen = INT_MAX; |
715 | const int InftyRep = 1025; | 722 | const int InftyRep = 1025; |
716 | const int EOS = -1; | 723 | const int EOS = -1; |
717 | 724 | ||
725 | static bool isWord( QChar ch ) | ||
726 | { | ||
727 | return ch.isLetterOrNumber() || ch == QChar( '_' ); | ||
728 | } | ||
729 | |||
718 | /* | 730 | /* |
719 | Merges two QMemArrays of ints and puts the result into the first one. | 731 | Merges two QMemArrays of ints and puts the result into the first one. |
720 | */ | 732 | */ |
721 | static void mergeInto( QMemArray<int> *a, const QMemArray<int>& b ) | 733 | static void mergeInto( QMemArray<int> *a, const QMemArray<int>& b ) |
722 | { | 734 | { |
723 | int asize = a->size(); | 735 | int asize = a->size(); |
724 | int bsize = b.size(); | 736 | int bsize = b.size(); |
725 | if ( asize == 0 ) { | 737 | if ( asize == 0 ) { |
726 | *a = b.copy(); | 738 | *a = b.copy(); |
727 | #ifndef QT_NO_REGEXP_OPTIM | 739 | #ifndef QT_NO_REGEXP_OPTIM |
728 | } else if ( bsize == 1 && (*a)[asize - 1] < b[0] ) { | 740 | } else if ( bsize == 1 && (*a)[asize - 1] < b[0] ) { |
729 | a->resize( asize + 1 ); | 741 | a->resize( asize + 1 ); |
730 | (*a)[asize] = b[0]; | 742 | (*a)[asize] = b[0]; |
731 | #endif | 743 | #endif |
732 | } else if ( bsize >= 1 ) { | 744 | } else if ( bsize >= 1 ) { |
733 | int csize = asize + bsize; | 745 | int csize = asize + bsize; |
@@ -1667,35 +1679,35 @@ bool QRegExpEngine::testAnchor( int i, int a, const int *capBegin ) | |||
1667 | } | 1679 | } |
1668 | #endif | 1680 | #endif |
1669 | 1681 | ||
1670 | if ( (a & Anchor_Caret) != 0 ) { | 1682 | if ( (a & Anchor_Caret) != 0 ) { |
1671 | if ( mmPos + i != mmCaretPos ) | 1683 | if ( mmPos + i != mmCaretPos ) |
1672 | return FALSE; | 1684 | return FALSE; |
1673 | } | 1685 | } |
1674 | if ( (a & Anchor_Dollar) != 0 ) { | 1686 | if ( (a & Anchor_Dollar) != 0 ) { |
1675 | if ( mmPos + i != mmLen ) | 1687 | if ( mmPos + i != mmLen ) |
1676 | return FALSE; | 1688 | return FALSE; |
1677 | } | 1689 | } |
1678 | #ifndef QT_NO_REGEXP_ESCAPE | 1690 | #ifndef QT_NO_REGEXP_ESCAPE |
1679 | if ( (a & (Anchor_Word | Anchor_NonWord)) != 0 ) { | 1691 | if ( (a & (Anchor_Word | Anchor_NonWord)) != 0 ) { |
1680 | bool before = FALSE; | 1692 | bool before = FALSE; |
1681 | bool after = FALSE; | 1693 | bool after = FALSE; |
1682 | if ( mmPos + i != 0 ) | 1694 | if ( mmPos + i != 0 ) |
1683 | before = mmIn[mmPos + i - 1].isLetterOrNumber(); | 1695 | before = isWord( mmIn[mmPos + i - 1] ); |
1684 | if ( mmPos + i != mmLen ) | 1696 | if ( mmPos + i != mmLen ) |
1685 | after = mmIn[mmPos + i].isLetterOrNumber(); | 1697 | after = isWord( mmIn[mmPos + i] ); |
1686 | if ( (a & Anchor_Word) != 0 && (before == after) ) | 1698 | if ( (a & Anchor_Word) != 0 && (before == after) ) |
1687 | return FALSE; | 1699 | return FALSE; |
1688 | if ( (a & Anchor_NonWord) != 0 && (before != after) ) | 1700 | if ( (a & Anchor_NonWord) != 0 && (before != after) ) |
1689 | return FALSE; | 1701 | return FALSE; |
1690 | } | 1702 | } |
1691 | #endif | 1703 | #endif |
1692 | #ifndef QT_NO_REGEXP_LOOKAHEAD | 1704 | #ifndef QT_NO_REGEXP_LOOKAHEAD |
1693 | bool catchx = TRUE; | 1705 | bool catchx = TRUE; |
1694 | 1706 | ||
1695 | if ( (a & Anchor_LookaheadMask) != 0 ) { | 1707 | if ( (a & Anchor_LookaheadMask) != 0 ) { |
1696 | QConstString cstr = QConstString( (QChar *) mmIn + mmPos + i, | 1708 | QConstString cstr = QConstString( (QChar *) mmIn + mmPos + i, |
1697 | mmLen - mmPos - i ); | 1709 | mmLen - mmPos - i ); |
1698 | for ( j = 0; j < (int) ahead.size(); j++ ) { | 1710 | for ( j = 0; j < (int) ahead.size(); j++ ) { |
1699 | if ( (a & (Anchor_FirstLookahead << j)) != 0 ) { | 1711 | if ( (a & (Anchor_FirstLookahead << j)) != 0 ) { |
1700 | catchx = ahead[j]->eng->match( cstr.string(), 0, TRUE, TRUE, | 1712 | catchx = ahead[j]->eng->match( cstr.string(), 0, TRUE, TRUE, |
1701 | mmCaretPos - mmPos - i )[0] == 0; | 1713 | mmCaretPos - mmPos - i )[0] == 0; |
@@ -2619,52 +2631,60 @@ int QRegExpEngine::getEscape() | |||
2619 | return Tok_NonWord; | 2631 | return Tok_NonWord; |
2620 | #endif | 2632 | #endif |
2621 | #ifndef QT_NO_REGEXP_CCLASS | 2633 | #ifndef QT_NO_REGEXP_CCLASS |
2622 | case 'D': | 2634 | case 'D': |
2623 | // see QChar::isDigit() | 2635 | // see QChar::isDigit() |
2624 | yyCharClass->addCategories( 0x7fffffef ); | 2636 | yyCharClass->addCategories( 0x7fffffef ); |
2625 | return Tok_CharClass; | 2637 | return Tok_CharClass; |
2626 | case 'S': | 2638 | case 'S': |
2627 | // see QChar::isSpace() | 2639 | // see QChar::isSpace() |
2628 | yyCharClass->addCategories( 0x7ffff87f ); | 2640 | yyCharClass->addCategories( 0x7ffff87f ); |
2629 | yyCharClass->addRange( 0x0000, 0x0008 ); | 2641 | yyCharClass->addRange( 0x0000, 0x0008 ); |
2630 | yyCharClass->addRange( 0x000e, 0x001f ); | 2642 | yyCharClass->addRange( 0x000e, 0x001f ); |
2631 | yyCharClass->addRange( 0x007f, 0x009f ); | 2643 | yyCharClass->addRange( 0x007f, 0x009f ); |
2632 | return Tok_CharClass; | 2644 | return Tok_CharClass; |
2633 | case 'W': | 2645 | case 'W': |
2634 | // see QChar::isLetterOrNumber() | 2646 | // see QChar::isLetterOrNumber() |
2635 | yyCharClass->addCategories( 0x7ff07f8f ); | 2647 | yyCharClass->addCategories( 0x7fe07f8f ); |
2648 | yyCharClass->addRange( 0x203f, 0x2040 ); | ||
2649 | yyCharClass->addSingleton( 0x2040 ); | ||
2650 | yyCharClass->addSingleton( 0x30fb ); | ||
2651 | yyCharClass->addRange( 0xfe33, 0xfe34 ); | ||
2652 | yyCharClass->addRange( 0xfe4d, 0xfe4f ); | ||
2653 | yyCharClass->addSingleton( 0xff3f ); | ||
2654 | yyCharClass->addSingleton( 0xff65 ); | ||
2636 | return Tok_CharClass; | 2655 | return Tok_CharClass; |
2637 | #endif | 2656 | #endif |
2638 | #ifndef QT_NO_REGEXP_ESCAPE | 2657 | #ifndef QT_NO_REGEXP_ESCAPE |
2639 | case 'b': | 2658 | case 'b': |
2640 | return Tok_Word; | 2659 | return Tok_Word; |
2641 | #endif | 2660 | #endif |
2642 | #ifndef QT_NO_REGEXP_CCLASS | 2661 | #ifndef QT_NO_REGEXP_CCLASS |
2643 | case 'd': | 2662 | case 'd': |
2644 | // see QChar::isDigit() | 2663 | // see QChar::isDigit() |
2645 | yyCharClass->addCategories( 0x00000010 ); | 2664 | yyCharClass->addCategories( 0x00000010 ); |
2646 | return Tok_CharClass; | 2665 | return Tok_CharClass; |
2647 | case 's': | 2666 | case 's': |
2648 | // see QChar::isSpace() | 2667 | // see QChar::isSpace() |
2649 | yyCharClass->addCategories( 0x00000380 ); | 2668 | yyCharClass->addCategories( 0x00000380 ); |
2650 | yyCharClass->addRange( 0x0009, 0x000d ); | 2669 | yyCharClass->addRange( 0x0009, 0x000d ); |
2651 | return Tok_CharClass; | 2670 | return Tok_CharClass; |
2652 | case 'w': | 2671 | case 'w': |
2653 | // see QChar::isLetterOrNumber() | 2672 | // see QChar::isLetterOrNumber() |
2654 | yyCharClass->addCategories( 0x000f8070 ); | 2673 | yyCharClass->addCategories( 0x000f8070 ); |
2674 | yyCharClass->addSingleton( 0x005f ); // '_' | ||
2655 | return Tok_CharClass; | 2675 | return Tok_CharClass; |
2656 | #endif | 2676 | #endif |
2657 | #ifndef QT_NO_REGEXP_ESCAPE | 2677 | #ifndef QT_NO_REGEXP_ESCAPE |
2658 | case 'x': | 2678 | case 'x': |
2659 | val = 0; | 2679 | val = 0; |
2660 | for ( i = 0; i < 4; i++ ) { | 2680 | for ( i = 0; i < 4; i++ ) { |
2661 | low = QChar( yyCh ).lower(); | 2681 | low = QChar( yyCh ).lower(); |
2662 | if ( low >= '0' && low <= '9' ) | 2682 | if ( low >= '0' && low <= '9' ) |
2663 | val = ( val << 4 ) | ( low - '0' ); | 2683 | val = ( val << 4 ) | ( low - '0' ); |
2664 | else if ( low >= 'a' && low <= 'f' ) | 2684 | else if ( low >= 'a' && low <= 'f' ) |
2665 | val = ( val << 4 ) | ( low - 'a' + 10 ); | 2685 | val = ( val << 4 ) | ( low - 'a' + 10 ); |
2666 | else | 2686 | else |
2667 | break; | 2687 | break; |
2668 | yyCh = getChar(); | 2688 | yyCh = getChar(); |
2669 | } | 2689 | } |
2670 | return Tok_Char | val; | 2690 | return Tok_Char | val; |
@@ -3170,53 +3190,55 @@ struct QRegExpPrivate | |||
3170 | #endif | 3190 | #endif |
3171 | QMemArray<int> captured; // what QRegExpEngine::search() returned last | 3191 | QMemArray<int> captured; // what QRegExpEngine::search() returned last |
3172 | 3192 | ||
3173 | QRegExpPrivate() { captured.fill( -1, 2 ); } | 3193 | QRegExpPrivate() { captured.fill( -1, 2 ); } |
3174 | }; | 3194 | }; |
3175 | 3195 | ||
3176 | #ifndef QT_NO_REGEXP_OPTIM | 3196 | #ifndef QT_NO_REGEXP_OPTIM |
3177 | static QCache<QRegExpEngine> *engineCache = 0; | 3197 | static QCache<QRegExpEngine> *engineCache = 0; |
3178 | static QSingleCleanupHandler<QCache<QRegExpEngine> > cleanup_cache; | 3198 | static QSingleCleanupHandler<QCache<QRegExpEngine> > cleanup_cache; |
3179 | #endif | 3199 | #endif |
3180 | 3200 | ||
3181 | static QRegExpEngine *newEngine( const QString& pattern, bool caseSensitive ) | 3201 | static QRegExpEngine *newEngine( const QString& pattern, bool caseSensitive ) |
3182 | { | 3202 | { |
3183 | #ifndef QT_NO_REGEXP_OPTIM | 3203 | #ifndef QT_NO_REGEXP_OPTIM |
3184 | if ( engineCache != 0 ) { | 3204 | if ( engineCache != 0 ) { |
3185 | #ifdef QT_THREAD_SUPPORT | 3205 | #ifdef QT_THREAD_SUPPORT |
3186 | QMutexLocker locker( qt_global_mutexpool->get( &engineCache ) ); | 3206 | QMutexLocker locker( qt_global_mutexpool ? |
3207 | qt_global_mutexpool->get( &engineCache ) : 0 ); | ||
3187 | #endif | 3208 | #endif |
3188 | QRegExpEngine *eng = engineCache->take( pattern ); | 3209 | QRegExpEngine *eng = engineCache->take( pattern ); |
3189 | if ( eng == 0 || eng->caseSensitive() != caseSensitive ) { | 3210 | if ( eng == 0 || eng->caseSensitive() != caseSensitive ) { |
3190 | delete eng; | 3211 | delete eng; |
3191 | } else { | 3212 | } else { |
3192 | eng->ref(); | 3213 | eng->ref(); |
3193 | return eng; | 3214 | return eng; |
3194 | } | 3215 | } |
3195 | } | 3216 | } |
3196 | #endif | 3217 | #endif |
3197 | return new QRegExpEngine( pattern, caseSensitive ); | 3218 | return new QRegExpEngine( pattern, caseSensitive ); |
3198 | } | 3219 | } |
3199 | 3220 | ||
3200 | static void derefEngine( QRegExpEngine *eng, const QString& pattern ) | 3221 | static void derefEngine( QRegExpEngine *eng, const QString& pattern ) |
3201 | { | 3222 | { |
3202 | if ( eng != 0 && eng->deref() ) { | ||
3203 | #ifndef QT_NO_REGEXP_OPTIM | ||
3204 | #ifdef QT_THREAD_SUPPORT | 3223 | #ifdef QT_THREAD_SUPPORT |
3205 | QMutexLocker locker( qt_global_mutexpool->get( &engineCache ) ); | 3224 | QMutexLocker locker( qt_global_mutexpool ? |
3225 | qt_global_mutexpool->get( &engineCache ) : 0 ); | ||
3206 | #endif | 3226 | #endif |
3227 | if ( eng != 0 && eng->deref() ) { | ||
3228 | #ifndef QT_NO_REGEXP_OPTIM | ||
3207 | if ( engineCache == 0 ) { | 3229 | if ( engineCache == 0 ) { |
3208 | engineCache = new QCache<QRegExpEngine>; | 3230 | engineCache = new QCache<QRegExpEngine>; |
3209 | engineCache->setAutoDelete( TRUE ); | 3231 | engineCache->setAutoDelete( TRUE ); |
3210 | cleanup_cache.set( &engineCache ); | 3232 | cleanup_cache.set( &engineCache ); |
3211 | } | 3233 | } |
3212 | if ( !pattern.isNull() && | 3234 | if ( !pattern.isNull() && |
3213 | engineCache->insert(pattern, eng, 4 + pattern.length() / 4) ) | 3235 | engineCache->insert(pattern, eng, 4 + pattern.length() / 4) ) |
3214 | return; | 3236 | return; |
3215 | #else | 3237 | #else |
3216 | Q_UNUSED( pattern ); | 3238 | Q_UNUSED( pattern ); |
3217 | #endif | 3239 | #endif |
3218 | delete eng; | 3240 | delete eng; |
3219 | } | 3241 | } |
3220 | } | 3242 | } |
3221 | 3243 | ||
3222 | /*! | 3244 | /*! |
@@ -3552,39 +3574,32 @@ bool QRegExp::exactMatch( const QString& str ) const | |||
3552 | regexp, if present. Otherwise, position 0 in \a str will match. | 3574 | regexp, if present. Otherwise, position 0 in \a str will match. |
3553 | 3575 | ||
3554 | Use search() and matchedLength() instead of this function. | 3576 | Use search() and matchedLength() instead of this function. |
3555 | 3577 | ||
3556 | \sa QString::mid() QConstString | 3578 | \sa QString::mid() QConstString |
3557 | */ | 3579 | */ |
3558 | int QRegExp::match( const QString& str, int index, int *len, | 3580 | int QRegExp::match( const QString& str, int index, int *len, |
3559 | bool indexIsStart ) const | 3581 | bool indexIsStart ) const |
3560 | { | 3582 | { |
3561 | int pos = search( str, index, indexIsStart ? CaretAtOffset : CaretAtZero ); | 3583 | int pos = search( str, index, indexIsStart ? CaretAtOffset : CaretAtZero ); |
3562 | if ( len != 0 ) | 3584 | if ( len != 0 ) |
3563 | *len = matchedLength(); | 3585 | *len = matchedLength(); |
3564 | return pos; | 3586 | return pos; |
3565 | } | 3587 | } |
3566 | #endif // QT_NO_COMPAT | 3588 | #endif // QT_NO_COMPAT |
3567 | 3589 | ||
3568 | /*! | ||
3569 | \overload | ||
3570 | |||
3571 | This convenience function searches with a \c CaretMode of \c | ||
3572 | CaretAtZero which is the most common usage. | ||
3573 | */ | ||
3574 | |||
3575 | int QRegExp::search( const QString& str, int offset ) const | 3590 | int QRegExp::search( const QString& str, int offset ) const |
3576 | { | 3591 | { |
3577 | return search( str, offset, CaretAtZero ); | 3592 | return search( str, offset, CaretAtZero ); |
3578 | } | 3593 | } |
3579 | 3594 | ||
3580 | /*! | 3595 | /*! |
3581 | Attempts to find a match in \a str from position \a offset (0 by | 3596 | Attempts to find a match in \a str from position \a offset (0 by |
3582 | default). If \a offset is -1, the search starts at the last | 3597 | default). If \a offset is -1, the search starts at the last |
3583 | character; if -2, at the next to last character; etc. | 3598 | character; if -2, at the next to last character; etc. |
3584 | 3599 | ||
3585 | Returns the position of the first match, or -1 if there was no | 3600 | Returns the position of the first match, or -1 if there was no |
3586 | match. | 3601 | match. |
3587 | 3602 | ||
3588 | The \a caretMode parameter can be used to instruct whether <b>^</b> | 3603 | The \a caretMode parameter can be used to instruct whether <b>^</b> |
3589 | should match at index 0 or at \a offset. | 3604 | should match at index 0 or at \a offset. |
3590 | 3605 | ||
@@ -3612,39 +3627,32 @@ int QRegExp::search( const QString& str, int offset ) const | |||
3612 | */ | 3627 | */ |
3613 | 3628 | ||
3614 | int QRegExp::search( const QString& str, int offset, CaretMode caretMode ) const | 3629 | int QRegExp::search( const QString& str, int offset, CaretMode caretMode ) const |
3615 | { | 3630 | { |
3616 | if ( offset < 0 ) | 3631 | if ( offset < 0 ) |
3617 | offset += str.length(); | 3632 | offset += str.length(); |
3618 | #ifndef QT_NO_REGEXP_CAPTURE | 3633 | #ifndef QT_NO_REGEXP_CAPTURE |
3619 | priv->t = str; | 3634 | priv->t = str; |
3620 | priv->capturedCache.clear(); | 3635 | priv->capturedCache.clear(); |
3621 | #endif | 3636 | #endif |
3622 | priv->captured = eng->match( str, offset, priv->min, FALSE, | 3637 | priv->captured = eng->match( str, offset, priv->min, FALSE, |
3623 | caretIndex(offset, caretMode) ); | 3638 | caretIndex(offset, caretMode) ); |
3624 | return priv->captured[0]; | 3639 | return priv->captured[0]; |
3625 | } | 3640 | } |
3626 | 3641 | ||
3627 | 3642 | ||
3628 | /*! | ||
3629 | \overload | ||
3630 | |||
3631 | This convenience function searches with a \c CaretMode of \c | ||
3632 | CaretAtZero which is the most common usage. | ||
3633 | */ | ||
3634 | |||
3635 | int QRegExp::searchRev( const QString& str, int offset ) const | 3643 | int QRegExp::searchRev( const QString& str, int offset ) const |
3636 | { | 3644 | { |
3637 | return searchRev( str, offset, CaretAtZero ); | 3645 | return searchRev( str, offset, CaretAtZero ); |
3638 | } | 3646 | } |
3639 | 3647 | ||
3640 | /*! | 3648 | /*! |
3641 | Attempts to find a match backwards in \a str from position \a | 3649 | Attempts to find a match backwards in \a str from position \a |
3642 | offset. If \a offset is -1 (the default), the search starts at the | 3650 | offset. If \a offset is -1 (the default), the search starts at the |
3643 | last character; if -2, at the next to last character; etc. | 3651 | last character; if -2, at the next to last character; etc. |
3644 | 3652 | ||
3645 | Returns the position of the first match, or -1 if there was no | 3653 | Returns the position of the first match, or -1 if there was no |
3646 | match. | 3654 | match. |
3647 | 3655 | ||
3648 | The \a caretMode parameter can be used to instruct whether <b>^</b> | 3656 | The \a caretMode parameter can be used to instruct whether <b>^</b> |
3649 | should match at index 0 or at \a offset. | 3657 | should match at index 0 or at \a offset. |
3650 | 3658 | ||
@@ -3681,33 +3689,33 @@ int QRegExp::searchRev( const QString& str, int offset, | |||
3681 | } | 3689 | } |
3682 | return -1; | 3690 | return -1; |
3683 | } | 3691 | } |
3684 | 3692 | ||
3685 | /*! | 3693 | /*! |
3686 | Returns the length of the last matched string, or -1 if there was | 3694 | Returns the length of the last matched string, or -1 if there was |
3687 | no match. | 3695 | no match. |
3688 | 3696 | ||
3689 | \sa exactMatch() search() searchRev() | 3697 | \sa exactMatch() search() searchRev() |
3690 | */ | 3698 | */ |
3691 | int QRegExp::matchedLength() const | 3699 | int QRegExp::matchedLength() const |
3692 | { | 3700 | { |
3693 | return priv->captured[1]; | 3701 | return priv->captured[1]; |
3694 | } | 3702 | } |
3695 | 3703 | ||
3696 | #ifndef QT_NO_REGEXP_CAPTURE | 3704 | #ifndef QT_NO_REGEXP_CAPTURE |
3697 | /*! | 3705 | /*! |
3698 | Returns the number of captures contained in the regular expression. | 3706 | Returns the number of captures contained in the regular expression. |
3699 | */ | 3707 | */ |
3700 | int QRegExp::numCaptures() const | 3708 | int QRegExp::numCaptures() const |
3701 | { | 3709 | { |
3702 | return eng->numCaptures(); | 3710 | return eng->numCaptures(); |
3703 | } | 3711 | } |
3704 | 3712 | ||
3705 | 3713 | ||
3706 | 3714 | ||
3707 | /*! | 3715 | /*! |
3708 | Returns a list of the captured text strings. | 3716 | Returns a list of the captured text strings. |
3709 | 3717 | ||
3710 | The first string in the list is the entire matched string. Each | 3718 | The first string in the list is the entire matched string. Each |
3711 | subsequent list element contains a string that matched a | 3719 | subsequent list element contains a string that matched a |
3712 | (capturing) subexpression of the regexp. | 3720 | (capturing) subexpression of the regexp. |
3713 | 3721 | ||
diff --git a/qmake/tools/qsemaphore_unix.cpp b/qmake/tools/qsemaphore_unix.cpp index fcf28da..4516049 100644 --- a/qmake/tools/qsemaphore_unix.cpp +++ b/qmake/tools/qsemaphore_unix.cpp | |||
@@ -170,70 +170,68 @@ int QSemaphore::operator--(int) | |||
170 | 170 | ||
171 | return ret; | 171 | return ret; |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | /*! | 175 | /*! |
176 | Try to get access to the semaphore. If \l available() \< \a n, this | 176 | Try to get access to the semaphore. If \l available() \< \a n, this |
177 | call will block until it can get all the accesses it wants, i.e. | 177 | call will block until it can get all the accesses it wants, i.e. |
178 | until available() \>= \a n. | 178 | until available() \>= \a n. |
179 | */ | 179 | */ |
180 | int QSemaphore::operator+=(int n) | 180 | int QSemaphore::operator+=(int n) |
181 | { | 181 | { |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | d->mutex.lock(); | 184 | d->mutex.lock(); |
185 | 185 | ||
186 | if ( n < 0 || n > d->max ) { | ||
187 | #ifdef QT_CHECK_RANGE | ||
188 | qWarning( "QSemaphore::operator+=: paramter %d out of range", n ); | ||
189 | #endif // QT_CHECK_RANGE | ||
190 | n = n < 0 ? 0 : d->max; | ||
191 | } | ||
192 | |||
186 | while (d->value + n > d->max) | 193 | while (d->value + n > d->max) |
187 | d->cond.wait(&(d->mutex)); | 194 | d->cond.wait(&(d->mutex)); |
188 | 195 | ||
189 | d->value += n; | 196 | d->value += n; |
190 | |||
191 | #ifdef QT_CHECK_RANGE | ||
192 | if (d->value > d->max) { | ||
193 | qWarning("QSemaphore::operator+=: attempt to allocate more resources than available"); | ||
194 | d->value = d->max; | ||
195 | } | ||
196 | #endif | ||
197 | |||
198 | ret = d->value; | 197 | ret = d->value; |
199 | 198 | ||
200 | d->mutex.unlock(); | 199 | d->mutex.unlock(); |
201 | 200 | ||
202 | return ret; | 201 | return ret; |
203 | } | 202 | } |
204 | 203 | ||
205 | 204 | ||
206 | /*! | 205 | /*! |
207 | Release \a n accesses to the semaphore. | 206 | Release \a n accesses to the semaphore. |
208 | */ | 207 | */ |
209 | int QSemaphore::operator-=(int n) | 208 | int QSemaphore::operator-=(int n) |
210 | { | 209 | { |
211 | int ret; | 210 | int ret; |
212 | 211 | ||
213 | d->mutex.lock(); | 212 | d->mutex.lock(); |
214 | 213 | ||
215 | d->value -= n; | 214 | if ( n < 0 || n > d->value ) { |
216 | |||
217 | #ifdef QT_CHECK_RANGE | 215 | #ifdef QT_CHECK_RANGE |
218 | if (d->value < 0) { | 216 | qWarning( "QSemaphore::operator-=: paramter %d out of range", n ); |
219 | qWarning("QSemaphore::operator-=: attempt to deallocate more resources than taken"); | 217 | #endif // QT_CHECK_RANGE |
220 | d->value = 0; | 218 | n = n < 0 ? 0 : d->value; |
221 | } | 219 | } |
222 | #endif | ||
223 | 220 | ||
221 | d->value -= n; | ||
224 | ret = d->value; | 222 | ret = d->value; |
225 | 223 | ||
226 | d->cond.wakeOne(); | 224 | d->cond.wakeOne(); |
227 | d->mutex.unlock(); | 225 | d->mutex.unlock(); |
228 | 226 | ||
229 | return ret; | 227 | return ret; |
230 | } | 228 | } |
231 | 229 | ||
232 | 230 | ||
233 | /*! | 231 | /*! |
234 | Returns the number of accesses currently available to the | 232 | Returns the number of accesses currently available to the |
235 | semaphore. | 233 | semaphore. |
236 | */ | 234 | */ |
237 | int QSemaphore::available() const { | 235 | int QSemaphore::available() const { |
238 | int ret; | 236 | int ret; |
239 | 237 | ||
diff --git a/qmake/tools/qsettings.cpp b/qmake/tools/qsettings.cpp index 5de105c..35fc039 100644 --- a/qmake/tools/qsettings.cpp +++ b/qmake/tools/qsettings.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QSettings class | 4 | ** Implementation of QSettings class |
5 | ** | 5 | ** |
6 | ** Created: 2000.06.26 | 6 | ** Created : 000626 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
@@ -50,122 +50,151 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode ) | |||
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #include "qsettings.h" | 52 | #include "qsettings.h" |
53 | 53 | ||
54 | #ifndef QT_NO_SETTINGS | 54 | #ifndef QT_NO_SETTINGS |
55 | 55 | ||
56 | #include "qdir.h" | 56 | #include "qdir.h" |
57 | #include "qfile.h" | 57 | #include "qfile.h" |
58 | #include "qfileinfo.h" | 58 | #include "qfileinfo.h" |
59 | #include "qmap.h" | 59 | #include "qmap.h" |
60 | #include "qtextstream.h" | 60 | #include "qtextstream.h" |
61 | #include "qregexp.h" | 61 | #include "qregexp.h" |
62 | #include <private/qsettings_p.h> | 62 | #include <private/qsettings_p.h> |
63 | #include <errno.h> | 63 | #include <errno.h> |
64 | 64 | ||
65 | /*! | 65 | /*! |
66 | \class QSettings | 66 | \class QSettings |
67 | \brief The QSettings class provides persistent platform-independent application settings. | 67 | \brief The QSettings class provides persistent platform-independent application settings. |
68 | 68 | ||
69 | \ingroup io | 69 | \ingroup io |
70 | \ingroup misc | 70 | \ingroup misc |
71 | \mainclass | 71 | \mainclass |
72 | 72 | ||
73 | On Unix systems, QSettings uses text files to store settings. On Windows | 73 | On Unix systems, QSettings uses text files to store settings. On Windows |
74 | systems, QSettings uses the system registry. On Mac OS X, QSettings will | 74 | systems, QSettings uses the system registry. On Mac OS X, QSettings uses |
75 | behave as on Unix, and store to text files. | 75 | the Carbon preferences API. |
76 | 76 | ||
77 | Each setting comprises an identifying key and the data associated with | 77 | Each setting comprises an identifying key and the data associated with |
78 | the key. A key is a unicode string which consists of \e two or more | 78 | the key. A key is a unicode string which consists of \e two or more |
79 | subkeys. A subkey is a slash, '/', followed by one or more unicode | 79 | subkeys. A subkey is a slash, '/', followed by one or more unicode |
80 | characters (excluding slashes, newlines, carriage returns and equals, | 80 | characters (excluding slashes, newlines, carriage returns and equals, |
81 | '=', signs). The associated data, called the entry or value, may be a | 81 | '=', signs). The associated data, called the entry or value, may be a |
82 | boolean, an integer, a double, a string or a list of strings. Entry | 82 | boolean, an integer, a double, a string or a list of strings. Entry |
83 | strings may contain any unicode characters. | 83 | strings may contain any unicode characters. |
84 | 84 | ||
85 | If you want to save and restore the entire desktop's settings, i.e. | 85 | If you want to save and restore the entire desktop's settings, i.e. |
86 | which applications are running, use QSettings to save the settings | 86 | which applications are running, use QSettings to save the settings |
87 | for each individual application and QSessionManager to save the | 87 | for each individual application and QSessionManager to save the |
88 | desktop's session. | 88 | desktop's session. |
89 | 89 | ||
90 | Example settings: | 90 | Example settings: |
91 | \code | 91 | \code |
92 | /MyCompany/MyApplication/background color | 92 | /MyCompany/MyApplication/background color |
93 | /MyCompany/MyApplication/foreground color | 93 | /MyCompany/MyApplication/foreground color |
94 | /MyCompany/MyApplication/geometry/x | 94 | /MyCompany/MyApplication/geometry/x |
95 | /MyCompany/MyApplication/geometry/y | 95 | /MyCompany/MyApplication/geometry/y |
96 | /MyCompany/MyApplication/geometry/width | 96 | /MyCompany/MyApplication/geometry/width |
97 | /MyCompany/MyApplication/geometry/height | 97 | /MyCompany/MyApplication/geometry/height |
98 | /MyCompany/MyApplication/recent files/1 | 98 | /MyCompany/MyApplication/recent files/1 |
99 | /MyCompany/MyApplication/recent files/2 | 99 | /MyCompany/MyApplication/recent files/2 |
100 | /MyCompany/MyApplication/recent files/3 | 100 | /MyCompany/MyApplication/recent files/3 |
101 | \endcode | 101 | \endcode |
102 | Each line above is a complete key, made up of subkeys. | 102 | Each line above is a complete key, made up of subkeys. |
103 | 103 | ||
104 | A typical usage pattern for application startup: | 104 | A typical usage pattern for reading application startup: |
105 | \code | 105 | \code |
106 | QSettings settings; | 106 | QSettings settings; |
107 | settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); | 107 | settings.setPath( "MyCompany.com", "MyApplication" ); |
108 | // No search path needed for Unix; see notes further on. | 108 | |
109 | // Use default values if the keys don't exist | 109 | QString bgColor = settings.readEntry( "/colors/background", "white" ); |
110 | QString bgColor = settings.readEntry( "/MyApplication/background color", "white" ); | 110 | int width = settings.readNumEntry( "/geometry/width", 640 ); |
111 | int width = settings.readNumEntry( "/MyApplication/geometry/width", 640 ); | ||
112 | // ... | 111 | // ... |
113 | \endcode | 112 | \endcode |
114 | 113 | ||
115 | A typical usage pattern for application exit or 'save preferences': | 114 | A typical usage pattern for application exit or 'save preferences': |
116 | \code | 115 | \code |
117 | QSettings settings; | 116 | QSettings settings; |
118 | settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); | 117 | settings.setPath( "MyCompany.com", "MyApplication" ); |
119 | // No search path needed for Unix; see notes further on. | 118 | |
120 | settings.writeEntry( "/MyApplication/background color", bgColor ); | 119 | settings.writeEntry( "/colors/background", bgColor ); |
121 | settings.writeEntry( "/MyApplication/geometry/width", width ); | 120 | settings.writeEntry( "/geometry/width", width ); |
122 | // ... | 121 | // ... |
123 | \endcode | 122 | \endcode |
124 | 123 | ||
124 | QSettings can build a key prefix that is prepended to all keys. To | ||
125 | build the key prefix, use beginGroup() and endGroup(). | ||
126 | \code | ||
127 | QSettings settings; | ||
128 | |||
129 | settings.beginGroup( "/MainWindow" ); | ||
130 | settings.beginGroup( "/Geometry" ); | ||
131 | int x = settings.readEntry( "/x" ); | ||
132 | // ... | ||
133 | settings.endGroup(); | ||
134 | settings.beginGroup( "/Toolbars" ); | ||
135 | // ... | ||
136 | settings.endGroup(); | ||
137 | settings.endGroup(); | ||
138 | \endcode | ||
139 | |||
125 | You can get a list of entry-holding keys by calling entryList(), and | 140 | You can get a list of entry-holding keys by calling entryList(), and |
126 | a list of key-holding keys using subkeyList(). | 141 | a list of key-holding keys using subkeyList(). |
127 | 142 | ||
128 | \code | 143 | \code |
129 | QStringList keys = entryList( "/MyApplication" ); | 144 | QStringList keys = entryList( "/MyApplication" ); |
130 | // keys contains 'background color' and 'foreground color'. | 145 | // keys contains 'background color' and 'foreground color'. |
131 | 146 | ||
132 | QStringList keys = entryList( "/MyApplication/recent files" ); | 147 | QStringList keys = entryList( "/MyApplication/recent files" ); |
133 | // keys contains '1', '2' and '3'. | 148 | // keys contains '1', '2' and '3'. |
134 | 149 | ||
135 | QStringList subkeys = subkeyList( "/MyApplication" ); | 150 | QStringList subkeys = subkeyList( "/MyApplication" ); |
136 | // subkeys contains 'geometry' and 'recent files' | 151 | // subkeys contains 'geometry' and 'recent files' |
137 | 152 | ||
138 | QStringList subkeys = subkeyList( "/MyApplication/recent files" ); | 153 | QStringList subkeys = subkeyList( "/MyApplication/recent files" ); |
139 | // subkeys is empty. | 154 | // subkeys is empty. |
140 | \endcode | 155 | \endcode |
141 | 156 | ||
142 | If you wish to use a different search path call insertSearchPath() | ||
143 | as often as necessary to add your preferred paths. Call | ||
144 | removeSearchPath() to remove any unwanted paths. | ||
145 | |||
146 | Since settings for Windows are stored in the registry there are size | 157 | Since settings for Windows are stored in the registry there are size |
147 | limits as follows: | 158 | limits as follows: |
148 | \list | 159 | \list |
149 | \i A subkey may not exceed 255 characters. | 160 | \i A subkey may not exceed 255 characters. |
150 | \i An entry's value may not exceed 16,300 characters. | 161 | \i An entry's value may not exceed 16,300 characters. |
151 | \i All the values of a key (for example, all the 'recent files' | 162 | \i All the values of a key (for example, all the 'recent files' |
152 | subkeys values), may not exceed 65,535 characters. | 163 | subkeys values), may not exceed 65,535 characters. |
153 | \endlist | 164 | \endlist |
154 | 165 | ||
155 | These limitations are not enforced on Unix. | 166 | These limitations are not enforced on Unix or Mac OS X. |
167 | |||
168 | If you wish to use a different search path call insertSearchPath() | ||
169 | as often as necessary to add your preferred paths. Call | ||
170 | removeSearchPath() to remove any unwanted paths. | ||
171 | |||
172 | \section1 Notes for Mac OS X Applications | ||
173 | |||
174 | Internal to the CFPreferences API it is not defined (for Mac OS 9 | ||
175 | support) where the settings will ultimitely be stored. However, at the | ||
176 | time of this writing the settings will be stored (either on a global or | ||
177 | user basis, preferring locally) into a plist file in | ||
178 | $ROOT/System/Library/Preferences (in XML format). QSettings will create | ||
179 | an appropriate plist file (com.<first group name>.plist) out of the | ||
180 | full path to a key. | ||
181 | |||
182 | For further information on CFPreferences see also | ||
183 | \link http://developer.apple.com/techpubs/macosx/CoreFoundation/PreferenceServices/preferenceservices_carbon.html | ||
184 | Apple's Specifications\endlink | ||
156 | 185 | ||
157 | \section1 Notes for Unix Applications | 186 | \section1 Notes for Unix Applications |
158 | 187 | ||
159 | There is no universally accepted place for storing application | 188 | There is no universally accepted place for storing application |
160 | settings under Unix. In the examples the settings file will be | 189 | settings under Unix. In the examples the settings file will be |
161 | searched for in the following directories: | 190 | searched for in the following directories: |
162 | \list 1 | 191 | \list 1 |
163 | \i INSTALL/etc/settings | 192 | \i INSTALL/etc/settings |
164 | \i /opt/MyCompany/share/etc | 193 | \i /opt/MyCompany/share/etc |
165 | \i /opt/MyCompany/share/MyApplication/etc | 194 | \i /opt/MyCompany/share/MyApplication/etc |
166 | \i $HOME/.qt | 195 | \i $HOME/.qt |
167 | \endlist | 196 | \endlist |
168 | When reading settings the files are searched in the order shown | 197 | When reading settings the files are searched in the order shown |
169 | above, with later settings overriding earlier settings. Files for | 198 | above, with later settings overriding earlier settings. Files for |
170 | which the user doesn't have read permission are ignored. When saving | 199 | which the user doesn't have read permission are ignored. When saving |
171 | settings QSettings works in the order shown above, writing | 200 | settings QSettings works in the order shown above, writing |
@@ -287,46 +316,46 @@ static void closelock( HANDLE fd ) | |||
287 | 316 | ||
288 | static HANDLE openlock( const QString &name, int /*type*/ ) | 317 | static HANDLE openlock( const QString &name, int /*type*/ ) |
289 | { | 318 | { |
290 | if ( !QFile::exists( name ) ) | 319 | if ( !QFile::exists( name ) ) |
291 | return 0; | 320 | return 0; |
292 | 321 | ||
293 | return 0; | 322 | return 0; |
294 | 323 | ||
295 | HANDLE fd = 0; | 324 | HANDLE fd = 0; |
296 | 325 | ||
297 | QT_WA( { | 326 | QT_WA( { |
298 | fd = CreateFileW( (TCHAR*)name.ucs2(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); | 327 | fd = CreateFileW( (TCHAR*)name.ucs2(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); |
299 | } , { | 328 | } , { |
300 | fd = CreateFileA( name.local8Bit(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); | 329 | fd = CreateFileA( name.local8Bit(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); |
301 | } ); | 330 | } ); |
302 | 331 | ||
303 | if ( !LockFile( fd, 0, 0, -1, -1 ) ) { | 332 | if ( !LockFile( fd, 0, 0, (DWORD)-1, (DWORD)-1 ) ) { // ### (DWORD)-1 ??? |
304 | #ifdef QT_CHECK_STATE | 333 | #ifdef QT_CHECK_STATE |
305 | qWarning( "QSettings: openlock failed!" ); | 334 | qWarning( "QSettings: openlock failed!" ); |
306 | #endif | 335 | #endif |
307 | } | 336 | } |
308 | return fd; | 337 | return fd; |
309 | } | 338 | } |
310 | 339 | ||
311 | void closelock( HANDLE fd ) | 340 | static void closelock( HANDLE fd ) |
312 | { | 341 | { |
313 | if ( !fd ) | 342 | if ( !fd ) |
314 | return; | 343 | return; |
315 | 344 | ||
316 | if ( !UnlockFile( fd, 0, 0, -1, -1 ) ) { | 345 | if ( !UnlockFile( fd, 0, 0, (DWORD)-1, (DWORD)-1 ) ) { // ### (DWORD)-1 ??? |
317 | #ifdef QT_CHECK_STATE | 346 | #ifdef QT_CHECK_STATE |
318 | qWarning( "QSettings: closelock failed!"); | 347 | qWarning( "QSettings: closelock failed!"); |
319 | #endif | 348 | #endif |
320 | } | 349 | } |
321 | CloseHandle( fd ); | 350 | CloseHandle( fd ); |
322 | } | 351 | } |
323 | #endif | 352 | #endif |
324 | 353 | ||
325 | 354 | ||
326 | QSettingsGroup::QSettingsGroup() | 355 | QSettingsGroup::QSettingsGroup() |
327 | : modified(FALSE) | 356 | : modified(FALSE) |
328 | { | 357 | { |
329 | } | 358 | } |
330 | 359 | ||
331 | 360 | ||
332 | 361 | ||
@@ -442,35 +471,37 @@ void QSettingsHeading::parseLine(QTextStream &stream) | |||
442 | #ifdef Q_WS_WIN // for homedirpath reading from registry | 471 | #ifdef Q_WS_WIN // for homedirpath reading from registry |
443 | #include "qt_windows.h" | 472 | #include "qt_windows.h" |
444 | #include "qlibrary.h" | 473 | #include "qlibrary.h" |
445 | 474 | ||
446 | #ifndef CSIDL_APPDATA | 475 | #ifndef CSIDL_APPDATA |
447 | #define CSIDL_APPDATA 0x001a // <user name>\Application Data | 476 | #define CSIDL_APPDATA 0x001a // <user name>\Application Data |
448 | #endif | 477 | #endif |
449 | #ifndef CSIDL_COMMON_APPDATA | 478 | #ifndef CSIDL_COMMON_APPDATA |
450 | #define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data | 479 | #define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data |
451 | #endif | 480 | #endif |
452 | 481 | ||
453 | #endif | 482 | #endif |
454 | 483 | ||
455 | QSettingsPrivate::QSettingsPrivate( QSettings::Format format ) | 484 | QSettingsPrivate::QSettingsPrivate( QSettings::Format format ) |
456 | : groupDirty( TRUE ), modified(FALSE), globalScope(TRUE) | 485 | : groupDirty( TRUE ), modified(FALSE), globalScope(TRUE) |
457 | { | 486 | { |
458 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 487 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
459 | if ( format != QSettings::Ini ) | 488 | if ( format != QSettings::Ini ) |
460 | return; | 489 | return; |
490 | #else | ||
491 | Q_UNUSED( format ); | ||
461 | #endif | 492 | #endif |
462 | 493 | ||
463 | QString appSettings(QDir::homeDirPath() + "/.qt/"); | 494 | QString appSettings(QDir::homeDirPath() + "/.qt/"); |
464 | QString defPath; | 495 | QString defPath; |
465 | #ifdef Q_WS_WIN | 496 | #ifdef Q_WS_WIN |
466 | #ifdef Q_OS_TEMP | 497 | #ifdef Q_OS_TEMP |
467 | TCHAR path[MAX_PATH]; | 498 | TCHAR path[MAX_PATH]; |
468 | SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, FALSE ); | 499 | SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, FALSE ); |
469 | appSettings = QString::fromUcs2( path ); | 500 | appSettings = QString::fromUcs2( path ); |
470 | SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, FALSE ); | 501 | SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, FALSE ); |
471 | defPath = QString::fromUcs2( path ); | 502 | defPath = QString::fromUcs2( path ); |
472 | #else | 503 | #else |
473 | QLibrary library( "shell32" ); | 504 | QLibrary library( "shell32" ); |
474 | library.setAutoUnload( FALSE ); | 505 | library.setAutoUnload( FALSE ); |
475 | QT_WA( { | 506 | QT_WA( { |
476 | typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); | 507 | typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); |
@@ -493,56 +524,60 @@ QSettingsPrivate::QSettingsPrivate( QSettings::Format format ) | |||
493 | defPath = QString::fromLocal8Bit( path ); | 524 | defPath = QString::fromLocal8Bit( path ); |
494 | } | 525 | } |
495 | } ); | 526 | } ); |
496 | #endif // Q_OS_TEMP | 527 | #endif // Q_OS_TEMP |
497 | #else | 528 | #else |
498 | // for now | 529 | // for now |
499 | #define QSETTINGS_DEFAULT_PATH_SUFFIX "/etc/settings" | 530 | #define QSETTINGS_DEFAULT_PATH_SUFFIX "/etc/settings" |
500 | 531 | ||
501 | defPath = qInstallPath(); | 532 | defPath = qInstallPath(); |
502 | defPath += QSETTINGS_DEFAULT_PATH_SUFFIX; | 533 | defPath += QSETTINGS_DEFAULT_PATH_SUFFIX; |
503 | #endif | 534 | #endif |
504 | QDir dir(appSettings); | 535 | QDir dir(appSettings); |
505 | if (! dir.exists()) { | 536 | if (! dir.exists()) { |
506 | if (! dir.mkdir(dir.path())) | 537 | if (! dir.mkdir(dir.path())) |
507 | #if defined(QT_CHECK_STATE) | 538 | #if defined(QT_CHECK_STATE) |
508 | qWarning("QSettings: error creating %s", dir.path().latin1()); | 539 | qWarning("QSettings: error creating %s", dir.path().latin1()); |
540 | #else | ||
541 | ; | ||
509 | #endif | 542 | #endif |
510 | } | 543 | } |
511 | 544 | ||
512 | if ( !!defPath ) | 545 | if ( !!defPath ) |
513 | searchPaths.append(defPath); | 546 | searchPaths.append(defPath); |
514 | searchPaths.append(dir.path()); | 547 | searchPaths.append(dir.path()); |
515 | } | 548 | } |
516 | 549 | ||
517 | QSettingsPrivate::~QSettingsPrivate() | 550 | QSettingsPrivate::~QSettingsPrivate() |
518 | { | 551 | { |
519 | } | 552 | } |
520 | 553 | ||
521 | QSettingsGroup QSettingsPrivate::readGroup() | 554 | QSettingsGroup QSettingsPrivate::readGroup() |
522 | { | 555 | { |
523 | QSettingsHeading hd; | 556 | QSettingsHeading hd; |
524 | QSettingsGroup grp; | 557 | QSettingsGroup grp; |
525 | 558 | ||
526 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); | 559 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); |
527 | if (headingsit != headings.end()) | 560 | if (headingsit != headings.end()) |
528 | hd = *headingsit; | 561 | hd = *headingsit; |
529 | 562 | ||
530 | QSettingsHeading::Iterator grpit = hd.find(group); | 563 | QSettingsHeading::Iterator grpit = hd.find(group); |
531 | if (grpit == hd.end()) { | 564 | if (grpit == hd.end()) { |
532 | QStringList::Iterator it = searchPaths.begin(); | 565 | QStringList::Iterator it = searchPaths.begin(); |
566 | if ( !globalScope ) | ||
567 | ++it; | ||
533 | while (it != searchPaths.end()) { | 568 | while (it != searchPaths.end()) { |
534 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); | 569 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); |
535 | QString fn((*it++) + "/" + filebase + "rc"); | 570 | QString fn((*it++) + "/" + filebase + "rc"); |
536 | if (! hd.contains(fn + "cached")) { | 571 | if (! hd.contains(fn + "cached")) { |
537 | hd.read(fn); | 572 | hd.read(fn); |
538 | hd.insert(fn + "cached", QSettingsGroup()); | 573 | hd.insert(fn + "cached", QSettingsGroup()); |
539 | } | 574 | } |
540 | } | 575 | } |
541 | 576 | ||
542 | headings.replace(heading, hd); | 577 | headings.replace(heading, hd); |
543 | 578 | ||
544 | grpit = hd.find(group); | 579 | grpit = hd.find(group); |
545 | if (grpit != hd.end()) | 580 | if (grpit != hd.end()) |
546 | grp = *grpit; | 581 | grp = *grpit; |
547 | } else if (hd.count() != 0) | 582 | } else if (hd.count() != 0) |
548 | grp = *grpit; | 583 | grp = *grpit; |
@@ -551,32 +586,34 @@ QSettingsGroup QSettingsPrivate::readGroup() | |||
551 | } | 586 | } |
552 | 587 | ||
553 | 588 | ||
554 | void QSettingsPrivate::removeGroup(const QString &key) | 589 | void QSettingsPrivate::removeGroup(const QString &key) |
555 | { | 590 | { |
556 | QSettingsHeading hd; | 591 | QSettingsHeading hd; |
557 | QSettingsGroup grp; | 592 | QSettingsGroup grp; |
558 | bool found = FALSE; | 593 | bool found = FALSE; |
559 | 594 | ||
560 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); | 595 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); |
561 | if (headingsit != headings.end()) | 596 | if (headingsit != headings.end()) |
562 | hd = *headingsit; | 597 | hd = *headingsit; |
563 | 598 | ||
564 | QSettingsHeading::Iterator grpit = hd.find(group); | 599 | QSettingsHeading::Iterator grpit = hd.find(group); |
565 | if (grpit == hd.end()) { | 600 | if (grpit == hd.end()) { |
566 | QStringList::Iterator it = searchPaths.begin(); | 601 | QStringList::Iterator it = searchPaths.begin(); |
602 | if ( !globalScope ) | ||
603 | ++it; | ||
567 | while (it != searchPaths.end()) { | 604 | while (it != searchPaths.end()) { |
568 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); | 605 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); |
569 | QString fn((*it++) + "/" + filebase + "rc"); | 606 | QString fn((*it++) + "/" + filebase + "rc"); |
570 | if (! hd.contains(fn + "cached")) { | 607 | if (! hd.contains(fn + "cached")) { |
571 | hd.read(fn); | 608 | hd.read(fn); |
572 | hd.insert(fn + "cached", QSettingsGroup()); | 609 | hd.insert(fn + "cached", QSettingsGroup()); |
573 | } | 610 | } |
574 | } | 611 | } |
575 | 612 | ||
576 | headings.replace(heading, hd); | 613 | headings.replace(heading, hd); |
577 | 614 | ||
578 | grpit = hd.find(group); | 615 | grpit = hd.find(group); |
579 | if (grpit != hd.end()) { | 616 | if (grpit != hd.end()) { |
580 | found = TRUE; | 617 | found = TRUE; |
581 | grp = *grpit; | 618 | grp = *grpit; |
582 | } | 619 | } |
@@ -602,32 +639,34 @@ void QSettingsPrivate::removeGroup(const QString &key) | |||
602 | } | 639 | } |
603 | } | 640 | } |
604 | 641 | ||
605 | 642 | ||
606 | void QSettingsPrivate::writeGroup(const QString &key, const QString &value) | 643 | void QSettingsPrivate::writeGroup(const QString &key, const QString &value) |
607 | { | 644 | { |
608 | QSettingsHeading hd; | 645 | QSettingsHeading hd; |
609 | QSettingsGroup grp; | 646 | QSettingsGroup grp; |
610 | 647 | ||
611 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); | 648 | QMap<QString,QSettingsHeading>::Iterator headingsit = headings.find(heading); |
612 | if (headingsit != headings.end()) | 649 | if (headingsit != headings.end()) |
613 | hd = *headingsit; | 650 | hd = *headingsit; |
614 | 651 | ||
615 | QSettingsHeading::Iterator grpit = hd.find(group); | 652 | QSettingsHeading::Iterator grpit = hd.find(group); |
616 | if (grpit == hd.end()) { | 653 | if (grpit == hd.end()) { |
617 | QStringList::Iterator it = searchPaths.begin(); | 654 | QStringList::Iterator it = searchPaths.begin(); |
655 | if ( !globalScope ) | ||
656 | ++it; | ||
618 | while (it != searchPaths.end()) { | 657 | while (it != searchPaths.end()) { |
619 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); | 658 | QString filebase = heading.lower().replace(QRegExp("\\s+"), "_"); |
620 | QString fn((*it++) + "/" + filebase + "rc"); | 659 | QString fn((*it++) + "/" + filebase + "rc"); |
621 | if (! hd.contains(fn + "cached")) { | 660 | if (! hd.contains(fn + "cached")) { |
622 | hd.read(fn); | 661 | hd.read(fn); |
623 | hd.insert(fn + "cached", QSettingsGroup()); | 662 | hd.insert(fn + "cached", QSettingsGroup()); |
624 | } | 663 | } |
625 | } | 664 | } |
626 | 665 | ||
627 | headings.replace(heading, hd); | 666 | headings.replace(heading, hd); |
628 | 667 | ||
629 | grpit = hd.find(group); | 668 | grpit = hd.find(group); |
630 | if (grpit != hd.end()) | 669 | if (grpit != hd.end()) |
631 | grp = *grpit; | 670 | grp = *grpit; |
632 | } else if (hd.count() != 0) | 671 | } else if (hd.count() != 0) |
633 | grp = *grpit; | 672 | grp = *grpit; |
@@ -636,94 +675,102 @@ void QSettingsPrivate::writeGroup(const QString &key, const QString &value) | |||
636 | grp.replace(key, value); | 675 | grp.replace(key, value); |
637 | hd.replace(group, grp); | 676 | hd.replace(group, grp); |
638 | headings.replace(heading, hd); | 677 | headings.replace(heading, hd); |
639 | 678 | ||
640 | modified = TRUE; | 679 | modified = TRUE; |
641 | } | 680 | } |
642 | 681 | ||
643 | 682 | ||
644 | QDateTime QSettingsPrivate::modificationTime() | 683 | QDateTime QSettingsPrivate::modificationTime() |
645 | { | 684 | { |
646 | QSettingsHeading hd = headings[heading]; | 685 | QSettingsHeading hd = headings[heading]; |
647 | QSettingsGroup grp = hd[group]; | 686 | QSettingsGroup grp = hd[group]; |
648 | 687 | ||
649 | QDateTime datetime; | 688 | QDateTime datetime; |
650 | 689 | ||
651 | QStringList::Iterator it = searchPaths.begin(); | 690 | QStringList::Iterator it = searchPaths.begin(); |
691 | if ( !globalScope ) | ||
692 | ++it; | ||
652 | while (it != searchPaths.end()) { | 693 | while (it != searchPaths.end()) { |
653 | QFileInfo fi((*it++) + "/" + heading + "rc"); | 694 | QFileInfo fi((*it++) + "/" + heading + "rc"); |
654 | if (fi.exists() && fi.lastModified() > datetime) | 695 | if (fi.exists() && fi.lastModified() > datetime) |
655 | datetime = fi.lastModified(); | 696 | datetime = fi.lastModified(); |
656 | } | 697 | } |
657 | 698 | ||
658 | return datetime; | 699 | return datetime; |
659 | } | 700 | } |
660 | 701 | ||
661 | static bool verifyKey( const QString &key ) | 702 | bool qt_verify_key( const QString &key ) |
662 | { | 703 | { |
663 | if ( key.isEmpty() || key[0] != '/' || key.contains( QRegExp("[=\\\\r\\\\n" ) ) ) | 704 | if ( key.isEmpty() || key[0] != '/' || key.contains( QRegExp("[=\\\\r\\\\n" ) ) ) |
664 | return FALSE; | 705 | return FALSE; |
665 | return TRUE; | 706 | return TRUE; |
666 | } | 707 | } |
667 | 708 | ||
668 | static inline QString groupKey( const QString &group, const QString &key ) | 709 | static inline QString groupKey( const QString &group, const QString &key ) |
669 | { | 710 | { |
670 | if ( group.endsWith( "/" ) || key.startsWith( "/" ) ) | 711 | if ( group.isEmpty() || ( group.length() == 1 && group[0] == '/' ) ) { |
712 | // group is empty, or it contains a single '/', so we just return the key | ||
713 | if ( key.startsWith( "/" ) ) | ||
714 | return key; | ||
715 | return "/" + key; | ||
716 | } else if ( group.endsWith( "/" ) || key.startsWith( "/" ) ) { | ||
671 | return group + key; | 717 | return group + key; |
718 | } | ||
672 | return group + "/" + key; | 719 | return group + "/" + key; |
673 | } | 720 | } |
674 | 721 | ||
675 | /*! | 722 | /*! |
676 | Inserts \a path into the settings search path. The semantics of \a | 723 | Inserts \a path into the settings search path. The semantics of \a |
677 | path depends on the system \a s. | 724 | path depends on the system \a s. |
678 | 725 | ||
679 | When \a s is \e Windows and the execution environment is \e not | 726 | When \a s is \e Windows and the execution environment is \e not |
680 | Windows the function does nothing. Similarly when \a s is \e Unix and | 727 | Windows the function does nothing. Similarly when \a s is \e Unix and |
681 | the execution environment is \e not Unix the function does nothing. | 728 | the execution environment is \e not Unix the function does nothing. |
682 | 729 | ||
683 | When \a s is \e Windows, and the execution environment is Windows, the | 730 | When \a s is \e Windows, and the execution environment is Windows, the |
684 | search path list will be used as the first subfolder of the "Software" | 731 | search path list will be used as the first subfolder of the "Software" |
685 | folder in the registry. | 732 | folder in the registry. |
686 | 733 | ||
687 | When reading settings the folders are searched forwards from the | 734 | When reading settings the folders are searched forwards from the |
688 | first folder (listed below) to the last, returning the first | 735 | first folder (listed below) to the last, returning the first |
689 | settings found, and ignoring any folders for which the user doesn't | 736 | settings found, and ignoring any folders for which the user doesn't |
690 | have read permission. | 737 | have read permission. |
691 | \list 1 | 738 | \list 1 |
692 | \i HKEY_CURRENT_USER/Software/MyCompany/MyApplication | 739 | \i HKEY_CURRENT_USER/Software/MyCompany/MyApplication |
693 | \i HKEY_LOCAL_MACHINE/Software/MyCompany/MyApplication | 740 | \i HKEY_LOCAL_MACHINE/Software/MyCompany/MyApplication |
694 | \i HKEY_CURRENT_USER/Software/MyApplication | 741 | \i HKEY_CURRENT_USER/Software/MyApplication |
695 | \i HKEY_LOCAL_MACHINE/Software/MyApplication | 742 | \i HKEY_LOCAL_MACHINE/Software/MyApplication |
696 | \endlist | 743 | \endlist |
697 | 744 | ||
698 | \code | 745 | \code |
699 | QSettings settings; | 746 | QSettings settings; |
700 | settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); | 747 | settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); |
701 | settings.writeEntry( "/MyApplication/Tip of the day", TRUE ); | 748 | settings.writeEntry( "/MyApplication/Tip of the day", TRUE ); |
702 | \endcode | 749 | \endcode |
703 | The code above will write the subkey "Tip of the day" into the \e | 750 | The code above will write the subkey "Tip of the day" into the \e |
704 | first of the registry folders listed below that is found and for | 751 | first of the registry folders listed below that is found and for |
705 | which the user has write permission. | 752 | which the user has write permission. |
706 | \list 1 | 753 | \list 1 |
707 | \i HKEY_LOCAL_MACHINE/Software/MyCompany/MyApplication | 754 | \i HKEY_LOCAL_MACHINE/Software/MyCompany/MyApplication |
708 | \i HKEY_CURRENT_USER/Software/MyCompany/MyApplication | 755 | \i HKEY_CURRENT_USER/Software/MyCompany/MyApplication |
709 | \i HKEY_LOCAL_MACHINE/Software/MyApplication | 756 | \i HKEY_LOCAL_MACHINE/Software/MyApplication |
710 | \i HKEY_CURRENT_USER/Software/MyApplication | 757 | \i HKEY_CURRENT_USER/Software/MyApplication |
711 | \endlist | 758 | \endlist |
712 | If a setting is found in the HKEY_CURRENT_USER space, this setting | 759 | If a setting is found in the HKEY_CURRENT_USER space, this setting |
713 | is overwritten independently of write permissions in the | 760 | is overwritten independently of write permissions in the |
714 | HKEY_LOCAL_MACHINE space. | 761 | HKEY_LOCAL_MACHINE space. |
715 | 762 | ||
716 | When \a s is \e Unix, and the execution environment is Unix, the | 763 | When \a s is \e Unix, and the execution environment is Unix, the |
717 | search path list will be used when trying to determine a suitable | 764 | search path list will be used when trying to determine a suitable |
718 | filename for reading and writing settings files. By default, there are | 765 | filename for reading and writing settings files. By default, there are |
719 | two entries in the search path: | 766 | two entries in the search path: |
720 | 767 | ||
721 | \list 1 | 768 | \list 1 |
722 | \i INSTALL/etc - where \c INSTALL is the directory where Qt was installed. | 769 | \i INSTALL/etc - where \c INSTALL is the directory where Qt was installed. |
723 | \i $HOME/.qt/ - where \c $HOME is the user's home directory. | 770 | \i $HOME/.qt/ - where \c $HOME is the user's home directory. |
724 | \endlist | 771 | \endlist |
725 | 772 | ||
726 | All insertions into the search path will go before $HOME/.qt/. | 773 | All insertions into the search path will go before $HOME/.qt/. |
727 | For example: | 774 | For example: |
728 | \code | 775 | \code |
729 | QSettings settings; | 776 | QSettings settings; |
@@ -744,195 +791,212 @@ static inline QString groupKey( const QString &group, const QString &key ) | |||
744 | settings QSettings works in the order shown above, writing | 791 | settings QSettings works in the order shown above, writing |
745 | to the first settings file for which the user has write permission. | 792 | to the first settings file for which the user has write permission. |
746 | 793 | ||
747 | Settings under Unix are stored in files whose names are based on the | 794 | Settings under Unix are stored in files whose names are based on the |
748 | first subkey of the key (not including the search path). The algorithm | 795 | first subkey of the key (not including the search path). The algorithm |
749 | for creating names is essentially: lowercase the first subkey, replace | 796 | for creating names is essentially: lowercase the first subkey, replace |
750 | spaces with underscores and add 'rc', e.g. | 797 | spaces with underscores and add 'rc', e.g. |
751 | <tt>/MyCompany/MyApplication/background color</tt> will be stored in | 798 | <tt>/MyCompany/MyApplication/background color</tt> will be stored in |
752 | <tt>myapplicationrc</tt> (assuming that <tt>/MyCompany</tt> is part of | 799 | <tt>myapplicationrc</tt> (assuming that <tt>/MyCompany</tt> is part of |
753 | the search path). | 800 | the search path). |
754 | 801 | ||
755 | \sa removeSearchPath() | 802 | \sa removeSearchPath() |
756 | 803 | ||
757 | */ | 804 | */ |
758 | void QSettings::insertSearchPath( System s, const QString &path) | 805 | void QSettings::insertSearchPath( System s, const QString &path) |
759 | { | 806 | { |
760 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 807 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
761 | if ( d->sysd ) { | 808 | if ( d->sysd ) { |
762 | d->sysInsertSearchPath( s, path ); | 809 | d->sysInsertSearchPath( s, path ); |
763 | return; | 810 | return; |
764 | } | 811 | } |
765 | #endif | 812 | #endif |
766 | 813 | ||
767 | if ( !verifyKey( path ) ) { | 814 | #if !defined(Q_WS_WIN) |
815 | if ( s == Windows ) | ||
816 | return; | ||
817 | #endif | ||
818 | #if !defined(Q_WS_WIN) | ||
819 | if ( s == Mac ) | ||
820 | return; | ||
821 | #endif | ||
822 | |||
823 | if ( !qt_verify_key( path ) ) { | ||
768 | #if defined(QT_CHECK_STATE) | 824 | #if defined(QT_CHECK_STATE) |
769 | qWarning( "QSettings::insertSearchPath: Invalid key: '%s'", path.isNull() ? "(null)" : path.latin1() ); | 825 | qWarning( "QSettings::insertSearchPath: Invalid key: '%s'", path.isNull() ? "(null)" : path.latin1() ); |
770 | #endif | 826 | #endif |
771 | return; | 827 | return; |
772 | } | 828 | } |
773 | 829 | ||
774 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 830 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
775 | if ( d->sysd && s != Unix ) { | 831 | if ( d->sysd && s != Unix ) { |
776 | #else | 832 | #else |
777 | if ( s != Unix ) { | 833 | if ( s != Unix ) { |
778 | #endif | 834 | #endif |
779 | #ifdef Q_OS_MAC | 835 | #if !defined(QWS) && defined(Q_OS_MAC) |
780 | if(s != Mac) //mac is respected on the mac as well | 836 | if(s != Mac) //mac is respected on the mac as well |
781 | #endif | 837 | #endif |
782 | return; | 838 | return; |
783 | } | 839 | } |
784 | 840 | ||
841 | QString realPath = path; | ||
842 | #if defined(Q_WS_WIN) | ||
843 | QString defPath = d->globalScope ? d->searchPaths.first() : d->searchPaths.last(); | ||
844 | realPath = defPath + path; | ||
845 | #endif | ||
846 | |||
785 | QStringList::Iterator it = d->searchPaths.find(d->searchPaths.last()); | 847 | QStringList::Iterator it = d->searchPaths.find(d->searchPaths.last()); |
786 | if (it != d->searchPaths.end()) { | 848 | if (it != d->searchPaths.end()) { |
787 | d->searchPaths.insert(it, path); | 849 | d->searchPaths.insert(it, realPath); |
788 | } | 850 | } |
789 | } | 851 | } |
790 | 852 | ||
791 | 853 | ||
792 | /*! | 854 | /*! |
793 | Removes all occurrences of \a path (using exact matching) from the | 855 | Removes all occurrences of \a path (using exact matching) from the |
794 | settings search path for system \a s. Note that the default search | 856 | settings search path for system \a s. Note that the default search |
795 | paths cannot be removed. | 857 | paths cannot be removed. |
796 | 858 | ||
797 | \sa insertSearchPath() | 859 | \sa insertSearchPath() |
798 | */ | 860 | */ |
799 | void QSettings::removeSearchPath( System s, const QString &path) | 861 | void QSettings::removeSearchPath( System s, const QString &path) |
800 | { | 862 | { |
801 | if ( !verifyKey( path ) ) { | 863 | if ( !qt_verify_key( path ) ) { |
802 | #if defined(QT_CHECK_STATE) | 864 | #if defined(QT_CHECK_STATE) |
803 | qWarning( "QSettings::insertSearchPath: Invalid key: '%s'", path.isNull() ? "(null)" : path.latin1() ); | 865 | qWarning( "QSettings::insertSearchPath: Invalid key: '%s'", path.isNull() ? "(null)" : path.latin1() ); |
804 | #endif | 866 | #endif |
805 | return; | 867 | return; |
806 | } | 868 | } |
807 | 869 | ||
808 | #ifdef Q_WS_WIN | 870 | #ifdef Q_WS_WIN |
809 | if ( d->sysd ) { | 871 | if ( d->sysd ) { |
810 | d->sysRemoveSearchPath( s, path ); | 872 | d->sysRemoveSearchPath( s, path ); |
811 | return; | 873 | return; |
812 | } | 874 | } |
813 | #endif | 875 | #endif |
814 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 876 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
815 | if ( d->sysd && s != Unix ) { | 877 | if ( d->sysd && s != Unix ) { |
816 | #else | 878 | #else |
817 | if ( s != Unix ) { | 879 | if ( s != Unix ) { |
818 | #endif | 880 | #endif |
819 | #ifdef Q_OS_MAC | 881 | #if !defined(QWS) && defined(Q_OS_MAC) |
820 | if(s != Mac) //mac is respected on the mac as well | 882 | if(s != Mac) //mac is respected on the mac as well |
821 | #endif | 883 | #endif |
822 | return; | 884 | return; |
823 | } | 885 | } |
824 | 886 | ||
825 | if (path == d->searchPaths.first() || path == d->searchPaths.last()) | 887 | if (path == d->searchPaths.first() || path == d->searchPaths.last()) |
826 | return; | 888 | return; |
827 | 889 | ||
828 | d->searchPaths.remove(path); | 890 | d->searchPaths.remove(path); |
829 | } | 891 | } |
830 | 892 | ||
831 | 893 | ||
832 | /*! | 894 | /*! |
833 | Creates a settings object. | 895 | Creates a settings object. |
834 | */ | 896 | */ |
835 | QSettings::QSettings() | 897 | QSettings::QSettings() |
836 | { | 898 | { |
837 | d = new QSettingsPrivate( Native ); | 899 | d = new QSettingsPrivate( Native ); |
838 | Q_CHECK_PTR(d); | 900 | Q_CHECK_PTR(d); |
839 | 901 | ||
840 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 902 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
841 | d->sysd = 0; | 903 | d->sysd = 0; |
842 | d->sysInit(); | 904 | d->sysInit(); |
843 | #endif | 905 | #endif |
844 | } | 906 | } |
845 | 907 | ||
846 | /*! | 908 | /*! |
847 | Creates a settings object. If \a format is 'Ini' the settings will | 909 | Creates a settings object. If \a format is 'Ini' the settings will |
848 | be stored in a text file, using the Unix strategy (see above). If \a format | 910 | be stored in a text file, using the Unix strategy (see above). If \a format |
849 | is 'Native', the settings will be stored in a platform specific way | 911 | is 'Native', the settings will be stored in a platform specific way |
850 | (ie. the Windows registry). | 912 | (ie. the Windows registry). |
851 | */ | 913 | */ |
852 | QSettings::QSettings( Format format ) | 914 | QSettings::QSettings( Format format ) |
853 | { | 915 | { |
854 | d = new QSettingsPrivate( format ); | 916 | d = new QSettingsPrivate( format ); |
855 | Q_CHECK_PTR(d); | 917 | Q_CHECK_PTR(d); |
856 | 918 | ||
857 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 919 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
858 | d->sysd = 0; | 920 | d->sysd = 0; |
859 | if ( format == Native ) | 921 | if ( format == Native ) |
860 | d->sysInit(); | 922 | d->sysInit(); |
861 | #else | 923 | #else |
862 | Q_UNUSED(format); | 924 | Q_UNUSED(format); |
863 | #endif | 925 | #endif |
864 | } | 926 | } |
865 | 927 | ||
866 | /*! | 928 | /*! |
867 | Destroys the settings object. All modifications made to the settings | 929 | Destroys the settings object. All modifications made to the settings |
868 | will automatically be saved. | 930 | will automatically be saved. |
869 | 931 | ||
870 | */ | 932 | */ |
871 | QSettings::~QSettings() | 933 | QSettings::~QSettings() |
872 | { | 934 | { |
873 | sync(); | 935 | sync(); |
874 | 936 | ||
875 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 937 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
876 | if ( d->sysd ) | 938 | if ( d->sysd ) |
877 | d->sysClear(); | 939 | d->sysClear(); |
878 | #endif | 940 | #endif |
879 | 941 | ||
880 | delete d; | 942 | delete d; |
881 | } | 943 | } |
882 | 944 | ||
883 | 945 | ||
884 | /*! \internal | 946 | /*! \internal |
885 | Writes all modifications to the settings to disk. If any errors are | 947 | Writes all modifications to the settings to disk. If any errors are |
886 | encountered, this function returns FALSE, otherwise it will return TRUE. | 948 | encountered, this function returns FALSE, otherwise it will return TRUE. |
887 | */ | 949 | */ |
888 | bool QSettings::sync() | 950 | bool QSettings::sync() |
889 | { | 951 | { |
890 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 952 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
891 | if ( d->sysd ) | 953 | if ( d->sysd ) |
892 | return d->sysSync(); | 954 | return d->sysSync(); |
893 | #endif | 955 | #endif |
894 | if (! d->modified) | 956 | if (! d->modified) |
895 | // fake success | 957 | // fake success |
896 | return TRUE; | 958 | return TRUE; |
897 | 959 | ||
898 | bool success = TRUE; | 960 | bool success = TRUE; |
899 | QMap<QString,QSettingsHeading>::Iterator it = d->headings.begin(); | 961 | QMap<QString,QSettingsHeading>::Iterator it = d->headings.begin(); |
900 | 962 | ||
901 | while (it != d->headings.end()) { | 963 | while (it != d->headings.end()) { |
902 | // determine filename | 964 | // determine filename |
903 | QSettingsHeading hd(*it); | 965 | QSettingsHeading hd(*it); |
904 | QSettingsHeading::Iterator hdit = hd.begin(); | 966 | QSettingsHeading::Iterator hdit = hd.begin(); |
905 | QFile file; | 967 | QFile file; |
906 | 968 | ||
907 | QStringList::Iterator pit = d->searchPaths.begin(); | 969 | QStringList::Iterator pit = d->searchPaths.begin(); |
970 | if ( !d->globalScope ) | ||
971 | ++pit; | ||
908 | while (pit != d->searchPaths.end()) { | 972 | while (pit != d->searchPaths.end()) { |
909 | QString filebase = it.key().lower().replace(QRegExp("\\s+"), "_"); | 973 | QString filebase = it.key().lower().replace(QRegExp("\\s+"), "_"); |
910 | QFileInfo di(*pit); | 974 | QFileInfo di(*pit); |
911 | QFileInfo fi((*pit++) + "/" + filebase + "rc"); | 975 | QFileInfo fi((*pit++) + "/" + filebase + "rc"); |
912 | 976 | ||
913 | if ((fi.exists() && fi.isFile() && fi.isWritable()) || | 977 | if ((fi.exists() && fi.isFile() && fi.isWritable()) || |
914 | (! fi.exists() && di.isDir() && di.isWritable())) { | 978 | (! fi.exists() && di.isDir() && di.isWritable())) { |
915 | file.setName(fi.filePath()); | 979 | file.setName(fi.filePath()); |
916 | break; | 980 | break; |
917 | } | 981 | } |
918 | } | 982 | } |
919 | 983 | ||
920 | it++; | 984 | ++it; |
921 | 985 | ||
922 | if (file.name().isNull() || file.name().isEmpty()) { | 986 | if ( file.name().isEmpty() ) { |
923 | 987 | ||
924 | #ifdef QT_CHECK_STATE | 988 | #ifdef QT_CHECK_STATE |
925 | qWarning("QSettings::sync: filename is null/empty"); | 989 | qWarning("QSettings::sync: filename is null/empty"); |
926 | #endif // QT_CHECK_STATE | 990 | #endif // QT_CHECK_STATE |
927 | 991 | ||
928 | success = FALSE; | 992 | success = FALSE; |
929 | continue; | 993 | continue; |
930 | } | 994 | } |
931 | 995 | ||
932 | HANDLE lockfd = openlock( file.name(), Q_LOCKWRITE ); | 996 | HANDLE lockfd = openlock( file.name(), Q_LOCKWRITE ); |
933 | 997 | ||
934 | if (! file.open(IO_WriteOnly)) { | 998 | if (! file.open(IO_WriteOnly)) { |
935 | 999 | ||
936 | #ifdef QT_CHECK_STATE | 1000 | #ifdef QT_CHECK_STATE |
937 | qWarning("QSettings::sync: failed to open '%s' for writing", | 1001 | qWarning("QSettings::sync: failed to open '%s' for writing", |
938 | file.name().latin1()); | 1002 | file.name().latin1()); |
@@ -950,39 +1014,39 @@ bool QSettings::sync() | |||
950 | if ((*hdit).count() > 0) { | 1014 | if ((*hdit).count() > 0) { |
951 | stream << "[" << hdit.key() << "]" << endl; | 1015 | stream << "[" << hdit.key() << "]" << endl; |
952 | 1016 | ||
953 | QSettingsGroup grp(*hdit); | 1017 | QSettingsGroup grp(*hdit); |
954 | QSettingsGroup::Iterator grpit = grp.begin(); | 1018 | QSettingsGroup::Iterator grpit = grp.begin(); |
955 | 1019 | ||
956 | while (grpit != grp.end()) { | 1020 | while (grpit != grp.end()) { |
957 | QString v = grpit.data(); | 1021 | QString v = grpit.data(); |
958 | if ( v.isNull() ) { | 1022 | if ( v.isNull() ) { |
959 | v = "\\0"; // escape null string | 1023 | v = "\\0"; // escape null string |
960 | } else { | 1024 | } else { |
961 | v.replace("\\", "\\\\"); // escape backslash | 1025 | v.replace("\\", "\\\\"); // escape backslash |
962 | v.replace("\n", "\\n"); // escape newlines | 1026 | v.replace("\n", "\\n"); // escape newlines |
963 | } | 1027 | } |
964 | 1028 | ||
965 | stream << grpit.key() << "=" << v << endl; | 1029 | stream << grpit.key() << "=" << v << endl; |
966 | grpit++; | 1030 | ++grpit; |
967 | } | 1031 | } |
968 | 1032 | ||
969 | stream << endl; | 1033 | stream << endl; |
970 | } | 1034 | } |
971 | 1035 | ||
972 | hdit++; | 1036 | ++hdit; |
973 | } | 1037 | } |
974 | 1038 | ||
975 | if (file.status() != IO_Ok) { | 1039 | if (file.status() != IO_Ok) { |
976 | 1040 | ||
977 | #ifdef QT_CHECK_STATE | 1041 | #ifdef QT_CHECK_STATE |
978 | qWarning("QSettings::sync: error at end of write"); | 1042 | qWarning("QSettings::sync: error at end of write"); |
979 | #endif // QT_CHECK_STATE | 1043 | #endif // QT_CHECK_STATE |
980 | 1044 | ||
981 | success = FALSE; | 1045 | success = FALSE; |
982 | } | 1046 | } |
983 | 1047 | ||
984 | file.close(); | 1048 | file.close(); |
985 | 1049 | ||
986 | closelock( lockfd ); | 1050 | closelock( lockfd ); |
987 | } | 1051 | } |
988 | 1052 | ||
@@ -995,49 +1059,48 @@ bool QSettings::sync() | |||
995 | /*! | 1059 | /*! |
996 | \fn bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok ) const | 1060 | \fn bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok ) const |
997 | 1061 | ||
998 | Reads the entry specified by \a key, and returns a bool, or the | 1062 | Reads the entry specified by \a key, and returns a bool, or the |
999 | default value, \a def, if the entry couldn't be read. | 1063 | default value, \a def, if the entry couldn't be read. |
1000 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE | 1064 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE |
1001 | otherwise. | 1065 | otherwise. |
1002 | 1066 | ||
1003 | \sa readEntry(), readNumEntry(), readDoubleEntry(), writeEntry(), removeEntry() | 1067 | \sa readEntry(), readNumEntry(), readDoubleEntry(), writeEntry(), removeEntry() |
1004 | */ | 1068 | */ |
1005 | 1069 | ||
1006 | /*! | 1070 | /*! |
1007 | \internal | 1071 | \internal |
1008 | */ | 1072 | */ |
1009 | bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok ) | 1073 | bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok ) |
1010 | { | 1074 | { |
1011 | if ( !verifyKey( key ) ) { | 1075 | if ( !qt_verify_key( key ) ) { |
1012 | #if defined(QT_CHECK_STATE) | 1076 | #if defined(QT_CHECK_STATE) |
1013 | qWarning( "QSettings::readBoolEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1077 | qWarning( "QSettings::readBoolEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1014 | #endif | 1078 | #endif |
1015 | if ( ok ) | 1079 | if ( ok ) |
1016 | *ok = FALSE; | 1080 | *ok = FALSE; |
1017 | 1081 | ||
1018 | return def; | 1082 | return def; |
1019 | } | 1083 | } |
1020 | 1084 | ||
1021 | QString theKey = groupKey( group(), key ); | 1085 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1022 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1023 | if ( d->sysd ) | 1086 | if ( d->sysd ) |
1024 | return d->sysReadBoolEntry( theKey, def, ok ); | 1087 | return d->sysReadBoolEntry( groupKey( group(), key ), def, ok ); |
1025 | #endif | 1088 | #endif |
1026 | 1089 | ||
1027 | QString value = readEntry( theKey, ( def ? "true" : "false" ), ok ); | 1090 | QString value = readEntry( key, ( def ? "true" : "false" ), ok ); |
1028 | 1091 | ||
1029 | if (value.lower() == "true") | 1092 | if (value.lower() == "true") |
1030 | return TRUE; | 1093 | return TRUE; |
1031 | else if (value.lower() == "false") | 1094 | else if (value.lower() == "false") |
1032 | return FALSE; | 1095 | return FALSE; |
1033 | else if (value == "1") | 1096 | else if (value == "1") |
1034 | return TRUE; | 1097 | return TRUE; |
1035 | else if (value == "0") | 1098 | else if (value == "0") |
1036 | return FALSE; | 1099 | return FALSE; |
1037 | 1100 | ||
1038 | if (! value.isEmpty()) | 1101 | if (! value.isEmpty()) |
1039 | qWarning("QSettings::readBoolEntry: '%s' is not 'true' or 'false'", | 1102 | qWarning("QSettings::readBoolEntry: '%s' is not 'true' or 'false'", |
1040 | value.latin1()); | 1103 | value.latin1()); |
1041 | if ( ok ) | 1104 | if ( ok ) |
1042 | *ok = FALSE; | 1105 | *ok = FALSE; |
1043 | return def; | 1106 | return def; |
@@ -1047,137 +1110,134 @@ bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok ) | |||
1047 | /*! | 1110 | /*! |
1048 | \fn double QSettings::readDoubleEntry(const QString &key, double def, bool *ok ) const | 1111 | \fn double QSettings::readDoubleEntry(const QString &key, double def, bool *ok ) const |
1049 | 1112 | ||
1050 | Reads the entry specified by \a key, and returns a double, or the | 1113 | Reads the entry specified by \a key, and returns a double, or the |
1051 | default value, \a def, if the entry couldn't be read. | 1114 | default value, \a def, if the entry couldn't be read. |
1052 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE | 1115 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE |
1053 | otherwise. | 1116 | otherwise. |
1054 | 1117 | ||
1055 | \sa readEntry(), readNumEntry(), readBoolEntry(), writeEntry(), removeEntry() | 1118 | \sa readEntry(), readNumEntry(), readBoolEntry(), writeEntry(), removeEntry() |
1056 | */ | 1119 | */ |
1057 | 1120 | ||
1058 | /*! | 1121 | /*! |
1059 | \internal | 1122 | \internal |
1060 | */ | 1123 | */ |
1061 | double QSettings::readDoubleEntry(const QString &key, double def, bool *ok ) | 1124 | double QSettings::readDoubleEntry(const QString &key, double def, bool *ok ) |
1062 | { | 1125 | { |
1063 | if ( !verifyKey( key ) ) { | 1126 | if ( !qt_verify_key( key ) ) { |
1064 | #if defined(QT_CHECK_STATE) | 1127 | #if defined(QT_CHECK_STATE) |
1065 | qWarning( "QSettings::readDoubleEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1128 | qWarning( "QSettings::readDoubleEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1066 | #endif | 1129 | #endif |
1067 | if ( ok ) | 1130 | if ( ok ) |
1068 | *ok = FALSE; | 1131 | *ok = FALSE; |
1069 | 1132 | ||
1070 | return def; | 1133 | return def; |
1071 | } | 1134 | } |
1072 | 1135 | ||
1073 | QString theKey = groupKey( group(), key ); | 1136 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1074 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1075 | if ( d->sysd ) | 1137 | if ( d->sysd ) |
1076 | return d->sysReadDoubleEntry( theKey, def, ok ); | 1138 | return d->sysReadDoubleEntry( groupKey( group(), key ), def, ok ); |
1077 | #endif | 1139 | #endif |
1078 | 1140 | ||
1079 | QString value = readEntry( theKey, QString::number(def), ok ); | 1141 | QString value = readEntry( key, QString::number(def), ok ); |
1080 | bool conv_ok; | 1142 | bool conv_ok; |
1081 | double retval = value.toDouble( &conv_ok ); | 1143 | double retval = value.toDouble( &conv_ok ); |
1082 | if ( conv_ok ) | 1144 | if ( conv_ok ) |
1083 | return retval; | 1145 | return retval; |
1084 | if ( ! value.isEmpty() ) | 1146 | if ( ! value.isEmpty() ) |
1085 | qWarning( "QSettings::readDoubleEntry: '%s' is not a number", | 1147 | qWarning( "QSettings::readDoubleEntry: '%s' is not a number", |
1086 | value.latin1() ); | 1148 | value.latin1() ); |
1087 | if ( ok ) | 1149 | if ( ok ) |
1088 | *ok = FALSE; | 1150 | *ok = FALSE; |
1089 | return def; | 1151 | return def; |
1090 | } | 1152 | } |
1091 | 1153 | ||
1092 | 1154 | ||
1093 | /*! | 1155 | /*! |
1094 | \fn int QSettings::readNumEntry(const QString &key, int def, bool *ok ) const | 1156 | \fn int QSettings::readNumEntry(const QString &key, int def, bool *ok ) const |
1095 | 1157 | ||
1096 | Reads the entry specified by \a key, and returns an integer, or the | 1158 | Reads the entry specified by \a key, and returns an integer, or the |
1097 | default value, \a def, if the entry couldn't be read. | 1159 | default value, \a def, if the entry couldn't be read. |
1098 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE | 1160 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE |
1099 | otherwise. | 1161 | otherwise. |
1100 | 1162 | ||
1101 | \sa readEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry() | 1163 | \sa readEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry() |
1102 | */ | 1164 | */ |
1103 | 1165 | ||
1104 | /*! | 1166 | /*! |
1105 | \internal | 1167 | \internal |
1106 | */ | 1168 | */ |
1107 | int QSettings::readNumEntry(const QString &key, int def, bool *ok ) | 1169 | int QSettings::readNumEntry(const QString &key, int def, bool *ok ) |
1108 | { | 1170 | { |
1109 | if ( !verifyKey( key ) ) { | 1171 | if ( !qt_verify_key( key ) ) { |
1110 | #if defined(QT_CHECK_STATE) | 1172 | #if defined(QT_CHECK_STATE) |
1111 | qWarning( "QSettings::readNumEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1173 | qWarning( "QSettings::readNumEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1112 | #endif | 1174 | #endif |
1113 | if ( ok ) | 1175 | if ( ok ) |
1114 | *ok = FALSE; | 1176 | *ok = FALSE; |
1115 | return def; | 1177 | return def; |
1116 | } | 1178 | } |
1117 | 1179 | ||
1118 | QString theKey = groupKey( group(), key ); | 1180 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1119 | |||
1120 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1121 | if ( d->sysd ) | 1181 | if ( d->sysd ) |
1122 | return d->sysReadNumEntry( theKey, def, ok ); | 1182 | return d->sysReadNumEntry( groupKey( group(), key ), def, ok ); |
1123 | #endif | 1183 | #endif |
1124 | 1184 | ||
1125 | QString value = readEntry( theKey, QString::number( def ), ok ); | 1185 | QString value = readEntry( key, QString::number( def ), ok ); |
1126 | bool conv_ok; | 1186 | bool conv_ok; |
1127 | int retval = value.toInt( &conv_ok ); | 1187 | int retval = value.toInt( &conv_ok ); |
1128 | if ( conv_ok ) | 1188 | if ( conv_ok ) |
1129 | return retval; | 1189 | return retval; |
1130 | if ( ! value.isEmpty() ) | 1190 | if ( ! value.isEmpty() ) |
1131 | qWarning( "QSettings::readNumEntry: '%s' is not a number", | 1191 | qWarning( "QSettings::readNumEntry: '%s' is not a number", |
1132 | value.latin1() ); | 1192 | value.latin1() ); |
1133 | if ( ok ) | 1193 | if ( ok ) |
1134 | *ok = FALSE; | 1194 | *ok = FALSE; |
1135 | return def; | 1195 | return def; |
1136 | } | 1196 | } |
1137 | 1197 | ||
1138 | 1198 | ||
1139 | /*! | 1199 | /*! |
1140 | \fn QString QSettings::readEntry(const QString &key, const QString &def, bool *ok ) const | 1200 | \fn QString QSettings::readEntry(const QString &key, const QString &def, bool *ok ) const |
1141 | 1201 | ||
1142 | Reads the entry specified by \a key, and returns a QString, or the | 1202 | Reads the entry specified by \a key, and returns a QString, or the |
1143 | default value, \a def, if the entry couldn't be read. | 1203 | default value, \a def, if the entry couldn't be read. |
1144 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE | 1204 | If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE |
1145 | otherwise. | 1205 | otherwise. |
1146 | 1206 | ||
1147 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry() | 1207 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry() |
1148 | */ | 1208 | */ |
1149 | 1209 | ||
1150 | /*! | 1210 | /*! |
1151 | \internal | 1211 | \internal |
1152 | */ | 1212 | */ |
1153 | QString QSettings::readEntry(const QString &key, const QString &def, bool *ok ) | 1213 | QString QSettings::readEntry(const QString &key, const QString &def, bool *ok ) |
1154 | { | 1214 | { |
1155 | if ( !verifyKey( key ) ) { | 1215 | if ( !qt_verify_key( key ) ) { |
1156 | #if defined(QT_CHECK_STATE) | 1216 | #if defined(QT_CHECK_STATE) |
1157 | qWarning( "QSettings::readEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1217 | qWarning( "QSettings::readEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1158 | #endif | 1218 | #endif |
1159 | if ( ok ) | 1219 | if ( ok ) |
1160 | *ok = FALSE; | 1220 | *ok = FALSE; |
1161 | 1221 | ||
1162 | return def; | 1222 | return def; |
1163 | } | 1223 | } |
1164 | 1224 | ||
1165 | QString theKey = groupKey( group(), key ); | 1225 | QString theKey = groupKey( group(), key ); |
1166 | 1226 | ||
1167 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1227 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1168 | if ( d->sysd ) | 1228 | if ( d->sysd ) |
1169 | return d->sysReadEntry( theKey, def, ok ); | 1229 | return d->sysReadEntry( theKey, def, ok ); |
1170 | #endif | 1230 | #endif |
1171 | 1231 | ||
1172 | if ( ok ) // no, everything is not ok | 1232 | if ( ok ) // no, everything is not ok |
1173 | *ok = FALSE; | 1233 | *ok = FALSE; |
1174 | 1234 | ||
1175 | QString realkey; | 1235 | QString realkey; |
1176 | 1236 | ||
1177 | if (theKey[0] == '/') { | 1237 | if (theKey[0] == '/') { |
1178 | // parse our key | 1238 | // parse our key |
1179 | QStringList list(QStringList::split('/', theKey)); | 1239 | QStringList list(QStringList::split('/', theKey)); |
1180 | 1240 | ||
1181 | if (list.count() < 2) { | 1241 | if (list.count() < 2) { |
1182 | #ifdef QT_CHECK_STATE | 1242 | #ifdef QT_CHECK_STATE |
1183 | qWarning("QSettings::readEntry: invalid key '%s'", theKey.latin1()); | 1243 | qWarning("QSettings::readEntry: invalid key '%s'", theKey.latin1()); |
@@ -1193,190 +1253,184 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok ) | |||
1193 | realkey = list[1]; | 1253 | realkey = list[1]; |
1194 | } else { | 1254 | } else { |
1195 | d->heading = list[0]; | 1255 | d->heading = list[0]; |
1196 | d->group = list[1]; | 1256 | d->group = list[1]; |
1197 | 1257 | ||
1198 | // remove the group from the list | 1258 | // remove the group from the list |
1199 | list.remove(list.at(1)); | 1259 | list.remove(list.at(1)); |
1200 | // remove the heading from the list | 1260 | // remove the heading from the list |
1201 | list.remove(list.at(0)); | 1261 | list.remove(list.at(0)); |
1202 | 1262 | ||
1203 | realkey = list.join("/"); | 1263 | realkey = list.join("/"); |
1204 | } | 1264 | } |
1205 | } else | 1265 | } else |
1206 | realkey = theKey; | 1266 | realkey = theKey; |
1207 | 1267 | ||
1208 | QSettingsGroup grp = d->readGroup(); | 1268 | QSettingsGroup grp = d->readGroup(); |
1209 | QString retval = grp[realkey]; | 1269 | QSettingsGroup::const_iterator it = grp.find( realkey ), end = grp.end(); |
1210 | if ( retval.isNull() ) | 1270 | QString retval = def; |
1211 | retval = def; | 1271 | if ( it != end ) { |
1212 | else if ( ok ) // everything is ok | 1272 | // found the value we needed |
1213 | *ok = TRUE; | 1273 | retval = *it; |
1274 | if ( ok ) *ok = TRUE; | ||
1275 | } | ||
1214 | return retval; | 1276 | return retval; |
1215 | } | 1277 | } |
1216 | 1278 | ||
1217 | 1279 | ||
1218 | #if !defined(Q_NO_BOOL_TYPE) | 1280 | #if !defined(Q_NO_BOOL_TYPE) |
1219 | /*! | 1281 | /*! |
1220 | Writes the boolean entry \a value into key \a key. The \a key is | 1282 | Writes the boolean entry \a value into key \a key. The \a key is |
1221 | created if it doesn't exist. Any previous value is overwritten by \a | 1283 | created if it doesn't exist. Any previous value is overwritten by \a |
1222 | value. | 1284 | value. |
1223 | 1285 | ||
1224 | If an error occurs the settings are left unchanged and FALSE is | 1286 | If an error occurs the settings are left unchanged and FALSE is |
1225 | returned; otherwise TRUE is returned. | 1287 | returned; otherwise TRUE is returned. |
1226 | 1288 | ||
1227 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() | 1289 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() |
1228 | */ | 1290 | */ |
1229 | bool QSettings::writeEntry(const QString &key, bool value) | 1291 | bool QSettings::writeEntry(const QString &key, bool value) |
1230 | { | 1292 | { |
1231 | if ( !verifyKey( key ) ) { | 1293 | if ( !qt_verify_key( key ) ) { |
1232 | #if defined(QT_CHECK_STATE) | 1294 | #if defined(QT_CHECK_STATE) |
1233 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1295 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1234 | #endif | 1296 | #endif |
1235 | return FALSE; | 1297 | return FALSE; |
1236 | } | 1298 | } |
1237 | 1299 | ||
1238 | QString theKey = groupKey( group(), key ); | 1300 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1239 | |||
1240 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1241 | if ( d->sysd ) | 1301 | if ( d->sysd ) |
1242 | return d->sysWriteEntry( theKey, value ); | 1302 | return d->sysWriteEntry( groupKey( group(), key ), value ); |
1243 | #endif | 1303 | #endif |
1244 | QString s(value ? "true" : "false"); | 1304 | QString s(value ? "true" : "false"); |
1245 | return writeEntry(theKey, s); | 1305 | return writeEntry(key, s); |
1246 | } | 1306 | } |
1247 | #endif | 1307 | #endif |
1248 | 1308 | ||
1249 | 1309 | ||
1250 | /*! | 1310 | /*! |
1251 | \overload | 1311 | \overload |
1252 | Writes the double entry \a value into key \a key. The \a key is | 1312 | Writes the double entry \a value into key \a key. The \a key is |
1253 | created if it doesn't exist. Any previous value is overwritten by \a | 1313 | created if it doesn't exist. Any previous value is overwritten by \a |
1254 | value. | 1314 | value. |
1255 | 1315 | ||
1256 | If an error occurs the settings are left unchanged and FALSE is | 1316 | If an error occurs the settings are left unchanged and FALSE is |
1257 | returned; otherwise TRUE is returned. | 1317 | returned; otherwise TRUE is returned. |
1258 | 1318 | ||
1259 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() | 1319 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() |
1260 | */ | 1320 | */ |
1261 | bool QSettings::writeEntry(const QString &key, double value) | 1321 | bool QSettings::writeEntry(const QString &key, double value) |
1262 | { | 1322 | { |
1263 | if ( !verifyKey( key ) ) { | 1323 | if ( !qt_verify_key( key ) ) { |
1264 | #if defined(QT_CHECK_STATE) | 1324 | #if defined(QT_CHECK_STATE) |
1265 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1325 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1266 | #endif | 1326 | #endif |
1267 | return FALSE; | 1327 | return FALSE; |
1268 | } | 1328 | } |
1269 | 1329 | ||
1270 | QString theKey = groupKey( group(), key ); | 1330 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1271 | |||
1272 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1273 | if ( d->sysd ) | 1331 | if ( d->sysd ) |
1274 | return d->sysWriteEntry( theKey, value ); | 1332 | return d->sysWriteEntry( groupKey( group(), key ), value ); |
1275 | #endif | 1333 | #endif |
1276 | QString s(QString::number(value)); | 1334 | QString s(QString::number(value)); |
1277 | return writeEntry(theKey, s); | 1335 | return writeEntry(key, s); |
1278 | } | 1336 | } |
1279 | 1337 | ||
1280 | 1338 | ||
1281 | /*! | 1339 | /*! |
1282 | \overload | 1340 | \overload |
1283 | Writes the integer entry \a value into key \a key. The \a key is | 1341 | Writes the integer entry \a value into key \a key. The \a key is |
1284 | created if it doesn't exist. Any previous value is overwritten by \a | 1342 | created if it doesn't exist. Any previous value is overwritten by \a |
1285 | value. | 1343 | value. |
1286 | 1344 | ||
1287 | If an error occurs the settings are left unchanged and FALSE is | 1345 | If an error occurs the settings are left unchanged and FALSE is |
1288 | returned; otherwise TRUE is returned. | 1346 | returned; otherwise TRUE is returned. |
1289 | 1347 | ||
1290 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() | 1348 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() |
1291 | */ | 1349 | */ |
1292 | bool QSettings::writeEntry(const QString &key, int value) | 1350 | bool QSettings::writeEntry(const QString &key, int value) |
1293 | { | 1351 | { |
1294 | if ( !verifyKey( key ) ) { | 1352 | if ( !qt_verify_key( key ) ) { |
1295 | #if defined(QT_CHECK_STATE) | 1353 | #if defined(QT_CHECK_STATE) |
1296 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1354 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1297 | #endif | 1355 | #endif |
1298 | return FALSE; | 1356 | return FALSE; |
1299 | } | 1357 | } |
1300 | 1358 | ||
1301 | QString theKey = groupKey( group(), key ); | 1359 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1302 | |||
1303 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | ||
1304 | if ( d->sysd ) | 1360 | if ( d->sysd ) |
1305 | return d->sysWriteEntry( theKey, value ); | 1361 | return d->sysWriteEntry( groupKey( group(), key ), value ); |
1306 | #endif | 1362 | #endif |
1307 | QString s(QString::number(value)); | 1363 | QString s(QString::number(value)); |
1308 | return writeEntry(theKey, s); | 1364 | return writeEntry(key, s); |
1309 | } | 1365 | } |
1310 | 1366 | ||
1311 | 1367 | ||
1312 | /*! | 1368 | /*! |
1313 | \internal | 1369 | \internal |
1314 | 1370 | ||
1315 | Writes the entry specified by \a key with the string-literal \a value, | 1371 | Writes the entry specified by \a key with the string-literal \a value, |
1316 | replacing any previous setting. If \a value is zero-length or null, the | 1372 | replacing any previous setting. If \a value is zero-length or null, the |
1317 | entry is replaced by an empty setting. | 1373 | entry is replaced by an empty setting. |
1318 | 1374 | ||
1319 | \e NOTE: This function is provided because some compilers use the | 1375 | \e NOTE: This function is provided because some compilers use the |
1320 | writeEntry (const QString &, bool) overload for this code: | 1376 | writeEntry (const QString &, bool) overload for this code: |
1321 | writeEntry ("/foo/bar", "baz") | 1377 | writeEntry ("/foo/bar", "baz") |
1322 | 1378 | ||
1323 | If an error occurs, this functions returns FALSE and the object is left | 1379 | If an error occurs, this functions returns FALSE and the object is left |
1324 | unchanged. | 1380 | unchanged. |
1325 | 1381 | ||
1326 | \sa readEntry(), removeEntry() | 1382 | \sa readEntry(), removeEntry() |
1327 | */ | 1383 | */ |
1328 | bool QSettings::writeEntry(const QString &key, const char *value) | 1384 | bool QSettings::writeEntry(const QString &key, const char *value) |
1329 | { | 1385 | { |
1330 | if ( !verifyKey( key ) ) { | 1386 | if ( !qt_verify_key( key ) ) { |
1331 | #if defined(QT_CHECK_STATE) | 1387 | #if defined(QT_CHECK_STATE) |
1332 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1388 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1333 | #endif | 1389 | #endif |
1334 | return FALSE; | 1390 | return FALSE; |
1335 | } | 1391 | } |
1336 | 1392 | ||
1337 | QString theKey = groupKey( group(), key ); | 1393 | return writeEntry(key, QString(value)); |
1338 | |||
1339 | return writeEntry(theKey, QString(value)); | ||
1340 | } | 1394 | } |
1341 | 1395 | ||
1342 | 1396 | ||
1343 | /*! | 1397 | /*! |
1344 | \overload | 1398 | \overload |
1345 | Writes the string entry \a value into key \a key. The \a key is | 1399 | Writes the string entry \a value into key \a key. The \a key is |
1346 | created if it doesn't exist. Any previous value is overwritten by \a | 1400 | created if it doesn't exist. Any previous value is overwritten by \a |
1347 | value. If \a value is an empty string or a null string the key's | 1401 | value. If \a value is an empty string or a null string the key's |
1348 | value will be an empty string. | 1402 | value will be an empty string. |
1349 | 1403 | ||
1350 | If an error occurs the settings are left unchanged and FALSE is | 1404 | If an error occurs the settings are left unchanged and FALSE is |
1351 | returned; otherwise TRUE is returned. | 1405 | returned; otherwise TRUE is returned. |
1352 | 1406 | ||
1353 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() | 1407 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() |
1354 | */ | 1408 | */ |
1355 | bool QSettings::writeEntry(const QString &key, const QString &value) | 1409 | bool QSettings::writeEntry(const QString &key, const QString &value) |
1356 | { | 1410 | { |
1357 | if ( !verifyKey( key ) ) { | 1411 | if ( !qt_verify_key( key ) ) { |
1358 | #if defined(QT_CHECK_STATE) | 1412 | #if defined(QT_CHECK_STATE) |
1359 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1413 | qWarning( "QSettings::writeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1360 | #endif | 1414 | #endif |
1361 | return FALSE; | 1415 | return FALSE; |
1362 | } | 1416 | } |
1363 | 1417 | ||
1364 | QString theKey = groupKey( group(), key ); | 1418 | QString theKey = groupKey( group(), key ); |
1365 | 1419 | ||
1366 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1420 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1367 | if ( d->sysd ) | 1421 | if ( d->sysd ) |
1368 | return d->sysWriteEntry( theKey, value ); | 1422 | return d->sysWriteEntry( theKey, value ); |
1369 | #endif | 1423 | #endif |
1370 | // NOTE: we *do* allow value to be a null/empty string | 1424 | // NOTE: we *do* allow value to be a null/empty string |
1371 | 1425 | ||
1372 | QString realkey; | 1426 | QString realkey; |
1373 | 1427 | ||
1374 | if (theKey[0] == '/') { | 1428 | if (theKey[0] == '/') { |
1375 | // parse our key | 1429 | // parse our key |
1376 | QStringList list(QStringList::split('/', theKey)); | 1430 | QStringList list(QStringList::split('/', theKey)); |
1377 | 1431 | ||
1378 | if (list.count() < 2) { | 1432 | if (list.count() < 2) { |
1379 | #ifdef QT_CHECK_STATE | 1433 | #ifdef QT_CHECK_STATE |
1380 | qWarning("QSettings::writeEntry: invalid key '%s'", theKey.latin1()); | 1434 | qWarning("QSettings::writeEntry: invalid key '%s'", theKey.latin1()); |
1381 | #endif // QT_CHECK_STATE | 1435 | #endif // QT_CHECK_STATE |
1382 | 1436 | ||
@@ -1402,42 +1456,42 @@ bool QSettings::writeEntry(const QString &key, const QString &value) | |||
1402 | realkey = theKey; | 1456 | realkey = theKey; |
1403 | 1457 | ||
1404 | d->writeGroup(realkey, value); | 1458 | d->writeGroup(realkey, value); |
1405 | return TRUE; | 1459 | return TRUE; |
1406 | } | 1460 | } |
1407 | 1461 | ||
1408 | 1462 | ||
1409 | /*! | 1463 | /*! |
1410 | Removes the entry specified by \a key. | 1464 | Removes the entry specified by \a key. |
1411 | 1465 | ||
1412 | Returns TRUE if the entry existed and was removed; otherwise returns FALSE. | 1466 | Returns TRUE if the entry existed and was removed; otherwise returns FALSE. |
1413 | 1467 | ||
1414 | \sa readEntry(), writeEntry() | 1468 | \sa readEntry(), writeEntry() |
1415 | */ | 1469 | */ |
1416 | bool QSettings::removeEntry(const QString &key) | 1470 | bool QSettings::removeEntry(const QString &key) |
1417 | { | 1471 | { |
1418 | if ( !verifyKey( key ) ) { | 1472 | if ( !qt_verify_key( key ) ) { |
1419 | #if defined(QT_CHECK_STATE) | 1473 | #if defined(QT_CHECK_STATE) |
1420 | qWarning( "QSettings::removeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1474 | qWarning( "QSettings::removeEntry: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1421 | #endif | 1475 | #endif |
1422 | return FALSE; | 1476 | return FALSE; |
1423 | } | 1477 | } |
1424 | 1478 | ||
1425 | QString theKey = groupKey( group(), key ); | 1479 | QString theKey = groupKey( group(), key ); |
1426 | 1480 | ||
1427 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1481 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1428 | if ( d->sysd ) | 1482 | if ( d->sysd ) |
1429 | return d->sysRemoveEntry( theKey ); | 1483 | return d->sysRemoveEntry( theKey ); |
1430 | #endif | 1484 | #endif |
1431 | 1485 | ||
1432 | QString realkey; | 1486 | QString realkey; |
1433 | 1487 | ||
1434 | if (theKey[0] == '/') { | 1488 | if (theKey[0] == '/') { |
1435 | // parse our key | 1489 | // parse our key |
1436 | QStringList list(QStringList::split('/', theKey)); | 1490 | QStringList list(QStringList::split('/', theKey)); |
1437 | 1491 | ||
1438 | if (list.count() < 2) { | 1492 | if (list.count() < 2) { |
1439 | #ifdef QT_CHECK_STATE | 1493 | #ifdef QT_CHECK_STATE |
1440 | qWarning("QSettings::removeEntry: invalid key '%s'", theKey.latin1()); | 1494 | qWarning("QSettings::removeEntry: invalid key '%s'", theKey.latin1()); |
1441 | #endif // QT_CHECK_STATE | 1495 | #endif // QT_CHECK_STATE |
1442 | 1496 | ||
1443 | return FALSE; | 1497 | return FALSE; |
@@ -1481,42 +1535,42 @@ bool QSettings::removeEntry(const QString &key) | |||
1481 | \endcode | 1535 | \endcode |
1482 | \code | 1536 | \code |
1483 | QStringList keys = entryList( "/MyCompany/MyApplication" ); | 1537 | QStringList keys = entryList( "/MyCompany/MyApplication" ); |
1484 | \endcode | 1538 | \endcode |
1485 | \c keys contains 'background color' and 'foreground color'. It does | 1539 | \c keys contains 'background color' and 'foreground color'. It does |
1486 | not contain 'geometry' because this key contains keys not entries. | 1540 | not contain 'geometry' because this key contains keys not entries. |
1487 | 1541 | ||
1488 | To access the geometry values could either use subkeyList() to read | 1542 | To access the geometry values could either use subkeyList() to read |
1489 | the keys and then read each entry, or simply read each entry | 1543 | the keys and then read each entry, or simply read each entry |
1490 | directly by specifying its full key, e.g. | 1544 | directly by specifying its full key, e.g. |
1491 | "/MyCompany/MyApplication/geometry/y". | 1545 | "/MyCompany/MyApplication/geometry/y". |
1492 | 1546 | ||
1493 | \sa subkeyList() | 1547 | \sa subkeyList() |
1494 | */ | 1548 | */ |
1495 | QStringList QSettings::entryList(const QString &key) const | 1549 | QStringList QSettings::entryList(const QString &key) const |
1496 | { | 1550 | { |
1497 | if ( !verifyKey( key ) ) { | 1551 | if ( !qt_verify_key( key ) ) { |
1498 | #if defined(QT_CHECK_STATE) | 1552 | #if defined(QT_CHECK_STATE) |
1499 | qWarning( "QSettings::entryList: Invalid key: %s", key.isNull() ? "(null)" : key.latin1() ); | 1553 | qWarning( "QSettings::entryList: Invalid key: %s", key.isNull() ? "(null)" : key.latin1() ); |
1500 | #endif | 1554 | #endif |
1501 | return QStringList(); | 1555 | return QStringList(); |
1502 | } | 1556 | } |
1503 | 1557 | ||
1504 | QString theKey = groupKey( group(), key ); | 1558 | QString theKey = groupKey( group(), key ); |
1505 | 1559 | ||
1506 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1560 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1507 | if ( d->sysd ) | 1561 | if ( d->sysd ) |
1508 | return d->sysEntryList( theKey ); | 1562 | return d->sysEntryList( theKey ); |
1509 | #endif | 1563 | #endif |
1510 | 1564 | ||
1511 | QString realkey; | 1565 | QString realkey; |
1512 | if (theKey[0] == '/') { | 1566 | if (theKey[0] == '/') { |
1513 | // parse our key | 1567 | // parse our key |
1514 | QStringList list(QStringList::split('/', theKey)); | 1568 | QStringList list(QStringList::split('/', theKey)); |
1515 | 1569 | ||
1516 | if (list.count() < 1) { | 1570 | if (list.count() < 1) { |
1517 | #ifdef QT_CHECK_STATE | 1571 | #ifdef QT_CHECK_STATE |
1518 | qWarning("QSettings::listEntries: invalid key '%s'", theKey.latin1()); | 1572 | qWarning("QSettings::listEntries: invalid key '%s'", theKey.latin1()); |
1519 | #endif // QT_CHECK_STATE | 1573 | #endif // QT_CHECK_STATE |
1520 | 1574 | ||
1521 | return QStringList(); | 1575 | return QStringList(); |
1522 | } | 1576 | } |
@@ -1531,33 +1585,33 @@ QStringList QSettings::entryList(const QString &key) const | |||
1531 | // remove the group from the list | 1585 | // remove the group from the list |
1532 | list.remove(list.at(1)); | 1586 | list.remove(list.at(1)); |
1533 | // remove the heading from the list | 1587 | // remove the heading from the list |
1534 | list.remove(list.at(0)); | 1588 | list.remove(list.at(0)); |
1535 | 1589 | ||
1536 | realkey = list.join("/"); | 1590 | realkey = list.join("/"); |
1537 | } | 1591 | } |
1538 | } else | 1592 | } else |
1539 | realkey = theKey; | 1593 | realkey = theKey; |
1540 | 1594 | ||
1541 | QSettingsGroup grp = d->readGroup(); | 1595 | QSettingsGroup grp = d->readGroup(); |
1542 | QSettingsGroup::Iterator it = grp.begin(); | 1596 | QSettingsGroup::Iterator it = grp.begin(); |
1543 | QStringList ret; | 1597 | QStringList ret; |
1544 | QString itkey; | 1598 | QString itkey; |
1545 | while (it != grp.end()) { | 1599 | while (it != grp.end()) { |
1546 | itkey = it.key(); | 1600 | itkey = it.key(); |
1547 | it++; | 1601 | ++it; |
1548 | 1602 | ||
1549 | if ( realkey.length() > 0 ) { | 1603 | if ( realkey.length() > 0 ) { |
1550 | if ( itkey.left( realkey.length() ) != realkey ) | 1604 | if ( itkey.left( realkey.length() ) != realkey ) |
1551 | continue; | 1605 | continue; |
1552 | else | 1606 | else |
1553 | itkey.remove( 0, realkey.length() + 1 ); | 1607 | itkey.remove( 0, realkey.length() + 1 ); |
1554 | } | 1608 | } |
1555 | 1609 | ||
1556 | if ( itkey.find( '/' ) != -1 ) | 1610 | if ( itkey.find( '/' ) != -1 ) |
1557 | continue; | 1611 | continue; |
1558 | 1612 | ||
1559 | ret << itkey; | 1613 | ret << itkey; |
1560 | } | 1614 | } |
1561 | 1615 | ||
1562 | return ret; | 1616 | return ret; |
1563 | } | 1617 | } |
@@ -1578,121 +1632,136 @@ QStringList QSettings::entryList(const QString &key) const | |||
1578 | /MyCompany/MyApplication/recent files/1 | 1632 | /MyCompany/MyApplication/recent files/1 |
1579 | /MyCompany/MyApplication/recent files/2 | 1633 | /MyCompany/MyApplication/recent files/2 |
1580 | /MyCompany/MyApplication/recent files/3 | 1634 | /MyCompany/MyApplication/recent files/3 |
1581 | \endcode | 1635 | \endcode |
1582 | \code | 1636 | \code |
1583 | QStringList keys = subkeyList( "/MyCompany/MyApplication" ); | 1637 | QStringList keys = subkeyList( "/MyCompany/MyApplication" ); |
1584 | \endcode | 1638 | \endcode |
1585 | \c keys contains 'geometry' and 'recent files'. It does not contain | 1639 | \c keys contains 'geometry' and 'recent files'. It does not contain |
1586 | 'background color' or 'foreground color' because they are keys which | 1640 | 'background color' or 'foreground color' because they are keys which |
1587 | contain entries not keys. To get a list of keys that have values | 1641 | contain entries not keys. To get a list of keys that have values |
1588 | rather than subkeys use entryList(). | 1642 | rather than subkeys use entryList(). |
1589 | 1643 | ||
1590 | \sa entryList() | 1644 | \sa entryList() |
1591 | */ | 1645 | */ |
1592 | QStringList QSettings::subkeyList(const QString &key) const | 1646 | QStringList QSettings::subkeyList(const QString &key) const |
1593 | { | 1647 | { |
1594 | if ( !verifyKey( key ) ) { | 1648 | if ( !qt_verify_key( key ) ) { |
1595 | #if defined(QT_CHECK_STATE) | 1649 | #if defined(QT_CHECK_STATE) |
1596 | qWarning( "QSettings::subkeyList: Invalid key: %s", key.isNull() ? "(null)" : key.latin1() ); | 1650 | qWarning( "QSettings::subkeyList: Invalid key: %s", key.isNull() ? "(null)" : key.latin1() ); |
1597 | #endif | 1651 | #endif |
1598 | return QStringList(); | 1652 | return QStringList(); |
1599 | } | 1653 | } |
1600 | 1654 | ||
1601 | QString theKey = groupKey( group(), key ); | 1655 | QString theKey = groupKey( group(), key ); |
1602 | 1656 | ||
1603 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1657 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1604 | if ( d->sysd ) | 1658 | if ( d->sysd ) |
1605 | return d->sysSubkeyList( theKey ); | 1659 | return d->sysSubkeyList( theKey ); |
1606 | #endif | 1660 | #endif |
1607 | 1661 | ||
1608 | QString realkey; | 1662 | QString realkey; |
1663 | int subkeycount = 2; | ||
1609 | if (theKey[0] == '/') { | 1664 | if (theKey[0] == '/') { |
1610 | // parse our key | 1665 | // parse our key |
1611 | QStringList list(QStringList::split('/', theKey)); | 1666 | QStringList list(QStringList::split('/', theKey)); |
1612 | 1667 | ||
1613 | if (list.count() < 1) { | 1668 | if (list.count() < 1) { |
1614 | #ifdef QT_CHECK_STATE | 1669 | #ifdef QT_CHECK_STATE |
1615 | qWarning("QSettings::subkeyList: invalid key '%s'", theKey.latin1()); | 1670 | qWarning("QSettings::subkeyList: invalid key '%s'", theKey.latin1()); |
1616 | #endif // QT_CHECK_STATE | 1671 | #endif // QT_CHECK_STATE |
1617 | 1672 | ||
1618 | return QStringList(); | 1673 | return QStringList(); |
1619 | } | 1674 | } |
1620 | 1675 | ||
1676 | subkeycount = list.count(); | ||
1677 | |||
1621 | if (list.count() == 1) { | 1678 | if (list.count() == 1) { |
1622 | d->heading = list[0]; | 1679 | d->heading = list[0]; |
1623 | d->group = "General"; | 1680 | d->group = "General"; |
1624 | } else { | 1681 | } else { |
1625 | d->heading = list[0]; | 1682 | d->heading = list[0]; |
1626 | d->group = list[1]; | 1683 | d->group = list[1]; |
1627 | 1684 | ||
1628 | // remove the group from the list | 1685 | // remove the group from the list |
1629 | list.remove(list.at(1)); | 1686 | list.remove(list.at(1)); |
1630 | // remove the heading from the list | 1687 | // remove the heading from the list |
1631 | list.remove(list.at(0)); | 1688 | list.remove(list.at(0)); |
1632 | 1689 | ||
1633 | realkey = list.join("/"); | 1690 | realkey = list.join("/"); |
1634 | } | 1691 | } |
1692 | |||
1635 | } else | 1693 | } else |
1636 | realkey = theKey; | 1694 | realkey = theKey; |
1637 | 1695 | ||
1696 | QStringList ret; | ||
1697 | if ( subkeycount == 1 ) { | ||
1698 | QMap<QString,QSettingsHeading>::Iterator it = d->headings.begin(); | ||
1699 | while ( it != d->headings.end() ) { | ||
1700 | if ( it.key() != "General" && ! ret.contains( it.key() ) ) | ||
1701 | ret << it.key(); | ||
1702 | ++it; | ||
1703 | } | ||
1704 | |||
1705 | return ret; | ||
1706 | } | ||
1707 | |||
1638 | QSettingsGroup grp = d->readGroup(); | 1708 | QSettingsGroup grp = d->readGroup(); |
1639 | QSettingsGroup::Iterator it = grp.begin(); | 1709 | QSettingsGroup::Iterator it = grp.begin(); |
1640 | QStringList ret; | ||
1641 | QString itkey; | 1710 | QString itkey; |
1642 | while (it != grp.end()) { | 1711 | while (it != grp.end()) { |
1643 | itkey = it.key(); | 1712 | itkey = it.key(); |
1644 | it++; | 1713 | ++it; |
1645 | 1714 | ||
1646 | if ( realkey.length() > 0 ) { | 1715 | if ( realkey.length() > 0 ) { |
1647 | if ( itkey.left( realkey.length() ) != realkey ) | 1716 | if ( itkey.left( realkey.length() ) != realkey ) |
1648 | continue; | 1717 | continue; |
1649 | else | 1718 | else |
1650 | itkey.remove( 0, realkey.length() + 1 ); | 1719 | itkey.remove( 0, realkey.length() + 1 ); |
1651 | } | 1720 | } |
1652 | 1721 | ||
1653 | int slash = itkey.find( '/' ); | 1722 | int slash = itkey.find( '/' ); |
1654 | if ( slash == -1 ) | 1723 | if ( slash == -1 ) |
1655 | continue; | 1724 | continue; |
1656 | itkey.truncate( slash ); | 1725 | itkey.truncate( slash ); |
1657 | 1726 | ||
1658 | if ( ! ret.contains( itkey ) ) | 1727 | if ( ! ret.contains( itkey ) ) |
1659 | ret << itkey; | 1728 | ret << itkey; |
1660 | } | 1729 | } |
1661 | 1730 | ||
1662 | return ret; | 1731 | return ret; |
1663 | } | 1732 | } |
1664 | 1733 | ||
1665 | 1734 | ||
1666 | /*! | 1735 | /*! |
1667 | \internal | 1736 | \internal |
1668 | 1737 | ||
1669 | This function returns the time of last modification for \a key. | 1738 | This function returns the time of last modification for \a key. |
1670 | */ | 1739 | */ |
1671 | QDateTime QSettings::lastModficationTime(const QString &key) | 1740 | QDateTime QSettings::lastModficationTime(const QString &key) |
1672 | { | 1741 | { |
1673 | if ( !verifyKey( key ) ) { | 1742 | if ( !qt_verify_key( key ) ) { |
1674 | #if defined(QT_CHECK_STATE) | 1743 | #if defined(QT_CHECK_STATE) |
1675 | qWarning( "QSettings::lastModficationTime: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); | 1744 | qWarning( "QSettings::lastModficationTime: Invalid key: '%s'", key.isNull() ? "(null)" : key.latin1() ); |
1676 | #endif | 1745 | #endif |
1677 | return QDateTime(); | 1746 | return QDateTime(); |
1678 | } | 1747 | } |
1679 | 1748 | ||
1680 | QString theKey = groupKey( group(), key ); | 1749 | QString theKey = groupKey( group(), key ); |
1681 | 1750 | ||
1682 | #if defined(Q_WS_WIN) || defined(Q_OS_MAC) | 1751 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC)) |
1683 | if ( d->sysd ) | 1752 | if ( d->sysd ) |
1684 | return QDateTime(); | 1753 | return QDateTime(); |
1685 | #endif | 1754 | #endif |
1686 | 1755 | ||
1687 | if (theKey[0] == '/') { | 1756 | if (theKey[0] == '/') { |
1688 | // parse our key | 1757 | // parse our key |
1689 | QStringList list(QStringList::split('/', theKey)); | 1758 | QStringList list(QStringList::split('/', theKey)); |
1690 | 1759 | ||
1691 | if (list.count() < 2) { | 1760 | if (list.count() < 2) { |
1692 | #ifdef QT_CHECK_STATE | 1761 | #ifdef QT_CHECK_STATE |
1693 | qWarning("QSettings::lastModficationTime: invalid key '%s'", theKey.latin1()); | 1762 | qWarning("QSettings::lastModficationTime: invalid key '%s'", theKey.latin1()); |
1694 | #endif // QT_CHECK_STATE | 1763 | #endif // QT_CHECK_STATE |
1695 | 1764 | ||
1696 | return QDateTime(); | 1765 | return QDateTime(); |
1697 | } | 1766 | } |
1698 | 1767 | ||
@@ -1702,35 +1771,43 @@ QDateTime QSettings::lastModficationTime(const QString &key) | |||
1702 | } else { | 1771 | } else { |
1703 | d->heading = list[0]; | 1772 | d->heading = list[0]; |
1704 | d->group = list[1]; | 1773 | d->group = list[1]; |
1705 | } | 1774 | } |
1706 | } | 1775 | } |
1707 | 1776 | ||
1708 | return d->modificationTime(); | 1777 | return d->modificationTime(); |
1709 | } | 1778 | } |
1710 | 1779 | ||
1711 | 1780 | ||
1712 | /*! | 1781 | /*! |
1713 | \overload | 1782 | \overload |
1714 | 1783 | ||
1715 | Writes the string list entry \a value into key \a key. The \a key | 1784 | Writes the string list entry \a value into key \a key. The \a key |
1716 | is created if it doesn't exist. Any previous value is overwritten | 1785 | is created if it doesn't exist. Any previous value is overwritten |
1717 | by \a value. The list is stored as a sequence of strings separated | 1786 | by \a value. The list is stored as a sequence of strings separated |
1718 | by \a separator, so none of the strings in the list should contain | 1787 | by \a separator (using QStringList::join()), so none of the |
1719 | the separator. If the list is empty or null the key's value will | 1788 | strings in the list should contain the separator. If the list is |
1720 | be an empty string. | 1789 | empty or null the key's value will be an empty string. |
1790 | |||
1791 | \warning The list should not contain empty or null strings, as | ||
1792 | readListEntry() will use QStringList::split() to recreate the | ||
1793 | list. As the documentation states, QStringList::split() will omit | ||
1794 | empty strings from the list. Because of this, it is impossible to | ||
1795 | retrieve identical list data that is stored with this function. | ||
1796 | We recommend using the writeEntry() and readListEntry() overloads | ||
1797 | that do not take a \a separator argument. | ||
1721 | 1798 | ||
1722 | If an error occurs the settings are left unchanged and FALSE is | 1799 | If an error occurs the settings are left unchanged and FALSE is |
1723 | returned; otherwise returns TRUE. | 1800 | returned; otherwise returns TRUE. |
1724 | 1801 | ||
1725 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() | 1802 | \sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry() |
1726 | */ | 1803 | */ |
1727 | bool QSettings::writeEntry(const QString &key, const QStringList &value, | 1804 | bool QSettings::writeEntry(const QString &key, const QStringList &value, |
1728 | const QChar &separator) | 1805 | const QChar &separator) |
1729 | { | 1806 | { |
1730 | QString s(value.join(separator)); | 1807 | QString s(value.join(separator)); |
1731 | return writeEntry(key, s); | 1808 | return writeEntry(key, s); |
1732 | } | 1809 | } |
1733 | 1810 | ||
1734 | /*! | 1811 | /*! |
1735 | \overload | 1812 | \overload |
1736 | 1813 | ||
@@ -1755,32 +1832,39 @@ bool QSettings::writeEntry(const QString &key, const QStringList &value) | |||
1755 | } | 1832 | } |
1756 | s+=el; | 1833 | s+=el; |
1757 | s+="^e"; // end of element | 1834 | s+="^e"; // end of element |
1758 | } | 1835 | } |
1759 | return writeEntry(key, s); | 1836 | return writeEntry(key, s); |
1760 | } | 1837 | } |
1761 | 1838 | ||
1762 | 1839 | ||
1763 | /*! | 1840 | /*! |
1764 | \overload QStringList QSettings::readListEntry(const QString &key, const QChar &separator, bool *ok ) const | 1841 | \overload QStringList QSettings::readListEntry(const QString &key, const QChar &separator, bool *ok ) const |
1765 | 1842 | ||
1766 | Reads the entry specified by \a key as a string. The \a separator | 1843 | Reads the entry specified by \a key as a string. The \a separator |
1767 | is used to create a QStringList by calling QStringList::split(\a | 1844 | is used to create a QStringList by calling QStringList::split(\a |
1768 | separator, entry). If \a ok is not 0: \a *ok is set to TRUE if the | 1845 | separator, entry). If \a ok is not 0: \a *ok is set to TRUE if the |
1769 | key was read, otherwise \a *ok is set to FALSE. | 1846 | key was read, otherwise \a *ok is set to FALSE. |
1770 | 1847 | ||
1848 | \warning As the documentation states, QStringList::split() will | ||
1849 | omit empty strings from the list. Because of this, it is | ||
1850 | impossible to retrieve identical list data with this function. We | ||
1851 | recommend using the readListEntry() and writeEntry() overloads | ||
1852 | that do not take a \a separator argument. | ||
1853 | |||
1854 | |||
1771 | Note that if you want to iterate over the list, you should iterate | 1855 | Note that if you want to iterate over the list, you should iterate |
1772 | over a copy, e.g. | 1856 | over a copy, e.g. |
1773 | \code | 1857 | \code |
1774 | QStringList list = mySettings.readListEntry( "size", " " ); | 1858 | QStringList list = mySettings.readListEntry( "size", " " ); |
1775 | QStringList::Iterator it = list.begin(); | 1859 | QStringList::Iterator it = list.begin(); |
1776 | while( it != list.end() ) { | 1860 | while( it != list.end() ) { |
1777 | myProcessing( *it ); | 1861 | myProcessing( *it ); |
1778 | ++it; | 1862 | ++it; |
1779 | } | 1863 | } |
1780 | \endcode | 1864 | \endcode |
1781 | 1865 | ||
1782 | \sa readEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry(), QStringList::split() | 1866 | \sa readEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry(), QStringList::split() |
1783 | */ | 1867 | */ |
1784 | 1868 | ||
1785 | /*! | 1869 | /*! |
1786 | \internal | 1870 | \internal |
@@ -1834,97 +1918,118 @@ QStringList QSettings::readListEntry(const QString &key, bool *ok ) | |||
1834 | s=QString::null; | 1918 | s=QString::null; |
1835 | } else { | 1919 | } else { |
1836 | s.append(value[i]); | 1920 | s.append(value[i]); |
1837 | } | 1921 | } |
1838 | esc=FALSE; | 1922 | esc=FALSE; |
1839 | } else if ( value[i] == '^' ) { | 1923 | } else if ( value[i] == '^' ) { |
1840 | esc = TRUE; | 1924 | esc = TRUE; |
1841 | } else { | 1925 | } else { |
1842 | s.append(value[i]); | 1926 | s.append(value[i]); |
1843 | if ( i == (int)value.length()-1 ) | 1927 | if ( i == (int)value.length()-1 ) |
1844 | l.append(s); | 1928 | l.append(s); |
1845 | } | 1929 | } |
1846 | } | 1930 | } |
1847 | return l; | 1931 | return l; |
1848 | } | 1932 | } |
1849 | 1933 | ||
1934 | #ifdef Q_OS_MAC | ||
1935 | void qt_setSettingsBasePath(const QString &); //qsettings_mac.cpp | ||
1936 | #endif | ||
1937 | |||
1850 | /*! | 1938 | /*! |
1851 | Insert platform-dependent paths from platform-independent information. | 1939 | Insert platform-dependent paths from platform-independent information. |
1940 | |||
1941 | The \a domain should be an Internet domain name | ||
1942 | controlled by the producer of the software, eg. Trolltech products | ||
1943 | use "trolltech.com". | ||
1852 | 1944 | ||
1853 | The \a domain should be an Internet domain name | 1945 | The \a product should be the official name of the product. |
1854 | controlled by the producer of the software, eg. Trolltech products | ||
1855 | use "trolltech.com". | ||
1856 | 1946 | ||
1857 | The \a product should be the official name of the product. | 1947 | The \a scope should be |
1948 | QSettings::User for user-specific settings, or | ||
1949 | QSettings::Global for system-wide settings (generally | ||
1950 | these will be read-only to many users). | ||
1858 | 1951 | ||
1859 | The \a scope should be | 1952 | Not all information is relevant on all systems (e.g. scoping is |
1860 | QSettings::User for user-specific settings, or | 1953 | currently used only if QSettings accesses the Windows registry). |
1861 | QSettings::Global for system-wide settings (generally | ||
1862 | these will be read-only to many users). | ||
1863 | */ | 1954 | */ |
1864 | 1955 | ||
1865 | void QSettings::setPath( const QString &domain, const QString &product, Scope scope ) | 1956 | void QSettings::setPath( const QString &domain, const QString &product, Scope scope ) |
1866 | { | 1957 | { |
1867 | // On Windows, any trailing ".com(\..*)" is stripped from the domain. The | 1958 | // On Windows, any trailing ".com(\..*)" is stripped from the domain. The |
1868 | // Global scope corresponds to HKEY_LOCAL_MACHINE, and User corresponds to | 1959 | // Global scope corresponds to HKEY_LOCAL_MACHINE, and User corresponds to |
1869 | // HKEY_CURRENT_USER. Note that on some installations, not all users can | 1960 | // HKEY_CURRENT_USER. Note that on some installations, not all users can |
1870 | // write to the Global scope. On UNIX, any trailing ".com(\..*)" is stripped | 1961 | // write to the Global scope. On UNIX, any trailing ".com(\..*)" is stripped |
1871 | // from the domain. The Global scope corresponds to "/opt" (this would be | 1962 | // from the domain. The Global scope corresponds to "/opt" (this would be |
1872 | // configurable at library build time - eg. to "/usr/local" or "/usr"), | 1963 | // configurable at library build time - eg. to "/usr/local" or "/usr"), |
1873 | // while the User scope corresponds to $HOME/.*rc. | 1964 | // while the User scope corresponds to $HOME/.*rc. |
1874 | // Note that on most installations, not all users can write to the System | 1965 | // Note that on most installations, not all users can write to the System |
1875 | // scope. | 1966 | // scope. |
1876 | // | 1967 | // |
1877 | // On MacOS X, if there is no "." in domain, append ".com", then reverse the | 1968 | // On MacOS X, if there is no "." in domain, append ".com", then reverse the |
1878 | // order of the elements (Mac OS uses "com.apple.finder" as domain+product). | 1969 | // order of the elements (Mac OS uses "com.apple.finder" as domain+product). |
1879 | // The Global scope corresponds to /Library/Preferences/*.plist, while the | 1970 | // The Global scope corresponds to /Library/Preferences/*.plist, while the |
1880 | // User scope corresponds to ~/Library/Preferences/*.plist. | 1971 | // User scope corresponds to ~/Library/Preferences/*.plist. |
1881 | // Note that on most installations, not all users can write to the System | 1972 | // Note that on most installations, not all users can write to the System |
1882 | // scope. | 1973 | // scope. |
1974 | d->globalScope = scope == Global; | ||
1975 | |||
1883 | QString actualSearchPath; | 1976 | QString actualSearchPath; |
1884 | int lastDot = domain.findRev( '.' ); | 1977 | int lastDot = domain.findRev( '.' ); |
1885 | 1978 | ||
1886 | #if defined(Q_WS_WIN) | 1979 | #if defined(Q_WS_WIN) |
1887 | actualSearchPath = "/" + domain.mid( 0, lastDot ) + "/" + product; | 1980 | actualSearchPath = "/" + domain.mid( 0, lastDot ) + "/" + product; |
1888 | insertSearchPath( Windows, actualSearchPath ); | 1981 | insertSearchPath( Windows, actualSearchPath ); |
1889 | #elif defined(Q_WS_MAC) | 1982 | #elif !defined(QWS) && defined(Q_OS_MAC) |
1890 | QString topLevelDomain = domain.right( domain.length() - lastDot - 1 ) + "."; | 1983 | QString topLevelDomain = domain.right( domain.length() - lastDot - 1 ) + "."; |
1891 | if ( topLevelDomain.isEmpty() ) | 1984 | if ( !topLevelDomain.isEmpty() ) |
1892 | topLevelDomain = "com."; | 1985 | qt_setSettingsBasePath( topLevelDomain ); |
1893 | actualSearchPath = "/" + topLevelDomain + domain.left( lastDot ) + product; | 1986 | actualSearchPath = "/" + domain.left( lastDot ) + product; |
1894 | insertSearchPath( Mac, actualSearchPath ); | 1987 | insertSearchPath( Mac, actualSearchPath ); |
1895 | #else | 1988 | #else |
1896 | actualSearchPath = "/" + domain.mid( 0, lastDot ) + "/" + product; | 1989 | actualSearchPath = "/" + domain.mid( 0, lastDot ) + "/" + product; |
1897 | insertSearchPath( Unix, actualSearchPath ); | 1990 | insertSearchPath( Unix, actualSearchPath ); |
1898 | #endif | 1991 | #endif |
1899 | |||
1900 | d->globalScope = scope == Global; | ||
1901 | } | 1992 | } |
1902 | 1993 | ||
1903 | /*! | 1994 | /*! |
1904 | Appends \a group to the current key prefix. | 1995 | Appends \a group to the current key prefix. |
1996 | |||
1997 | \code | ||
1998 | QSettings settings; | ||
1999 | settings.beginGroup( "/MainWindow" ); | ||
2000 | // read values | ||
2001 | settings.endGroup(); | ||
2002 | \endcode | ||
1905 | */ | 2003 | */ |
1906 | void QSettings::beginGroup( const QString &group ) | 2004 | void QSettings::beginGroup( const QString &group ) |
1907 | { | 2005 | { |
1908 | d->groupStack.push( group ); | 2006 | d->groupStack.push( group ); |
1909 | d->groupDirty = TRUE; | 2007 | d->groupDirty = TRUE; |
1910 | } | 2008 | } |
1911 | 2009 | ||
1912 | /*! | 2010 | /*! |
1913 | Undo previous calls to beginGroup(). Note that a single beginGroup("a/b/c") is undone | 2011 | Undo previous calls to beginGroup(). Note that a single beginGroup("a/b/c") is undone |
1914 | by a single call to endGroup(). | 2012 | by a single call to endGroup(). |
2013 | |||
2014 | \code | ||
2015 | QSettings settings; | ||
2016 | settings.beginGroup( "/MainWindow/Geometry" ); | ||
2017 | // read values | ||
2018 | settings.endGroup(); | ||
2019 | \endcode | ||
1915 | */ | 2020 | */ |
1916 | void QSettings::endGroup() | 2021 | void QSettings::endGroup() |
1917 | { | 2022 | { |
1918 | d->groupStack.pop(); | 2023 | d->groupStack.pop(); |
1919 | d->groupDirty = TRUE; | 2024 | d->groupDirty = TRUE; |
1920 | } | 2025 | } |
1921 | 2026 | ||
1922 | /*! | 2027 | /*! |
1923 | Set the current key prefix to the empty string. | 2028 | Set the current key prefix to the empty string. |
1924 | */ | 2029 | */ |
1925 | void QSettings::resetGroup() | 2030 | void QSettings::resetGroup() |
1926 | { | 2031 | { |
1927 | d->groupStack.clear(); | 2032 | d->groupStack.clear(); |
1928 | d->groupDirty = FALSE; | 2033 | d->groupDirty = FALSE; |
1929 | d->groupPrefix = QString::null; | 2034 | d->groupPrefix = QString::null; |
1930 | } | 2035 | } |
@@ -1932,24 +2037,24 @@ void QSettings::resetGroup() | |||
1932 | /*! | 2037 | /*! |
1933 | Returns the current key prefix, or a null string if there is no key prefix set. | 2038 | Returns the current key prefix, or a null string if there is no key prefix set. |
1934 | 2039 | ||
1935 | \sa beginGroup(); | 2040 | \sa beginGroup(); |
1936 | */ | 2041 | */ |
1937 | QString QSettings::group() const | 2042 | QString QSettings::group() const |
1938 | { | 2043 | { |
1939 | if ( d->groupDirty ) { | 2044 | if ( d->groupDirty ) { |
1940 | d->groupDirty = FALSE; | 2045 | d->groupDirty = FALSE; |
1941 | d->groupPrefix = QString::null; | 2046 | d->groupPrefix = QString::null; |
1942 | 2047 | ||
1943 | QValueStack<QString>::Iterator it = d->groupStack.begin(); | 2048 | QValueStack<QString>::Iterator it = d->groupStack.begin(); |
1944 | while ( it != d->groupStack.end() ) { | 2049 | while ( it != d->groupStack.end() ) { |
1945 | QString group = *it; | 2050 | QString group = *it; |
1946 | ++it; | 2051 | ++it; |
1947 | if ( group[0] != '/' ) | 2052 | if ( group[0] != '/' ) |
1948 | group = "/" + group; | 2053 | group.prepend( "/" ); |
1949 | d->groupPrefix += group; | 2054 | d->groupPrefix += group; |
1950 | } | 2055 | } |
1951 | } | 2056 | } |
1952 | return d->groupPrefix; | 2057 | return d->groupPrefix; |
1953 | } | 2058 | } |
1954 | 2059 | ||
1955 | #endif | 2060 | #endif |
diff --git a/qmake/tools/qstring.cpp b/qmake/tools/qstring.cpp index 56df62b..7f1fac3 100644 --- a/qmake/tools/qstring.cpp +++ b/qmake/tools/qstring.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of the QString class and related Unicode functions | 4 | ** Implementation of the QString class and related Unicode functions |
5 | ** | 5 | ** |
6 | ** Created : 920722 | 6 | ** Created : 920722 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
@@ -34,44 +34,48 @@ | |||
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | // Don't define it while compiling this module, or USERS of Qt will | 38 | // Don't define it while compiling this module, or USERS of Qt will |
39 | // not be able to link. | 39 | // not be able to link. |
40 | #ifdef QT_NO_CAST_ASCII | 40 | #ifdef QT_NO_CAST_ASCII |
41 | #undef QT_NO_CAST_ASCII | 41 | #undef QT_NO_CAST_ASCII |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #include "qstring.h" | 44 | #include "qstring.h" |
45 | #include "qregexp.h" | 45 | #include "qregexp.h" |
46 | #include "qdatastream.h" | 46 | #include "qdatastream.h" |
47 | #ifndef QT_NO_TEXTCODEC | 47 | #ifndef QT_NO_TEXTCODEC |
48 | #include "qtextcodec.h" | 48 | #include "qtextcodec.h" |
49 | #endif | 49 | #endif |
50 | #include <ctype.h> | ||
51 | #include <limits.h> | 50 | #include <limits.h> |
52 | #include <stdarg.h> | 51 | #include <stdarg.h> |
53 | #include <stdio.h> | 52 | #include <stdio.h> |
54 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | #include <string.h> | ||
55 | #if defined(Q_WS_WIN) | 55 | #if defined(Q_WS_WIN) |
56 | #include "qt_windows.h" | 56 | #include "qt_windows.h" |
57 | #endif | 57 | #endif |
58 | #if !defined( QT_NO_COMPONENT ) && !defined( QT_LITE_COMPONENT ) | 58 | #if !defined( QT_NO_COMPONENT ) && !defined( QT_LITE_COMPONENT ) |
59 | #include "qcleanuphandler.h" | 59 | #include "qcleanuphandler.h" |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #ifdef QT_NO_UNICODETABLES | ||
63 | # include <ctype.h> | ||
64 | #endif | ||
65 | |||
62 | 66 | ||
63 | /* ------------------------------------------------------------------------- | 67 | /* ------------------------------------------------------------------------- |
64 | * unicode information | 68 | * unicode information |
65 | * these tables are generated from the unicode reference file | 69 | * these tables are generated from the unicode reference file |
66 | * ftp://ftp.unicode.org/Public/3.2-Update/UnicodeData.txt | 70 | * ftp://ftp.unicode.org/Public/3.2-Update/UnicodeData.txt |
67 | * | 71 | * |
68 | * Lars | 72 | * Lars |
69 | * ------------------------------------------------------------------------- | 73 | * ------------------------------------------------------------------------- |
70 | */ | 74 | */ |
71 | 75 | ||
72 | /* Perl script to generate (run perl -x tools/qstring.cpp) | 76 | /* Perl script to generate (run perl -x tools/qstring.cpp) |
73 | 77 | ||
74 | #!perl | 78 | #!perl |
75 | 79 | ||
76 | sub numberize | 80 | sub numberize |
77 | { | 81 | { |
@@ -11774,44 +11778,46 @@ static inline QChar upper( const QChar &c ) | |||
11774 | return upper; | 11778 | return upper; |
11775 | #else | 11779 | #else |
11776 | if ( c.row() ) | 11780 | if ( c.row() ) |
11777 | return c; | 11781 | return c; |
11778 | else | 11782 | else |
11779 | return QChar( toupper((uchar) c.latin1()) ); | 11783 | return QChar( toupper((uchar) c.latin1()) ); |
11780 | #endif | 11784 | #endif |
11781 | } | 11785 | } |
11782 | 11786 | ||
11783 | static inline QChar::Direction direction( const QChar &c ) | 11787 | static inline QChar::Direction direction( const QChar &c ) |
11784 | { | 11788 | { |
11785 | #ifndef QT_NO_UNICODETABLES | 11789 | #ifndef QT_NO_UNICODETABLES |
11786 | const Q_UINT8 *rowp = direction_info[c.row()]; | 11790 | const Q_UINT8 *rowp = direction_info[c.row()]; |
11787 | if(!rowp) return QChar::DirL; | 11791 | if(!rowp) return QChar::DirL; |
11788 | return (QChar::Direction) ( *(rowp+c.cell()) & 0x1f ); | 11792 | return (QChar::Direction) ( *(rowp+c.cell()) & 0x1f ); |
11789 | #else | 11793 | #else |
11794 | Q_UNUSED(c); | ||
11790 | return QChar::DirL; | 11795 | return QChar::DirL; |
11791 | #endif | 11796 | #endif |
11792 | } | 11797 | } |
11793 | 11798 | ||
11794 | static inline bool mirrored( const QChar &c ) | 11799 | static inline bool mirrored( const QChar &c ) |
11795 | { | 11800 | { |
11796 | #ifndef QT_NO_UNICODETABLES | 11801 | #ifndef QT_NO_UNICODETABLES |
11797 | const Q_UINT8 *rowp = direction_info[c.row()]; | 11802 | const Q_UINT8 *rowp = direction_info[c.row()]; |
11798 | if ( !rowp ) | 11803 | if ( !rowp ) |
11799 | return FALSE; | 11804 | return FALSE; |
11800 | return *(rowp+c.cell())>128; | 11805 | return *(rowp+c.cell())>128; |
11801 | #else | 11806 | #else |
11807 | Q_UNUSED(c); | ||
11802 | return FALSE; | 11808 | return FALSE; |
11803 | #endif | 11809 | #endif |
11804 | } | 11810 | } |
11805 | 11811 | ||
11806 | #ifndef QT_NO_UNICODETABLES | 11812 | #ifndef QT_NO_UNICODETABLES |
11807 | static const Q_UINT16 symmetricPairs[] = { | 11813 | static const Q_UINT16 symmetricPairs[] = { |
11808 | 0x0028, 0x0029, 0x003C, 0x003E, 0x005B, 0x005D, 0x007B, 0x007D, | 11814 | 0x0028, 0x0029, 0x003C, 0x003E, 0x005B, 0x005D, 0x007B, 0x007D, |
11809 | 0x00AB, 0x00BB, 0x2039, 0x203A, 0x2045, 0x2046, 0x207D, 0x207E, | 11815 | 0x00AB, 0x00BB, 0x2039, 0x203A, 0x2045, 0x2046, 0x207D, 0x207E, |
11810 | 0x208D, 0x208E, 0x2208, 0x220B, 0x2209, 0x220C, 0x220A, 0x220D, | 11816 | 0x208D, 0x208E, 0x2208, 0x220B, 0x2209, 0x220C, 0x220A, 0x220D, |
11811 | 0x2215, 0x29F5, 0x223C, 0x223D, 0x2243, 0x22CD, 0x2252, 0x2253, | 11817 | 0x2215, 0x29F5, 0x223C, 0x223D, 0x2243, 0x22CD, 0x2252, 0x2253, |
11812 | 0x2254, 0x2255, 0x2264, 0x2265, 0x2266, 0x2267, 0x2268, 0x2269, | 11818 | 0x2254, 0x2255, 0x2264, 0x2265, 0x2266, 0x2267, 0x2268, 0x2269, |
11813 | 0x226A, 0x226B, 0x226E, 0x226F, 0x2270, 0x2271, 0x2272, 0x2273, | 11819 | 0x226A, 0x226B, 0x226E, 0x226F, 0x2270, 0x2271, 0x2272, 0x2273, |
11814 | 0x2274, 0x2275, 0x2276, 0x2277, 0x2278, 0x2279, 0x227A, 0x227B, | 11820 | 0x2274, 0x2275, 0x2276, 0x2277, 0x2278, 0x2279, 0x227A, 0x227B, |
11815 | 0x227C, 0x227D, 0x227E, 0x227F, 0x2280, 0x2281, 0x2282, 0x2283, | 11821 | 0x227C, 0x227D, 0x227E, 0x227F, 0x2280, 0x2281, 0x2282, 0x2283, |
11816 | 0x2284, 0x2285, 0x2286, 0x2287, 0x2288, 0x2289, 0x228A, 0x228B, | 11822 | 0x2284, 0x2285, 0x2286, 0x2287, 0x2288, 0x2289, 0x228A, 0x228B, |
11817 | 0x228F, 0x2290, 0x2291, 0x2292, 0x2298, 0x29B8, 0x22A2, 0x22A3, | 11823 | 0x228F, 0x2290, 0x2291, 0x2292, 0x2298, 0x29B8, 0x22A2, 0x22A3, |
@@ -11887,33 +11893,33 @@ static int ucstrncmp( const QChar *a, const QChar *b, int l ) | |||
11887 | } | 11893 | } |
11888 | 11894 | ||
11889 | static int ucstrnicmp( const QChar *a, const QChar *b, int l ) | 11895 | static int ucstrnicmp( const QChar *a, const QChar *b, int l ) |
11890 | { | 11896 | { |
11891 | while ( l-- && ::lower( *a ) == ::lower( *b ) ) | 11897 | while ( l-- && ::lower( *a ) == ::lower( *b ) ) |
11892 | a++,b++; | 11898 | a++,b++; |
11893 | if ( l==-1 ) | 11899 | if ( l==-1 ) |
11894 | return 0; | 11900 | return 0; |
11895 | return ::lower( *a ).unicode() - ::lower( *b ).unicode(); | 11901 | return ::lower( *a ).unicode() - ::lower( *b ).unicode(); |
11896 | } | 11902 | } |
11897 | 11903 | ||
11898 | static uint computeNewMax( uint len ) | 11904 | static uint computeNewMax( uint len ) |
11899 | { | 11905 | { |
11900 | uint newMax = 4; | 11906 | uint newMax = 4; |
11901 | while ( newMax < len ) | 11907 | while ( newMax < len ) |
11902 | newMax *= 2; | 11908 | newMax *= 2; |
11903 | // try to spare some memory | 11909 | // try to save some memory |
11904 | if ( newMax >= 1024 * 1024 && len <= newMax - (newMax >> 2) ) | 11910 | if ( newMax >= 1024 * 1024 && len <= newMax - (newMax >> 2) ) |
11905 | newMax -= newMax >> 2; | 11911 | newMax -= newMax >> 2; |
11906 | return newMax; | 11912 | return newMax; |
11907 | } | 11913 | } |
11908 | 11914 | ||
11909 | /*! | 11915 | /*! |
11910 | \class QCharRef qstring.h | 11916 | \class QCharRef qstring.h |
11911 | \reentrant | 11917 | \reentrant |
11912 | \brief The QCharRef class is a helper class for QString. | 11918 | \brief The QCharRef class is a helper class for QString. |
11913 | 11919 | ||
11914 | \ingroup text | 11920 | \ingroup text |
11915 | 11921 | ||
11916 | When you get an object of type QCharRef, if you can assign to it, | 11922 | When you get an object of type QCharRef, if you can assign to it, |
11917 | the assignment will apply to the character in the string from | 11923 | the assignment will apply to the character in the string from |
11918 | which you got the reference. That is its whole purpose in life. | 11924 | which you got the reference. That is its whole purpose in life. |
11919 | The QCharRef becomes invalid once modifications are made to the | 11925 | The QCharRef becomes invalid once modifications are made to the |
@@ -12878,136 +12884,136 @@ void QString::compose() | |||
12878 | // These macros are used for efficient allocation of QChar strings. | 12884 | // These macros are used for efficient allocation of QChar strings. |
12879 | // IMPORTANT! If you change these, make sure you also change the | 12885 | // IMPORTANT! If you change these, make sure you also change the |
12880 | // "delete unicode" statement in ~QStringData() in qstring.h correspondingly! | 12886 | // "delete unicode" statement in ~QStringData() in qstring.h correspondingly! |
12881 | 12887 | ||
12882 | #define QT_ALLOC_QCHAR_VEC( N ) (QChar*) new char[ sizeof(QChar)*( N ) ] | 12888 | #define QT_ALLOC_QCHAR_VEC( N ) (QChar*) new char[ sizeof(QChar)*( N ) ] |
12883 | #define QT_DELETE_QCHAR_VEC( P ) delete[] ((char*)( P )) | 12889 | #define QT_DELETE_QCHAR_VEC( P ) delete[] ((char*)( P )) |
12884 | 12890 | ||
12885 | 12891 | ||
12886 | /*! | 12892 | /*! |
12887 | This utility function converts the 8-bit string \a ba to Unicode, | 12893 | This utility function converts the 8-bit string \a ba to Unicode, |
12888 | returning the result. | 12894 | returning the result. |
12889 | 12895 | ||
12890 | The caller is responsible for deleting the return value with | 12896 | The caller is responsible for deleting the return value with |
12891 | delete[]. | 12897 | delete[]. |
12892 | */ | 12898 | */ |
12893 | 12899 | ||
12894 | QChar* QString::asciiToUnicode( const QByteArray& ba, uint* len ) | 12900 | QChar* QString::latin1ToUnicode( const QByteArray& ba, uint* len ) |
12895 | { | 12901 | { |
12896 | if ( ba.isNull() ) { | 12902 | if ( ba.isNull() ) { |
12897 | *len = 0; | 12903 | *len = 0; |
12898 | return 0; | 12904 | return 0; |
12899 | } | 12905 | } |
12900 | int l = 0; | 12906 | int l = 0; |
12901 | while ( l < (int)ba.size() && ba[l] ) | 12907 | while ( l < (int)ba.size() && ba[l] ) |
12902 | l++; | 12908 | l++; |
12903 | char* str = ba.data(); | 12909 | char* str = ba.data(); |
12904 | QChar *uc = new QChar[ l ]; // Can't use macro, since function is public | 12910 | QChar *uc = new QChar[ l ]; // Can't use macro, since function is public |
12905 | QChar *result = uc; | 12911 | QChar *result = uc; |
12906 | if ( len ) | 12912 | if ( len ) |
12907 | *len = l; | 12913 | *len = l; |
12908 | while (l--) | 12914 | while (l--) |
12909 | *uc++ = *str++; | 12915 | *uc++ = *str++; |
12910 | return result; | 12916 | return result; |
12911 | } | 12917 | } |
12912 | 12918 | ||
12913 | static QChar* internalAsciiToUnicode( const QByteArray& ba, uint* len ) | 12919 | static QChar* internalLatin1ToUnicode( const QByteArray& ba, uint* len ) |
12914 | { | 12920 | { |
12915 | if ( ba.isNull() ) { | 12921 | if ( ba.isNull() ) { |
12916 | *len = 0; | 12922 | *len = 0; |
12917 | return 0; | 12923 | return 0; |
12918 | } | 12924 | } |
12919 | int l = 0; | 12925 | int l = 0; |
12920 | while ( l < (int)ba.size() && ba[l] ) | 12926 | while ( l < (int)ba.size() && ba[l] ) |
12921 | l++; | 12927 | l++; |
12922 | char* str = ba.data(); | 12928 | char* str = ba.data(); |
12923 | QChar *uc = QT_ALLOC_QCHAR_VEC( l ); | 12929 | QChar *uc = QT_ALLOC_QCHAR_VEC( l ); |
12924 | QChar *result = uc; | 12930 | QChar *result = uc; |
12925 | if ( len ) | 12931 | if ( len ) |
12926 | *len = l; | 12932 | *len = l; |
12927 | while (l--) | 12933 | while (l--) |
12928 | *uc++ = *str++; | 12934 | *uc++ = *str++; |
12929 | return result; | 12935 | return result; |
12930 | } | 12936 | } |
12931 | 12937 | ||
12932 | /*! | 12938 | /*! |
12933 | \overload | 12939 | \overload |
12934 | 12940 | ||
12935 | This utility function converts the '\0'-terminated 8-bit string \a | 12941 | This utility function converts the '\0'-terminated 8-bit string \a |
12936 | str to Unicode, returning the result and setting \a *len to the | 12942 | str to Unicode, returning the result and setting \a *len to the |
12937 | length of the Unicode string. | 12943 | length of the Unicode string. |
12938 | 12944 | ||
12939 | The caller is responsible for deleting the return value with | 12945 | The caller is responsible for deleting the return value with |
12940 | delete[]. | 12946 | delete[]. |
12941 | */ | 12947 | */ |
12942 | 12948 | ||
12943 | QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen ) | 12949 | QChar* QString::latin1ToUnicode( const char *str, uint* len, uint maxlen ) |
12944 | { | 12950 | { |
12945 | QChar* result = 0; | 12951 | QChar* result = 0; |
12946 | uint l = 0; | 12952 | uint l = 0; |
12947 | if ( str ) { | 12953 | if ( str ) { |
12948 | if ( maxlen != (uint)-1 ) { | 12954 | if ( maxlen != (uint)-1 ) { |
12949 | while ( l < maxlen && str[l] ) | 12955 | while ( l < maxlen && str[l] ) |
12950 | l++; | 12956 | l++; |
12951 | } else { | 12957 | } else { |
12952 | // Faster? | 12958 | // Faster? |
12953 | l = qstrlen(str); | 12959 | l = strlen( str ); |
12954 | } | 12960 | } |
12955 | QChar *uc = new QChar[ l ]; // Can't use macro since function is public | 12961 | QChar *uc = new QChar[ l ]; // Can't use macro since function is public |
12956 | result = uc; | 12962 | result = uc; |
12957 | uint i = l; | 12963 | uint i = l; |
12958 | while ( i-- ) | 12964 | while ( i-- ) |
12959 | *uc++ = *str++; | 12965 | *uc++ = *str++; |
12960 | } | 12966 | } |
12961 | if ( len ) | 12967 | if ( len ) |
12962 | *len = l; | 12968 | *len = l; |
12963 | return result; | 12969 | return result; |
12964 | } | 12970 | } |
12965 | 12971 | ||
12966 | static QChar* internalAsciiToUnicode( const char *str, uint* len, | 12972 | static QChar* internalLatin1ToUnicode( const char *str, uint* len, |
12967 | uint maxlen = (uint)-1 ) | 12973 | uint maxlen = (uint)-1 ) |
12968 | { | 12974 | { |
12969 | QChar* result = 0; | 12975 | QChar* result = 0; |
12970 | uint l = 0; | 12976 | uint l = 0; |
12971 | if ( str ) { | 12977 | if ( str ) { |
12972 | if ( maxlen != (uint)-1 ) { | 12978 | if ( maxlen != (uint)-1 ) { |
12973 | while ( l < maxlen && str[l] ) | 12979 | while ( l < maxlen && str[l] ) |
12974 | l++; | 12980 | l++; |
12975 | } else { | 12981 | } else { |
12976 | // Faster? | 12982 | // Faster? |
12977 | l = qstrlen(str); | 12983 | l = strlen( str ); |
12978 | } | 12984 | } |
12979 | QChar *uc = QT_ALLOC_QCHAR_VEC( l ); | 12985 | QChar *uc = QT_ALLOC_QCHAR_VEC( l ); |
12980 | result = uc; | 12986 | result = uc; |
12981 | uint i = l; | 12987 | uint i = l; |
12982 | while ( i-- ) | 12988 | while ( i-- ) |
12983 | *uc++ = *str++; | 12989 | *uc++ = *str++; |
12984 | } | 12990 | } |
12985 | if ( len ) | 12991 | if ( len ) |
12986 | *len = l; | 12992 | *len = l; |
12987 | return result; | 12993 | return result; |
12988 | } | 12994 | } |
12989 | 12995 | ||
12990 | /*! | 12996 | /*! |
12991 | This utility function converts \a l 16-bit characters from \a uc | 12997 | This utility function converts \a l 16-bit characters from \a uc |
12992 | to ASCII, returning a '\0'-terminated string. | 12998 | to ASCII, returning a '\0'-terminated string. |
12993 | 12999 | ||
12994 | The caller is responsible for deleting the resultant string with | 13000 | The caller is responsible for deleting the resultant string with |
12995 | delete[]. | 13001 | delete[]. |
12996 | */ | 13002 | */ |
12997 | char* QString::unicodeToAscii(const QChar *uc, uint l) | 13003 | char* QString::unicodeToLatin1(const QChar *uc, uint l) |
12998 | { | 13004 | { |
12999 | if (!uc) { | 13005 | if (!uc) { |
13000 | return 0; | 13006 | return 0; |
13001 | } | 13007 | } |
13002 | char *a = new char[l+1]; | 13008 | char *a = new char[l+1]; |
13003 | char *result = a; | 13009 | char *result = a; |
13004 | while (l--) { | 13010 | while (l--) { |
13005 | *a++ = (uc->unicode() > 0xff) ? '?' : (char)uc->unicode(); | 13011 | *a++ = (uc->unicode() > 0xff) ? '?' : (char)uc->unicode(); |
13006 | uc++; | 13012 | uc++; |
13007 | } | 13013 | } |
13008 | *a = '\0'; | 13014 | *a = '\0'; |
13009 | return result; | 13015 | return result; |
13010 | } | 13016 | } |
13011 | 13017 | ||
13012 | /***************************************************************************** | 13018 | /***************************************************************************** |
13013 | QString member functions | 13019 | QString member functions |
@@ -13144,127 +13150,100 @@ QT_STATIC_CONST_IMPL QString QString::null; | |||
13144 | QT_STATIC_CONST_IMPL QChar QChar::null; | 13150 | QT_STATIC_CONST_IMPL QChar QChar::null; |
13145 | QT_STATIC_CONST_IMPL QChar QChar::replacement((ushort)0xfffd); | 13151 | QT_STATIC_CONST_IMPL QChar QChar::replacement((ushort)0xfffd); |
13146 | QT_STATIC_CONST_IMPL QChar QChar::byteOrderMark((ushort)0xfeff); | 13152 | QT_STATIC_CONST_IMPL QChar QChar::byteOrderMark((ushort)0xfeff); |
13147 | QT_STATIC_CONST_IMPL QChar QChar::byteOrderSwapped((ushort)0xfffe); | 13153 | QT_STATIC_CONST_IMPL QChar QChar::byteOrderSwapped((ushort)0xfffe); |
13148 | QT_STATIC_CONST_IMPL QChar QChar::nbsp((ushort)0x00a0); | 13154 | QT_STATIC_CONST_IMPL QChar QChar::nbsp((ushort)0x00a0); |
13149 | 13155 | ||
13150 | QStringData* QString::makeSharedNull() | 13156 | QStringData* QString::makeSharedNull() |
13151 | { | 13157 | { |
13152 | QString::shared_null = new QStringData; | 13158 | QString::shared_null = new QStringData; |
13153 | #if defined( Q_OS_MAC ) | 13159 | #if defined( Q_OS_MAC ) |
13154 | QString *that = const_cast<QString *>(&QString::null); | 13160 | QString *that = const_cast<QString *>(&QString::null); |
13155 | that->d = QString::shared_null; | 13161 | that->d = QString::shared_null; |
13156 | #endif | 13162 | #endif |
13157 | return QString::shared_null; | 13163 | return QString::shared_null; |
13158 | } | 13164 | } |
13159 | 13165 | ||
13160 | // Uncomment this to get some useful statistics. | ||
13161 | // #define Q2HELPER(x) x | ||
13162 | |||
13163 | #ifdef Q2HELPER | ||
13164 | static int stat_construct_charstar=0; | ||
13165 | static int stat_construct_charstar_size=0; | ||
13166 | static int stat_construct_null=0; | ||
13167 | static int stat_construct_int=0; | ||
13168 | static int stat_construct_int_size=0; | ||
13169 | static int stat_construct_ba=0; | ||
13170 | static int stat_get_ascii=0; | ||
13171 | static int stat_get_ascii_size=0; | ||
13172 | static int stat_copy_on_write=0; | ||
13173 | static int stat_copy_on_write_size=0; | ||
13174 | static int stat_fast_copy=0; | ||
13175 | Q_EXPORT void qt_qstring_stats() | ||
13176 | { | ||
13177 | qDebug("construct_charstar = %d (%d chars)", stat_construct_charstar, stat_construct_charstar_size); | ||
13178 | qDebug("construct_null = %d", stat_construct_null); | ||
13179 | qDebug("construct_int = %d (%d chars)", stat_construct_int, stat_construct_int_size); | ||
13180 | qDebug("construct_ba = %d", stat_construct_ba); | ||
13181 | qDebug("get_ascii = %d (%d chars)", stat_get_ascii, stat_get_ascii_size); | ||
13182 | qDebug("copy_on_write = %d (%d chars)", stat_copy_on_write, stat_copy_on_write_size); | ||
13183 | qDebug("fast_copy = %d", stat_fast_copy); | ||
13184 | } | ||
13185 | #else | ||
13186 | #define Q2HELPER(x) | ||
13187 | #endif | ||
13188 | |||
13189 | /*! | 13166 | /*! |
13190 | \fn QString::QString() | 13167 | \fn QString::QString() |
13191 | 13168 | ||
13192 | Constructs a null string, i.e. both the length and data pointer | 13169 | Constructs a null string, i.e. both the length and data pointer |
13193 | are 0. | 13170 | are 0. |
13194 | 13171 | ||
13195 | \sa isNull() | 13172 | \sa isNull() |
13196 | */ | 13173 | */ |
13197 | 13174 | ||
13198 | /*! | 13175 | /*! |
13199 | Constructs a string of length one, containing the character \a ch. | 13176 | Constructs a string of length one, containing the character \a ch. |
13200 | */ | 13177 | */ |
13201 | QString::QString( QChar ch ) | 13178 | QString::QString( QChar ch ) |
13202 | { | 13179 | { |
13203 | d = new QStringData( QT_ALLOC_QCHAR_VEC( 1 ), 1, 1 ); | 13180 | d = new QStringData( QT_ALLOC_QCHAR_VEC( 1 ), 1, 1 ); |
13204 | d->unicode[0] = ch; | 13181 | d->unicode[0] = ch; |
13205 | } | 13182 | } |
13206 | 13183 | ||
13207 | /*! | 13184 | /*! |
13208 | Constructs an implicitly shared copy of \a s. This is very fast | 13185 | Constructs an implicitly shared copy of \a s. This is very fast |
13209 | since it only involves incrementing a reference count. | 13186 | since it only involves incrementing a reference count. |
13210 | */ | 13187 | */ |
13211 | QString::QString( const QString &s ) : | 13188 | QString::QString( const QString &s ) : |
13212 | d(s.d) | 13189 | d(s.d) |
13213 | { | 13190 | { |
13214 | Q2HELPER(stat_fast_copy++) | ||
13215 | d->ref(); | 13191 | d->ref(); |
13216 | } | 13192 | } |
13217 | 13193 | ||
13218 | /*! | 13194 | /*! |
13219 | \internal | 13195 | \internal |
13220 | 13196 | ||
13221 | Private function. | 13197 | Private function. |
13222 | 13198 | ||
13223 | Constructs a string with preallocated space for \a size characters. | 13199 | Constructs a string with preallocated space for \a size characters. |
13224 | 13200 | ||
13225 | The string is empty. | 13201 | The string is empty. |
13226 | 13202 | ||
13227 | \sa isNull() | 13203 | \sa isNull() |
13228 | */ | 13204 | */ |
13229 | 13205 | ||
13230 | QString::QString( int size, bool /*dummy*/ ) | 13206 | QString::QString( int size, bool /*dummy*/ ) |
13231 | { | 13207 | { |
13232 | if ( size ) { | 13208 | if ( size ) { |
13233 | Q2HELPER(stat_construct_int++) | ||
13234 | int l = size; | 13209 | int l = size; |
13235 | Q2HELPER(stat_construct_int_size+=l) | ||
13236 | QChar* uc = QT_ALLOC_QCHAR_VEC( l ); | 13210 | QChar* uc = QT_ALLOC_QCHAR_VEC( l ); |
13237 | d = new QStringData( uc, 0, l ); | 13211 | d = new QStringData( uc, 0, l ); |
13238 | } else { | 13212 | } else { |
13239 | Q2HELPER(stat_construct_null++) | ||
13240 | d = shared_null ? shared_null : (shared_null=new QStringData); | 13213 | d = shared_null ? shared_null : (shared_null=new QStringData); |
13241 | d->ref(); | 13214 | d->ref(); |
13242 | } | 13215 | } |
13243 | } | 13216 | } |
13244 | 13217 | ||
13245 | /*! | 13218 | /*! |
13246 | Constructs a string that is a deep copy of \a ba interpreted as a | 13219 | Constructs a string that is a deep copy of \a ba interpreted as a |
13247 | classic C string. | 13220 | classic C string. |
13248 | */ | 13221 | */ |
13249 | 13222 | ||
13250 | QString::QString( const QByteArray& ba ) | 13223 | QString::QString( const QByteArray& ba ) |
13251 | { | 13224 | { |
13252 | Q2HELPER(stat_construct_ba++) | 13225 | #ifndef QT_NO_TEXTCODEC |
13226 | if ( QTextCodec::codecForCStrings() ) { | ||
13227 | d = 0; | ||
13228 | *this = fromAscii( ba.data(), ba.size() ); | ||
13229 | return; | ||
13230 | } | ||
13231 | #endif | ||
13253 | uint l; | 13232 | uint l; |
13254 | QChar *uc = internalAsciiToUnicode(ba,&l); | 13233 | QChar *uc = internalLatin1ToUnicode(ba,&l); |
13255 | d = new QStringData(uc,l,l); | 13234 | d = new QStringData(uc,l,l); |
13256 | } | 13235 | } |
13257 | 13236 | ||
13258 | /*! | 13237 | /*! |
13259 | Constructs a string that is a deep copy of the first \a length | 13238 | Constructs a string that is a deep copy of the first \a length |
13260 | characters in the QChar array. | 13239 | characters in the QChar array. |
13261 | 13240 | ||
13262 | If \a unicode and \a length are 0, then a null string is created. | 13241 | If \a unicode and \a length are 0, then a null string is created. |
13263 | 13242 | ||
13264 | If only \a unicode is 0, the string is empty but has \a length | 13243 | If only \a unicode is 0, the string is empty but has \a length |
13265 | characters of space preallocated: QString expands automatically | 13244 | characters of space preallocated: QString expands automatically |
13266 | anyway, but this may speed up some cases a little. We recommend | 13245 | anyway, but this may speed up some cases a little. We recommend |
13267 | using the plain constructor and setLength() for this purpose since | 13246 | using the plain constructor and setLength() for this purpose since |
13268 | it will result in more readable code. | 13247 | it will result in more readable code. |
13269 | 13248 | ||
13270 | \sa isNull() setLength() | 13249 | \sa isNull() setLength() |
@@ -13289,130 +13268,165 @@ QString::QString( const QChar* unicode, uint length ) | |||
13289 | 13268 | ||
13290 | If \a str is 0, then a null string is created. | 13269 | If \a str is 0, then a null string is created. |
13291 | 13270 | ||
13292 | This is a cast constructor, but it is perfectly safe: converting a | 13271 | This is a cast constructor, but it is perfectly safe: converting a |
13293 | Latin1 const char* to QString preserves all the information. You | 13272 | Latin1 const char* to QString preserves all the information. You |
13294 | can disable this constructor by defining \c QT_NO_CAST_ASCII when | 13273 | can disable this constructor by defining \c QT_NO_CAST_ASCII when |
13295 | you compile your applications. You can also make QString objects | 13274 | you compile your applications. You can also make QString objects |
13296 | by using setLatin1(), fromLatin1(), fromLocal8Bit(), and | 13275 | by using setLatin1(), fromLatin1(), fromLocal8Bit(), and |
13297 | fromUtf8(). Or whatever encoding is appropriate for the 8-bit data | 13276 | fromUtf8(). Or whatever encoding is appropriate for the 8-bit data |
13298 | you have. | 13277 | you have. |
13299 | 13278 | ||
13300 | \sa isNull() | 13279 | \sa isNull() |
13301 | */ | 13280 | */ |
13302 | 13281 | ||
13303 | QString::QString( const char *str ) | 13282 | QString::QString( const char *str ) |
13304 | { | 13283 | { |
13305 | Q2HELPER(stat_construct_charstar++) | 13284 | #ifndef QT_NO_TEXTCODEC |
13285 | if ( QTextCodec::codecForCStrings() ) { | ||
13286 | d = 0; | ||
13287 | *this = fromAscii( str ); | ||
13288 | return; | ||
13289 | } | ||
13290 | #endif | ||
13291 | uint l; | ||
13292 | QChar *uc = internalLatin1ToUnicode(str,&l); | ||
13293 | d = new QStringData(uc,l,l); | ||
13294 | } | ||
13295 | |||
13296 | #ifndef QT_NO_STL | ||
13297 | /*! | ||
13298 | Constructs a string that is a deep copy of \a str. | ||
13299 | |||
13300 | This is the same as fromAscii(\a str). | ||
13301 | */ | ||
13302 | |||
13303 | QString::QString( const std::string &str ) | ||
13304 | { | ||
13305 | #ifndef QT_NO_TEXTCODEC | ||
13306 | if ( QTextCodec::codecForCStrings() ) { | ||
13307 | d = 0; | ||
13308 | *this = fromAscii( str.c_str() ); | ||
13309 | return; | ||
13310 | } | ||
13311 | #endif | ||
13306 | uint l; | 13312 | uint l; |
13307 | QChar *uc = internalAsciiToUnicode(str,&l); | 13313 | QChar *uc = internalLatin1ToUnicode(str.c_str(),&l); |
13308 | Q2HELPER(stat_construct_charstar_size+=l) | ||
13309 | d = new QStringData(uc,l,l); | 13314 | d = new QStringData(uc,l,l); |
13310 | } | 13315 | } |
13316 | #endif | ||
13311 | 13317 | ||
13312 | /*! | 13318 | /*! |
13313 | \fn QString::~QString() | 13319 | \fn QString::~QString() |
13314 | 13320 | ||
13315 | Destroys the string and frees the string's data if this is the | 13321 | Destroys the string and frees the string's data if this is the |
13316 | last reference to the string. | 13322 | last reference to the string. |
13317 | */ | 13323 | */ |
13318 | 13324 | ||
13319 | 13325 | ||
13320 | /*! | 13326 | /*! |
13321 | Deallocates any space reserved solely by this QString. | 13327 | Deallocates any space reserved solely by this QString. |
13322 | 13328 | ||
13323 | If the string does not share its data with another QString | 13329 | If the string does not share its data with another QString |
13324 | instance, nothing happens; otherwise the function creates a new, | 13330 | instance, nothing happens; otherwise the function creates a new, |
13325 | unique copy of this string. This function is called whenever the | 13331 | unique copy of this string. This function is called whenever the |
13326 | string is modified. | 13332 | string is modified. |
13327 | */ | 13333 | */ |
13328 | 13334 | ||
13329 | void QString::real_detach() | 13335 | void QString::real_detach() |
13330 | { | 13336 | { |
13331 | setLength( length() ); | 13337 | setLength( length() ); |
13332 | } | 13338 | } |
13333 | 13339 | ||
13334 | void QString::deref() | 13340 | void QString::deref() |
13335 | { | 13341 | { |
13336 | if ( d->deref() ) { | 13342 | if ( d && d->deref() ) { |
13337 | if ( d != shared_null ) | 13343 | if ( d != shared_null ) |
13338 | delete d; | 13344 | delete d; |
13339 | d = 0; // helps debugging | 13345 | d = 0; |
13340 | } | 13346 | } |
13341 | } | 13347 | } |
13342 | 13348 | ||
13343 | void QStringData::deleteSelf() | 13349 | void QStringData::deleteSelf() |
13344 | { | 13350 | { |
13345 | delete this; | 13351 | delete this; |
13346 | } | 13352 | } |
13347 | 13353 | ||
13348 | /*! | 13354 | /*! |
13349 | \fn QString& QString::operator=( QChar c ) | 13355 | \fn QString& QString::operator=( QChar c ) |
13350 | 13356 | ||
13351 | Sets the string to contain just the single character \a c. | 13357 | Sets the string to contain just the single character \a c. |
13352 | */ | 13358 | */ |
13353 | 13359 | ||
13354 | /*! | 13360 | /*! |
13361 | \fn QString& QString::operator=( const std::string& s ) | ||
13362 | |||
13363 | \overload | ||
13364 | |||
13365 | Makes a deep copy of \a s and returns a reference to the deep | ||
13366 | copy. | ||
13367 | */ | ||
13368 | |||
13369 | /*! | ||
13355 | \fn QString& QString::operator=( char c ) | 13370 | \fn QString& QString::operator=( char c ) |
13356 | 13371 | ||
13357 | \overload | 13372 | \overload |
13358 | 13373 | ||
13359 | Sets the string to contain just the single character \a c. | 13374 | Sets the string to contain just the single character \a c. |
13360 | */ | 13375 | */ |
13361 | 13376 | ||
13362 | /*! | 13377 | /*! |
13363 | \overload | 13378 | \overload |
13364 | 13379 | ||
13365 | Assigns a shallow copy of \a s to this string and returns a | 13380 | Assigns a shallow copy of \a s to this string and returns a |
13366 | reference to this string. This is very fast because the string | 13381 | reference to this string. This is very fast because the string |
13367 | isn't actually copied. | 13382 | isn't actually copied. |
13368 | */ | 13383 | */ |
13369 | QString &QString::operator=( const QString &s ) | 13384 | QString &QString::operator=( const QString &s ) |
13370 | { | 13385 | { |
13371 | Q2HELPER(stat_fast_copy++) | ||
13372 | s.d->ref(); | 13386 | s.d->ref(); |
13373 | deref(); | 13387 | deref(); |
13374 | d = s.d; | 13388 | d = s.d; |
13375 | return *this; | 13389 | return *this; |
13376 | } | 13390 | } |
13377 | 13391 | ||
13378 | /*! | 13392 | /*! |
13379 | \overload | 13393 | \overload |
13380 | 13394 | ||
13381 | Assigns a deep copy of \a cs, interpreted as a classic C string, | 13395 | Assigns a deep copy of \a cs, interpreted as a classic C string, |
13382 | to this string and returns a reference to this string. | 13396 | to this string and returns a reference to this string. |
13383 | */ | 13397 | */ |
13384 | QString &QString::operator=( const QCString& cs ) | 13398 | QString &QString::operator=( const QCString& cs ) |
13385 | { | 13399 | { |
13386 | return setLatin1(cs); | 13400 | return setAscii(cs); |
13387 | } | 13401 | } |
13388 | 13402 | ||
13389 | 13403 | ||
13390 | /*! | 13404 | /*! |
13391 | \overload | 13405 | \overload |
13392 | 13406 | ||
13393 | Assigns a deep copy of \a str, interpreted as a classic C string | 13407 | Assigns a deep copy of \a str, interpreted as a classic C string |
13394 | to this string and returns a reference to this string. | 13408 | to this string and returns a reference to this string. |
13395 | 13409 | ||
13396 | If \a str is 0, then a null string is created. | 13410 | If \a str is 0, then a null string is created. |
13397 | 13411 | ||
13398 | \sa isNull() | 13412 | \sa isNull() |
13399 | */ | 13413 | */ |
13400 | QString &QString::operator=( const char *str ) | 13414 | QString &QString::operator=( const char *str ) |
13401 | { | 13415 | { |
13402 | return setLatin1(str); | 13416 | return setAscii(str); |
13403 | } | 13417 | } |
13404 | 13418 | ||
13405 | 13419 | ||
13406 | /*! | 13420 | /*! |
13407 | \fn bool QString::isNull() const | 13421 | \fn bool QString::isNull() const |
13408 | 13422 | ||
13409 | Returns TRUE if the string is null; otherwise returns FALSE. A | 13423 | Returns TRUE if the string is null; otherwise returns FALSE. A |
13410 | null string is always empty. | 13424 | null string is always empty. |
13411 | 13425 | ||
13412 | \code | 13426 | \code |
13413 | QString a; // a.unicode() == 0, a.length() == 0 | 13427 | QString a; // a.unicode() == 0, a.length() == 0 |
13414 | a.isNull(); // TRUE, because a.unicode() == 0 | 13428 | a.isNull(); // TRUE, because a.unicode() == 0 |
13415 | a.isEmpty(); // TRUE | 13429 | a.isEmpty(); // TRUE |
13416 | \endcode | 13430 | \endcode |
13417 | 13431 | ||
13418 | \sa isEmpty(), length() | 13432 | \sa isEmpty(), length() |
@@ -13458,106 +13472,102 @@ QString &QString::operator=( const char *str ) | |||
13458 | \endcode | 13472 | \endcode |
13459 | 13473 | ||
13460 | \sa setLength() | 13474 | \sa setLength() |
13461 | */ | 13475 | */ |
13462 | 13476 | ||
13463 | void QString::truncate( uint newLen ) | 13477 | void QString::truncate( uint newLen ) |
13464 | { | 13478 | { |
13465 | if ( newLen < d->len ) | 13479 | if ( newLen < d->len ) |
13466 | setLength( newLen ); | 13480 | setLength( newLen ); |
13467 | } | 13481 | } |
13468 | 13482 | ||
13469 | /*! | 13483 | /*! |
13470 | Ensures that at least \a newLen characters are allocated to the | 13484 | Ensures that at least \a newLen characters are allocated to the |
13471 | string, and sets the length of the string to \a newLen. Any new | 13485 | string, and sets the length of the string to \a newLen. Any new |
13472 | space allocated contains arbitrary data. | 13486 | space allocated contains arbitrary data. |
13473 | 13487 | ||
13474 | If \a newLen is 0, then the string becomes empty, unless the | 13488 | If \a newLen is 0, then the string becomes empty (non-null). |
13475 | string is null, in which case it remains null. | ||
13476 | 13489 | ||
13477 | If it is not possible to allocate enough memory, the string | 13490 | If it is not possible to allocate enough memory, the string |
13478 | remains unchanged. | 13491 | remains unchanged. |
13479 | 13492 | ||
13480 | This function always detaches the string from other references to | 13493 | This function always detaches the string from other references to |
13481 | the same data. | 13494 | the same data. |
13482 | 13495 | ||
13483 | This function is useful for code that needs to build up a long | 13496 | This function is useful for code that needs to build up a long |
13484 | string and wants to avoid repeated reallocation. In this example, | 13497 | string and wants to avoid repeated reallocation. In this example, |
13485 | we want to add to the string until some condition is true, and | 13498 | we want to add to the string until some condition is true, and |
13486 | we're fairly sure that size is big enough: | 13499 | we're fairly sure that size is big enough: |
13487 | \code | 13500 | \code |
13488 | QString result; | 13501 | QString result; |
13489 | int resultLength = 0; | 13502 | int len = 0; |
13490 | result.setLength( newLen ) // allocate some space | 13503 | result.setLength( maxLen ); // allocate some space |
13491 | while ( ... ) { | 13504 | while ( ... ) { |
13492 | result[resultLength++] = ... // fill (part of) the space with data | 13505 | result[len++] = ... // fill part of the space |
13493 | } | 13506 | } |
13494 | result.truncate[resultLength]; // and get rid of the undefined junk | 13507 | result.truncate( len ); // and get rid of the rest |
13495 | \endcode | 13508 | \endcode |
13496 | 13509 | ||
13497 | If \a newLen is an underestimate, the worst that will happen is | 13510 | If \a newLen is an underestimate, the worst that will happen is |
13498 | that the loop will slow down. | 13511 | that the loop will slow down. |
13499 | 13512 | ||
13500 | \sa truncate(), isNull(), isEmpty(), length() | 13513 | \sa truncate(), isNull(), isEmpty(), length() |
13501 | */ | 13514 | */ |
13502 | 13515 | ||
13503 | void QString::setLength( uint newLen ) | 13516 | void QString::setLength( uint newLen ) |
13504 | { | 13517 | { |
13505 | if ( d->count != 1 || newLen > d->maxl || | 13518 | if ( d->count != 1 || newLen > d->maxl || |
13506 | ( newLen * 4 < d->maxl && d->maxl > 4 ) ) { | 13519 | ( newLen * 4 < d->maxl && d->maxl > 4 ) ) { |
13507 | // detach, grow or shrink | 13520 | // detach, grow or shrink |
13508 | Q2HELPER(stat_copy_on_write++) | ||
13509 | Q2HELPER(stat_copy_on_write_size+=d->len) | ||
13510 | uint newMax = computeNewMax( newLen ); | 13521 | uint newMax = computeNewMax( newLen ); |
13511 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); | 13522 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); |
13512 | if ( nd ) { | 13523 | if ( nd ) { |
13513 | uint len = QMIN( d->len, newLen ); | 13524 | uint len = QMIN( d->len, newLen ); |
13514 | if ( d->unicode ) | 13525 | if ( d->unicode ) |
13515 | memcpy( nd, d->unicode, sizeof(QChar)*len ); | 13526 | memcpy( nd, d->unicode, sizeof(QChar)*len ); |
13516 | deref(); | 13527 | deref(); |
13517 | d = new QStringData( nd, newLen, newMax ); | 13528 | d = new QStringData( nd, newLen, newMax ); |
13518 | } | 13529 | } |
13519 | } else { | 13530 | } else { |
13520 | d->len = newLen; | 13531 | d->len = newLen; |
13521 | d->setDirty(); | 13532 | d->setDirty(); |
13522 | } | 13533 | } |
13523 | } | 13534 | } |
13524 | 13535 | ||
13525 | /*! | 13536 | /*! |
13526 | This function will return a string that replaces the lowest | 13537 | This function will return a string that replaces the lowest |
13527 | numbered occurrence of \c %1, \c %2, ..., \c %9 with \a a. | 13538 | numbered occurrence of \c %1, \c %2, ..., \c %9 with \a a. |
13528 | 13539 | ||
13529 | The \a fieldwidth value specifies the minimum amount of space that | 13540 | The \a fieldwidth value specifies the minimum amount of space that |
13530 | \a a is padded to. A positive value will produce right-aligned | 13541 | \a a is padded to. A positive value will produce right-aligned |
13531 | text, whereas a negative value will produce left-aligned text. | 13542 | text, whereas a negative value will produce left-aligned text. |
13532 | 13543 | ||
13544 | The following example shows how we could create a 'status' string | ||
13545 | when processing a list of files: | ||
13533 | \code | 13546 | \code |
13534 | QString firstName( "Joe" ); | 13547 | QString status = QString( "Processing file %1 of %2: %3" ) |
13535 | QString lastName( "Bloggs" ); | 13548 | .arg( i ) // current file's number |
13536 | QString fullName; | 13549 | .arg( total ) // number of files to process |
13537 | fullName = QString( "First name is '%1', last name is '%2'" ) | 13550 | .arg( fileName ); // current file's name |
13538 | .arg( firstName ) | ||
13539 | .arg( lastName ); | ||
13540 | |||
13541 | // fullName == First name is 'Joe', last name is 'Bloggs' | ||
13542 | \endcode | 13551 | \endcode |
13543 | 13552 | ||
13544 | Note that using arg() to construct sentences as we've done in the | 13553 | It is generally fine to use filenames and numbers as we have done |
13545 | example above does not usually translate well into other languages | 13554 | in the example above. But note that using arg() to construct |
13546 | because sentence structure and word order often differ between | 13555 | natural language sentences does not usually translate well into |
13547 | languages. | 13556 | other languages because sentence structure and word order often |
13557 | differ between languages. | ||
13548 | 13558 | ||
13549 | If there is no place marker (\c %1 or \c %2, etc.), a warning | 13559 | If there is no place marker (\c %1 or \c %2, etc.), a warning |
13550 | message (qWarning()) is output and the text is appended at the | 13560 | message (qWarning()) is output and the text is appended at the |
13551 | end of the string. We recommend that the correct number of place | 13561 | end of the string. We recommend that the correct number of place |
13552 | markers is always used in production code. | 13562 | markers is always used in production code. |
13553 | */ | 13563 | */ |
13554 | QString QString::arg( const QString& a, int fieldwidth ) const | 13564 | QString QString::arg( const QString& a, int fieldwidth ) const |
13555 | { | 13565 | { |
13556 | int pos, len; | 13566 | int pos, len; |
13557 | QString r = *this; | 13567 | QString r = *this; |
13558 | 13568 | ||
13559 | if ( !findArg( pos, len ) ) { | 13569 | if ( !findArg( pos, len ) ) { |
13560 | qWarning( "QString::arg(): Argument missing: %s, %s", | 13570 | qWarning( "QString::arg(): Argument missing: %s, %s", |
13561 | latin1(), a.latin1() ); | 13571 | latin1(), a.latin1() ); |
13562 | // Make sure the text at least appears SOMEWHERE | 13572 | // Make sure the text at least appears SOMEWHERE |
13563 | r += ' '; | 13573 | r += ' '; |
@@ -13761,33 +13771,33 @@ bool QString::findArg( int& pos, int& len ) const | |||
13761 | Unicode support. | 13771 | Unicode support. |
13762 | 13772 | ||
13763 | \sa arg() | 13773 | \sa arg() |
13764 | */ | 13774 | */ |
13765 | 13775 | ||
13766 | #ifndef QT_NO_SPRINTF | 13776 | #ifndef QT_NO_SPRINTF |
13767 | QString &QString::sprintf( const char* cformat, ... ) | 13777 | QString &QString::sprintf( const char* cformat, ... ) |
13768 | { | 13778 | { |
13769 | va_list ap; | 13779 | va_list ap; |
13770 | va_start( ap, cformat ); | 13780 | va_start( ap, cformat ); |
13771 | 13781 | ||
13772 | if ( !cformat || !*cformat ) { | 13782 | if ( !cformat || !*cformat ) { |
13773 | // Qt 1.x compat | 13783 | // Qt 1.x compat |
13774 | *this = fromLatin1( "" ); | 13784 | *this = fromLatin1( "" ); |
13775 | return *this; | 13785 | return *this; |
13776 | } | 13786 | } |
13777 | QString format = fromLatin1( cformat ); | 13787 | QString format = fromAscii( cformat ); |
13778 | 13788 | ||
13779 | QRegExp escape( "%#?0?-? ?\\+?'?[0-9*]*\\.?[0-9*]*h?l?L?q?Z?" ); | 13789 | QRegExp escape( "%#?0?-? ?\\+?'?[0-9*]*\\.?[0-9*]*h?l?L?q?Z?" ); |
13780 | QString result; | 13790 | QString result; |
13781 | uint last = 0; | 13791 | uint last = 0; |
13782 | int pos; | 13792 | int pos; |
13783 | int len = 0; | 13793 | int len = 0; |
13784 | 13794 | ||
13785 | for (;;) { | 13795 | for (;;) { |
13786 | pos = escape.search( format, last ); | 13796 | pos = escape.search( format, last ); |
13787 | len = escape.matchedLength(); | 13797 | len = escape.matchedLength(); |
13788 | // Non-escaped text | 13798 | // Non-escaped text |
13789 | if ( pos > (int)last ) | 13799 | if ( pos > (int)last ) |
13790 | result += format.mid( last, pos - last ); | 13800 | result += format.mid( last, pos - last ); |
13791 | if ( pos < 0 ) { | 13801 | if ( pos < 0 ) { |
13792 | // The rest | 13802 | // The rest |
13793 | if ( last < format.length() ) | 13803 | if ( last < format.length() ) |
@@ -13900,33 +13910,33 @@ QString &QString::sprintf( const char* cformat, ... ) | |||
13900 | break; | 13910 | break; |
13901 | case 'p': | 13911 | case 'p': |
13902 | { | 13912 | { |
13903 | void* value = va_arg( ap, void * ); | 13913 | void* value = va_arg( ap, void * ); |
13904 | switch ( params ) { | 13914 | switch ( params ) { |
13905 | case 0: | 13915 | case 0: |
13906 | ::sprintf( out, in, value ); | 13916 | ::sprintf( out, in, value ); |
13907 | break; | 13917 | break; |
13908 | case 1: | 13918 | case 1: |
13909 | ::sprintf( out, in, width, value ); | 13919 | ::sprintf( out, in, width, value ); |
13910 | break; | 13920 | break; |
13911 | case 2: | 13921 | case 2: |
13912 | ::sprintf( out, in, width, decimals, value ); | 13922 | ::sprintf( out, in, width, decimals, value ); |
13913 | } | 13923 | } |
13914 | } | 13924 | } |
13915 | } | 13925 | } |
13916 | replacement = fromLatin1( out ); | 13926 | replacement = fromAscii( out ); |
13917 | } | 13927 | } |
13918 | result += replacement; | 13928 | result += replacement; |
13919 | } | 13929 | } |
13920 | *this = result; | 13930 | *this = result; |
13921 | 13931 | ||
13922 | va_end( ap ); | 13932 | va_end( ap ); |
13923 | return *this; | 13933 | return *this; |
13924 | } | 13934 | } |
13925 | #endif | 13935 | #endif |
13926 | 13936 | ||
13927 | /*! | 13937 | /*! |
13928 | Fills the string with \a len characters of value \a c, and returns | 13938 | Fills the string with \a len characters of value \a c, and returns |
13929 | a reference to the string. | 13939 | a reference to the string. |
13930 | 13940 | ||
13931 | If \a len is negative (the default), the current string length is | 13941 | If \a len is negative (the default), the current string length is |
13932 | used. | 13942 | used. |
@@ -14111,34 +14121,36 @@ static int bm_find( const QString &str, int index, const QString &pattern, uint | |||
14111 | search is case insensitive. | 14121 | search is case insensitive. |
14112 | 14122 | ||
14113 | Returns the position of \a str or -1 if \a str could not be found. | 14123 | Returns the position of \a str or -1 if \a str could not be found. |
14114 | */ | 14124 | */ |
14115 | 14125 | ||
14116 | int QString::find( const QString& str, int index, bool cs ) const | 14126 | int QString::find( const QString& str, int index, bool cs ) const |
14117 | { | 14127 | { |
14118 | const uint l = length(); | 14128 | const uint l = length(); |
14119 | const uint sl = str.length(); | 14129 | const uint sl = str.length(); |
14120 | if ( index < 0 ) | 14130 | if ( index < 0 ) |
14121 | index += l; | 14131 | index += l; |
14122 | if ( sl + index > l ) | 14132 | if ( sl + index > l ) |
14123 | return -1; | 14133 | return -1; |
14124 | if ( !sl ) | 14134 | if ( !sl ) |
14125 | return index; | 14135 | return index; |
14126 | 14136 | ||
14137 | #ifndef MACOSX_101 | ||
14127 | if ( sl == 1 ) | 14138 | if ( sl == 1 ) |
14128 | return find( *str.unicode(), index, cs ); | 14139 | return find( *str.unicode(), index, cs ); |
14140 | #endif | ||
14129 | 14141 | ||
14130 | // we use the Boyer-Moore algorithm in cases where the overhead | 14142 | // we use the Boyer-Moore algorithm in cases where the overhead |
14131 | // for the hash table should pay off, otherwise we use a simple | 14143 | // for the hash table should pay off, otherwise we use a simple |
14132 | // hash function | 14144 | // hash function |
14133 | if ( l > 500 && sl > 5 ) { | 14145 | if ( l > 500 && sl > 5 ) { |
14134 | uint skiptable[0x100]; | 14146 | uint skiptable[0x100]; |
14135 | bm_init_skiptable( str, skiptable, cs ); | 14147 | bm_init_skiptable( str, skiptable, cs ); |
14136 | return bm_find( *this, index, str, skiptable, cs ); | 14148 | return bm_find( *this, index, str, skiptable, cs ); |
14137 | } | 14149 | } |
14138 | 14150 | ||
14139 | /* | 14151 | /* |
14140 | We use some hashing for efficiency's sake. Instead of | 14152 | We use some hashing for efficiency's sake. Instead of |
14141 | comparing strings, we compare the hash value of str with that of | 14153 | comparing strings, we compare the hash value of str with that of |
14142 | a part of this QString. Only if that matches, we call ucstrncmp | 14154 | a part of this QString. Only if that matches, we call ucstrncmp |
14143 | or ucstrnicmp. | 14155 | or ucstrnicmp. |
14144 | */ | 14156 | */ |
@@ -14208,48 +14220,52 @@ int QString::find( const QString& str, int index, bool cs ) const | |||
14208 | search starts at the last character, if it is -2, at the next to | 14220 | search starts at the last character, if it is -2, at the next to |
14209 | last character and so on. | 14221 | last character and so on. |
14210 | 14222 | ||
14211 | Returns the position of \a c or -1 if \a c could not be found. | 14223 | Returns the position of \a c or -1 if \a c could not be found. |
14212 | 14224 | ||
14213 | If \a cs is TRUE, the search is case sensitive; otherwise the | 14225 | If \a cs is TRUE, the search is case sensitive; otherwise the |
14214 | search is case insensitive. | 14226 | search is case insensitive. |
14215 | 14227 | ||
14216 | \code | 14228 | \code |
14217 | QString string( "bananas" ); | 14229 | QString string( "bananas" ); |
14218 | int i = string.findRev( 'a' ); // i == 5 | 14230 | int i = string.findRev( 'a' ); // i == 5 |
14219 | \endcode | 14231 | \endcode |
14220 | */ | 14232 | */ |
14221 | 14233 | ||
14222 | int QString::findRev( QChar c, int index, bool cs ) const | 14234 | int QString::findRev( QChar c, int index, bool cs ) const |
14223 | { | 14235 | { |
14236 | #ifdef MACOSX_101 | ||
14237 | return findRev( QString( c ), index, cs ); | ||
14238 | #else | ||
14224 | const uint l = length(); | 14239 | const uint l = length(); |
14225 | if ( index < 0 ) | 14240 | if ( index < 0 ) |
14226 | index += l; | 14241 | index += l; |
14227 | if ( (uint)index >= l ) | 14242 | if ( (uint)index >= l ) |
14228 | return -1; | 14243 | return -1; |
14229 | const QChar *end = unicode(); | 14244 | const QChar *end = unicode(); |
14230 | register const QChar *uc = end + index; | 14245 | register const QChar *uc = end + index; |
14231 | if ( cs ) { | 14246 | if ( cs ) { |
14232 | while ( uc >= end && *uc != c ) | 14247 | while ( uc >= end && *uc != c ) |
14233 | uc--; | 14248 | uc--; |
14234 | } else { | 14249 | } else { |
14235 | c = ::lower( c ); | 14250 | c = ::lower( c ); |
14236 | while ( uc >= end && ::lower( *uc ) != c ) | 14251 | while ( uc >= end && ::lower( *uc ) != c ) |
14237 | uc--; | 14252 | uc--; |
14238 | } | 14253 | } |
14239 | return uc - end; | 14254 | return uc - end; |
14255 | #endif | ||
14240 | } | 14256 | } |
14241 | 14257 | ||
14242 | /*! | 14258 | /*! |
14243 | \overload | 14259 | \overload |
14244 | 14260 | ||
14245 | Finds the first occurrence of the string \a str, starting at | 14261 | Finds the first occurrence of the string \a str, starting at |
14246 | position \a index and searching backwards. If the index is -1, the | 14262 | position \a index and searching backwards. If the index is -1, the |
14247 | search starts at the last character, if it is -2, at the next to | 14263 | search starts at the last character, if it is -2, at the next to |
14248 | last character and so on. | 14264 | last character and so on. |
14249 | 14265 | ||
14250 | Returns the position of \a str or -1 if \a str could not be found. | 14266 | Returns the position of \a str or -1 if \a str could not be found. |
14251 | 14267 | ||
14252 | If \a cs is TRUE, the search is case sensitive; otherwise the | 14268 | If \a cs is TRUE, the search is case sensitive; otherwise the |
14253 | search is case insensitive. | 14269 | search is case insensitive. |
14254 | 14270 | ||
14255 | \code | 14271 | \code |
@@ -14260,34 +14276,36 @@ int QString::findRev( QChar c, int index, bool cs ) const | |||
14260 | 14276 | ||
14261 | int QString::findRev( const QString& str, int index, bool cs ) const | 14277 | int QString::findRev( const QString& str, int index, bool cs ) const |
14262 | { | 14278 | { |
14263 | /* | 14279 | /* |
14264 | See QString::find() for explanations. | 14280 | See QString::find() for explanations. |
14265 | */ | 14281 | */ |
14266 | const uint l = length(); | 14282 | const uint l = length(); |
14267 | if ( index < 0 ) | 14283 | if ( index < 0 ) |
14268 | index += l; | 14284 | index += l; |
14269 | const uint sl = str.length(); | 14285 | const uint sl = str.length(); |
14270 | int delta = l-sl; | 14286 | int delta = l-sl; |
14271 | if ( index < 0 || index > (int)l || delta < 0 ) | 14287 | if ( index < 0 || index > (int)l || delta < 0 ) |
14272 | return -1; | 14288 | return -1; |
14273 | if ( index > delta ) | 14289 | if ( index > delta ) |
14274 | index = delta; | 14290 | index = delta; |
14275 | 14291 | ||
14292 | #ifndef MACOSX_101 | ||
14276 | if ( sl == 1 ) | 14293 | if ( sl == 1 ) |
14277 | return findRev( *str.unicode(), index, cs ); | 14294 | return findRev( *str.unicode(), index, cs ); |
14295 | #endif | ||
14278 | 14296 | ||
14279 | const QChar* needle = str.unicode(); | 14297 | const QChar* needle = str.unicode(); |
14280 | const QChar* haystack = unicode() + index; | 14298 | const QChar* haystack = unicode() + index; |
14281 | const QChar* end = unicode(); | 14299 | const QChar* end = unicode(); |
14282 | const uint sl_minus_1 = sl-1; | 14300 | const uint sl_minus_1 = sl-1; |
14283 | const QChar* n = needle+sl_minus_1; | 14301 | const QChar* n = needle+sl_minus_1; |
14284 | const QChar* h = haystack+sl_minus_1; | 14302 | const QChar* h = haystack+sl_minus_1; |
14285 | uint hashNeedle = 0, hashHaystack = 0, i; | 14303 | uint hashNeedle = 0, hashHaystack = 0, i; |
14286 | 14304 | ||
14287 | if ( cs ) { | 14305 | if ( cs ) { |
14288 | for ( i = 0; i < sl; ++i ) { | 14306 | for ( i = 0; i < sl; ++i ) { |
14289 | hashNeedle = ((hashNeedle<<1) + (n-i)->unicode() ); | 14307 | hashNeedle = ((hashNeedle<<1) + (n-i)->unicode() ); |
14290 | hashHaystack = ((hashHaystack<<1) + (h-i)->unicode() ); | 14308 | hashHaystack = ((hashHaystack<<1) + (h-i)->unicode() ); |
14291 | } | 14309 | } |
14292 | hashHaystack -= haystack->unicode(); | 14310 | hashHaystack -= haystack->unicode(); |
14293 | 14311 | ||
@@ -14966,73 +14984,83 @@ QString QString::rightJustify( uint width, QChar fill, bool truncate ) const | |||
14966 | return result; | 14984 | return result; |
14967 | } | 14985 | } |
14968 | 14986 | ||
14969 | /*! | 14987 | /*! |
14970 | Returns a lowercase copy of the string. | 14988 | Returns a lowercase copy of the string. |
14971 | 14989 | ||
14972 | \code | 14990 | \code |
14973 | QString string( "TROlltECH" ); | 14991 | QString string( "TROlltECH" ); |
14974 | str = string.lower(); // str == "trolltech" | 14992 | str = string.lower(); // str == "trolltech" |
14975 | \endcode | 14993 | \endcode |
14976 | 14994 | ||
14977 | \sa upper() | 14995 | \sa upper() |
14978 | */ | 14996 | */ |
14979 | 14997 | ||
14980 | QString QString::lower() const | 14998 | QString QString::lower() const |
14981 | { | 14999 | { |
14982 | QString s(*this); | 15000 | int l = length(); |
14983 | int l=length(); | 15001 | register QChar *p = d->unicode; |
14984 | if ( l ) { | 15002 | while ( l ) { |
14985 | s.real_detach(); // could do this only when we find a change | 15003 | if ( *p != ::lower(*p) ) { |
14986 | register QChar *p=s.d->unicode; | 15004 | QString s( *this ); |
14987 | if ( p ) { | 15005 | s.real_detach(); |
14988 | while ( l-- ) { | 15006 | p = s.d->unicode + ( p - d->unicode ); |
15007 | while ( l ) { | ||
14989 | *p = ::lower( *p ); | 15008 | *p = ::lower( *p ); |
15009 | l--; | ||
14990 | p++; | 15010 | p++; |
14991 | } | 15011 | } |
15012 | return s; | ||
14992 | } | 15013 | } |
15014 | l--; | ||
15015 | p++; | ||
14993 | } | 15016 | } |
14994 | return s; | 15017 | return *this; |
14995 | } | 15018 | } |
14996 | 15019 | ||
14997 | /*! | 15020 | /*! |
14998 | Returns an uppercase copy of the string. | 15021 | Returns an uppercase copy of the string. |
14999 | 15022 | ||
15000 | \code | 15023 | \code |
15001 | QString string( "TeXt" ); | 15024 | QString string( "TeXt" ); |
15002 | str = string.upper(); // t == "TEXT" | 15025 | str = string.upper(); // t == "TEXT" |
15003 | \endcode | 15026 | \endcode |
15004 | 15027 | ||
15005 | \sa lower() | 15028 | \sa lower() |
15006 | */ | 15029 | */ |
15007 | 15030 | ||
15008 | QString QString::upper() const | 15031 | QString QString::upper() const |
15009 | { | 15032 | { |
15010 | QString s(*this); | 15033 | int l = length(); |
15011 | int l=length(); | 15034 | register QChar *p = d->unicode; |
15012 | if ( l ) { | 15035 | while ( l ) { |
15013 | s.real_detach(); // could do this only when we find a change | 15036 | if ( *p != ::upper(*p) ) { |
15014 | register QChar *p=s.d->unicode; | 15037 | QString s( *this ); |
15015 | if ( p ) { | 15038 | s.real_detach(); |
15016 | while ( l-- ) { | 15039 | p = s.d->unicode + ( p - d->unicode ); |
15040 | while ( l ) { | ||
15017 | *p = ::upper( *p ); | 15041 | *p = ::upper( *p ); |
15042 | l--; | ||
15018 | p++; | 15043 | p++; |
15019 | } | 15044 | } |
15045 | return s; | ||
15020 | } | 15046 | } |
15047 | l--; | ||
15048 | p++; | ||
15021 | } | 15049 | } |
15022 | return s; | 15050 | return *this; |
15023 | } | 15051 | } |
15024 | 15052 | ||
15025 | 15053 | ||
15026 | /*! | 15054 | /*! |
15027 | Returns a string that has whitespace removed from the start and | 15055 | Returns a string that has whitespace removed from the start and |
15028 | the end. | 15056 | the end. |
15029 | 15057 | ||
15030 | Whitespace means any character for which QChar::isSpace() returns | 15058 | Whitespace means any character for which QChar::isSpace() returns |
15031 | TRUE. This includes Unicode characters with decimal values 9 | 15059 | TRUE. This includes Unicode characters with decimal values 9 |
15032 | (TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR) and 32 (Space), and may | 15060 | (TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR) and 32 (Space), and may |
15033 | also include other Unicode characters. | 15061 | also include other Unicode characters. |
15034 | 15062 | ||
15035 | \code | 15063 | \code |
15036 | QString string = " white space "; | 15064 | QString string = " white space "; |
15037 | QString s = string.stripWhiteSpace(); // s == "white space" | 15065 | QString s = string.stripWhiteSpace(); // s == "white space" |
15038 | \endcode | 15066 | \endcode |
@@ -15124,34 +15152,34 @@ QString QString::simplifyWhiteSpace() const | |||
15124 | str = string.insert( 2, "don't " ); | 15152 | str = string.insert( 2, "don't " ); |
15125 | // str == "I don't like fish" | 15153 | // str == "I don't like fish" |
15126 | \endcode | 15154 | \endcode |
15127 | 15155 | ||
15128 | \sa remove(), replace() | 15156 | \sa remove(), replace() |
15129 | */ | 15157 | */ |
15130 | 15158 | ||
15131 | QString &QString::insert( uint index, const QString &s ) | 15159 | QString &QString::insert( uint index, const QString &s ) |
15132 | { | 15160 | { |
15133 | // the sub function takes care of &s == this case. | 15161 | // the sub function takes care of &s == this case. |
15134 | return insert( index, s.unicode(), s.length() ); | 15162 | return insert( index, s.unicode(), s.length() ); |
15135 | } | 15163 | } |
15136 | 15164 | ||
15137 | /*! | 15165 | /*! |
15138 | \overload | 15166 | \overload |
15139 | 15167 | ||
15140 | Inserts the character in \a s into the string at position \a index | 15168 | Inserts the first \a len characters in \a s into the string at |
15141 | \a len number of times and returns a reference to the string. | 15169 | position \a index and returns a reference to the string. |
15142 | */ | 15170 | */ |
15143 | 15171 | ||
15144 | QString &QString::insert( uint index, const QChar* s, uint len ) | 15172 | QString &QString::insert( uint index, const QChar* s, uint len ) |
15145 | { | 15173 | { |
15146 | if ( len == 0 ) | 15174 | if ( len == 0 ) |
15147 | return *this; | 15175 | return *this; |
15148 | uint olen = length(); | 15176 | uint olen = length(); |
15149 | int nlen = olen + len; | 15177 | int nlen = olen + len; |
15150 | 15178 | ||
15151 | if ( s >= d->unicode && (uint)(s - d->unicode) < d->maxl ) { | 15179 | if ( s >= d->unicode && (uint)(s - d->unicode) < d->maxl ) { |
15152 | // Part of me - take a copy. | 15180 | // Part of me - take a copy. |
15153 | QChar *tmp = QT_ALLOC_QCHAR_VEC( len ); | 15181 | QChar *tmp = QT_ALLOC_QCHAR_VEC( len ); |
15154 | memcpy(tmp,s,len*sizeof(QChar)); | 15182 | memcpy(tmp,s,len*sizeof(QChar)); |
15155 | insert(index,tmp,len); | 15183 | insert(index,tmp,len); |
15156 | QT_DELETE_QCHAR_VEC( tmp ); | 15184 | QT_DELETE_QCHAR_VEC( tmp ); |
15157 | return *this; | 15185 | return *this; |
@@ -15238,32 +15266,42 @@ QString &QString::insert( uint index, QChar c ) // insert char | |||
15238 | 15266 | ||
15239 | Equivalent to insert(0, \a ch). | 15267 | Equivalent to insert(0, \a ch). |
15240 | 15268 | ||
15241 | \sa insert() | 15269 | \sa insert() |
15242 | */ | 15270 | */ |
15243 | 15271 | ||
15244 | /*! \fn QString& QString::prepend( const QByteArray &s ) | 15272 | /*! \fn QString& QString::prepend( const QByteArray &s ) |
15245 | \overload | 15273 | \overload |
15246 | 15274 | ||
15247 | Inserts \a s at the beginning of the string and returns a reference to the string. | 15275 | Inserts \a s at the beginning of the string and returns a reference to the string. |
15248 | 15276 | ||
15249 | Equivalent to insert(0, \a s). | 15277 | Equivalent to insert(0, \a s). |
15250 | 15278 | ||
15251 | \sa insert() | 15279 | \sa insert() |
15252 | */ | 15280 | */ |
15253 | 15281 | ||
15282 | /*! \fn QString& QString::prepend( const std::string &s ) | ||
15283 | \overload | ||
15284 | |||
15285 | Inserts \a s at the beginning of the string and returns a reference to the string. | ||
15286 | |||
15287 | Equivalent to insert(0, \a s). | ||
15288 | |||
15289 | \sa insert() | ||
15290 | */ | ||
15291 | |||
15254 | /*! | 15292 | /*! |
15255 | \overload | 15293 | \overload |
15256 | 15294 | ||
15257 | Inserts \a s at the beginning of the string and returns a reference to the string. | 15295 | Inserts \a s at the beginning of the string and returns a reference to the string. |
15258 | 15296 | ||
15259 | Equivalent to insert(0, \a s). | 15297 | Equivalent to insert(0, \a s). |
15260 | 15298 | ||
15261 | \sa insert() | 15299 | \sa insert() |
15262 | */ | 15300 | */ |
15263 | QString &QString::prepend( const char *s ) | 15301 | QString &QString::prepend( const char *s ) |
15264 | { | 15302 | { |
15265 | return insert( 0, QString(s) ); | 15303 | return insert( 0, QString(s) ); |
15266 | } | 15304 | } |
15267 | 15305 | ||
15268 | /*! | 15306 | /*! |
15269 | Removes \a len characters from the string starting at position \a | 15307 | Removes \a len characters from the string starting at position \a |
@@ -15835,237 +15873,245 @@ static bool ok_in_base( QChar c, int base ) | |||
15835 | || (c >= 'A' && c < char('A'+base-10)); | 15873 | || (c >= 'A' && c < char('A'+base-10)); |
15836 | } | 15874 | } |
15837 | 15875 | ||
15838 | /*! | 15876 | /*! |
15839 | Returns the string converted to a \c long value to the base \a | 15877 | Returns the string converted to a \c long value to the base \a |
15840 | base, which is 10 by default and must be between 2 and 36. | 15878 | base, which is 10 by default and must be between 2 and 36. |
15841 | 15879 | ||
15842 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 15880 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
15843 | FALSE; otherwise \a *ok is set to TRUE. | 15881 | FALSE; otherwise \a *ok is set to TRUE. |
15844 | 15882 | ||
15845 | \sa number() | 15883 | \sa number() |
15846 | */ | 15884 | */ |
15847 | 15885 | ||
15848 | long QString::toLong( bool *ok, int base ) const | 15886 | long QString::toLong( bool *ok, int base ) const |
15849 | { | 15887 | { |
15850 | const QChar *p = unicode(); | 15888 | const QChar *p = unicode(); |
15851 | long val = 0; | 15889 | ulong val = 0; |
15852 | int l = length(); | 15890 | int l = length(); |
15853 | const long max_mult = INT_MAX / base; | 15891 | const ulong max_mult = LONG_MAX / base; |
15854 | bool is_ok = FALSE; | 15892 | bool is_ok = FALSE; |
15855 | int neg = 0; | 15893 | int neg = 0; |
15856 | if ( !p ) | 15894 | if ( !p ) |
15857 | goto bye; | 15895 | goto bye; |
15858 | while ( l && p->isSpace() ) // skip leading space | 15896 | while ( l && p->isSpace() ) // skip leading space |
15859 | l--,p++; | 15897 | l--,p++; |
15860 | if ( !l ) | 15898 | if ( !l ) |
15861 | goto bye; | 15899 | goto bye; |
15862 | if ( *p == '-' ) { | 15900 | if ( *p == '-' ) { |
15863 | l--; | 15901 | l--; |
15864 | p++; | 15902 | p++; |
15865 | neg = 1; | 15903 | neg = 1; |
15866 | } else if ( *p == '+' ) { | 15904 | } else if ( *p == '+' ) { |
15867 | l--; | 15905 | l--; |
15868 | p++; | 15906 | p++; |
15869 | } | 15907 | } |
15870 | 15908 | ||
15871 | // NOTE: toULong() code is similar | 15909 | // NOTE: toULong() code is similar |
15872 | if ( !l || !ok_in_base(*p,base) ) | 15910 | if ( !l || !ok_in_base(*p,base) ) |
15873 | goto bye; | 15911 | goto bye; |
15874 | while ( l && ok_in_base(*p,base) ) { | 15912 | while ( l && ok_in_base(*p,base) ) { |
15875 | l--; | 15913 | l--; |
15876 | int dv; | 15914 | int dv; |
15877 | if ( p->isDigit() ) { | 15915 | if ( p->isDigit() ) { |
15878 | dv = p->digitValue(); | 15916 | dv = p->digitValue(); |
15879 | } else { | 15917 | } else { |
15880 | if ( *p >= 'a' && *p <= 'z' ) | 15918 | if ( *p >= 'a' && *p <= 'z' ) |
15881 | dv = *p - 'a' + 10; | 15919 | dv = *p - 'a' + 10; |
15882 | else | 15920 | else |
15883 | dv = *p - 'A' + 10; | 15921 | dv = *p - 'A' + 10; |
15884 | } | 15922 | } |
15885 | if ( val > max_mult || | 15923 | if ( val > max_mult || |
15886 | (val == max_mult && dv > (INT_MAX % base) + neg) ) | 15924 | (val == max_mult && dv > (LONG_MAX % base) + neg) ) |
15887 | goto bye; | 15925 | goto bye; |
15888 | val = base * val + dv; | 15926 | val = base * val + dv; |
15889 | p++; | 15927 | p++; |
15890 | } | 15928 | } |
15891 | if ( neg ) | ||
15892 | val = -val; | ||
15893 | while ( l && p->isSpace() ) // skip trailing space | 15929 | while ( l && p->isSpace() ) // skip trailing space |
15894 | l--,p++; | 15930 | l--, p++; |
15895 | if ( !l ) | 15931 | if ( !l ) |
15896 | is_ok = TRUE; | 15932 | is_ok = TRUE; |
15897 | bye: | 15933 | bye: |
15898 | if ( ok ) | 15934 | if ( ok ) |
15899 | *ok = is_ok; | 15935 | *ok = is_ok; |
15900 | return is_ok ? val : 0; | 15936 | return is_ok ? ( neg ? -( (long) val ) : (long) val ) : 0L; |
15901 | } | 15937 | } |
15902 | 15938 | ||
15903 | /*! | 15939 | /*! |
15904 | Returns the string converted to an \c {unsigned long} value to the | 15940 | Returns the string converted to an \c {unsigned long} value to the |
15905 | base \a base, which is 10 by default and must be between 2 and 36. | 15941 | base \a base, which is 10 by default and must be between 2 and 36. |
15906 | 15942 | ||
15907 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 15943 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
15908 | FALSE; otherwise \a *ok is set to TRUE. | 15944 | FALSE; otherwise \a *ok is set to TRUE. |
15909 | 15945 | ||
15910 | \sa number() | 15946 | \sa number() |
15911 | */ | 15947 | */ |
15912 | 15948 | ||
15913 | ulong QString::toULong( bool *ok, int base ) const | 15949 | ulong QString::toULong( bool *ok, int base ) const |
15914 | { | 15950 | { |
15915 | const QChar *p = unicode(); | 15951 | const QChar *p = unicode(); |
15916 | ulong val = 0; | 15952 | ulong val = 0; |
15917 | int l = length(); | 15953 | int l = length(); |
15918 | const ulong max_mult = UINT_MAX / base; | 15954 | const ulong max_mult = ULONG_MAX / base; |
15919 | bool is_ok = FALSE; | 15955 | bool is_ok = FALSE; |
15920 | if ( !p ) | 15956 | if ( !p ) |
15921 | goto bye; | 15957 | goto bye; |
15922 | while ( l && p->isSpace() ) // skip leading space | 15958 | while ( l && p->isSpace() ) // skip leading space |
15923 | l--,p++; | 15959 | l--,p++; |
15924 | if ( !l ) | 15960 | if ( !l ) |
15925 | goto bye; | 15961 | goto bye; |
15926 | if ( *p == '+' ) | 15962 | if ( *p == '+' ) |
15927 | l--,p++; | 15963 | l--,p++; |
15928 | 15964 | ||
15929 | // NOTE: toLong() code is similar | 15965 | // NOTE: toLong() code is similar |
15930 | if ( !l || !ok_in_base(*p,base) ) | 15966 | if ( !l || !ok_in_base(*p,base) ) |
15931 | goto bye; | 15967 | goto bye; |
15932 | while ( l && ok_in_base(*p,base) ) { | 15968 | while ( l && ok_in_base(*p,base) ) { |
15933 | l--; | 15969 | l--; |
15934 | uint dv; | 15970 | uint dv; |
15935 | if ( p->isDigit() ) { | 15971 | if ( p->isDigit() ) { |
15936 | dv = p->digitValue(); | 15972 | dv = p->digitValue(); |
15937 | } else { | 15973 | } else { |
15938 | if ( *p >= 'a' && *p <= 'z' ) | 15974 | if ( *p >= 'a' && *p <= 'z' ) |
15939 | dv = *p - 'a' + 10; | 15975 | dv = *p - 'a' + 10; |
15940 | else | 15976 | else |
15941 | dv = *p - 'A' + 10; | 15977 | dv = *p - 'A' + 10; |
15942 | } | 15978 | } |
15943 | if ( val > max_mult || (val == max_mult && dv > UINT_MAX % base) ) | 15979 | if ( val > max_mult || (val == max_mult && dv > ULONG_MAX % base) ) |
15944 | goto bye; | 15980 | goto bye; |
15945 | val = base * val + dv; | 15981 | val = base * val + dv; |
15946 | p++; | 15982 | p++; |
15947 | } | 15983 | } |
15948 | 15984 | ||
15949 | while ( l && p->isSpace() ) // skip trailing space | 15985 | while ( l && p->isSpace() ) // skip trailing space |
15950 | l--,p++; | 15986 | l--,p++; |
15951 | if ( !l ) | 15987 | if ( !l ) |
15952 | is_ok = TRUE; | 15988 | is_ok = TRUE; |
15953 | bye: | 15989 | bye: |
15954 | if ( ok ) | 15990 | if ( ok ) |
15955 | *ok = is_ok; | 15991 | *ok = is_ok; |
15956 | return is_ok ? val : 0; | 15992 | return is_ok ? val : 0; |
15957 | } | 15993 | } |
15958 | 15994 | ||
15959 | /*! | 15995 | /*! |
15960 | Returns the string converted to a \c short value to the base \a | 15996 | Returns the string converted to a \c short value to the base \a |
15961 | base, which is 10 by default and must be between 2 and 36. | 15997 | base, which is 10 by default and must be between 2 and 36. |
15962 | 15998 | ||
15963 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 15999 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
15964 | FALSE; otherwise \a *ok is set to TRUE. | 16000 | FALSE; otherwise \a *ok is set to TRUE. |
15965 | */ | 16001 | */ |
15966 | 16002 | ||
15967 | short QString::toShort( bool *ok, int base ) const | 16003 | short QString::toShort( bool *ok, int base ) const |
15968 | { | 16004 | { |
15969 | long v = toLong( ok, base ); | 16005 | long v = toLong( ok, base ); |
15970 | if ( ok && *ok && (v < -32768 || v > 32767) ) { | 16006 | if ( ok && *ok && (v < SHRT_MIN || v > SHRT_MAX) ) { |
15971 | *ok = FALSE; | 16007 | *ok = FALSE; |
15972 | v = 0; | 16008 | v = 0; |
15973 | } | 16009 | } |
15974 | return (short)v; | 16010 | return (short)v; |
15975 | } | 16011 | } |
15976 | 16012 | ||
15977 | /*! | 16013 | /*! |
15978 | Returns the string converted to an \c {unsigned short} value to | 16014 | Returns the string converted to an \c {unsigned short} value to |
15979 | the base \a base, which is 10 by default and must be between 2 and | 16015 | the base \a base, which is 10 by default and must be between 2 and |
15980 | 36. | 16016 | 36. |
15981 | 16017 | ||
15982 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 16018 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
15983 | FALSE; otherwise \a *ok is set to TRUE. | 16019 | FALSE; otherwise \a *ok is set to TRUE. |
15984 | */ | 16020 | */ |
15985 | 16021 | ||
15986 | ushort QString::toUShort( bool *ok, int base ) const | 16022 | ushort QString::toUShort( bool *ok, int base ) const |
15987 | { | 16023 | { |
15988 | ulong v = toULong( ok, base ); | 16024 | ulong v = toULong( ok, base ); |
15989 | if ( ok && *ok && (v > 65535) ) { | 16025 | if ( ok && *ok && (v > USHRT_MAX) ) { |
15990 | *ok = FALSE; | 16026 | *ok = FALSE; |
15991 | v = 0; | 16027 | v = 0; |
15992 | } | 16028 | } |
15993 | return (ushort)v; | 16029 | return (ushort)v; |
15994 | } | 16030 | } |
15995 | 16031 | ||
15996 | 16032 | ||
15997 | /*! | 16033 | /*! |
15998 | Returns the string converted to an \c int value to the base \a | 16034 | Returns the string converted to an \c int value to the base \a |
15999 | base, which is 10 by default and must be between 2 and 36. | 16035 | base, which is 10 by default and must be between 2 and 36. |
16000 | 16036 | ||
16001 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 16037 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
16002 | FALSE; otherwise \a *ok is set to TRUE. | 16038 | FALSE; otherwise \a *ok is set to TRUE. |
16003 | 16039 | ||
16004 | \code | 16040 | \code |
16005 | QString str( "FF" ); | 16041 | QString str( "FF" ); |
16006 | bool ok; | 16042 | bool ok; |
16007 | int hex = str.toInt( &ok, 16 ); // hex == 255, ok == TRUE | 16043 | int hex = str.toInt( &ok, 16 ); // hex == 255, ok == TRUE |
16008 | int dec = str.toInt( &ok, 10 ); // dec == 0, ok == FALSE | 16044 | int dec = str.toInt( &ok, 10 ); // dec == 0, ok == FALSE |
16009 | \endcode | 16045 | \endcode |
16010 | 16046 | ||
16011 | \sa number() | 16047 | \sa number() |
16012 | */ | 16048 | */ |
16013 | 16049 | ||
16014 | int QString::toInt( bool *ok, int base ) const | 16050 | int QString::toInt( bool *ok, int base ) const |
16015 | { | 16051 | { |
16016 | return (int)toLong( ok, base ); | 16052 | long v = toLong( ok, base ); |
16053 | if ( ok && *ok && (v < INT_MIN || v > INT_MAX) ) { | ||
16054 | *ok = FALSE; | ||
16055 | v = 0; | ||
16056 | } | ||
16057 | return (int)v; | ||
16017 | } | 16058 | } |
16018 | 16059 | ||
16019 | /*! | 16060 | /*! |
16020 | Returns the string converted to an \c{unsigned int} value to the | 16061 | Returns the string converted to an \c{unsigned int} value to the |
16021 | base \a base, which is 10 by default and must be between 2 and 36. | 16062 | base \a base, which is 10 by default and must be between 2 and 36. |
16022 | 16063 | ||
16023 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 16064 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
16024 | FALSE; otherwise \a *ok is set to TRUE. | 16065 | FALSE; otherwise \a *ok is set to TRUE. |
16025 | 16066 | ||
16026 | \sa number() | 16067 | \sa number() |
16027 | */ | 16068 | */ |
16028 | 16069 | ||
16029 | uint QString::toUInt( bool *ok, int base ) const | 16070 | uint QString::toUInt( bool *ok, int base ) const |
16030 | { | 16071 | { |
16031 | return (uint)toULong( ok, base ); | 16072 | ulong v = toULong( ok, base ); |
16073 | if ( ok && *ok && (v > UINT_MAX) ) { | ||
16074 | *ok = FALSE; | ||
16075 | v = 0; | ||
16076 | } | ||
16077 | return (uint)v; | ||
16032 | } | 16078 | } |
16033 | 16079 | ||
16034 | /*! | 16080 | /*! |
16035 | Returns the string converted to a \c double value. | 16081 | Returns the string converted to a \c double value. |
16036 | 16082 | ||
16037 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 16083 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
16038 | FALSE; otherwise \a *ok is set to TRUE. | 16084 | FALSE; otherwise \a *ok is set to TRUE. |
16039 | 16085 | ||
16040 | \code | 16086 | \code |
16041 | QString string( "1234.56" ); | 16087 | QString string( "1234.56" ); |
16042 | double a = string.toDouble(); // a == 1234.56 | 16088 | double a = string.toDouble(); // a == 1234.56 |
16043 | \endcode | 16089 | \endcode |
16044 | 16090 | ||
16045 | \sa number() | 16091 | \sa number() |
16046 | */ | 16092 | */ |
16047 | 16093 | ||
16048 | double QString::toDouble( bool *ok ) const | 16094 | double QString::toDouble( bool *ok ) const |
16049 | { | 16095 | { |
16050 | char *end; | 16096 | char *end; |
16051 | 16097 | ||
16052 | const char *a = latin1(); | 16098 | const char *a = latin1(); |
16053 | double val = strtod( a ? a : "", &end ); | 16099 | double val = strtod( a ? a : "", &end ); |
16054 | if ( ok ) | 16100 | if ( ok ) |
16055 | *ok = ( a && *a && (end == 0 || (end - a) == (int)length()) ); | 16101 | *ok = ( a && *a && (end == 0 || *end == '\0') ); |
16056 | return val; | 16102 | return val; |
16057 | } | 16103 | } |
16058 | 16104 | ||
16059 | /*! | 16105 | /*! |
16060 | Returns the string converted to a \c float value. | 16106 | Returns the string converted to a \c float value. |
16061 | 16107 | ||
16062 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to | 16108 | If \a ok is not 0: if a conversion error occurs, \a *ok is set to |
16063 | FALSE; otherwise \a *ok is set to TRUE. | 16109 | FALSE; otherwise \a *ok is set to TRUE. |
16064 | 16110 | ||
16065 | \sa number() | 16111 | \sa number() |
16066 | */ | 16112 | */ |
16067 | 16113 | ||
16068 | float QString::toFloat( bool *ok ) const | 16114 | float QString::toFloat( bool *ok ) const |
16069 | { | 16115 | { |
16070 | return (float)toDouble( ok ); | 16116 | return (float)toDouble( ok ); |
16071 | } | 16117 | } |
@@ -16085,37 +16131,37 @@ float QString::toFloat( bool *ok ) const | |||
16085 | 16131 | ||
16086 | QString &QString::setNum( long n, int base ) | 16132 | QString &QString::setNum( long n, int base ) |
16087 | { | 16133 | { |
16088 | #if defined(QT_CHECK_RANGE) | 16134 | #if defined(QT_CHECK_RANGE) |
16089 | if ( base < 2 || base > 36 ) { | 16135 | if ( base < 2 || base > 36 ) { |
16090 | qWarning( "QString::setNum: Invalid base %d", base ); | 16136 | qWarning( "QString::setNum: Invalid base %d", base ); |
16091 | base = 10; | 16137 | base = 10; |
16092 | } | 16138 | } |
16093 | #endif | 16139 | #endif |
16094 | char charbuf[65*sizeof(QChar)]; | 16140 | char charbuf[65*sizeof(QChar)]; |
16095 | QChar *buf = (QChar*)charbuf; | 16141 | QChar *buf = (QChar*)charbuf; |
16096 | QChar *p = &buf[64]; | 16142 | QChar *p = &buf[64]; |
16097 | int len = 0; | 16143 | int len = 0; |
16098 | bool neg; | 16144 | bool neg; |
16099 | if ( n < 0 ) { | 16145 | if ( n < 0 ) { |
16100 | neg = TRUE; | 16146 | neg = TRUE; |
16101 | if ( n == INT_MIN ) { | 16147 | if ( n == LONG_MIN ) { |
16102 | // Cannot always negate this special case | 16148 | // Cannot always negate this special case |
16103 | QString s1, s2; | 16149 | QString s1, s2; |
16104 | s1.setNum(n/base); | 16150 | s1.setNum(n/base, base ); |
16105 | s2.setNum((-(n+base))%base); | 16151 | s2.setNum((-(n+base))%base, base ); |
16106 | *this = s1 + s2; | 16152 | *this = s1 + s2; |
16107 | return *this; | 16153 | return *this; |
16108 | } | 16154 | } |
16109 | n = -n; | 16155 | n = -n; |
16110 | } else { | 16156 | } else { |
16111 | neg = FALSE; | 16157 | neg = FALSE; |
16112 | } | 16158 | } |
16113 | do { | 16159 | do { |
16114 | *--p = "0123456789abcdefghijklmnopqrstuvwxyz"[((int)(n%base))]; | 16160 | *--p = "0123456789abcdefghijklmnopqrstuvwxyz"[((int)(n%base))]; |
16115 | n /= base; | 16161 | n /= base; |
16116 | ++len; | 16162 | ++len; |
16117 | } while ( n ); | 16163 | } while ( n ); |
16118 | if ( neg ) { | 16164 | if ( neg ) { |
16119 | *--p = '-'; | 16165 | *--p = '-'; |
16120 | ++len; | 16166 | ++len; |
16121 | } | 16167 | } |
@@ -16448,159 +16494,204 @@ void QString::setExpand( uint index, QChar c ) | |||
16448 | \overload | 16494 | \overload |
16449 | 16495 | ||
16450 | Appends character \a ch to the string and returns a reference to | 16496 | Appends character \a ch to the string and returns a reference to |
16451 | the result. | 16497 | the result. |
16452 | 16498 | ||
16453 | Equivalent to operator+=(). | 16499 | Equivalent to operator+=(). |
16454 | */ | 16500 | */ |
16455 | 16501 | ||
16456 | /*! \fn QString& QString::append( const QByteArray &str ) | 16502 | /*! \fn QString& QString::append( const QByteArray &str ) |
16457 | \overload | 16503 | \overload |
16458 | 16504 | ||
16459 | Appends \a str to the string and returns a reference to the result. | 16505 | Appends \a str to the string and returns a reference to the result. |
16460 | 16506 | ||
16461 | Equivalent to operator+=(). | 16507 | Equivalent to operator+=(). |
16462 | */ | 16508 | */ |
16463 | 16509 | ||
16510 | /*! \fn QString& QString::append( const std::string &str ) | ||
16511 | \overload | ||
16512 | |||
16513 | Appends \a str to the string and returns a reference to the result. | ||
16514 | |||
16515 | Equivalent to operator+=(). | ||
16516 | */ | ||
16517 | |||
16518 | |||
16464 | /*! \fn QString& QString::append( const char *str ) | 16519 | /*! \fn QString& QString::append( const char *str ) |
16465 | \overload | 16520 | \overload |
16466 | 16521 | ||
16467 | Appends \a str to the string and returns a reference to the result. | 16522 | Appends \a str to the string and returns a reference to the result. |
16468 | 16523 | ||
16469 | Equivalent to operator+=(). | 16524 | Equivalent to operator+=(). |
16470 | */ | 16525 | */ |
16471 | 16526 | ||
16472 | /*! | 16527 | /*! |
16473 | Appends \a str to the string and returns a reference to the string. | 16528 | Appends \a str to the string and returns a reference to the string. |
16474 | */ | 16529 | */ |
16475 | QString& QString::operator+=( const QString &str ) | 16530 | QString& QString::operator+=( const QString &str ) |
16476 | { | 16531 | { |
16477 | uint len1 = length(); | 16532 | uint len1 = length(); |
16478 | uint len2 = str.length(); | 16533 | uint len2 = str.length(); |
16479 | if ( len2 ) { | 16534 | if ( len2 ) { |
16480 | setLength(len1+len2); | 16535 | setLength(len1+len2); |
16481 | memcpy( d->unicode+len1, str.unicode(), sizeof(QChar)*len2 ); | 16536 | memcpy( d->unicode+len1, str.unicode(), sizeof(QChar)*len2 ); |
16482 | } else if ( isNull() && !str.isNull() ) { // ## just for 1.x compat: | 16537 | } else if ( isNull() && !str.isNull() ) { // ## just for 1.x compat: |
16483 | *this = fromLatin1( "" ); | 16538 | *this = fromLatin1( "" ); |
16484 | } | 16539 | } |
16485 | return *this; | 16540 | return *this; |
16486 | } | 16541 | } |
16487 | 16542 | ||
16488 | /*! | 16543 | /*! |
16489 | \overload | 16544 | \overload |
16490 | 16545 | ||
16491 | Appends \a str to the string and returns a reference to the string. | 16546 | Appends \a str to the string and returns a reference to the string. |
16492 | */ | 16547 | */ |
16548 | #ifndef QT_NO_CAST_ASCII | ||
16493 | QString& QString::operator+=( const char *str ) | 16549 | QString& QString::operator+=( const char *str ) |
16494 | { | 16550 | { |
16495 | if ( str ) { | 16551 | if ( str ) { |
16552 | #ifndef QT_NO_TEXTCODEC | ||
16553 | if ( QTextCodec::codecForCStrings() ) | ||
16554 | return operator+=( fromAscii( str ) ); | ||
16555 | #endif | ||
16556 | |||
16496 | uint len1 = length(); | 16557 | uint len1 = length(); |
16497 | uint len2 = strlen( str ); | 16558 | uint len2 = strlen( str ); |
16498 | if ( len2 ) { | 16559 | if ( len2 ) { |
16499 | setLength(len1+len2); | 16560 | setLength(len1+len2); |
16500 | uint i = 0; | 16561 | uint i = 0; |
16501 | while( i < len2 ) { | 16562 | while( i < len2 ) { |
16502 | d->unicode[len1+i] = str[i]; | 16563 | d->unicode[len1+i] = str[i]; |
16503 | i++; | 16564 | i++; |
16504 | } | 16565 | } |
16505 | } else if ( isNull() ) { // ## just for 1.x compat: | 16566 | } else if ( isNull() ) { // ## just for 1.x compat: |
16506 | *this = fromLatin1( "" ); | 16567 | *this = fromLatin1( "" ); |
16507 | } | 16568 | } |
16508 | } | 16569 | } |
16509 | return *this; | 16570 | return *this; |
16510 | } | 16571 | } |
16572 | #endif | ||
16511 | 16573 | ||
16512 | /*! \overload | 16574 | /*! \overload |
16513 | 16575 | ||
16514 | Appends \a c to the string and returns a reference to the string. | 16576 | Appends \a c to the string and returns a reference to the string. |
16515 | */ | 16577 | */ |
16516 | 16578 | ||
16517 | QString &QString::operator+=( QChar c ) | 16579 | QString &QString::operator+=( QChar c ) |
16518 | { | 16580 | { |
16519 | setLength(length()+1); | 16581 | setLength(length()+1); |
16520 | d->unicode[length()-1] = c; | 16582 | d->unicode[length()-1] = c; |
16521 | return *this; | 16583 | return *this; |
16522 | } | 16584 | } |
16523 | 16585 | ||
16524 | /*! | 16586 | /*! |
16525 | \overload | 16587 | \overload |
16526 | 16588 | ||
16527 | Appends \a c to the string and returns a reference to the string. | 16589 | Appends \a c to the string and returns a reference to the string. |
16528 | */ | 16590 | */ |
16529 | 16591 | ||
16530 | QString &QString::operator+=( char c ) | 16592 | QString &QString::operator+=( char c ) |
16531 | { | 16593 | { |
16594 | #ifndef QT_NO_TEXTCODEC | ||
16595 | if ( QTextCodec::codecForCStrings() ) | ||
16596 | return operator+=( fromAscii( &c, 1 ) ); | ||
16597 | #endif | ||
16532 | setLength(length()+1); | 16598 | setLength(length()+1); |
16533 | d->unicode[length()-1] = c; | 16599 | d->unicode[length()-1] = c; |
16534 | return *this; | 16600 | return *this; |
16535 | } | 16601 | } |
16536 | 16602 | ||
16537 | /*! | 16603 | /*! |
16538 | \fn QString &QString::operator+=( const QByteArray &str ) | 16604 | \fn QString &QString::operator+=( const QByteArray &str ) |
16539 | \overload | 16605 | \overload |
16540 | 16606 | ||
16541 | Appends \a str to the string and returns a reference to the string. | 16607 | Appends \a str to the string and returns a reference to the string. |
16542 | */ | 16608 | */ |
16543 | 16609 | ||
16610 | /*! | ||
16611 | \fn QString &QString::operator+=( const std::string &str ) | ||
16612 | \overload | ||
16613 | |||
16614 | Appends \a str to the string and returns a reference to the string. | ||
16615 | */ | ||
16616 | |||
16544 | 16617 | ||
16545 | 16618 | ||
16546 | /*! | 16619 | /*! |
16547 | \fn char QChar::latin1() const | 16620 | \fn char QChar::latin1() const |
16548 | 16621 | ||
16549 | Returns a latin-1 copy of this character, if this character is in | 16622 | Returns the Latin-1 value of this character, or 0 if it |
16550 | the latin-1 character set. If not, this function returns 0. | 16623 | cannot be represented in Latin-1. |
16551 | */ | 16624 | */ |
16552 | 16625 | ||
16553 | 16626 | ||
16554 | /*! | 16627 | /*! |
16555 | Returns a Latin-1 representation of the string. Note that the | 16628 | Returns a Latin-1 representation of the string. The |
16556 | returned value is undefined if the string contains non-Latin-1 | 16629 | returned value is undefined if the string contains non-Latin-1 |
16557 | characters. If you want to convert strings into formats other than | 16630 | characters. If you want to convert strings into formats other than |
16558 | Unicode, see the QTextCodec classes. | 16631 | Unicode, see the QTextCodec classes. |
16559 | 16632 | ||
16560 | This function is mainly useful for boot-strapping legacy code to | 16633 | This function is mainly useful for boot-strapping legacy code to |
16561 | use Unicode. | 16634 | use Unicode. |
16562 | 16635 | ||
16563 | The result remains valid so long as one unmodified copy of the | 16636 | The result remains valid so long as one unmodified copy of the |
16564 | source string exists. | 16637 | source string exists. |
16565 | 16638 | ||
16566 | \sa utf8(), local8Bit() | 16639 | \sa fromLatin1(), ascii(), utf8(), local8Bit() |
16567 | */ | 16640 | */ |
16568 | const char* QString::latin1() const | 16641 | const char* QString::latin1() const |
16569 | { | 16642 | { |
16570 | if ( !d->ascii ) { | 16643 | if ( !d->ascii || !d->islatin1 ) { |
16571 | Q2HELPER(stat_get_ascii++) | 16644 | d->ascii = unicodeToLatin1( d->unicode, d->len ); |
16572 | Q2HELPER(stat_get_ascii_size+=d->len) | 16645 | d->islatin1 = TRUE; |
16573 | d->ascii = unicodeToAscii( d->unicode, d->len ); | ||
16574 | } | 16646 | } |
16575 | return d->ascii; | 16647 | return d->ascii; |
16576 | } | 16648 | } |
16577 | 16649 | ||
16578 | /*! | 16650 | /*! |
16579 | \fn const char* QString::ascii() const | 16651 | Returns an 8-bit ASCII representation of the string. |
16580 | \obsolete | ||
16581 | 16652 | ||
16582 | This function simply calls latin1() and returns the result. | 16653 | If a codec has been set using QTextCodec::codecForCStrings(), |
16654 | it is used to convert Unicode to 8-bit char. Otherwise, this function | ||
16655 | does the same as latin1(). | ||
16656 | |||
16657 | \sa fromAscii(), latin1(), utf8(), local8Bit() | ||
16583 | */ | 16658 | */ |
16659 | const char* QString::ascii() const | ||
16660 | { | ||
16661 | #ifndef QT_NO_TEXTCODEC | ||
16662 | if ( QTextCodec::codecForCStrings() ) { | ||
16663 | if ( !d->ascii || d->islatin1 ) { | ||
16664 | QCString s = QTextCodec::codecForCStrings()->fromUnicode( *this ); | ||
16665 | s.detach(); | ||
16666 | d->ascii = s.data(); | ||
16667 | d->islatin1 = FALSE; | ||
16668 | s.resetRawData( s.data(), s.size() ); // we have stolen the data | ||
16669 | } | ||
16670 | return d->ascii; | ||
16671 | } | ||
16672 | #endif // QT_NO_TEXTCODEC | ||
16673 | return latin1(); | ||
16674 | } | ||
16584 | 16675 | ||
16585 | /*! | 16676 | /*! |
16586 | Returns the string encoded in UTF8 format. | 16677 | Returns the string encoded in UTF-8 format. |
16587 | 16678 | ||
16588 | See QTextCodec for more diverse coding/decoding of Unicode strings. | 16679 | See QTextCodec for more diverse coding/decoding of Unicode strings. |
16589 | 16680 | ||
16590 | \sa QString::fromUtf8(), local8Bit(), latin1() | 16681 | \sa fromUtf8(), ascii(), latin1(), local8Bit() |
16591 | */ | 16682 | */ |
16592 | QCString QString::utf8() const | 16683 | QCString QString::utf8() const |
16593 | { | 16684 | { |
16594 | int l = length(); | 16685 | int l = length(); |
16595 | int rlen = l*3+1; | 16686 | int rlen = l*3+1; |
16596 | QCString rstr(rlen); | 16687 | QCString rstr(rlen); |
16597 | uchar* cursor = (uchar*)rstr.data(); | 16688 | uchar* cursor = (uchar*)rstr.data(); |
16598 | const QChar *ch = d->unicode; | 16689 | const QChar *ch = d->unicode; |
16599 | for (int i=0; i<l; i++) { | 16690 | for (int i=0; i<l; i++) { |
16600 | ushort u = ch->unicode(); | 16691 | ushort u = ch->unicode(); |
16601 | if ( u < 0x80 ) { | 16692 | if ( u < 0x80 ) { |
16602 | *cursor++ = (uchar)u; | 16693 | *cursor++ = (uchar)u; |
16603 | } else { | 16694 | } else { |
16604 | if ( u < 0x0800 ) { | 16695 | if ( u < 0x0800 ) { |
16605 | *cursor++ = 0xc0 | ((uchar) (u >> 6)); | 16696 | *cursor++ = 0xc0 | ((uchar) (u >> 6)); |
16606 | } else { | 16697 | } else { |
@@ -16620,33 +16711,34 @@ QCString QString::utf8() const | |||
16620 | characters of \a utf8, ignoring the rest of \a utf8. If \a len is | 16711 | characters of \a utf8, ignoring the rest of \a utf8. If \a len is |
16621 | -1 then the length of \a utf8 is used. If \a len is bigger than | 16712 | -1 then the length of \a utf8 is used. If \a len is bigger than |
16622 | the length of \a utf8 then it will use the length of \a utf8. | 16713 | the length of \a utf8 then it will use the length of \a utf8. |
16623 | 16714 | ||
16624 | \code | 16715 | \code |
16625 | QString str = QString::fromUtf8( "123456789", 5 ); | 16716 | QString str = QString::fromUtf8( "123456789", 5 ); |
16626 | // str == "12345" | 16717 | // str == "12345" |
16627 | \endcode | 16718 | \endcode |
16628 | 16719 | ||
16629 | See QTextCodec for more diverse coding/decoding of Unicode strings. | 16720 | See QTextCodec for more diverse coding/decoding of Unicode strings. |
16630 | */ | 16721 | */ |
16631 | QString QString::fromUtf8( const char* utf8, int len ) | 16722 | QString QString::fromUtf8( const char* utf8, int len ) |
16632 | { | 16723 | { |
16633 | if ( !utf8 ) | 16724 | if ( !utf8 ) |
16634 | return QString::null; | 16725 | return QString::null; |
16635 | 16726 | ||
16636 | if ( len < 0 ) len = qstrlen( utf8 ); | 16727 | if ( len < 0 ) |
16728 | len = strlen( utf8 ); | ||
16637 | QString result; | 16729 | QString result; |
16638 | result.setLength( len ); // worst case | 16730 | result.setLength( len ); // worst case |
16639 | QChar *qch = (QChar *)result.unicode(); | 16731 | QChar *qch = (QChar *)result.unicode(); |
16640 | ushort uc = 0; | 16732 | ushort uc = 0; |
16641 | int need = 0; | 16733 | int need = 0; |
16642 | for (int i=0; i<len; i++) { | 16734 | for (int i=0; i<len; i++) { |
16643 | uchar ch = utf8[i]; | 16735 | uchar ch = utf8[i]; |
16644 | if (need) { | 16736 | if (need) { |
16645 | if ( (ch&0xc0) == 0x80 ) { | 16737 | if ( (ch&0xc0) == 0x80 ) { |
16646 | uc = (uc << 6) | (ch & 0x3f); | 16738 | uc = (uc << 6) | (ch & 0x3f); |
16647 | need--; | 16739 | need--; |
16648 | if ( !need ) { | 16740 | if ( !need ) { |
16649 | *qch = uc; | 16741 | *qch = uc; |
16650 | qch++; | 16742 | qch++; |
16651 | } | 16743 | } |
16652 | } else { | 16744 | } else { |
@@ -16661,179 +16753,213 @@ QString QString::fromUtf8( const char* utf8, int len ) | |||
16661 | qch++; | 16753 | qch++; |
16662 | } else if ( (ch&0xe0) == 0xc0 ) { | 16754 | } else if ( (ch&0xe0) == 0xc0 ) { |
16663 | uc = ch &0x1f; | 16755 | uc = ch &0x1f; |
16664 | need = 1; | 16756 | need = 1; |
16665 | } else if ( (ch&0xf0) == 0xe0 ) { | 16757 | } else if ( (ch&0xf0) == 0xe0 ) { |
16666 | uc = ch &0x0f; | 16758 | uc = ch &0x0f; |
16667 | need = 2; | 16759 | need = 2; |
16668 | } | 16760 | } |
16669 | } | 16761 | } |
16670 | } | 16762 | } |
16671 | result.truncate( qch - result.unicode() ); | 16763 | result.truncate( qch - result.unicode() ); |
16672 | return result; | 16764 | return result; |
16673 | } | 16765 | } |
16674 | 16766 | ||
16675 | /*! | 16767 | /*! |
16676 | Returns the Unicode string decoded from the first \a len | 16768 | Returns the Unicode string decoded from the first \a len |
16677 | characters of \a chars, ignoring the rest of \a chars. If \a len | 16769 | characters of \a ascii, ignoring the rest of \a ascii. If \a len |
16678 | is -1 then the length of \a chars is used. If \a len is bigger | 16770 | is -1 then the length of \a ascii is used. If \a len is bigger |
16679 | than the length of \a chars then it will use the length of \a | 16771 | than the length of \a ascii then it will use the length of \a |
16680 | chars. | 16772 | ascii. |
16773 | |||
16774 | If a codec has been set using QTextCodec::codecForCStrings(), | ||
16775 | it is used to convert Unicode to 8-bit char. Otherwise, this function | ||
16776 | does the same as fromLatin1(). | ||
16681 | 16777 | ||
16682 | This is the same as the QString(const char*) constructor, but you | 16778 | This is the same as the QString(const char*) constructor, but you |
16683 | can make that constructor invisible if you compile with the define | 16779 | can make that constructor invisible if you compile with the define |
16684 | \c QT_NO_CAST_ASCII, in which case you can explicitly create a | 16780 | \c QT_NO_CAST_ASCII, in which case you can explicitly create a |
16685 | QString from Latin-1 text using this function. | 16781 | QString from 8-bit ASCII text using this function. |
16686 | 16782 | ||
16687 | \code | 16783 | \code |
16688 | QString str = QString::fromLatin1( "123456789", 5 ); | 16784 | QString str = QString::fromAscii( "123456789", 5 ); |
16689 | // str == "12345" | 16785 | // str == "12345" |
16690 | \endcode | 16786 | \endcode |
16787 | */ | ||
16788 | QString QString::fromAscii( const char* ascii, int len ) | ||
16789 | { | ||
16790 | #ifndef QT_NO_TEXTCODEC | ||
16791 | if ( QTextCodec::codecForCStrings() ) { | ||
16792 | if ( !ascii ) | ||
16793 | return QString::null; | ||
16794 | if ( len < 0 ) | ||
16795 | len = strlen( ascii ); | ||
16796 | if ( len == 0 || *ascii == '\0' ) | ||
16797 | return QString::fromLatin1( "" ); | ||
16798 | return QTextCodec::codecForCStrings()->toUnicode( ascii, len ); | ||
16799 | } | ||
16800 | #endif | ||
16801 | return fromLatin1( ascii, len ); | ||
16802 | } | ||
16803 | |||
16804 | |||
16805 | /*! | ||
16806 | Returns the Unicode string decoded from the first \a len | ||
16807 | characters of \a chars, ignoring the rest of \a chars. If \a len | ||
16808 | is -1 then the length of \a chars is used. If \a len is bigger | ||
16809 | than the length of \a chars then it will use the length of \a | ||
16810 | chars. | ||
16811 | |||
16812 | \sa fromAscii() | ||
16691 | */ | 16813 | */ |
16692 | QString QString::fromLatin1( const char* chars, int len ) | 16814 | QString QString::fromLatin1( const char* chars, int len ) |
16693 | { | 16815 | { |
16694 | uint l; | 16816 | uint l; |
16695 | QChar *uc; | 16817 | QChar *uc; |
16696 | if ( len < 0 ) | 16818 | if ( len < 0 ) |
16697 | len = -1; | 16819 | len = -1; |
16698 | uc = internalAsciiToUnicode( chars, &l, len ); | 16820 | uc = internalLatin1ToUnicode( chars, &l, len ); |
16699 | return QString( new QStringData(uc, l, l), TRUE ); | 16821 | return QString( new QStringData(uc, l, l), TRUE ); |
16700 | } | 16822 | } |
16701 | 16823 | ||
16702 | /*! | 16824 | /*! |
16703 | \fn const QChar* QString::unicode() const | 16825 | \fn const QChar* QString::unicode() const |
16704 | 16826 | ||
16705 | Returns the Unicode representation of the string. The result | 16827 | Returns the Unicode representation of the string. The result |
16706 | remains valid until the string is modified. | 16828 | remains valid until the string is modified. |
16707 | */ | 16829 | */ |
16708 | 16830 | ||
16709 | /*! | 16831 | /*! |
16710 | Returns the string encoded in a locale-specific format. On X11, | 16832 | Returns the string encoded in a locale-specific format. On X11, |
16711 | this is the QTextCodec::codecForLocale(). On Windows, it is a | 16833 | this is the QTextCodec::codecForLocale(). On Windows, it is a |
16712 | system-defined encoding. On Mac OS X, this always uses utf8 as the | 16834 | system-defined encoding. On Mac OS X, this always uses UTF-8 as |
16713 | encoding. | 16835 | the encoding. |
16714 | 16836 | ||
16715 | See QTextCodec for more diverse coding/decoding of Unicode | 16837 | See QTextCodec for more diverse coding/decoding of Unicode |
16716 | strings. | 16838 | strings. |
16717 | 16839 | ||
16718 | \sa QString::fromLocal8Bit(), latin1(), utf8() | 16840 | \sa fromLocal8Bit(), ascii(), latin1(), utf8() |
16719 | */ | 16841 | */ |
16720 | 16842 | ||
16721 | |||
16722 | QCString QString::local8Bit() const | 16843 | QCString QString::local8Bit() const |
16723 | { | 16844 | { |
16724 | #ifdef QT_NO_TEXTCODEC | 16845 | #ifdef QT_NO_TEXTCODEC |
16725 | return latin1(); | 16846 | return latin1(); |
16726 | #else | 16847 | #else |
16727 | #ifdef Q_WS_X11 | 16848 | #ifdef Q_WS_X11 |
16728 | QTextCodec* codec = QTextCodec::codecForLocale(); | 16849 | QTextCodec* codec = QTextCodec::codecForLocale(); |
16729 | return codec | 16850 | return codec |
16730 | ? codec->fromUnicode(*this) | 16851 | ? codec->fromUnicode(*this) |
16731 | : QCString(latin1()); | 16852 | : QCString(latin1()); |
16732 | #endif | 16853 | #endif |
16733 | #if defined( Q_WS_MACX ) | 16854 | #if defined( Q_WS_MACX ) |
16734 | return utf8(); | 16855 | return utf8(); |
16735 | #endif | 16856 | #endif |
16736 | #if defined( Q_WS_MAC9 ) | 16857 | #if defined( Q_WS_MAC9 ) |
16737 | return QCString(latin1()); //I'm evil.. | 16858 | return QCString(latin1()); //I'm evil.. |
16738 | #endif | 16859 | #endif |
16739 | #ifdef Q_WS_WIN | 16860 | #ifdef Q_WS_WIN |
16740 | return qt_winQString2MB( *this ); | 16861 | return qt_winQString2MB( *this ); |
16741 | #endif | 16862 | #endif |
16742 | #ifdef Q_WS_QWS | 16863 | #ifdef Q_WS_QWS |
16743 | return utf8(); // ##### if there is ANY 8 bit format supported? | 16864 | return utf8(); // ### if there is any 8 bit format supported? |
16744 | #endif | 16865 | #endif |
16745 | #endif | 16866 | #endif |
16746 | } | 16867 | } |
16747 | 16868 | ||
16748 | /*! | 16869 | /*! |
16749 | Returns the Unicode string decoded from the first \a len | 16870 | Returns the Unicode string decoded from the first \a len |
16750 | characters of \a local8Bit, ignoring the rest of \a local8Bit. If | 16871 | characters of \a local8Bit, ignoring the rest of \a local8Bit. If |
16751 | \a len is -1 then the length of \a local8Bit is used. If \a len is | 16872 | \a len is -1 then the length of \a local8Bit is used. If \a len is |
16752 | bigger than the length of \a local8Bit then it will use the length | 16873 | bigger than the length of \a local8Bit then it will use the length |
16753 | of \a local8Bit. | 16874 | of \a local8Bit. |
16754 | 16875 | ||
16755 | \code | 16876 | \code |
16756 | QString str = QString::fromLocal8Bit( "123456789", 5 ); | 16877 | QString str = QString::fromLocal8Bit( "123456789", 5 ); |
16757 | // str == "12345" | 16878 | // str == "12345" |
16758 | \endcode | 16879 | \endcode |
16759 | 16880 | ||
16760 | \a local8Bit is assumed to be encoded in a locale-specific format. | 16881 | \a local8Bit is assumed to be encoded in a locale-specific format. |
16761 | 16882 | ||
16762 | See QTextCodec for more diverse coding/decoding of Unicode strings. | 16883 | See QTextCodec for more diverse coding/decoding of Unicode strings. |
16763 | */ | 16884 | */ |
16764 | QString QString::fromLocal8Bit( const char* local8Bit, int len ) | 16885 | QString QString::fromLocal8Bit( const char* local8Bit, int len ) |
16765 | { | 16886 | { |
16766 | #ifdef QT_NO_TEXTCODEC | 16887 | #ifdef QT_NO_TEXTCODEC |
16767 | return fromLatin1( local8Bit, len ); | 16888 | return fromLatin1( local8Bit, len ); |
16768 | #else | 16889 | #else |
16769 | 16890 | ||
16770 | if ( !local8Bit ) | 16891 | if ( !local8Bit ) |
16771 | return QString::null; | 16892 | return QString::null; |
16772 | #ifdef Q_WS_X11 | 16893 | #ifdef Q_WS_X11 |
16773 | QTextCodec* codec = QTextCodec::codecForLocale(); | 16894 | QTextCodec* codec = QTextCodec::codecForLocale(); |
16774 | if ( len < 0 ) len = qstrlen(local8Bit); | 16895 | if ( len < 0 ) |
16896 | len = strlen( local8Bit ); | ||
16775 | return codec | 16897 | return codec |
16776 | ? codec->toUnicode( local8Bit, len ) | 16898 | ? codec->toUnicode( local8Bit, len ) |
16777 | : fromLatin1( local8Bit, len ); | 16899 | : fromLatin1( local8Bit, len ); |
16778 | #endif | 16900 | #endif |
16779 | #if defined( Q_WS_MAC ) | 16901 | #if defined( Q_WS_MAC ) |
16780 | return fromUtf8(local8Bit,len); | 16902 | return fromUtf8(local8Bit,len); |
16781 | #endif | 16903 | #endif |
16782 | // Should this be OS_WIN32? | 16904 | // Should this be OS_WIN32? |
16783 | #ifdef Q_WS_WIN | 16905 | #ifdef Q_WS_WIN |
16784 | if ( len >= 0 ) { | 16906 | if ( len >= 0 ) { |
16785 | QCString s(local8Bit,len+1); | 16907 | QCString s(local8Bit,len+1); |
16786 | return qt_winMB2QString(s); | 16908 | return qt_winMB2QString(s); |
16787 | } | 16909 | } |
16788 | return qt_winMB2QString( local8Bit ); | 16910 | return qt_winMB2QString( local8Bit ); |
16789 | #endif | 16911 | #endif |
16790 | #ifdef Q_WS_QWS | 16912 | #ifdef Q_WS_QWS |
16791 | return fromUtf8(local8Bit,len); | 16913 | return fromUtf8(local8Bit,len); |
16792 | #endif | 16914 | #endif |
16793 | #endif // QT_NO_TEXTCODEC | 16915 | #endif // QT_NO_TEXTCODEC |
16794 | } | 16916 | } |
16795 | 16917 | ||
16796 | /*! | 16918 | /*! |
16797 | \fn QString::operator const char *() const | 16919 | \fn QString::operator const char *() const |
16798 | 16920 | ||
16799 | Returns latin1(). Be sure to see the warnings documented in the | 16921 | Returns latin1(). Be sure to see the warnings documented in the |
16800 | latin1() function. Note that for new code which you wish to be | 16922 | latin1() function. Note that for new code which you wish to be |
16801 | strictly Unicode-clean, you can define the macro \c | 16923 | strictly Unicode-clean, you can define the macro \c |
16802 | QT_NO_ASCII_CAST when compiling your code to hide this function so | 16924 | QT_NO_ASCII_CAST when compiling your code to hide this function so |
16803 | that automatic casts are not done. This has the added advantage | 16925 | that automatic casts are not done. This has the added advantage |
16804 | that you catch the programming error described in operator!(). | 16926 | that you catch the programming error described in operator!(). |
16805 | */ | 16927 | */ |
16806 | 16928 | ||
16929 | /*! | ||
16930 | \fn QString::operator std::string() const | ||
16931 | |||
16932 | Returns ascii(). | ||
16933 | */ | ||
16934 | |||
16807 | 16935 | ||
16808 | /*! | 16936 | /*! |
16809 | Returns the QString as a zero terminated array of unsigned shorts | 16937 | Returns the QString as a zero terminated array of unsigned shorts |
16810 | if the string is not null; otherwise returns zero. | 16938 | if the string is not null; otherwise returns zero. |
16811 | 16939 | ||
16812 | The result remains valid so long as one unmodified | 16940 | The result remains valid so long as one unmodified |
16813 | copy of the source string exists. | 16941 | copy of the source string exists. |
16814 | */ | 16942 | */ |
16815 | const unsigned short *QString::ucs2() const | 16943 | const unsigned short *QString::ucs2() const |
16816 | { | 16944 | { |
16817 | if ( ! d->unicode ) | 16945 | if ( ! d->unicode ) |
16818 | return 0; | 16946 | return 0; |
16819 | unsigned int len = d->len; | 16947 | unsigned int len = d->len; |
16820 | if ( d->maxl < len + 1 ) { | 16948 | if ( d->maxl < len + 1 ) { |
16821 | // detach, grow or shrink | 16949 | // detach, grow or shrink |
16822 | Q2HELPER(stat_copy_on_write++) | ||
16823 | Q2HELPER(stat_copy_on_write_size += len) | ||
16824 | uint newMax = computeNewMax( len + 1 ); | 16950 | uint newMax = computeNewMax( len + 1 ); |
16825 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); | 16951 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); |
16826 | if ( nd ) { | 16952 | if ( nd ) { |
16827 | if ( d->unicode ) | 16953 | if ( d->unicode ) |
16828 | memcpy( nd, d->unicode, sizeof(QChar)*len ); | 16954 | memcpy( nd, d->unicode, sizeof(QChar)*len ); |
16829 | ((QString *)this)->deref(); | 16955 | ((QString *)this)->deref(); |
16830 | ((QString *)this)->d = new QStringData( nd, len, newMax ); | 16956 | ((QString *)this)->d = new QStringData( nd, len, newMax ); |
16831 | } | 16957 | } |
16832 | } | 16958 | } |
16833 | d->unicode[len] = 0; | 16959 | d->unicode[len] = 0; |
16834 | return (unsigned short *) d->unicode; | 16960 | return (unsigned short *) d->unicode; |
16835 | } | 16961 | } |
16836 | 16962 | ||
16837 | /*! | 16963 | /*! |
16838 | Constructs a string that is a deep copy of \a str, interpreted as a | 16964 | Constructs a string that is a deep copy of \a str, interpreted as a |
16839 | UCS2 encoded, zero terminated, Unicode string. | 16965 | UCS2 encoded, zero terminated, Unicode string. |
@@ -16970,34 +17096,32 @@ void QString::subat( uint i ) | |||
16970 | string becomes a \link isNull() null\endlink string. | 17096 | string becomes a \link isNull() null\endlink string. |
16971 | 17097 | ||
16972 | \sa setLatin1(), isNull() | 17098 | \sa setLatin1(), isNull() |
16973 | */ | 17099 | */ |
16974 | 17100 | ||
16975 | QString& QString::setUnicode( const QChar *unicode, uint len ) | 17101 | QString& QString::setUnicode( const QChar *unicode, uint len ) |
16976 | { | 17102 | { |
16977 | if ( len == 0 ) { // set to null string | 17103 | if ( len == 0 ) { // set to null string |
16978 | if ( d != shared_null ) { // beware of nullstring being set to nullstring | 17104 | if ( d != shared_null ) { // beware of nullstring being set to nullstring |
16979 | deref(); | 17105 | deref(); |
16980 | d = shared_null ? shared_null : makeSharedNull(); | 17106 | d = shared_null ? shared_null : makeSharedNull(); |
16981 | d->ref(); | 17107 | d->ref(); |
16982 | } | 17108 | } |
16983 | } else if ( d->count != 1 || len > d->maxl || | 17109 | } else if ( d->count != 1 || len > d->maxl || |
16984 | ( len * 4 < d->maxl && d->maxl > 4 ) ) { | 17110 | ( len * 4 < d->maxl && d->maxl > 4 ) ) { |
16985 | // detach, grown or shrink | 17111 | // detach, grown or shrink |
16986 | Q2HELPER(stat_copy_on_write++) | ||
16987 | Q2HELPER(stat_copy_on_write_size+=d->len) | ||
16988 | uint newMax = computeNewMax( len ); | 17112 | uint newMax = computeNewMax( len ); |
16989 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); | 17113 | QChar* nd = QT_ALLOC_QCHAR_VEC( newMax ); |
16990 | if ( unicode ) | 17114 | if ( unicode ) |
16991 | memcpy( nd, unicode, sizeof(QChar)*len ); | 17115 | memcpy( nd, unicode, sizeof(QChar)*len ); |
16992 | deref(); | 17116 | deref(); |
16993 | d = new QStringData( nd, len, newMax ); | 17117 | d = new QStringData( nd, len, newMax ); |
16994 | } else { | 17118 | } else { |
16995 | d->len = len; | 17119 | d->len = len; |
16996 | d->setDirty(); | 17120 | d->setDirty(); |
16997 | if ( unicode ) | 17121 | if ( unicode ) |
16998 | memcpy( d->unicode, unicode, sizeof(QChar)*len ); | 17122 | memcpy( d->unicode, unicode, sizeof(QChar)*len ); |
16999 | } | 17123 | } |
17000 | return *this; | 17124 | return *this; |
17001 | } | 17125 | } |
17002 | 17126 | ||
17003 | /*! | 17127 | /*! |
@@ -17005,75 +17129,97 @@ QString& QString::setUnicode( const QChar *unicode, uint len ) | |||
17005 | unicode_as_ushorts into the string (on some X11 client platforms | 17129 | unicode_as_ushorts into the string (on some X11 client platforms |
17006 | this will involve a byte-swapping pass). | 17130 | this will involve a byte-swapping pass). |
17007 | 17131 | ||
17008 | If \a unicode_as_ushorts is 0, nothing is copied, but the string | 17132 | If \a unicode_as_ushorts is 0, nothing is copied, but the string |
17009 | is still resized to \a len. If \a len is zero, the string becomes | 17133 | is still resized to \a len. If \a len is zero, the string becomes |
17010 | a \link isNull() null\endlink string. | 17134 | a \link isNull() null\endlink string. |
17011 | 17135 | ||
17012 | \sa setLatin1(), isNull() | 17136 | \sa setLatin1(), isNull() |
17013 | */ | 17137 | */ |
17014 | QString& QString::setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ) | 17138 | QString& QString::setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ) |
17015 | { | 17139 | { |
17016 | return setUnicode((const QChar*)unicode_as_ushorts, len); | 17140 | return setUnicode((const QChar*)unicode_as_ushorts, len); |
17017 | } | 17141 | } |
17018 | 17142 | ||
17019 | 17143 | ||
17020 | /*! | 17144 | /*! |
17145 | Sets this string to \a str, interpreted as a classic 8-bit ASCII C | ||
17146 | string. If \a len is -1 (the default), then it is set to | ||
17147 | strlen(str). | ||
17148 | |||
17149 | If \a str is 0 a null string is created. If \a str is "", an empty | ||
17150 | string is created. | ||
17151 | |||
17152 | \sa isNull(), isEmpty() | ||
17153 | */ | ||
17154 | |||
17155 | QString &QString::setAscii( const char *str, int len ) | ||
17156 | { | ||
17157 | #ifndef QT_NO_TEXTCODEC | ||
17158 | if ( QTextCodec::codecForCStrings() ) { | ||
17159 | *this = QString::fromAscii( str, len ); | ||
17160 | return *this; | ||
17161 | } | ||
17162 | #endif // QT_NO_TEXTCODEC | ||
17163 | return setLatin1( str, len ); | ||
17164 | } | ||
17165 | |||
17166 | /*! | ||
17021 | Sets this string to \a str, interpreted as a classic Latin1 C | 17167 | Sets this string to \a str, interpreted as a classic Latin1 C |
17022 | string. If \a len is -1 (the default), then it is set to | 17168 | string. If \a len is -1 (the default), then it is set to |
17023 | strlen(str). | 17169 | strlen(str). |
17024 | 17170 | ||
17025 | If \a str is 0 a null string is created. If \a str is "", an empty | 17171 | If \a str is 0 a null string is created. If \a str is "", an empty |
17026 | string is created. | 17172 | string is created. |
17027 | 17173 | ||
17028 | \sa isNull(), isEmpty() | 17174 | \sa isNull(), isEmpty() |
17029 | */ | 17175 | */ |
17030 | 17176 | ||
17031 | QString &QString::setLatin1( const char *str, int len ) | 17177 | QString &QString::setLatin1( const char *str, int len ) |
17032 | { | 17178 | { |
17033 | if ( str == 0 ) | 17179 | if ( str == 0 ) |
17034 | return setUnicode(0,0); | 17180 | return setUnicode(0,0); |
17035 | if ( len < 0 ) | 17181 | if ( len < 0 ) |
17036 | len = qstrlen(str); | 17182 | len = strlen( str ); |
17037 | if ( len == 0 ) { // won't make a null string | 17183 | if ( len == 0 ) { // won't make a null string |
17038 | *this = QString::fromLatin1( "" ); | 17184 | *this = QString::fromLatin1( "" ); |
17039 | } else { | 17185 | } else { |
17040 | setUnicode( 0, len ); // resize but not copy | 17186 | setUnicode( 0, len ); // resize but not copy |
17041 | QChar *p = d->unicode; | 17187 | QChar *p = d->unicode; |
17042 | while ( len-- ) | 17188 | while ( len-- ) |
17043 | *p++ = *str++; | 17189 | *p++ = *str++; |
17044 | } | 17190 | } |
17045 | return *this; | 17191 | return *this; |
17046 | } | 17192 | } |
17047 | 17193 | ||
17048 | /*! \internal | 17194 | /*! \internal |
17049 | */ | 17195 | */ |
17050 | void QString::checkSimpleText() const | 17196 | void QString::checkSimpleText() const |
17051 | { | 17197 | { |
17052 | QChar *p = d->unicode; | 17198 | QChar *p = d->unicode; |
17053 | QChar *end = p + d->len; | 17199 | QChar *end = p + d->len; |
17054 | d->simpletext = 1; | ||
17055 | while( p < end ) { | 17200 | while( p < end ) { |
17056 | ushort uc = p->unicode(); | 17201 | ushort uc = p->unicode(); |
17057 | // sort out regions of complex text formatting | 17202 | // sort out regions of complex text formatting |
17058 | if ( uc > 0x058f && ( uc < 0x1100 || uc > 0xfb0f ) ) { | 17203 | if ( uc > 0x058f && ( uc < 0x1100 || uc > 0xfb0f ) ) { |
17059 | d->simpletext = 0; | 17204 | d->issimpletext = FALSE; |
17060 | return; | 17205 | return; |
17061 | } | 17206 | } |
17062 | p++; | 17207 | p++; |
17063 | } | 17208 | } |
17209 | d->issimpletext = TRUE; | ||
17064 | } | 17210 | } |
17065 | 17211 | ||
17066 | /*! \fn bool QString::simpleText() const | 17212 | /*! \fn bool QString::simpleText() const |
17067 | \internal | 17213 | \internal |
17068 | */ | 17214 | */ |
17069 | 17215 | ||
17070 | /*! \internal | 17216 | /*! \internal |
17071 | */ | 17217 | */ |
17072 | bool QString::isRightToLeft() const | 17218 | bool QString::isRightToLeft() const |
17073 | { | 17219 | { |
17074 | int len = length(); | 17220 | int len = length(); |
17075 | QChar *p = d->unicode; | 17221 | QChar *p = d->unicode; |
17076 | while( len-- ) { | 17222 | while( len-- ) { |
17077 | switch( ::direction( *p ) ) | 17223 | switch( ::direction( *p ) ) |
17078 | { | 17224 | { |
17079 | case QChar::DirL: | 17225 | case QChar::DirL: |
diff --git a/qmake/tools/qtextstream.cpp b/qmake/tools/qtextstream.cpp index 75c6531..ddca5bd 100644 --- a/qmake/tools/qtextstream.cpp +++ b/qmake/tools/qtextstream.cpp | |||
@@ -1076,33 +1076,33 @@ QTextStream &QTextStream::writeBlock( const char* p, uint len ) | |||
1076 | return *this; | 1076 | return *this; |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | QTextStream &QTextStream::writeBlock( const QChar* p, uint len ) | 1079 | QTextStream &QTextStream::writeBlock( const QChar* p, uint len ) |
1080 | { | 1080 | { |
1081 | #ifndef QT_NO_TEXTCODEC | 1081 | #ifndef QT_NO_TEXTCODEC |
1082 | if ( mapper ) { | 1082 | if ( mapper ) { |
1083 | if ( !d->encoder ) | 1083 | if ( !d->encoder ) |
1084 | d->encoder = mapper->makeEncoder(); | 1084 | d->encoder = mapper->makeEncoder(); |
1085 | QConstString s( p, len ); | 1085 | QConstString s( p, len ); |
1086 | int l = len; | 1086 | int l = len; |
1087 | QCString block = d->encoder->fromUnicode( s.string(), l ); | 1087 | QCString block = d->encoder->fromUnicode( s.string(), l ); |
1088 | dev->writeBlock( block, l ); | 1088 | dev->writeBlock( block, l ); |
1089 | } else | 1089 | } else |
1090 | #endif | 1090 | #endif |
1091 | if ( latin1 ) { | 1091 | if ( latin1 ) { |
1092 | char *str = QString::unicodeToAscii( p, len ); | 1092 | char *str = QString::unicodeToLatin1( p, len ); |
1093 | dev->writeBlock( str, len ); | 1093 | dev->writeBlock( str, len ); |
1094 | delete [] str; | 1094 | delete [] str; |
1095 | } else if ( internalOrder ) { | 1095 | } else if ( internalOrder ) { |
1096 | if ( doUnicodeHeader ) { | 1096 | if ( doUnicodeHeader ) { |
1097 | doUnicodeHeader = FALSE; | 1097 | doUnicodeHeader = FALSE; |
1098 | ts_putc( QChar::byteOrderMark ); | 1098 | ts_putc( QChar::byteOrderMark ); |
1099 | } | 1099 | } |
1100 | dev->writeBlock( (char*)p, sizeof(QChar)*len ); | 1100 | dev->writeBlock( (char*)p, sizeof(QChar)*len ); |
1101 | } else { | 1101 | } else { |
1102 | for (uint i=0; i<len; i++) | 1102 | for (uint i=0; i<len; i++) |
1103 | ts_putc( p[i] ); | 1103 | ts_putc( p[i] ); |
1104 | } | 1104 | } |
1105 | return *this; | 1105 | return *this; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | /*! | 1108 | /*! |
diff --git a/qmake/tools/qucom.cpp b/qmake/tools/qucom.cpp index 6086a79..658da97 100644 --- a/qmake/tools/qucom.cpp +++ b/qmake/tools/qucom.cpp | |||
@@ -283,250 +283,133 @@ int QUType_bool::serializeFrom( QUObject *, QUBuffer * ) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | // {53C1F3BE-73C3-4c7d-9E05-CCF09EB676B5} | 285 | // {53C1F3BE-73C3-4c7d-9E05-CCF09EB676B5} |
286 | const QUuid TID_QUType_int( 0x53c1f3be, 0x73c3, 0x4c7d, 0x9e, 0x5, 0xcc, 0xf0, 0x9e, 0xb6, 0x76, 0xb5 ); | 286 | const QUuid TID_QUType_int( 0x53c1f3be, 0x73c3, 0x4c7d, 0x9e, 0x5, 0xcc, 0xf0, 0x9e, 0xb6, 0x76, 0xb5 ); |
287 | QUType_int static_QUType_int; | 287 | QUType_int static_QUType_int; |
288 | const QUuid *QUType_int::uuid() const { return &TID_QUType_int; } | 288 | const QUuid *QUType_int::uuid() const { return &TID_QUType_int; } |
289 | const char *QUType_int::desc() const { return "int"; } | 289 | const char *QUType_int::desc() const { return "int"; } |
290 | 290 | ||
291 | void QUType_int::set( QUObject *o, int v ) | 291 | void QUType_int::set( QUObject *o, int v ) |
292 | { | 292 | { |
293 | o->payload.i = v; | 293 | o->payload.i = v; |
294 | o->type = this; | 294 | o->type = this; |
295 | } | 295 | } |
296 | 296 | ||
297 | bool QUType_int::canConvertFrom( QUObject *o, QUType *t ) | 297 | bool QUType_int::canConvertFrom( QUObject *o, QUType *t ) |
298 | { | 298 | { |
299 | if ( isEqual( t, &static_QUType_double ) || | 299 | if ( isEqual( t, &static_QUType_double ) ) |
300 | isEqual( t, &static_QUType_float ) ) | ||
301 | return TRUE; | 300 | return TRUE; |
302 | 301 | ||
303 | return t->canConvertTo( o, this ); | 302 | return t->canConvertTo( o, this ); |
304 | } | 303 | } |
305 | 304 | ||
306 | bool QUType_int::canConvertTo( QUObject * /*o*/, QUType *t ) | 305 | bool QUType_int::canConvertTo( QUObject * /*o*/, QUType *t ) |
307 | { | 306 | { |
308 | return isEqual( t, &static_QUType_double ) || | 307 | return isEqual( t, &static_QUType_double ); |
309 | isEqual( t, &static_QUType_float ); | ||
310 | } | 308 | } |
311 | 309 | ||
312 | bool QUType_int::convertFrom( QUObject *o, QUType *t ) | 310 | bool QUType_int::convertFrom( QUObject *o, QUType *t ) |
313 | { | 311 | { |
314 | if ( isEqual( t, &static_QUType_double ) ) | 312 | if ( isEqual( t, &static_QUType_double ) ) |
315 | o->payload.i = (long)o->payload.d; | 313 | o->payload.i = (long)o->payload.d; |
316 | else if ( isEqual( t, &static_QUType_float ) ) | ||
317 | o->payload.i = (long)o->payload.f; | ||
318 | else | 314 | else |
319 | return t->convertTo( o, this ); | 315 | return t->convertTo( o, this ); |
320 | 316 | ||
321 | o->type = this; | 317 | o->type = this; |
322 | return TRUE; | 318 | return TRUE; |
323 | } | 319 | } |
324 | 320 | ||
325 | bool QUType_int::convertTo( QUObject *o, QUType *t ) | 321 | bool QUType_int::convertTo( QUObject *o, QUType *t ) |
326 | { | 322 | { |
327 | if ( isEqual( t, &static_QUType_double ) ) { | 323 | if ( isEqual( t, &static_QUType_double ) ) { |
328 | o->payload.d = (double)o->payload.i; | 324 | o->payload.d = (double)o->payload.i; |
329 | o->type = &static_QUType_double; | 325 | o->type = &static_QUType_double; |
330 | } else if ( isEqual( t, &static_QUType_float ) ) { | ||
331 | o->payload.f = (float)o->payload.i; | ||
332 | o->type = &static_QUType_float; | ||
333 | } else | 326 | } else |
334 | return FALSE; | 327 | return FALSE; |
335 | return TRUE; | 328 | return TRUE; |
336 | } | 329 | } |
337 | 330 | ||
338 | int QUType_int::serializeTo( QUObject *, QUBuffer * ) | 331 | int QUType_int::serializeTo( QUObject *, QUBuffer * ) |
339 | { | 332 | { |
340 | return 0; | 333 | return 0; |
341 | } | 334 | } |
342 | 335 | ||
343 | int QUType_int::serializeFrom( QUObject *, QUBuffer * ) | 336 | int QUType_int::serializeFrom( QUObject *, QUBuffer * ) |
344 | { | 337 | { |
345 | return 0; | 338 | return 0; |
346 | } | 339 | } |
347 | 340 | ||
348 | // {5938712A-C496-11D5-8CB2-00C0F03BC0F3} | ||
349 | const QUuid TID_QUType_uint( 0x5938712a, 0xc496, 0x11d5, 0x8c, 0xb2, 0x00, 0xc0, 0xf0, 0x3b, 0xc0, 0xf3); | ||
350 | QUType_uint static_QUType_uint; | ||
351 | const QUuid *QUType_uint::uuid() const { return &TID_QUType_uint; } | ||
352 | const char *QUType_uint::desc() const { return "uint"; } | ||
353 | |||
354 | void QUType_uint::set( QUObject *o, uint v ) | ||
355 | { | ||
356 | o->payload.ui = v; | ||
357 | o->type = this; | ||
358 | } | ||
359 | |||
360 | bool QUType_uint::canConvertFrom( QUObject *o, QUType *t ) | ||
361 | { | ||
362 | return t->canConvertTo( o, this ); | ||
363 | } | ||
364 | |||
365 | bool QUType_uint::canConvertTo( QUObject * /*o*/, QUType * /*t*/ ) | ||
366 | { | ||
367 | return FALSE; | ||
368 | } | ||
369 | |||
370 | bool QUType_uint::convertFrom( QUObject *o, QUType *t ) | ||
371 | { | ||
372 | return t->convertTo( o, this ); | ||
373 | } | ||
374 | |||
375 | bool QUType_uint::convertTo( QUObject * /*o*/, QUType * /*t*/ ) | ||
376 | { | ||
377 | return FALSE; | ||
378 | } | ||
379 | |||
380 | int QUType_uint::serializeTo( QUObject *, QUBuffer * ) | ||
381 | { | ||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | int QUType_uint::serializeFrom( QUObject *, QUBuffer * ) | ||
386 | { | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | // {2D0974E5-0BA6-4ec2-8837-C198972CB48C} | 341 | // {2D0974E5-0BA6-4ec2-8837-C198972CB48C} |
391 | const QUuid TID_QUType_double( 0x2d0974e5, 0xba6, 0x4ec2, 0x88, 0x37, 0xc1, 0x98, 0x97, 0x2c, 0xb4, 0x8c ); | 342 | const QUuid TID_QUType_double( 0x2d0974e5, 0xba6, 0x4ec2, 0x88, 0x37, 0xc1, 0x98, 0x97, 0x2c, 0xb4, 0x8c ); |
392 | QUType_double static_QUType_double; | 343 | QUType_double static_QUType_double; |
393 | const QUuid *QUType_double::uuid() const { return &TID_QUType_double; } | 344 | const QUuid *QUType_double::uuid() const { return &TID_QUType_double; } |
394 | const char *QUType_double::desc() const {return "double"; } | 345 | const char *QUType_double::desc() const {return "double"; } |
395 | 346 | ||
396 | void QUType_double::set( QUObject *o, double v ) | 347 | void QUType_double::set( QUObject *o, double v ) |
397 | { | 348 | { |
398 | o->payload.d = v; | 349 | o->payload.d = v; |
399 | o->type = this; | 350 | o->type = this; |
400 | } | 351 | } |
401 | 352 | ||
402 | bool QUType_double::canConvertFrom( QUObject *o, QUType *t ) | 353 | bool QUType_double::canConvertFrom( QUObject *o, QUType *t ) |
403 | { | 354 | { |
404 | if ( isEqual( t, &static_QUType_int ) || | 355 | if ( isEqual( t, &static_QUType_int ) ) |
405 | isEqual( t, &static_QUType_float) ) | ||
406 | return TRUE; | 356 | return TRUE; |
407 | 357 | ||
408 | return t->canConvertTo( o, this ); | 358 | return t->canConvertTo( o, this ); |
409 | } | 359 | } |
410 | 360 | ||
411 | bool QUType_double::canConvertTo( QUObject * /*o*/, QUType *t ) | 361 | bool QUType_double::canConvertTo( QUObject * /*o*/, QUType *t ) |
412 | { | 362 | { |
413 | return isEqual( t, &static_QUType_int ) || | 363 | return isEqual( t, &static_QUType_int ); |
414 | isEqual( t, &static_QUType_float ); | ||
415 | } | 364 | } |
416 | 365 | ||
417 | bool QUType_double::convertFrom( QUObject *o, QUType *t ) | 366 | bool QUType_double::convertFrom( QUObject *o, QUType *t ) |
418 | { | 367 | { |
419 | if ( isEqual( t, &static_QUType_int ) ) | 368 | if ( isEqual( t, &static_QUType_int ) ) |
420 | o->payload.d = (double)o->payload.i; | 369 | o->payload.d = (double)o->payload.i; |
421 | else if ( isEqual( t, &static_QUType_float ) ) | 370 | else |
422 | o->payload.d = (double)o->payload.f; | ||
423 | else | ||
424 | return t->convertTo( o, this ); | 371 | return t->convertTo( o, this ); |
425 | 372 | ||
426 | o->type = this; | 373 | o->type = this; |
427 | return TRUE; | 374 | return TRUE; |
428 | } | 375 | } |
429 | 376 | ||
430 | bool QUType_double::convertTo( QUObject *o, QUType *t ) | 377 | bool QUType_double::convertTo( QUObject *o, QUType *t ) |
431 | { | 378 | { |
432 | if ( isEqual( t, &static_QUType_int ) ) { | 379 | if ( isEqual( t, &static_QUType_int ) ) { |
433 | o->payload.i = (int) o->payload.d; | 380 | o->payload.i = (int) o->payload.d; |
434 | o->type = &static_QUType_int; | 381 | o->type = &static_QUType_int; |
435 | } else if ( isEqual( t, &static_QUType_double ) ) { | 382 | } else if ( isEqual( t, &static_QUType_double ) ) { |
436 | o->payload.d = (double) o->payload.f; | 383 | o->payload.d = (double) o->payload.f; |
437 | o->type = &static_QUType_double; | 384 | o->type = &static_QUType_double; |
438 | } else | 385 | } else |
439 | return FALSE; | 386 | return FALSE; |
440 | return TRUE; | 387 | return TRUE; |
441 | } | 388 | } |
442 | 389 | ||
443 | int QUType_double::serializeTo( QUObject *, QUBuffer * ) | 390 | int QUType_double::serializeTo( QUObject *, QUBuffer * ) |
444 | { | 391 | { |
445 | return 0; | 392 | return 0; |
446 | } | 393 | } |
447 | 394 | ||
448 | int QUType_double::serializeFrom( QUObject *, QUBuffer * ) | 395 | int QUType_double::serializeFrom( QUObject *, QUBuffer * ) |
449 | { | 396 | { |
450 | return 0; | 397 | return 0; |
451 | } | 398 | } |
452 | 399 | ||
453 | |||
454 | // {544C5175-6993-4486-B04D-CEC4D21BF4B9 } | ||
455 | const QUuid TID_QUType_float( 0x544c5175, 0x6993, 0x4486, 0xb0, 0x4d, 0xce, 0xc4, 0xd2, 0x1b, 0xf4, 0xb9 ); | ||
456 | QUType_float static_QUType_float; | ||
457 | const QUuid *QUType_float::uuid() const { return &TID_QUType_float; } | ||
458 | const char *QUType_float::desc() const {return "float"; } | ||
459 | |||
460 | void QUType_float::set( QUObject *o, float v ) | ||
461 | { | ||
462 | o->payload.f = v; | ||
463 | o->type = this; | ||
464 | } | ||
465 | |||
466 | bool QUType_float::canConvertFrom( QUObject *o, QUType *t ) | ||
467 | { | ||
468 | if ( isEqual( t, &static_QUType_int ) || | ||
469 | isEqual( t, &static_QUType_double ) ) | ||
470 | return TRUE; | ||
471 | |||
472 | return t->canConvertTo( o, this ); | ||
473 | } | ||
474 | |||
475 | bool QUType_float::canConvertTo( QUObject * /*o*/, QUType *t ) | ||
476 | { | ||
477 | return isEqual( t, &static_QUType_int ) || | ||
478 | isEqual( t, &static_QUType_double ); | ||
479 | } | ||
480 | |||
481 | bool QUType_float::convertFrom( QUObject *o, QUType *t ) | ||
482 | { | ||
483 | if ( isEqual( t, &static_QUType_int ) ) | ||
484 | o->payload.f = (float)o->payload.i; | ||
485 | else if ( isEqual( t, &static_QUType_double ) ) | ||
486 | o->payload.f = (float)o->payload.d; | ||
487 | else | ||
488 | return t->convertTo( o, this ); | ||
489 | |||
490 | o->type = this; | ||
491 | return TRUE; | ||
492 | } | ||
493 | |||
494 | bool QUType_float::convertTo( QUObject *o, QUType *t ) | ||
495 | { | ||
496 | if ( isEqual( t, &static_QUType_int ) ) { | ||
497 | o->payload.i = (int) o->payload.f; | ||
498 | o->type = &static_QUType_int; | ||
499 | } else if ( isEqual( t, &static_QUType_double ) ) { | ||
500 | o->payload.d = (double) o->payload.f; | ||
501 | o->type = &static_QUType_double; | ||
502 | } else | ||
503 | return FALSE; | ||
504 | return TRUE; | ||
505 | } | ||
506 | |||
507 | int QUType_float::serializeTo( QUObject *, QUBuffer * ) | ||
508 | { | ||
509 | return 0; | ||
510 | } | ||
511 | |||
512 | int QUType_float::serializeFrom( QUObject *, QUBuffer * ) | ||
513 | { | ||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | // {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} | 400 | // {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} |
518 | const QUuid TID_QUType_charstar( 0xefcdd1d4, 0x77a3, 0x4b8e, 0x8d, 0x46, 0xdc, 0x14, 0xb8, 0xd3, 0x93, 0xe9 ); | 401 | const QUuid TID_QUType_charstar( 0xefcdd1d4, 0x77a3, 0x4b8e, 0x8d, 0x46, 0xdc, 0x14, 0xb8, 0xd3, 0x93, 0xe9 ); |
519 | QUType_charstar static_QUType_charstar; | 402 | QUType_charstar static_QUType_charstar; |
520 | const QUuid *QUType_charstar::uuid() const { return &TID_QUType_charstar; } | 403 | const QUuid *QUType_charstar::uuid() const { return &TID_QUType_charstar; } |
521 | const char *QUType_charstar::desc() const { return "char*"; } | 404 | const char *QUType_charstar::desc() const { return "char*"; } |
522 | 405 | ||
523 | void QUType_charstar::set( QUObject *o, const char* v, bool take ) | 406 | void QUType_charstar::set( QUObject *o, const char* v, bool take ) |
524 | { | 407 | { |
525 | if ( take ) { | 408 | if ( take ) { |
526 | if ( v ) { | 409 | if ( v ) { |
527 | o->payload.charstar.ptr = new char[ strlen(v) + 1 ]; | 410 | o->payload.charstar.ptr = new char[ strlen(v) + 1 ]; |
528 | strcpy( o->payload.charstar.ptr, v ); | 411 | strcpy( o->payload.charstar.ptr, v ); |
529 | } else { | 412 | } else { |
530 | o->payload.charstar.ptr = 0; | 413 | o->payload.charstar.ptr = 0; |
531 | } | 414 | } |
532 | o->payload.charstar.owner = TRUE; | 415 | o->payload.charstar.owner = TRUE; |
@@ -580,83 +463,76 @@ int QUType_charstar::serializeFrom( QUObject *, QUBuffer * ) | |||
580 | // {44C2A547-01E7-4e56-8559-35AF9D2F42B7} | 463 | // {44C2A547-01E7-4e56-8559-35AF9D2F42B7} |
581 | const QUuid TID_QUType_QString( 0x44c2a547, 0x1e7, 0x4e56, 0x85, 0x59, 0x35, 0xaf, 0x9d, 0x2f, 0x42, 0xb7 ); | 464 | const QUuid TID_QUType_QString( 0x44c2a547, 0x1e7, 0x4e56, 0x85, 0x59, 0x35, 0xaf, 0x9d, 0x2f, 0x42, 0xb7 ); |
582 | QUType_QString static_QUType_QString; | 465 | QUType_QString static_QUType_QString; |
583 | const QUuid *QUType_QString::uuid() const { return &TID_QUType_QString; } | 466 | const QUuid *QUType_QString::uuid() const { return &TID_QUType_QString; } |
584 | const char *QUType_QString::desc() const { return "QString"; } | 467 | const char *QUType_QString::desc() const { return "QString"; } |
585 | 468 | ||
586 | void QUType_QString::set( QUObject *o, const QString& v ) | 469 | void QUType_QString::set( QUObject *o, const QString& v ) |
587 | { | 470 | { |
588 | o->payload.ptr = new QString( v ); | 471 | o->payload.ptr = new QString( v ); |
589 | o->type = this; | 472 | o->type = this; |
590 | } | 473 | } |
591 | 474 | ||
592 | bool QUType_QString::canConvertFrom( QUObject *o, QUType *t ) | 475 | bool QUType_QString::canConvertFrom( QUObject *o, QUType *t ) |
593 | { | 476 | { |
594 | if ( isEqual( t, &static_QUType_charstar ) || | 477 | if ( isEqual( t, &static_QUType_charstar ) || |
595 | isEqual( t, &static_QUType_double ) || | 478 | isEqual( t, &static_QUType_double ) || |
596 | isEqual( t, &static_QUType_float ) || | ||
597 | isEqual( t, &static_QUType_int ) ) | 479 | isEqual( t, &static_QUType_int ) ) |
598 | return TRUE; | 480 | return TRUE; |
599 | 481 | ||
600 | return t->canConvertTo( o, this ); | 482 | return t->canConvertTo( o, this ); |
601 | } | 483 | } |
602 | 484 | ||
603 | bool QUType_QString::canConvertTo( QUObject * /*o*/, QUType *t ) | 485 | bool QUType_QString::canConvertTo( QUObject * /*o*/, QUType *t ) |
604 | { | 486 | { |
605 | return isEqual( t, &static_QUType_charstar ) || | 487 | return isEqual( t, &static_QUType_charstar ) || |
606 | isEqual( t, &static_QUType_int ) || | 488 | isEqual( t, &static_QUType_int ) || |
607 | isEqual( t, &static_QUType_double ) || | 489 | isEqual( t, &static_QUType_double ); |
608 | isEqual( t, &static_QUType_float ); | ||
609 | } | 490 | } |
610 | 491 | ||
611 | bool QUType_QString::convertFrom( QUObject *o, QUType *t ) | 492 | bool QUType_QString::convertFrom( QUObject *o, QUType *t ) |
612 | { | 493 | { |
613 | QString *str = 0; | 494 | QString *str = 0; |
614 | if ( isEqual( t, &static_QUType_charstar ) ) | 495 | if ( isEqual( t, &static_QUType_charstar ) ) |
615 | str = new QString( o->payload.charstar.ptr ); | 496 | str = new QString( o->payload.charstar.ptr ); |
616 | else if ( isEqual( t, &static_QUType_double ) ) | 497 | else if ( isEqual( t, &static_QUType_double ) ) |
617 | str = new QString( QString::number( o->payload.d ) ); | 498 | str = new QString( QString::number( o->payload.d ) ); |
618 | else if ( isEqual( t, &static_QUType_float ) ) | ||
619 | str = new QString( QString::number( o->payload.f ) ); | ||
620 | else if ( isEqual( t, &static_QUType_int ) ) | 499 | else if ( isEqual( t, &static_QUType_int ) ) |
621 | str = new QString( QString::number( o->payload.i ) ); | 500 | str = new QString( QString::number( o->payload.i ) ); |
622 | else | 501 | else |
623 | return t->convertTo( o, this ); | 502 | return t->convertTo( o, this ); |
624 | 503 | ||
625 | o->type->clear( o ); | 504 | o->type->clear( o ); |
626 | o->payload.ptr = str; | 505 | o->payload.ptr = str; |
627 | o->type = this; | 506 | o->type = this; |
628 | return TRUE; | 507 | return TRUE; |
629 | } | 508 | } |
630 | 509 | ||
631 | bool QUType_QString::convertTo( QUObject *o, QUType *t ) | 510 | bool QUType_QString::convertTo( QUObject *o, QUType *t ) |
632 | { | 511 | { |
633 | QString *str = (QString *)o->payload.ptr; | 512 | QString *str = (QString *)o->payload.ptr; |
634 | if ( isEqual( t, &static_QUType_charstar ) ) { | 513 | if ( isEqual( t, &static_QUType_charstar ) ) { |
635 | o->payload.charstar.ptr = qstrdup( str->local8Bit().data() ); | 514 | o->payload.charstar.ptr = qstrdup( str->local8Bit().data() ); |
636 | o->payload.charstar.owner = TRUE; | 515 | o->payload.charstar.owner = TRUE; |
637 | o->type = &static_QUType_charstar; | 516 | o->type = &static_QUType_charstar; |
638 | } else if ( isEqual( t, &static_QUType_int ) ) { | 517 | } else if ( isEqual( t, &static_QUType_int ) ) { |
639 | o->payload.l = str->toLong(); | 518 | o->payload.l = str->toLong(); |
640 | o->type = &static_QUType_int; | 519 | o->type = &static_QUType_int; |
641 | } else if ( isEqual( t, &static_QUType_double ) ) { | 520 | } else if ( isEqual( t, &static_QUType_double ) ) { |
642 | o->payload.d = str->toDouble(); | 521 | o->payload.d = str->toDouble(); |
643 | o->type = &static_QUType_double; | 522 | o->type = &static_QUType_double; |
644 | } else if ( isEqual( t, &static_QUType_float ) ) { | ||
645 | o->payload.d = str->toFloat(); | ||
646 | o->type = &static_QUType_float; | ||
647 | } else { | 523 | } else { |
648 | return FALSE; | 524 | return FALSE; |
649 | } | 525 | } |
650 | delete str; | 526 | delete str; |
651 | return TRUE; | 527 | return TRUE; |
652 | } | 528 | } |
653 | 529 | ||
654 | int QUType_QString::serializeTo( QUObject *, QUBuffer * ) | 530 | int QUType_QString::serializeTo( QUObject *, QUBuffer * ) |
655 | { | 531 | { |
656 | return 0; | 532 | return 0; |
657 | } | 533 | } |
658 | 534 | ||
659 | int QUType_QString::serializeFrom( QUObject *, QUBuffer * ) | 535 | int QUType_QString::serializeFrom( QUObject *, QUBuffer * ) |
660 | { | 536 | { |
661 | return 0; | 537 | return 0; |
662 | } | 538 | } |
diff --git a/qmake/tools/qwaitcondition_unix.cpp b/qmake/tools/qwaitcondition_unix.cpp index 99c1014..6684617 100644 --- a/qmake/tools/qwaitcondition_unix.cpp +++ b/qmake/tools/qwaitcondition_unix.cpp | |||
@@ -111,33 +111,33 @@ struct QWaitConditionPrivate { | |||
111 | for (;;) { | 111 | for (;;) { |
112 | key_pressed.wait(); // This is a QWaitCondition global variable | 112 | key_pressed.wait(); // This is a QWaitCondition global variable |
113 | mymutex.lock(); | 113 | mymutex.lock(); |
114 | mycount++; | 114 | mycount++; |
115 | mymutex.unlock(); | 115 | mymutex.unlock(); |
116 | do_something(); | 116 | do_something(); |
117 | mymutex.lock(); | 117 | mymutex.lock(); |
118 | mycount--; | 118 | mycount--; |
119 | mymutex.unlock(); | 119 | mymutex.unlock(); |
120 | } | 120 | } |
121 | 121 | ||
122 | // Key reading thread code | 122 | // Key reading thread code |
123 | for (;;) { | 123 | for (;;) { |
124 | getchar(); | 124 | getchar(); |
125 | mymutex.lock(); | 125 | mymutex.lock(); |
126 | // Sleep until there are no busy worker threads | 126 | // Sleep until there are no busy worker threads |
127 | while( count > 0 ) { | 127 | while( mycount > 0 ) { |
128 | mymutex.unlock(); | 128 | mymutex.unlock(); |
129 | sleep( 1 ); | 129 | sleep( 1 ); |
130 | mymutex.lock(); | 130 | mymutex.lock(); |
131 | } | 131 | } |
132 | mymutex.unlock(); | 132 | mymutex.unlock(); |
133 | key_pressed.wakeAll(); | 133 | key_pressed.wakeAll(); |
134 | } | 134 | } |
135 | \endcode | 135 | \endcode |
136 | 136 | ||
137 | The mutexes are necessary because the results of two threads | 137 | The mutexes are necessary because the results of two threads |
138 | attempting to change the value of the same variable simultaneously | 138 | attempting to change the value of the same variable simultaneously |
139 | are unpredictable. | 139 | are unpredictable. |
140 | */ | 140 | */ |
141 | 141 | ||
142 | /*! | 142 | /*! |
143 | Constructs a new event signalling, i.e. wait condition, object. | 143 | Constructs a new event signalling, i.e. wait condition, object. |
@@ -211,53 +211,58 @@ void QWaitCondition::wakeAll() | |||
211 | /*! | 211 | /*! |
212 | Wait on the thread event object. The thread calling this will | 212 | Wait on the thread event object. The thread calling this will |
213 | block until either of these conditions is met: | 213 | block until either of these conditions is met: |
214 | \list | 214 | \list |
215 | \i Another thread signals it using wakeOne() or wakeAll(). This | 215 | \i Another thread signals it using wakeOne() or wakeAll(). This |
216 | function will return TRUE in this case. | 216 | function will return TRUE in this case. |
217 | \i \a time milliseconds has elapsed. If \a time is ULONG_MAX (the | 217 | \i \a time milliseconds has elapsed. If \a time is ULONG_MAX (the |
218 | default), then the wait will never timeout (the event must be | 218 | default), then the wait will never timeout (the event must be |
219 | signalled). This function will return FALSE if the wait timed | 219 | signalled). This function will return FALSE if the wait timed |
220 | out. | 220 | out. |
221 | \endlist | 221 | \endlist |
222 | 222 | ||
223 | \sa wakeOne(), wakeAll() | 223 | \sa wakeOne(), wakeAll() |
224 | */ | 224 | */ |
225 | bool QWaitCondition::wait(unsigned long time) | 225 | bool QWaitCondition::wait(unsigned long time) |
226 | { | 226 | { |
227 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; | 227 | pthread_mutex_t mutex; |
228 | pthread_mutex_init( &mutex, 0 ); | ||
229 | pthread_mutex_lock( &mutex ); | ||
228 | 230 | ||
229 | int ret; | 231 | int ret; |
230 | if (time != ULONG_MAX) { | 232 | if (time != ULONG_MAX) { |
231 | struct timeval tv; | 233 | struct timeval tv; |
232 | gettimeofday(&tv, 0); | 234 | gettimeofday(&tv, 0); |
233 | 235 | ||
234 | timespec ti; | 236 | timespec ti; |
235 | ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000; | 237 | ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000; |
236 | ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); | 238 | ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); |
237 | ti.tv_nsec %= 1000000000; | 239 | ti.tv_nsec %= 1000000000; |
238 | 240 | ||
239 | ret = pthread_cond_timedwait(&d->cond, &mutex, &ti); | 241 | ret = pthread_cond_timedwait(&d->cond, &mutex, &ti); |
240 | } else | 242 | } else |
241 | ret = pthread_cond_wait(&d->cond, &mutex); | 243 | ret = pthread_cond_wait(&d->cond, &mutex); |
242 | 244 | ||
243 | #ifdef QT_CHECK_RANGE | 245 | #ifdef QT_CHECK_RANGE |
244 | if (ret && ret != ETIMEDOUT) | 246 | if (ret && ret != ETIMEDOUT) |
245 | qWarning("Wait condition wait failure: %s",strerror(ret)); | 247 | qWarning("Wait condition wait failure: %s",strerror(ret)); |
246 | #endif | 248 | #endif |
247 | 249 | ||
250 | pthread_mutex_unlock( &mutex ); | ||
251 | pthread_mutex_destroy( &mutex ); | ||
252 | |||
248 | return (ret == 0); | 253 | return (ret == 0); |
249 | } | 254 | } |
250 | 255 | ||
251 | /*! | 256 | /*! |
252 | \overload | 257 | \overload |
253 | 258 | ||
254 | Release the locked \a mutex and wait on the thread event object. | 259 | Release the locked \a mutex and wait on the thread event object. |
255 | The \a mutex must be initially locked by the calling thread. If \a | 260 | The \a mutex must be initially locked by the calling thread. If \a |
256 | mutex is not in a locked state, this function returns immediately. | 261 | mutex is not in a locked state, this function returns immediately. |
257 | If \a mutex is a recursive mutex, this function returns | 262 | If \a mutex is a recursive mutex, this function returns |
258 | immediately. The \a mutex will be unlocked, and the calling thread | 263 | immediately. The \a mutex will be unlocked, and the calling thread |
259 | will block until either of these conditions is met: | 264 | will block until either of these conditions is met: |
260 | \list | 265 | \list |
261 | \i Another thread signals it using wakeOne() or wakeAll(). This | 266 | \i Another thread signals it using wakeOne() or wakeAll(). This |
262 | function will return TRUE in this case. | 267 | function will return TRUE in this case. |
263 | \i \a time milliseconds has elapsed. If \a time is ULONG_MAX (the | 268 | \i \a time milliseconds has elapsed. If \a time is ULONG_MAX (the |
@@ -278,33 +283,33 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time) | |||
278 | return FALSE; | 283 | return FALSE; |
279 | 284 | ||
280 | if (mutex->d->type() == Q_MUTEX_RECURSIVE) { | 285 | if (mutex->d->type() == Q_MUTEX_RECURSIVE) { |
281 | #ifdef QT_CHECK_RANGE | 286 | #ifdef QT_CHECK_RANGE |
282 | qWarning("Wait condition warning: using recursive mutexes with\n" | 287 | qWarning("Wait condition warning: using recursive mutexes with\n" |
283 | " wait conditions is undefined!"); | 288 | " wait conditions is undefined!"); |
284 | #endif | 289 | #endif |
285 | return FALSE; | 290 | return FALSE; |
286 | } | 291 | } |
287 | 292 | ||
288 | int ret; | 293 | int ret; |
289 | if (time != ULONG_MAX) { | 294 | if (time != ULONG_MAX) { |
290 | struct timeval tv; | 295 | struct timeval tv; |
291 | gettimeofday(&tv, 0); | 296 | gettimeofday(&tv, 0); |
292 | 297 | ||
293 | timespec ti; | 298 | timespec ti; |
294 | ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000; | 299 | ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000; |
295 | ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); | 300 | ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); |
296 | ti.tv_nsec %= 1000000000; | 301 | ti.tv_nsec %= 1000000000; |
297 | 302 | ||
298 | ret = pthread_cond_timedwait(&d->cond, &mutex->d->handle, &ti); | 303 | ret = pthread_cond_timedwait(&d->cond, &mutex->d->handle, &ti); |
299 | } else | 304 | } else |
300 | ret = pthread_cond_wait(&d->cond, &mutex->d->handle); | 305 | ret = pthread_cond_wait(&d->cond, &mutex->d->handle); |
301 | 306 | ||
302 | #ifdef QT_CHECK_RANGE | 307 | #ifdef QT_CHECK_RANGE |
303 | if (ret && ret != ETIMEDOUT) | 308 | if (ret && ret != ETIMEDOUT) |
304 | qWarning("Wait condition wait failure: %s",strerror(ret)); | 309 | qWarning("Wait condition wait failure: %s",strerror(ret)); |
305 | #endif | 310 | #endif |
306 | 311 | ||
307 | return (ret == 0); | 312 | return (ret == 0); |
308 | } | 313 | } |
309 | 314 | ||
310 | #endif // QT_THREAD_SUPPORT | 315 | #endif // QT_THREAD_SUPPORT |