summaryrefslogtreecommitdiff
path: root/qmake
authorllornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
committer llornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
commit155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff)
treee6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake
parent86703e8a5527ef114facd02c005b6b3a7e62e263 (diff)
downloadopie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2
update qmake to 1.05a
Diffstat (limited to 'qmake') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/Makefile10
-rw-r--r--qmake/generators/makefile.cpp476
-rw-r--r--qmake/generators/makefile.h10
-rw-r--r--qmake/generators/projectgenerator.cpp64
-rw-r--r--qmake/generators/unix/unixmake.cpp168
-rw-r--r--qmake/generators/unix/unixmake.h1
-rw-r--r--qmake/generators/unix/unixmake2.cpp185
-rw-r--r--qmake/generators/win32/borland_bmake.cpp56
-rw-r--r--qmake/generators/win32/borland_bmake.h9
-rw-r--r--qmake/generators/win32/mingw_make.cpp524
-rw-r--r--qmake/generators/win32/mingw_make.h58
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp171
-rw-r--r--qmake/generators/win32/msvc_dsp.h14
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp98
-rw-r--r--qmake/generators/win32/msvc_nmake.h8
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp243
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h100
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp412
-rw-r--r--qmake/generators/win32/msvc_vcproj.h30
-rw-r--r--qmake/generators/win32/winmakefile.cpp148
-rw-r--r--qmake/include/private/qapplication_p.h5
-rw-r--r--qmake/include/private/qcom_p.h6
-rw-r--r--qmake/include/private/qcomlibrary_p.h6
-rw-r--r--qmake/include/private/qcomplextext_p.h8
-rw-r--r--qmake/include/private/qcomponentfactory_p.h6
-rw-r--r--qmake/include/private/qcriticalsection_p.h4
-rw-r--r--qmake/include/private/qdir_p.h9
-rw-r--r--qmake/include/private/qeffects_p.h2
-rw-r--r--qmake/include/private/qeventloop_p.h70
-rw-r--r--qmake/include/private/qfontcodecs_p.h4
-rw-r--r--qmake/include/private/qfontdata_p.h3
-rw-r--r--qmake/include/private/qgfxdriverinterface_p.h18
-rw-r--r--qmake/include/private/qgpluginmanager_p.h8
-rw-r--r--qmake/include/private/qimageformatinterface_p.h8
-rw-r--r--qmake/include/private/qinputcontext_p.h5
-rw-r--r--qmake/include/private/qkbddriverinterface_p.h18
-rw-r--r--qmake/include/private/qlibrary_p.h5
-rw-r--r--qmake/include/private/qlock_p.h93
-rw-r--r--qmake/include/private/qmousedriverinterface_p.h18
-rw-r--r--qmake/include/private/qmutexpool_p.h44
-rw-r--r--qmake/include/private/qpluginmanager_p.h16
-rw-r--r--qmake/include/private/qpsprinter_p.h4
-rw-r--r--qmake/include/private/qrichtext_p.h59
-rw-r--r--qmake/include/private/qsettings_p.h2
-rw-r--r--qmake/include/private/qsharedmemory_p.h11
-rw-r--r--qmake/include/private/qsqldriverinterface_p.h17
-rw-r--r--qmake/include/private/qsqlextension_p.h41
-rw-r--r--qmake/include/private/qstyleinterface_p.h18
-rw-r--r--qmake/include/private/qsvgdevice_p.h8
-rw-r--r--qmake/include/private/qtextcodecinterface_p.h2
-rw-r--r--qmake/include/private/qtitlebar_p.h2
-rw-r--r--qmake/include/private/qucom_p.h76
-rw-r--r--qmake/include/private/qucomextra_p.h18
-rw-r--r--qmake/include/private/qwidgetinterface_p.h65
-rw-r--r--qmake/include/private/qwidgetresizehandler_p.h18
-rw-r--r--qmake/include/qasciidict.h4
-rw-r--r--qmake/include/qcstring.h7
-rw-r--r--qmake/include/qdict.h4
-rw-r--r--qmake/include/qdir.h3
-rw-r--r--qmake/include/qfeatures.h2
-rw-r--r--qmake/include/qgarray.h13
-rw-r--r--qmake/include/qglobal.h87
-rw-r--r--qmake/include/qintdict.h4
-rw-r--r--qmake/include/qmap.h4
-rw-r--r--qmake/include/qmemarray.h9
-rw-r--r--qmake/include/qptrlist.h6
-rw-r--r--qmake/include/qptrvector.h4
-rw-r--r--qmake/include/qregexp.h2
-rw-r--r--qmake/include/qstring.h91
-rw-r--r--qmake/include/qstrlist.h2
-rw-r--r--qmake/include/qtextcodec.h16
-rw-r--r--qmake/include/qtl.h1
-rw-r--r--qmake/include/quuid.h6
-rw-r--r--qmake/include/qvaluelist.h4
-rw-r--r--qmake/include/qvaluestack.h4
-rw-r--r--qmake/main.cpp9
-rw-r--r--qmake/option.cpp153
-rw-r--r--qmake/option.h5
-rw-r--r--qmake/project.cpp407
-rw-r--r--qmake/project.h20
-rw-r--r--qmake/tools/qbitarray.cpp3
-rw-r--r--qmake/tools/qbuffer.cpp4
-rw-r--r--qmake/tools/qcomlibrary.cpp43
-rw-r--r--qmake/tools/qconfig.cpp14
-rw-r--r--qmake/tools/qcriticalsection_p.cpp2
-rw-r--r--qmake/tools/qcstring.cpp107
-rw-r--r--qmake/tools/qdatastream.cpp24
-rw-r--r--qmake/tools/qdatetime.cpp70
-rw-r--r--qmake/tools/qdir.cpp94
-rw-r--r--qmake/tools/qdir_unix.cpp54
-rw-r--r--qmake/tools/qfile.cpp3
-rw-r--r--qmake/tools/qfile_unix.cpp13
-rw-r--r--qmake/tools/qfileinfo.cpp4
-rw-r--r--qmake/tools/qfileinfo_unix.cpp4
-rw-r--r--qmake/tools/qgarray.cpp97
-rw-r--r--qmake/tools/qgdict.cpp5
-rw-r--r--qmake/tools/qglist.cpp6
-rw-r--r--qmake/tools/qglobal.cpp45
-rw-r--r--qmake/tools/qgpluginmanager.cpp4
-rw-r--r--qmake/tools/qgvector.cpp9
-rw-r--r--qmake/tools/qlibrary.cpp13
-rw-r--r--qmake/tools/qlibrary_unix.cpp21
-rw-r--r--qmake/tools/qmutex_unix.cpp8
-rw-r--r--qmake/tools/qmutexpool.cpp78
-rw-r--r--qmake/tools/qregexp.cpp70
-rw-r--r--qmake/tools/qsemaphore_unix.cpp26
-rw-r--r--qmake/tools/qsettings.cpp387
-rw-r--r--qmake/tools/qstring.cpp434
-rw-r--r--qmake/tools/qtextstream.cpp2
-rw-r--r--qmake/tools/qucom.cpp136
-rw-r--r--qmake/tools/qwaitcondition_unix.cpp13
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
@@ -10,3 +10,3 @@ CXX = g++
10OBJS=project.o main.o makefile.o unixmake2.o unixmake.o borland_bmake.o \ 10OBJS=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
@@ -16,3 +16,3 @@ 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 \
@@ -100,2 +100,5 @@ qdir.o: $(OPIEDIR)/qmake/tools/qdir.cpp
100 100
101quuid.o: $(OPIEDIR)/qmake/tools/quuid.cpp
102 $(CXX) -c -o $@ $(CXXFLAGS) $(OPIEDIR)/qmake/tools/quuid.cpp
103
101qfileinfo_unix.o: $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp 104qfileinfo_unix.o: $(OPIEDIR)/qmake/tools/qfileinfo_unix.cpp
@@ -145,2 +148,5 @@ borland_bmake.o: generators/win32/borland_bmake.cpp
145 148
149mingw_make.o: generators/win32/mingw_make.cpp
150 $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/mingw_make.cpp
151
146msvc_objectmodel.o: generators/win32/msvc_objectmodel.cpp 152msvc_objectmodel.o: generators/win32/msvc_objectmodel.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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -61,4 +61,18 @@
61 61
62static 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
62static bool createDir(const QString& fullPath) 73static bool createDir(const QString& fullPath)
63{ 74{
75 if(QFile::exists(fullPath))
76 return FALSE;
77
64 QDir dirTmp; 78 QDir dirTmp;
@@ -79,4 +93,4 @@ static bool createDir(const QString& fullPath)
79 93
80MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), 94MakefileGenerator::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)
@@ -90,3 +104,3 @@ static char *gimme_buffer(off_t s)
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;
@@ -95,3 +109,3 @@ static char *gimme_buffer(off_t s)
95bool 109bool
96MakefileGenerator::generateMocList(QString fn_target) 110MakefileGenerator::generateMocList(const QString &fn_target)
97{ 111{
@@ -175,3 +189,4 @@ MakefileGenerator::generateMocList(QString fn_target)
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
@@ -187,3 +202,4 @@ MakefileGenerator::generateMocList(QString fn_target)
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))))
@@ -193,6 +209,6 @@ MakefileGenerator::generateMocList(QString fn_target)
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))) {
@@ -227,9 +243,8 @@ MakefileGenerator::generateMocList(QString fn_target)
227bool 243bool
228MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QString fn, bool recurse) 244MakefileGenerator::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);
@@ -290,4 +305,6 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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');
@@ -330,3 +347,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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++;
@@ -344,3 +361,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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)) {
@@ -371,3 +388,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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);
@@ -385,2 +402,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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(),
@@ -406,2 +424,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
406 fqn = fndir + inc; 424 fqn = fndir + inc;
425 goto handle_fqn;
407 } else { 426 } else {
@@ -417,3 +436,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
417 fqn = mdd->real_dir + QDir::separator() + inc; 436 fqn = mdd->real_dir + QDir::separator() + inc;
418 break; 437 goto handle_fqn;
419 } 438 }
@@ -422,3 +441,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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
@@ -427,3 +446,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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];
@@ -449,3 +468,26 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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 }
@@ -453,3 +495,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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();
@@ -469,3 +511,30 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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 }
@@ -476,8 +545,10 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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)
@@ -499,3 +570,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri
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;
@@ -615,3 +686,7 @@ MakefileGenerator::init()
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 ||
@@ -630,3 +705,3 @@ MakefileGenerator::init()
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")) {
@@ -685,3 +760,3 @@ MakefileGenerator::init()
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());
@@ -745,2 +820,3 @@ MakefileGenerator::init()
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)) {
@@ -771,3 +847,3 @@ MakefileGenerator::init()
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);
@@ -784,5 +860,10 @@ MakefileGenerator::init()
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 }
@@ -797,35 +878,39 @@ MakefileGenerator::init()
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 }
@@ -855,7 +940,8 @@ MakefileGenerator::init()
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 }
@@ -948,6 +1034,7 @@ MakefileGenerator::init()
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"];
@@ -962,5 +1049,5 @@ MakefileGenerator::init()
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 {
@@ -968,3 +1055,4 @@ MakefileGenerator::init()
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();
@@ -972,5 +1060,5 @@ MakefileGenerator::init()
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 }
@@ -985,3 +1073,17 @@ MakefileGenerator::init()
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();
@@ -1032,5 +1134,5 @@ MakefileGenerator::init()
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
@@ -1068,3 +1170,3 @@ MakefileGenerator::processPrlFile(QString &file)
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")) {
@@ -1106,3 +1208,3 @@ MakefileGenerator::processPrlFile(QString &file)
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());
@@ -1198,2 +1300,4 @@ MakefileGenerator::writePrlFile(QTextStream &t)
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")) {
@@ -1230,4 +1334,3 @@ MakefileGenerator::write()
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);
@@ -1242,3 +1345,3 @@ MakefileGenerator::write()
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();
@@ -1304,3 +1407,3 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s
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);
@@ -1322,16 +1425,32 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui)
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 }
@@ -1372,3 +1491,3 @@ MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString
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");
@@ -1415,5 +1534,9 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src)
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();
@@ -1425,3 +1548,3 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src)
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;
@@ -1454,3 +1577,6 @@ MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src)
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)
@@ -1465,3 +1591,3 @@ MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src)
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);
@@ -1496,3 +1622,3 @@ MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj)
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");
@@ -1543,19 +1669,22 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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;
@@ -1563,25 +1692,32 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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++) {
@@ -1590,13 +1726,24 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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)
@@ -1605,5 +1752,13 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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) + " ";
@@ -1611,4 +1766,4 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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) + " ";
@@ -1789,3 +1944,3 @@ MakefileGenerator::writeHeader(QTextStream &t)
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;
@@ -1804,3 +1959,3 @@ MakefileGenerator::writeMakeQmake(QTextStream &t)
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")) {
@@ -1848,5 +2003,11 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, 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;
@@ -1892,2 +2053,8 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const
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 }
@@ -1901,2 +2068,7 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const
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);
@@ -1931,2 +2103,4 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const
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())
@@ -1934,2 +2108,3 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const
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;
@@ -2041,4 +2216,5 @@ MakefileGenerator::openOutput(QFile &file) const
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"
@@ -2063,3 +2239,3 @@ MakefileGenerator::create(QMakeProject *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)
@@ -2069,3 +2245,3 @@ MakefileGenerator::create(QMakeProject *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)
@@ -2076,2 +2252,4 @@ MakefileGenerator::create(QMakeProject *proj)
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") {
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -49,3 +49,3 @@ class MakefileGenerator
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;
@@ -70,6 +70,6 @@ protected:
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
@@ -79,3 +79,3 @@ protected:
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
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
@@ -44,2 +44,18 @@
44 44
45QString 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
@@ -69,17 +85,9 @@ ProjectGenerator::init()
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
@@ -142,5 +150,4 @@ ProjectGenerator::init()
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 }
@@ -243,4 +250,10 @@ ProjectGenerator::init()
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)
@@ -248,3 +261,4 @@ ProjectGenerator::init()
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))) {
@@ -262,3 +276,4 @@ ProjectGenerator::init()
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)) {
@@ -266,3 +281,4 @@ ProjectGenerator::init()
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()) {
@@ -339,3 +355,4 @@ ProjectGenerator::writeMakefile(QTextStream &t)
339 << getWritableVar("CONFIG_REMOVE", FALSE) 355 << getWritableVar("CONFIG_REMOVE", FALSE)
340 << getWritableVar("DEPENDPATH") << endl; 356 << getWritableVar("DEPENDPATH")
357 << getWritableVar("INCLUDEPATH") << endl;
341 358
@@ -346,3 +363,4 @@ ProjectGenerator::writeMakefile(QTextStream &t)
346 << getWritableVar("YACCSOURCES") 363 << getWritableVar("YACCSOURCES")
347 << getWritableVar("SOURCES"); 364 << getWritableVar("SOURCES")
365 << getWritableVar("TRANSLATIONS");
348 } 366 }
@@ -405,2 +423,4 @@ ProjectGenerator::addFile(QString file)
405 where = "YACCSOURCES"; 423 where = "YACCSOURCES";
424 else if(file.endsWith(".ts"))
425 where = "TRANSLATIONS";
406 } 426 }
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -74,7 +74,6 @@ UnixMakefileGenerator::init()
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 }
@@ -85,3 +84,3 @@ UnixMakefileGenerator::init()
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")) {
@@ -140,3 +139,3 @@ UnixMakefileGenerator::init()
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"), "");
@@ -168,3 +167,3 @@ UnixMakefileGenerator::init()
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"), "");
@@ -178,17 +177,5 @@ UnixMakefileGenerator::init()
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", "");
@@ -201,6 +188,2 @@ UnixMakefileGenerator::init()
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") )
@@ -212,2 +195,18 @@ UnixMakefileGenerator::init()
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") )
@@ -342,3 +341,3 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li
342 unique = (list2.findIndex((*it)) == -1); 341 unique = (list2.findIndex((*it)) == -1);
343 } 342 }
344 if(unique) 343 if(unique)
@@ -353,3 +352,3 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList
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"]);
@@ -359,2 +358,86 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList
359 358
359bool
360UnixMakefileGenerator::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
360void 443void
@@ -404,3 +487,3 @@ UnixMakefileGenerator::processPrlFiles()
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;
@@ -436,4 +519,5 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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);
@@ -441,3 +525,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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)
@@ -460,4 +544,4 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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())
@@ -466,9 +550,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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 }
@@ -480,3 +563,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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())
@@ -485,6 +568,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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
@@ -508,3 +593,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
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 + "\"";
@@ -519,2 +604 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
519
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
@@ -57,2 +57,3 @@ protected:
57 57
58 virtual bool findLibraries();
58 virtual void init(); 59 virtual void init();
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
@@ -81,5 +81,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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
@@ -110,3 +109,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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
@@ -138,3 +144,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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;
@@ -214,4 +221,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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;
@@ -223,7 +229,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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;
@@ -232,2 +234,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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 }
@@ -263,3 +268,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"
@@ -388,3 +393,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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())
@@ -401,3 +407,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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())
@@ -462,4 +469,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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 {
@@ -467,4 +474,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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 }
@@ -485,16 +492,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &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"
@@ -515,2 +509,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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 }
@@ -520,6 +527,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"
@@ -533,3 +540,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"
@@ -537,3 +544,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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")) {
@@ -548,3 +556,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"
@@ -552,3 +560,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"],
@@ -556,6 +564,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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);
@@ -563,6 +571,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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(" "));
@@ -582,3 +590,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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"
@@ -594,3 +602,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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.
@@ -599,3 +607,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
599 fixEnvVariables(moc); 607 fixEnvVariables(moc);
600 if(target != moc) 608 if(target != moc)
601 t << "$(MOC): \n\t" 609 t << "$(MOC): \n\t"
@@ -645,3 +653,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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;
@@ -655,3 +663,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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;
@@ -679,2 +687,41 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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) {
@@ -712,4 +759,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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() &&
@@ -808,3 +859,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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;
@@ -837,3 +888,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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;
@@ -846,3 +897,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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 {
@@ -860,3 +911,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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";
@@ -864,3 +915,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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) {
@@ -908,2 +959,4 @@ void UnixMakefileGenerator::init2()
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") ) {
@@ -919,3 +972,2 @@ void UnixMakefileGenerator::init2()
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") ) {
@@ -925,3 +977,3 @@ void UnixMakefileGenerator::init2()
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"));
@@ -935,12 +987,12 @@ void UnixMakefileGenerator::init2()
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");
@@ -1013,4 +1065,11 @@ void UnixMakefileGenerator::init2()
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() )
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
@@ -134,2 +134,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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;
@@ -152,7 +154,10 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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
@@ -160,3 +165,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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()) {
@@ -171,2 +177,6 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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()) {
@@ -215,3 +225,2 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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 ","")
@@ -222,4 +231,2 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
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"))
@@ -246,2 +253,6 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
246 t << endl << endl; 253 t << endl << endl;
254
255 t << "distclean: clean"
256 << "\n\t-del $(TARGET)"
257 << endl << endl;
247} 258}
@@ -366,3 +377,3 @@ BorlandMakefileGenerator::init()
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) {
@@ -428,2 +439,24 @@ BorlandMakefileGenerator::init()
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") ) {
@@ -454,3 +487,3 @@ BorlandMakefileGenerator::init()
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 }
@@ -476,2 +509 @@ BorlandMakefileGenerator::init()
476} }
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __BORLANDMAKE_H__ 37#ifndef __BORLAND_BMAKE_H__
38#define __BORLANDMAKE_H__ 38#define __BORLAND_BMAKE_H__
39 39
@@ -57,3 +57,2 @@ inline BorlandMakefileGenerator::~BorlandMakefileGenerator()
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
44MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
45{
46 Option::obj_ext = ".o";
47}
48
49bool
50MingwMakefileGenerator::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
74void
75MingwMakefileGenerator::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
268void
269MingwMakefileGenerator::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
507void
508MingwMakefileGenerator::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
40class 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
49public:
50 MingwMakefileGenerator(QMakeProject *p);
51 ~MingwMakefileGenerator();
52
53};
54
55inline 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
@@ -510,2 +510,26 @@ DspMakefileGenerator::init()
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 */
@@ -570,3 +594,3 @@ DspMakefileGenerator::init()
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"];
@@ -580,3 +604,3 @@ DspMakefileGenerator::init()
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"];
@@ -624,3 +648,3 @@ DspMakefileGenerator::init()
624 } 648 }
625 if ( project->isActiveConfig("thread") ) { 649 if ( thread ) {
626 if(project->isActiveConfig("qt")) 650 if(project->isActiveConfig("qt"))
@@ -734,2 +758,3 @@ DspMakefileGenerator::init()
734 758
759 processPrlFiles();
735 QStringList &libs = project->variables()["QMAKE_LIBS"]; 760 QStringList &libs = project->variables()["QMAKE_LIBS"];
@@ -756,2 +781,14 @@ DspMakefileGenerator::init()
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() ) {
@@ -772,16 +809,9 @@ DspMakefileGenerator::init()
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") ) {
@@ -797,35 +827,30 @@ DspMakefileGenerator::init()
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 }
@@ -833,2 +858,19 @@ DspMakefileGenerator::init()
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() ) {
@@ -846,3 +888,3 @@ DspMakefileGenerator::init()
846QString 888QString
847DspMakefileGenerator::findTemplate(QString file) 889DspMakefileGenerator::findTemplate(const QString &file)
848{ 890{
@@ -873,8 +915,8 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &
873 915
874int 916void
875DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, 917DspMakefileGenerator::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
@@ -885,3 +927,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
885 if(file == currentGroup) 927 if(file == currentGroup)
886 return 0; 928 return;
887 929
@@ -889,3 +931,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
889 endGroups(t); 931 endGroups(t);
890 return 0; 932 return;
891 } 933 }
@@ -893,17 +935,19 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
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}
@@ -911,3 +955,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
911 955
912int 956void
913DspMakefileGenerator::endGroups(QTextStream &t) 957DspMakefileGenerator::endGroups(QTextStream &t)
@@ -915,5 +959,5 @@ DspMakefileGenerator::endGroups(QTextStream &t)
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
@@ -924,3 +968,2 @@ DspMakefileGenerator::endGroups(QTextStream &t)
924 currentGroup = ""; 968 currentGroup = "";
925 return dirs.count();
926} 969}
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __DSPMAKE_H__ 37#ifndef __MSVC_DSP_H__
38#define __DSPMAKE_H__ 38#define __MSVC_DSP_H__
39 39
@@ -45,4 +45,4 @@ class DspMakefileGenerator : public Win32MakefileGenerator
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
@@ -52,3 +52,3 @@ class DspMakefileGenerator : public Win32MakefileGenerator
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();
@@ -72,2 +72,2 @@ inline bool DspMakefileGenerator::findLibraries()
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -40,2 +40,3 @@
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qdict.h>
41#include <qdir.h> 42#include <qdir.h>
@@ -137,2 +138,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
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;
@@ -158,7 +161,47 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
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
@@ -166,3 +209,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
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()) {
@@ -175,2 +219,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
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()) {
@@ -222,2 +268,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
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")) {
@@ -248,2 +295,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
248 t << endl << endl; 295 t << endl << endl;
296
297 t << "distclean: clean"
298 << "\n\t-del $(TARGET)"
299 << endl << endl;
249} 300}
@@ -433,2 +484,24 @@ NmakeMakefileGenerator::init()
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
@@ -467,3 +540,3 @@ NmakeMakefileGenerator::init()
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 }
@@ -478,9 +551,10 @@ NmakeMakefileGenerator::init()
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");
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __NMAKEMAKE_H__ 37#ifndef __MSVC_NMAKE_H__
38#define __NMAKEMAKE_H__ 38#define __MSVC_NMAKE_H__
39 39
@@ -58,2 +58,2 @@ inline NmakeMakefileGenerator::~NmakeMakefileGenerator()
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
@@ -256,23 +256,23 @@ 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};
260struct EPair { 260struct 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};
265struct LPair { 265struct 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};
270struct SPair { 270struct 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};
275struct XPair { 275struct 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;
@@ -385,3 +385,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
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 );
@@ -444,3 +444,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
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 << "/>";
@@ -452,3 +452,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
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];
@@ -456,2 +456,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
456 char fourth = option[4]; 456 char fourth = option[4];
457 bool found = TRUE;
457 458
@@ -461,13 +462,16 @@ bool VCCLCompilerTool::parseOption( const char* option )
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;
@@ -489,3 +493,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
489 } 493 }
490 return FALSE; 494 found = FALSE; break;
491 } 495 }
@@ -546,3 +550,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
546 default: 550 default:
547 return FALSE; 551 found = FALSE; break;
548 } 552 }
@@ -555,3 +559,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
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':
@@ -621,3 +625,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
621 default: 625 default:
622 return FALSE; 626 found = FALSE; break;
623 } 627 }
@@ -635,3 +639,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
635 } 639 }
636 return FALSE; 640 found = FALSE; break;
637 case 'M': 641 case 'M':
@@ -653,3 +657,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
653 } 657 }
654 return FALSE; 658 found = FALSE; break;
655 case 'O': 659 case 'O':
@@ -673,3 +677,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
673 else 677 else
674 return FALSE; 678 found = FALSE;
675 break; 679 break;
@@ -707,3 +711,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
707 default: 711 default:
708 return FALSE; 712 found = FALSE; break;
709 } 713 }
@@ -718,3 +722,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
718 } 722 }
719 return FALSE; 723 found = FALSE; break;
720 case 'R': 724 case 'R':
@@ -730,3 +734,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
730 else 734 else
731 return FALSE; 735 found = FALSE; break;
732 } 736 }
@@ -740,3 +744,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
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 }
@@ -780,3 +784,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
780 default: 784 default:
781 return FALSE; 785 found = FALSE; break;
782 } 786 }
@@ -809,3 +813,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
809 default: 813 default:
810 return FALSE; 814 found = FALSE; break;
811 } 815 }
@@ -842,5 +846,5 @@ bool VCCLCompilerTool::parseOption( const char* option )
842 else 846 else
843 return FALSE; 847 found = FALSE;
844 } else { 848 } else {
845 return FALSE; 849 found = FALSE; break;
846 } 850 }
@@ -871,3 +875,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
871 default: 875 default:
872 return FALSE; 876 found = FALSE; break;
873 } 877 }
@@ -875,3 +879,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
875 default: 879 default:
876 return FALSE; 880 found = FALSE; break;
877 } 881 }
@@ -889,3 +893,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
889 } else { 893 } else {
890 return FALSE; 894 found = FALSE; break;
891 } 895 }
@@ -893,4 +897,5 @@ bool VCCLCompilerTool::parseOption( const char* option )
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;
@@ -906,3 +911,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
906 } 911 }
907 return FALSE; 912 found = FALSE; break;
908 case 's': 913 case 's':
@@ -912,3 +917,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
912 } 917 }
913 return FALSE; 918 found = FALSE; break;
914 case 'u': 919 case 'u':
@@ -921,3 +926,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
921 } 926 }
922 return FALSE; 927 found = FALSE; break;
923 case 'w': 928 case 'w':
@@ -935,4 +940,6 @@ bool VCCLCompilerTool::parseOption( const char* option )
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;
@@ -982,3 +989,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
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 );
@@ -1048,4 +1055,4 @@ static uint elfHash( const char* 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)!=',' &&
@@ -1062,2 +1069,5 @@ static uint elfHash( const char* name )
1062} 1069}
1070
1071//#define USE_DISPLAY_HASH
1072#ifdef USE_DISPLAY_HASH
1063static void displayHash( const char* str ) 1073static void displayHash( const char* str )
@@ -1066,2 +1076,3 @@ static void displayHash( const char* str )
1066} 1076}
1077#endif
1067 1078
@@ -1069,34 +1080,34 @@ 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) ) {
@@ -1143,3 +1154,3 @@ bool VCLinkerTool::parseOption( const char* option )
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;
@@ -1194,3 +1205,3 @@ bool VCLinkerTool::parseOption( const char* option )
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...
@@ -1218,3 +1229,3 @@ bool VCLinkerTool::parseOption( const char* option )
1218 default: 1229 default:
1219 return FALSE; 1230 found = FALSE;
1220 } 1231 }
@@ -1277,3 +1288,3 @@ bool VCLinkerTool::parseOption( const char* option )
1277 default: 1288 default:
1278 return FALSE; 1289 found = FALSE;
1279 } 1290 }
@@ -1326,3 +1337,3 @@ bool VCLinkerTool::parseOption( const char* option )
1326 default: 1337 default:
1327 return FALSE; 1338 found = FALSE;
1328 } 1339 }
@@ -1336,3 +1347,3 @@ bool VCLinkerTool::parseOption( const char* option )
1336 else 1347 else
1337 return FALSE; 1348 found = FALSE;
1338 break; 1349 break;
@@ -1362,5 +1373,7 @@ bool VCLinkerTool::parseOption( const char* option )
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}
@@ -1394,3 +1407,3 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
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 );
@@ -1429,3 +1442,3 @@ 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" );
@@ -1437,3 +1450,3 @@ bool VCMIDLTool::parseOption( const char* option )
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" );
@@ -1447,3 +1460,3 @@ bool VCMIDLTool::parseOption( const char* option )
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}" );
@@ -1457,2 +1470,3 @@ bool VCMIDLTool::parseOption( const char* option )
1457#endif 1470#endif
1471 bool found = TRUE;
1458 int offset = 0; 1472 int offset = 0;
@@ -1492,3 +1506,3 @@ bool VCMIDLTool::parseOption( const char* option )
1492 default: 1506 default:
1493 return FALSE; 1507 found = FALSE;
1494 } 1508 }
@@ -1507,3 +1521,3 @@ bool VCMIDLTool::parseOption( const char* option )
1507 default: 1521 default:
1508 return FALSE; 1522 found = FALSE;
1509 } 1523 }
@@ -1538,9 +1552,9 @@ bool VCMIDLTool::parseOption( const char* option )
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 }
@@ -1649,3 +1663,3 @@ bool VCMIDLTool::parseOption( const char* option )
1649 default: 1663 default:
1650 return FALSE; 1664 found = FALSE;
1651 } 1665 }
@@ -1654,2 +1668,4 @@ bool VCMIDLTool::parseOption( const char* option )
1654 } 1668 }
1669 if( !found )
1670 warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
1655 return TRUE; 1671 return TRUE;
@@ -1670,3 +1686,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
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 );
@@ -1716,3 +1732,3 @@ QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
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 );
@@ -1853,9 +1869,30 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
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;
@@ -1869,5 +1906,5 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
1869 strm << _CommandLine6; 1906 strm << _CommandLine6;
1870 strm << uicApp << " " << str << " -o " << pname << fname << ".h &amp;&amp; "; // Create .h from .ui file 1907 strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h &amp;&amp; "; // Create .h from .ui file
1871 strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp &amp;&amp; ";// Create .cpp from .ui file 1908 strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp &amp;&amp; ";// 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;
@@ -1875,3 +1912,3 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
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 << "/>";
@@ -1908,5 +1945,5 @@ 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 );
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
@@ -42,3 +42,3 @@
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
@@ -49,5 +49,5 @@
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...
@@ -85,3 +85,3 @@ enum browseInfoOption {
85 brInfoNone, 85 brInfoNone,
86 brAllInfo, 86 brAllInfo,
87 brNoLocalSymbols 87 brNoLocalSymbols
@@ -120,3 +120,3 @@ enum debugOption {
120 debugEnabled, 120 debugEnabled,
121 debugEditAndContinue 121 debugEditAndContinue
122}; 122};
@@ -126,3 +126,3 @@ enum eAppProtectionOption {
126 eAppProtectMedium, 126 eAppProtectMedium,
127 eAppProtectHigh 127 eAppProtectHigh
128}; 128};
@@ -233,3 +233,3 @@ enum favorSizeOrSpeedOption {
233 favorSpeed, 233 favorSpeed,
234 favorSize 234 favorSize
235}; 235};
@@ -247,3 +247,3 @@ enum linkIncrementalType {
247 linkIncrementalNo, 247 linkIncrementalNo,
248 linkIncrementalYes 248 linkIncrementalYes
249}; 249};
@@ -252,3 +252,3 @@ enum linkProgressOption {
252 linkProgressAll, 252 linkProgressAll,
253 linkProgressLibs 253 linkProgressLibs
254}; 254};
@@ -266,3 +266,3 @@ enum midlErrorCheckOption {
266 midlDisableAll, 266 midlDisableAll,
267 midlEnableAll 267 midlEnableAll
268}; 268};
@@ -286,3 +286,3 @@ enum midlWarningLevelOption {
286 midlWarningLevel_3, 286 midlWarningLevel_3,
287 midlWarningLevel_4 287 midlWarningLevel_4
288}; 288};
@@ -298,3 +298,3 @@ enum optimizeOption {
298 optimizeFull, 298 optimizeFull,
299 optimizeCustom 299 optimizeCustom
300}; 300};
@@ -314,3 +314,3 @@ enum pchOption {
314 pchGenerateAuto, 314 pchGenerateAuto,
315 pchUseUsingSpecific 315 pchUseUsingSpecific
316}; 316};
@@ -319,3 +319,3 @@ enum preprocessOption {
319 preprocessYes, 319 preprocessYes,
320 preprocessNoLineNumbers 320 preprocessNoLineNumbers
321}; 321};
@@ -324,3 +324,3 @@ enum ProcessorOptimizeOption {
324 procOptimizePentium, 324 procOptimizePentium,
325 procOptimizePentiumProAndAbove 325 procOptimizePentiumProAndAbove
326}; 326};
@@ -329,3 +329,3 @@ enum RemoteDebuggerType {
329 DbgRemote, 329 DbgRemote,
330 DbgRemoteTCPIP 330 DbgRemoteTCPIP
331}; 331};
@@ -337,3 +337,3 @@ enum runtimeLibraryOption {
337 rtSingleThreaded, 337 rtSingleThreaded,
338 rtSingleThreadedDebug 338 rtSingleThreadedDebug
339}; 339};
@@ -345,3 +345,3 @@ enum structMemberAlignOption {
345 alignEightBytes, 345 alignEightBytes,
346 alignSixteenBytes 346 alignSixteenBytes
347}; 347};
@@ -368,3 +368,3 @@ enum TypeOfDebugger {
368 DbgMixed, 368 DbgMixed,
369 DbgAuto 369 DbgAuto
370}; 370};
@@ -373,3 +373,3 @@ enum useOfATL {
373 useATLStatic, 373 useATLStatic,
374 useATLDynamic 374 useATLDynamic
375}; 375};
@@ -378,3 +378,3 @@ enum useOfMfc {
378 useMfcStatic, 378 useMfcStatic,
379 useMfcDynamic 379 useMfcDynamic
380}; 380};
@@ -392,10 +392,8 @@ protected:
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;
395public: 395public:
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 }
@@ -411,5 +409,5 @@ public:
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
@@ -482,4 +480,4 @@ public:
482 VCLinkerTool(); 480 VCLinkerTool();
483 ~VCLinkerTool(){}; 481 virtual ~VCLinkerTool(){}
484 virtual bool parseOption( const char* option ); 482 bool parseOption( const char* option );
485 483
@@ -547,4 +545,4 @@ public:
547 VCMIDLTool(); 545 VCMIDLTool();
548 ~VCMIDLTool(){}; 546 virtual ~VCMIDLTool(){}
549 virtual bool parseOption( const char* option ); 547 bool parseOption( const char* option );
550 548
@@ -589,4 +587,4 @@ public:
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
@@ -610,4 +608,4 @@ public:
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
@@ -627,4 +625,4 @@ public:
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
@@ -647,4 +645,4 @@ protected:
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
@@ -659,3 +657,3 @@ public:
659 657
660class VCPostBuildEventTool : public VCEventTool 658class VCPostBuildEventTool : public VCEventTool
661{ 659{
@@ -663,6 +661,6 @@ public:
663 VCPostBuildEventTool(); 661 VCPostBuildEventTool();
664 ~VCPostBuildEventTool(){}; 662 ~VCPostBuildEventTool(){}
665}; 663};
666 664
667class VCPreBuildEventTool : public VCEventTool 665class VCPreBuildEventTool : public VCEventTool
668{ 666{
@@ -670,6 +668,6 @@ public:
670 VCPreBuildEventTool(); 668 VCPreBuildEventTool();
671 ~VCPreBuildEventTool(){}; 669 ~VCPreBuildEventTool(){}
672}; 670};
673 671
674class VCPreLinkEventTool : public VCEventTool 672class VCPreLinkEventTool : public VCEventTool
675{ 673{
@@ -677,3 +675,3 @@ public:
677 VCPreLinkEventTool(); 675 VCPreLinkEventTool();
678 ~VCPreLinkEventTool(){}; 676 ~VCPreLinkEventTool(){}
679}; 677};
@@ -685,3 +683,3 @@ public:
685 VCConfiguration(); 683 VCConfiguration();
686 ~VCConfiguration(){}; 684 ~VCConfiguration(){}
687 685
@@ -722,3 +720,3 @@ public:
722 VCFilter(); 720 VCFilter();
723 ~VCFilter(){}; 721 ~VCFilter(){}
724 void generateMOC( QTextStream &strm, QString str ) const; 722 void generateMOC( QTextStream &strm, QString str ) const;
@@ -741,3 +739,3 @@ public:
741 VCProject(); 739 VCProject();
742 ~VCProject(){}; 740 ~VCProject(){}
743 741
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -40,4 +40,6 @@
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
@@ -45,4 +47,44 @@
45#include <objbase.h> 47#include <objbase.h>
48#ifndef GUID_DEFINED
49#define GUID_DEFINED
50typedef 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.
69const 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
48VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) 90VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
@@ -54,4 +96,3 @@ VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), i
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*/
@@ -66,3 +107,3 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
66 107
67 // Generate full project file 108 // Generate project file
68 if(project->first("TEMPLATE") == "vcapp" || 109 if(project->first("TEMPLATE") == "vcapp" ||
@@ -72,3 +113,5 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
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" );
@@ -82,3 +125,5 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
82struct VcsolutionDepend { 125struct 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;
@@ -86,2 +131,28 @@ struct VcsolutionDepend {
86 131
132QUuid 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
87void VcprojGenerator::writeSubDirs(QTextStream &t) 158void VcprojGenerator::writeSubDirs(QTextStream &t)
@@ -94,4 +165,18 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
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"];
@@ -118,44 +203,71 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
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 }
272nextfile:
161 QDir::setCurrent(oldpwd); 273 QDir::setCurrent(oldpwd);
@@ -164,22 +276,26 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
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}
@@ -308,8 +424,8 @@ void VcprojGenerator::initConfiguration()
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");
@@ -340,3 +456,3 @@ void VcprojGenerator::initCompilerTool()
340 if ( placement.isEmpty() ) 456 if ( placement.isEmpty() )
341 placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\"; 457 placement = ".\\";
342 458
@@ -364,2 +480,3 @@ void VcprojGenerator::initCompilerTool()
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") ) {
@@ -377,3 +494,3 @@ void VcprojGenerator::initCompilerTool()
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"] );
@@ -410,9 +527,11 @@ void VcprojGenerator::initLinkerTool()
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 }
@@ -461,3 +580,13 @@ void VcprojGenerator::initPreBuildEventTools()
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;
@@ -469,2 +598,6 @@ 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" ) ) {
@@ -476,5 +609,7 @@ void VcprojGenerator::initPostBuildEventTools()
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 += " &amp;&amp; ";
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
@@ -604,17 +739,2 @@ void VcprojGenerator::initResourceFiles()
604 739
605/*
606// $$MSVCPROJ_IDLSOURCES ---------------------------------------------
607void 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
@@ -631,2 +751,24 @@ void VcprojGenerator::initOld()
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
@@ -790,3 +932,3 @@ void VcprojGenerator::initOld()
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 )
@@ -801,2 +943,15 @@ void VcprojGenerator::initOld()
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
@@ -823,4 +978,4 @@ void VcprojGenerator::initOld()
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
@@ -869,4 +1024,11 @@ void VcprojGenerator::initOld()
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"];
@@ -885,15 +1047,14 @@ void VcprojGenerator::initOld()
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 }
@@ -998,15 +1159,3 @@ bool VcprojGenerator::openOutput(QFile &file) const
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 }
@@ -1015,2 +1164,17 @@ bool VcprojGenerator::openOutput(QFile &file) const
1015 1164
1165QString 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
1016QString VcprojGenerator::findTemplate(QString file) 1180QString VcprojGenerator::findTemplate(QString file)
@@ -1044,5 +1208,5 @@ void VcprojGenerator::outputVariables()
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 }
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __VCPROJMAKE_H__ 37#ifndef __MSVC_VCPROJ_H__
38#define __VCPROJMAKE_H__ 38#define __MSVC_VCPROJ_H__
39 39
@@ -48,2 +48,3 @@ enum target {
48 48
49struct QUuid;
49class VcprojGenerator : public Win32MakefileGenerator 50class VcprojGenerator : public Win32MakefileGenerator
@@ -70,2 +71,3 @@ protected:
70 virtual void outputVariables(); 71 virtual void outputVariables();
72 QString fixFilename(QString ofile) const;
71 73
@@ -91,20 +93,2 @@ protected:
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;
@@ -112,2 +96,4 @@ protected:
112 96
97private:
98 QUuid increaseUUID(const QUuid &id);
113 friend class VCFilter; 99 friend class VCFilter;
@@ -128,2 +114,2 @@ inline bool VcprojGenerator::findLibraries()
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
@@ -103,3 +103,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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;
@@ -118,7 +118,6 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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) {
@@ -135,7 +134,6 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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) {
@@ -157,2 +155,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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;
@@ -163,4 +162,5 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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"
@@ -188,5 +188,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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];
@@ -194,3 +192,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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 << "..";
@@ -212,13 +210,10 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
212int 210int
213Win32MakefileGenerator::findHighestVersion(const QString &d, const 211Win32MakefileGenerator::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);
@@ -226,8 +221,15 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const
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 }
@@ -243,11 +245,28 @@ Win32MakefileGenerator::findLibraries(const QString &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")) {
@@ -256,8 +275,10 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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;
@@ -266,24 +287,40 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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 }
@@ -293,6 +330,9 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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 }
@@ -325,4 +365,4 @@ Win32MakefileGenerator::processPrlFiles()
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;
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
@@ -75,2 +75,4 @@ extern QClipboard *qt_clipboard;
75extern Qt::WindowsVersion qt_winver; 75extern Qt::WindowsVersion qt_winver;
76#elif defined (Q_OS_MAC)
77extern Qt::MacintoshVersion qt_macver;
76#endif 78#endif
@@ -83,4 +85,3 @@ extern int qt_ncols_option;
83extern void qt_dispatchEnterLeave( QWidget*, QWidget* ); 85extern void qt_dispatchEnterLeave( QWidget*, QWidget* );
84 86extern bool qt_tryModalHelper( QWidget *, QWidget ** = 0 );
85
86 87
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
@@ -35,4 +35,4 @@
35 35
36#ifndef QCOM_H 36#ifndef QCOM_P_H
37#define QCOM_H 37#define QCOM_P_H
38 38
@@ -336,2 +336,2 @@ public: \
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
@@ -35,4 +35,4 @@
35 35
36#ifndef QUCOMLIBRARY_H 36#ifndef QCOMLIBRARY_P_H
37#define QUCOMLIBRARY_H 37#define QCOMLIBRARY_P_H
38 38
@@ -78,2 +78,2 @@ private:
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
@@ -5,5 +5,3 @@
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**
@@ -37,4 +35,4 @@
37 35
38#ifndef QCOMPLEXTEXT_H 36#ifndef QCOMPLEXTEXT_P_H
39#define QCOMPLEXTEXT_H 37#define QCOMPLEXTEXT_P_H
40 38
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
@@ -37,4 +37,4 @@
37 37
38#ifndef QCOMPONENTFACTORY_H 38#ifndef QCOMPONENTFACTORY_P_H
39#define QCOMPONENTFACTORY_H 39#define QCOMPONENTFACTORY_P_H
40 40
@@ -72,2 +72,2 @@ public:
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
@@ -35,4 +35,4 @@
35 35
36#ifndef QCRITICALSECTION_H 36#ifndef QCRITICALSECTION_P_H
37#define QCRITICALSECTION_H 37#define QCRITICALSECTION_P_H
38 38
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000.11.06 6** Created : 001106
7** 7**
@@ -40,3 +40,2 @@
40 40
41
42// 41//
@@ -55,6 +54,8 @@
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
58extern QStringList qt_makeFilterList( const QString & ); 59extern QValueList<QRegExp> qt_makeFilterList( const QString & );
59 60extern bool qt_matchFilterList( const QValueList<QRegExp> &, const QString & );
60 61
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000.06.21 6** Created : 000621
7** 7**
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 +1,31 @@
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
@@ -3,3 +33,21 @@
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"
@@ -8,5 +56,7 @@ 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)
12struct QSockNot 62struct QSockNot
@@ -32,2 +82,8 @@ public:
32 82
83#if defined(Q_WS_WIN)
84struct QSockNot {
85 QSocketNotifier *obj;
86 int fd;
87};
88#endif // Q_WS_WIN
33 89
@@ -46,2 +102,3 @@ public:
46 exitloop = FALSE; 102 exitloop = FALSE;
103 shortcut = FALSE;
47 } 104 }
@@ -50,4 +107,5 @@ public:
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
@@ -71,2 +129,8 @@ public:
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};
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
@@ -53,4 +53,4 @@
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
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
@@ -164,2 +164,3 @@ public:
164 uintpaintDevice:1; 164 uintpaintDevice:1;
165 uint useTextOutA:1;
165 union { 166 union {
@@ -415,3 +416,3 @@ public:
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();
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
@@ -32,4 +32,16 @@
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
@@ -55,2 +67,2 @@ struct Q_EXPORT QGfxDriverInterface : public QFeatureListInterface
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
@@ -5,3 +5,3 @@
5** 5**
6** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. 6** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
7** 7**
@@ -35,4 +35,4 @@
35 35
36#ifndef QGPLUGINMANAGER_H 36#ifndef QGPLUGINMANAGER_P_H
37#define QGPLUGINMANAGER_H 37#define QGPLUGINMANAGER_P_H
38 38
@@ -106,2 +106,2 @@ inline bool QGPluginManager::autoUnload() const
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
@@ -3,3 +3,3 @@
3** 3**
4** Definition of ??? 4** ...
5** 5**
@@ -35,4 +35,4 @@
35 35
36#ifndef QIMAGEFORMATINTERFACE_H 36#ifndef QIMAGEFORMATINTERFACE_P_H
37#define QIMAGEFORMATINTERFACE_H 37#define QIMAGEFORMATINTERFACE_P_H
38 38
@@ -74,2 +74,2 @@ struct Q_EXPORT QImageFormatInterface : public QFeatureListInterface
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
@@ -89,3 +89,3 @@ public:
89 void *ic; 89 void *ic;
90 QString text, lastcompose; 90 QString text;
91 QWidget *focusWidget; 91 QWidget *focusWidget;
@@ -117,2 +117,5 @@ private:
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
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
@@ -32,4 +32,16 @@
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
@@ -55,2 +67,2 @@ struct Q_EXPORT QKbdDriverInterface : public QFeatureListInterface
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
@@ -57,5 +57,2 @@
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"
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
52class QLockData;
53
54class QLock
55{
56public:
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
67private:
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.
76class QLockHolder
77{
78public:
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
88private:
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
@@ -32,4 +32,16 @@
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
@@ -55,2 +67,2 @@ struct Q_EXPORT QMouseDriverInterface : public QFeatureListInterface
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,3 +1,38 @@
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
@@ -30,3 +65,4 @@ private:
30 QMutex mutex; 65 QMutex mutex;
31 QMemArray<QMutex*> mutexes; 66 QMutex **mutexes;
67 int count;
32 bool recurs; 68 bool recurs;
@@ -38,2 +74,2 @@ extern QMutexPool *qt_global_mutexpool;
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
@@ -37,8 +37,4 @@
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
@@ -56,2 +52,6 @@
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
@@ -72,2 +72,2 @@ public:
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
@@ -8,3 +8,3 @@
8** 8**
9** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 9** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
10** 10**
@@ -63,3 +63,3 @@
63 63
64struct QPSPrinterPrivate; 64class QPSPrinterPrivate;
65 65
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
@@ -158,2 +158,4 @@ private:
158 } 158 }
159 QTextStringChar( const QTextStringChar & ) {
160 }
159 friend class QComplexText; 161 friend class QComplexText;
@@ -176,4 +178,4 @@ public:
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
@@ -288,4 +290,4 @@ public:
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();
@@ -328,3 +330,3 @@ private:
328 void pop(); 330 void pop();
329 void processNesting( Operation op ); 331 bool processNesting( Operation op );
330 void invalidateNested(); 332 void invalidateNested();
@@ -705,2 +707,3 @@ struct Q_EXPORT QTextDocumentSelection
705 bool swapped; 707 bool swapped;
708 Q_DUMMY_COMPARISON_OPERATOR(QTextDocumentSelection)
706}; 709};
@@ -841,2 +844,5 @@ public:
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,
@@ -1069,2 +1075,3 @@ struct Q_EXPORT QTextParagraphSelection
1069 int start, end; 1075 int start, end;
1076 Q_DUMMY_COMPARISON_OPERATOR(QTextParagraphSelection)
1070}; 1077};
@@ -1138,15 +1145,6 @@ public:
1138 1145
1139class Q_EXPORT QTextParagraphPseudoDocument 1146class QTextParagraphPseudoDocument;
1140{ 1147
1141public: 1148class 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
1152class Q_EXPORT QTextParagraph 1150class Q_EXPORT QTextParagraph
@@ -1155,2 +1153,3 @@ class Q_EXPORT QTextParagraph
1155 friend class QTextCursor; 1153 friend class QTextCursor;
1154 friend class QSyntaxHighlighter;
1156 1155
@@ -1178,3 +1177,9 @@ public:
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;
@@ -1598,3 +1603,2 @@ public:
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
@@ -1618,2 +1622,15 @@ private:
1618 1622
1623class Q_EXPORT QTextParagraphPseudoDocument
1624{
1625public:
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// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -1830,2 +1847,8 @@ inline void QTextDocument::takeFlow()
1830 1847
1848inline 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// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
@@ -96,3 +96,3 @@ public:
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
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 2002 Trolltech AS. All rights reserved.
9** 9**
@@ -32,2 +32,5 @@
32 32
33#ifndef QSHAREDMEMORY_P_H
34#define QSHAREDMEMORY_P_H
35
33// 36//
@@ -40,6 +43,5 @@
40// 43//
44// We mean it.
45//
41// 46//
42
43#if !defined(QT_QSHM_H)
44#define QT_QSHM_H
45 47
@@ -83,2 +85,3 @@ private:
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,2 +1,3 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
2** 3**
@@ -6,3 +7,3 @@
6** 7**
7** Copyright (C) 2000 Trolltech AS. All rights reserved. 8** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
8** 9**
@@ -39,2 +40,14 @@
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
@@ -68,2 +81,2 @@ struct QM_EXPORT_SQL QSqlDriverFactoryInterface : public QFeatureListInterface
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
@@ -53,4 +53,6 @@
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
@@ -61,9 +63,27 @@
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
70struct 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
77struct 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)
67Q_TEMPLATE_EXTERN template class QM_EXPORT_SQL QMap<QString,QVariant>; 86QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QMap<QString,Param>;
68Q_TEMPLATE_EXTERN template class QM_EXPORT_SQL QMap<int,QString>; 87QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QMap<int,QString>;
88QM_TEMPLATE_EXTERN_SQL template class QM_EXPORT_SQL QValueVector<Holder>;
69#endif 89#endif
@@ -76,5 +96,7 @@ public:
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();
@@ -88,3 +110,9 @@ public:
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};
@@ -98,3 +126,2 @@ public:
98}; 126};
99
100#endif 127#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
@@ -35,4 +35,16 @@
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
@@ -60,2 +72,2 @@ struct Q_EXPORT QStyleFactoryInterface : public QFeatureListInterface
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 20001024 6** Created : 001024
7** 7**
@@ -37,4 +37,4 @@
37 37
38#ifndef QSVGDEVICE_H 38#ifndef QSVGDEVICE_P_H
39#define QSVGDEVICE_H 39#define QSVGDEVICE_P_H
40 40
@@ -133,2 +133,2 @@ inline QRect QSvgDevice::boundingRect() const
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
@@ -38,3 +38,2 @@
38 38
39
40// 39//
@@ -52,3 +51,2 @@
52 51
53
54#ifndef QT_H 52#ifndef QT_H
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
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
@@ -37,9 +37,4 @@
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
@@ -57,2 +52,7 @@
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
@@ -131,3 +131,3 @@ public: // scary MSVC bug makes this necessary
131 bool b; 131 bool b;
132 132
133 char c; 133 char c;
@@ -136,3 +136,3 @@ public: // scary MSVC bug makes this necessary
136 long l; 136 long l;
137 137
138 unsigned char uc; 138 unsigned char uc;
@@ -141,8 +141,8 @@ public: // scary MSVC bug makes this necessary
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 {
@@ -151,5 +151,5 @@ public: // scary MSVC bug makes this necessary
151 } bytearray; 151 } bytearray;
152 152
153 void* ptr; 153 void* ptr;
154 154
155 struct { 155 struct {
@@ -158,3 +158,3 @@ public: // scary MSVC bug makes this necessary
158 } voidstar; 158 } voidstar;
159 159
160 struct { 160 struct {
@@ -168,3 +168,3 @@ public: // scary MSVC bug makes this necessary
168 } utf8; 168 } utf8;
169 169
170 struct { 170 struct {
@@ -173,6 +173,6 @@ public: // scary MSVC bug makes this necessary
173 } local8bit; 173 } local8bit;
174 174
175 QUnknownInterface* iface; 175 QUnknownInterface* iface;
176 QDispatchInterface* idisp; 176 QDispatchInterface* idisp;
177 177
178 } payload; 178 } payload;
@@ -265,3 +265,3 @@ struct Q_EXPORT QUEnumItem // - a name/value pair
265struct Q_EXPORT QUEnum 265struct Q_EXPORT QUEnum
266 { 266{
267 const char *name; // - enumerator name 267 const char *name; // - enumerator name
@@ -398,20 +398,2 @@ extern Q_EXPORT QUType_int static_QUType_int;
398 398
399// {5938712A-C496-11D5-8CB2-00C0F03BC0F3}
400extern Q_EXPORT const QUuid TID_QUType_uint;
401struct 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};
416extern Q_EXPORT QUType_uint static_QUType_uint;
417 399
@@ -436,20 +418,2 @@ extern Q_EXPORT QUType_double static_QUType_double;
436 418
437// {544C5175-6993-4486-B04D-CEC4D21BF4B9 }
438extern Q_EXPORT const QUuid TID_QUType_float;
439struct 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};
454extern Q_EXPORT QUType_float static_QUType_float;
455 419
@@ -498,2 +462,2 @@ extern Q_EXPORT QUType_QString static_QUType_QString;
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
@@ -37,4 +37,16 @@
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
@@ -91,3 +103,3 @@ extern Q_EXPORT QUType_varptr static_QUType_varptr;
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,5 +1,13 @@
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**
@@ -10,2 +18,6 @@
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
@@ -13,2 +25,5 @@
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.
@@ -20,12 +35,4 @@
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
@@ -43,2 +50,9 @@
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
44class QWidget; 58class QWidget;
@@ -94,3 +108,3 @@ public:
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}
@@ -103,5 +117,20 @@ struct QWidgetContainerInterfacePrivate : public QUnknownInterface
103public: 117public:
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};
@@ -110,2 +139,2 @@ public:
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -37,4 +37,16 @@
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
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
@@ -117,2 +117,6 @@ public:
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
@@ -103,2 +103,3 @@ Q_EXPORT Q_UINT16 qChecksum( const char *s, uint len );
103 103
104#ifndef QT_QWINEXPORT
104#if defined(Q_TEMPLATEDLL) 105#if defined(Q_TEMPLATEDLL)
@@ -106,2 +107,3 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<char>;
106#endif 107#endif
108#endif /* QT_QWINEXPORT */
107 109
@@ -234,2 +236,4 @@ public:
234 QCString &operator+=( char c ); 236 QCString &operator+=( char c );
237private:
238 intfind( const char *str, int index, bool cs, uint l ) const;
235}; 239};
@@ -390,2 +394,5 @@ Q_EXPORT inline const QCString operator+( char c1, const QCString &s2 )
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
@@ -117,2 +117,6 @@ public:
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
@@ -180,2 +180,3 @@ public:
180 static bool isRelativePath( const QString &path ); 180 static bool isRelativePath( const QString &path );
181 void refresh() const;
181 182
@@ -190,3 +191,3 @@ private:
190 191
191 static void slashify ( QString &); 192 static void slashify( QString & );
192 193
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
@@ -76,3 +76,3 @@
76 76
77// 4-bit greyscale 77// 4-bit grayscale
78//#define QT_NO_QWS_DEPTH_4 78//#define QT_NO_QWS_DEPTH_4
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
@@ -51,7 +51,15 @@ public:
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 };
57protected: 65protected:
@@ -72,2 +80,3 @@ protected:
72 80
81 boolresize( uint newsize, Optimization optim );
73 boolresize( uint newsize ); 82 boolresize( uint newsize );
@@ -90,3 +99,3 @@ protected:
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 );
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
@@ -40,3 +40,3 @@
40 40
41#define QT_VERSION_STR "3.1.0-b2" 41#define QT_VERSION_STR "3.1.2"
42/* 42/*
@@ -44,3 +44,3 @@
44 */ 44 */
45#define QT_VERSION 0x030100 45#define QT_VERSION 0x030102
46 46
@@ -143,8 +143,8 @@
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
@@ -227,3 +227,5 @@
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
@@ -273,2 +275,6 @@
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)
@@ -392,2 +398,6 @@
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 */
@@ -399,5 +409,4 @@
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)
@@ -417,2 +426,4 @@
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 */
@@ -425,4 +436,5 @@
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
@@ -430,2 +442,3 @@
430# define Q_NO_USING_KEYWORD 442# define Q_NO_USING_KEYWORD
443# define Q_INLINE_TEMPLATES inline
431 444
@@ -456,2 +469,12 @@
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)
@@ -508,2 +531,3 @@
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)
@@ -747,2 +771,6 @@ class QDataStream;
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
@@ -754,2 +782,3 @@ class QDataStream;
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//
@@ -772,4 +801,4 @@ class QDataStream;
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
@@ -778,3 +807,14 @@ class QDataStream;
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
@@ -805,3 +845,5 @@ Q_EXPORT const char *qVersion();
805Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian ); 845Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
806#if defined(Q_WS_WIN) 846#if defined(Q_OS_MAC)
847int qMacVersion();
848#elif defined(Q_WS_WIN)
807Q_EXPORT int qWinVersion(); 849Q_EXPORT int qWinVersion();
@@ -971,2 +1013,18 @@ Q_EXPORT const char *qInstallPathData();
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
@@ -994,2 +1052,3 @@ Q_EXPORT const char *qInstallPathData();
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)
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
@@ -113,2 +113,6 @@ public:
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
@@ -882,2 +882,6 @@ Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QMap<Key,T>& m
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
@@ -45,3 +45,3 @@
45 45
46template<class type> 46template<class type>
47class QMemArray : public QGArray 47class QMemArray : public QGArray
@@ -70,2 +70,3 @@ public:
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)); }
@@ -110,2 +111,3 @@ public:
110 111
112#ifndef QT_QWINEXPORT
111#if defined(Q_TEMPLATEDLL) 113#if defined(Q_TEMPLATEDLL)
@@ -116,2 +118,3 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<bool>;
116#endif 118#endif
119#endif /* QT_QWINEXPORT */
117 120
@@ -121,2 +124,6 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<bool>;
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
@@ -5,4 +5,2 @@
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.
@@ -159,2 +157,6 @@ public:
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
@@ -112,2 +112,6 @@ template<class type> inline void QPtrVector<type>::deleteItem( QPtrCollection::I
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
@@ -82,3 +82,3 @@ public:
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,
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
@@ -3,4 +3,3 @@
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**
@@ -8,3 +7,3 @@
8** 7**
9** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
10** 9**
@@ -45,2 +44,9 @@
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
@@ -338,5 +344,5 @@ 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);
@@ -352,3 +358,3 @@ struct Q_EXPORT QStringData : public QShared {
352 } 358 }
353 dirty = 1; 359 issimpletext = FALSE;
354 } 360 }
@@ -359,3 +365,3 @@ struct Q_EXPORT QStringData : public QShared {
359#endif 365#endif
360 uint simpletext : 1; 366 uint issimpletext : 1;
361#ifdef Q_OS_MAC9 367#ifdef Q_OS_MAC9
@@ -365,3 +371,3 @@ struct Q_EXPORT QStringData : public QShared {
365#endif 371#endif
366 uint dirty : 1; 372 uint islatin1 : 1;
367 373
@@ -386,2 +392,5 @@ public:
386#endif 392#endif
393#ifndef QT_NO_STL
394 QString( const std::string& ); // deep copy
395#endif
387 ~QString(); 396 ~QString();
@@ -389,4 +398,5 @@ public:
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
@@ -496,2 +506,5 @@ public:
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 );
@@ -503,2 +516,5 @@ public:
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 );
@@ -558,2 +574,5 @@ public:
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 );
@@ -578,3 +597,4 @@ public:
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;
@@ -587,4 +607,8 @@ public:
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 );
@@ -594,2 +618,3 @@ public:
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 );
@@ -611,3 +636,3 @@ public:
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
@@ -619,3 +644,3 @@ public:
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;
@@ -633,5 +658,5 @@ private:
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
@@ -796,3 +821,13 @@ inline QString &QString::prepend( char c )
796inline QString &QString::prepend( const QByteArray & s ) 821inline 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
826inline QString &QString::prepend( const std::string& s )
827{ return insert(0, s); }
828#endif
829
830#ifndef QT_NO_CAST_ASCII
831inline QString &QString::operator+=( const QByteArray &s )
832{ return operator+=(QString(s)); }
798#endif 833#endif
@@ -804,3 +839,3 @@ inline QString &QString::append( const QString & s )
804inline QString &QString::append( const QByteArray &s ) 839inline QString &QString::append( const QByteArray &s )
805{ return operator+=(s.data()); } 840{ return operator+=(s); }
806 841
@@ -816,5 +851,7 @@ inline QString &QString::append( char c )
816 851
817#ifndef QT_NO_CAST_ASCII 852#ifndef QT_NO_STL
818inline QString &QString::operator+=( const QByteArray &s ) 853inline QString &QString::operator+=( const std::string& s )
819{ return operator+=(s.data()); } 854{ return operator+=(s.c_str()); }
855inline QString &QString::append( const std::string& s )
856{ return operator+=(s); }
820#endif 857#endif
@@ -856,6 +893,6 @@ inline int QString::findRev( char c, int index, bool cs) const
856inline int QString::find( const char* str, int index ) const 893inline 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
859inline int QString::findRev( const char* str, int index ) const 896inline 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
@@ -899,3 +936,3 @@ Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 )
899 QString tmp( s1 ); 936 QString tmp( s1 );
900 tmp += QString::fromLatin1(s2); 937 tmp += QString::fromAscii(s2);
901 return tmp; 938 return tmp;
@@ -905,3 +942,3 @@ 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;
@@ -949,2 +986,6 @@ extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 );
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
@@ -47,2 +47,3 @@
47 47
48#ifndef QT_QWINEXPORT
48#if defined(Q_TEMPLATEDLL) 49#if defined(Q_TEMPLATEDLL)
@@ -51,2 +52,3 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrListIterator<char>;
51#endif 52#endif
53#endif /* QT_QWINEXPORT */
52 54
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
@@ -77,2 +77,7 @@ public:
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();
@@ -90,3 +95,3 @@ public:
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;
@@ -110,4 +115,13 @@ protected:
110 115
116private:
117 static QTextCodec *cftr;
118 static QTextCodec *cfcs;
111 friend class QFont; 119 friend class QFont;
112}; 120};
121
122inline QTextCodec* QTextCodec::codecForTr() { return cftr; }
123inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; }
124inline QTextCodec* QTextCodec::codecForCStrings() { return cfcs; }
125inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { cfcs = c; }
126
113#endif // QT_NO_TEXTCODEC 127#endif // QT_NO_TEXTCODEC
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
@@ -91,2 +91,3 @@ inline bool qEqual( InputIterator1 first1, InputIterator1 last1, InputIterator2
91{ 91{
92 // ### compare using !(*first1 == *first2) in Qt 4.0
92 for ( ; first1 != last1; ++first1, ++first2 ) 93 for ( ; first1 != last1; ++first1, ++first2 )
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
@@ -5,5 +5,5 @@
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**
@@ -55,3 +55,3 @@ typedef struct _GUID
55 uchar Data4[ 8 ]; 55 uchar Data4[ 8 ];
56} GUID; 56} GUID, *REFGUID, *LPGUID;
57#endif 57#endif
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
@@ -664,2 +664,6 @@ Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QValueList<T>&
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -56,3 +56,3 @@ public:
56 if ( !this->isEmpty() ) 56 if ( !this->isEmpty() )
57 remove( this->fromLast() ); 57 this->remove( this->fromLast() );
58 return elem; 58 return elem;
diff --git a/qmake/main.cpp b/qmake/main.cpp
index eed1697..cc2d08a 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -62,4 +62,9 @@ int main(int argc, char **argv)
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;
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 34b3ee2..8b7e5e8 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -84,3 +84,3 @@ Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE;
84bool Option::projfile::do_pwd = TRUE; 84bool Option::projfile::do_pwd = TRUE;
85bool Option::projfile::do_recursive = FALSE; 85bool Option::projfile::do_recursive = TRUE;
86QStringList Option::projfile::project_dirs; 86QStringList Option::projfile::project_dirs;
@@ -99,2 +99,13 @@ QString Option::mkfile::qmakespec_commandline;
99 99
100static 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
110QString project_builtin_regx();
100bool usage(const char *a0) 111bool usage(const char *a0)
@@ -109,7 +120,7 @@ bool usage(const char *a0)
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"
@@ -138,3 +149,3 @@ bool usage(const char *a0)
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"
@@ -145,22 +156,14 @@ bool usage(const char *a0)
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}
150static 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
161bool 164bool
162Option::parseCommandLine(int argc, char **argv) 165Option::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 */
@@ -181,3 +184,2 @@ Option::parseCommandLine(int argc, char **argv)
181 specified = FALSE; 184 specified = FALSE;
182 Option::qmake_mode = default_mode(argv[0]);
183 } 185 }
@@ -206,3 +208,3 @@ Option::parseCommandLine(int argc, char **argv)
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");
@@ -210,3 +212,3 @@ Option::parseCommandLine(int argc, char **argv)
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") {
@@ -246,5 +248,7 @@ Option::parseCommandLine(int argc, char **argv)
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 }
@@ -253,5 +257,2 @@ Option::parseCommandLine(int argc, char **argv)
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];
@@ -274,4 +275,65 @@ Option::parseCommandLine(int argc, char **argv)
274 } 275 }
276 return TRUE;
277}
278
279
280bool
281Option::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
@@ -285,8 +347,12 @@ Option::parseCommandLine(int argc, char **argv)
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 }
@@ -295,13 +361,2 @@ Option::parseCommandLine(int argc, char **argv)
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) {
@@ -388,9 +443,9 @@ Option::fixPathToTargetOS(const QString& in, bool fix_env, bool canonical)
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}
diff --git a/qmake/option.h b/qmake/option.h
index 9a5a85a..8bd348e 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -45,3 +45,3 @@
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
@@ -118,2 +118,5 @@ struct Option
118 }; 118 };
119
120private:
121 static bool internalParseCommandLine(int, char **, int=0);
119}; 122};
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 44eb503..834823d 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -68,5 +68,10 @@ static QString varMap(const QString &x)
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;
@@ -108,3 +113,3 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=FALSE
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] == ' ')) {
@@ -124,6 +129,8 @@ QMakeProject::QMakeProject()
124bool 129bool
125QMakeProject::parse(QString t, QMap<QString, QStringList> &place) 130QMakeProject::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 */
@@ -156,13 +163,17 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place)
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 }
@@ -219,3 +230,3 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place)
219 } else { 230 } else {
220 test = isActiveConfig(comp_scope.stripWhiteSpace()); 231 test = isActiveConfig(comp_scope.stripWhiteSpace(), TRUE);
221 } 232 }
@@ -289,3 +300,3 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place)
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())
@@ -357,3 +368,3 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place)
357bool 368bool
358QMakeProject::read(QString file, QMap<QString, QStringList> &place) 369QMakeProject::read(const QString &file, QMap<QString, QStringList> &place)
359{ 370{
@@ -365,7 +376,7 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
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("");
@@ -374,3 +385,3 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
374 } else { 385 } else {
375 qfile.setName(file); 386 qfile.setName(filename);
376 ret = qfile.open(IO_ReadOnly); 387 ret = qfile.open(IO_ReadOnly);
@@ -380,3 +391,3 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
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;
@@ -386,3 +397,7 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
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) == "\\") {
@@ -410,4 +425,11 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
410bool 425bool
411QMakeProject::read(QString project, QString) 426QMakeProject::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()) {
@@ -416,2 +438,4 @@ QMakeProject::read(QString project, QString)
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
@@ -443,16 +467,5 @@ QMakeProject::read(QString project, QString)
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()) {
@@ -466,7 +479,6 @@ QMakeProject::read(QString project, QString)
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 }
@@ -546,8 +558,10 @@ QMakeProject::read(QString project, QString)
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
@@ -581,3 +595,3 @@ QMakeProject::read(QString project, QString)
581bool 595bool
582QMakeProject::isActiveConfig(const QString &x) 596QMakeProject::isActiveConfig(const QString &x, bool regex)
583{ 597{
@@ -586,5 +600,4 @@ QMakeProject::isActiveConfig(const QString &x)
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;
@@ -603,5 +616,6 @@ QMakeProject::isActiveConfig(const QString &x)
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;
@@ -618,3 +632,3 @@ QMakeProject::isActiveConfig(const QString &x)
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;
@@ -627,2 +641,3 @@ QMakeProject::isActiveConfig(const QString &x)
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)))
@@ -634,3 +649,3 @@ QMakeProject::isActiveConfig(const QString &x)
634bool 649bool
635QMakeProject::doProjectTest(QString func, const QString &params, QMap<QString, QStringList> &place) 650QMakeProject::doProjectTest(const QString& func, const QString &params, QMap<QString, QStringList> &place)
636{ 651{
@@ -646,3 +661,3 @@ QMakeProject::doProjectTest(QString func, const QString &params, QMap<QString, Q
646bool 661bool
647QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStringList> &place) 662QMakeProject::doProjectTest(const QString& func, QStringList args, QMap<QString, QStringList> &place)
648{ 663{
@@ -656,2 +671,12 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin
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") {
@@ -693,3 +718,3 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin
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;
@@ -807,4 +832,7 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin
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;
@@ -821,2 +849,7 @@ QMakeProject::doProjectTest(QString func, QStringList args, QMap<QString, QStrin
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);
@@ -859,3 +892,3 @@ QMakeProject::doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringL
859 } else { 892 } else {
860 test = isActiveConfig(chk); 893 test = isActiveConfig(chk, TRUE);
861 } 894 }
@@ -879,114 +912,164 @@ QMakeProject::doVariableReplace(QString &str, const QMap<QString, QStringList> &
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 }
diff --git a/qmake/project.h b/qmake/project.h
index 201e63c..ec19f0c 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __QMAKE_H__ 37#ifndef __PROJECT_H__
38#define __QMAKE_H__ 38#define __PROJECT_H__
39 39
@@ -50,5 +50,5 @@ class QMakeProject
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 &params, QMap<QString, QStringList> &place); 52 bool doProjectTest(const QString &func, const QString &params, 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);
@@ -59,3 +59,3 @@ public:
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();
@@ -67,3 +67,3 @@ public:
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
@@ -71,3 +71,3 @@ 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
@@ -113,2 +113,2 @@ inline QMap<QString, QStringList> &QMakeProject::variables()
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
@@ -199,3 +199,4 @@ void QBitArray::pad0()
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
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
@@ -198,4 +198,4 @@ bool QBuffer::open( int 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 }
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
@@ -65,2 +65,6 @@ QComLibrary::~QComLibrary()
65 unload(); 65 unload();
66 if ( libiface )
67 libiface->release();
68 if ( entry )
69 entry->release();
66} 70}
@@ -393,25 +397,23 @@ void QComLibrary::createInstanceInternal()
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 }
@@ -463,7 +465,2 @@ void QComLibrary::createInstanceInternal()
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 );
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
@@ -2,9 +2,9 @@
2 2
3static const char QT_INSTALL_PREFIX [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; 3static const char QT_INSTALL_PREFIX [256] = "/opt/qt-x11-free-3.1.2";
4static const char QT_INSTALL_BINS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/bin"; 4static const char QT_INSTALL_BINS [256] = "/opt/qt-x11-free-3.1.2/bin";
5static const char QT_INSTALL_DOCS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/doc"; 5static const char QT_INSTALL_DOCS [256] = "/opt/qt-x11-free-3.1.2/doc";
6static const char QT_INSTALL_HEADERS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/include"; 6static const char QT_INSTALL_HEADERS[256] = "/opt/qt-x11-free-3.1.2/include";
7static const char QT_INSTALL_LIBS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/lib"; 7static const char QT_INSTALL_LIBS [256] = "/opt/qt-x11-free-3.1.2/lib";
8static const char QT_INSTALL_PLUGINS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/plugins"; 8static const char QT_INSTALL_PLUGINS[256] = "/opt/qt-x11-free-3.1.2/plugins";
9static const char QT_INSTALL_DATA [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; 9static const char QT_INSTALL_DATA [256] = "/opt/qt-x11-free-3.1.2";
10 10
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
@@ -5,4 +5,2 @@
5** 5**
6** Created :
7**
8** Copyright (C) 2001 Trolltech AS. All rights reserved. 6** Copyright (C) 2001 Trolltech AS. All rights reserved.
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
@@ -143,2 +143,13 @@ char *qstrncpy( char *dst, const char *src, uint len )
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 );
@@ -301,3 +312,4 @@ Q_UINT16 qChecksum( const char *data, uint len )
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
@@ -321,5 +333,11 @@ Q_UINT16 qChecksum( const char *data, uint len )
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*/
@@ -327,8 +345,8 @@ Q_UINT16 qChecksum( const char *data, uint len )
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*/
@@ -381,5 +399,19 @@ QByteArray qCompress( const uchar* data, int nbytes )
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*/
@@ -387,10 +419,8 @@ QByteArray qCompress( const uchar* data, int nbytes )
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*/
@@ -938,2 +968,7 @@ int QCString::find( const char *str, int index, bool cs ) const
938{ 968{
969 return find( str, index, cs, length() );
970}
971
972int QCString::find( const char *str, int index, bool cs, uint l ) const
973{
939 if ( (uint)index >= size() ) 974 if ( (uint)index >= size() )
@@ -944,3 +979,2 @@ int QCString::find( const char *str, int index, bool cs ) const
944 return index; 979 return index;
945 const uint l = length();
946 const uint sl = qstrlen( str ); 980 const uint sl = qstrlen( str );
@@ -1154,4 +1188,5 @@ int QCString::contains( const char *str, bool cs ) const
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++;
@@ -1175,3 +1210,2 @@ int QCString::contains( const char *str, bool cs ) const
1175*/ 1210*/
1176
1177QCString QCString::left( uint len ) const 1211QCString QCString::left( uint len ) const
@@ -1499,3 +1533,3 @@ QCString &QCString::insert( uint index, const char *s )
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 );
@@ -1503,6 +1537,8 @@ QCString &QCString::insert( uint index, const char *s )
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 }
@@ -1571,3 +1607,3 @@ QCString &QCString::remove( uint index, uint len )
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 }
@@ -1633,2 +1669,3 @@ QCString &QCString::replace( char c, const char *after )
1633*/ 1669*/
1670
1634QCString &QCString::replace( const char *before, const char *after ) 1671QCString &QCString::replace( const char *before, const char *after )
@@ -1648,3 +1685,3 @@ QCString &QCString::replace( const char *before, const char *after )
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 );
@@ -1657,3 +1694,3 @@ QCString &QCString::replace( const char *before, const char *after )
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 ) {
@@ -1688,3 +1725,3 @@ QCString &QCString::replace( const char *before, const char *after )
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 )
@@ -1765,3 +1802,3 @@ 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 );
@@ -1785,3 +1822,3 @@ 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 );
@@ -1810,3 +1847,3 @@ 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 );
@@ -1840,4 +1877,4 @@ 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 );
@@ -2201,3 +2238,3 @@ QCString& QCString::operator+=( const char *str )
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
@@ -2217,3 +2254,3 @@ QCString &QCString::operator+=( char c )
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
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
@@ -752,4 +752,12 @@ QDataStream &QDataStream::readRawBytes( char *s, uint len )
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
@@ -1014,5 +1022,11 @@ QDataStream &QDataStream::writeRawBytes( const char *s, uint len )
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
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -37,3 +37,2 @@
37 37
38// Get the system specific includes and defines
39#include "qplatformdefs.h" 38#include "qplatformdefs.h"
@@ -897,2 +896,8 @@ QDate QDate::addYears( int nyears ) const
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);
@@ -992,2 +997,3 @@ QDate QDate::currentDate( Qt::TimeSpec ts )
992#else 997#else
998 // posix compliant system
993 time_t ltime; 999 time_t ltime;
@@ -995,6 +1001,17 @@ QDate QDate::currentDate( Qt::TimeSpec ts )
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( &ltime, &res );
1008 else
1009 t = gmtime_r( &ltime, &res );
1010# else
996 if ( ts == Qt::LocalTime ) 1011 if ( ts == Qt::LocalTime )
997 t = localtime( &ltime ); 1012 t = localtime( &ltime );
998 else 1013 else
999 t = gmtime( &ltime ); 1014 t = gmtime( &ltime );
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 );
@@ -1557,3 +1574,3 @@ int QTime::msecsTo( const QTime &t ) const
1557 1574
1558/*! 1575/*!
1559 \overload 1576 \overload
@@ -1655,2 +1672,3 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
1655#elif defined(Q_OS_UNIX) 1672#elif defined(Q_OS_UNIX)
1673 // posix compliant system
1656 struct timeval tv; 1674 struct timeval tv;
@@ -1659,7 +1677,17 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
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( &ltime, &res );
1684 else
1685 t = gmtime_r( &ltime, &res );
1686# else
1687 if ( ts == Qt::LocalTime )
1661 t = localtime( &ltime ); 1688 t = localtime( &ltime );
1662 } else { 1689 else
1663 t = gmtime( &ltime ); 1690 t = gmtime( &ltime );
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 +
@@ -1670,3 +1698,3 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
1670 tm *t; 1698 tm *t;
1671 if ( ts == Qt::LocalTime ) 1699 if ( ts == Qt::LocalTime )
1672 localtime( &ltime ); 1700 localtime( &ltime );
@@ -1708,5 +1736,5 @@ bool QTime::isValid( int h, int m, int s, int ms )
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
@@ -1962,2 +1990,18 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts )
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 )
@@ -1972,2 +2016,4 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts )
1972 } 2016 }
2017#endif
2018
1973 d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900, 2019 d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900,
@@ -2302,3 +2348,3 @@ bool QDateTime::operator>=( const QDateTime &dt ) const
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.
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -45,5 +45,9 @@
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)
49const bool CaseSensitiveFS = FALSE;
50#else
51const bool CaseSensitiveFS = TRUE;
52#endif
49 53
@@ -52,2 +56,3 @@
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.
@@ -232,2 +237,10 @@ QDir::QDir( const QDir &d )
232 237
238/*!
239 Refreshes the directory information.
240*/
241void QDir::refresh() const
242{
243 QDir* that = (QDir*) this;
244 that->dirty = TRUE;
245}
233 246
@@ -384,6 +397,32 @@ QString QDir::absFilePath( const QString &fileName,
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;
@@ -936,3 +975,4 @@ QDir &QDir::operator=( const QString &path )
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
@@ -951,3 +991,4 @@ QDir &QDir::operator=( const QString &path )
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
@@ -1089,6 +1130,7 @@ QDir QDir::root()
1089 1130
1090QStringList qt_makeFilterList( const QString &filter ) 1131QValueList<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
@@ -1101,11 +1143,22 @@ QStringList qt_makeFilterList( const QString &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 ) { 1151bool 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/*!
@@ -1125,7 +1178,3 @@ bool QDir::match( const QStringList &filters, const QString &fileName )
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) )
@@ -1149,4 +1198,3 @@ 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}
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -53,2 +53,3 @@
53#include <limits.h> 53#include <limits.h>
54#include <errno.h>
54 55
@@ -72,13 +73,12 @@ QString QDir::canonicalPath() const
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;
@@ -92,8 +92,9 @@ bool QDir::mkdir( const QString &dirName, bool acceptAbsPath ) const
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}
@@ -188,3 +189,3 @@ bool QDir::readDirEntries( const QString &nameFilter,
188 189
189 QStringList filters = qt_makeFilterList( nameFilter ); 190 QValueList<QRegExp> filters = qt_makeFilterList( nameFilter );
190 191
@@ -199,7 +200,2 @@ bool QDir::readDirEntries( const QString &nameFilter,
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;
@@ -212,6 +208,15 @@ bool QDir::readDirEntries( const QString &nameFilter,
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;
@@ -278,3 +283,4 @@ const QFileInfoList * QDir::drives()
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
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
@@ -90,3 +90,3 @@ extern bool qt_file_access( const QString& fn, int t );
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'
@@ -292,2 +292,3 @@ void QFile::flush()
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
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
@@ -437,7 +437,10 @@ QIODevice::Offset QFile::size() const
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)
@@ -540,3 +543,3 @@ Q_LONG QFile::readBlock( char *p, Q_ULONG len )
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++;
@@ -631,3 +634,5 @@ Q_LONG QFile::writeBlock( const char *p, Q_ULONG len )
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
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
@@ -637,2 +637,4 @@ QDateTime QFileInfo::lastRead() const
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
@@ -646,3 +648,3 @@ QString QFileInfo::absFilePath() const
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] != ':'
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
@@ -216,5 +216,5 @@ uint QFileInfo::groupId() const
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
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
@@ -37,5 +37,9 @@
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
@@ -51,3 +55,9 @@
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
@@ -137,3 +147,7 @@ QGArray::QGArray( int 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}
@@ -214,8 +228,16 @@ bool QGArray::isEqual( const QGArray &a ) const
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 232bool QGArray::resize( uint newsize, Optimization optim )
218bool 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;
@@ -225,2 +247,21 @@ bool QGArray::resize( uint newsize )
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
@@ -228,3 +269,3 @@ bool QGArray::resize( uint newsize )
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);
@@ -232,6 +273,6 @@ bool QGArray::resize( uint newsize )
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 }
@@ -243,2 +284,10 @@ bool QGArray::resize( uint newsize )
243 284
285/*!\overload
286*/
287bool QGArray::resize( uint newsize )
288{
289 return resize( newsize, MemOptim );
290}
291
292
244/*! 293/*!
@@ -321,3 +370,7 @@ QGArray &QGArray::assign( const char *d, uint len )
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;
@@ -366,3 +419,7 @@ QGArray &QGArray::duplicate( const QGArray &a )
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 )
@@ -404,3 +461,7 @@ QGArray &QGArray::duplicate( const char *d, uint len )
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;
@@ -661,3 +722,4 @@ void QGArray::sort( uint sz )
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
@@ -679,3 +741,4 @@ int QGArray::bsearch( const char *d, uint sz ) const
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
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
@@ -206,3 +206,6 @@ 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 );
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
@@ -331,8 +331,4 @@ QLNode *QGList::locate( uint index )
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
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
@@ -151,3 +151,24 @@ bool qSysInfo( int *wordSize, bool *bigEndian )
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
156int 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}
172Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion();
173#elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
153bool qt_winunicode; 174bool qt_winunicode;
@@ -323,3 +344,15 @@ static const int QT_BUFFER_LENGTH = 8196; // internal buffer length
323#ifdef Q_OS_MAC 344#ifdef Q_OS_MAC
324const unsigned char * p_str(const char * c, int len=-1) 345QString 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
357unsigned char * p_str(const char * c, int len=-1)
325{ 358{
@@ -339,3 +372,3 @@ const unsigned char * p_str(const char * c, int len=-1)
339 372
340const unsigned char * p_str(const QString &s) 373unsigned char * p_str(const QString &s)
341{ 374{
@@ -643,4 +676,4 @@ void qSystemWarning( const char* msg, int code )
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
@@ -654,3 +687,3 @@ void qSystemWarning( const char* msg, int code )
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 );
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
@@ -5,3 +5,3 @@
5** 5**
6** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. 6** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
7** 7**
@@ -477,3 +477,3 @@ bool QGPluginManager::addLibrary( QLibrary* lib )
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];
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
@@ -37,2 +37,8 @@
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
@@ -395,3 +401,4 @@ void QGVector::sort() // sort vector
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
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
@@ -5,5 +5,5 @@
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**
@@ -73,3 +73,3 @@ QLibraryPrivate::QLibraryPrivate( QLibrary *lib )
73 \mainclass 73 \mainclass
74 \group plugins 74 \ingroup plugins
75 75
@@ -328,3 +328,4 @@ QString QLibrary::library() const
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( "/" );
@@ -333,5 +334,5 @@ QString QLibrary::library() const
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 }
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
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
@@ -55,3 +55,20 @@
55 55
56#if defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit 56#if defined(Q_OS_MAC)
57
58bool QLibraryPrivate::loadLibrary()
59{
60 return FALSE;
61}
62
63bool QLibraryPrivate::freeLibrary()
64{
65 return FALSE;
66}
67
68void* 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
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
@@ -45,4 +45,5 @@ typedef pthread_mutex_t Q_MUTEX_T;
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))
@@ -663,3 +664,4 @@ bool QMutex::tryLock()
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
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 +1,36 @@
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"
@@ -5,3 +40,2 @@
5#include <qthread.h> 40#include <qthread.h>
6#include <stdio.h>
7 41
@@ -9,17 +43,2 @@ QMutexPool *qt_global_mutexpool = 0;
9 43
10// this is an internal class used only for inititalizing the global mutexpool
11class QGlobalMutexPoolInitializer
12{
13public:
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};
24QGlobalMutexPoolInitializer qt_global_mutexpool_initializer;
25 44
@@ -87,5 +106,8 @@ QGlobalMutexPoolInitializer qt_global_mutexpool_initializer;
87QMutexPool::QMutexPool( bool recursive, int size ) 106QMutexPool::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}
@@ -99,7 +121,8 @@ QMutexPool::~QMutexPool()
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}
@@ -112,6 +135,5 @@ 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
@@ -121,4 +143,4 @@ QMutex *QMutexPool::get( void *address )
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 }
@@ -126,3 +148,3 @@ QMutex *QMutexPool::get( void *address )
126 148
127 return d[index]; 149 return mutexes[index];
128} 150}
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
@@ -265,3 +265,3 @@
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>
@@ -269,3 +269,3 @@
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>
@@ -273,3 +273,3 @@
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>
@@ -549,3 +549,10 @@
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
@@ -679,7 +686,7 @@
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
@@ -717,2 +724,7 @@ const int EOS = -1;
717 724
725static bool isWord( QChar ch )
726{
727 return ch.isLetterOrNumber() || ch == QChar( '_' );
728}
729
718/* 730/*
@@ -1682,5 +1694,5 @@ bool QRegExpEngine::testAnchor( int i, int a, const int *capBegin )
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) )
@@ -2634,3 +2646,10 @@ int QRegExpEngine::getEscape()
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;
@@ -2654,2 +2673,3 @@ int QRegExpEngine::getEscape()
2654 yyCharClass->addCategories( 0x000f8070 ); 2673 yyCharClass->addCategories( 0x000f8070 );
2674 yyCharClass->addSingleton( 0x005f ); // '_'
2655 return Tok_CharClass; 2675 return Tok_CharClass;
@@ -3185,3 +3205,4 @@ static QRegExpEngine *newEngine( const QString& pattern, bool caseSensitive )
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
@@ -3201,7 +3222,8 @@ 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 ) {
@@ -3567,9 +3589,2 @@ int QRegExp::match( const QString& str, int index, int *len,
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
3575int QRegExp::search( const QString& str, int offset ) const 3590int QRegExp::search( const QString& str, int offset ) const
@@ -3627,9 +3642,2 @@ int QRegExp::search( const QString& str, int offset, CaretMode caretMode ) const
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
3635int QRegExp::searchRev( const QString& str, int offset ) const 3643int QRegExp::searchRev( const QString& str, int offset ) const
@@ -3696,3 +3704,3 @@ int QRegExp::matchedLength() const
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.
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
@@ -185,2 +185,9 @@ int QSemaphore::operator+=(int n)
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)
@@ -189,10 +196,2 @@ int QSemaphore::operator+=(int n)
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;
@@ -214,11 +213,10 @@ int QSemaphore::operator-=(int n)
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;
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
@@ -5,3 +5,3 @@
5** 5**
6** Created: 2000.06.26 6** Created : 000626
7** 7**
@@ -65,25 +65,25 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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
@@ -103,10 +103,9 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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 // ...
@@ -117,6 +116,6 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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 // ...
@@ -124,2 +123,18 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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
@@ -141,6 +156,2 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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
@@ -154,3 +165,21 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
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
@@ -302,3 +331,3 @@ static HANDLE openlock( const QString &name, int /*type*/ )
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
@@ -310,3 +339,3 @@ static HANDLE openlock( const QString &name, int /*type*/ )
310 339
311void closelock( HANDLE fd ) 340static void closelock( HANDLE fd )
312{ 341{
@@ -315,3 +344,3 @@ void closelock( HANDLE fd )
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
@@ -457,5 +486,7 @@ QSettingsPrivate::QSettingsPrivate( QSettings::Format format )
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
@@ -508,2 +539,4 @@ QSettingsPrivate::QSettingsPrivate( QSettings::Format format )
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
@@ -532,2 +565,4 @@ QSettingsGroup QSettingsPrivate::readGroup()
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()) {
@@ -566,2 +601,4 @@ void QSettingsPrivate::removeGroup(const QString &key)
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()) {
@@ -617,2 +654,4 @@ void QSettingsPrivate::writeGroup(const QString &key, const QString &value)
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()) {
@@ -651,2 +690,4 @@ QDateTime QSettingsPrivate::modificationTime()
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()) {
@@ -660,3 +701,3 @@ QDateTime QSettingsPrivate::modificationTime()
660 701
661static bool verifyKey( const QString &key ) 702bool qt_verify_key( const QString &key )
662{ 703{
@@ -669,4 +710,10 @@ 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;
@@ -688,3 +735,3 @@ static inline QString groupKey( const QString &group, const QString &key )
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.
@@ -712,3 +759,3 @@ static inline QString groupKey( const QString &group, const QString &key )
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.
@@ -759,3 +806,3 @@ 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 ) {
@@ -766,3 +813,12 @@ void QSettings::insertSearchPath( System s, const QString &path)
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)
@@ -773,3 +829,3 @@ void QSettings::insertSearchPath( System s, const QString &path)
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 ) {
@@ -778,3 +834,3 @@ void QSettings::insertSearchPath( System s, const QString &path)
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
@@ -784,5 +840,11 @@ void QSettings::insertSearchPath( System s, const QString &path)
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 }
@@ -800,3 +862,3 @@ 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)
@@ -813,3 +875,3 @@ void QSettings::removeSearchPath( System s, const QString &path)
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 ) {
@@ -818,3 +880,3 @@ void QSettings::removeSearchPath( System s, const QString &path)
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
@@ -839,3 +901,3 @@ QSettings::QSettings()
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;
@@ -856,3 +918,3 @@ QSettings::QSettings( Format format )
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;
@@ -874,3 +936,3 @@ QSettings::~QSettings()
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 )
@@ -889,3 +951,3 @@ 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 )
@@ -907,2 +969,4 @@ bool QSettings::sync()
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()) {
@@ -919,5 +983,5 @@ bool QSettings::sync()
919 983
920 it++; 984 ++it;
921 985
922 if (file.name().isNull() || file.name().isEmpty()) { 986 if ( file.name().isEmpty() ) {
923 987
@@ -965,3 +1029,3 @@ bool QSettings::sync()
965 stream << grpit.key() << "=" << v << endl; 1029 stream << grpit.key() << "=" << v << endl;
966 grpit++; 1030 ++grpit;
967 } 1031 }
@@ -971,3 +1035,3 @@ bool QSettings::sync()
971 1035
972 hdit++; 1036 ++hdit;
973 } 1037 }
@@ -1010,3 +1074,3 @@ 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)
@@ -1020,9 +1084,8 @@ bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok )
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
@@ -1062,3 +1125,3 @@ 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)
@@ -1072,9 +1135,8 @@ double QSettings::readDoubleEntry(const QString &key, double def, bool *ok )
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;
@@ -1108,3 +1170,3 @@ 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)
@@ -1117,10 +1179,8 @@ int QSettings::readNumEntry(const QString &key, int def, bool *ok )
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;
@@ -1154,3 +1214,3 @@ 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)
@@ -1166,3 +1226,3 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok )
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 )
@@ -1208,7 +1268,9 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok )
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;
@@ -1230,3 +1292,3 @@ 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)
@@ -1237,10 +1299,8 @@ bool QSettings::writeEntry(const QString &key, bool value)
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}
@@ -1262,3 +1322,3 @@ 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)
@@ -1269,10 +1329,8 @@ bool QSettings::writeEntry(const QString &key, double value)
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}
@@ -1293,3 +1351,3 @@ 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)
@@ -1300,10 +1358,8 @@ bool QSettings::writeEntry(const QString &key, int value)
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}
@@ -1329,3 +1385,3 @@ 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)
@@ -1336,5 +1392,3 @@ bool QSettings::writeEntry(const QString &key, const char *value)
1336 1392
1337 QString theKey = groupKey( group(), key ); 1393 return writeEntry(key, QString(value));
1338
1339 return writeEntry(theKey, QString(value));
1340} 1394}
@@ -1356,3 +1410,3 @@ 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)
@@ -1365,3 +1419,3 @@ bool QSettings::writeEntry(const QString &key, const QString &value)
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 )
@@ -1417,3 +1471,3 @@ 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)
@@ -1426,3 +1480,3 @@ bool QSettings::removeEntry(const QString &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 )
@@ -1496,3 +1550,3 @@ 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)
@@ -1505,3 +1559,3 @@ QStringList QSettings::entryList(const QString &key) const
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 )
@@ -1546,3 +1600,3 @@ QStringList QSettings::entryList(const QString &key) const
1546 itkey = it.key(); 1600 itkey = it.key();
1547 it++; 1601 ++it;
1548 1602
@@ -1593,3 +1647,3 @@ 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)
@@ -1602,3 +1656,3 @@ QStringList QSettings::subkeyList(const QString &key) const
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 )
@@ -1608,2 +1662,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1608 QString realkey; 1662 QString realkey;
1663 int subkeycount = 2;
1609 if (theKey[0] == '/') { 1664 if (theKey[0] == '/') {
@@ -1620,2 +1675,4 @@ QStringList QSettings::subkeyList(const QString &key) const
1620 1675
1676 subkeycount = list.count();
1677
1621 if (list.count() == 1) { 1678 if (list.count() == 1) {
@@ -1634,2 +1691,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1634 } 1691 }
1692
1635 } else 1693 } else
@@ -1637,5 +1695,16 @@ QStringList QSettings::subkeyList(const QString &key) const
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;
@@ -1643,3 +1712,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1643 itkey = it.key(); 1712 itkey = it.key();
1644 it++; 1713 ++it;
1645 1714
@@ -1672,3 +1741,3 @@ 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)
@@ -1681,3 +1750,3 @@ QDateTime QSettings::lastModficationTime(const QString &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 )
@@ -1717,5 +1786,13 @@ QDateTime QSettings::lastModficationTime(const QString &key)
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
@@ -1770,2 +1847,9 @@ bool QSettings::writeEntry(const QString &key, const QStringList &value)
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
@@ -1849,15 +1933,22 @@ QStringList QSettings::readListEntry(const QString &key, bool *ok )
1849 1933
1934#ifdef Q_OS_MAC
1935void 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*/
@@ -1875,3 +1966,3 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
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
@@ -1882,2 +1973,4 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1882// scope. 1973// scope.
1974 d->globalScope = scope == Global;
1975
1883 QString actualSearchPath; 1976 QString actualSearchPath;
@@ -1888,7 +1981,7 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
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 );
@@ -1898,4 +1991,2 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1898#endif 1991#endif
1899
1900 d->globalScope = scope == Global;
1901} 1992}
@@ -1904,2 +1995,9 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
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*/
@@ -1914,2 +2012,9 @@ void QSettings::beginGroup( const QString &group )
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*/
@@ -1947,3 +2052,3 @@ QString QSettings::group() const
1947 if ( group[0] != '/' ) 2052 if ( group[0] != '/' )
1948 group = "/" + group; 2053 group.prepend( "/" );
1949 d->groupPrefix += group; 2054 d->groupPrefix += group;
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
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -49,3 +49,2 @@
49#endif 49#endif
50#include <ctype.h>
51#include <limits.h> 50#include <limits.h>
@@ -54,2 +53,3 @@
54#include <stdlib.h> 53#include <stdlib.h>
54#include <string.h>
55#if defined(Q_WS_WIN) 55#if defined(Q_WS_WIN)
@@ -61,2 +61,6 @@
61 61
62#ifdef QT_NO_UNICODETABLES
63# include <ctype.h>
64#endif
65
62 66
@@ -11789,2 +11793,3 @@ static inline QChar::Direction direction( const QChar &c )
11789#else 11793#else
11794 Q_UNUSED(c);
11790 return QChar::DirL; 11795 return QChar::DirL;
@@ -11801,2 +11806,3 @@ static inline bool mirrored( const QChar &c )
11801#else 11806#else
11807 Q_UNUSED(c);
11802 return FALSE; 11808 return FALSE;
@@ -11902,3 +11908,3 @@ static uint computeNewMax( uint 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) )
@@ -12893,3 +12899,3 @@ void QString::compose()
12893 12899
12894QChar* QString::asciiToUnicode( const QByteArray& ba, uint* len ) 12900QChar* QString::latin1ToUnicode( const QByteArray& ba, uint* len )
12895{ 12901{
@@ -12912,3 +12918,3 @@ QChar* QString::asciiToUnicode( const QByteArray& ba, uint* len )
12912 12918
12913static QChar* internalAsciiToUnicode( const QByteArray& ba, uint* len ) 12919static QChar* internalLatin1ToUnicode( const QByteArray& ba, uint* len )
12914{ 12920{
@@ -12942,3 +12948,3 @@ static QChar* internalAsciiToUnicode( const QByteArray& ba, uint* len )
12942 12948
12943QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen ) 12949QChar* QString::latin1ToUnicode( const char *str, uint* len, uint maxlen )
12944{ 12950{
@@ -12952,3 +12958,3 @@ QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen )
12952 // Faster? 12958 // Faster?
12953 l = qstrlen(str); 12959 l = strlen( str );
12954 } 12960 }
@@ -12965,3 +12971,3 @@ QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen )
12965 12971
12966static QChar* internalAsciiToUnicode( const char *str, uint* len, 12972static QChar* internalLatin1ToUnicode( const char *str, uint* len,
12967 uint maxlen = (uint)-1 ) 12973 uint maxlen = (uint)-1 )
@@ -12976,3 +12982,3 @@ static QChar* internalAsciiToUnicode( const char *str, uint* len,
12976 // Faster? 12982 // Faster?
12977 l = qstrlen(str); 12983 l = strlen( str );
12978 } 12984 }
@@ -12996,3 +13002,3 @@ static QChar* internalAsciiToUnicode( const char *str, uint* len,
12996*/ 13002*/
12997char* QString::unicodeToAscii(const QChar *uc, uint l) 13003char* QString::unicodeToLatin1(const QChar *uc, uint l)
12998{ 13004{
@@ -13159,31 +13165,2 @@ QStringData* QString::makeSharedNull()
13159 13165
13160// Uncomment this to get some useful statistics.
13161// #define Q2HELPER(x) x
13162
13163#ifdef Q2HELPER
13164static int stat_construct_charstar=0;
13165static int stat_construct_charstar_size=0;
13166static int stat_construct_null=0;
13167static int stat_construct_int=0;
13168static int stat_construct_int_size=0;
13169static int stat_construct_ba=0;
13170static int stat_get_ascii=0;
13171static int stat_get_ascii_size=0;
13172static int stat_copy_on_write=0;
13173static int stat_copy_on_write_size=0;
13174static int stat_fast_copy=0;
13175Q_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/*!
@@ -13213,3 +13190,2 @@ QString::QString( const QString &s ) :
13213{ 13190{
13214 Q2HELPER(stat_fast_copy++)
13215 d->ref(); 13191 d->ref();
@@ -13232,5 +13208,3 @@ QString::QString( int size, bool /*dummy*/ )
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 );
@@ -13238,3 +13212,2 @@ QString::QString( int size, bool /*dummy*/ )
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);
@@ -13251,5 +13224,11 @@ 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);
@@ -13304,8 +13283,35 @@ 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
13303QString::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
@@ -13335,6 +13341,6 @@ 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 }
@@ -13354,2 +13360,11 @@ void QStringData::deleteSelf()
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 )
@@ -13370,3 +13385,2 @@ QString &QString::operator=( const QString &s )
13370{ 13385{
13371 Q2HELPER(stat_fast_copy++)
13372 s.d->ref(); 13386 s.d->ref();
@@ -13385,3 +13399,3 @@ QString &QString::operator=( const QCString& cs )
13385{ 13399{
13386 return setLatin1(cs); 13400 return setAscii(cs);
13387} 13401}
@@ -13401,3 +13415,3 @@ QString &QString::operator=( const char *str )
13401{ 13415{
13402 return setLatin1(str); 13416 return setAscii(str);
13403} 13417}
@@ -13473,4 +13487,3 @@ void QString::truncate( uint newLen )
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
@@ -13488,8 +13501,8 @@ void QString::truncate( uint newLen )
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
@@ -13507,4 +13520,2 @@ void QString::setLength( uint newLen )
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 );
@@ -13532,17 +13543,16 @@ void QString::setLength( uint newLen )
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
@@ -13776,3 +13786,3 @@ QString &QString::sprintf( const char* cformat, ... )
13776 } 13786 }
13777 QString format = fromLatin1( cformat ); 13787 QString format = fromAscii( cformat );
13778 13788
@@ -13915,3 +13925,3 @@ QString &QString::sprintf( const char* cformat, ... )
13915 } 13925 }
13916 replacement = fromLatin1( out ); 13926 replacement = fromAscii( out );
13917 } 13927 }
@@ -14126,4 +14136,6 @@ int QString::find( const QString& str, int index, bool cs ) const
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
@@ -14223,2 +14235,5 @@ 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();
@@ -14239,2 +14254,3 @@ int QString::findRev( QChar c, int index, bool cs ) const
14239 return uc - end; 14254 return uc - end;
14255#endif
14240} 14256}
@@ -14275,4 +14291,6 @@ int QString::findRev( const QString& str, int index, bool cs ) const
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
@@ -14981,15 +14999,20 @@ 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}
@@ -15009,15 +15032,20 @@ 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}
@@ -15139,4 +15167,4 @@ QString &QString::insert( uint index, const QString &s )
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*/
@@ -15253,2 +15281,12 @@ QString &QString::insert( uint index, QChar c ) // insert char
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/*!
@@ -15850,5 +15888,5 @@ long QString::toLong( bool *ok, int base ) const
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;
@@ -15885,3 +15923,3 @@ long QString::toLong( bool *ok, int base ) const
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;
@@ -15890,6 +15928,4 @@ long QString::toLong( bool *ok, int base ) const
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 )
@@ -15899,3 +15935,3 @@ bye:
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}
@@ -15917,3 +15953,3 @@ ulong QString::toULong( bool *ok, int base ) const
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;
@@ -15942,3 +15978,3 @@ ulong QString::toULong( bool *ok, int base ) const
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;
@@ -15969,3 +16005,3 @@ short QString::toShort( bool *ok, int base ) const
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;
@@ -15988,3 +16024,3 @@ ushort QString::toUShort( bool *ok, int base ) const
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;
@@ -16015,3 +16051,8 @@ 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}
@@ -16030,3 +16071,8 @@ 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}
@@ -16054,3 +16100,3 @@ double QString::toDouble( bool *ok ) const
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;
@@ -16100,7 +16146,7 @@ QString &QString::setNum( long n, int base )
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;
@@ -16463,2 +16509,11 @@ void QString::setExpand( uint index, QChar c )
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 )
@@ -16492,2 +16547,3 @@ QString& QString::operator+=( const QString &str )
16492*/ 16547*/
16548#ifndef QT_NO_CAST_ASCII
16493QString& QString::operator+=( const char *str ) 16549QString& QString::operator+=( const char *str )
@@ -16495,2 +16551,7 @@ QString& QString::operator+=( const char *str )
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();
@@ -16510,2 +16571,3 @@ QString& QString::operator+=( const char *str )
16510} 16571}
16572#endif
16511 16573
@@ -16531,2 +16593,6 @@ 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);
@@ -16543,2 +16609,9 @@ QString &QString::operator+=( char c )
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
@@ -16548,4 +16621,4 @@ QString &QString::operator+=( char c )
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*/
@@ -16554,3 +16627,3 @@ QString &QString::operator+=( char c )
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
@@ -16565,3 +16638,3 @@ QString &QString::operator+=( char c )
16565 16638
16566 \sa utf8(), local8Bit() 16639 \sa fromLatin1(), ascii(), utf8(), local8Bit()
16567*/ 16640*/
@@ -16569,6 +16642,5 @@ 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 }
@@ -16578,10 +16650,29 @@ const char* QString::latin1() const
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*/
16659const 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
@@ -16589,3 +16680,3 @@ const char* QString::latin1() const
16589 16680
16590 \sa QString::fromUtf8(), local8Bit(), latin1() 16681 \sa fromUtf8(), ascii(), latin1(), local8Bit()
16591*/ 16682*/
@@ -16635,3 +16726,4 @@ QString QString::fromUtf8( const char* utf8, int len )
16635 16726
16636 if ( len < 0 ) len = qstrlen( utf8 ); 16727 if ( len < 0 )
16728 len = strlen( utf8 );
16637 QString result; 16729 QString result;
@@ -16676,6 +16768,10 @@ QString QString::fromUtf8( const char* utf8, int len )
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
@@ -16684,8 +16780,34 @@ QString QString::fromUtf8( const char* utf8, int len )
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 */
16788QString 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*/
@@ -16697,3 +16819,3 @@ QString QString::fromLatin1( const char* chars, int len )
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 );
@@ -16711,4 +16833,4 @@ QString QString::fromLatin1( const char* chars, int len )
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
@@ -16717,6 +16839,5 @@ QString QString::fromLatin1( const char* chars, int len )
16717 16839
16718 \sa QString::fromLocal8Bit(), latin1(), utf8() 16840 \sa fromLocal8Bit(), ascii(), latin1(), utf8()
16719*/ 16841*/
16720 16842
16721
16722QCString QString::local8Bit() const 16843QCString QString::local8Bit() const
@@ -16742,3 +16863,3 @@ QCString QString::local8Bit() const
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
@@ -16773,3 +16894,4 @@ QString QString::fromLocal8Bit( const char* local8Bit, int len )
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
@@ -16806,2 +16928,8 @@ QString QString::fromLocal8Bit( const char* local8Bit, int len )
16806 16928
16929/*!
16930 \fn QString::operator std::string() const
16931
16932 Returns ascii().
16933*/
16934
16807 16935
@@ -16821,4 +16949,2 @@ const unsigned short *QString::ucs2() const
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 );
@@ -16985,4 +17111,2 @@ QString& QString::setUnicode( const QChar *unicode, uint len )
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 );
@@ -17020,2 +17144,24 @@ QString& QString::setUnicodeCodes( const ushort* unicode_as_ushorts, uint len )
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
17155QString &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
@@ -17035,3 +17181,3 @@ QString &QString::setLatin1( const char *str, int len )
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
@@ -17053,3 +17199,2 @@ void QString::checkSimpleText() const
17053 QChar *end = p + d->len; 17199 QChar *end = p + d->len;
17054 d->simpletext = 1;
17055 while( p < end ) { 17200 while( p < end ) {
@@ -17058,3 +17203,3 @@ void QString::checkSimpleText() const
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;
@@ -17063,2 +17208,3 @@ void QString::checkSimpleText() const
17063 } 17208 }
17209 d->issimpletext = TRUE;
17064} 17210}
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
@@ -1091,3 +1091,3 @@ QTextStream &QTextStream::writeBlock( const QChar* p, uint len )
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 );
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
@@ -298,4 +298,3 @@ 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;
@@ -307,4 +306,3 @@ 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}
@@ -315,4 +313,2 @@ bool QUType_int::convertFrom( QUObject *o, QUType *t )
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
@@ -329,5 +325,2 @@ bool QUType_int::convertTo( QUObject *o, QUType *t )
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
@@ -347,44 +340,2 @@ int QUType_int::serializeFrom( QUObject *, QUBuffer * )
347 340
348// {5938712A-C496-11D5-8CB2-00C0F03BC0F3}
349const QUuid TID_QUType_uint( 0x5938712a, 0xc496, 0x11d5, 0x8c, 0xb2, 0x00, 0xc0, 0xf0, 0x3b, 0xc0, 0xf3);
350QUType_uint static_QUType_uint;
351const QUuid *QUType_uint::uuid() const { return &TID_QUType_uint; }
352const char *QUType_uint::desc() const { return "uint"; }
353
354void QUType_uint::set( QUObject *o, uint v )
355{
356 o->payload.ui = v;
357 o->type = this;
358}
359
360bool QUType_uint::canConvertFrom( QUObject *o, QUType *t )
361{
362 return t->canConvertTo( o, this );
363}
364
365bool QUType_uint::canConvertTo( QUObject * /*o*/, QUType * /*t*/ )
366{
367 return FALSE;
368}
369
370bool QUType_uint::convertFrom( QUObject *o, QUType *t )
371{
372 return t->convertTo( o, this );
373}
374
375bool QUType_uint::convertTo( QUObject * /*o*/, QUType * /*t*/ )
376{
377 return FALSE;
378}
379
380int QUType_uint::serializeTo( QUObject *, QUBuffer * )
381{
382 return 0;
383}
384
385int QUType_uint::serializeFrom( QUObject *, QUBuffer * )
386{
387 return 0;
388}
389
390// {2D0974E5-0BA6-4ec2-8837-C198972CB48C} 341// {2D0974E5-0BA6-4ec2-8837-C198972CB48C}
@@ -403,4 +354,3 @@ 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;
@@ -412,4 +362,3 @@ 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}
@@ -420,5 +369,3 @@ bool QUType_double::convertFrom( QUObject *o, QUType *t )
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 );
@@ -452,66 +399,2 @@ int QUType_double::serializeFrom( QUObject *, QUBuffer * )
452 399
453
454// {544C5175-6993-4486-B04D-CEC4D21BF4B9 }
455const QUuid TID_QUType_float( 0x544c5175, 0x6993, 0x4486, 0xb0, 0x4d, 0xce, 0xc4, 0xd2, 0x1b, 0xf4, 0xb9 );
456QUType_float static_QUType_float;
457const QUuid *QUType_float::uuid() const { return &TID_QUType_float; }
458const char *QUType_float::desc() const {return "float"; }
459
460void QUType_float::set( QUObject *o, float v )
461{
462 o->payload.f = v;
463 o->type = this;
464}
465
466bool 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
475bool QUType_float::canConvertTo( QUObject * /*o*/, QUType *t )
476{
477 return isEqual( t, &static_QUType_int ) ||
478 isEqual( t, &static_QUType_double );
479}
480
481bool 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
494bool 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
507int QUType_float::serializeTo( QUObject *, QUBuffer * )
508{
509 return 0;
510}
511
512int QUType_float::serializeFrom( QUObject *, QUBuffer * )
513{
514 return 0;
515}
516
517// {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} 400// {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9}
@@ -595,3 +478,2 @@ bool QUType_QString::canConvertFrom( QUObject *o, QUType *t )
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 ) )
@@ -606,4 +488,3 @@ bool QUType_QString::canConvertTo( QUObject * /*o*/, QUType *t )
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}
@@ -617,4 +498,2 @@ bool QUType_QString::convertFrom( QUObject *o, QUType *t )
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 ) )
@@ -643,5 +522,2 @@ bool QUType_QString::convertTo( QUObject *o, QUType *t )
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 {
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
@@ -126,3 +126,3 @@ struct QWaitConditionPrivate {
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();
@@ -226,3 +226,5 @@ 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
@@ -234,3 +236,3 @@ bool QWaitCondition::wait(unsigned long time)
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 );
@@ -247,2 +249,5 @@ bool QWaitCondition::wait(unsigned long time)
247 249
250 pthread_mutex_unlock( &mutex );
251 pthread_mutex_destroy( &mutex );
252
248 return (ret == 0); 253 return (ret == 0);
@@ -293,3 +298,3 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
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 );