diff options
158 files changed, 67022 insertions, 0 deletions
@@ -0,0 +1,16 @@ + +PerlQt-3 is (c) Ashley Winters 2002, and (c) Germain Garand 2003 + +The project's homepage is at http://perlqt.sourceforge.net + +Puic was derived from Pyuic(Phil Thompson et alii) and Uic(Trolltech As) by +Germain Garand. + +The Smoke binding library was conceived by Ashley Winters. +It uses the Kalyptus Parser by Richard Dale, with a module implemented +by David Faure. + + +All code in this tree is released under the terms of the GNU Public License +v2. + @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..a10cb7f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,104 @@ + +2003-09-09 GG (v.3.008) + - improved garbage collection. No more leaks of Q*Items. + GC is now believed to be entirely sound. + - faster/cleaner build system (no more automake dependancy) + - speed optimizations (+50% gain) + - 9 new marshallers (Q*List are marshalled as a reference to a Perl array of Q*) + - tied marshallers for non-const QString/QByteArray + $ts = Qt::TextStream( $x, IO_WriteOnly ); + $ts << "foo"; # will write to $x + - alternative Sig/Slot declaration syntax + sub a_signal : SIGNAL(int,QString); + sub a_slot : SLOT(int,QString) { + #do something + } + - perleditor plugin for Qt Designer (released separately as pqt-designer package) + - Perl syntax highlighting + - thorough code completion (static and instance methods, &Qt::enums...) + - Perl aware Object Browser ("Class Declarations" tab) + - run your PerlQt project straight from the designer + - STDIN/STDOUT output and Perl messages are redirected to the Output Window view, + with corrected line numbers pointing to syntax errors. + - global scope Qt functions (bitBlt, qCompress...) are now available. + - gathered in the Qt::GlobalSpace namespace + - import them to current namespace with "use Qt::GlobalSpace" + - global scope operators are available as well (e.g Qt::Point + Qt::point) + - bug fixes and other improvements. + => see ChangeLog.CVS.delta and ChangeLog.CVS for details + +2002-02-13 GG (v.3.006) + - "use bytes" pragma now changes the way QStrings are marshalled + back to Perl : within the scope, instead of all utf-8, QStrings are + marshalled to ISO-Latin1 by default, or to locale if "use locale" is + active. + - Operator overloading is now functional. 21 operators are available. + e.g: + $d = Qt::TextStream( $f ); + $d << "Foo " << 12 << " Bar"; + N.B: the copy constructor operator('=') isn't overloaded. + It clashes with the perl paradigm. + - fixed a bug in QCString Marshaller : plain ASCII was tagged as UTF-8 + - raised priority of QString in case of ambiguous call + - allow runtime definition of signals and slots (via eval) + - added two development tools : pqtsh (a graphical PerlQt shell) and + pqtapi (a command line introspection tool) + - look also in super classes when dumping possible candidates (Qt::debug) + - updated french and english documentation + - module Qt::constants for on-demand loading of global Qt constants + (as of now, only concerns IO_* constants defined in qiodevice.h) + e.g: + use Qt::constants qw(:IO) + or + use Qt::constants qw( IO_ReadOnly IO_WriteOnly ) + from an idea by Marek Rouchal + +2002-12-16 GG (v.3.004-final) + - test suite ("make test" target) + - one more example (progress.pl) + - fixed a bug related to pointer mapping and Smoke's cf_virtual flag + (regeneration of Smoke isn't mandatory, but is recommended) + - fixed possible redefinition of a sub in isa.pm + - raised default test threshold to 10 + - some code optimizations (object construction/destruction) + - added an undocumented but supported CAST function + e.g CAST $obj, "Qt::Application"; (it proved to be useful in some + situations) +2002-12-11 GG. (v.3.004-RC2) + - turnaround for segfaults with some KDE themes (KThemeStyles) + =>will work witth kdelibs compiled with --disable-fast-malloc and --enable-fast-malloc, + but not with --enable-fast-malloc=full + - Qt::version() + - updated documentation (marshallers, debugging, i18n) + - switch to Makefile.PL for driving ./configure + +2002-12-07 GG. (v.3.004-RC1) + - better ISO C++ compliance and portability + -ansi -pedantic is now almost silent except for some Perl Macros + - speed improvements over 40% + ported memoïze-like cache to C++ ; various code optimizations + - Signal/Slots inheritance now works as expected + - proper handling of Qt modules stored in a hierarchy + - introduced SUPER->method() construct for accessing methods in the + superclass + - Internationalization + Perl strings are marshalled to QStrings either in utf8, iso-latin-1 or + current locale according to context (the rule is: if they are tagged as utf8, use + utf8 ; if not, use iso-latin by default or current locale if the "locale" + pragma is active) ; they are always marshalled back as utf8. + - You can now safely "eval" PerlQt code. + - New marshallers: + QCString /*/&, bool */&, QValueList<int> /*/& + - Debugging channels through "use Qt::debug" + You can now monitor specific parts of your application's behaviour. + Available channels are : ambiguous, calls, gc, autoload, virtual, + verbose, all. + - Updated documentation + french translation + many thanks to Stéphane Payrard for the accurate french translation ! + - Subclassing Qt::Application is now possible + - Smoke can be built with Qt-3.1 + - Various other bug fixes + +2002-08-24 Germain Garand <germain@ebooksfrance.com> (v.3.001) + + * initial release diff --git a/ChangeLog.CVS b/ChangeLog.CVS new file mode 100644 index 0000000..7589419 --- /dev/null +++ b/ChangeLog.CVS @@ -0,0 +1,2631 @@ +2003-09-13 00:39 germaingarand + + * PerlQt/handlers.cpp: + + - cache copy constructor && destructor lookups + - avoid looking twice in type hash for most common types + +2003-09-13 00:37 germaingarand + + * PerlQt/Qt.pm: + + - fix line numbers && current file on error (no method to call...) + +2003-09-12 15:43 germaingarand + + * PerlQt/handlers.cpp: + + - reworking the tied marshallers: let's allow readonly variables. + +2003-09-12 15:24 germaingarand + + * PerlQt/t/b_nogui.t: + + - adding test for tied marshaller/TextStream + +2003-09-12 13:13 germaingarand + + * PerlQt/Qt.xs: + + (see previous commit on handlers.cpp) + +2003-09-12 13:12 germaingarand + + * PerlQt/handlers.cpp: + + - fix garbage collection: we need to register external objects as well, so that + widgets using e.g: the $mainWindow->menuBar() pointer as parent don't get GCed. + - do not look in real stash if call is for a Qt::enum + (emulation of the previous Legacy autoload behaviour) + +2003-09-12 13:02 germaingarand + + * PerlQt/Qt.pm: + + - strict matching is too strict. We'll do that only for operators + +2003-09-10 18:16 germaingarand + + * PerlQt/Qt.pm: + + - We don't want to check the type of every argument, but let's check at least Qt Objects. + Wrong casts are deadly and hard to debug. + - got rid of the legacy autoload. Fully qualified calls are much faster now. + +2003-09-10 13:17 germaingarand + + * puic/uic.cpp: + + - 3.1 Actions were housed + +2003-09-09 10:45 germaingarand + + * ChangeLog.CVS, ChangeLog.CVS.delta, Makefile.am, cvs2cl.pl: + + - updated ChangeLogs + +2003-09-09 09:21 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + fix compile for 5.6.1 + +2003-09-09 07:32 germaingarand + + * perleditor/: perlcompletion.cpp, perlcompletion.h: + + - perlcompletion isn't at top speed until a first call has been made. + Put a singleShot timer to warm it up before the user come + +2003-09-09 06:25 germaingarand + + * PerlQt/Makefile.PL.in: + + - add qt_libraries to RPATH too, otherwise Qt.so can pull a qt-mt library different from the one Smoke + would have picked up. + +2003-09-08 18:13 germaingarand + + * PerlQt/t/ca_i18n.t: + + - one more test, monitoring "use bytes" pragma + +2003-09-08 16:24 germaingarand + + * PerlQt/: MANIFEST, Makefile.PL.in, Qt.pod: + + - cleaning Makefile.PL.in + - install documentation in {datadir}/PerlQt-3 + - install a short Qt.pod notice pointing to the real doc, for those + who are going to try "perldoc Qt" :-} + +2003-09-08 15:38 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html: + + - updated documentation (/en and /fr) to reflect 3.008 changes + +2003-09-08 02:23 germaingarand + + * perleditor/README.perleditor.quickstart: + + - a bit of documentation never hurts... + +2003-09-08 01:47 germaingarand + + * perleditor/: objectbrowser.cpp, perlaction.cpp: + + - fixing proper detection of PerlEditor modified state when Running Project + +2003-09-07 15:32 germaingarand + + * perleditor/: listeditor.h, mainfilesettings.h, preferences.h, + projectsettings.h, slotfuncdia.h: + + removing auto-generated headers + +2003-09-07 15:26 germaingarand + + * PerlQt/lib/Qt/debug.pm: + + - warn and display list of available debugging channels when asked for an unknown one + +2003-09-07 15:18 germaingarand + + * configure.in, PerlQt/Qt.pm: + + - bumping version to 3.008 + +2003-09-07 14:35 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + - major bug fix: "use bytes" and "use locale" pragmata didn't apply to current scope. + They are held in the op_private of the context stack after compiling, no more in PL_hints. + Thanks to Ashley for pointing where to find them :) + Additionaly, there was a loss of context in AUTOLOAD due to the many hops. + So we need to fetch the old context in there. + +2003-09-06 21:05 germaingarand + + * puic/: Makefile.am, puic.1: + + adding Lutz Badenheuer <Lutz.Badenheuer@t-online.de>'s man page + +2003-09-06 19:03 germaingarand + + * perleditor/yyindent.cpp: + + - fix comment detection. + +2003-09-06 16:51 germaingarand + + * PerlQt/Qt.pm: + + - be more strict when matching ambiguous methods + - fixed a bug regarding the priority of some types + +2003-09-05 03:30 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp: + + - implemented QByteArray Marshaller (from/to Perl string, tied if needed) + Still needs some thought /wrt to Utf8 handling (think qCompress/qUncompress) + + With QDataStream static operators and this, we get a nice object serializer :) + + use Qt::constants; + $bytearray = ""; + $a = Qt::DataStream( $bytearray, IO_WriteOnly ); + # now magically serialize some objects in $bytearray + $a << $qdatetime << $qfont << $qpixmap; + +2003-09-01 21:09 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + - real non-const QString&/* marshaller implemented via tied scalars + e.g: + use Qt; + use Qt::constants; + + $str = "Foooooooooooooooo"; + + $ts = Qt::TextStream( $str, IO_WriteOnly ); + $ts << "pi = " << 3.14; + + # $str is now "pi = 3.14oooooooo" + + The link is maintained until the scalar is destroyed, or until it is untied. + +2003-08-31 16:35 germaingarand + + * PerlQt/lib/Qt/GlobalSpace.pm, PerlQt/Qt.pm, PerlQt/t/b_nogui.t, + kalyptus/ChangeLog, kalyptus/Iter.pm, kalyptus/README, + kalyptus/kalyptus, kalyptus/kalyptusCxxToSmoke.pm, + kalyptus/kdocAstUtil.pm: + + updating kalyptus/smoke (GlobSpace operator names no longer munged) + +2003-08-31 14:38 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/slots.pm: + + - more permissive syntax for new sig/slot declarations (white spaces, quotes) + - implement consistency check of old vs. new style slot declarations + allows one to say + use Qt::slots "foo" => ["int"]; + then + sub foo : SLOT( int ) {} # OK. Same decl. Noop. + sub foo : SLOT( QString ) {} # triggers a warning: + # Slot declaration: + # foo(QString) + # will override previous declaration: + # foo(int) + +2003-08-30 23:01 germaingarand + + * PerlQt/Qt.pm: + + Doing it the Right Way. + - make $SIG{__DIE__} local inside eval'ed ops + - added missing operators (unary minus, binary mul) + - GlobalSpace operators with assignment were returning wrong values + +2003-08-28 02:10 germaingarand + + * smoke/qt/generate.pl.in, smoke/qt/qt_smoke.h, kalyptus/kalyptus, + kalyptus/kalyptusCxxToSmoke.pm, kalyptus/kalyptusDataDict.pm, + kalyptus/kdocAstUtil.pm: + + - GlobalSpace support + updates + +2003-08-28 02:02 germaingarand + + * smoke/qt/header_list: + + -removing conflicting/useless headers + +2003-08-28 01:28 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/GlobalSpace.pm, lib/Qt/constants.pm: + + - adding support for the new Qt::GlobalSpace pseudo-class holding all global Qt functions. + Requires a recompilation of Smoke. + use Qt::GlobalSpace; # exports all symbols to the caller's namespace (not recommended) + use Qt::GlobalSpace qw( bitBlt qCompress qSysInfo ); # export listed symbols only + - when an operator call fails, forward the call to Qt::GlobalSpace which has a lot of static operators: + $aPoint = Qt::Point( 20, 20 ); + $aPoint += Qt::Point( 10, 10); # this one calls Qt::Point->operator+() + $o = Qt::Point(10,10) + Qt::Point(30,30); # this is forwarded to Qt::GlobalSpace::+( QPoint, QPoint ) + - made "use Qt::constant" export all symbols by default (IO_ReadOnly, ...). + +2003-08-20 10:12 germaingarand + + * PerlQt/handlers.cpp: + + - construct_copy for const ref: update the macros, and oh, don't forget to + mark the resulting object as allocated. Caveat leakem. + +2003-08-20 09:25 germaingarand + + * PerlQt/handlers.cpp: + + - fixed a severe bug in construct_copy + - when marshalling const QFoo&, construct a copy... + this ought to fix a lot of subtle bugs (mostly QShared related). + +2003-08-14 20:52 germaingarand + + * puic/: form.cpp, uic.cpp, uic.h: + + - various fixes for when compiling with Qt < 3.1 + +2003-08-14 18:44 germaingarand + + * PerlQt/Makefile.PL.in, admin/acinclude.m4.in, + smoke/qt/qtguess.pl.in: + + - nice patch by Marek Rouchal<marek.rouchal@infineon.com>. Improves Solaris + compatibility and static builds. Many thanks to him! + - fix the sometimes incorrect rpath for Smoke (kde_libraries=>libdir) + +2003-08-14 18:35 germaingarand + + * puic/: form.cpp, main.cpp, object.cpp, uic.cpp, uic.h, + widgetdatabase.cpp: + + - end of uic 3.2 merging at last. Pheeeew. + +2003-08-14 18:22 germaingarand + + * perleditor/perlaction.cpp: + + - prevent random crash when destroying qprocesses too early + +2003-07-18 03:14 germaingarand + + * puic/object.cpp: + + - compile fix by David Hugh-Jones <hughjonesd@yahoo.co.uk> + +2003-06-14 04:52 germaingarand + + * smoke/qt/Makefile.am, smoke/qt/header_list, + kalyptus/kalyptusCxxToSmoke.pm: + + - fix Smoke generation for Qt-3.2b1 + +2003-06-14 04:47 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp, perlqt.h: + + - speed optimizations again. cachegrind rocks + +2003-06-09 17:17 germaingarand + + * PerlQt/lib/Qt/attributes.pm: + + - do not redefine attributes if they have already been defined in base class. + +2003-06-09 17:15 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - Some polishing on Q*Items garbage collection. setAllocated() is now correct. + - Speed, speed, speed. Moved object destruction routine to XS. Object creation/deletion + is now 50% faster than in 5.006 + +2003-06-08 02:01 germaingarand + + * puic/: domtool.cpp, domtool.h, form.cpp, main.cpp, object.cpp, + subclassing.cpp, uic.cpp, uic.h, widgetdatabase.cpp: + + - big merges from uic. Regressions expected. Needs testing + +2003-06-06 21:30 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - sig/slot defined via sub attributes are now created upon metaObject() request if needed. + Much better this way, since it allows runtime evaluation: + eval "sub foo : SLOT() {}" + +2003-06-06 02:51 germaingarand + + * PerlQt/Qt.pm: + + for now: slot/signal/dcop => SLOT/SIGNAL/DCOP + +2003-06-06 01:53 germaingarand + + * PerlQt/Qt.pm: + + - moved the sig/slot attributes handling from Qt::base to the Qt::Object package, + where it obviously belongs + - silenced a 5.6.0 warning /wrt Qt::debug + +2003-06-05 22:07 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/signals.pm, lib/Qt/slots.pm: + + - implemented Ashley's great syntax proposal for sig/slots definition via sub attributes + sub mySlot : slot( int, const QString& ) { ... } + sub mySig : signal( bool ); + Of course, the old/alternative syntax is still valid. + +2003-06-05 15:22 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - fixed the garbage collection for Q*Items. + Use list->takeItem( foo ) when available to safely remove an Item from a list (then undef it to delete). + - as a consequence, could remove the dreadful obj->isa("Q*Item") test. Gives a nice 30% speed up in + Object creation. + +2003-05-30 03:22 germaingarand + + * puic/puic.pro: + + - added a qmake project file, for easy building of puic when checked out separately + ( export QTDIR, then: + $QTDIR/bin/qmake -makefile puic.pro && make && make install ) + +2003-05-30 01:36 germaingarand + + * perleditor/: listeditor.ui.h, objectbrowser.cpp, objectbrowser.h, + perlaction.cpp, perlaction.h, perlcompletion.cpp, perleditor.cpp: + + - fixed a bug in function arguments completion + - turnaround for a Designer bug (it wouldn't mark current form as modified in some circumstances) + - small bugfixes and code cleanup + +2003-05-28 22:17 germaingarand + + * perleditor/: preferenceinterfaceimpl.cpp, syntaxhighliter_perl.h: + + - gcc-2.9x fixes + +2003-05-28 18:30 germaingarand + + * perleditor/: mainfilesettings.ui.h, perlaction.cpp, + projectsettings.ui.h, projectsettingsinterfaceimpl.cpp, + yyindent.cpp: + + - rewrote the project settings saving code (had overlooked the nice customSetting interface) + +2003-05-28 04:58 germaingarand + + * perleditor/: README, actioninterfaceimpl.cpp, + actioninterfaceimpl.h, common.cpp, common.h, + editorinterfaceimpl.cpp, editorinterfaceimpl.h, + languageinterfaceimpl.cpp, listeditor.h, mainfilesettings.h, + mainfilesettings.ui, mainfilesettings.ui.h, objectbrowser.cpp, + objectbrowser.h, perlaction.cpp, perlaction.h, perlcompletion.cpp, + perlcompletion.h, perleditor.cpp, perleditor.h, perleditor.pro, + perlmainprojectfile.cpp, perlmainprojectfile.h, pqtapiprocess.cpp, + pqtapiprocess.h, preferences.h, projectsettings.h, + projectsettings.ui, projectsettings.ui.h, + projectsettingsinterfaceimpl.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp: + + - implemented "Build and run project". One can now fully develop/test/run a PerlQt program without ever using + a console. This is VB on steroids :) + - added an application template + - project settings looks OK. Would need some testing usability wise though + - lot of bugfixes + +2003-05-26 21:28 germaingarand + + * puic/main.cpp: + + - bumping version to 0.6main.cpp + +2003-05-26 21:25 germaingarand + + * puic/form.cpp: + + - adding "# line" directive to ui.pm + +2003-05-26 19:41 germaingarand + + * perleditor/: actioninterfaceimpl.cpp, actioninterfaceimpl.h, + common.cpp, common.h, imagefactory.h, languageinterfaceimpl.cpp, + listeditor.h, mainfilesettings.h, perlaction.cpp, perlaction.h, + perleditor.cpp, perleditor.h, perleditor.pro, preferences.h, + projectsettings.h, slotfuncdia.h, images/perlqt.png, + images/perlqtblue.png, images/perlqtblue2.png: + + - added PerlQt Menu/toolbar ("Run form/run project" triggers puic->perl) + - "run project" not yet implemented + - "Run Form" can be accessed also with RMB on source code + - When Form is run through Perl, STDOUT/STDERR are captured and redirected to the Designer's + Output Window + - Perl syntax errors and warnings show up with correct line number/ FormFile name, thanks to + '# line \d+ "foo"' magic :-) + - some icons + +2003-05-26 00:57 germaingarand + + * perleditor/: languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, perleditor.cpp, perleditor.h, + pqtapiprocess.cpp, designer_3.1_patches/resource.cpp.diff: + + - added "Build and Run this form with perl" RMB option + - code cleanup + +2003-05-25 15:31 germaingarand + + * perleditor/: README, imagefactory.h, languageinterfaceimpl.cpp, + objectbrowser.cpp, perlcompletion.cpp, images/editcut.png: + + README + +2003-05-25 15:30 germaingarand + + * perleditor/designer_3.1_patches/: designerappiface.cpp.diff, + mainwindowactions.cpp.diff, resource.cpp.diff: + + - needed Designer 3.1 patches + (hopefully not for long, as discussion with Marius B. Monsen from Trolltech could lead to having + those issues fixed in 3.2) + +2003-05-25 15:27 germaingarand + + * perleditor/images/filenew.png: + + images/editcut.png + +2003-05-23 23:35 germaingarand + + * perleditor/: completion.cpp, listeditor.h, perlcompletion.cpp, + perlcompletion.h, pqtapiprocess.cpp, projectsettings.h, + slotfuncdia.h, slotfuncdia.ui, slotfuncdia.ui.h: + + - invalidate "function" radio if user input obviously describes a slot. + - better auto-completion: methods, statics and enums are all in. Yay! + (might need some optims, I'm on a 2400+ box now ;-P) + +2003-05-23 16:23 germaingarand + + * PerlQt/bin/pqtapi: + + - added option 'p' for including inherited methods of 'class' in results + - option 'm' is for communication with the Designer Plugin (for code completion) + +2003-05-23 09:39 germaingarand + + * perleditor/: listeditor.cpp, mainfilesettings.cpp, + preferences.cpp, projectsettings.cpp, slotfuncdia.cpp: + + those are auto-generated + +2003-05-22 21:34 germaingarand + + * perleditor/: completion.cpp, editor.h, parenmatcher.cpp, + parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h, + globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h, + projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp, + completion.h, languageinterfaceimpl.h, listeditor.h, + mainfilesettings.cpp, pqtapiprocess.h, preferences.ui, + syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h, + conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui, + listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h, + paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h, + perleditor.h, perlindent.cpp, perlqt.cpp, + preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h, + syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp, + yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h, + editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp, + imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp, + preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h, + browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h, + listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp, + perleditor.pro, pqtapiprocess.cpp, + projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h, + variabledialog.ui, images/editslots.png, images/folder.png, + interfaces/actioninterface.h, interfaces/classbrowserinterface.h, + interfaces/designerinterface.h, interfaces/editorinterface.h, + interfaces/filterinterface.h, interfaces/interpreterinterface.h, + interfaces/languageinterface.h, interfaces/preferenceinterface.h, + interfaces/programinterface.h, interfaces/projectsettingsiface.h, + interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h, + interfaces/widgetinterface.h: + + Initial import of the PerlQt plugin for Qt Designer + +2003-05-22 21:34 germaingarand + + * perleditor/: completion.cpp, editor.h, parenmatcher.cpp, + parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h, + globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h, + projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp, + completion.h, languageinterfaceimpl.h, listeditor.h, + mainfilesettings.cpp, pqtapiprocess.h, preferences.ui, + syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h, + conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui, + listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h, + paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h, + perleditor.h, perlindent.cpp, perlqt.cpp, + preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h, + syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp, + yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h, + editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp, + imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp, + preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h, + browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h, + listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp, + perleditor.pro, pqtapiprocess.cpp, + projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h, + variabledialog.ui, images/editslots.png, images/folder.png, + interfaces/actioninterface.h, interfaces/classbrowserinterface.h, + interfaces/designerinterface.h, interfaces/editorinterface.h, + interfaces/filterinterface.h, interfaces/interpreterinterface.h, + interfaces/languageinterface.h, interfaces/preferenceinterface.h, + interfaces/programinterface.h, interfaces/projectsettingsiface.h, + interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h, + interfaces/widgetinterface.h: + + Initial revision + +2003-05-22 04:58 germaingarand + + * puic/: form.cpp, subclassing.cpp: + + - support for the Designer's PerlQt plugin + - patch by Terrence (Terry) Fleury <tfleury@ncsa.uiuc.edu> + for incluson of "Use" directives (also supported by the plugin, and stored + in the same structure) + - DESTROY really ought to call SUPER->DESTROY + +2003-05-11 01:41 germaingarand + + * puic/: widgetdatabase.cpp, widgetdatabase.h: + + -updated the widget database (fix for #731881) + +2003-04-15 23:03 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html: + + -documenting new marshallers + +2003-04-15 22:43 germaingarand + + * configure.in, PerlQt/Qt.pm: + + bumping version number to 3.007 + +2003-04-15 16:07 germaingarand + + * PerlQt/: handlers.cpp, Qt.pm, smokeperl.h: + + - added 8 marshallers for Q*List classes: + QWidgetList, QCanvasItemList, QObjectList, QPtrList<QTab>, QPtrList<QToolBar>, + QPtrList<QDockWindow>, QPtrList<QNetworkOperation>, QFileInfoList + +2003-04-15 16:04 germaingarand + + * smoke/qt/Makefile.am: + + bumping revision number + +2003-04-15 16:02 germaingarand + + * kalyptus/kalyptusCxxToSmoke.pm: + + disabling 3 template derived classes, now handled by marshallers + +2003-04-06 16:40 germaingarand + + * admin/: Doxyfile.am, Doxyfile.global, acinclude.m4.in, am_edit, + cvs.sh, debianrules, detect-autoconf.sh, Makefile.common, + libtool.m4.in, nmcheck: + + updating admin dir + +2003-03-08 19:03 germaingarand + + * PerlQt/bin/pqtsh: + + disable strict in eval + +2003-03-03 14:37 germaingarand + + * puic/: main.cpp, object.cpp: + + skip 'database' property (doesn't exist anymore), thanks to Michael Traxler for pointing that one + +2003-02-22 13:43 germaingarand + + * puic/object.cpp: + + temporary font objects where incorrect + +2003-02-22 13:05 germaingarand + + * puic/uic.cpp: + + + else if ( attrib == "resizeable" || attrib == "resizable" ) + +2003-02-19 17:14 germaingarand + + * Makefile.PL: + + getting rid of Automake dependancy + +2003-02-19 17:01 germaingarand + + * PerlQt/bin/pqtsh: + + - redirect STDOUT/STDERR to shell window (patch by Stéphane Payrard<stef@payrard.net>) + - fixed troubles with line breaks and Qt-3.1 + - discard empty lines on save + +2003-02-19 13:44 germaingarand + + * smoke/qt/Makefile.am, smoke/qt/generate.pl.in, + smoke/qt/qtguess.pl.in, kalyptus/kalyptus, + kalyptus/kalyptusCxxToSmoke.pm: + + getting rid of GNU toolchain dependancy at last :) + +2003-02-13 15:30 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html: + + How to perform an installation with user rights + various details + +2003-02-13 12:23 germaingarand + + * configure.in, PerlQt/Qt.pm: + + finally, lets bump the version number to 3.006 + +2003-02-13 12:21 germaingarand + + * PerlQt/Qt.pm: + + operators modifying their operand (++, +=, ...) need to return the modified object itself, not the Qt ref to the modified object + +2003-02-12 23:47 germaingarand + + * TODO: + + update + +2003-02-12 23:34 germaingarand + + * PerlQt/t/h_allstyles.t: + + too many errors on this one + +2003-02-12 22:11 germaingarand + + * PerlQt/examples/: progress/progress.pl, richedit/richedit.pl: + + no blib + +2003-02-12 22:04 germaingarand + + * PerlQt/examples/forever/forever.pl: + + no blib + +2003-02-12 21:21 germaingarand + + * PerlQt/examples/drawlines/drawlines.pl: + + no blib + +2003-02-12 21:17 germaingarand + + * PerlQt/examples/: aclock/aclock.pl, dclock/dclock.pl, + buttongroups/buttongroups.pl, drawdemo/drawdemo.pl: + + no blib + +2003-02-12 21:16 germaingarand + + * PerlQt/Makefile.PL.in: + + better chmod +x the scripts before install + +2003-02-12 17:07 germaingarand + + * doc/: fr/PerlQt.pod, fr/index.html, en/PerlQt.pod, en/index.html: + + updated documentation + +2003-02-12 16:44 germaingarand + + * ChangeLog: + + update + +2003-02-12 15:25 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, images/pqtsh.png: + + updated english documentation + +2003-02-12 13:18 germaingarand + + * PerlQt/bin/pqtsh: + + adding an interactive example (within help menu) + +2003-02-12 10:54 germaingarand + + * PerlQt/lib/Qt/isa.pm: + + cope with 5.8.0's buggy if.pm - patch by S.Payrard<stef@payrard.net> + +2003-02-12 10:44 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/signals.pm, lib/Qt/slots.pm: + + -Allow runtime definition of Signals/Slots (via eval) + +2003-02-11 23:18 germaingarand + + * PerlQt/Qt.pm: + + -when dumping possible method matches, look also in super classes + +2003-02-11 23:15 germaingarand + + * PerlQt/: MANIFEST, Makefile.PL.in, bin/pqtsh, bin/pqtapi: + + - adding pqtsh and pqtapi utilities + +2003-02-09 15:15 germaingarand + + * PerlQt/lib/Qt/constants.pm: + + export sub names, not globs + +2003-02-07 22:25 germaingarand + + * PerlQt/Qt.xs: + + oops + +2003-02-07 22:24 germaingarand + + * PerlQt/Qt.xs: + + - IRIX compiler fix (don't 'return' in a void method) + +2003-02-06 23:07 germaingarand + + * PerlQt/: lib/Qt/constants.pm, MANIFEST: + + - adding a Qt::constants module for import of Qt constants + (mainly intended for qiodevice.h's IO_* hardcoded values, but who knows...) + +2003-02-06 18:36 germaingarand + + * admin/acinclude.m4.in: + + propagate $LIBXINERAMA + +2003-02-05 11:19 germaingarand + + * configure.in: + + too many QT_NO_* tests - totally overkill + +2003-02-05 11:14 germaingarand + + * ChangeLog: + + ... + +2003-02-05 10:03 germaingarand + + * PerlQt/t/g_gui.t: + + avoid loading syle plugins for first GUI test + +2003-02-05 00:19 germaingarand + + * smoke/qt/generate.pl.in, kalyptus/kalyptus: + + do not write kalyptus cache in $HOME... it breaks chrooted builds + +2003-02-04 16:52 germaingarand + + * configure.in, PerlQt/Qt.pm: + + bump version + +2003-01-30 10:41 germaingarand + + * Makefile.am, PerlQt/t/h_allstyles.t: + + set correct LD_LIBRARY_PATH before running tests + +2003-01-27 11:11 germaingarand + + * PerlQt/Makefile.PL.in: + + add CXXFLAGS to compilation parameters + +2003-01-27 11:09 germaingarand + + * PerlQt/Makefile.PL.in: + + use RPATH in a more crossplatform way (through libtool) + +2003-01-27 09:33 germaingarand + + * admin/conf.change.pl: + + support post-processing commands in AC_CONFIG* macros + +2003-01-14 16:00 germaingarand + + * smoke/qt/Makefile.am: + + added KDE_RPATH to libsmokeqt (about time) + +2003-01-05 04:00 germaingarand + + * PerlQt/: lib/Qt/isa.pm, Qt.pm: + + - implementation of operator overloading (21 supported operators). Copy constructors *aren't* + available : they clash with Perl semantics. + - raised priority of QString in ambiguous methods resolution + +2003-01-04 06:22 germaingarand + + * PerlQt/handlers.cpp: + + - fixed QCString marshaller : don't tag pure ASCII strings as UTF-8 + - QString marshalling toSV is now driven by HINT_BYTES (a.k.a "use bytes" pragma) + This is intended as a compatiblity device for legacy code that can't handle UTF-8 + +2002-12-22 02:52 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - fixing Perl debugger at last + +2002-12-17 10:45 germaingarand + + * puic/: main.cpp, uic.cpp: + + - fixed a bug with embedded pixmaps + +2002-12-16 20:45 germaingarand + + * PerlQt/: t/f_import.t, t/h_allstyles.t, MANIFEST: + + - fixing invocation of make test from within Perlqt/ + +2002-12-16 18:13 germaingarand + + * configure.in, PerlQt/Qt.pm: + + version = 'PerlQt-3.004' (final) + +2002-12-16 17:43 germaingarand + + * kalyptus/kalyptusCxxToSmoke.pm: + + - fixed a problem with multiple inheritance when looking for cf_virtual + +2002-12-16 17:38 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp, perlqt.h, smokeperl.h: + + - code cleanup and optimization + - fixed a bug with hasVirtual() + +2002-12-16 17:32 germaingarand + + * PerlQt/examples/forever/forever.pl: + + avoid QPoint + +2002-12-16 17:26 germaingarand + + * PerlQt/examples/progress/progress.pl: + + initial checkin + +2002-12-16 17:24 germaingarand + + * PerlQt/lib/Qt/: isa.pm, debug.pm: + + - fixed redefinition of a sub in isa.pm + - added "use Qt;" in debug.pm + +2002-12-16 17:04 germaingarand + + * PerlQt/t/Foo/SubCodec.pm: + + - adding the test suite (make test) + +2002-12-16 17:01 germaingarand + + * test.pl, Makefile.am, PerlQt/test.pl, PerlQt/t/a_loading.t, + PerlQt/t/b_nogui.t, PerlQt/t/c_qapp.t, PerlQt/t/d_sigslot.t, + PerlQt/t/e_sigslot_inherit.t, PerlQt/t/f_import.t, + PerlQt/t/g_gui.t, PerlQt/t/h_allstyles.t, PerlQt/t/My/Codec.pm, + PerlQt/t/My/SubCodec.pm: + + - adding the test suite (make test) + +2002-12-16 16:57 germaingarand + + * configure.in, doc/en/PerlQt.pod, doc/en/index.html, + smoke/qt/qtguess.pl.in: + + typo: treshold <-> threshold (configure option) + +2002-12-16 16:45 germaingarand + + * configure.in: + + changed default test threshold to be 5 + +2002-12-13 20:53 germaingarand + + * PerlQt/: handlers.cpp, Qt.xs: + + -fixed compilation with 5.6.0 + -fix HAS_BOOL for SUN's Forte + +2002-12-13 11:42 germaingarand + + * PerlQt/Qt.pm: + + added a CAST function + +2002-12-13 11:41 germaingarand + + * PerlQt/handlers.cpp: + + - made the marshaller croak instead of marshalling null as a reference to a Qt object + - 5.6.0 doesn't have is_utf8_string, made it use QTextCodec::heuristicContentMatch() instead + +2002-12-12 01:50 germaingarand + + * puic/: form.cpp, main.cpp: + + - added parsing of custom member variables + - fixed issue with init()/destroy() + +2002-12-11 15:53 germaingarand + + * configure.in, PerlQt/Qt.pm: + + updating $VERSION (3.004-RC2) + +2002-12-11 15:43 germaingarand + + * ChangeLog: + + updated for 3.004-RC2 + +2002-12-11 15:31 germaingarand + + * doc/en/: PerlQt.pod, index.html: + + added several appendices to documentation (debugging, marshallers and i18n) + +2002-12-11 09:54 germaingarand + + * INSTALL, README, PerlQt/MANIFEST, PerlQt/Qt.pm: + + - updated README/INSTALL + - turnaround for KDE's malloc in Qt.pm + - added Qt/debug.pm in MANIFEST + +2002-12-09 18:09 germaingarand + + * Makefile.am, smoke/qt/qtguess.pl.in: + + - add Makefile.cvs to make dist + - correct qtguess.pl : retry grabbing symbols without __cplusplus if it fails (e.g. for Sun Forte) + +2002-12-09 17:32 germaingarand + + * Makefile.PL: + + Makefile.PL is likely to become the default building command, since conflicts of automake versions + are impossible to sort out within the framework. + +2002-12-09 05:37 germaingarand + + * PerlQt/Qt.xs: + + added Qt::version() + +2002-12-09 05:06 germaingarand + + * Makefile.PL: + + wrapper for ./configure intended to be used by CPAN + +2002-12-07 15:55 germaingarand + + * configure.in, PerlQt/Qt.pm: + + - Adjust version no. for RC1 + - correct USE_QT_KDE so that configure doesn't reject Qt-3.0 + +2002-12-07 13:17 germaingarand + + * PerlQt/Qt.pm: + + - allow subclassing of Qt::Application + +2002-12-06 23:36 germaingarand + + * puic/: embed.cpp, main.cpp: + + - Issue the "use utf8" pragma. That's all we need to fully support i18n in puic :) + +2002-12-06 21:37 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp: + + - code cleanup && added some comments in Qt.xs + - fixed segfault when marshalling "undef" as QString& (handlers.cpp) + - added bool*/bool& marshallers + - more consistent debugging statements wrt the considered channel + - more profiling/optimization of caching + +2002-12-05 14:20 germaingarand + + * admin/: Doxyfile.am, Doxyfile.global, compile, + configure.in.bot.end, cvs-clean.pl, cvs.sh, detect-autoconf.sh: + + damn, I forgot to cvs add a lot of file in the new admin dir ;( + +2002-12-05 14:10 germaingarand + + * PerlQt/: Qt.xs, Qt.pm: + + - switched all method calls to G_EVAL : needed for having a correct 'this' pointer if an error occur inside an eval{} + - implemented the memoize-like cache in C++ with a QAsciiDict (gain 50% in speed) + +2002-12-03 21:45 germaingarand + + * configure.in: + + minor error + +2002-12-03 21:36 germaingarand + + * configure.in: + + updating reimplementation of an AC macro + +2002-12-03 17:16 germaingarand + + * admin/: ChangeLog, Makefile.common, acinclude.m4.in, am_edit, + config.guess, config.pl, config.sub, debianrules, depcomp, + install-sh, libtool.m4.in, ltconfig, ltmain.sh, missing, + mkinstalldirs, old-libtool.m4.in, old-ltcf-c.sh, old-ltcf-cxx.sh, + old-ltcf-gcj.sh, old-ltconfig, old-ltmain.sh: + + updating /admin directory to KDE 3.1's + +2002-12-03 16:53 germaingarand + + * PerlQt/Qt.xs: + + removing a stupid debug line that went in + +2002-12-03 15:20 germaingarand + + * smoke/qt/qtguess.pl.in: + + fixed a quotation error + -$qtflags =~ s/\$\((.*?)\)/$x{'$1'}/g; + +$qtflags =~ s/\$\((.*?)\)/$x{$1}/g; + +2002-12-02 21:28 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp, perlqt.h, lib/Qt/debug.pm: + + - added pragma for enabling multiple debugging channels. See lib/Qt/debug.pm + - findAllMethods(classId [, startingWith]) for a more useful debug output and easy impl. of code completion. + eg. to pretty print the whole Qt API: + + for (1..400) + { + $a=Qt::_internal::findAllMethods($_); + @x=map {@{ $$a{$_} }} sort keys %$a; + print Qt::_internal::dumpCandidates(\@x); + } + - various optimizations and cleanups for an overall gain in speed of 15% approx. + +2002-11-28 14:26 germaingarand + + * Makefile.am: + + adjusting EXTRA_DIST for /doc + +2002-11-28 13:08 germaingarand + + * PerlQt/smokeperl.h: + + operator= should return *this + +2002-11-28 12:33 germaingarand + + * doc/: Makefile, PerlQt.pod, index.html, pod.css: + + removing doc/* (moved to /doc/en) + +2002-11-28 12:31 germaingarand + + * doc/: css/pod.css, en/Makefile, en/PerlQt.pod, en/index.html, + fr/Makefile, fr/PerlQt.pod, fr/index.html: + + adding french documentation, thanks to Stéphane Payard + +2002-11-27 19:53 germaingarand + + * PerlQt/handlers.cpp: + + - Internationalization support (QString now marshalls toSV as UTF8) + - ISO C++ fixes (replaced variable-size arrays by new[]) + +2002-11-27 19:51 germaingarand + + * PerlQt/Qt.xs: + + Changed variable-size arrays to use "new" (ISO C++ conformance... should fix the build on Compaq's CC) + +2002-11-18 02:20 germaingarand + + * smoke/qt/generate.pl.in: + + Exclude some more Qt headers (3.1) + +2002-11-18 02:17 germaingarand + + * kalyptus/: kalyptus, kalyptusCxxToSmoke.pm, kalyptusDataDict.pm: + + Syncing Qt-3.1 fixes from KDE's CVS + +2002-10-14 10:15 germaingarand + + * PerlQt/: handlers.cpp, Qt.pm: + + added a marshaller for QValueList<int> + +2002-10-12 17:42 germaingarand + + * kalyptus/kalyptusCxxToSmoke.pm: + + Skip QTSManip class: resulting file cause internal compiler errors on many platforms + +2002-10-09 18:20 germaingarand + + * PerlQt/Qt.pm: + + updating $VERSION + +2002-10-08 01:40 germaingarand + + * puic/: main.cpp, form.cpp, object.cpp: + + - s/this->SUPER::polish/SUPER->polish/ in database code + - fixed setAccel to use an intermediate Qt::KeySequence + +2002-10-08 00:27 germaingarand + + * PerlQt/Qt.pm: + + Added a turnaround for a Qt bug. + QGridLayout::addMultiCellLayout does not reparent its QLayout argument, leading to parentless Layouts. + +2002-09-27 20:04 germaingarand + + * puic/: uic.cpp, main.cpp: + + Fixing multiple lines concatenation within tr calls. + +2002-09-27 11:40 germaingarand + + * PerlQt/MANIFEST: + + added network example + +2002-09-27 11:35 germaingarand + + * PerlQt/examples/network/httpd/httpd.pl: + + initial import of the httpd example + +2002-09-27 00:41 germaingarand + + * doc/: PerlQt.pod, index.html: + + typo + +2002-09-26 21:08 germaingarand + + * PerlQt/: Qt.xs, lib/Qt/isa.pm: + + SUPER was only forwarding to base Perl classes, not base Qt classes + Fixed + +2002-09-25 11:04 germaingarand + + * PerlQt/Qt.pm: + + Fixing signals inheritance + +2002-09-22 16:30 germaingarand + + * PerlQt/Qt.xs, doc/PerlQt.pod, doc/index.html: + + SUPER->foo() was not passing the 'this' object. + Removed the this->SUPER->foo construct which was buggy, and useless since SUPER is "protected" right now. + Might implement "public" SUPER later (e.g $myContainedObj->SUPER->foo() )... no emergency though. + +2002-09-22 16:16 germaingarand + + * smoke/qt/generate.pl.in, kalyptus/kalyptus, + kalyptus/kalyptusCxxToSmoke.pm: + + Fixing SMOKE to build with Qt-3.1b1 + +2002-09-20 16:01 germaingarand + + * configure.in: + + Fixed wong test for GL/gl.h + (was causing Smoke's build to fail when OpenGL headers aren't installed) + +2002-09-19 01:53 germaingarand + + * smoke/qt/generate.pl.in: + + removed debug + +2002-09-19 01:47 germaingarand + + * Makefile.am, smoke/qt/generate.pl.in, smoke/qt/header_list: + + Changed generate.pl to use a closed list of headers... some system don't store Qt headers in a distinct directory. + +2002-09-18 18:56 germaingarand + + * doc/: PerlQt.pod, index.html: + + fixed an error in one of the tutorials + +2002-09-18 10:06 germaingarand + + * doc/: PerlQt.pod, index.html: + + Updating install instructions + +2002-09-16 16:24 germaingarand + + * PerlQt/: lib/Qt/attributes.pm, lib/Qt/isa.pm, Qt.pm, Qt.xs: + + Inheritance of slots/attributes/SUPER was still half wrong. Fixed. + +2002-09-14 20:54 germaingarand + + * Makefile.am: + + Adding doc dir to the dist target + +2002-09-14 20:32 germaingarand + + * smoke/qt/Makefile.am: + + simplifying default Makefile.am to minimum + +2002-09-14 18:45 germaingarand + + * configure.in: + + increasing version number to 3.002 + +2002-09-14 17:58 germaingarand + + * PerlQt/Qt.xs: + + cleaning a debug line + +2002-09-14 17:52 germaingarand + + * doc/: PerlQt.pod, index.html: + + Update for the "SUPER" construct + +2002-09-14 17:50 germaingarand + + * PerlQt/: lib/Qt/isa.pm, Qt.pm, Qt.xs: + + Implemented a special attribute "SUPER" for calling methods on the superclass + +2002-09-14 05:37 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/isa.pm: + + - Fixed inheritance of attributes + - added a "no warnings" block around "this" assignation statement + (Michael Traxler reported "use of uninitialised value" warning on SuSE's Perl 5.6.1) + +2002-09-14 04:51 germaingarand + + * puic/form.cpp: + + - Fixed grabbing of slots from ui.h file + Now handles also additional functions. + - If(0)'ed the Font Handler + +2002-09-13 12:29 germaingarand + + * kalyptus/kalyptus, kalyptus/kalyptusCxxToSmoke.pm, + smoke/qt/qtguess.pl.in: + + Qt 3.1 fixes + +2002-09-12 12:32 germaingarand + + * smoke/qt/generate.pl.in: + + should learn how to revert one day :-/ + +2002-09-12 03:19 germaingarand + + * PerlQt/MANIFEST: + + Update + +2002-09-12 03:11 germaingarand + + * doc/index.html: + + updated from latest PerlQt.pod + +2002-09-12 03:10 germaingarand + + * doc/PerlQt.pod: + + Added a note about correct syntax for calling a base class method + +2002-09-12 02:43 germaingarand + + * PerlQt/lib/Qt/isa.pm: + + cleaning pollution of $_ + +2002-09-11 19:38 germaingarand + + * smoke/qt/generate.pl.in: + + added a bogus header in the skiplist + +2002-09-11 19:26 germaingarand + + * PerlQt/Qt.pm: + + fixing broken regex in argmatch (my fault) + +2002-09-11 05:18 germaingarand + + * PerlQt/Qt.pm: + + fixing polling of uninitialised {slots} array + Still not totally right... creating extra/unneeded qt_invoke + +2002-09-11 04:21 germaingarand + + * doc/PerlQt.pod: + + Added a chapter about puic usage + +2002-09-11 02:59 germaingarand + + * PerlQt/Makefile.PL.in: + + Fixing some env vars value and a broken regex + +2002-09-11 02:57 germaingarand + + * INSTALL, README, configure.in, smoke/qt/Makefile.am, + smoke/qt/generate.pl.in: + + Adding OpenGL detection && compilation to the autoconf framework + --without-Mesa : if you use a vendor specific GL lib, specify this (default is to look for Mesa) + --disable-GL : skip GL stuff... not really needed since it is skipped anyway if Qt doesn't have it + +2002-09-11 02:51 germaingarand + + * PerlQt/examples/opengl/: README, gear/gear, box/GLBox.pm, + box/glbox: + + Initial import of OpenGL examples + +2002-09-10 12:40 germaingarand + + * puic/: main.cpp, subclassing.cpp, uic.cpp: + + Polishing -subimpl option + - only generate derived slot stub for those that aren't implemented in the ui file + - -x now generates appropriate code with -subimpl + +2002-09-10 11:24 germaingarand + + * puic/: form.cpp, main.cpp: + + - option subimpl now working + - code to parse ui.h files... you can write Perl code for slots directly in the designer. + +2002-09-10 00:33 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + Implementing slot inheritance + +2002-09-09 13:55 germaingarand + + * PerlQt/lib/Qt/: signals.pm, slots.pm: + + Allow a space between typename and ref/star sign for sig/slot args (i.e 'FooType &' is now OK) + +2002-09-09 12:13 germaingarand + + * PerlQt/Qt.xs: + + oops. removed unwanted debug output + +2002-09-09 10:47 germaingarand + + * kalyptus/: kalyptus, kdocUtil.pm: + + Fixing incorrect parsing of enums with left/right bitshifts + +2002-09-09 10:41 germaingarand + + * puic/uic.cpp: + + Fixing bad names for extern pixmaps + +2002-09-09 10:41 germaingarand + + * puic/: form.cpp, main.cpp, uic.h: + + Database code now fully working + - handles multiple connections + - option -x generates template code to configure the connections + +2002-09-09 10:38 germaingarand + + * PerlQt/lib/Qt/isa.pm: + + Fixing import rules for deeper-than-CWD located modules + New rule is : always import fully qualified &X::Y::classname, but only + import &classname in the caller namespace if they share the same namespace + prefix. + +2002-09-09 10:30 germaingarand + + * PerlQt/Qt.xs: + + - test for virtual destructor replaces endless isDerivedFrom() tests + - added a function to lookup for an allocated object corresponding to a given anonymous pointer + +2002-09-09 10:25 germaingarand + + * PerlQt/Qt.pm: + + -better discrimination of method arguments (check for array reference) + -added Qt::SqlCursor to PersistentObjects (this is getting ugly :-/) + +2002-09-09 10:23 germaingarand + + * COPYING, ChangeLog, INSTALL, Makefile.am, configure.in, + inst-apps, subdirs, PerlQt/Makefile.PL.in, smoke/qt/Makefile.am, + smoke/qt/generate.pl.in: + + improved build system + - Smoke is now linked correctly wether it's installed on the system or built in the source tree + - some extra configure options to control the behaviour (--with-treshold=X for qtguess tests, + --enable-smoke to force smoke builds) + +2002-08-22 05:46 germaingarand + + * README, TODO, configure.in, subdirs, AUTHORS, COPYING, ChangeLog, + Makefile.am, Makefile.cvs, config.h.in, stamp-h.in, doc/Makefile, + doc/PerlQt.pod, doc/index.html, doc/pod.css, doc/images/ex1.png, + doc/images/ex2.png, puic/TODO, puic/Makefile.am, puic/domtool.cpp, + puic/embed.cpp, puic/form.cpp, puic/globaldefs.h, puic/main.cpp, + puic/object.cpp, puic/parser.cpp, puic/parser.h, + puic/subclassing.cpp, puic/uic.cpp, puic/uic.h, + puic/widgetdatabase.cpp, puic/widgetinterface.h, admin/depcomp, + admin/old-libtool.m4.in, admin/old-ltcf-cxx.sh, + admin/old-ltcf-gcj.sh, puic/LICENSE.GPL, puic/domtool.h, + puic/stamp-h.in, puic/widgetdatabase.h, admin/Makefile.common, + admin/config.guess, admin/config.pl, admin/configure.in.min, + admin/ltmain.sh, admin/acinclude.m4.in, admin/config.sub, + admin/install-sh, admin/conf.change.pl, admin/ltconfig, + admin/missing, admin/mkinstalldirs, admin/old-ltmain.sh, + admin/am_edit, admin/old-ltconfig, admin/debianrules, + admin/libtool.m4.in, admin/ylwrap, admin/ChangeLog, + admin/old-ltcf-c.sh, smoke/Makefile.am, smoke/README, + smoke/smoke.h, smoke/qt/Makefile.am, smoke/qt/generate.pl.in, + smoke/qt/generate_makefile_am.pl, smoke/qt/qt_smoke.h, + smoke/qt/qtguess.pl.in, PerlQt/MANIFEST, PerlQt/Makefile.PL.in, + PerlQt/examples/richedit/imageCollection.pm, + PerlQt/examples/richedit/richedit.pl, kalyptus/Ast.pm, + kalyptus/README, kalyptus/TODO, kalyptus/Version, kalyptus/Iter.pm, + kalyptus/kalyptus, kalyptus/kalyptusDataDict.pm, + kalyptus/kdocAstUtil.pm, kalyptus/ChangeLog, + kalyptus/kalyptusCxxToSmoke.pm, kalyptus/kdocLib.pm, + kalyptus/kdocParseDoc.pm, kalyptus/kdocUtil.pm: + + Initial import of new PerlQt-3 tree with Autoconf framework + +2002-08-22 05:46 germaingarand + + * README, TODO, configure.in, subdirs, AUTHORS, COPYING, ChangeLog, + Makefile.am, Makefile.cvs, config.h.in, stamp-h.in, doc/Makefile, + doc/PerlQt.pod, doc/index.html, doc/pod.css, doc/images/ex1.png, + doc/images/ex2.png, puic/TODO, puic/Makefile.am, puic/domtool.cpp, + puic/embed.cpp, puic/form.cpp, puic/globaldefs.h, puic/main.cpp, + puic/object.cpp, puic/parser.cpp, puic/parser.h, + puic/subclassing.cpp, puic/uic.cpp, puic/uic.h, + puic/widgetdatabase.cpp, puic/widgetinterface.h, admin/depcomp, + admin/old-libtool.m4.in, admin/old-ltcf-cxx.sh, + admin/old-ltcf-gcj.sh, puic/LICENSE.GPL, puic/domtool.h, + puic/stamp-h.in, puic/widgetdatabase.h, admin/Makefile.common, + admin/config.guess, admin/config.pl, admin/configure.in.min, + admin/ltmain.sh, admin/acinclude.m4.in, admin/config.sub, + admin/install-sh, admin/conf.change.pl, admin/ltconfig, + admin/missing, admin/mkinstalldirs, admin/old-ltmain.sh, + admin/am_edit, admin/old-ltconfig, admin/debianrules, + admin/libtool.m4.in, admin/ylwrap, admin/ChangeLog, + admin/old-ltcf-c.sh, smoke/Makefile.am, smoke/README, + smoke/smoke.h, smoke/qt/Makefile.am, smoke/qt/generate.pl.in, + smoke/qt/generate_makefile_am.pl, smoke/qt/qt_smoke.h, + smoke/qt/qtguess.pl.in, PerlQt/MANIFEST, PerlQt/Makefile.PL.in, + PerlQt/examples/richedit/imageCollection.pm, + PerlQt/examples/richedit/richedit.pl, kalyptus/Ast.pm, + kalyptus/README, kalyptus/TODO, kalyptus/Version, kalyptus/Iter.pm, + kalyptus/kalyptus, kalyptus/kalyptusDataDict.pm, + kalyptus/kdocAstUtil.pm, kalyptus/ChangeLog, + kalyptus/kalyptusCxxToSmoke.pm, kalyptus/kdocLib.pm, + kalyptus/kdocParseDoc.pm, kalyptus/kdocUtil.pm: + + Initial revision + +2002-08-22 04:38 germaingarand + + * PerlQt/Qt.pm: + + Added line number & file to the 'Lookup for...' warning in do_autoload/autoloaded. + It also filters out calls to enums now. + +2002-08-20 18:15 germaingarand + + * PerlQt/Qt.pm: + + do_autoload/autoloaded: Choose a different caller(n) if needed + +2002-08-20 17:59 germaingarand + + * PerlQt/Qt.xs: + + burn-proofing catArguments + +2002-08-20 15:33 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - Added detailed error reporting (Ambiguity candidates, warning when discarding args, correct file and line spotting when dying, etc.). Partly backported from dev branch. + - Added caching for method calls (makes PerlQt 300% faster :-) + +2002-08-14 17:02 germaingarand + + * PerlQt/Qt.pm: + + Don't hide object into parent if parent shall die ! + Fixes case where parent is a pointer to a QObject that wasn't allocated from Perl. + +2002-08-13 18:11 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + Added some PersistentObjects cases as well as some isDerivedFrom tests. + +2002-07-19 18:40 awinters + + * PerlQt/: Makefile.PL, smokeperl.cpp, lib/Qt/isa.pm: + + Fix to virtual functions in Perl subclasses - register the classname with Smoke from Qt::isa + +2002-07-17 03:35 awinters + + * PerlQt/Qt.pm: + + Fixing perl-5.8 compatibility problem. This generates a warning with -w, + but since this code branch is obsolete I don't care that much. :( + +2002-06-30 01:51 awinters + + * PerlQt/: handlers.cpp, smokeperl.cpp: + + memory leak fixes + +2002-06-29 21:55 awinters + + * PerlQt/smokeperl.cpp: + + broken leaky virtual method support - rejoice + +2002-06-28 08:52 awinters + + * PerlQt/: Qt.pm, smokeperl.cpp: + + More destructor voodoo. Why is QApplication getting addRefed? + +2002-06-27 04:59 awinters + + * PerlQt/: Qt.pm, smokeperl.cpp, smokeperl.h: + + global destruction working nicely + +2002-06-27 02:22 awinters + + * PerlQt/smokeperl.cpp: + + enabled method calling - t1 through t6 work again + +2002-06-27 01:46 awinters + + * PerlQt/smokeperl.cpp: + + code movement + +2002-06-27 01:44 awinters + + * PerlQt/smokeperl.cpp: + + Start of multimethod dispatching + +2002-06-26 04:56 awinters + + * PerlQt/: Qt.xs, smokeperl.cpp, lib/Qt/attributes.pm, + lib/Qt/isa.pm, lib/Qt/signals.pm, lib/Qt/slots.pm, + tutorials/t7/LCDRange.pm: + + Getting the skeleton working for the tutorials + +2002-06-26 03:36 awinters + + * PerlQt/smokeperl.cpp: + + Added Smoke::this(), and a possibly useful closure() function + +2002-06-26 02:45 awinters + + * PerlQt/: Qt.pm, smokeperl.cpp, smokeperl.h: + + This debugging stuff is great + +2002-06-25 21:08 awinters + + * PerlQt/smokeperl.cpp: + + use SmokeClass::parents() + +2002-06-25 20:54 awinters + + * PerlQt/smokeperl.cpp: + + reference counting... + +2002-06-25 16:52 awinters + + * PerlQt/smokeperl.cpp: + + file/line-number needed to be taken from caller + +2002-06-25 07:09 awinters + + * PerlQt/smokeperl.cpp: + + Kickass error messages! + +2002-06-25 06:18 awinters + + * PerlQt/Qt.pm: + + Changed the versioning, cooler this way. + +2002-06-25 05:47 awinters + + * PerlQt/: Makefile.PL, Qt.pm, Qt.xs, handlers.cpp, marshall.h, + perlqt.h, smokeperl.cpp, smokeperl.h: + + Initial version of code rewrite + +2002-06-15 01:19 awinters + + * PerlQt/: smokeperl.cpp, smokeperl.h: + + Added smokeperl.cpp... doesn't do anything, and it's not linked in yet. + +2002-06-14 21:02 awinters + + * PerlQt/smokeperl.h: + + Perhaps I have it right this time + +2002-06-14 20:57 awinters + + * PerlQt/smokeperl.h: + + SmokeMethod::call() + +2002-06-14 20:51 awinters + + * PerlQt/smokeperl.h: + + Added SmokeMethod + +2002-06-14 20:27 awinters + + * PerlQt/: Qt.xs, handlers.cpp, marshall.h, perlqt.h, smokeperl.h: + + Adding smokeperl.h. Changed all uses of Smoke::Type to SmokeType. + +2002-06-14 03:11 awinters + + * PerlQt/handlers.cpp: + + + I unchanged my mind. Is that a crime? + +2002-06-14 03:06 awinters + + * PerlQt/handlers.cpp: + + I changed my mind, you can't pass NULL to a function expecting int*. Sorry. + +2002-06-14 02:52 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Added a global object persistance thing + +2002-06-14 02:28 awinters + + * PerlQt/handlers.cpp: + + int* handler + +2002-06-13 22:58 awinters + + * PerlQt/handlers.cpp: + + Untested QStringList marshaller. Try it. + +2002-06-13 09:09 awinters + + * PerlQt/: Qt.pm, lib/Qt/isa.pm: + + Created a global baseclass - something I've been meaning to do for a while. Made constructors automatically inherit, you don't need to have empty constructors anymore. + +2002-06-13 08:47 awinters + + * PerlQt/: Qt.pm, examples/aclock/AnalogClock.pm, + examples/buttongroups/ButtonsGroups.pm, + examples/dclock/DigitalClock.pm, examples/drawdemo/drawdemo.pl, + examples/drawlines/drawlines.pl, examples/forever/forever.pl, + lib/Qt/isa.pm, tutorials/t10/CannonField.pm, + tutorials/t10/LCDRange.pm, tutorials/t10/t10.pl, + tutorials/t11/CannonField.pm, tutorials/t11/LCDRange.pm, + tutorials/t11/t11.pl, tutorials/t12/CannonField.pm, + tutorials/t12/LCDRange.pm, tutorials/t12/t12.pl, + tutorials/t13/CannonField.pm, tutorials/t13/GameBoard.pm, + tutorials/t13/LCDRange.pm, tutorials/t14/CannonField.pm, + tutorials/t14/GameBoard.pm, tutorials/t14/LCDRange.pm, + tutorials/t4/t4.pl, tutorials/t5/t5.pl, tutorials/t6/t6.pl, + tutorials/t7/LCDRange.pm, tutorials/t7/t7.pl, + tutorials/t8/CannonField.pm, tutorials/t8/LCDRange.pm, + tutorials/t8/t8.pl, tutorials/t9/CannonField.pm, + tutorials/t9/LCDRange.pm, tutorials/t9/t9.pl: + + new => NEW. NEW() acts like the C++ constructor function, new() acts like a nice object instantiator. + +2002-06-13 03:10 awinters + + * PerlQt/Qt.pm: + + Evil debug statement + +2002-06-13 03:05 awinters + + * PerlQt/: Qt.xs, examples/drawdemo/drawdemo.pl, + examples/drawlines/drawlines.pl, examples/forever/forever.pl, + lib/Qt/isa.pm, tutorials/t10/t10.pl, tutorials/t11/t11.pl, + tutorials/t12/t12.pl, tutorials/t4/t4.pl, tutorials/t5/t5.pl, + tutorials/t6/t6.pl, tutorials/t7/t7.pl, tutorials/t8/t8.pl, + tutorials/t9/t9.pl: + + Hack 'use' + +2002-06-10 06:04 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + @ISA is now honored - had to fudge to make Exporter work + +2002-06-10 04:29 awinters + + * PerlQt/: Qt.pm, handlers.cpp: + + New type handlers for uchar* and QRgb*, as well as a QImage constructor + +2002-06-10 02:04 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Evil hacks for puic + +2002-06-05 18:35 awinters + + * PerlQt/examples/buttongroups/: buttongroups.pl, buttonsgroups.pl: + + Original was misnamed buttonsgroups.pl - now buttongroups.pl + +2002-06-04 20:58 awinters + + * PerlQt/: examples/dclock/DigitalClock.pm, + tutorials/t14/GameBoard.pm, tutorials/t5/t5.pl, tutorials/t6/t6.pl, + tutorials/t7/LCDRange.pm: + + Make constant usage as pleasing as possible + +2002-06-04 20:20 awinters + + * PerlQt/Qt.pm: + + $AUTOLOAD is always $Qt::AutoLoad::AUTOLOAD, now + +2002-06-04 18:57 awinters + + * PerlQt/handlers.cpp: + + No smoke_types.h + +2002-06-04 16:58 awinters + + * PerlQt/: INSTALL, Qt.xs: + + Fixing build procedure - smoke_types.h is long dead + +2002-06-04 08:36 awinters + + * PerlQt/INSTALL: + + KDE SDK hopefully isn't required + +2002-06-04 07:55 awinters + + * PerlQt/: INSTALL, README: + + Build instructions + +2002-06-04 01:50 awinters + + * PerlQt/examples/: aclock/aclock.pl, + buttongroups/buttonsgroups.pl, dclock/dclock.pl, + drawdemo/drawdemo.pl, drawlines/drawlines.pl, forever/forever.pl: + + add 'use blib' and 'use constant' + +2002-06-04 00:51 awinters + + * PerlQt/examples/dclock/DigitalClock.pm: + + LeftButton is global + +2002-06-03 07:29 awinters + + * PerlQt/tutorials/runall.pl: + + $^X is handy + +2002-06-03 06:25 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/isa.pm: + + XS autoload was disabled in Perl-5.6.1, so I made a perl sub redirect autoloads + +2002-06-02 10:53 awinters + + * PerlQt/Qt.pm: + + List ops are fun + +2002-06-02 10:49 awinters + + * PerlQt/Qt.pm: + + Don't ask me why, but signals can have return-values. I don't even want to imagine it. + +2002-06-02 10:46 awinters + + * PerlQt/Qt.pm: + + Switched from DynaLoader to XSLoader. Gave exported functions prototypes, for better or worse. + +2002-06-02 10:29 awinters + + * PerlQt/tutorials/runall.pl: + + I'm not usually paranoid about security, but this was too easy not to fix. + +2002-06-02 10:25 awinters + + * PerlQt/tutorials/runall.pl: + + Script to run all the tutorials in order + +2002-06-02 07:24 awinters + + * PerlQt/perlqt.h: + + ifdef + +2002-06-02 07:22 awinters + + * PerlQt/: Makefile.PL, Qt.xs, handlers.cpp, perlqt.h: + + Created perlqt.h, moved code from Qt.xs to new handlers.cpp. Starting code reorganization. + +2002-06-02 03:28 awinters + + * PerlQt/examples/forever/forever.pl: + + Added forever - this will be my benchmark. Current results: SLOW + +2002-06-02 03:09 awinters + + * PerlQt/examples/drawlines/drawlines.pl: + + Adding drawlines demo + +2002-06-02 02:35 awinters + + * PerlQt/examples/drawdemo/drawdemo.pl: + + Added drawdemo + +2002-06-01 23:37 awinters + + * PerlQt/examples/dclock/: dclock, dclock.pl: + + Renamed dclock to dclock.pl + +2002-06-01 23:36 awinters + + * PerlQt/examples/buttongroups/: ButtonsGroups.pm, + buttonsgroups.pl: + + Added buttongroups example + +2002-06-01 23:36 awinters + + * PerlQt/examples/aclock/: aclock, aclock.pl: + + Renamed aclock to aclock.pl + +2002-06-01 23:05 awinters + + * PerlQt/: Qt.pm, Qt.xs, examples/aclock/AnalogClock.pm, + examples/aclock/aclock, examples/dclock/DigitalClock.pm, + examples/dclock/dclock, lib/Qt/attributes.pm, lib/Qt/isa.pm, + lib/Qt/signals.pm, lib/Qt/slots.pm, tutorials/t1/t1.pl, + tutorials/t10/CannonField.pm, tutorials/t10/LCDRange.pm, + tutorials/t10/t10.pl, tutorials/t11/CannonField.pm, + tutorials/t11/LCDRange.pm, tutorials/t11/t11.pl, + tutorials/t12/CannonField.pm, tutorials/t12/LCDRange.pm, + tutorials/t12/t12.pl, tutorials/t13/CannonField.pm, + tutorials/t13/GameBoard.pm, tutorials/t13/LCDRange.pm, + tutorials/t13/t13.pl, tutorials/t14/CannonField.pm, + tutorials/t14/GameBoard.pm, tutorials/t14/LCDRange.pm, + tutorials/t14/t14.pl, tutorials/t2/t2.pl, tutorials/t3/t3.pl, + tutorials/t4/t4.pl, tutorials/t5/t5.pl, tutorials/t6/t6.pl, + tutorials/t7/LCDRange.pm, tutorials/t7/t7.pl, + tutorials/t8/CannonField.pm, tutorials/t8/LCDRange.pm, + tutorials/t8/t8.pl, tutorials/t9/CannonField.pm, + tutorials/t9/LCDRange.pm, tutorials/t9/t9.pl: + + Merged 'this' change, tutorials changed accordingly + +2002-06-01 23:00 awinters + + * PerlQt/examples/dclock/: DigitalClock.pm, dclock: + + Adding dclock + +2002-06-01 23:00 awinters + + * PerlQt/examples/dclock/DigitalClock.pm: + + file DigitalClock.pm was initially added on branch this. + +2002-06-01 23:00 awinters + + * PerlQt/examples/dclock/dclock: + + file dclock was initially added on branch this. + +2002-06-01 21:17 awinters + + * PerlQt/examples/aclock/AnalogClock.pm: + + file AnalogClock.pm was initially added on branch this. + +2002-06-01 21:17 awinters + + * PerlQt/examples/aclock/aclock: + + file aclock was initially added on branch this. + +2002-06-01 21:17 awinters + + * PerlQt/: Qt.pm, Qt.xs, examples/aclock/AnalogClock.pm, + examples/aclock/aclock: + + Added support for QCOORD* and Qt::PointArray::setPoints. Added global min() and max() functions. + +2002-06-01 11:15 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/signals.pm: + + Made qt_emit also use XS code - noticable speedup in t7. Qt::_internal::invoke is obsolete + +2002-06-01 10:13 awinters + + * PerlQt/: lib/Qt/slots.pm, tutorials/t1/t1.pl, + tutorials/t10/t10.pl, tutorials/t11/t11.pl, tutorials/t12/t12.pl, + tutorials/t13/CannonField.pm, tutorials/t13/GameBoard.pm, + tutorials/t13/t13.pl, tutorials/t14/CannonField.pm, + tutorials/t14/GameBoard.pm, tutorials/t14/t14.pl, + tutorials/t2/t2.pl, tutorials/t3/t3.pl, tutorials/t4/t4.pl, + tutorials/t5/t5.pl, tutorials/t6/t6.pl, tutorials/t7/t7.pl, + tutorials/t8/t8.pl, tutorials/t9/t9.pl: + + tutorial mods - use blib and enable canShoot(bool) signal in t13/t14. + +2002-06-01 09:59 awinters + + * PerlQt/: Qt.xs, lib/Qt/slots.pm: + + qt_invoke implemented in XS + +2002-06-01 06:37 awinters + + * PerlQt/: Qt.xs, lib/Qt/signals.pm: + + Code reorganization, start of XS slot work + +2002-06-01 00:19 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/signals.pm, lib/Qt/slots.pm: + + emit signal() now uses type marshalling -- the way has been shown + +2002-05-31 06:42 awinters + + * PerlQt/: Qt.pm, tutorials/t10/CannonField.pm, + tutorials/t10/LCDRange.pm, tutorials/t10/t10.pl, + tutorials/t11/CannonField.pm, tutorials/t11/t11.pl, + tutorials/t12/CannonField.pm, tutorials/t12/t12.pl, + tutorials/t13/CannonField.pm, tutorials/t8/CannonField.pm, + tutorials/t8/LCDRange.pm, tutorials/t8/t8.pl, + tutorials/t9/CannonField.pm, tutorials/t9/LCDRange.pm, + tutorials/t9/t9.pl: + + Mostly done with code style revision + +2002-05-31 06:18 awinters + + * PerlQt/: Qt.xs, tutorials/t11/CannonField.pm, + tutorials/t11/LCDRange.pm, tutorials/t11/t11.pl: + + It seems I still haven't knocked down the &Constant quirks. It's zero arguments! Sheesh. + +2002-05-31 06:07 awinters + + * PerlQt/tutorials/t12/: CannonField.pm, LCDRange.pm, t12.pl: + + My revisionist ways continue + +2002-05-31 05:51 awinters + + * PerlQt/tutorials/t13/: CannonField.pm, GameBoard.pm, LCDRange.pm, + t13.pl: + + t13 revisions + +2002-05-31 05:37 awinters + + * PerlQt/tutorials/t14/: CannonField.pm, GameBoard.pm, LCDRange.pm, + t14.pl: + + I'm trying to define a coding style using t14 as the baseline. This works with the latest kalyptus. + +2002-05-31 04:48 awinters + + * PerlQt/: Qt.pm, Qt.xs, tutorials/t10/CannonField.pm, + tutorials/t10/LCDRange.pm, tutorials/t10/t10.pl, + tutorials/t11/CannonField.pm, tutorials/t11/LCDRange.pm, + tutorials/t11/t11.pl, tutorials/t14/CannonField.pm, + tutorials/t14/GameBoard.pm, tutorials/t14/LCDRange.pm, + tutorials/t14/t14.pl, tutorials/t2/t2.pl, tutorials/t3/t3.pl, + tutorials/t4/t4.pl, tutorials/t5/t5.pl, tutorials/t6/t6.pl, + tutorials/t7/LCDRange.pm, tutorials/t7/t7.pl, + tutorials/t8/LCDRange.pm, tutorials/t8/t8.pl, + tutorials/t9/CannonField.pm, tutorials/t9/LCDRange.pm, + tutorials/t9/t9.pl: + + AUTOLOAD return values on user-defined functions work, &Constant works thanks to ignoring any arguments passed, t14 ported to new + code format. + +2002-05-31 03:37 awinters + + * PerlQt/: Qt.pm, lib/Qt/attributes.pm, tutorials/t9/LCDRange.pm, + tutorials/t9/t9.pl: + + Changed static method calls from Class->method to Class::method + +2002-05-30 22:48 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/signals.pm, + tutorials/t10/CannonField.pm, tutorials/t10/LCDRange.pm, + tutorials/t10/t10.pl, tutorials/t9/CannonField.pm, + tutorials/t9/LCDRange.pm, tutorials/t9/t9.pl: + + Changed how sv_this was being saved. That fixed the passing-lvalue-this-around problem + +2002-05-30 13:30 awinters + + * PerlQt/: lib/Qt/isa.pm, tutorials/t8/CannonField.pm, + tutorials/t8/LCDRange.pm, tutorials/t8/t8.pl: + + passing 'this' as an lvalue to constructors which MODIFY 'this' could be unpleasant. Perhaps using sv_setsv was a bad idea. + +2002-05-30 13:16 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/signals.pm, lib/Qt/slots.pm, + tutorials/t5/t5.pl, tutorials/t6/t6.pl, tutorials/t7/LCDRange.pm, + tutorials/t7/t7.pl: + + Made signals/slots use 'this' + +2002-05-30 12:51 awinters + + * PerlQt/: Qt.pm, Qt.xs, tutorials/t4/t4.pl: + + set 'this' for do_autoload, so QObject-mirroring refcounting works + +2002-05-30 12:29 awinters + + * PerlQt/: Qt.xs, lib/Qt/isa.pm: + + AUTOLOAD now works on non-method-calls in classes, by defaulting unknown functions to this->method + +2002-05-30 11:05 awinters + + * PerlQt/: Qt.pm, lib/Qt/isa.pm: + + enable MyClass->AUTOLOAD and @ISA searching from autoloader + +2002-05-30 10:53 awinters + + * PerlQt/lib/Qt/isa.pm: + + Add import() function for use classes, so MyClass() constructors work + +2002-05-30 10:07 awinters + + * PerlQt/Qt.xs: + + Object destruction seems to work again + +2002-05-30 07:40 awinters + + * PerlQt/Qt.xs: + + Stop pushing 'this' on the stack for virtual methods + +2002-05-30 07:28 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Calling convention works. $x->foo works for AUTOLOAD case, haven't tested the non-AUTOLOAD case even though it should work too. + +2002-05-30 05:01 awinters + + * PerlQt/Qt.xs: + + AUTOLOAD now works for calling Perl-defined methods + +2002-05-30 04:12 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/isa.pm: + + Added an XS autoload + +2002-05-30 02:08 awinters + + * PerlQt/: Qt.xs, lib/Qt/attributes.pm, lib/Qt/isa.pm: + + Implementation of 'this' and attributes + +2002-05-30 02:08 awinters + + * PerlQt/lib/Qt/attributes.pm: + + file attributes.pm was initially added on branch this. + +2002-05-29 11:09 awinters + + * PerlQt/: Qt.pm, Qt.xs, tutorials/t1/t1.pl, + tutorials/t14/CannonField.pm, tutorials/t14/GameBoard.pm, + tutorials/t14/LCDRange.pm, tutorials/t14/t14.pl, + tutorials/t2/t2.pl, tutorials/t3/t3.pl, tutorials/t4/t4.pl, + tutorials/t5/t5.pl, tutorials/t6/t6.pl, tutorials/t7/LCDRange.pm, + tutorials/t7/t7.pl, tutorials/t8/CannonField.pm, + tutorials/t8/LCDRange.pm, tutorials/t8/t8.pl, + tutorials/t9/CannonField.pm, tutorials/t9/LCDRange.pm, + tutorials/t9/t9.pl: + + Outline for goal of this branch - pretty programs + +2002-05-29 09:18 awinters + + * PerlQt/Qt.xs: + + Forgot to remove debugging arguments to warn() before committing + +2002-05-29 04:49 awinters + + * PerlQt/tutorials/t9/: CannonField.pm, LCDRange.pm, t9.pl: + + Initial commit + +2002-05-29 04:47 awinters + + * PerlQt/tutorials/t10/CannonField.pm: + + Color constants work now + +2002-05-29 04:40 awinters + + * PerlQt/tutorials/: t11/CannonField.pm, t11/LCDRange.pm, + t11/t11.pl, t12/CannonField.pm, t12/LCDRange.pm, t12/t12.pl, + t13/CannonField.pm, t13/GameBoard.pm, t13/LCDRange.pm, t13/t13.pl, + t14/CannonField.pm, t14/GameBoard.pm, t14/LCDRange.pm, t14/t14.pl: + + Adding tutorials + +2002-05-28 23:33 awinters + + * PerlQt/: Qt.xs, tutorials/t10/CannonField.pm, + tutorials/t10/LCDRange.pm, tutorials/t10/t10.pl: + + Plugged a memory-leak involving tf_stack return-values, and added isa(QPaintDevice) to the list of classes added to the + virtual function object-map. Tutorial 10 added. + +2002-05-28 22:13 awinters + + * PerlQt/tutorials/t8/CannonField.pm: + + When I said ambiguous method resolution was improved, I wasn't kidding. + +2002-05-28 22:12 awinters + + * PerlQt/: Qt.pm, Qt.xs, tutorials/t8/CannonField.pm, + tutorials/t8/LCDRange.pm, tutorials/t8/t8.pl: + + Copy constructor implemented for virtual method return-values, ambiguous method resolution improved, t8 working. + +2002-05-28 20:27 awinters + + * PerlQt/Qt.pm: + + Added emit keyword + +2002-05-28 20:13 awinters + + * PerlQt/tutorials/: t6/t6.pl, t7/LCDRange.pm, t7/t7.pl: + + Last commit failed, new object destruction + +2002-05-28 20:13 awinters + + * PerlQt/: Qt.pm, Qt.xs, tutorials/t4/t4.pl, tutorials/t5/t5.pl: + + New object destruction - Perl now mirrors QObject reference counts + +2002-05-28 07:49 awinters + + * PerlQt/tutorials/t7/: LCDRange.pm, t7.pl: + + Tutorial 7, in all its glory + +2002-05-28 07:48 awinters + + * PerlQt/: Qt.xs, lib/Qt/signals.pm: + + Workings of tutorial 7 + +2002-05-28 06:53 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/signals.pm, lib/Qt/slots.pm: + + signal and slot implementation merged a bit, first stab at ambiguous method resolution added. + +2002-05-28 04:08 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/slots.pm: + + Slots are now declared through the Qt::slots pragma. Only int arguments are supported, so far. + +2002-05-28 00:19 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/slots.pm: + + Got slot arguments working + +2002-05-27 19:52 awinters + + * PerlQt/lib/Qt/slots.pm: + + More slot goodness + +2002-05-27 19:37 awinters + + * PerlQt/lib/Qt/slots.pm: + + Recognize when Perl slot is invoked + +2002-05-27 19:27 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/slots.pm: + + Paranoid backup. I got a slot to work, and I want it to stay that way. :) + +2002-05-27 18:47 awinters + + * PerlQt/: Qt.pm, Qt.xs, lib/Qt/isa.pm, lib/Qt/signals.pm, + lib/Qt/slots.pm: + + Start overriding signal/slot methods. Qt is now 'aware' of PerlQt classes, thanks to overrides of className() and + metaObject(). + +2002-05-27 09:09 awinters + + * PerlQt/Qt.xs: + + Bye bye, comments + +2002-05-27 08:53 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Dirty first draft of 'proper' reference counting + +2002-05-27 08:52 awinters + + * PerlQt/tutorials/: t1/t1.pl, t2/t2.pl, t3/t3.pl, t4/t4.pl, + t5/t5.pl, t6/t6.pl: + + use strict is mandatory, now. Reference counts matter. + +2002-05-27 02:51 awinters + + * PerlQt/Qt.xs: + + I never manage to get all the debug statements first time around... + +2002-05-27 02:49 awinters + + * PerlQt/Qt.xs: + + Fully working marshalling class. Toss MyStack for good; Long live Marshall! + +2002-05-27 01:35 awinters + + * PerlQt/Qt.xs: + + I don't need these debugging statements anymore + +2002-05-27 01:28 awinters + + * PerlQt/: Qt.xs, marshall.h: + + Marshalling works for method calls + +2002-05-26 23:41 awinters + + * PerlQt/: Qt.xs, marshall.h: + + Defined some of the type mapping + +2002-05-26 23:23 awinters + + * PerlQt/marshall.h: + + #ifndef MARSHALL_H + +2002-05-26 23:19 awinters + + * PerlQt/: Qt.xs, marshall.h: + + Defining general type-marshalling interface + +2002-05-24 20:14 awinters + + * PerlQt/Makefile.PL: + + Forgot to update this... + +2002-05-24 17:25 awinters + + * PerlQt/Qt.xs: + + Eliminate warning during global destruction + +2002-05-24 17:19 awinters + + * PerlQt/tutorials/: t2/t2.pl, t3/t3.pl, t4/t4.pl, t5/t5.pl, + t6/t6.pl: + + Enums work, now + +2002-05-24 08:19 awinters + + * PerlQt/lib/Qt/: enumerations.pm, properties.pm, signals.pm, + slots.pm: + + Documented some proposed usage. Perhaps good, perhaps not. + +2002-05-24 07:45 awinters + + * PerlQt/lib/Qt/isa.pm: + + Initial implementation - no QMetaObject stuff yet + +2002-05-24 07:43 awinters + + * PerlQt/tutorials/: t4/t4.pl, t5/t5.pl, t6/t6.pl: + + Use Qt::isa pragma + +2002-05-24 07:36 awinters + + * PerlQt/lib/Qt/: enumerations.pm, isa.pm, properties.pm, + signals.pm, slots.pm: + + Adding some QMetaObject-generating pragmas + +2002-05-24 04:46 awinters + + * PerlQt/Qt.xs: + + That qobject boolean was a bad idea... + +2002-05-24 04:13 awinters + + * PerlQt/Qt.xs: + + Fixed memory leak, isQObject() forgot to return false + +2002-05-24 03:41 awinters + + * PerlQt/Qt.xs: + + Call delete through smoked library + +2002-05-24 03:24 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Added a flag indicating whether an object can be deleted -- object deletion enabled. + +2002-05-24 02:59 awinters + + * PerlQt/Qt.xs: + + First version with virtual functions + +2002-05-24 02:36 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Beginning of virtual method support + +2002-05-24 02:07 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Default to silent output, and remove old commented functions. + +2002-05-24 01:56 awinters + + * PerlQt/: Qt.xs, Qt.pm: + + Implemented rudimentary object tracking and destruction. + +2002-05-23 22:57 awinters + + * PerlQt/: Qt.pm, Qt.xs: + + Implement new smokelib => perl interface SmokeBinding class, and add destructor callback. Start of work to + get working object destruction. + +2002-05-23 20:53 awinters + + * PerlQt/Qt.xs: + + Changed return-value handling to be generic so it can handle virtual-function arguments as well. + +2002-05-23 06:16 awinters + + * PerlQt/Qt.xs: + + This one works. First working version in SF CVS + +2002-05-23 06:02 awinters + + * PerlQt/: Makefile.PL, Qt.pm, Qt.xs, tutorials/t1/t1.pl, + tutorials/t2/t2.pl, tutorials/t3/t3.pl, tutorials/t4/t4.pl, + tutorials/t5/t5.pl, tutorials/t6/t6.pl: + + Imported sourcecode + +2002-05-23 06:02 awinters + + * PerlQt/: Makefile.PL, Qt.pm, Qt.xs, tutorials/t1/t1.pl, + tutorials/t2/t2.pl, tutorials/t3/t3.pl, tutorials/t4/t4.pl, + tutorials/t5/t5.pl, tutorials/t6/t6.pl: + + Initial revision + diff --git a/ChangeLog.CVS.delta b/ChangeLog.CVS.delta new file mode 100644 index 0000000..7450ada --- /dev/null +++ b/ChangeLog.CVS.delta @@ -0,0 +1,696 @@ +2003-09-13 00:39 germaingarand + + * PerlQt/handlers.cpp: + + - cache copy constructor && destructor lookups + - avoid looking twice in type hash for most common types + +2003-09-13 00:37 germaingarand + + * PerlQt/Qt.pm: + + - fix line numbers && current file on error (no method to call...) + +2003-09-12 15:43 germaingarand + + * PerlQt/handlers.cpp: + + - reworking the tied marshallers: let's allow readonly variables. + +2003-09-12 15:24 germaingarand + + * PerlQt/t/b_nogui.t: + + - adding test for tied marshaller/TextStream + +2003-09-12 13:13 germaingarand + + * PerlQt/Qt.xs: + + (see previous commit on handlers.cpp) + +2003-09-12 13:12 germaingarand + + * PerlQt/handlers.cpp: + + - fix garbage collection: we need to register external objects as well, so that + widgets using e.g: the $mainWindow->menuBar() pointer as parent don't get GCed. + - do not look in real stash if call is for a Qt::enum + (emulation of the previous Legacy autoload behaviour) + +2003-09-12 13:02 germaingarand + + * PerlQt/Qt.pm: + + - strict matching is too strict. We'll do that only for operators + +2003-09-10 18:16 germaingarand + + * PerlQt/Qt.pm: + + - We don't want to check the type of every argument, but let's check at least Qt Objects. + Wrong casts are deadly and hard to debug. + - got rid of the legacy autoload. Fully qualified calls are much faster now. + +2003-09-10 13:17 germaingarand + + * puic/uic.cpp: + + - 3.1 Actions were housed + +2003-09-09 10:45 germaingarand + + * ChangeLog.CVS, ChangeLog.CVS.delta, Makefile.am, cvs2cl.pl: + + - updated ChangeLogs + +2003-09-09 09:21 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + fix compile for 5.6.1 + +2003-09-09 07:32 germaingarand + + * perleditor/: perlcompletion.cpp, perlcompletion.h: + + - perlcompletion isn't at top speed until a first call has been made. + Put a singleShot timer to warm it up before the user come + +2003-09-09 06:25 germaingarand + + * PerlQt/Makefile.PL.in: + + - add qt_libraries to RPATH too, otherwise Qt.so can pull a qt-mt library different from the one Smoke + would have picked up. + +2003-09-08 18:13 germaingarand + + * PerlQt/t/ca_i18n.t: + + - one more test, monitoring "use bytes" pragma + +2003-09-08 16:24 germaingarand + + * PerlQt/: MANIFEST, Makefile.PL.in, Qt.pod: + + - cleaning Makefile.PL.in + - install documentation in {datadir}/PerlQt-3 + - install a short Qt.pod notice pointing to the real doc, for those + who are going to try "perldoc Qt" :-} + +2003-09-08 15:38 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html: + + - updated documentation (/en and /fr) to reflect 3.008 changes + +2003-09-08 02:23 germaingarand + + * perleditor/README.perleditor.quickstart: + + - a bit of documentation never hurts... + +2003-09-08 01:47 germaingarand + + * perleditor/: objectbrowser.cpp, perlaction.cpp: + + - fixing proper detection of PerlEditor modified state when Running Project + +2003-09-07 15:32 germaingarand + + * perleditor/: listeditor.h, mainfilesettings.h, preferences.h, + projectsettings.h, slotfuncdia.h: + + removing auto-generated headers + +2003-09-07 15:26 germaingarand + + * PerlQt/lib/Qt/debug.pm: + + - warn and display list of available debugging channels when asked for an unknown one + +2003-09-07 15:18 germaingarand + + * configure.in, PerlQt/Qt.pm: + + - bumping version to 3.008 + +2003-09-07 14:35 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + - major bug fix: "use bytes" and "use locale" pragmata didn't apply to current scope. + They are held in the op_private of the context stack after compiling, no more in PL_hints. + Thanks to Ashley for pointing where to find them :) + Additionaly, there was a loss of context in AUTOLOAD due to the many hops. + So we need to fetch the old context in there. + +2003-09-06 21:05 germaingarand + + * puic/: Makefile.am, puic.1: + + adding Lutz Badenheuer <Lutz.Badenheuer@t-online.de>'s man page + +2003-09-06 19:03 germaingarand + + * perleditor/yyindent.cpp: + + - fix comment detection. + +2003-09-06 16:51 germaingarand + + * PerlQt/Qt.pm: + + - be more strict when matching ambiguous methods + - fixed a bug regarding the priority of some types + +2003-09-05 03:30 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp: + + - implemented QByteArray Marshaller (from/to Perl string, tied if needed) + Still needs some thought /wrt to Utf8 handling (think qCompress/qUncompress) + + With QDataStream static operators and this, we get a nice object serializer :) + + use Qt::constants; + $bytearray = ""; + $a = Qt::DataStream( $bytearray, IO_WriteOnly ); + # now magically serialize some objects in $bytearray + $a << $qdatetime << $qfont << $qpixmap; + +2003-09-01 21:09 germaingarand + + * PerlQt/: Qt.xs, handlers.cpp: + + - real non-const QString&/* marshaller implemented via tied scalars + e.g: + use Qt; + use Qt::constants; + + $str = "Foooooooooooooooo"; + + $ts = Qt::TextStream( $str, IO_WriteOnly ); + $ts << "pi = " << 3.14; + + # $str is now "pi = 3.14oooooooo" + + The link is maintained until the scalar is destroyed, or until it is untied. + +2003-08-31 16:35 germaingarand + + * PerlQt/lib/Qt/GlobalSpace.pm, PerlQt/Qt.pm, PerlQt/t/b_nogui.t, + kalyptus/ChangeLog, kalyptus/Iter.pm, kalyptus/README, + kalyptus/kalyptus, kalyptus/kalyptusCxxToSmoke.pm, + kalyptus/kdocAstUtil.pm: + + updating kalyptus/smoke (GlobSpace operator names no longer munged) + +2003-08-31 14:38 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/slots.pm: + + - more permissive syntax for new sig/slot declarations (white spaces, quotes) + - implement consistency check of old vs. new style slot declarations + allows one to say + use Qt::slots "foo" => ["int"]; + then + sub foo : SLOT( int ) {} # OK. Same decl. Noop. + sub foo : SLOT( QString ) {} # triggers a warning: + # Slot declaration: + # foo(QString) + # will override previous declaration: + # foo(int) + +2003-08-30 23:01 germaingarand + + * PerlQt/Qt.pm: + + Doing it the Right Way. + - make $SIG{__DIE__} local inside eval'ed ops + - added missing operators (unary minus, binary mul) + - GlobalSpace operators with assignment were returning wrong values + +2003-08-28 02:10 germaingarand + + * smoke/qt/generate.pl.in, smoke/qt/qt_smoke.h, kalyptus/kalyptus, + kalyptus/kalyptusCxxToSmoke.pm, kalyptus/kalyptusDataDict.pm, + kalyptus/kdocAstUtil.pm: + + - GlobalSpace support + updates + +2003-08-28 02:02 germaingarand + + * smoke/qt/header_list: + + -removing conflicting/useless headers + +2003-08-28 01:28 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/GlobalSpace.pm, lib/Qt/constants.pm: + + - adding support for the new Qt::GlobalSpace pseudo-class holding all global Qt functions. + Requires a recompilation of Smoke. + use Qt::GlobalSpace; # exports all symbols to the caller's namespace (not recommended) + use Qt::GlobalSpace qw( bitBlt qCompress qSysInfo ); # export listed symbols only + - when an operator call fails, forward the call to Qt::GlobalSpace which has a lot of static operators: + $aPoint = Qt::Point( 20, 20 ); + $aPoint += Qt::Point( 10, 10); # this one calls Qt::Point->operator+() + $o = Qt::Point(10,10) + Qt::Point(30,30); # this is forwarded to Qt::GlobalSpace::+( QPoint, QPoint ) + - made "use Qt::constant" export all symbols by default (IO_ReadOnly, ...). + +2003-08-20 10:12 germaingarand + + * PerlQt/handlers.cpp: + + - construct_copy for const ref: update the macros, and oh, don't forget to + mark the resulting object as allocated. Caveat leakem. + +2003-08-20 09:25 germaingarand + + * PerlQt/handlers.cpp: + + - fixed a severe bug in construct_copy + - when marshalling const QFoo&, construct a copy... + this ought to fix a lot of subtle bugs (mostly QShared related). + +2003-08-14 20:52 germaingarand + + * puic/: form.cpp, uic.cpp, uic.h: + + - various fixes for when compiling with Qt < 3.1 + +2003-08-14 18:44 germaingarand + + * PerlQt/Makefile.PL.in, admin/acinclude.m4.in, + smoke/qt/qtguess.pl.in: + + - nice patch by Marek Rouchal<marek.rouchal@infineon.com>. Improves Solaris + compatibility and static builds. Many thanks to him! + - fix the sometimes incorrect rpath for Smoke (kde_libraries=>libdir) + +2003-08-14 18:35 germaingarand + + * puic/: form.cpp, main.cpp, object.cpp, uic.cpp, uic.h, + widgetdatabase.cpp: + + - end of uic 3.2 merging at last. Pheeeew. + +2003-08-14 18:22 germaingarand + + * perleditor/perlaction.cpp: + + - prevent random crash when destroying qprocesses too early + +2003-07-18 03:14 germaingarand + + * puic/object.cpp: + + - compile fix by David Hugh-Jones <hughjonesd@yahoo.co.uk> + +2003-06-14 04:52 germaingarand + + * smoke/qt/Makefile.am, smoke/qt/header_list, + kalyptus/kalyptusCxxToSmoke.pm: + + - fix Smoke generation for Qt-3.2b1 + +2003-06-14 04:47 germaingarand + + * PerlQt/: Qt.pm, Qt.xs, handlers.cpp, perlqt.h: + + - speed optimizations again. cachegrind rocks + +2003-06-09 17:17 germaingarand + + * PerlQt/lib/Qt/attributes.pm: + + - do not redefine attributes if they have already been defined in base class. + +2003-06-09 17:15 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - Some polishing on Q*Items garbage collection. setAllocated() is now correct. + - Speed, speed, speed. Moved object destruction routine to XS. Object creation/deletion + is now 50% faster than in 5.006 + +2003-06-08 02:01 germaingarand + + * puic/: domtool.cpp, domtool.h, form.cpp, main.cpp, object.cpp, + subclassing.cpp, uic.cpp, uic.h, widgetdatabase.cpp: + + - big merges from uic. Regressions expected. Needs testing + +2003-06-06 21:30 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - sig/slot defined via sub attributes are now created upon metaObject() request if needed. + Much better this way, since it allows runtime evaluation: + eval "sub foo : SLOT() {}" + +2003-06-06 02:51 germaingarand + + * PerlQt/Qt.pm: + + for now: slot/signal/dcop => SLOT/SIGNAL/DCOP + +2003-06-06 01:53 germaingarand + + * PerlQt/Qt.pm: + + - moved the sig/slot attributes handling from Qt::base to the Qt::Object package, + where it obviously belongs + - silenced a 5.6.0 warning /wrt Qt::debug + +2003-06-05 22:07 germaingarand + + * PerlQt/: Qt.pm, lib/Qt/signals.pm, lib/Qt/slots.pm: + + - implemented Ashley's great syntax proposal for sig/slots definition via sub attributes + sub mySlot : slot( int, const QString& ) { ... } + sub mySig : signal( bool ); + Of course, the old/alternative syntax is still valid. + +2003-06-05 15:22 germaingarand + + * PerlQt/: Qt.pm, Qt.xs: + + - fixed the garbage collection for Q*Items. + Use list->takeItem( foo ) when available to safely remove an Item from a list (then undef it to delete). + - as a consequence, could remove the dreadful obj->isa("Q*Item") test. Gives a nice 30% speed up in + Object creation. + +2003-05-30 03:22 germaingarand + + * puic/puic.pro: + + - added a qmake project file, for easy building of puic when checked out separately + ( export QTDIR, then: + $QTDIR/bin/qmake -makefile puic.pro && make && make install ) + +2003-05-30 01:36 germaingarand + + * perleditor/: listeditor.ui.h, objectbrowser.cpp, objectbrowser.h, + perlaction.cpp, perlaction.h, perlcompletion.cpp, perleditor.cpp: + + - fixed a bug in function arguments completion + - turnaround for a Designer bug (it wouldn't mark current form as modified in some circumstances) + - small bugfixes and code cleanup + +2003-05-28 22:17 germaingarand + + * perleditor/: preferenceinterfaceimpl.cpp, syntaxhighliter_perl.h: + + - gcc-2.9x fixes + +2003-05-28 18:30 germaingarand + + * perleditor/: mainfilesettings.ui.h, perlaction.cpp, + projectsettings.ui.h, projectsettingsinterfaceimpl.cpp, + yyindent.cpp: + + - rewrote the project settings saving code (had overlooked the nice customSetting interface) + +2003-05-28 04:58 germaingarand + + * perleditor/: README, actioninterfaceimpl.cpp, + actioninterfaceimpl.h, common.cpp, common.h, + editorinterfaceimpl.cpp, editorinterfaceimpl.h, + languageinterfaceimpl.cpp, listeditor.h, mainfilesettings.h, + mainfilesettings.ui, mainfilesettings.ui.h, objectbrowser.cpp, + objectbrowser.h, perlaction.cpp, perlaction.h, perlcompletion.cpp, + perlcompletion.h, perleditor.cpp, perleditor.h, perleditor.pro, + perlmainprojectfile.cpp, perlmainprojectfile.h, pqtapiprocess.cpp, + pqtapiprocess.h, preferences.h, projectsettings.h, + projectsettings.ui, projectsettings.ui.h, + projectsettingsinterfaceimpl.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp: + + - implemented "Build and run project". One can now fully develop/test/run a PerlQt program without ever using + a console. This is VB on steroids :) + - added an application template + - project settings looks OK. Would need some testing usability wise though + - lot of bugfixes + +2003-05-26 21:28 germaingarand + + * puic/main.cpp: + + - bumping version to 0.6main.cpp + +2003-05-26 21:25 germaingarand + + * puic/form.cpp: + + - adding "# line" directive to ui.pm + +2003-05-26 19:41 germaingarand + + * perleditor/: actioninterfaceimpl.cpp, actioninterfaceimpl.h, + common.cpp, common.h, imagefactory.h, languageinterfaceimpl.cpp, + listeditor.h, mainfilesettings.h, perlaction.cpp, perlaction.h, + perleditor.cpp, perleditor.h, perleditor.pro, preferences.h, + projectsettings.h, slotfuncdia.h, images/perlqt.png, + images/perlqtblue.png, images/perlqtblue2.png: + + - added PerlQt Menu/toolbar ("Run form/run project" triggers puic->perl) + - "run project" not yet implemented + - "Run Form" can be accessed also with RMB on source code + - When Form is run through Perl, STDOUT/STDERR are captured and redirected to the Designer's + Output Window + - Perl syntax errors and warnings show up with correct line number/ FormFile name, thanks to + '# line \d+ "foo"' magic :-) + - some icons + +2003-05-26 00:57 germaingarand + + * perleditor/: languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, perleditor.cpp, perleditor.h, + pqtapiprocess.cpp, designer_3.1_patches/resource.cpp.diff: + + - added "Build and Run this form with perl" RMB option + - code cleanup + +2003-05-25 15:31 germaingarand + + * perleditor/: README, imagefactory.h, languageinterfaceimpl.cpp, + objectbrowser.cpp, perlcompletion.cpp, images/editcut.png: + + README + +2003-05-25 15:30 germaingarand + + * perleditor/designer_3.1_patches/: designerappiface.cpp.diff, + mainwindowactions.cpp.diff, resource.cpp.diff: + + - needed Designer 3.1 patches + (hopefully not for long, as discussion with Marius B. Monsen from Trolltech could lead to having + those issues fixed in 3.2) + +2003-05-25 15:27 germaingarand + + * perleditor/images/filenew.png: + + images/editcut.png + +2003-05-23 23:35 germaingarand + + * perleditor/: completion.cpp, listeditor.h, perlcompletion.cpp, + perlcompletion.h, pqtapiprocess.cpp, projectsettings.h, + slotfuncdia.h, slotfuncdia.ui, slotfuncdia.ui.h: + + - invalidate "function" radio if user input obviously describes a slot. + - better auto-completion: methods, statics and enums are all in. Yay! + (might need some optims, I'm on a 2400+ box now ;-P) + +2003-05-23 16:23 germaingarand + + * PerlQt/bin/pqtapi: + + - added option 'p' for including inherited methods of 'class' in results + - option 'm' is for communication with the Designer Plugin (for code completion) + +2003-05-23 09:39 germaingarand + + * perleditor/: listeditor.cpp, mainfilesettings.cpp, + preferences.cpp, projectsettings.cpp, slotfuncdia.cpp: + + those are auto-generated + +2003-05-22 21:34 germaingarand + + * perleditor/: completion.cpp, editor.h, parenmatcher.cpp, + parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h, + globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h, + projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp, + completion.h, languageinterfaceimpl.h, listeditor.h, + mainfilesettings.cpp, pqtapiprocess.h, preferences.ui, + syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h, + conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui, + listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h, + paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h, + perleditor.h, perlindent.cpp, perlqt.cpp, + preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h, + syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp, + yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h, + editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp, + imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp, + preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h, + browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h, + listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp, + perleditor.pro, pqtapiprocess.cpp, + projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h, + variabledialog.ui, images/editslots.png, images/folder.png, + interfaces/actioninterface.h, interfaces/classbrowserinterface.h, + interfaces/designerinterface.h, interfaces/editorinterface.h, + interfaces/filterinterface.h, interfaces/interpreterinterface.h, + interfaces/languageinterface.h, interfaces/preferenceinterface.h, + interfaces/programinterface.h, interfaces/projectsettingsiface.h, + interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h, + interfaces/widgetinterface.h: + + Initial import of the PerlQt plugin for Qt Designer + +2003-05-22 21:34 germaingarand + + * perleditor/: completion.cpp, editor.h, parenmatcher.cpp, + parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h, + globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h, + projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp, + completion.h, languageinterfaceimpl.h, listeditor.h, + mainfilesettings.cpp, pqtapiprocess.h, preferences.ui, + syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h, + conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui, + listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h, + paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h, + perleditor.h, perlindent.cpp, perlqt.cpp, + preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h, + syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp, + yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h, + editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp, + imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp, + perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp, + preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h, + sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h, + browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h, + listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp, + perleditor.pro, pqtapiprocess.cpp, + projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h, + variabledialog.ui, images/editslots.png, images/folder.png, + interfaces/actioninterface.h, interfaces/classbrowserinterface.h, + interfaces/designerinterface.h, interfaces/editorinterface.h, + interfaces/filterinterface.h, interfaces/interpreterinterface.h, + interfaces/languageinterface.h, interfaces/preferenceinterface.h, + interfaces/programinterface.h, interfaces/projectsettingsiface.h, + interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h, + interfaces/widgetinterface.h: + + Initial revision + +2003-05-22 04:58 germaingarand + + * puic/: form.cpp, subclassing.cpp: + + - support for the Designer's PerlQt plugin + - patch by Terrence (Terry) Fleury <tfleury@ncsa.uiuc.edu> + for incluson of "Use" directives (also supported by the plugin, and stored + in the same structure) + - DESTROY really ought to call SUPER->DESTROY + +2003-05-11 01:41 germaingarand + + * puic/: widgetdatabase.cpp, widgetdatabase.h: + + -updated the widget database (fix for #731881) + +2003-04-15 23:03 germaingarand + + * doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html: + + -documenting new marshallers + +2003-04-15 22:43 germaingarand + + * configure.in, PerlQt/Qt.pm: + + bumping version number to 3.007 + +2003-04-15 16:07 germaingarand + + * PerlQt/: handlers.cpp, Qt.pm, smokeperl.h: + + - added 8 marshallers for Q*List classes: + QWidgetList, QCanvasItemList, QObjectList, QPtrList<QTab>, QPtrList<QToolBar>, + QPtrList<QDockWindow>, QPtrList<QNetworkOperation>, QFileInfoList + +2003-04-15 16:04 germaingarand + + * smoke/qt/Makefile.am: + + bumping revision number + +2003-04-15 16:02 germaingarand + + * kalyptus/kalyptusCxxToSmoke.pm: + + disabling 3 template derived classes, now handled by marshallers + +2003-04-06 16:40 germaingarand + + * admin/: Doxyfile.am, Doxyfile.global, acinclude.m4.in, am_edit, + cvs.sh, debianrules, detect-autoconf.sh, Makefile.common, + libtool.m4.in, nmcheck: + + updating admin dir + +2003-03-08 19:03 germaingarand + + * PerlQt/bin/pqtsh: + + disable strict in eval + +2003-03-03 14:37 germaingarand + + * puic/: main.cpp, object.cpp: + + skip 'database' property (doesn't exist anymore), thanks to Michael Traxler for pointing that one + +2003-02-22 13:43 germaingarand + + * puic/object.cpp: + + temporary font objects where incorrect + +2003-02-22 13:05 germaingarand + + * puic/uic.cpp: + + + else if ( attrib == "resizeable" || attrib == "resizable" ) + +2003-02-19 17:14 germaingarand + + * Makefile.PL: + + getting rid of Automake dependancy + +2003-02-19 17:01 germaingarand + + * PerlQt/bin/pqtsh: + + - redirect STDOUT/STDERR to shell window (patch by Stéphane Payrard<stef@payrard.net>) + - fixed troubles with line breaks and Qt-3.1 + - discard empty lines on save + +2003-02-19 13:44 germaingarand + + * smoke/qt/Makefile.am, smoke/qt/generate.pl.in, + smoke/qt/qtguess.pl.in, kalyptus/kalyptus, + kalyptus/kalyptusCxxToSmoke.pm: + + getting rid of GNU toolchain dependancy at last :) + @@ -0,0 +1,44 @@ + +Though this package uses GNU's Autoconf framework, +it is recommended to use the Makefile.PL wrapper +to drive the ./configure script. + +perl Makefile.PL [options] +make +make test +su -c 'make install' + + +===== + +Custom important options : + +--prefix=<path to KDE3 root directory, or final install prefix> + +--with-qt-dir=<path to QT3 root directory> + +--without-Mesa : when detecting OpenGL support, check for a proprietary GL + library (e.g NVidia) and not for the MesaGL library. + +--disable-GL : do not compile OpenGL classes into the Smoke interface + library + +--enable-smoke : force generation and compilation of the Smoke library, + even if it has been detected on your system + +--with-threshold=<0..15> : set the lever of standardness of your Qt + library. Default is 10, which is reasonable. + If your Qt library is very customized, and you + experience missing symbols in libsmokeqt.so, + set this to zero (paranoid level). +==== + +See doc/en/index.html for installation procedure, requirements and +detailed tutorial. + +See also PerlQt/tutorials and PerlQt/examples to get started. + + + + + diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..fa18b9f --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,139 @@ +#!/usr/bin/perl -w + +# +# This Makefile.PL is an interface to ./configure intended to be used +# by automatic CPAN builds. It just checks that some needed environment +# variables are set and eventually tries to guess their value... +# +# You should use it instead of the ./configure program ; +# it accepts the same options. +# + +use strict; + +my $libname = "libqt-mt.so"; +my @prefix = ('/usr', '/usr/local'); + +my $res=""; +my %p; +my @alt; + +exec "./configure --help" if grep /^-?-h(elp)?$/, @ARGV; + +unless ($ENV{'QTDIR'} or grep /--with-qt-dir/, @ARGV) +{ + print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n". + " Your QTDIR environment variable is not set and you\n". + "did not use the '--with-qt-dir=' commandline option.\n". + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"; + print "Nevermind, I'll try to guess Qt's location.\n"; + sleep(6); + for(@prefix) + { + my $stdpath = $_."/lib/qt3/lib"; + if(-s $stdpath."/$libname") + { + push @alt, glob($stdpath."/$libname*"); + print "Found what looks like a Qt-3 tree in $_/lib/qt3\n"; + sleep(1); + } + } + + unless (@alt) + { + @alt=`locate $libname 2>/dev/null`; + + if(!check_exit_status($?) || !@alt) + { + print "mmh... locate did not help. We'll try a find then.\n"; + sleep(2); + + print "Scanning local file system (ctrl-c to abort)...\n"; + @alt=`find / -name "$libname*" 2>/dev/null`; + } + } + + if(!check_exit_status($?) || !@alt) + { + print "Still no luck... I'll give up and let ./configure work it out\n"; + } + elsif(@alt>1) + { + print "We have several answers. I'll try to discriminate a bit...\n"; + sleep(3); + for(@alt) { /(.*)\/lib\// and $p{$1}++ } + if(keys %p == 1) + { + $res = each %p; + } + else + { + my ($ver,$tmp)=(0,0); + for(@alt) + { + /$libname(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?$/o; + $tmp = (($1?$1:0)*100)+(($2?$2:0)*10)+($3?$3:0); + if($tmp>=$ver) + { + $ver = $tmp; + $res = (/(.*)\/lib\//)[0] + } + } + $res = each %p if keys %p ==1; + } + print $res?"OK. We can try --with-qt-dir=$res.\n":"No, that's too fuzzy. I'll give up and let ./configure decide.\n"; + } + else + { + ($res=$alt[0])=~s|(.*)/lib/.*|$1|; + print "Fine. We'll try with --with-qt-dir=$res.\n"; + } + sleep(3); +} + +unshift(@ARGV, "--with-qt-dir=$res") if $res; + +unless ($ENV{'KDEDIR'} or grep /--prefix/, @ARGV) +{ + print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n". + " Your KDEDIR environment variable is not set and you\n". + "did not use the '--prefix=' commandline option.\n"; + print "KDE-3 isn't required at all. However, if it's installed on your system,\n". + "it is much better to specify it's location since PerlQt uses (or build, if\n". + "it can't find it) a KDE library named smokeqt.\n"; + print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"; + sleep(5); +} + +print "\nNow starting ./configure ...\n\n"; + +exec join " ", "./configure", @ARGV; + +#--------------------------------------------------------------# + +sub check_exit_status +{ + my $a = 0xFFFF & shift; + if( !$a ) + { + return 1; + } + elsif( $a == 0xFF00 ) + { + #die "\nSystem call failed: $!\n"; + } + elsif( $a > 0x80 ) + { + # non-zero status. + } + else + { + if( $a & 0x80 ) + { + #die "\nProgram coredumped with signal ". ($a & ~0x80); + } + die "\nProgram interrupted by signal $a\n"; + } + return 0; +} + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..55d68c4 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,33 @@ + +SUBDIRS = $(TOPSUBDIRS) + +EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO Makefile.cvs test.pl Makefile.PL inst-apps smoke/smoke.h smoke/Makefile.in smoke/Makefile.am smoke/qt/qtguess.pl.in smoke/qt/generate.pl.in smoke/qt/qt_smoke.h smoke/qt/generate_makefile_am.pl smoke/qt/Makefile.am smoke/qt/Makefile.in smoke/qt/header_list kalyptus/Ast.pm kalyptus/kalyptus kalyptus/kalyptusDataDict.pm kalyptus/kdocParseDoc.pm kalyptus/Version kalyptus/ChangeLog kalyptus/kdocUtil.pm kalyptus/kdocAstUtil.pm kalyptus/README kalyptus/Iter.pm kalyptus/kalyptusCxxToSmoke.pm kalyptus/kdocLib.pm kalyptus/TODO doc/en/index.html doc/en/Makefile doc/en/PerlQt.pod doc/fr/index.html doc/fr/Makefile doc/fr/PerlQt.pod doc/css/pod.css doc/images/ex1.png doc/images/ex2.png doc/images/pqtsh.png + +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign + +# $(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs +# cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs + +test: + cd $(top_distdir) && LD_LIBRARY_PATH="../../smoke/qt/.libs:@qt_libraries@" PERL_DL_NONLAZY=1 perl test.pl + +ChangeLog: + perl cvs2cl.pl -P -S --no-wrap -f ChangeLog.CVS diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..be59a86 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,14 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + @if test ! -d admin; then \ + echo "Please recheckout this module!" ;\ + echo "for cvs: use checkout once and after that update again" ;\ + echo "for cvsup: checkout kde-common from cvsup and" ;\ + echo " link kde-common/admin to ./admin" ;\ + exit 1 ;\ + fi + $(MAKE) -f admin/Makefile.common cvs + +.SILENT: diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..5d38411 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,709 @@ +# Makefile.in generated by automake 1.7.2 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 1.3 $ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_HAVE_GL = @KDE_HAVE_GL@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ +KDE_MT_LIBS = @KDE_MT_LIBS@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBRESOLV = @LIBRESOLV@ +LIBS = @LIBS@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBZ = @LIBZ@ +LIB_POLL = @LIB_POLL@ +LIB_QPE = @LIB_QPE@ +LIB_QT = @LIB_QT@ +LIB_X11 = @LIB_X11@ +LIB_XEXT = @LIB_XEXT@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MOC = @MOC@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +QTE_NORTTI = @QTE_NORTTI@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RPATH = @USE_RPATH@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +kde_includes = @kde_includes@ +kde_libraries = @kde_libraries@ +kde_qtver = @kde_qtver@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +qt_test_threshold = @qt_test_threshold@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ + +SUBDIRS = $(TOPSUBDIRS) + +EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO Makefile.cvs test.pl Makefile.PL inst-apps smoke/smoke.h smoke/Makefile.in smoke/Makefile.am smoke/qt/qtguess.pl.in smoke/qt/generate.pl.in smoke/qt/qt_smoke.h smoke/qt/generate_makefile_am.pl smoke/qt/Makefile.am smoke/qt/Makefile.in smoke/qt/header_list kalyptus/Ast.pm kalyptus/kalyptus kalyptus/kalyptusDataDict.pm kalyptus/kdocParseDoc.pm kalyptus/Version kalyptus/ChangeLog kalyptus/kdocUtil.pm kalyptus/kdocAstUtil.pm kalyptus/README kalyptus/Iter.pm kalyptus/kalyptusCxxToSmoke.pm kalyptus/kdocLib.pm kalyptus/TODO doc/en/index.html doc/en/Makefile doc/en/PerlQt.pod doc/fr/index.html doc/fr/Makefile doc/fr/PerlQt.pod doc/css/pod.css doc/images/ex1.png doc/images/ex2.png doc/images/pqtsh.png + +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = PerlQt/Makefile.PL +DIST_SOURCES = + +#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ +#>- ps-recursive install-info-recursive uninstall-info-recursive \ +#>- all-recursive install-data-recursive install-exec-recursive \ +#>- installdirs-recursive install-recursive uninstall-recursive \ +#>- check-recursive installcheck-recursive +#>+ 5 +#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ +#>- ps-recursive install-info-recursive uninstall-info-recursive \ +#>- all-recursive install-data-recursive install-exec-recursive \ +#>- installdirs-recursive install-recursive uninstall-recursive \ +#>- check-recursive installcheck-recursive nmcheck-recursive +#>+ 5 +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive nmcheck-recursive bcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in TODO acinclude.m4 aclocal.m4 admin/ChangeLog \ + admin/compile admin/config.guess admin/config.sub admin/depcomp \ + admin/install-sh admin/ltmain.sh admin/missing \ + admin/mkinstalldirs admin/ylwrap config.h.in configure \ + configure.in +DIST_SUBDIRS = $(SUBDIRS) +#>- all: config.h +#>+ 1 +all: docs-am config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --foreign Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/config.h.in + +distclean-hdr: + -rm -f config.h stamp-h1 +PerlQt/Makefile.PL: $(top_builddir)/config.status $(top_srcdir)/PerlQt/Makefile.PL.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=cvs2cl.pl stamp-h.in subdirs ChangeLog.CVS.delta ChangeLog.CVS + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/PerlQt $(distdir)/admin $(distdir)/doc/css $(distdir)/doc/en $(distdir)/doc/fr $(distdir)/doc/images $(distdir)/kalyptus $(distdir)/smoke $(distdir)/smoke/qt + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive dist dist-all dist-gzip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + +# $(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs +# cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs + +test: + cd $(top_distdir) && LD_LIBRARY_PATH="../../smoke/qt/.libs:@qt_libraries@" PERL_DL_NONLAZY=1 perl test.pl + +ChangeLog: + perl cvs2cl.pl -P -S --no-wrap -f ChangeLog.CVS +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/Makefile.in + + +#>+ 5 +bcheck: bcheck-recursive + +bcheck-am: + + +#>+ 2 +final: + $(MAKE) all-am +#>+ 2 +final-install: + $(MAKE) install-am +#>+ 2 +no-final: + $(MAKE) all-am +#>+ 2 +no-final-install: + $(MAKE) install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/PerlQt/INSTALL b/PerlQt/INSTALL new file mode 100644 index 0000000..bd4a724 --- /dev/null +++ b/PerlQt/INSTALL @@ -0,0 +1,82 @@ +PerlQt is distributed under the GPL. Development is coordinated on the +kde-perl@mail.kde.org mailing-list. To subscribe, visit +http://mail.kde.org/mailman/listinfo/kde-perl or send a subscribe message +to kde-perl-request@mail.kde.org. Please send patches and bug reports +to the mailing-list. + +This file contains instructions for downloading and building the SmokeQt +library and PerlQt. PerlQt is not a direct Perl interface to the Qt +library, but is rather an interface to the SmokeQt library generated by +Kalyptus. + +The programs+version I use, but not necessarily required: +Linux (oddly enough, most of the developers use Mandrake) +Perl-5.6.0 or above (tested up to 5.8.0-RC1) +Qt-3.0.1 or above (untested with 3.0.0, should work though) +automake-1.5 (KDE requires recent automake) +autoconf-2.53 (KDE requires recent autoconf) + +Make sure your $QTDIR environment-variable is set. + +I'm sorry for all the requirements, but you *are* getting this from +CVS. Release versions will be much easier and more independant. + +First, you need to download the development environment for smokeqt. +Please use compression for cvs downloads ('cvs -z4' in .cvsrc). + +$ export CVSROOT=:pserver:anonymous@anoncvs.kde.org:/home/kde +$ cvs login # no password +$ cvs co -l kdebindings # downloads configure/makefile stubs +$ cvs co kdebindings/kalyptus # for generating smoke files from scratch +$ cvs co kdebindings/smoke # pre-generated smoke library +$ cd kdebindings # kdebindings/ +$ cvs co admin # get kde build tools + +At this point, you now have the full smokeqt environment. The +pre-generated smoke library is based off KDE's copy of Qt-3.0.4. I have +Qt-3.0.1, so I have to re-generate the files to match my installed +version of Qt. Here's how to do it. + +$ cd smoke/qt # kdebindings/smoke/qt/ +$ perl ./qtguess.pl # simple script to find disabled Qt features +$ perl ./generate.pl # calls kalyptus which generates code + +Now you have the SmokeQt source-code generated for your personal Qt +configuration. Here's how to compile. + +$ cd ../.. # kdebindings/ +$ make -f Makefile.cvs # create ./configure, will croak but succeed +$ ./configure # use --prefix or whatever options you want +$ cd smoke # kdebindings/smoke/ +$ make # this should succeed +$ make install # will install to --prefix from configure + +Okay, you now have libsmokeqt installed on your system. You can now +compile PerlQt. First, get the latest version of PerlQt-3. + +$ export CVSROOT=:pserver:anonymous@cvs.perlqt.sf.net:/cvsroot/perlqt +$ cvs login # no password +$ cvs co PerlQt-3 +$ cd PerlQt-3 # PerlQt-3/ + +If you installed libsmokeqt in a non-standard library path, you will +need to edit Makefile.PL and add -L/your/lib/path to the LIBS +parameter. If any of the other options in Makefile.PL need changing for +your system, you will need to change it now. + +$ perl Makefile.PL +$ make + +Now PerlQt is built on your system. To test it out: + +$ cd tutorials # PerlQt-3/tutorials/ +$ perl runall.pl + +All 14 tutorials should run in order. As you close one program out by +clicking Quit or the window close button, the next should start. If all 14 +tutorials run without error and work like the C++ version, PerlQt is built +correctly and you can make install if you wish. If an error occurs which +you can't fix, contact the kde-perl mailing list and make a bug report. + +Good luck, +Ashley Winters <qaqortog@nwlink.com> diff --git a/PerlQt/MANIFEST b/PerlQt/MANIFEST new file mode 100644 index 0000000..d52681c --- /dev/null +++ b/PerlQt/MANIFEST @@ -0,0 +1,82 @@ +INSTALL +MANIFEST +Makefile.PL.in +Qt.pm +Qt.xs +Qt.pod +bin/pqtapi +bin/pqtsh +examples/aclock/AnalogClock.pm +examples/aclock/aclock.pl +examples/buttongroups/ButtonsGroups.pm +examples/buttongroups/buttongroups.pl +examples/dclock/DigitalClock.pm +examples/dclock/dclock.pl +examples/drawdemo/drawdemo.pl +examples/drawlines/drawlines.pl +examples/forever/forever.pl +examples/network/httpd/httpd.pl +examples/opengl/README +examples/opengl/box/GLBox.pm +examples/opengl/box/glbox +examples/opengl/gear/gear +examples/progress/progress.pl +examples/richedit/imageCollection.pm +examples/richedit/richedit.pl +handlers.cpp +lib/Qt/attributes.pm +lib/Qt/debug.pm +lib/Qt/enumerations.pm +lib/Qt/isa.pm +lib/Qt/constants.pm +lib/Qt/properties.pm +lib/Qt/signals.pm +lib/Qt/slots.pm +lib/Qt/GlobalSpace.pm +marshall.h +perlqt.h +smokeperl.cpp +smokeperl.h +t/My/Codec.pm +t/My/SubCodec.pm +t/Foo/SubCodec.pm +t/a_loading.t +t/b_nogui.t +t/c_qapp.t +t/ca_i18n.t +t/d_sigslot.t +t/e_sigslot_inherit.t +t/f_import.t +t/g_gui.t +tutorials/runall.pl +tutorials/t1/t1.pl +tutorials/t10/CannonField.pm +tutorials/t10/LCDRange.pm +tutorials/t10/t10.pl +tutorials/t11/CannonField.pm +tutorials/t11/LCDRange.pm +tutorials/t11/t11.pl +tutorials/t12/CannonField.pm +tutorials/t12/LCDRange.pm +tutorials/t12/t12.pl +tutorials/t13/CannonField.pm +tutorials/t13/GameBoard.pm +tutorials/t13/LCDRange.pm +tutorials/t13/t13.pl +tutorials/t14/CannonField.pm +tutorials/t14/GameBoard.pm +tutorials/t14/LCDRange.pm +tutorials/t14/t14.pl +tutorials/t2/t2.pl +tutorials/t3/t3.pl +tutorials/t4/t4.pl +tutorials/t5/t5.pl +tutorials/t6/t6.pl +tutorials/t7/LCDRange.pm +tutorials/t7/t7.pl +tutorials/t8/CannonField.pm +tutorials/t8/LCDRange.pm +tutorials/t8/t8.pl +tutorials/t9/CannonField.pm +tutorials/t9/LCDRange.pm +tutorials/t9/t9.pl diff --git a/PerlQt/Makefile.PL.in b/PerlQt/Makefile.PL.in new file mode 100644 index 0000000..e848160 --- /dev/null +++ b/PerlQt/Makefile.PL.in @@ -0,0 +1,223 @@ + +### do not edit Makefile.PL, edit Makefile.PL.in + +use Config; +use File::Spec; +use strict; + +my %x; +$x{'prefix'} = '@prefix@'; +$x{'exec_prefix'}='@exec_prefix@'; +$x{'libdir'} = '@libdir@'; +$x{'datadir'} = '@datadir@'; +$x{'qt_libraries'} = '@qt_libraries@'; +$x{'LIBPNG'} = '@LIBPNG@'; +$x{'LIBJPEG'} = '@LIBJPEG@'; +$x{'LIBSM'} = '@LIBSM@'; +$x{'LIBSOCKET'} = '@LIBSOCKET@'; +$x{'LIBRESOLV'} = '@LIBRESOLV@'; +$x{'LIB_X11'} = '@LIB_X11@'; +$x{'X_PRE_LIBS'} = '@X_PRE_LIBS@'; + +interpolate('LIB_X11', 'exec_prefix', 'libdir', 'datadir'); + +my $objects='Qt$(OBJ_EXT) handlers$(OBJ_EXT)'; +my $qtlib ='@LIB_QT@'; + +interpolate(\$qtlib); + +my $rpath='@USE_RPATH@'; + +my $cxx = '@CXX@'; +my $sh= '@SHELL@'; +my $topdir= '@top_builddir@'; +if($^O =~ /solaris/i && $cxx eq 'CC') { + # we have Forte/Sunworkshop on Solaris + # do we build only static libs? + my $only_static = 0; + foreach(`$topdir/libtool --config 2>&1`) { + /^build_libtool_libs=no/ && $only_static++; + /^build_old_libs=yes/ && $only_static++; + } + # ...then add the C++ runtime lib + $qtlib .= ' -lCrun' if($only_static == 2); +} + +my $libtool = File::Spec->catfile( $topdir, "libtool" ); +my $devnull = File::Spec->devnull(); +my $libtool_rpath = `$libtool --mode=link $cxx -o foo.so foo.o -R $x{'libdir'} -R $x{'qt_libraries'} 2>${devnull}`; +$libtool_rpath = "" unless $libtool_rpath =~ s/.*foo.so foo.o//s; +chomp $libtool_rpath; +$rpath = $rpath eq "yes" ? + ($libtool_rpath ? + $libtool_rpath : + ('@CXX@' eq 'g++' ? + "-Wl,--rpath -Wl,$x{'libdir'} -Wl,--rpath -Wl,$x{'qt_libraries'}" : "" + ) + ) : ""; + +my @scripts = ("bin/pqtsh", "bin/pqtapi"); + +my $cxxflags = '@CXXFLAGS@'; + $cxxflags =~ s/ -pedantic / /g; + $cxxflags =~ s/ -Wwrite-strings / /g; + $cxxflags =~ s/ -Wall / /g; + +my $doc_dir_glob; + +### + +use ExtUtils::MakeMaker; +use Cwd; + +my $pwd = getcwd; +my @pwd = File::Spec->splitdir( $pwd ); +pop @pwd; +my $abs_topdir = File::Spec->catdir(@pwd); +my $localsmoke = File::Spec->catdir($abs_topdir,"smoke","qt",".libs"); + + +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. + +WriteMakefile( + 'NAME' => 'Qt', + 'VERSION_FROM' => 'Qt.pm', # finds $VERSION + 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1, + 'INC' => '@all_includes@ -I. -I../smoke', + 'LIBS' => ['@all_libraries@'." -L$localsmoke -lsmokeqt ".'@LIBCRYPT@'." $qtlib"], +# 'XS' => {'Qt.xs' => 'Qt.cpp'}, # does not work ... still expects Qt.c + 'XSOPT' => "-C++", + 'OBJECT' => "$objects", # Object files + 'CC' => '@CXX@', + # use the CC/g++ utility to link if linking is done with cc/gcc + ($Config{ld} =~ /cc/ ? ( + 'LD' => '@CXX@' + ) : ()), + 'INST_BIN' => './bin', + 'DEFINE' => $cxxflags, + 'H' => ["marshall.h", "perlqt.h", "smokeperl.h"], + 'ABSTRACT' => "An OO interface to Trolltech's Qt toolkit", + 'dynamic_lib' => {'OTHERLDFLAGS' => $rpath}, + ($] >= 5.005 ? ## Add these new keywords supported since 5.005 + ( + AUTHOR => 'Ashley Winters <qaqortog@nwlink.com>') : ()), +); + +sub MY::clean { + package MY; + my $i = shift->SUPER::clean(@_); + my $pl = '$(PERL) Makefile.PL'; + $i =~ s/\n+$/\n\t$pl$&/s; + $i; +} + +sub MY::const_loadlibs { + package MY; + my $i = shift->SUPER::const_loadlibs(@_); + # hacks for linking against a non-yet-installed smoke + $i =~ s/((?:EXTRALIBS|LDLOADLIBS).*?)\n/$1 -L$localsmoke -lsmokeqt\n/gs unless $i =~/-lsmokeqt/; + $i =~ s#(LD_RUN_PATH.*?)(${localsmoke})?\n#"$1".($2?"":":")."$x{'libdir'}\n"#se; + $i; +} + +sub MY::dist { + package MY; + my $i = shift->SUPER::dist(@_); + $i =~ s#(DISTVNAME =).*?\n#$1 \$(distdir)\n#s; + $i; +} + +sub MY::install { + package MY; + my $i = shift->SUPER::install(@_); + my $lng = $ENV{LANG}; + my $doc_dir = "/usr/share/doc/libqt-perl/tutorial"; + my $src= File::Spec->catdir(File::Spec->updir, "doc"); + my $found = 0; + # for my $l( split(":", $lng) ) + # { + # $l =~ s/^(.*?)_.*$/$1/; + # $l = lc($l); + # if( $l and -d File::Spec->catdir( $src, $l ) ) + # { + # $src = File::Spec->catdir( $src, $l); + # $found++; + # last; + # } + # } + $i =~ s/^install\s+::\s+all.*$/$& install_my_perlqt_doc/m; + # $src = File::Spec->catdir( $src, "en" ) unless $found; + $i .= "\ninstall_my_perlqt_doc:\n". + "\t\@echo Installing documentation in ${doc_dir}\n". + "\t\@$^X -MExtUtils::Install -MConfig -e \\\n". + "\t\t'install({ \"$src\" => \"\$(PREFIX)/share/doc/libqt-perl/tutorial\" },0,0)' \$(DEV_NULL)\n"; + $doc_dir_glob = $doc_dir; + $i; +} + +sub interpolate +{ + for( @_ ) + { + my $r = ref( $_ ) ? $_ : \$x{"$_"}; + $$r =~ s/\$\(\s*(.*?)\s*\)/$x{$1}/g; + $$r =~ s/\$\{\s*(.*?)\s*\}/$x{$1}/g; + } +} + +######### + +for my $s( @scripts ) +{ + MY->fixin( $s ); + chmod 0755, $s; +} + +open(IN, ">Qt.pod") or die "couldn't write Qt.pod: $!\n"; +print IN <<STOP; + +=head1 NAME + +PerlQt - Perl interface to the Qt GUI Widget toolkit + +=head1 Qt + +Given the huge size of the Qt module +(more than 400 classes and 13000 methods) +it doesn't have any formal documentation. + +Instead, it provides two introspection tools + +=over 4 + +=item * pqtapi: + +a command line PerlQt API introspector + +=item * pqtsh: + +a graphical PerlQt shell + +=back + +and a detailed B<tutorial> with comprehensive +explanations. +This is where anyone new to PerlQt +should start. + +The tutorial has been originally installed +on this system in C<$doc_dir_glob>, in both B<POD> and +B<HTML> format. + +For a complete IDE allowing RAD and visual programming, +check the pqt-designer package. + +--- The PerlQt team + +http://perlqt.sf.net - PerlQt Project Homepage + +=cut +STOP +close IN; + diff --git a/PerlQt/Qt.pm b/PerlQt/Qt.pm new file mode 100644 index 0000000..01a08e8 --- /dev/null +++ b/PerlQt/Qt.pm @@ -0,0 +1,1109 @@ +package Qt::base; +use strict; + +sub this () {} + +sub new { + no strict 'refs'; + my $t = this; + shift->NEW(@_); + my $ret = this; + Qt::_internal::setThis($t); + return $ret; +} + +package Qt::base::_overload; +use strict; + +no strict 'refs'; +use overload + "fallback" => 1, + "==" => "Qt::base::_overload::op_equal", + "!=" => "Qt::base::_overload::op_not_equal", + "+=" => "Qt::base::_overload::op_plus_equal", + "-=" => "Qt::base::_overload::op_minus_equal", + "*=" => "Qt::base::_overload::op_mul_equal", + "/=" => "Qt::base::_overload::op_div_equal", + ">>" => "Qt::base::_overload::op_shift_right", + "<<" => "Qt::base::_overload::op_shift_left", + "<=" => "Qt::base::_overload::op_lesser_equal", + ">=" => "Qt::base::_overload::op_greater_equal", + "^=" => "Qt::base::_overload::op_xor_equal", + "|=" => "Qt::base::_overload::op_or_equal", + ">" => "Qt::base::_overload::op_greater", + "<" => "Qt::base::_overload::op_lesser", + "+" => "Qt::base::_overload::op_plus", + "-" => "Qt::base::_overload::op_minus", + "*" => "Qt::base::_overload::op_mul", + "/" => "Qt::base::_overload::op_div", + "^" => "Qt::base::_overload::op_xor", + "|" => "Qt::base::_overload::op_or", + "--" => "Qt::base::_overload::op_decrement", + "++" => "Qt::base::_overload::op_increment", + "neg"=> "Qt::base::_overload::op_negate"; + +sub op_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator=='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator=='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_not_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator!='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator!='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_plus_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator+='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator+='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_minus_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator-='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator-='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_mul_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator*='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator*='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_div_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator/='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator/='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_shift_right { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator>>'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator>>'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_shift_left { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator<<'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator<<'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_lesser_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator<='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + $Qt::_internal::strictArgMatch = 0; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator<='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_greater_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator>='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator>='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_xor_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator^='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator^='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_or_equal { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator|='; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return ($_[2] ? $_[1] : $_[0]) unless $err = $@; + my $ret; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator|='; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_greater { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator>'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator>'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_lesser { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator<'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator<'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_plus { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator+'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator+'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_minus { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator-'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator-'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_mul { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator*'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator*'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_div { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator/'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator/'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_negate { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator-'; + my $autoload = ref($_[0])."::AUTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->($_[0]) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator-'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload($_[0]) }; + die $err.$@ if $@; + $ret +} + +sub op_xor { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator^'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator^'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_or { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator|'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my ($ret, $err); + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $ret = $autoload->(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + $Qt::_internal::strictArgMatch = 0; + return $ret unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator|'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; $ret = &$autoload(($_[2] ? (@_)[1,0] : (@_)[0,1])) }; + die $err.$@ if $@; + $ret +} + +sub op_increment { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator++'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->($_[0]) }; + $Qt::_internal::strictArgMatch = 0; + return $_[0] unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator++'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; &$autoload($_[0]) }; + die $err.$@ if $@; + $_[0] +} + +sub op_decrement { + $Qt::AutoLoad::AUTOLOAD = ref($_[0]).'::operator--'; + my $autoload = ref($_[0])."::_UTOLOAD"; + my $err; + $Qt::_internal::strictArgMatch = 1; + eval { local $SIG{'__DIE__'}; $autoload->($_[0]) }; + $Qt::_internal::strictArgMatch = 0; + return $_[0] unless $err = $@; + $Qt::AutoLoad::AUTOLOAD = 'Qt::GlobalSpace::operator--'; + $autoload = "Qt::GlobalSpace::_UTOLOAD"; + eval { local $SIG{'__DIE__'}; &$autoload($_[0]) }; + die $err.$@ if $@; + $_[0] +} + +package Qt::_internal; + +use strict; + +our $Classes; +our %CppName; +our @IdClass; + +our @PersistentObjects; # objects which need a "permanent" reference in Perl +our @sigslots; +our $strictArgMatch = 0; + +sub this () {} + + +sub init_class { + no strict 'refs'; + my $c = shift; + my $class = $c; + $class =~ s/^Q(?=[A-Z])/Qt::/; + my $classId = Qt::_internal::idClass($c); + insert_pclassid($class, $classId); + + $IdClass[$classId] = $class; + $CppName{$class} = $c; + Qt::_internal::installautoload("$class"); + { + package Qt::AutoLoad; # this package holds $AUTOLOAD + my $closure = \&{ "$class\::_UTOLOAD" }; + *{ $class . "::AUTOLOAD" } = sub{ &$closure }; + } + + my @isa = Qt::_internal::getIsa($classId); + for my $super (@isa) { + $super =~ s/^Q(?=[A-Z])/Qt::/; + } + # the general base class is Qt::base. + # implicit new(@_) calls are forwarded there. + @isa = ("Qt::base") unless @isa; + *{ "$class\::ISA" } = \@isa; + + Qt::_internal::installautoload(" $class"); + { + package Qt::AutoLoad; + # do lookup at compile-time + my $autosub = \&{ " $class\::_UTOLOAD" }; + *{ " $class\::AUTOLOAD" } = sub { &$autosub }; + } + + *{ " $class\::ISA" } = ["Qt::base::_overload"]; + + *{ "$class\::NEW" } = sub { + my $class = shift; + $Qt::AutoLoad::AUTOLOAD = "$class\::$c"; + my $autoload = " $class\::_UTOLOAD"; + { + no warnings; + # the next line triggers a warning on SuSE's Perl 5.6.1 (?) + setThis(bless &$autoload, " $class"); + } + setAllocated(this, 1); + mapObject(this); + } unless defined &{"$class\::NEW"}; + + *{ $class } = sub { + $class->new(@_); + } unless defined &{ $class }; +} + +sub argmatch { + my $methods = shift; + my $args = shift; + my $i = shift; + my %match; + my $argtype = getSVt($args->[$i]); + for my $methix(0..$#$methods) { + my $method = $$methods[$methix]; + my $typename = getTypeNameOfArg($method, $i); + if($argtype eq 'i') { + if($typename =~ /^(?:bool|(?:(?:un)?signed )?(?:int|long)|uint)[*&]?$/) { + $match{$method} = [0,$methix]; + } + } elsif($argtype eq 'n') { + if($typename =~ /^(?:float|double)$/) { + $match{$method} = [0,$methix]; + } + } elsif($argtype eq 's') { + if($typename =~ /^(?:(?:const )?u?char\*|(?:const )?(?:(Q(C?)String)|QByteArray)[*&]?)$/) { + # the below read as: is it a (Q(C)String) ? ->priority 1 + # is it a (QString) ? -> priority 2 + # neither: normal priority + # Watch the capturing parens vs. non-capturing (?:) + $match{$method}[0] = defined $2 && $2 ? 1 : ( defined $1 ? 2 : 0 ); + $match{$method}[1] = $methix + } + } elsif($argtype eq 'a') { + # FIXME: shouldn't be hardcoded. Installed handlers should tell what perl type they expect. + if($typename =~ /^(?: + const\ QCOORD\*| + (?:const\ )? + (?: + Q(?:String|Widget|Object|FileInfo|CanvasItem)List[\*&]?| + QValueList<int>[\*&]?| + QPtrList<Q(?:Tab|ToolBar|DockWindow|NetworkOperation)>| + QRgb\*| + char\*\* + ) + )$/x) { + $match{$method} = [0,$methix]; + } + } elsif($argtype eq 'r' or $argtype eq 'U') { + $match{$method} = [0,$methix]; + } else { + my $t = $typename; + $t =~ s/^const\s+//; + $t =~ s/(?<=\w)[&*]$//; + my $isa = classIsa($argtype, $t); + if($isa != -1) { + $match{$method} = [-$isa,$methix]; + } + } + } + return sort { $match{$b}[0] <=> $match{$a}[0] or $match{$a}[1] <=> $match{$b}[1] } keys %match; +} + +sub objmatch { + my $method = shift; + my $args = shift; + for my $i(0..$#$args) { + my $argtype = getSVt($$args[$i]); + my $t = getTypeNameOfArg($method, $i); + next if length $argtype == 1; + $t =~ s/^const\s+//; + $t =~ s/(?<=\w)[&*]$//; + return 0 unless classIsa($argtype, $t) != -1; + } + 1; +} + +sub do_autoload { + my $package = pop; + my $method = pop; + my $classId = pop; + + my $class = $CppName{$IdClass[$classId]}; + my @methods = ($method); + for my $arg (@_) { + unless(defined $arg) { + @methods = map { $_ . '?', $_ . '#', $_ . '$' } @methods; + } elsif(isObject($arg)) { + @methods = map { $_ . '#' } @methods; + } elsif(ref $arg) { + @methods = map { $_ . '?' } @methods; + } else { + @methods = map { $_ . '$' } @methods; + } + } + my @methodids = map { findMethod($class, $_) } @methods; +# @methodids = map { findMethod('QGlobalSpace', $_) } @methods +# if (!@methodids and $withObject || $class eq 'Qt'); + + if(@methodids > 1) { + # ghetto method resolution + my $count = scalar @_; + for my $i (0..$count-1) { + my @matching = argmatch(\@methodids, \@_, $i); + @methodids = @matching if @matching or $strictArgMatch; + } + do { + my $c = ($method eq $class)? 4:2; + warn "Ambiguous method call for :\n". + "\t${class}::${method}(".catArguments(\@_).")". + ((debug() && (debug() & $Qt::debug::channel{'verbose'})) ? + "\nCandidates are:\n".dumpCandidates(\@methodids). + "\nTaking first one...\nat " : ""). + (caller($c))[1]." line ".(caller($c))[2].".\n" + } if debug() && @methodids > 1 && (debug() & $Qt::debug::channel{'ambiguous'}); + + } + elsif( @methodids == 1 and @_ ) { + @methodids = () unless objmatch($methodids[0], \@_) + } + unless(@methodids) { + if(@_) { + @methodids = findMethod($class, $method); + do { + do { + my $c = ($method eq $class)? 4:2; + warn "Lookup for ${class}::${method}(".catArguments(\@_). + ")\ndid not yeld any result.\n". + ((debug() && (debug() & $Qt::debug::channel{'verbose'})) ? + "Might be a call for an enumerated value (enum).\n":""). + "Trying ${class}::${method}() with no arguments\nat ". + (caller($c))[1]." line ".(caller($c))[2].".\n" + } if debug() && @_ > 1 && (debug() & $Qt::debug::channel{'ambiguous'}); + @_ = () + } if @methodids; + } + do{ + my $verbose = ""; + if(debug() && (debug() & $Qt::debug::channel{'verbose'})) { + my $alt = findAllMethods( $classId ); + getAllParents($classId, \my @sup); + for my $s(@sup) + { + my $h = findAllMethods( $s ); + map { $alt->{$_} = $h->{$_} } keys %$h + } + my $pat1 = my $pat2 = $method; + my @near = (); + while(!@near && length($pat1)>2) { + @near = map { /$pat1|$pat2/i ? @{ $$alt{$_} }:() } sort keys %$alt; + chop $pat1; + substr($pat2,-1,1)= ""; + } + $verbose = @near ? ("\nCloser candidates are :\n".dumpCandidates(\@near)) : + "\nNo close candidate found.\n"; + } + my $c = ($method eq $class)? 4:2; + + die "--- No method to call for :\n\t${class}::${method}(". + catArguments(\@_).")".$verbose."\nat ".(caller($c))[1]. + " line ".(caller($c))[2].".\n"; + } unless @methodids; + } + setCurrentMethod($methodids[0]); + return 1; +} + +sub init { + no warnings; + installthis(__PACKAGE__); + installthis("Qt::base"); + $Classes = getClassList(); + for my $c (@$Classes) { + init_class($c); + } +} + +sub splitUnnested { + my $string = shift; + my(%open) = ( + '[' => ']', + '(' => ')', + '<' => '>', + '{' => '}', + ); + my(%close) = reverse %open; + my @ret; + my $depth = 0; + my $start = 0; + $string =~ tr/"'//; + while($string =~ /([][}{)(><,])/g) { + my $c = $1; + if(!$depth and $c eq ',') { + my $len = pos($string) - $start - 1; + my $ret = substr($string, $start, $len); + $ret =~ s/^\s*(.*?)\s*$/$1/; + push @ret, $ret; + $start = pos($string); + } elsif($open{$c}) { + $depth++; + } elsif($close{$c}) { + $depth--; + } + } + my $subs = substr($string, $start); + $subs =~ s/^\s*(.*?)\s*$/$1/; + push @ret, $subs if ($subs); + return @ret; +} + +sub getSubName +{ + my $glob = getGV( shift ); + return ( $glob =~ /^.*::(.*)$/ )[0]; +} + +sub Qt::Application::NEW { + my $class = shift; + my $argv = shift; + unshift @$argv, $0; + my $count = scalar @$argv; + setThis( bless Qt::Application::QApplication($count, $argv, @_), " $class" ); + mapObject(this); + setAllocated(this, 1); + setqapp(this); + shift @$argv; +} + +sub Qt::Image::NEW { + no strict 'refs'; + # another ugly hack, whee + my $class = shift; + if(@_ == 6) { + my $colortable = $_[4]; + my $numColors = (ref $colortable eq 'ARRAY') ? @$colortable : 0; + splice(@_, 5, 0, $numColors); + } + + # FIXME: this is evil + $Qt::AutoLoad::AUTOLOAD = 'Qt::Image::QImage'; + my $autoload = " Qt::Image::_UTOLOAD"; + dontRecurse(); + setThis( $autoload->(@_) ); + setAllocated(this, 1); +} + +sub makeMetaData { + my $data = shift; + my @tbl; + for my $entry (@$data) { + my @params; + my $argcnt = scalar @{ $entry->{arguments} }; + for my $arg (@{ $entry->{arguments} }) { + push @params, make_QUParameter($arg->{name}, $arg->{type}, 0, 1); + } + my $method = make_QUMethod($entry->{name}, \@params); + push @tbl, make_QMetaData($entry->{prototype}, $method); + } + my $count = scalar @tbl; + my $metadata = make_QMetaData_tbl(\@tbl); + return ($metadata, $count); +} + +# This is the key function for signal/slots... +# All META hash entries have been defined by /lib/Qt/slots.pm and /lib/Qt/signals.pm +# Thereafter, /lib/Qt/isa.pm build the MetaObject by calling this function +# Here is the structure of the META hash: +# META { 'slot' => { $slotname-1 => { name => $slotname-1, +# arguments => xxx, +# prototype => xxx, +# returns => xxx, +# method => xxx, +# index => <index in 'slots' array>, +# mocargs => xxx, +# argcnt => xxx }, +# ... , +# $slotname-n => ... +# }, +# 'slots' => [ slot1-hash, slot2-hash...slot-n-hash ], +# 'signal' => ibidem, +# 'signals' => ibidem, +# 'superClass' => ["classname1", .."classname-n"] # inherited +# } + +sub getMetaObject { + no strict 'refs'; + my $class = shift; + my $meta = \%{ $class . '::META' }; + return $meta->{object} if $meta->{object} and !$meta->{changed}; + updateSigSlots() if( @sigslots ); + inheritSuperSigSlots($class); + my($slot_tbl, $slot_tbl_count) = makeMetaData($meta->{slots}); + my($signal_tbl, $signal_tbl_count) = makeMetaData($meta->{signals}); + $meta->{object} = make_metaObject($class, Qt::this()->staticMetaObject, + $slot_tbl, $slot_tbl_count, + $signal_tbl, $signal_tbl_count); + $meta->{changed} = 0; + return $meta->{object}; +} + +sub updateSigSlots +{ + require Qt::signals; + require Qt::slots; + for my $i (@sigslots) { + no strict 'refs'; + my $mod = "Qt::" . lc($$i[0]) . ( substr($$i[0], 0, 1) eq 'S' ? 's' : '' ) . "::import"; + $mod->( $$i[1], getSubName($$i[2]) => $$i[3] ); + } + @sigslots = (); +} + +sub inheritSuperSigSlots { + no strict 'refs'; + my $class = shift; + my $meta = \%{ $class . '::META' }; + if(defined $meta->{'superClass'} && @{ $meta->{'superClass'} }) { + for my $super(@{$meta->{'superClass'}}) { + inheritSuperSigSlots($super); + for my $ssn(keys %{${$super.'::META'}{slot}}) { + if(!exists $meta->{slot}->{"$ssn"}) { + my %ss = %{${$super.'::META'}{slot}{$ssn}}; + push @{$meta->{slots}}, \%ss; + $meta->{slot}->{$ssn} = \%ss; + $ss{index} = $#{ $meta->{slots} }; + } + } + for my $ssn(keys %{${$super.'::META'}{signal}}) { + if(!exists $meta->{signal}->{"$ssn"}) { + my %ss = %{${$super.'::META'}{signal}{$ssn}}; + push @{$meta->{signals}}, \%ss; + $meta->{signal}->{$ssn} = \%ss; + $ss{index} = $#{ $meta->{signals} }; + Qt::_internal::installsignal("$class\::$ssn"); + } + } + Qt::_internal::installqt_invoke($class . '::qt_invoke') + if( !defined &{ $class. '::qt_invoke' } && exists $meta->{slots} && @{ $meta->{slots} }); + Qt::_internal::installqt_invoke($class . '::qt_emit') + if( !defined &{ $class. '::qt_emit' } && exists $meta->{signals} && @{ $meta->{signals} }); + } + } +} + +sub getAllParents +{ + my $classId = shift; + my $res = shift; + my @classes = Qt::_internal::getIsa( $classId ); + for my $s( @classes ) + { + my $c = Qt::_internal::idClass($s); + push @{ $res }, $c; + getAllParents($c, $res) + } +} + +sub Qt::PointArray::setPoints { + my $points = $_[0]; + no strict 'refs'; + # what a horrible, horrible way to do this + $Qt::AutoLoad::AUTOLOAD = 'Qt::PointArray::setPoints'; + my $autoload = " Qt::PointArray::_UTOLOAD"; + dontRecurse(); + $autoload->(scalar(@$points)/2, $points); +} + +sub Qt::GridLayout::addMultiCellLayout { + # yet another hack. Turnaround for a bug in Qt < 3.1 + # (addMultiCellLayout doesn't reparent its QLayout argument) + no strict 'refs'; + if(!defined $_[0]->{'has been hidden'}) + { + push @{ this()->{'hidden children'} }, $_[0]; + $_[0]->{'has been hidden'} = 1; + } + $Qt::AutoLoad::AUTOLOAD = 'Qt::GridLayout::addMultiCellLayout'; + my $autoload = " Qt::GridLayout::_UTOLOAD"; + dontRecurse(); + $autoload->(@_); +} + +package Qt::Object; +use strict; + +sub MODIFY_CODE_ATTRIBUTES +{ + package Qt::_internal; + my ($package, $coderef, @attrs ) = @_; + my @reject; + foreach my $attr( @attrs ) + { + if( $attr !~ /^ (SIGNAL|SLOT|DCOP) \(( .* )\) $/x ) + { + push @reject, $attr; + next; + } + push @sigslots, + [ $1, $package, $coderef, [ splitUnnested( $2 ) ] ]; + } + if( @sigslots ) + { + no strict 'refs'; + my $meta = \%{ $package . '::META' }; + $meta->{ 'changed' } = 1; + } + return @reject; +} + +package Qt; + +use 5.006; +use strict; +use warnings; +use XSLoader; + +require Exporter; + +our $VERSION = '3.008'; + +our @EXPORT = qw(&SIGNAL &SLOT &CAST &emit &min &max); + +XSLoader::load 'Qt', $VERSION; + +# try to avoid KDE's buggy malloc +# only works for --enable-fast-malloc, +# not when --enable-fast-malloc=full +$ENV{'KDE_MALLOC'} = 0; + +Qt::_internal::init(); + +# In general, I'm not a fan of prototypes. +# However, I'm also not a fan of parentheses + +sub SIGNAL ($) { '2' . $_[0] } +sub SLOT ($) { '1' . $_[0] } +sub CAST ($$) { bless $_[0], " $_[1]" } +sub emit (@) { pop @_ } +sub min ($$) { $_[0] < $_[1] ? $_[0] : $_[1] } +sub max ($$) { $_[0] > $_[1] ? $_[0] : $_[1] } + +sub import { goto &Exporter::import } + +sub Qt::base::ON_DESTROY { 0 }; + +sub Qt::Object::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->parent; + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + return 1 + } + return 0 +} + +sub Qt::Application::ON_DESTROY { 0 } + +# we need to solve an ambiguity for Q*Items: they aren't QObjects, +# and are meant to be created on the heap / destroyed manually. +# On the one hand, we don't want to delete them if they are still owned by a QObject hierarchy +# but on the other hand, what can we do if the user DOES need to destroy them? +# +# So the solution adopted here is to use the takeItem() method when it exists +# to lower the refcount and allow explicit destruction/removal. + +sub Qt::ListViewItem::ON_DESTROY { + package Qt::_internal; + my $parent = this()->listView(); + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this) } = this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 + } + setAllocated( this(), 1 ); + return 0 +} + +sub Qt::ListViewItem::takeItem +{ + package Qt::_internal; + delete ${ this()->{"hidden children"} } { sv_to_ptr($_[0]) }; + delete $_[0]->{"has been hidden"}; + setAllocated( $_[0], 1 ); + no strict 'refs'; + $Qt::AutoLoad::AUTOLOAD = 'Qt::ListViewItem::takeItem'; + my $autoload = " Qt::ListViewItem::_UTOLOAD"; + dontRecurse(); + $autoload->( $_[0] ); +} + +sub Qt::ListView::takeItem +{ + package Qt::_internal; + delete ${ this()->{"hidden children"} } { sv_to_ptr($_[0]) }; + delete $_[0]->{"has been hidden"}; + setAllocated( $_[0], 1 ); + no strict 'refs'; + $Qt::AutoLoad::AUTOLOAD = 'Qt::ListView::takeItem'; + my $autoload = " Qt::ListView::_UTOLOAD"; + dontRecurse(); + $autoload->( $_[0] ); +} + +sub Qt::IconViewItem::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->iconView; + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 + } + setAllocated( this(), 1 ); + return 0 +} + +sub Qt::IconView::takeItem +{ + package Qt::_internal; + delete ${ this()->{"hidden children"} } { sv_to_ptr($_[0]) }; + delete $_[0]->{"has been hidden"}; + setAllocated( $_[0], 1 ); + no strict 'refs'; + $Qt::AutoLoad::AUTOLOAD = 'Qt::IconView::takeItem'; + my $autoload = " Qt::IconView::_UTOLOAD"; + Qt::_internal::dontRecurse(); + $autoload->( $_[0] ); +} + + +sub Qt::ListBoxItem::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->listBox(); + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 + } + setAllocated( this(), 1 ); + return 0 +} + +sub Qt::ListBox::takeItem +{ + # Unfortunately, takeItem() won't reset the Item's listBox() pointer to 0. + # That's a Qt bug (I reported it and it got fixed as of Qt 3.2b2) + package Qt::_internal; + delete ${ this()->{"hidden children"} } { sv_to_ptr($_[0]) }; + delete $_[0]->{"has been hidden"}; + setAllocated( $_[0], 1 ); + no strict 'refs'; + $Qt::Autoload::AUTOLOAD = 'Qt::ListBox::takeItem'; + my $autoload = " Qt::ListBox::_UTOLOAD"; + dontRecurse(); + $autoload->( $_[0] ); +} + +sub Qt::TableItem::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->table; + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 + } + setAllocated( this(), 1 ); + return 0 +} + +sub Qt::Table::takeItem +{ + package Qt::_internal; + delete ${ this()->{"hidden children"} } { sv_to_ptr($_[0]) }; + delete $_[0]->{"has been hidden"}; + setAllocated( $_[0], 1 ); + no strict 'refs'; + $Qt::AutoLoad::AUTOLOAD = 'Qt::Table::takeItem'; + my $autoload = " Qt::Table::_UTOLOAD"; + dontRecurse(); + $autoload->( $_[0] ); +} + +sub Qt::LayoutItem::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->widget() || this()->layout(); + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + } + else # a SpacerItem... + { + push @PersistentObjects, this(); + } + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 +} + +sub Qt::Layout::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->mainWidget() || this()->parent(); + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + return 1 + } + return 0 +} + +sub Qt::StyleSheetItem::ON_DESTROY +{ + package Qt::_internal; + my $parent = this()->styleSheet(); + if( $parent ) + { + ${ $parent->{"hidden children"} } { sv_to_ptr(this()) } = this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 + } + setAllocated( this(), 1 ); + return 0 +} + +sub Qt::SqlCursor::ON_DESTROY +{ + package Qt::_internal; + push @PersistentObjects, this(); + this()->{"has been hidden"} = 1; + setAllocated( this(), 0 ); + return 1 +} + +1; diff --git a/PerlQt/Qt.pod b/PerlQt/Qt.pod new file mode 100644 index 0000000..94503ba --- /dev/null +++ b/PerlQt/Qt.pod @@ -0,0 +1,42 @@ + +=head1 NAME + +PerlQt - Perl interface to the Qt GUI Widget toolkit + +=head1 Qt + +Given the huge size of the Qt module +(more than 400 classes and 13000 methods) +it doesn't have any formal documentation. + +Instead, it provides two introspection tools + +=over 4 + +=item * pqtapi: + +a command line PerlQt API introspector + +=item * pqtsh: + +a graphical PerlQt shell + +=back + +and a detailed B<tutorial> with comprehensive +explanations. +This is where anyone new to PerlQt +should start. + +The tutorial has been originally installed +on this system in C</usr/share/doc/libqt-perl/tutorial>, in both B<POD> and +B<HTML> format. + +For a complete IDE allowing RAD and visual programming, +check the pqt-designer package. + +--- The PerlQt team + +http://perlqt.sf.net - PerlQt Project Homepage + +=cut diff --git a/PerlQt/Qt.xs b/PerlQt/Qt.xs new file mode 100644 index 0000000..e72bffd --- /dev/null +++ b/PerlQt/Qt.xs @@ -0,0 +1,2198 @@ +#include <stdio.h> +#include <qglobal.h> +#include <qstring.h> +#include <qapplication.h> +#include <qmetaobject.h> +#include <private/qucomextra_p.h> +#include "smoke.h" + +#undef DEBUG +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef __USE_POSIX +#define __USE_POSIX +#endif +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#ifdef _BOOL +#define HAS_BOOL +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifndef QT_VERSION_STR +#define QT_VERSION_STR "Unknown" +#endif + +#undef free +#undef malloc + +#include "marshall.h" +#include "perlqt.h" +#include "smokeperl.h" + +#ifndef IN_BYTES +#define IN_BYTES IN_BYTE +#endif + +#ifndef IN_LOCALE +#define IN_LOCALE (PL_curcop->op_private & HINT_LOCALE) +#endif + +extern Smoke *qt_Smoke; +extern void init_qt_Smoke(); + +int do_debug = qtdb_none; + +HV *pointer_map = 0; +SV *sv_qapp = 0; +int object_count = 0; +void *_current_object = 0; // TODO: ask myself if this is stupid + +bool temporary_virtual_function_success = false; + +static QAsciiDict<Smoke::Index> *methcache = 0; +static QAsciiDict<Smoke::Index> *classcache = 0; + +SV *sv_this = 0; + +Smoke::Index _current_object_class = 0; +Smoke::Index _current_method = 0; +/* + * Type handling by moc is simple. + * + * If the type name matches /^(?:const\s+)?\Q$types\E&?$/, use the + * static_QUType, where $types is join('|', qw(bool int double char* QString); + * + * Everything else is passed as a pointer! There are types which aren't + * Smoke::tf_ptr but will have to be passed as a pointer. Make sure to keep + * track of what's what. + */ + +/* + * Simply using typeids isn't enough for signals/slots. It will be possible + * to declare signals and slots which use arguments which can't all be + * found in a single smoke object. Instead, we need to store smoke => typeid + * pairs. We also need additional informatation, such as whether we're passing + * a pointer to the union element. + */ + +enum MocArgumentType { + xmoc_ptr, + xmoc_bool, + xmoc_int, + xmoc_double, + xmoc_charstar, + xmoc_QString +}; + +struct MocArgument { + // smoke object and associated typeid + SmokeType st; + MocArgumentType argType; +}; + + +extern TypeHandler Qt_handlers[]; +void install_handlers(TypeHandler *); + +void *sv_to_ptr(SV *sv) { // ptr on success, null on fail + smokeperl_object *o = sv_obj_info(sv); + return o ? o->ptr : 0; +} + +bool isQObject(Smoke *smoke, Smoke::Index classId) { + if(!strcmp(smoke->classes[classId].className, "QObject")) + return true; + for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents; + *p; + p++) { + if(isQObject(smoke, *p)) + return true; + } + return false; +} + +int isDerivedFrom(Smoke *smoke, Smoke::Index classId, Smoke::Index baseId, int cnt) { + if(classId == baseId) + return cnt; + cnt++; + for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents; + *p; + p++) { + if(isDerivedFrom(smoke, *p, baseId, cnt) != -1) + return cnt; + } + return -1; +} + +int isDerivedFrom(Smoke *smoke, const char *className, const char *baseClassName, int cnt) { + if(!smoke || !className || !baseClassName) + return -1; + Smoke::Index idClass = smoke->idClass(className); + Smoke::Index idBase = smoke->idClass(baseClassName); + return isDerivedFrom(smoke, idClass, idBase, cnt); +} + +SV *getPointerObject(void *ptr) { + HV *hv = pointer_map; + SV *keysv = newSViv((IV)ptr); + STRLEN len; + char *key = SvPV(keysv, len); + SV **svp = hv_fetch(hv, key, len, 0); + if(!svp){ + SvREFCNT_dec(keysv); + return 0; + } + if(!SvOK(*svp)){ + hv_delete(hv, key, len, G_DISCARD); + SvREFCNT_dec(keysv); + return 0; + } + return *svp; +} + +void unmapPointer(smokeperl_object *o, Smoke::Index classId, void *lastptr) { + HV *hv = pointer_map; + void *ptr = o->smoke->cast(o->ptr, o->classId, classId); + if(ptr != lastptr) { + lastptr = ptr; + SV *keysv = newSViv((IV)ptr); + STRLEN len; + char *key = SvPV(keysv, len); + if(hv_exists(hv, key, len)) + hv_delete(hv, key, len, G_DISCARD); + SvREFCNT_dec(keysv); + } + for(Smoke::Index *i = o->smoke->inheritanceList + o->smoke->classes[classId].parents; + *i; + i++) { + unmapPointer(o, *i, lastptr); + } +} + +// Store pointer in pointer_map hash : "pointer_to_Qt_object" => weak ref to associated Perl object +// Recurse to store it also as casted to its parent classes. + +void mapPointer(SV *obj, smokeperl_object *o, HV *hv, Smoke::Index classId, void *lastptr) { + void *ptr = o->smoke->cast(o->ptr, o->classId, classId); + if(ptr != lastptr) { + lastptr = ptr; + SV *keysv = newSViv((IV)ptr); + STRLEN len; + char *key = SvPV(keysv, len); + SV *rv = newSVsv(obj); + sv_rvweaken(rv); // weak reference! + hv_store(hv, key, len, rv, 0); + SvREFCNT_dec(keysv); + } + for(Smoke::Index *i = o->smoke->inheritanceList + o->smoke->classes[classId].parents; + *i; + i++) { + mapPointer(obj, o, hv, *i, lastptr); + } +} + +Marshall::HandlerFn getMarshallFn(const SmokeType &type); + +class VirtualMethodReturnValue : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + Smoke::Stack _stack; + SmokeType _st; + SV *_retval; +public: + const Smoke::Method &method() { return _smoke->methods[_method]; } + SmokeType type() { return _st; } + Marshall::Action action() { return Marshall::FromSV; } + Smoke::StackItem &item() { return _stack[0]; } + SV *var() { return _retval; } + void unsupported() { + croak("Cannot handle '%s' as return-type of virtual method %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void next() {} + bool cleanup() { return false; } + VirtualMethodReturnValue(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *retval) : + _smoke(smoke), _method(meth), _stack(stack), _retval(retval) { + _st.set(_smoke, method().ret); + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + } +}; + +class VirtualMethodCall : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + Smoke::Stack _stack; + GV *_gv; + int _cur; + Smoke::Index *_args; + SV **_sp; + bool _called; + SV *_savethis; + +public: + SmokeType type() { return SmokeType(_smoke, _args[_cur]); } + Marshall::Action action() { return Marshall::ToSV; } + Smoke::StackItem &item() { return _stack[_cur + 1]; } + SV *var() { return _sp[_cur]; } + const Smoke::Method &method() { return _smoke->methods[_method]; } + void unsupported() { + croak("Cannot handle '%s' as argument of virtual method %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void callMethod() { + dSP; + if(_called) return; + _called = true; + SP = _sp + method().numArgs - 1; + PUTBACK; + int count = call_sv((SV*)GvCV(_gv), G_SCALAR); + SPAGAIN; + VirtualMethodReturnValue r(_smoke, _method, _stack, POPs); + PUTBACK; + FREETMPS; + LEAVE; + } + void next() { + int oldcur = _cur; + _cur++; + while(!_called && _cur < method().numArgs) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + _cur++; + } + callMethod(); + _cur = oldcur; + } + bool cleanup() { return false; } // is this right? + VirtualMethodCall(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *obj, GV *gv) : + _smoke(smoke), _method(meth), _stack(stack), _gv(gv), _cur(-1), _sp(0), _called(false) { + dSP; + ENTER; + SAVETMPS; + PUSHMARK(SP); + EXTEND(SP, method().numArgs); + _savethis = sv_this; + sv_this = newSVsv(obj); + _sp = SP + 1; + for(int i = 0; i < method().numArgs; i++) + _sp[i] = sv_newmortal(); + _args = _smoke->argumentList + method().args; + } + ~VirtualMethodCall() { + SvREFCNT_dec(sv_this); + sv_this = _savethis; + } +}; + +class MethodReturnValue : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + SV *_retval; + Smoke::Stack _stack; +public: + MethodReturnValue(Smoke *smoke, Smoke::Index method, Smoke::Stack stack, SV *retval) : + _smoke(smoke), _method(method), _retval(retval), _stack(stack) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + } + const Smoke::Method &method() { return _smoke->methods[_method]; } + SmokeType type() { return SmokeType(_smoke, method().ret); } + Marshall::Action action() { return Marshall::ToSV; } + Smoke::StackItem &item() { return _stack[0]; } + SV *var() { return _retval; } + void unsupported() { + croak("Cannot handle '%s' as return-type of %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void next() {} + bool cleanup() { return false; } +}; + +class MethodCall : public Marshall { + int _cur; + Smoke *_smoke; + Smoke::Stack _stack; + Smoke::Index _method; + Smoke::Index *_args; + SV **_sp; + int _items; + SV *_retval; + bool _called; +public: + MethodCall(Smoke *smoke, Smoke::Index method, SV **sp, int items) : + _smoke(smoke), _method(method), _sp(sp), _items(items), _cur(-1), _called(false) { + _args = _smoke->argumentList + _smoke->methods[_method].args; + _items = _smoke->methods[_method].numArgs; + _stack = new Smoke::StackItem[items + 1]; + _retval = newSV(0); + } + ~MethodCall() { + delete[] _stack; + SvREFCNT_dec(_retval); + } + SmokeType type() { return SmokeType(_smoke, _args[_cur]); } + Marshall::Action action() { return Marshall::FromSV; } + Smoke::StackItem &item() { return _stack[_cur + 1]; } + SV *var() { + if(_cur < 0) return _retval; + SvGETMAGIC(*(_sp + _cur)); + return *(_sp + _cur); + } + inline const Smoke::Method &method() { return _smoke->methods[_method]; } + void unsupported() { + croak("Cannot handle '%s' as argument to %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + inline void callMethod() { + if(_called) return; + _called = true; + Smoke::ClassFn fn = _smoke->classes[method().classId].classFn; + void *ptr = _smoke->cast( + _current_object, + _current_object_class, + method().classId + ); + _items = -1; + (*fn)(method().method, ptr, _stack); + MethodReturnValue r(_smoke, _method, _stack, _retval); + } + void next() { + int oldcur = _cur; + _cur++; + + while(!_called && _cur < _items) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + _cur++; + } + + callMethod(); + _cur = oldcur; + } + bool cleanup() { return true; } +}; + +class UnencapsulatedQObject : public QObject { +public: + QConnectionList *public_receivers(int signal) const { return receivers(signal); } + void public_activate_signal(QConnectionList *clist, QUObject *o) { activate_signal(clist, o); } +}; + +class EmitSignal : public Marshall { + UnencapsulatedQObject *_qobj; + int _id; + MocArgument *_args; + SV **_sp; + int _items; + int _cur; + Smoke::Stack _stack; + bool _called; +public: + EmitSignal(QObject *qobj, int id, int items, MocArgument *args, SV **sp) : + _qobj((UnencapsulatedQObject*)qobj), _id(id), _items(items), _args(args), + _sp(sp), _cur(-1), _called(false) { + _stack = new Smoke::StackItem[_items]; + } + ~EmitSignal() { + delete[] _stack; + } + const MocArgument &arg() { return _args[_cur]; } + SmokeType type() { return arg().st; } + Marshall::Action action() { return Marshall::FromSV; } + Smoke::StackItem &item() { return _stack[_cur]; } + SV *var() { return _sp[_cur]; } + void unsupported() { + croak("Cannot handle '%s' as signal argument", type().name()); + } + Smoke *smoke() { return type().smoke(); } + void emitSignal() { + if(_called) return; + _called = true; + + QConnectionList *clist = _qobj->public_receivers(_id); + if(!clist) return; + + QUObject *o = new QUObject[_items + 1]; + for(int i = 0; i < _items; i++) { + QUObject *po = o + i + 1; + Smoke::StackItem *si = _stack + i; + switch(_args[i].argType) { + case xmoc_bool: + static_QUType_bool.set(po, si->s_bool); + break; + case xmoc_int: + static_QUType_int.set(po, si->s_int); + break; + case xmoc_double: + static_QUType_double.set(po, si->s_double); + break; + case xmoc_charstar: + static_QUType_charstar.set(po, (char*)si->s_voidp); + break; + case xmoc_QString: + static_QUType_QString.set(po, *(QString*)si->s_voidp); + break; + default: + { + const SmokeType &t = _args[i].st; + void *p; + switch(t.elem()) { + case Smoke::t_bool: + p = &si->s_bool; + break; + case Smoke::t_char: + p = &si->s_char; + break; + case Smoke::t_uchar: + p = &si->s_uchar; + break; + case Smoke::t_short: + p = &si->s_short; + break; + case Smoke::t_ushort: + p = &si->s_ushort; + break; + case Smoke::t_int: + p = &si->s_int; + break; + case Smoke::t_uint: + p = &si->s_uint; + break; + case Smoke::t_long: + p = &si->s_long; + break; + case Smoke::t_ulong: + p = &si->s_ulong; + break; + case Smoke::t_float: + p = &si->s_float; + break; + case Smoke::t_double: + p = &si->s_double; + break; + case Smoke::t_enum: + { + // allocate a new enum value + Smoke::EnumFn fn = SmokeClass(t).enumFn(); + if(!fn) { + warn("Unknown enumeration %s\n", t.name()); + p = new int((int)si->s_enum); + break; + } + Smoke::Index id = t.typeId(); + (*fn)(Smoke::EnumNew, id, p, si->s_enum); + (*fn)(Smoke::EnumFromLong, id, p, si->s_enum); + // FIXME: MEMORY LEAK + } + break; + case Smoke::t_class: + case Smoke::t_voidp: + p = si->s_voidp; + break; + default: + p = 0; + break; + } + static_QUType_ptr.set(po, p); + } + } + } + + _qobj->public_activate_signal(clist, o); + delete[] o; + } + void next() { + int oldcur = _cur; + _cur++; + + while(!_called && _cur < _items) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + _cur++; + } + + emitSignal(); + _cur = oldcur; + } + bool cleanup() { return true; } +}; + +class InvokeSlot : public Marshall { + QObject *_qobj; + GV *_gv; + int _items; + MocArgument *_args; + QUObject *_o; + int _cur; + bool _called; + SV **_sp; + Smoke::Stack _stack; +public: + const MocArgument &arg() { return _args[_cur]; } + SmokeType type() { return arg().st; } + Marshall::Action action() { return Marshall::ToSV; } + Smoke::StackItem &item() { return _stack[_cur]; } + SV *var() { return _sp[_cur]; } + Smoke *smoke() { return type().smoke(); } + bool cleanup() { return false; } + void unsupported() { + croak("Cannot handle '%s' as slot argument\n", type().name()); + } + void copyArguments() { + for(int i = 0; i < _items; i++) { + QUObject *o = _o + i + 1; + switch(_args[i].argType) { + case xmoc_bool: + _stack[i].s_bool = static_QUType_bool.get(o); + break; + case xmoc_int: + _stack[i].s_int = static_QUType_int.get(o); + break; + case xmoc_double: + _stack[i].s_double = static_QUType_double.get(o); + break; + case xmoc_charstar: + _stack[i].s_voidp = static_QUType_charstar.get(o); + break; + case xmoc_QString: + _stack[i].s_voidp = &static_QUType_QString.get(o); + break; + default: // case xmoc_ptr: + { + const SmokeType &t = _args[i].st; + void *p = static_QUType_ptr.get(o); + switch(t.elem()) { + case Smoke::t_bool: + _stack[i].s_bool = *(bool*)p; + break; + case Smoke::t_char: + _stack[i].s_char = *(char*)p; + break; + case Smoke::t_uchar: + _stack[i].s_uchar = *(unsigned char*)p; + break; + case Smoke::t_short: + _stack[i].s_short = *(short*)p; + break; + case Smoke::t_ushort: + _stack[i].s_ushort = *(unsigned short*)p; + break; + case Smoke::t_int: + _stack[i].s_int = *(int*)p; + break; + case Smoke::t_uint: + _stack[i].s_uint = *(unsigned int*)p; + break; + case Smoke::t_long: + _stack[i].s_long = *(long*)p; + break; + case Smoke::t_ulong: + _stack[i].s_ulong = *(unsigned long*)p; + break; + case Smoke::t_float: + _stack[i].s_float = *(float*)p; + break; + case Smoke::t_double: + _stack[i].s_double = *(double*)p; + break; + case Smoke::t_enum: + { + Smoke::EnumFn fn = SmokeClass(t).enumFn(); + if(!fn) { + warn("Unknown enumeration %s\n", t.name()); + _stack[i].s_enum = *(int*)p; + break; + } + Smoke::Index id = t.typeId(); + (*fn)(Smoke::EnumToLong, id, p, _stack[i].s_enum); + } + break; + case Smoke::t_class: + case Smoke::t_voidp: + _stack[i].s_voidp = p; + break; + } + } + } + } + } + void invokeSlot() { + dSP; + if(_called) return; + _called = true; + + SP = _sp + _items - 1; + PUTBACK; + int count = call_sv((SV*)GvCV(_gv), G_SCALAR); + SPAGAIN; + SP -= count; + PUTBACK; + FREETMPS; + LEAVE; + } + void next() { + int oldcur = _cur; + _cur++; + + while(!_called && _cur < _items) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + _cur++; + } + + invokeSlot(); + _cur = oldcur; + } + InvokeSlot(QObject *qobj, GV *gv, int items, MocArgument *args, QUObject *o) : + _qobj(qobj), _gv(gv), _items(items), _args(args), _o(o), _cur(-1), _called(false) { + dSP; + ENTER; + SAVETMPS; + PUSHMARK(SP); + EXTEND(SP, items); + PUTBACK; + _sp = SP + 1; + for(int i = 0; i < _items; i++) + _sp[i] = sv_newmortal(); + _stack = new Smoke::StackItem[_items]; + copyArguments(); + } + ~InvokeSlot() { + delete[] _stack; + } + +}; + +class QtSmokeBinding : public SmokeBinding { +public: + QtSmokeBinding(Smoke *s) : SmokeBinding(s) {} + void deleted(Smoke::Index classId, void *ptr) { + SV *obj = getPointerObject(ptr); + smokeperl_object *o = sv_obj_info(obj); + if(do_debug && (do_debug & qtdb_gc)) { + fprintf(stderr, "%p->~%s()\n", ptr, smoke->className(classId)); + } + if(!o || !o->ptr) { + return; + } + unmapPointer(o, o->classId, 0); + o->ptr = 0; + } + bool callMethod(Smoke::Index method, void *ptr, Smoke::Stack args, bool isAbstract) { + SV *obj = getPointerObject(ptr); + smokeperl_object *o = sv_obj_info(obj); + if(do_debug && (do_debug & qtdb_virtual)) fprintf(stderr, "virtual %p->%s::%s() called\n", ptr, + smoke->classes[smoke->methods[method].classId].className, + smoke->methodNames[smoke->methods[method].name] + ); + + if(!o) { + if(!PL_dirty && (do_debug && (do_debug & qtdb_virtual)) ) // if not in global destruction + fprintf(stderr, "Cannot find object for virtual method\n"); + return false; + } + HV *stash = SvSTASH(SvRV(obj)); + if(*HvNAME(stash) == ' ') + stash = gv_stashpv(HvNAME(stash) + 1, TRUE); + const char *methodName = smoke->methodNames[smoke->methods[method].name]; + GV *gv = gv_fetchmethod_autoload(stash, methodName, 0); + if(!gv) return false; + + VirtualMethodCall c(smoke, method, args, obj, gv); + // exception variable, just temporary + temporary_virtual_function_success = true; + c.next(); + bool ret = temporary_virtual_function_success; + temporary_virtual_function_success = true; + return ret; + } + char *className(Smoke::Index classId) { + const char *className = smoke->className(classId); + char *buf = new char[strlen(className) + 6]; + strcpy(buf, " Qt::"); + strcat(buf, className + 1); + return buf; + } +}; + +// ---------------- Helpers ------------------- + +SV *catArguments(SV** sp, int n) +{ + SV* r=newSVpvf(""); + for(int i = 0; i < n; i++) { + if(i) sv_catpv(r, ", "); + if(!SvOK(sp[i])) { + sv_catpv(r, "undef"); + } else if(SvROK(sp[i])) { + smokeperl_object *o = sv_obj_info(sp[i]); + if(o) + sv_catpv(r, o->smoke->className(o->classId)); + else + sv_catsv(r, sp[i]); + } else { + bool isString = SvPOK(sp[i]); + STRLEN len; + char *s = SvPV(sp[i], len); + if(isString) sv_catpv(r, "'"); + sv_catpvn(r, s, len > 10 ? 10 : len); + if(len > 10) sv_catpv(r, "..."); + if(isString) sv_catpv(r, "'"); + } + } + return r; +} + +Smoke::Index package_classid(const char *p) +{ + Smoke::Index *item = classcache->find(p); + if(item) + return *item; + char *nisa = new char[strlen(p)+6]; + strcpy(nisa, p); + strcat(nisa, "::ISA"); + AV* isa=get_av(nisa, true); + delete[] nisa; + for(int i=0; i<=av_len(isa); i++) { + SV** np = av_fetch(isa, i, 0); + if(np) { + Smoke::Index ix = package_classid(SvPV_nolen(*np)); + if(ix) { + classcache->insert(p, new Smoke::Index(ix)); + return ix; + } + } + } + return (Smoke::Index) 0; +} + +char *get_SVt(SV *sv) +{ + char *r; + if(!SvOK(sv)) + r = "u"; + else if(SvIOK(sv)) + r = "i"; + else if(SvNOK(sv)) + r = "n"; + else if(SvPOK(sv)) + r = "s"; + else if(SvROK(sv)) { + smokeperl_object *o = sv_obj_info(sv); + if(!o) { + switch (SvTYPE(SvRV(sv))) { + case SVt_PVAV: + r = "a"; + break; +// case SVt_PV: +// case SVt_PVMG: +// r = "p"; + default: + r = "r"; + } + } + else + r = (char*)o->smoke->className(o->classId); + } + else + r = "U"; + return r; +} + +SV *prettyPrintMethod(Smoke::Index id) { + SV *r = newSVpvf(""); + Smoke::Method &meth = qt_Smoke->methods[id]; + const char *tname = qt_Smoke->types[meth.ret].name; + if(meth.flags & Smoke::mf_static) sv_catpv(r, "static "); + sv_catpvf(r, "%s ", (tname ? tname:"void")); + sv_catpvf(r, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); + for(int i = 0; i < meth.numArgs; i++) { + if(i) sv_catpv(r, ", "); + tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; + sv_catpv(r, (tname ? tname:"void")); + } + sv_catpv(r, ")"); + if(meth.flags & Smoke::mf_const) sv_catpv(r, " const"); + return r; +} + +// --------------- Unary Keywords && Attributes ------------------ + + +// implements unary 'this' +XS(XS_this) { + dXSARGS; + ST(0) = sv_this; + XSRETURN(1); +} + +// implements unary attributes: 'foo' means 'this->{foo}' +XS(XS_attr) { + dXSARGS; + char *key = GvNAME(CvGV(cv)); + U32 klen = strlen(key); + SV **svp = 0; + if(SvROK(sv_this) && SvTYPE(SvRV(sv_this)) == SVt_PVHV) { + HV *hv = (HV*)SvRV(sv_this); + svp = hv_fetch(hv, key, klen, 1); + } + if(svp) { + ST(0) = *svp; + XSRETURN(1); + } + XSRETURN_UNDEF; +} + +// implements unary SUPER attribute: 'SUPER' means ${(CopSTASH)::_INTERNAL_STATIC_}{SUPER} +XS(XS_super) { + dXSARGS; + char *key = "SUPER"; + U32 klen = strlen(key); + SV **svp = 0; + if(SvROK(sv_this) && SvTYPE(SvRV(sv_this)) == SVt_PVHV) { + HV *cs = (HV*)CopSTASH(PL_curcop); + if(!cs) XSRETURN_UNDEF; + svp = hv_fetch(cs, "_INTERNAL_STATIC_", 17, 0); + if(!svp) XSRETURN_UNDEF; + cs = GvHV((GV*)*svp); + if(!cs) XSRETURN_UNDEF; + svp = hv_fetch(cs, "SUPER", 5, 0); + } + if(svp) { + ST(0) = *svp; + XSRETURN(1); + } + XSRETURN_UNDEF; +} + +//---------- XS Autoload (for all functions except fully qualified statics & enums) --------- + +static inline bool isQt(char *p) { + return (p[0] == 'Q' && p[1] && p[1] == 't' && ((p[2] && p[2] == ':') || !p[2])); +} + +bool avoid_fetchmethod = false; +XS(XS_AUTOLOAD) { + // Err, XS autoload is borked. Lets try... + dXSARGS; + SV *sv = get_sv("Qt::AutoLoad::AUTOLOAD", TRUE); + char *package = SvPV_nolen(sv); + char *method = 0; + for(char *s = package; *s ; s++) + if(*s == ':') method = s; + if(!method) XSRETURN_NO; + *(method++ - 1) = 0; // sorry for showing off. :) + int withObject = (*package == ' ') ? 1 : 0; + int isSuper = 0; + if(withObject) { + package++; + if(*package == ' ') { + isSuper = 1; + char *super = new char[strlen(package) + 7]; + package++; + strcpy(super, package); + strcat(super, "::SUPER"); + package = super; + } + } else if( isQt(package) ) + avoid_fetchmethod = true; + + HV *stash = gv_stashpv(package, TRUE); + + if(do_debug && (do_debug & qtdb_autoload)) + warn("In XS Autoload for %s::%s()\n", package, method); + + // check for user-defined methods in the REAL stash; skip prefix + GV *gv = 0; + if(avoid_fetchmethod) + avoid_fetchmethod = false; + else + gv = gv_fetchmethod_autoload(stash, method, 0); + + // If we've made it here, we need to set sv_this + if(gv) { + if(do_debug && (do_debug & qtdb_autoload)) + warn("\tfound in %s's Perl stash\n", package); + + // call the defined Perl method with new 'this' + SV *old_this; + if(withObject && !isSuper) { + old_this = sv_this; + sv_this = newSVsv(ST(0)); + } + + ENTER; + SAVETMPS; + PUSHMARK(SP - items + withObject); + PUTBACK; + int count = call_sv((SV*)GvCV(gv), G_SCALAR|G_EVAL); + SPAGAIN; + SV *ret = newSVsv(TOPs); + SP -= count; + PUTBACK; + FREETMPS; + LEAVE; + + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + else if(isSuper) + delete[] package; + + if(SvTRUE(ERRSV)) + croak(SvPV_nolen(ERRSV)); + ST(0) = sv_2mortal(ret); + XSRETURN(1); + } + else if(!strcmp(method, "DESTROY")) { + SV *old_this; + if(withObject && !isSuper) { + old_this = sv_this; + sv_this = newSVsv(ST(0)); + } + smokeperl_object *o = sv_obj_info(sv_this); + + if(!(o && o->ptr && (o->allocated || getPointerObject(o->ptr)))) { + if(isSuper) + delete[] package; + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + XSRETURN_YES; + } + const char *key = "has been hidden"; + U32 klen = 15; + SV **svp = 0; + if(SvROK(sv_this) && SvTYPE(SvRV(sv_this)) == SVt_PVHV) { + HV *hv = (HV*)SvRV(sv_this); + svp = hv_fetch(hv, key, klen, 0); + } + if(svp) { + if(isSuper) + delete[] package; + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + XSRETURN_YES; + } + gv = gv_fetchmethod_autoload(stash, "ON_DESTROY", 0); + if( !gv ) + croak( "Couldn't find ON_DESTROY method for %s=%p\n", package, o->ptr); + PUSHMARK(SP); + call_sv((SV*)GvCV(gv), G_SCALAR|G_NOARGS); + SPAGAIN; + int ret = POPi; + PUTBACK; + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + if( do_debug && ret && (do_debug & qtdb_gc) ) + fprintf(stderr, "Increasing refcount in DESTROY for %s=%p (still has a parent)\n", package, o->ptr); + } else { + + if( items > 18 ) XSRETURN_NO; // current max number of args in Qt is 13. + + // save the stack -- we'll need it + SV **savestack = new SV*[items+1]; + SV *saveobj = ST(0); + SV *old_this; + + Copy(SP - items + 1 + withObject, savestack, items-withObject, SV*); + + // Get the classid (eventually converting SUPER to the right Qt class) + Smoke::Index cid = package_classid(package); + // Look in the cache + char *cname = (char*)qt_Smoke->className(cid); + int lcname = strlen(cname); + int lmethod = strlen(method); + char mcid[256]; + strncpy(mcid, cname, lcname); + char *ptr = mcid + lcname; + *(ptr++) = ';'; + strncpy(ptr, method, lmethod); + ptr += lmethod; + for(int i=withObject ; i<items ; i++) + { + *(ptr++) = ';'; + char *t = get_SVt(ST(i)); + int tlen = strlen(t); + strncpy(ptr, t, tlen ); + ptr += tlen; + } + *ptr = 0; + Smoke::Index *rcid = methcache->find(mcid); + + if(rcid) { + // Got a hit + _current_method = *rcid; + if(withObject && !isSuper) { + old_this = sv_this; + sv_this = newSVsv(ST(0)); + } + } + else { + + // Find the C++ method to call. I'll do that from Perl for now + + ENTER; + SAVETMPS; + PUSHMARK(SP - items + withObject); + EXTEND(SP, 3); + PUSHs(sv_2mortal(newSViv((IV)cid))); + PUSHs(sv_2mortal(newSVpv(method, 0))); + PUSHs(sv_2mortal(newSVpv(package, 0))); + PUTBACK; + if(withObject && !isSuper) { + old_this = sv_this; + sv_this = newSVsv(saveobj); + } + call_pv("Qt::_internal::do_autoload", G_DISCARD|G_EVAL); + FREETMPS; + LEAVE; + + // Restore sv_this on error, so that eval{ } works + if(SvTRUE(ERRSV)) { + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + else if(isSuper) + delete[] package; + delete[] savestack; + croak(SvPV_nolen(ERRSV)); + } + + // Success. Cache result. + methcache->insert(mcid, new Smoke::Index(_current_method)); + } + // FIXME: I shouldn't have to set the current object + { + smokeperl_object *o = sv_obj_info(sv_this); + if(o && o->ptr) { + _current_object = o->ptr; + _current_object_class = o->classId; + } else { + _current_object = 0; + } + } + // honor debugging channels + if(do_debug && (do_debug & qtdb_calls)) { + warn("Calling method\t%s\n", SvPV_nolen(sv_2mortal(prettyPrintMethod(_current_method)))); + if(do_debug & qtdb_verbose) + warn("with arguments (%s)\n", SvPV_nolen(sv_2mortal(catArguments(savestack, items-withObject)))); + } + MethodCall c(qt_Smoke, _current_method, savestack, items-withObject); + c.next(); + if(savestack) + delete[] savestack; + + if(withObject && !isSuper) { + SvREFCNT_dec(sv_this); + sv_this = old_this; + } + else if(isSuper) + delete[] package; + + SV *ret = c.var(); + SvREFCNT_inc(ret); + ST(0) = sv_2mortal(ret); + XSRETURN(1); + } + if(isSuper) + delete[] package; + XSRETURN_YES; +} + + +//----------------- Sig/Slot ------------------ + + +MocArgument *getmetainfo(GV *gv, const char *name, int &offset, int &index, int &argcnt) { + char *signalname = GvNAME(gv); + HV *stash = GvSTASH(gv); + + // $meta = $stash->{META} + SV **svp = hv_fetch(stash, "META", 4, 0); + if(!svp) return 0; + HV *hv = GvHV((GV*)*svp); + if(!hv) return 0; + + // $metaobject = $meta->{object} + // aka. Class->staticMetaObject + svp = hv_fetch(hv, "object", 6, 0); + if(!svp) return 0; + smokeperl_object *ometa = sv_obj_info(*svp); + if(!ometa) return 0; + QMetaObject *metaobject = (QMetaObject*)ometa->ptr; + + offset = metaobject->signalOffset(); + + // $signals = $meta->{signal} + U32 len = strlen(name); + svp = hv_fetch(hv, name, len, 0); + if(!svp) return 0; + HV *signalshv = (HV*)SvRV(*svp); + + // $signal = $signals->{$signalname} + len = strlen(signalname); + svp = hv_fetch(signalshv, signalname, len, 0); + if(!svp) return 0; + HV *signalhv = (HV*)SvRV(*svp); + + // $index = $signal->{index} + svp = hv_fetch(signalhv, "index", 5, 0); + if(!svp) return 0;; + index = SvIV(*svp); + + // $argcnt = $signal->{argcnt} + svp = hv_fetch(signalhv, "argcnt", 6, 0); + if(!svp) return 0; + argcnt = SvIV(*svp); + + // $mocargs = $signal->{mocargs} + svp = hv_fetch(signalhv, "mocargs", 7, 0); + if(!svp) return 0; + MocArgument *args = (MocArgument*)SvIV(*svp); + + return args; +} + +MocArgument *getslotinfo(GV *gv, int id, char *&slotname, int &index, int &argcnt, bool isSignal = false) { + HV *stash = GvSTASH(gv); + + // $meta = $stash->{META} + SV **svp = hv_fetch(stash, "META", 4, 0); + if(!svp) return 0; + HV *hv = GvHV((GV*)*svp); + if(!hv) return 0; + + // $metaobject = $meta->{object} + // aka. Class->staticMetaObject + svp = hv_fetch(hv, "object", 6, 0); + if(!svp) return 0; + smokeperl_object *ometa = sv_obj_info(*svp); + if(!ometa) return 0; + QMetaObject *metaobject = (QMetaObject*)ometa->ptr; + + int offset = isSignal ? metaobject->signalOffset() : metaobject->slotOffset(); + + index = id - offset; // where we at + // FIXME: make slot inheritance work + if(index < 0) return 0; + // $signals = $meta->{signal} + const char *key = isSignal ? "signals" : "slots"; + svp = hv_fetch(hv, key, strlen(key), 0); + if(!svp) return 0; + AV *signalsav = (AV*)SvRV(*svp); + svp = av_fetch(signalsav, index, 0); + if(!svp) return 0; + HV *signalhv = (HV*)SvRV(*svp); + // $argcnt = $signal->{argcnt} + svp = hv_fetch(signalhv, "argcnt", 6, 0); + if(!svp) return 0; + argcnt = SvIV(*svp); + // $mocargs = $signal->{mocargs} + svp = hv_fetch(signalhv, "mocargs", 7, 0); + if(!svp) return 0; + MocArgument *args = (MocArgument*)SvIV(*svp); + + svp = hv_fetch(signalhv, "name", 4, 0); + if(!svp) return 0; + slotname = SvPV_nolen(*svp); + + return args; +} + +XS(XS_signal) { + dXSARGS; + + smokeperl_object *o = sv_obj_info(sv_this); + QObject *qobj = (QObject*)o->smoke->cast( + o->ptr, + o->classId, + o->smoke->idClass("QObject") + ); + if(qobj->signalsBlocked()) XSRETURN_UNDEF; + + int offset; + int index; + int argcnt; + MocArgument *args; + + args = getmetainfo(CvGV(cv), "signal", offset, index, argcnt); + if(!args) XSRETURN_UNDEF; + + // Okay, we have the signal info. *whew* + if(items < argcnt) + croak("Insufficient arguments to emit signal"); + + EmitSignal signal(qobj, offset + index, argcnt, args, &ST(0)); + signal.next(); + + XSRETURN_UNDEF; +} + +XS(XS_qt_invoke) { + dXSARGS; + // Arguments: int id, QUObject *o + int id = SvIV(ST(0)); + QUObject *_o = (QUObject*)SvIV(SvRV(ST(1))); + + smokeperl_object *o = sv_obj_info(sv_this); + QObject *qobj = (QObject*)o->smoke->cast( + o->ptr, + o->classId, + o->smoke->idClass("QObject") + ); + + // Now, I need to find out if this means me + int index; + char *slotname; + int argcnt; + MocArgument *args; + bool isSignal = !strcmp(GvNAME(CvGV(cv)), "qt_emit"); + args = getslotinfo(CvGV(cv), id, slotname, index, argcnt, isSignal); + if(!args) { + // throw an exception - evil style + temporary_virtual_function_success = false; + XSRETURN_UNDEF; + } + HV *stash = GvSTASH(CvGV(cv)); + GV *gv = gv_fetchmethod_autoload(stash, slotname, 0); + if(!gv) XSRETURN_UNDEF; + InvokeSlot slot(qobj, gv, argcnt, args, _o); + slot.next(); + + XSRETURN_UNDEF; +} + +// ------------------- Tied types ------------------------ + +MODULE = Qt PACKAGE = Qt::_internal::QString +PROTOTYPES: DISABLE + +SV* +FETCH(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QString *s = (QString*) tmp; + RETVAL = newSV(0); + if( s ) + { + if(!(IN_BYTES)) + { + sv_setpv_mg(RETVAL, (const char *)s->utf8()); + SvUTF8_on(RETVAL); + } + else if(IN_LOCALE) + sv_setpv_mg(RETVAL, (const char *)s->local8Bit()); + else + sv_setpv_mg(RETVAL, (const char *)s->latin1()); + } + else + sv_setsv_mg(RETVAL, &PL_sv_undef); + OUTPUT: + RETVAL + +void +STORE(obj,what) + SV* obj + SV* what + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QString *s = (QString*) tmp; + s->truncate(0); + if(SvOK(what)) { + if(SvUTF8(what)) + s->append(QString::fromUtf8(SvPV_nolen(what))); + else if(IN_LOCALE) + s->append(QString::fromLocal8Bit(SvPV_nolen(what))); + else + s->append(QString::fromLatin1(SvPV_nolen(what))); + } + +void +DESTROY(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QString *s = (QString*) tmp; + delete s; + +MODULE = Qt PACKAGE = Qt::_internal::QByteArray +PROTOTYPES: DISABLE + +SV* +FETCH(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QByteArray *s = (QByteArray*) tmp; + RETVAL = newSV(0); + if( s ) + { + sv_setpvn_mg(RETVAL, s->data(), s->size()); + } + else + sv_setsv_mg(RETVAL, &PL_sv_undef); + OUTPUT: + RETVAL + +void +STORE(obj,what) + SV* obj + SV* what + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QByteArray *s = (QByteArray*) tmp; + + if(SvOK(what)) { + STRLEN len; + char* tmp2 = SvPV(what, len); + s->resize(len); + Copy((void*)tmp2, (void*)s->data(), len, char); + } else + s->truncate(0); + +void +DESTROY(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QByteArray *s = (QByteArray*) tmp; + delete s; + +MODULE = Qt PACKAGE = Qt::_internal::QRgbStar +PROTOTYPES: DISABLE + +SV* +FETCH(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QRgb *s = (QRgb*) tmp; + AV* ar = newAV(); + RETVAL = newRV_noinc((SV*)ar); + for(int i=0; s[i] ; i++) + { + SV *item = newSViv((IV)s[i]); + if(!av_store(ar, (I32)i, item)) + SvREFCNT_dec( item ); + } + OUTPUT: + RETVAL + +void +STORE(obj,sv) + SV* obj + SV* sv + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QRgb *s = (QRgb*) tmp; + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + s = new QRgb[1]; + s[0] = 0; + sv_setref_pv(obj, "Qt::_internal::QRgbStar", (void*)s); + return; + } + AV *list = (AV*)SvRV(sv); + int count = av_len(list); + s = new QRgb[count + 2]; + int i; + for(i = 0; i <= count; i++) { + SV **item = av_fetch(list, i, 0); + if(!item || !SvOK(*item)) { + s[i] = 0; + continue; + } + s[i] = SvIV(*item); + } + s[i] = 0; + sv_setref_pv(obj, "Qt::_internal::QRgbStar", (void*)s); + +void +DESTROY(obj) + SV* obj + CODE: + if (!SvROK(obj)) + croak("?"); + IV tmp = SvIV((SV*)SvRV(obj)); + QRgb *s = (QRgb*) tmp; + delete[] s; + +# --------------- XSUBS for Qt::_internal::* helpers ---------------- + + +MODULE = Qt PACKAGE = Qt::_internal +PROTOTYPES: DISABLE + +void +getMethStat() + PPCODE: + XPUSHs(sv_2mortal(newSViv((int)methcache->size()))); + XPUSHs(sv_2mortal(newSViv((int)methcache->count()))); + +void +getClassStat() + PPCODE: + XPUSHs(sv_2mortal(newSViv((int)classcache->size()))); + XPUSHs(sv_2mortal(newSViv((int)classcache->count()))); + +void +getIsa(classId) + int classId + PPCODE: + Smoke::Index *parents = + qt_Smoke->inheritanceList + + qt_Smoke->classes[classId].parents; + while(*parents) + XPUSHs(sv_2mortal(newSVpv(qt_Smoke->classes[*parents++].className, 0))); + +void +dontRecurse() + CODE: + avoid_fetchmethod = true; + +void * +sv_to_ptr(sv) + SV* sv + +void * +allocateMocArguments(count) + int count + CODE: + RETVAL = (void*)new MocArgument[count + 1]; + OUTPUT: + RETVAL + +void +setMocType(ptr, idx, name, static_type) + void *ptr + int idx + char *name + char *static_type + CODE: + Smoke::Index typeId = qt_Smoke->idType(name); + if(!typeId) XSRETURN_NO; + MocArgument *arg = (MocArgument*)ptr; + arg[idx].st.set(qt_Smoke, typeId); + if(!strcmp(static_type, "ptr")) + arg[idx].argType = xmoc_ptr; + else if(!strcmp(static_type, "bool")) + arg[idx].argType = xmoc_bool; + else if(!strcmp(static_type, "int")) + arg[idx].argType = xmoc_int; + else if(!strcmp(static_type, "double")) + arg[idx].argType = xmoc_double; + else if(!strcmp(static_type, "char*")) + arg[idx].argType = xmoc_charstar; + else if(!strcmp(static_type, "QString")) + arg[idx].argType = xmoc_QString; + XSRETURN_YES; + +void +installsignal(name) + char *name + CODE: + char *file = __FILE__; + newXS(name, XS_signal, file); + +void +installqt_invoke(name) + char *name + CODE: + char *file = __FILE__; + newXS(name, XS_qt_invoke, file); + +void +setDebug(on) + int on + CODE: + do_debug = on; + +int +debug() + CODE: + RETVAL = do_debug; + OUTPUT: + RETVAL + +char * +getTypeNameOfArg(method, idx) + int method + int idx + CODE: + Smoke::Method &m = qt_Smoke->methods[method]; + Smoke::Index *args = qt_Smoke->argumentList + m.args; + RETVAL = (char*)qt_Smoke->types[args[idx]].name; + OUTPUT: + RETVAL + +int +classIsa(className, base) + char *className + char *base + CODE: + RETVAL = isDerivedFrom(qt_Smoke, className, base, 0); + OUTPUT: + RETVAL + +void +insert_pclassid(p, ix) + char *p + int ix + CODE: + classcache->insert(p, new Smoke::Index((Smoke::Index)ix)); + +int +find_pclassid(p) + char *p + CODE: + Smoke::Index *r = classcache->find(p); + if(r) + RETVAL = (int)*r; + else + RETVAL = 0; + OUTPUT: + RETVAL + +void +insert_mcid(mcid, ix) + char *mcid + int ix + CODE: + methcache->insert(mcid, new Smoke::Index((Smoke::Index)ix)); + +int +find_mcid(mcid) + char *mcid + CODE: + Smoke::Index *r = methcache->find(mcid); + if(r) + RETVAL = (int)*r; + else + RETVAL = 0; + OUTPUT: + RETVAL + +char * +getSVt(sv) + SV *sv + CODE: + RETVAL=get_SVt(sv); + OUTPUT: + RETVAL + +void * +make_QUParameter(name, type, extra, inout) + char *name + char *type + SV *extra + int inout + CODE: + QUParameter *p = new QUParameter; + p->name = new char[strlen(name) + 1]; + strcpy((char*)p->name, name); + if(!strcmp(type, "bool")) + p->type = &static_QUType_bool; + else if(!strcmp(type, "int")) + p->type = &static_QUType_int; + else if(!strcmp(type, "double")) + p->type = &static_QUType_double; + else if(!strcmp(type, "char*") || !strcmp(type, "const char*")) + p->type = &static_QUType_charstar; + else if(!strcmp(type, "QString") || !strcmp(type, "QString&") || + !strcmp(type, "const QString") || !strcmp(type, "const QString&")) + p->type = &static_QUType_QString; + else + p->type = &static_QUType_ptr; + // Lacking support for several types. Evil. + p->inOut = inout; + p->typeExtra = 0; + RETVAL = (void*)p; + OUTPUT: + RETVAL + +void * +make_QMetaData(name, method) + char *name + void *method + CODE: + QMetaData *m = new QMetaData; // will be deleted + m->name = new char[strlen(name) + 1]; + strcpy((char*)m->name, name); + m->method = (QUMethod*)method; + m->access = QMetaData::Public; + RETVAL = m; + OUTPUT: + RETVAL + +void * +make_QUMethod(name, params) + char *name + SV *params + CODE: + QUMethod *m = new QUMethod; // permanent memory allocation + m->name = new char[strlen(name) + 1]; // this too + strcpy((char*)m->name, name); + m->count = 0; + m->parameters = 0; + if(SvOK(params) && SvRV(params)) { + AV *av = (AV*)SvRV(params); + m->count = av_len(av) + 1; + if(m->count > 0) { + m->parameters = new QUParameter[m->count]; + for(int i = 0; i < m->count; i++) { + SV *sv = av_shift(av); + if(!SvOK(sv)) + croak("Invalid paramater for QUMethod\n"); + QUParameter *p = (QUParameter*)SvIV(sv); + SvREFCNT_dec(sv); + ((QUParameter*)m->parameters)[i] = *p; + delete p; + } + } else + m->count = 0; + } + RETVAL = m; + OUTPUT: + RETVAL + +void * +make_QMetaData_tbl(list) + SV *list + CODE: + RETVAL = 0; + if(SvOK(list) && SvRV(list)) { + AV *av = (AV*)SvRV(list); + int count = av_len(av) + 1; + QMetaData *m = new QMetaData[count]; + for(int i = 0; i < count; i++) { + SV *sv = av_shift(av); + if(!SvOK(sv)) + croak("Invalid metadata\n"); + QMetaData *old = (QMetaData*)SvIV(sv); + SvREFCNT_dec(sv); + m[i] = *old; + delete old; + } + RETVAL = (void*)m; + } + OUTPUT: + RETVAL + +SV * +make_metaObject(className, parent, slot_tbl, slot_count, signal_tbl, signal_count) + char *className + SV *parent + void *slot_tbl + int slot_count + void *signal_tbl + int signal_count + CODE: + smokeperl_object *po = sv_obj_info(parent); + if(!po || !po->ptr) croak("Cannot create metaObject\n"); + QMetaObject *meta = QMetaObject::new_metaobject( + className, (QMetaObject*)po->ptr, + (const QMetaData*)slot_tbl, slot_count, // slots + (const QMetaData*)signal_tbl, signal_count, // signals + 0, 0, // properties + 0, 0, // enums + 0, 0); + + // this object-creation code is so, so wrong here + HV *hv = newHV(); + SV *obj = newRV_noinc((SV*)hv); + + smokeperl_object o; + o.smoke = qt_Smoke; + o.classId = qt_Smoke->idClass("QMetaObject"); + o.ptr = meta; + o.allocated = true; + sv_magic((SV*)hv, sv_qapp, '~', (char*)&o, sizeof(o)); + MAGIC *mg = mg_find((SV*)hv, '~'); + mg->mg_virtual = &vtbl_smoke; + char *buf = qt_Smoke->binding->className(o.classId); + sv_bless(obj, gv_stashpv(buf, TRUE)); + delete[] buf; + RETVAL = obj; + OUTPUT: + RETVAL + +void +dumpObjects() + CODE: + hv_iterinit(pointer_map); + HE *e; + while(e = hv_iternext(pointer_map)) { + STRLEN len; + SV *sv = HeVAL(e); + printf("key = %s, refcnt = %d, weak = %d, ref? %d\n", HePV(e, len), SvREFCNT(sv), SvWEAKREF(sv), SvROK(sv)?1:0); + if(SvRV(sv)) + printf("REFCNT = %d\n", SvREFCNT(SvRV(sv))); + //SvREFCNT_dec(HeVAL(e)); + //HeVAL(e) = &PL_sv_undef; + } + +void +dangle(obj) + SV *obj + CODE: + if(SvRV(obj)) + SvREFCNT_inc(SvRV(obj)); + +void +setAllocated(obj, b) + SV *obj + bool b + CODE: + smokeperl_object *o = sv_obj_info(obj); + if(o) { + o->allocated = b; + } + +void +setqapp(obj) + SV *obj + CODE: + if(!obj || !SvROK(obj)) + croak("Invalid Qt::Application object. Couldn't set Qt::app()\n"); + sv_qapp = SvRV(obj); + +void +setThis(obj) + SV *obj + CODE: + sv_setsv_mg(sv_this, obj); + +void +deleteObject(obj) + SV *obj + CODE: + smokeperl_object *o = sv_obj_info(obj); + if(!o) { XSRETURN_EMPTY; } + QObject *qobj = (QObject*)o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); + delete qobj; + +void +mapObject(obj) + SV *obj + CODE: + smokeperl_object *o = sv_obj_info(obj); + if(!o) + XSRETURN_EMPTY; + SmokeClass c( o->smoke, o->classId ); + if(!c.hasVirtual() ) { + XSRETURN_EMPTY; + } + mapPointer(obj, o, pointer_map, o->classId, 0); + +bool +isQObject(obj) + SV *obj + CODE: + RETVAL = 0; + smokeperl_object *o = sv_obj_info(obj); + if(o && isQObject(o->smoke, o->classId)) + RETVAL = 1; + OUTPUT: + RETVAL + +bool +isValidAllocatedPointer(obj) + SV *obj + CODE: + RETVAL = 0; + smokeperl_object *o = sv_obj_info(obj); + if(o && o->ptr && o->allocated) + RETVAL = 1; + OUTPUT: + RETVAL + +SV* +findAllocatedObjectFor(obj) + SV *obj + CODE: + RETVAL = &PL_sv_undef; + smokeperl_object *o = sv_obj_info(obj); + SV *ret; + if(o && o->ptr && (ret = getPointerObject(o->ptr))) + RETVAL = ret; + OUTPUT: + RETVAL + +SV * +getGV(cv) + SV *cv + CODE: + RETVAL = (SvROK(cv) && (SvTYPE(SvRV(cv))==SVt_PVCV) ? + SvREFCNT_inc(CvGV((CV*)SvRV(cv))) : &PL_sv_undef); + OUTPUT: + RETVAL + +int +idClass(name) + char *name + CODE: + RETVAL = qt_Smoke->idClass(name); + OUTPUT: + RETVAL + +int +idMethodName(name) + char *name + CODE: + RETVAL = qt_Smoke->idMethodName(name); + OUTPUT: + RETVAL + +int +idMethod(idclass, idmethodname) + int idclass + int idmethodname + CODE: + RETVAL = qt_Smoke->idMethod(idclass, idmethodname); + OUTPUT: + RETVAL + +void +findMethod(c, name) + char *c + char *name + PPCODE: + Smoke::Index meth = qt_Smoke->findMethod(c, name); +// printf("DAMNIT on %s::%s => %d\n", c, name, meth); + if(!meth) { + // empty list + } else if(meth > 0) { + Smoke::Index i = qt_Smoke->methodMaps[meth].method; + if(!i) { // shouldn't happen + croak("Corrupt method %s::%s", c, name); + } else if(i > 0) { // single match + PUSHs(sv_2mortal(newSViv( + (IV)qt_Smoke->methodMaps[meth].method + ))); + } else { // multiple match + i = -i; // turn into ambiguousMethodList index + while(qt_Smoke->ambiguousMethodList[i]) { + PUSHs(sv_2mortal(newSViv( + (IV)qt_Smoke->ambiguousMethodList[i] + ))); + i++; + } + } + } + +void +findMethodFromIds(idclass, idmethodname) + int idclass + int idmethodname + PPCODE: + Smoke::Index meth = qt_Smoke->findMethod(idclass, idmethodname); + if(!meth) { + // empty list + } else if(meth > 0) { + Smoke::Index i = qt_Smoke->methodMaps[meth].method; + if(i >= 0) { // single match + PUSHs(sv_2mortal(newSViv((IV)i))); + } else { // multiple match + i = -i; // turn into ambiguousMethodList index + while(qt_Smoke->ambiguousMethodList[i]) { + PUSHs(sv_2mortal(newSViv( + (IV)qt_Smoke->ambiguousMethodList[i] + ))); + i++; + } + } + } + +# findAllMethods(classid [, startingWith]) : returns { "mungedName" => [index in methods, ...], ... } + +HV* +findAllMethods(classid, ...) + SV* classid + CODE: + RETVAL=newHV(); + if(SvIOK(classid)) { + Smoke::Index c = (Smoke::Index) SvIV(classid); + char * pat = 0L; + if(items > 1 && SvPOK(ST(1))) + pat = SvPV_nolen(ST(1)); + Smoke::Index imax = qt_Smoke->numMethodMaps; + Smoke::Index imin = 0, icur = -1, methmin = 0, methmax = 0; + int icmp = -1; + while(imax >= imin) { + icur = (imin + imax) / 2; + icmp = qt_Smoke->leg(qt_Smoke->methodMaps[icur].classId, c); + if(!icmp) { + Smoke::Index pos = icur; + while(icur && qt_Smoke->methodMaps[icur-1].classId == c) + icur --; + methmin = icur; + icur = pos; + while(icur < imax && qt_Smoke->methodMaps[icur+1].classId == c) + icur ++; + methmax = icur; + break; + } + if (icmp > 0) + imax = icur - 1; + else + imin = icur + 1; + } + if(!icmp) { + for(Smoke::Index i=methmin ; i <= methmax ; i++) { + Smoke::Index m = qt_Smoke->methodMaps[i].name; + if(!pat || !strncmp(qt_Smoke->methodNames[m], pat, strlen(pat))) { + Smoke::Index ix= qt_Smoke->methodMaps[i].method; + AV* meths = newAV(); + if(ix >= 0) { // single match + av_push(meths, newSViv((IV)ix)); + } else { // multiple match + ix = -ix; // turn into ambiguousMethodList index + while(qt_Smoke->ambiguousMethodList[ix]) { + av_push(meths, newSViv((IV)qt_Smoke->ambiguousMethodList[ix])); + ix++; + } + } + hv_store(RETVAL, qt_Smoke->methodNames[m],strlen(qt_Smoke->methodNames[m]),newRV_inc((SV*)meths),0); + } + } + } + } + OUTPUT: + RETVAL + +SV * +dumpCandidates(rmeths) + SV *rmeths + CODE: + if(SvROK(rmeths) && SvTYPE(SvRV(rmeths)) == SVt_PVAV) { + AV *methods = (AV*)SvRV(rmeths); + SV *errmsg = newSVpvf(""); + for(int i = 0; i <= av_len(methods); i++) { + sv_catpv(errmsg, "\t"); + IV id = SvIV(*(av_fetch(methods, i, 0))); + Smoke::Method &meth = qt_Smoke->methods[id]; + const char *tname = qt_Smoke->types[meth.ret].name; + if(meth.flags & Smoke::mf_static) sv_catpv(errmsg, "static "); + sv_catpvf(errmsg, "%s ", (tname ? tname:"void")); + sv_catpvf(errmsg, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); + for(int i = 0; i < meth.numArgs; i++) { + if(i) sv_catpv(errmsg, ", "); + tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; + sv_catpv(errmsg, (tname ? tname:"void")); + } + sv_catpv(errmsg, ")"); + if(meth.flags & Smoke::mf_const) sv_catpv(errmsg, " const"); + sv_catpv(errmsg, "\n"); + } + RETVAL=errmsg; + } + else + RETVAL=newSVpvf(""); + OUTPUT: + RETVAL + +SV * +catArguments(r_args) + SV* r_args + CODE: + RETVAL=newSVpvf(""); + if(SvROK(r_args) && SvTYPE(SvRV(r_args)) == SVt_PVAV) { + AV* args=(AV*)SvRV(r_args); + for(int i = 0; i <= av_len(args); i++) { + SV **arg=av_fetch(args, i, 0); + if(i) sv_catpv(RETVAL, ", "); + if(!arg || !SvOK(*arg)) { + sv_catpv(RETVAL, "undef"); + } else if(SvROK(*arg)) { + smokeperl_object *o = sv_obj_info(*arg); + if(o) + sv_catpv(RETVAL, o->smoke->className(o->classId)); + else + sv_catsv(RETVAL, *arg); + } else { + bool isString = SvPOK(*arg); + STRLEN len; + char *s = SvPV(*arg, len); + if(isString) sv_catpv(RETVAL, "'"); + sv_catpvn(RETVAL, s, len > 10 ? 10 : len); + if(len > 10) sv_catpv(RETVAL, "..."); + if(isString) sv_catpv(RETVAL, "'"); + } + } + } + OUTPUT: + RETVAL + +SV * +callMethod(...) + PPCODE: + if(_current_method) { + MethodCall c(qt_Smoke, _current_method, &ST(0), items); + c.next(); + SV *ret = c.var(); + SvREFCNT_inc(ret); + PUSHs(sv_2mortal(ret)); + } else + PUSHs(sv_newmortal()); + +bool +isObject(obj) + SV *obj + CODE: + RETVAL = sv_to_ptr(obj) ? TRUE : FALSE; + OUTPUT: + RETVAL + +void +setCurrentMethod(meth) + int meth + CODE: + // FIXME: damn, this is lame, and it doesn't handle ambiguous methods + _current_method = meth; //qt_Smoke->methodMaps[meth].method; + +SV * +getClassList() + CODE: + AV *av = newAV(); + for(int i = 1; i <= qt_Smoke->numClasses; i++) { +//printf("%s => %d\n", qt_Smoke->classes[i].className, i); + av_push(av, newSVpv(qt_Smoke->classes[i].className, 0)); +// hv_store(hv, qt_Smoke->classes[i].className, 0, newSViv(i), 0); + } + RETVAL = newRV((SV*)av); + OUTPUT: + RETVAL + +void +installthis(package) + char *package + CODE: + if(!package) XSRETURN_EMPTY; + char *name = new char[strlen(package) + 7]; + char *file = __FILE__; + strcpy(name, package); + strcat(name, "::this"); + // *{ $name } = sub () : lvalue; + CV *thissub = newXS(name, XS_this, file); + sv_setpv((SV*)thissub, ""); // sub this () : lvalue; + delete[] name; + +void +installattribute(package, name) + char *package + char *name + CODE: + if(!package || !name) XSRETURN_EMPTY; + char *attr = new char[strlen(package) + strlen(name) + 3]; + sprintf(attr, "%s::%s", package, name); + char *file = __FILE__; + // *{ $attr } = sub () : lvalue; + CV *attrsub = newXS(attr, XS_attr, file); + sv_setpv((SV*)attrsub, ""); + CvLVALUE_on(attrsub); + CvNODEBUG_on(attrsub); + delete[] attr; + +void +installsuper(package) + char *package + CODE: + if(!package) XSRETURN_EMPTY; + char *attr = new char[strlen(package) + 8]; + sprintf(attr, "%s::SUPER", package); + char *file = __FILE__; + CV *attrsub = newXS(attr, XS_super, file); + sv_setpv((SV*)attrsub, ""); + delete[] attr; + +void +installautoload(package) + char *package + CODE: + if(!package) XSRETURN_EMPTY; + char *autoload = new char[strlen(package) + 11]; + strcpy(autoload, package); + strcat(autoload, "::_UTOLOAD"); + char *file = __FILE__; + // *{ $package."::AUTOLOAD" } = XS_AUTOLOAD + newXS(autoload, XS_AUTOLOAD, file); + delete[] autoload; + +# ----------------- XSUBS for Qt:: ----------------- + +MODULE = Qt PACKAGE = Qt + +SV * +this() + CODE: + RETVAL = newSVsv(sv_this); + OUTPUT: + RETVAL + +SV * +app() + CODE: + RETVAL = newRV_inc(sv_qapp); + OUTPUT: + RETVAL + +SV * +version() + CODE: + RETVAL = newSVpv(QT_VERSION_STR,0); + OUTPUT: + RETVAL + +BOOT: + init_qt_Smoke(); + qt_Smoke->binding = new QtSmokeBinding(qt_Smoke); + install_handlers(Qt_handlers); + pointer_map = newHV(); + sv_this = newSV(0); + methcache = new QAsciiDict<Smoke::Index>(1187); + classcache = new QAsciiDict<Smoke::Index>(827); + methcache->setAutoDelete(1); + classcache->setAutoDelete(1); diff --git a/PerlQt/bin/pqtapi b/PerlQt/bin/pqtapi new file mode 100755 index 0000000..9c5eadf --- /dev/null +++ b/PerlQt/bin/pqtapi @@ -0,0 +1,82 @@ +#!/usr/bin/perl + +# Note: this program is part of PerlQt and makes use of its internal functions. +# You should not rely on those in your own programs. + +use Getopt::Std; +use strict 'vars'; + +our (%o, @x, $h); +getopts('r:hvimp', \%o); + +package Qt::_internal; +use Qt; + +exists $o{'v'} and do{ print "PerlQt-$Qt::VERSION using Qt-".&Qt::version."\n" and exit 0 }; +exists $o{'h'} and do{ print $h and exit 0 }; +exists $o{'m'} and do{ # interactive mode for driving the Qt Designer Plugin + select(STDOUT); $| = 1; # unbuffered + while(<STDIN>) + { + chomp; + s/^Q(?=[A-Z])/Qt::/; + my $i = find_pclassid( $_ ); + print "__START__\n"; + if ($i) + { + my $a = findAllMethods( $i ); + my $t = dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + getAllParents($i, \my @sup); + for my $s(@sup) + { + $a = findAllMethods( $s ); + $t.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + } + $t =~ s/\t//gs; + print $t; + } + print "__END__\n"; + } +}; +(my $c = $ARGV[0]) =~ s/^Q(?=[A-Z])/Qt::/; +my $i = $c ? find_pclassid( $c ) : 1; +my $r = exists $o{'r'} ? (exists $o{'i'} ? qr|$o{'r'}|i : qr|$o{'r'}|) : 0; +my $d = ""; + +while ($i) +{ + my $a=findAllMethods($i); + last unless keys %$a; + @x=map {@{ $$a{$_} }} sort keys %$a; + $d = dumpCandidates(\@x); + if($c and $i and exists $o{'p'}) + { + getAllParents($i, \my @sup); + for my $s(@sup) + { + $a = findAllMethods( $s ); + $d.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + } + } + if($r) + { + map { print "$_\n" if $_=~$r } split("\n", $d); + } + else + { + print $d + } + $c and last; + $i++ +} + +BEGIN { + $h = "pqtapi - a PerlQt introspection tool\t(c) Germain Garand 2003 <germain\@ebooksfrance.org>\n\n". + "usage: pqtapi [-r <re>] [<class>]\n\n". + "options:\n". + "\t-r <re> : find all functions matching regular expression/keyword <re>\n". + "\t-i : together with -r, performs a case insensitive search\n". + "\t-p : display also inherited methods for <class>.\n". + "\t-v : print PerlQt and Qt versions\n". + "\t-h : print this help message\n"; +} diff --git a/PerlQt/bin/pqtsh b/PerlQt/bin/pqtsh new file mode 100755 index 0000000..11a9e64 --- /dev/null +++ b/PerlQt/bin/pqtsh @@ -0,0 +1,675 @@ +#!/usr/bin/perl + +# pqtsh : a graphical shell for PerlQt. +# +# author: Germain Garand <germain@ebooksfrance.org> +# license: GNU Public License v2 +# + +use utf8; +use strict 'vars'; + +package QtShellControl; + +use Qt; +use Qt::isa qw(Qt::MainWindow); +use Qt::slots + fileOpen => [], + fileSave => [], + fileSaveAs => [], + filePrint => [], + fileExit => [], + helpExample => []; +use Qt::signals + fileNeedsEval => [QString]; +use Qt::attributes qw( + menubar + fileMenu + helpMenu + toolBar + fileName + fileOpenAction + fileSaveAction + fileSaveAsAction + filePrintAction + fileExitAction + helpExampleAction + comboBox + sessionLog + executedLines + printer +); + +our $image0_data = +["22 22 7 1", +". c None", +"# c #000000", +"b c #292c29", +"c c #5a5d5a", +"d c #838583", +"e c #c5c2c5", +"a c #ffffff", +"......................", +"....##########........", +"....#aaaaaaa#b#.......", +"....#aaaaaaa#cb#......", +"....#aaaaaaa#dcb#.....", +"....#aaaaaaa#edcb#....", +"....#aaaaaaa#aedcb#...", +"....#aaaaaaa#######...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....#aaaaaaaaaaaaa#...", +"....###############...", +"......................", +"......................"]; + +our $image1_data = +["22 22 5 1", +". c None", +"# c #000000", +"c c #838100", +"a c #ffff00", +"b c #ffffff", +"......................", +"......................", +"......................", +"............####....#.", +"...........#....##.##.", +"..................###.", +".................####.", +".####...........#####.", +"#abab##########.......", +"#babababababab#.......", +"#ababababababa#.......", +"#babababababab#.......", +"#ababab###############", +"#babab##cccccccccccc##", +"#abab##cccccccccccc##.", +"#bab##cccccccccccc##..", +"#ab##cccccccccccc##...", +"#b##cccccccccccc##....", +"###cccccccccccc##.....", +"##cccccccccccc##......", +"###############.......", +"......................"]; + +our $image2_data = +["22 22 5 1", +". c None", +"# c #000000", +"a c #838100", +"b c #c5c2c5", +"c c #cdb6d5", +"......................", +".####################.", +".#aa#bbbbbbbbbbbb#bb#.", +".#aa#bbbbbbbbbbbb#bb#.", +".#aa#bbbbbbbbbcbb####.", +".#aa#bbbccbbbbbbb#aa#.", +".#aa#bbbccbbbbbbb#aa#.", +".#aa#bbbbbbbbbbbb#aa#.", +".#aa#bbbbbbbbbbbb#aa#.", +".#aa#bbbbbbbbbbbb#aa#.", +".#aa#bbbbbbbbbbbb#aa#.", +".#aaa############aaa#.", +".#aaaaaaaaaaaaaaaaaa#.", +".#aaaaaaaaaaaaaaaaaa#.", +".#aaa#############aa#.", +".#aaa#########bbb#aa#.", +".#aaa#########bbb#aa#.", +".#aaa#########bbb#aa#.", +".#aaa#########bbb#aa#.", +".#aaa#########bbb#aa#.", +"..##################..", +"......................"]; + +our $image3_data = +["22 22 88 2", +"Qt c None", +".2 c #000000", +".S c #08ff08", +"#v c #100810", +".U c #101010", +"#c c #101018", +".M c #181018", +"#e c #181818", +".A c #181820", +".L c #201820", +"#l c #202020", +".z c #202029", +"#m c #292029", +"#u c #292829", +"#n c #292831", +".R c #29ff29", +"#o c #312831", +".T c #313031", +"#p c #313039", +".Z c #31ff31", +"#q c #393039", +"#t c #393839", +".y c #393841", +"#s c #413841", +".o c #414041", +"#h c #4a4852", +".n c #5a505a", +"#r c #5a5962", +".I c #5ace5a", +"#b c #6a616a", +".p c #6a696a", +".x c #6a6973", +".Y c #6aff62", +".l c #736973", +".t c #7b717b", +".s c #7b7183", +".0 c #7bff7b", +".r c #837983", +".u c #83798b", +"#g c #83858b", +".v c #8b7994", +"#i c #8b858b", +".w c #8b8594", +"#j c #8b8d8b", +".8 c #8b8d94", +".m c #948d94", +"#k c #948d9c", +"#f c #949594", +".q c #94959c", +".J c #94c694", +"#d c #9c959c", +"#a c #9c95a4", +".k c #9c9d9c", +".N c #9c9da4", +".H c #9ccea4", +".K c #a49da4", +"#. c #a49dac", +".i c #a4a5a4", +".3 c #a4a5ac", +"## c #ac9dac", +".V c #aca5ac", +".d c #acaeac", +".j c #acaeb4", +".9 c #b4aeb4", +".# c #b4b6b4", +".a c #bdbebd", +".7 c #bdd6bd", +".c c #c5c6c5", +".5 c #cdc6cd", +".b c #cdcecd", +".4 c #cdced5", +".F c #d5ced5", +".G c #d5cede", +".h c #d5d6d5", +".E c #d5d6de", +".Q c #d5ffd5", +".B c #ded6de", +".1 c #ded6e6", +".g c #dedede", +".D c #dedee6", +".6 c #e6dee6", +".f c #e6e6e6", +".C c #e6e6ee", +".X c #e6ffe6", +".O c #eee6ee", +".e c #eeeeee", +".W c #f6f6f6", +".P c #ffffff", +"QtQtQtQtQtQt.#.a.b.b.b.b.c.c.a.a.d.aQtQtQtQt", +"QtQtQtQtQtQt.a.e.f.f.f.f.f.e.e.e.g.aQtQtQtQt", +"QtQtQtQtQtQt.a.c.c.c.b.b.c.c.c.c.a.cQtQtQtQt", +"QtQtQtQtQtQt.#.a.a.a.a.#.a.a.#.#.d.aQtQtQtQt", +"QtQtQtQtQt.c.d.c.a.c.c.c.a.a.a.c.#QtQtQtQtQt", +"QtQtQtQtQt.a.a.#.a.a.a.a.a.a.c.c.#QtQtQtQtQt", +"QtQtQtQtQt.a.#.c.a.a.a.a.a.c.a.c.dQtQtQtQtQt", +"QtQtQtQtQt.c.a.a.a.a.a.a.a.a.a.a.#QtQtQtQtQt", +"QtQtQtQtQt.d.b.f.g.g.g.g.g.g.h.g.i.i.jQtQtQt", +"QtQtQt.a.k.l.#.h.b.h.b.h.b.h.g.g.m.n.o.p.#Qt", +"QtQt.a.q.r.s.t.t.t.t.t.t.t.u.v.w.x.y.z.A.o.i", +"Qt.a.k.B.C.D.B.E.E.E.E.F.G.H.I.J.K.o.L.L.M.y", +".a.N.O.P.P.P.P.P.P.P.P.P.Q.R.S.R.b.v.T.A.U.L", +".V.W.P.P.P.P.P.P.P.P.P.P.X.Y.Z.0.P.1.t.A.2.L", +".3.E.4.5.4.h.E.E.g.6.D.B.D.E.7.F.4.5.8.M.2.A", +".m.9.j.V.3#..3.K#.#..i#..K#.###a.q.8#b#c.2.L", +".m.j.j#..3.K.K.K.N.K.N.N.N.N#a#d#d.w#b#c.2#e", +"#f#.#..K.N.K.N.N.N#a.k#a#d#d#d#a.m#g#b.M.2#h", +".m.3.K.K#a.k#a#d#a.k#a#d#a#d.q.m.8#i.x#c#e.d", +"#f#g#i.w#j.w#i.8.w#i.8.8.m.8.m#k.8.w#b#e#fQt", +".#.l.z.A#l.z#m#m#m#n#o#o#p#p#q#q#p#o#p#fQtQt", +"QtQt.d#r#s#s#t#p.T.T.T#u#u.z#e#e#v.o.kQtQtQt"]; + + +sub NEW +{ + shift->SUPER::NEW(@_); + + my $image0 = Qt::Pixmap($image0_data); + my $image1 = Qt::Pixmap($image1_data); + my $image2 = Qt::Pixmap($image2_data); + my $image3 = Qt::Pixmap($image3_data); + my $box = VBox(this); + sessionLog = TextEdit($box, "sessionLog"); + sessionLog->setTextFormat(Qt::RichText()); + sessionLog->setReadOnly(1); + comboBox = ComboBox($box, "comboBox"); + comboBox->setEditable(1); + comboBox->setAutoCompletion(1); + this->setCentralWidget($box); + comboBox->setFocus; + this->resize(500,300); + setCaption("PerlQt Shell"); +# fileNewAction= Qt::Action(this, "fileNewAction"); +# fileNewAction->setIconSet(Qt::IconSet($image0)); +# fileNewAction->setText(trUtf8("New")); +# fileNewAction->setMenuText(trUtf8("&New")); +# fileNewAction->setAccel(KeySequence(trUtf8("Ctrl+N"))); + fileOpenAction= Qt::Action(this, "fileOpenAction"); + fileOpenAction->setIconSet(Qt::IconSet($image1)); + fileOpenAction->setText(trUtf8("Open")); + fileOpenAction->setMenuText(trUtf8("&Open...")); + fileOpenAction->setAccel(KeySequence(trUtf8("Ctrl+O"))); + fileSaveAction= Qt::Action(this, "fileSaveAction"); + fileSaveAction->setIconSet(Qt::IconSet($image2)); + fileSaveAction->setText(trUtf8("Save")); + fileSaveAction->setMenuText(trUtf8("&Save")); + fileSaveAction->setAccel(KeySequence(trUtf8("Ctrl+S"))); + fileSaveAsAction= Qt::Action(this, "fileSaveAsAction"); + fileSaveAsAction->setText(trUtf8("Save As")); + fileSaveAsAction->setMenuText(trUtf8("Save &As...")); + fileSaveAsAction->setAccel(KeySequence(trUtf8("Ctrl+A"))); + filePrintAction= Qt::Action(this, "filePrintAction"); + filePrintAction->setIconSet(Qt::IconSet($image3)); + filePrintAction->setText(trUtf8("Print")); + filePrintAction->setMenuText(trUtf8("&Print...")); + filePrintAction->setAccel(KeySequence(trUtf8("Ctrl+P"))); + fileExitAction= Qt::Action(this, "fileExitAction"); + fileExitAction->setText(trUtf8("Exit")); + fileExitAction->setMenuText(trUtf8("E&xit")); + fileExitAction->setAccel(KeySequence(trUtf8("Ctrl+E"))); + + helpExampleAction= Qt::Action(this, "helpExampleAction"); + helpExampleAction->setText(trUtf8("Example")); + helpExampleAction->setMenuText(trUtf8("Examp&le")); + helpExampleAction->setAccel(KeySequence(trUtf8("Ctrl+L"))); + + toolBar = Qt::ToolBar("", this, DockTop()); + + toolBar->setLabel(trUtf8("Tools")); + fileOpenAction->addTo(toolBar); + fileSaveAction->addTo(toolBar); + filePrintAction->addTo(toolBar); + + + menubar= Qt::MenuBar( this, "menubar"); + + fileMenu= Qt::PopupMenu(this); +# fileNewAction->addTo(fileMenu); + fileOpenAction->addTo(fileMenu); + fileSaveAction->addTo(fileMenu); + fileSaveAsAction->addTo(fileMenu); + fileMenu->insertSeparator; + filePrintAction->addTo(fileMenu); + fileMenu->insertSeparator; + fileExitAction->addTo(fileMenu); + menubar->insertItem(trUtf8("&File"), fileMenu); + + menubar->insertSeparator; + + helpMenu= Qt::PopupMenu(this); + helpExampleAction->addTo(helpMenu); + menubar->insertItem(trUtf8("&Help"), helpMenu); + +# Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()"); + Qt::Object::connect(fileOpenAction, SIGNAL "activated()", this, SLOT "fileOpen()"); + Qt::Object::connect(fileSaveAction, SIGNAL "activated()", this, SLOT "fileSave()"); + Qt::Object::connect(fileSaveAsAction, SIGNAL "activated()", this, SLOT "fileSaveAs()"); + Qt::Object::connect(filePrintAction, SIGNAL "activated()", this, SLOT "filePrint()"); + Qt::Object::connect(fileExitAction, SIGNAL "activated()", this, SLOT "fileExit()"); + Qt::Object::connect(helpExampleAction, SIGNAL "activated()", this, SLOT "helpExample()"); + + + executedLines = []; +} + +#sub fileNew +#{ +# print "Form1->fileNew(): Not implemented yet.\n"; +#} + +sub fileOpen +{ + my $fn = Qt::FileDialog::getOpenFileName( + ".", + "Pqtsh Session (*.pqts)", + this, + "open session", + "Choose a file to open" ); + $fn or return; + emit fileNeedsEval($fn); + +} + +sub getFileName +{ + fileName = Qt::FileDialog::getSaveFileName( + ".", + "Pqtsh Session (*.pqts)", + this, + "save session", + "Choose a filename" ); + fileName !~ /\.pqts$/ and fileName = fileName . ".pqts"; + return fileName; +} + + +sub save +{ + my $fn = shift; + open( OUT, ">$fn") or do { + Qt::MessageBox::critical( + this, + "Error" , + "Couldn't open $fn for writing: $!", + &Qt::MessageBox::Ok, + &Qt::MessageBox::NoButton ); + return + }; + for (@{ &executedLines }) + { + next if /^\s*$/; + chomp; + $_ .= ";" unless /;\s*$/; + print OUT $_, "\n" + } + close OUT +} + +sub fileSave +{ + emptySession() and return; + my $fn = fileName || getFileName(); + $fn or return; + save($fn) +} + +sub fileSaveAs +{ + emptySession() and return; + my $fn; + my ($cond, $doit); + AGAIN: + { + $fn = getFileName(); + $fn or return; + if( -e $fn ) + { + $cond++; + $doit = Qt::MessageBox::warning( + this, + "Warning" , + "File exists, overwrite ?", + &Qt::MessageBox::Yes, + &Qt::MessageBox::No ); + } + else + { $cond = 0 } + } + goto AGAIN if $cond and $doit == &Qt::MessageBox::No; + save($fn) +} + +sub filePrint +{ + my $Margin = 10; + my $pageNo = 1; + emptySession() and return; + printer = Qt::Printer unless printer; + if ( printer->setup(this) ) { + statusBar()->message( "Printing..." ); + my $p = Qt::Painter; + if( !$p->begin( printer ) ) + { + statusBar()->message( "An error occured..." ); + return + } + + $p->setFont( sessionLog->font() ); + my $yPos = 0; + my $fm = $p->fontMetrics; + my $metrics = Qt::PaintDeviceMetrics( printer ); + + for( my $i = 0 ; $i < @{ &executedLines } ; $i++ ) { + if ( $Margin + $yPos > $metrics->height() - $Margin ) { + my $msg ="Printing (page ". ++$pageNo . ")..."; + statusBar()->message( $msg ); + printer->newPage(); + $yPos = 0; + } + $p->drawText( $Margin, $Margin + $yPos, + $metrics->width(), $fm->lineSpacing(), + &ExpandTabs | &DontClip, + ${ &executedLines }[ $i ] ); + $yPos = $yPos + $fm->lineSpacing(); + } + $p->end(); + statusBar()->message( "Printing completed", 3000 ); + } else { + statusBar()->message( "Printing aborted", 3000 ); + } +} + +sub fileExit +{ + emit Qt::app()->quit() if confirmExit(); +} + +sub closeEvent +{ + my $e = shift; + if(confirmExit()) + { + $e->accept + } + else + { + $e->ignore + } +} + +sub confirmExit +{ + my $doit; + if(@{ &executedLines }) + { + $doit = Qt::MessageBox::warning( + this, + "Warning" , + "A session is opened, quit anyway ?", + &Qt::MessageBox::Yes, + &Qt::MessageBox::No ); + } + else + { return 1 } + + return (($doit == &Qt::MessageBox::No) ? 0 : 1); +} + +sub emptySession +{ + unless (@{ &executedLines }) + { + statusBar()->message("Session is empty...", 3000); + return 1; + } + 0 +} + +sub helpExample +{ + emit fileNeedsEval("__DATA__") +} + +1; + +package QtShell; + +use Qt; +use Qt::isa qw(Qt::MainWindow); +use Qt::slots + evalInput=>[], + evalFile=>[QString]; +use Qt::attributes qw( + shellWindow +); +use QtShellControl; + +sub NEW +{ + shift->SUPER::NEW(@_); + + shellWindow = QtShellControl(undef, "shellWindow"); + this->resize(350,350); + this->move(Point(10,10)); + shellWindow->move(Point(300,200)); + this->show; + shellWindow->show; + + + this->connect(shellWindow->comboBox->lineEdit, SIGNAL 'returnPressed()', SLOT 'evalInput()'); + this->{'prompt'} = '<b><font color="blue">$></font></b>'; + setCaption("MainWindow - this"); + shellWindow->sessionLog->setText("Ready.<br>"); + Qt::Object::connect(shellWindow, SIGNAL 'fileNeedsEval(QString)', this, SLOT 'evalFile(QString)'); +} + +sub logAppend +{ + shellWindow->sessionLog->setText( shellWindow->sessionLog->text . shift ) +} + +sub evalInput +{ + evalOneLine( shellWindow->comboBox->currentText ); +} + +sub evalOneLine +{ + my $prot = my $ln = shift; + $prot =~ s/</</gs; + $prot =~ s/>/>/gs; + logAppend( this->{'prompt'}. "$prot<br>" ); + { + no strict; + eval $ln; + } + if($@) + { + my $prot = $@ ; + $prot =~ s/</</gs; + $prot =~ s/>/>/gs; + my $c = shellWindow->sessionLog->color; + $prot =~ s/\n/<br>/gs; + logAppend('<font color="red">'.$prot.'</font><br>'); + shellWindow->sessionLog->setColor( $c ); + } + else + { + push @{ shellWindow()->{'executedLines'} }, $ln; + shellWindow->comboBox->clearEdit; + shellWindow->comboBox->setFocus; + } + shellWindow->sessionLog->scrollToBottom +} + +sub evalFile +{ + my $fn = shift; + my $fh; + if($fn eq "__DATA__") + { + $fh = \*::DATA + } + else + { + open($fh, $fn) or do { + Qt::MessageBox::warning ( + this, + "Error" , + "Couldn't open $fn: $!", + &Qt::MessageBox::Ok, + &Qt::MessageBox::NoButton ); + return + }; + } + while(<$fh>) + { + evalOneLine($_) + } + close $fh +} + +1; + +package Qt::TextHandle; + +sub TIEHANDLE { my ( $classnm, $widg, $color) = @_; + my $h = { widg => $widg, color => $color}; + bless $h, $classnm; + +} + +sub PRINT { + my $me = shift; + my $color = $me->{color}; + my $printed = join $/, @_; + $printed =~ s/</</gs; + $printed =~ s/>/>/gs; + $printed =~ s/\n/<br>/gs; + $me->{widg}->setText( $me->{widg}->text . "<font color=\"$color\">$printed</font>" ); + +} + +sub PRINTF { shift->PRINT(sprintf shift, @_); } +sub CLOSE { shift->UNTIE; } +sub UNTIE { } + + +1; + +package main; +use strict; +use Qt; +use QtShell; +use Qt::debug; + +my $app = Qt::Application(\@ARGV); +my $w = QtShell(undef, "mainWindow"); +my $shw = $w->shellWindow; +$app->setMainWidget($shw); +tie *STDOUT, 'Qt::TextHandle', $shw->sessionLog, 'black'; +tie *STDERR, 'Qt::TextHandle', $shw->sessionLog, 'red'; + +exit $app->exec; + +__DATA__ +statusBar()->message("Hello World !"); +use Qt::attributes qw|datetime button textedit sample vbox| ; +vbox = VBox(this); +datetime = DateTimeEdit(vbox); +textedit = Qt::TextEdit(vbox); +button = PushButton("Hello World!", vbox) ; +this->setCentralWidget(vbox); +resize(220,240); +vbox->show; +sample = Qt::PopupMenu( this ); +use Qt::slots 'there' => []; +sample->insertItem("&There", this, SLOT 'there()'); +menuBar()->insertItem("&Here", sample); +sub there { statusBar()->message("There...", 2000) }; diff --git a/PerlQt/examples/aclock/AnalogClock.pm b/PerlQt/examples/aclock/AnalogClock.pm new file mode 100644 index 0000000..d4aeff9 --- /dev/null +++ b/PerlQt/examples/aclock/AnalogClock.pm @@ -0,0 +1,137 @@ +package AnalogClock; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + setTime => ['const QTime&'], + drawClock => ['QPainter*'], + timeout => []; +use Qt::attributes qw( + clickPos + _time +); + +# +# Constructs an analog clock widget that uses an internal QTimer +# + +sub NEW { + shift->SUPER::NEW(@_); + _time = Qt::Time::currentTime(); # get current time + my $internalTimer = Qt::Timer(this); # create internal timer + this->connect($internalTimer, SIGNAL('timeout()'), SLOT('timeout()')); + $internalTimer->start(5000); # emit signal every 5 seconds +} + +sub mousePressEvent { + my $e = shift; + if(isTopLevel()) { + # Lack of operators is really noticable here + my $topLeft = Qt::Point( + geometry()->topLeft->x - frameGeometry()->topLeft->x, + geometry()->topLeft->y - frameGeometry()->topLeft->y + ); + clickPos = Qt::Point($e->pos->x + $topLeft->x, + $e->pos->y + $topLeft->y); + } +} + +sub mouseMoveEvent { + my $e = shift; + if(isTopLevel()) { + move(Qt::Point($e->globalPos->x - clickPos->x, + $e->globalPos->y - clickPos->y)); + } +} + +sub setTime { + my $t = shift; + timeout(); +} + +# +# The QTimer::timeout() signal is received by this slot. +# + +sub timeout { + my $new_time = Qt::Time::currentTime(); # get the current time + _time = _time->addSecs(5); + if($new_time->minute != _time->minute) { # minute has changed + if(autoMask()) { + updateMask(); + } else { + update(); + } + } +} + +sub paintEvent { + return if autoMask(); + my $paint = Qt::Painter(this); + $paint->setBrush(colorGroup()->foreground); + drawClock($paint); +} + +# If clock is transparent, we use updateMask() +# instead of paintEvent() + +sub updateMask { # paint clock mask + my $bm = Qt::Bitmap(size()); + $bm->fill(&color0); # transparent + + my $paint = Qt::Painter; + $paint->begin($bm, this); + $paint->setBrush(&color1); # use non-transparent color + $paint->setPen(&color1); + + drawClock($paint); + + $paint->end; + setMask($bm); +} + +# +# The clock is painted using a 1000x1000 square coordinate system, in +# the centered square, as big as possible. The painter's pen and +# brush colors are used. +# +sub drawClock { + my $paint = shift; + $paint->save; + + $paint->setWindow(-500,-500, 1000,1000); + + my $v = $paint->viewport; + my $d = min($v->width, $v->height); + $paint->setViewport($v->left + ($v->width-$d)/2, + $v->top - ($v->height-$d)/2, $d, $d); + + # _time = Qt::Time::currentTime(); + my $pts = Qt::PointArray(); + + $paint->save; + $paint->rotate(30*(_time->hour%12-3) + _time->minute/2); + $pts->setPoints([-20,0, 0,-20, 300,0, 0,20]); + $paint->drawConvexPolygon($pts); + $paint->restore; + + $paint->save; + $paint->rotate((_time->minute-15)*6); + $pts->setPoints([-10,0, 0,-10, 400,0, 0,10]); + $paint->drawConvexPolygon($pts); + $paint->restore; + + for(1 .. 12) { + $paint->drawLine(440,0, 460,0); + $paint->rotate(30); + } + + $paint->restore; +} + +sub setAutoMask { + my $b = shift; + setBackgroundMode($b ? &PaletteForeground : &PaletteBackground); + Qt::Widget::setAutoMask($b); +} + +1; diff --git a/PerlQt/examples/aclock/aclock.pl b/PerlQt/examples/aclock/aclock.pl new file mode 100644 index 0000000..ff59ec1 --- /dev/null +++ b/PerlQt/examples/aclock/aclock.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w +use strict; +use Qt; +use AnalogClock; + +my $a = Qt::Application(\@ARGV); +my $clock = AnalogClock; +$clock->setAutoMask(1) if @ARGV and $ARGV[0] eq '-transparent'; +$clock->resize(100, 100); +$a->setMainWidget($clock); +$clock->setCaption("PerlQt example - Analog Clock"); +$clock->show; +exit $a->exec; diff --git a/PerlQt/examples/buttongroups/ButtonsGroups.pm b/PerlQt/examples/buttongroups/ButtonsGroups.pm new file mode 100644 index 0000000..0bb6c73 --- /dev/null +++ b/PerlQt/examples/buttongroups/ButtonsGroups.pm @@ -0,0 +1,104 @@ +package ButtonsGroups; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + slotChangeGrp3State => []; +use Qt::attributes qw( + state + rb21 + rb22 + rb23 +); + +# +# Constructor +# +# Creates all child widgets of the ButtonGroups window +# + +sub NEW { + shift->SUPER::NEW(@_); + + # Create Widgets which allow easy layouting + my $vbox = Qt::VBoxLayout(this); + my $box1 = Qt::HBoxLayout($vbox); + my $box2 = Qt::HBoxLayout($vbox); + + # ------- first group + + # Create an exclusive button group + my $bgrp1 = Qt::ButtonGroup(1, &Horizontal, "Button Group &1 (exclusive)", this); + $box1->addWidget($bgrp1); + $bgrp1->setExclusive(1); + + # insert 3 radiobuttons + Qt::RadioButton("R&adiobutton 2", $bgrp1); + Qt::RadioButton("Ra&diobutton 3", $bgrp1); + + # ------- second group + + # Create a non-exclusive buttongroup + my $bgrp2 = Qt::ButtonGroup(1, &Horizontal, "Button Group &2 (non-exclusive)", this); + $box1->addWidget($bgrp2); + $bgrp2->setExclusive(0); + + # insert 3 checkboxes + Qt::CheckBox("&Checkbox 1", $bgrp2); + my $cb12 = Qt::CheckBox("C&heckbox 2", $bgrp2); + $cb12->setChecked(1); + my $cb13 = Qt::CheckBox("Triple &State Button", $bgrp2); + $cb13->setTristate(1); + $cb13->setChecked(1); + + # ----------- third group + + # create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons + my $bgrp3 = Qt::ButtonGroup(1, &Horizontal, "Button Group &3 (Radiobutton-exclusive)", this); + $box2->addWidget($bgrp3); + $bgrp3->setRadioButtonExclusive(1); + + # insert three radiobuttons + rb21 = Qt::RadioButton("Rad&iobutton 1", $bgrp3); + rb22 = Qt::RadioButton("Radi&obutton 2", $bgrp3); + rb23 = Qt::RadioButton("Radio&button 3", $bgrp3); + rb23->setChecked(1); + + # insert a checkbox + state = Qt::CheckBox("E&nable Radiobuttons", $bgrp3); + state->setChecked(1); + # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() + this->connect(state, SIGNAL('clicked()'), SLOT('slotChangeGrp3State()')); + + # ----------- fourth group + + # create a groupbox which layouts its childs in a columns + my $bgrp4 = Qt::ButtonGroup(1, &Horizontal, "Groupbox with &normal buttons", this); + $box2->addWidget($bgrp4); + + # insert three pushbuttons... + Qt::PushButton("&Push Button", $bgrp4); + my $tb2 = Qt::PushButton("&Toggle Button", $bgrp4); + my $tb3 = Qt::PushButton("&Flat Button", $bgrp4); + + # ... and make the second one a toggle button + $tb2->setToggleButton(1); + $tb2->setOn(1); + + # ... and make the third one a flat button + $tb3->setFlat(1); +} + +# +# SLOT slotChangeGrp3State() +# +# enables/disables the radiobuttons of the third buttongroup +# + +sub slotChangeGrp3State { + rb21->setEnabled(state->isChecked); + rb22->setEnabled(state->isChecked); + rb23->setEnabled(state->isChecked); +} + +1; diff --git a/PerlQt/examples/buttongroups/buttongroups.pl b/PerlQt/examples/buttongroups/buttongroups.pl new file mode 100644 index 0000000..3fdf884 --- /dev/null +++ b/PerlQt/examples/buttongroups/buttongroups.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w +use strict; +use Qt; +use ButtonsGroups; + +my $a = Qt::Application(\@ARGV); + +my $buttonsgroups = ButtonsGroups; +$buttonsgroups->resize(500, 250); +$buttonsgroups->setCaption("PerlQt Example - Buttongroups"); +$a->setMainWidget($buttonsgroups); +$buttonsgroups->show; +exit $a->exec; diff --git a/PerlQt/examples/dclock/DigitalClock.pm b/PerlQt/examples/dclock/DigitalClock.pm new file mode 100644 index 0000000..4611272 --- /dev/null +++ b/PerlQt/examples/dclock/DigitalClock.pm @@ -0,0 +1,88 @@ +package DigitalClock; +use strict; +use Qt; +use Qt::isa qw(Qt::LCDNumber); +use Qt::slots + stopDate => [], + showTime => []; +use Qt::attributes qw( + showingColon + normalTimer + showDateTimer +); + +# +# Constructs a DigitalClock widget +# + +sub NEW { + shift->SUPER::NEW(@_); + showingColon = 0; + setFrameStyle(&Panel | &Raised); + setLineWidth(2); + showTime(); + normalTimer = startTimer(500); + showDateTimer = -1; +} + +# +# Handles timer events and the digital clock widget. +# There are two different timers; one timer for updating the clock +# and another one for switching back from date mode to time mode +# + +sub timerEvent { + my $e = shift; + if($e->timerId == showDateTimer) { # stop showing date + stopDate(); + } elsif(showDateTimer == -1) { # normal timer + showTime(); + } +} + +# +# Enters date mode when the left mouse button is pressed +# + +sub mousePressEvent { + my $e = shift; + showDate() if $e->button == &LeftButton; +} + +# +# Shows the durrent date in the internal lcd widget. +# Fires a timer to stop showing the date. +# + +sub showDate { + return if showDateTimer != -1; # already showing date + my $date = Qt::Date::currentDate(); + my $s = sprintf("%2d %2d", $date->month, $date->day); + display($s); # sets the LCD number/text + showDateTimer = startTimer(2000); # keep this state for 2 secs +} + +# +# Stops showing the date. +# + +sub stopDate { + killTimer(showDateTimer); + showDateTimer = -1; + showTime(); +} + +# +# Shows the current time in the internal lcd widget. +# + +sub showTime { + showingColon = !showingColon; + my $s = substr(Qt::Time::currentTime()->toString, 0, 5); + $s =~ s/^0/ /; + $s =~ s/:/ / unless showingColon; + display($s); +} + +1; + diff --git a/PerlQt/examples/dclock/dclock.pl b/PerlQt/examples/dclock/dclock.pl new file mode 100644 index 0000000..f5820fd --- /dev/null +++ b/PerlQt/examples/dclock/dclock.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w +use strict; +use Qt; +use DigitalClock; + +my $a = Qt::Application(\@ARGV); +my $clock = DigitalClock; +$clock->resize(170, 80); +$a->setMainWidget($clock); +$clock->setCaption("PerlQt Example - Digital Clock"); +$clock->show; +exit $a->exec; diff --git a/PerlQt/examples/drawdemo/drawdemo.pl b/PerlQt/examples/drawdemo/drawdemo.pl new file mode 100644 index 0000000..c58e10d --- /dev/null +++ b/PerlQt/examples/drawdemo/drawdemo.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl -w +use strict; +package DrawView; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + updateIt => ['int'], + printIt => []; +use Qt::attributes qw( + printer + bgroup + _print + drawindex + maxindex +); + +# +# First we define the functionality our demo should present +# to the user. You might add different demo-modes if you wish so +# + +# +# This function draws a color wheel. +# The coordinate system x=(0..500), y=(0..500) spans the paint device. +# + +sub drawColorWheel { + my $p = shift; + my $f = Qt::Font("times", 18, &Qt::Font::Bold); + $p->setFont($f); + $p->setPen(&black); + $p->setWindow(0, 0, 500, 500); # defines coordinate system + + for my $i (0..35) { + my $matrix = Qt::WMatrix; + $matrix->translate(250.0, 250.0); # move to center + $matrix->shear(0.0, 0.3); # twist it + $matrix->rotate($i*10.0); # rotate 0,10,20,.. degrees + $p->setWorldMatrix($matrix); # use this world matrix + + my $c = Qt::Color; + $c->setHsv($i*10, 255, 255); # rainbow effect + $p->setBrush($c); # solid fill with color $c + $p->drawRect(70, -10, 80, 10); # draw the rectangle + + my $n = sprintf "H=%d", $i*10; + $p->drawText(80+70+5, 0, $n); # draw the hue number + } +} + +# +# This function draws a few lines of text using different fonts. +# + +sub drawFonts { + my $p = shift; + my @fonts = qw(Helvetica Courier Times); + my @sizes = (10, 12, 18, 24, 36); + my $y = 0; + for my $f (@fonts) { + for my $s (@sizes) { + my $font = Qt::Font($f, $s); + $p->setFont($font); + my $fm = $p->fontMetrics; + $y += $fm->ascent; + $p->drawText(10, $y, "Quartz Glyph Job Vex'd Cwm Finks"); + $y += $fm->descent; + } + } +} + +# +# This function draws some shapes +# + +sub drawShapes { + my $p = shift; + my $b1 = Qt::Brush(&blue); + my $b2 = Qt::Brush(&green, &Dense6Pattern); # green 12% fill + my $b3 = Qt::Brush(&NoBrush); # void brush + my $b4 = Qt::Brush(&CrossPattern); # black cross pattern + + $p->setPen(&red); + $p->setBrush($b1); + $p->drawRect(10, 10, 200, 100); + $p->setBrush($b2); + $p->drawRoundRect(10, 150, 200, 100, 20, 20); + $p->setBrush($b3); + $p->drawEllipse(250, 10, 200, 100); + $p->setBrush($b4); + $p->drawPie(250, 150, 200, 100, 45*16, 90*16); +} + +our @drawFunctions = ( +# title presented to user, reference to the function + { name => "Draw color wheel", f => \&drawColorWheel }, + { name => "Draw fonts" , f => \&drawFonts }, + { name => "Draw shapes" , f => \&drawShapes }, +); + +# +# Construct the DrawView with buttons. +# + +sub NEW { + shift->SUPER::NEW(@_); + + setCaption("PerlQt Draw Demo Application"); + setBackgroundColor(&white); + + # Create a button group to contain all buttons + bgroup = Qt::ButtonGroup(this); + bgroup->resize(200, 200); + this->connect(bgroup, SIGNAL('clicked(int)'), SLOT('updateIt(int)')); + + # Calculate the size for the radio buttons + my $maxwidth = 80; + my $maxheight = 10; + my $fm = bgroup->fontMetrics; + + for my $i (0 .. $#drawFunctions) { + my $n = $drawFunctions[$i]{name}; + my $w = $fm->width($n); + $maxwidth = max($w, $maxwidth); + } + + $maxwidth += 30; + + for my $i (0 .. $#drawFunctions) { + my $n = $drawFunctions[$i]{name}; + my $rb = Qt::RadioButton($n, bgroup); + $rb->setGeometry(10, $i*30+10, $maxwidth, 30); + + $maxheight += 30; + + $rb->setChecked(1) unless $i; + $i++; + } + + $maxheight += 10; + + drawindex = 0; + maxindex = scalar @drawFunctions; + $maxwidth += 20; + + bgroup->resize($maxwidth, $maxheight); + + printer = Qt::Printer; + + _print = Qt::PushButton("Print...", bgroup); + _print->resize(80, 30); + _print->move($maxwidth/2 - _print->width/2, maxindex*30+20); + this->connect(_print, SIGNAL('clicked()'), SLOT('printIt()')); + + bgroup->resize($maxwidth, _print->y+_print->height+10); + + resize(640,300); +} + +sub updateIt { + my $index = shift; + if($index < maxindex) { + drawindex = $index; + update(); + } +} + +sub drawIt { + my $p = shift; + $drawFunctions[drawindex]{f}->($p); +} + +sub printIt { + if(printer->setup(this)) { + my $paint = Qt::Painter(printer); + drawIt($paint); + } +} + +sub paintEvent { + my $paint = Qt::Painter(this); + drawIt($paint); +} + +sub resizeEvent { + bgroup->move(int(width() - bgroup->width), int(0)); +} + +package main; +use Qt; +use DrawView; + +my $app = Qt::Application(\@ARGV); +my $draw = DrawView; +$app->setMainWidget($draw); +$draw->setCaption("PerlQt Example - Drawdemo"); +$draw->show; +exit $app->exec; diff --git a/PerlQt/examples/drawlines/drawlines.pl b/PerlQt/examples/drawlines/drawlines.pl new file mode 100644 index 0000000..7297fa2 --- /dev/null +++ b/PerlQt/examples/drawlines/drawlines.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w +use strict; +package ConnectWidget; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::attributes qw( + points + colors + count + down +); +use constant MAXPOINTS => 2000; +use constant MAXCOLORS => 40; + +# +# Constructs a ConnectWidget. +# + +sub NEW { + shift->SUPER::NEW(@_[0,1], &WStaticContents); + + setBackgroundColor(&white); + count = 0; + down = 0; + points = []; + my @colors; + for(1 .. MAXCOLORS) { + push @colors, Qt::Color(rand(255), rand(255), rand(255)); + } + colors = \@colors; +} + +sub paintEvent { + my $paint = Qt::Painter(this); + for(my $i = 0; $i < count-1; $i++) { + for(my $j = $i+1; $j < count; $j++) { + $paint->setPen(colors->[rand(MAXCOLORS)]); + $paint->drawLine(points->[$i], points->[$j]); + } + } +} + +sub mousePressEvent { + down = 1; + count = 0; + points = []; + erase(); +} + +sub mouseReleaseEvent { + down = 0; + update(); +} + +sub mouseMoveEvent { + my $e = shift; + if(down && count < MAXPOINTS) { + my $paint = Qt::Painter(this); + push @{this->points}, Qt::Point($e->pos); + count++; + $paint->drawPoint($e->pos); + } +} + +package main; +use Qt; +use ConnectWidget; + +my $a = Qt::Application(\@ARGV); +my $connect = ConnectWidget; +$connect->setCaption("PerlQt Example - Draw lines"); +$a->setMainWidget($connect); +$connect->show; +exit $a->exec; diff --git a/PerlQt/examples/forever/forever.pl b/PerlQt/examples/forever/forever.pl new file mode 100644 index 0000000..bf6d56a --- /dev/null +++ b/PerlQt/examples/forever/forever.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w +use strict; +package Forever; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + updateCaption => []; +use Qt::attributes qw( + rectangles + colors +); +use constant numColors => 120; + +sub NEW { + shift->SUPER::NEW(@_); + colors = \my @colors; + for(my $a = 0; $a < numColors; $a++) { + push @colors, Qt::Color(rand(255), rand(255), rand(255)); + } + rectangles = 0; + startTimer(0); + my $counter = Qt::Timer(this); + this->connect($counter, SIGNAL('timeout()'), SLOT('updateCaption()')); + $counter->start(1000); +} + +sub updateCaption { + my $s = sprintf "PerlQt Example - Forever - %d rectangles/second", rectangles; + rectangles = 0; + setCaption($s); +} + +sub paintEvent { + my $paint = Qt::Painter(this); + my $w = width(); + my $h = height(); + return if $w <= 0 || $h <= 0; + $paint->setPen(&NoPen); + $paint->setBrush(colors->[rand(numColors)]); + $paint->drawRect(rand($w), rand($h), rand($w), rand($h)); +} + +sub timerEvent { + for(my $i = 0; $i < 100; $i++) { + repaint(0); + rectangles++; + } +} + +package main; +use Qt; +use Forever; + +my $a = Qt::Application(\@ARGV); +my $always = Forever; +$a->setMainWidget($always); +$always->setCaption("PerlQt Example - Forever"); +$always->show; +exit $a->exec; diff --git a/PerlQt/examples/network/httpd/httpd.pl b/PerlQt/examples/network/httpd/httpd.pl new file mode 100644 index 0000000..3f46041 --- /dev/null +++ b/PerlQt/examples/network/httpd/httpd.pl @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w + +## This program is based on an example program for Qt. It +## may be used, distributed and modified without limitation. +## +## Copyright (C) 1992-2000 Trolltech AS. All rights reserved. + + +# When a new client connects, the server constructs a Qt::Socket and all +# communication with the client is done over this Socket object. Qt::Socket +# works asynchronously - this means that all the communication is done +# through the two slots readClient() and discardClient(). + +package HttpDaemon; + +use Qt; +use Qt::isa qw(Qt::ServerSocket); +use Qt::signals + newConnect => [], + endConnect => [], + wroteToClient => []; +use Qt::slots + readClient => [], + discardClient => []; +use Qt::attributes qw( + sockets +); + +sub NEW +{ + shift->SUPER::NEW(8080, 1, $_[0]); + if( !this->ok() ) + { + die "Failed to bind to port 8080\n"; + } + sockets = {}; +} + +sub newConnection +{ + my $s = Qt::Socket( this ); + this->connect( $s, SIGNAL 'readyRead()', this, SLOT 'readClient()' ); + this->connect( $s, SIGNAL 'delayedCloseFinished()', this, SLOT 'discardClient()' ); + $s->setSocket( shift ); + sockets->{ $s } = $s; + emit newConnect(); +} + +sub readClient +{ + # This slot is called when the client sent data to the server. The + # server looks if it was a get request and sends a very simple HTML + # document back. + my $s = sender(); + if ( $s->canReadLine() ) + { + my @tokens = split( /\s\s*/, $s->readLine() ); + if ( $tokens[0] eq "GET" ) + { + my $string = "HTTP/1.0 200 Ok\n\rContent-Type: text/html; charset=\"utf-8\"\n\r". + "\n\r<h1>Nothing to see here</h1>\n"; + $s->writeBlock($string, length($string)); + $s->close(); + emit wroteToClient(); + } + } +} + +sub discardClient +{ + my $s = sender(); + sockets->{$s} = 0; + emit endConnect(); +} + +1; + + +# HttpInfo provides a simple graphical user interface to the server and shows +# the actions of the server. + +package HttpInfo; + +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + newConnect => [], + endConnect => [], + wroteToClient => []; +use Qt::attributes qw( + httpd + infoText +); + +use HttpDaemon; + +sub NEW +{ + shift->SUPER::NEW(@_); + httpd = HttpDaemon( this ); + my $port = httpd->port(); + my $itext = "This is a small httpd example.\n". + "You can connect with your\n". + "web browser to port $port\n"; + my $lb = Label( $itext, this ); + $lb->setAlignment( &AlignHCenter ); + infoText = TextView( this ); + my $quit = PushButton( "quit" , this ); + this->connect( httpd, SIGNAL 'newConnect()', SLOT 'newConnect()' ); + this->connect( httpd, SIGNAL 'endConnect()', SLOT 'endConnect()' ); + this->connect( httpd, SIGNAL 'wroteToClient()', SLOT 'wroteToClient()' ); + this->connect( $quit, SIGNAL 'pressed()', Qt::app(), SLOT 'quit()' ); +} + +sub newConnect +{ + infoText->append( "New connection" ); +} + +sub endConnect +{ + infoText->append( "Connection closed\n\n" ); +} + +sub wroteToClient +{ + infoText->append( "Wrote to client" ); +} + +1; + +package main; +use Qt; +use HttpInfo; + +my $app = Qt::Application(\@ARGV); +my $info = HttpInfo; +$app->setMainWidget($info); +$info->show; +exit $app->exec; diff --git a/PerlQt/examples/opengl/README b/PerlQt/examples/opengl/README new file mode 100644 index 0000000..5c93086 --- /dev/null +++ b/PerlQt/examples/opengl/README @@ -0,0 +1,12 @@ +Before you can run the OpenGL examples, you need to install +the OpenGL module available on CPAN (http://www.cpan.org) + +Latest version is 0.54, as of 09/11/02 + +Both Smoke and Qt must also have been compiled with OpenGL support. + +If your Qt library has OpenGL support but PerlQt complains about lacking + methods or classes, check ./configure's config.log file for any +error that might have occured while detecting your OpenGL settings. + +You might also want to check if OpenGL is properly installed on your system. diff --git a/PerlQt/examples/opengl/box/GLBox.pm b/PerlQt/examples/opengl/box/GLBox.pm new file mode 100644 index 0000000..dd6ceb9 --- /dev/null +++ b/PerlQt/examples/opengl/box/GLBox.pm @@ -0,0 +1,149 @@ +package GLBox; + +use OpenGL qw(:all); + +use strict; + +use Qt; +use Qt::isa qw(Qt::GLWidget); +use Qt::slots + setXRotation => ['int'], + setYRotation => ['int'], + setZRotation => ['int']; +use Qt::attributes qw( + xRot + yRot + zRot + scale + object + list +); + +sub NEW { + shift->SUPER::NEW(@_); + xRot = yRot = zRot = 0.0; + scale = 1.25; + object = undef; +} + +sub paintGL +{ + glClear( GL_COLOR_BUFFER_BIT ); + glClear( GL_DEPTH_BUFFER_BIT ); + + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -10.0 ); + glScalef( scale, scale, scale ); + + glRotatef( xRot, 1.0, 0.0, 0.0 ); + glRotatef( yRot, 0.0, 1.0, 0.0 ); + glRotatef( zRot, 0.0, 0.0, 1.0 ); + + glCallList( object ); +} + +sub initializeGL +{ + qglClearColor( &black ); # Let OpenGL clear to black + object = makeObject(); # Generate an OpenGL display list + glShadeModel( GL_FLAT ); + glEnable( GL_DEPTH_TEST ); +} + +# Set up the OpenGL view port, matrix mode, etc. + +sub resizeGL +{ + my $w = shift; + my $h = shift; + glViewport( 0, 0, $w, $h ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); + glMatrixMode( GL_MODELVIEW ); +} + +# Generate an OpenGL display list for the object to be shown, i.e. the box + +sub makeObject +{ + my $list = glGenLists( 1 ); + + glNewList( $list, GL_COMPILE ); + + qglColor( &darkGreen ); # Shorthand for glColor3f or glIndex + + glLineWidth( 2.0 ); + + glBegin( GL_QUADS ); + glVertex3f( 1.0, 0.5, -0.4 ); + glVertex3f( 1.0, -0.5, -0.4 ); + glVertex3f( -1.0, -0.5, -0.4 ); + glVertex3f( -1.0, 0.5, -0.4 ); + glEnd(); + + qglColor( &blue ); + + glBegin( GL_QUADS ); + glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, 0.4 ); + glVertex3f( -1.0, -0.5, 0.4 ); + glVertex3f( -1.0, 0.5, 0.4 ); + glEnd(); + + qglColor( &darkRed ); + + glBegin( GL_QUAD_STRIP ); + glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 ); + qglColor( &yellow ); + glVertex3f( -1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, 0.4 ); + qglColor( &green ); + glVertex3f( -1.0, 0.5, -0.4 ); glVertex3f( -1.0, 0.5, 0.4 ); + qglColor( &lightGray ); + glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 ); + glEnd(); + + glEndList(); + + return $list; +} + + + +# Set the rotation angle of the object to \e degrees around the X axis. + +sub setXRotation +{ + my $deg = shift; + xRot = $deg % 360; + updateGL(); +} + + +# Set the rotation angle of the object to \e degrees around the Y axis. + +sub setYRotation +{ + my $deg = shift; + yRot = $deg % 360; + updateGL(); +} + + +# Set the rotation angle of the object to \e degrees around the Z axis. + +sub setZRotation +{ + my $deg = shift; + zRot = $deg % 360; + updateGL(); +} + +sub DESTROY +{ +# makeCurrent(); + glDeleteLists( object, 1 ); +} + +1; diff --git a/PerlQt/examples/opengl/box/glbox b/PerlQt/examples/opengl/box/glbox new file mode 100644 index 0000000..613a274 --- /dev/null +++ b/PerlQt/examples/opengl/box/glbox @@ -0,0 +1,90 @@ + +package GLObjectWindow; + +use strict; + +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::attributes qw( + file + frame + menu + box + xpos + ypos + zpos +); + +use GLBox; + +sub NEW +{ + shift->SUPER::NEW(@_); + + # Create a menu + file = Qt::PopupMenu( this ); + file->insertItem( "Exit", Qt::app(), SLOT 'quit()', Qt::KeySequence(int &CTRL + &Key_Q )); + + # Create a menu bar + menu = Qt::MenuBar( this ); + menu->setSeparator( &Qt::MenuBar::InWindowsStyle ); + menu->insertItem("&File", file ); + + # Create a nice frame to put around the OpenGL widget + frame = Qt::Frame( this, "frame" ); + frame->setFrameStyle( &Qt::Frame::Sunken | &Qt::Frame::Panel ); + frame->setLineWidth( 2 ); + + # Create our OpenGL widget + box = GLBox( frame, "glbox"); + + # Create the three sliders; one for each rotation axis + xpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "xsl" ); + xpos->setTickmarks( &Qt::Slider::Left ); + Qt::Object::connect( xpos, SIGNAL 'valueChanged(int)', box, SLOT 'setXRotation(int)' ); + + ypos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "ysl" ); + ypos->setTickmarks( &Qt::Slider::Left ); + Qt::Object::connect( ypos, SIGNAL 'valueChanged(int)', box, SLOT 'setYRotation(int)' ); + + zpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "zsl" ); + zpos->setTickmarks( &Qt::Slider::Left ); + Qt::Object::connect( zpos, SIGNAL 'valueChanged(int)', box, SLOT 'setZRotation(int)' ); + + + # Now that we have all the widgets, put them into a nice layout + + # Put the sliders on top of each other + my $vlayout = Qt::VBoxLayout( 20, "vlayout"); + $vlayout->addWidget( xpos ); + $vlayout->addWidget( ypos ); + $vlayout->addWidget( zpos ); + + # Put the GL widget inside the frame + my $flayout = Qt::HBoxLayout( frame, 2, 2, "flayout"); + $flayout->addWidget( box, 1 ); + + # Top level layout, puts the sliders to the left of the frame/GL widget + my $hlayout = Qt::HBoxLayout( this, 20, 20, "hlayout"); + $hlayout->setMenuBar( menu ); + $hlayout->addLayout( $vlayout ); + $hlayout->addWidget( frame, 1 ); +} + +1; + +package main; + +use Qt; +use GLObjectWindow; + +my $a = Qt::Application(\@ARGV); + +my $w = GLObjectWindow; +$w->resize(350,350); +$w->show; + +$a->setMainWidget( $w); + +exit $a->exec; + diff --git a/PerlQt/examples/opengl/gear/gear b/PerlQt/examples/opengl/gear/gear new file mode 100644 index 0000000..2edc951 --- /dev/null +++ b/PerlQt/examples/opengl/gear/gear @@ -0,0 +1,267 @@ +#!/usr/bin/perl -w +# +# Draws a gear. +# +# This code is originally from Qt-1.44, by Troll Tech +# +# Portions of this code have been borrowed from Brian Paul's Mesa +# distribution. +# + +package GearWidget; +use OpenGL qw(:all); + +use Qt; +use Qt::attributes qw( + gear1 + gear2 + gear3 + view_rotx + view_roty + view_rotz + angle +); + +use Qt::isa qw(Qt::GLWidget); + +# +# Draw a gear wheel. You'll probably want to call this function when +# building a display list since we do a lot of trig here. +# +# Input: inner_radius - radius of hole at center +# outer_radius - radius at center of teeth +# width - width of gear +# teeth - number of teeth +# tooth_depth - depth of tooth +# + +sub gear { + my($inner_radius, $outer_radius, $width, $teeth, $tooth_depth) = @_; + my $i; + my($r0, $r1, $r2); + my($angle, $da); + my($u, $v, $len); + + $r0 = $inner_radius; + $r1 = $outer_radius - $tooth_depth/2.0; + $r2 = $outer_radius + $tooth_depth/2.0; + + my $pi = 3.141592654; + $da = 2.0*$pi / $teeth / 4.0; + + glShadeModel(GL_FLAT); + + glNormal3f(0.0, 0.0, 1.0); + + # draw front face + glBegin(GL_QUAD_STRIP); + for $i (0 .. $teeth) { + $angle = $i * 2.0*$pi / $teeth; + glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5); + glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5); + glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5); + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5); + } + glEnd(); + + # draw front sides of teeth + glBegin(GL_QUADS); + $da = 2.0*$pi / $teeth / 4.0; + for $i (0 .. $teeth-1) { + $angle = $i * 2.0*$pi / $teeth; + + glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5); + glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), $width*0.5); + glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), $width*0.5); + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5); + } + glEnd(); + + + glNormal3f(0.0, 0.0, -1.0); + + # draw back face + glBegin(GL_QUAD_STRIP); + for $i (0 .. $teeth) { + $angle = $i * 2.0*$pi / $teeth; + glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5); + glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5); + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5); + glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5); + } + glEnd(); + + # draw back sides of teeth + glBegin(GL_QUADS); + $da = 2.0*$pi / $teeth / 4.0; + for $i (0 .. $teeth-1) { + $angle = $i * 2.0*$pi / $teeth; + + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5); + glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), -$width*0.5); + glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), -$width*0.5); + glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5); + } + glEnd(); + + # draw outward faces of teeth + glBegin(GL_QUAD_STRIP); + for $i (0 .. $teeth-1) { + $angle = $i * 2.0*$pi / $teeth; + + glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5); + glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5); + $u = $r2*cos($angle+$da) - $r1*cos($angle); + $v = $r2*sin($angle+$da) - $r1*sin($angle); + $len = sqrt($u*$u + $v*$v); + $u /= $len; + $v /= $len; + glNormal3f($v, -$u, 0.0); + glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), $width*0.5); + glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), -$width*0.5); + glNormal3f(cos($angle), sin($angle), 0.0); + glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), $width*0.5); + glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), -$width*0.5); + $u = $r1*cos($angle+3*$da) - $r2*cos($angle+2*$da); + $v = $r1*sin($angle+3*$da) - $r2*sin($angle+2*$da); + glNormal3f($v, -$u, 0.0); + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5); + glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5); + glNormal3f(cos($angle), sin($angle), 0.0); + } + + glVertex3f($r1*cos(0.0), $r1*sin(0.0), $width*0.5); + glVertex3f($r1*cos(0.0), $r1*sin(0.0), -$width*0.5); + + glEnd(); + + + glShadeModel(GL_SMOOTH); + + # draw inside radius cylinder + glBegin(GL_QUAD_STRIP); + for $i (0 .. $teeth) { + $angle = $i * 2.0*$pi / $teeth; + glNormal3f(-cos($angle), -sin($angle), 0.0); + glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5); + glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5); + } + glEnd(); +} + + + +sub draw { + angle += 2.0; + view_roty += 1.0; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(view_rotx, 1.0, 0.0, 0.0); + glRotatef(view_roty, 0.0, 1.0, 0.0); + glRotatef(view_rotz, 0.0, 0.0, 1.0); + + glPushMatrix(); + glTranslatef(-3.0, -2.0, 0.0); + glRotatef(angle, 0.0, 0.0, 1.0); + glCallList(gear1); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(3.1, -2.0, 0.0); + glRotatef(-2.0*angle-9.0, 0.0, 0.0, 1.0); + glCallList(gear2); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-3.1, 2.2, -1.8); + glRotatef(90.0, 1.0, 0.0, 0.0); + glRotatef(2.0*angle-2.0, 0.0, 0.0, 1.0); + glCallList(gear3); + glPopMatrix(); + + glPopMatrix(); +} + +sub NEW { + shift->SUPER::NEW(@_); + this->startTimer(10); + view_rotx = 20.0; + view_roty = 30.0; + view_rotz = 0.0; + angle = 0.0; +} + +sub initializeGL { + my $pos = [ 5.0, 5.0, 10.0, 1.0 ]; + my $red = [ 0.8, 0.1, 0.0, 1.0 ]; + my $green = [ 0.0, 0.8, 0.2, 1.0 ]; + my $blue = [ 0.2, 0.2, 1.0, 1.0 ]; + + glLightfv_p(GL_LIGHT0, GL_POSITION, @$pos); + glEnable(GL_CULL_FACE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + # make the gears + gear1 = glGenLists(1); + glNewList(gear1, GL_COMPILE); + glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$red); + gear(1.0, 4.0, 1.0, 20, 0.7); + glEndList(); + + gear2 = glGenLists(1); + glNewList(gear2, GL_COMPILE); + glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$green); + gear(0.5, 2.0, 2.0, 10, 0.7); + glEndList(); + + gear3 = glGenLists(1); + glNewList(gear3, GL_COMPILE); + glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$blue); + gear(1.3, 2.0, 0.5, 10, 0.7); + glEndList(); + + glEnable(GL_NORMALIZE); +} + +sub resizeGL { + my($width, $height) = @_; + my $w = $width / $height; + my $h = 1.0; + + glViewport(0, 0, $width, $height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-$w, $w, -$h, $h, 5.0, 60.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -40.0); +} + +sub paintGL { + draw(); +} + +sub timerEvent { + updateGL(); +} + +package main; + +use Qt; +use GearWidget; + +$app = Qt::Application(\@ARGV); + +if(!Qt::GLFormat::hasOpenGL()) { + warn("This system has no OpenGL support. Exiting."); + exit -1; +} + +$w = GearWidget; +$app->setMainWidget($w); +$w->show; +exit $app->exec; diff --git a/PerlQt/examples/progress/progress.pl b/PerlQt/examples/progress/progress.pl new file mode 100644 index 0000000..a63e95e --- /dev/null +++ b/PerlQt/examples/progress/progress.pl @@ -0,0 +1,348 @@ +#!/usr/bin/perl -w + +use strict; + +package AnimatedThingy; + +use Qt; +use Qt::isa "Qt::Label"; +use Qt::attributes qw[ + label + step + ox oy + x0 x1 + y0 y1 + dx0 dx1 + dy0 dy1 +]; + +use constant nqix => 10; + +sub NEW +{ + shift->SUPER::NEW($_[0]); + label= $_[1]."\n... and wasting CPU\nwith this animation!\n"; + ox = []; + oy = []; + step = 0; + for (my $i=0; $i<nqix; $i++) + { ox->[0][$i] = oy->[0][$i] = ox->[1][$i] = oy->[1][$i] = 0 } + x0 = y0 = x1 = y1 = 0; + dx0 = rand(8)+2; + dy0 = rand(8)+2; + dx1 = rand(8)+2; + dy1 = rand(8)+2; + setBackgroundColor(&black); +} + +sub show +{ + startTimer(150) unless isVisible(); + SUPER->show; +} + +sub hide +{ + SUPER->hide; + killTimers() +} + +sub sizeHint +{ + Qt::Size(120,100) +} + +sub timerEvent +{ + my $p = Qt::Painter(this); + my $pn= $p->pen; + $pn->setWidth(2); + $pn->setColor(backgroundColor()); + $p->setPen($pn); + + step = (step + 1) % nqix; + + $p->drawLine(ox->[0][step], oy->[0][step], ox->[1][step], oy->[1][step]); + + (x0, dx0) = inc(x0, dx0, width()); + (y0, dy0) = inc(y0, dy0, height()); + (x1, dx1) = inc(x1, dx1, width()); + (y1, dy1) = inc(y1, dy1, height()); + ox->[0][step] = x0; + oy->[0][step] = y0; + ox->[1][step] = x1; + oy->[1][step] = y1; + + my $c = Qt::Color; + $c->setHsv( (step*255)/nqix, 255, 255 ); # rainbow effect + $pn->setColor($c); + $pn->setWidth(2); + $p->setPen($pn); + $p->drawLine(ox->[0][step], oy->[0][step], ox->[1][step], oy->[1][step]); + $p->setPen(&white); + $p->drawText(rect(), &AlignCenter, label); +} + +sub paintEvent +{ + my $ev = shift; + my $p = Qt::Painter(this); + my $pn= $p->pen; + $pn->setWidth(2); + $p->setPen($pn); + $p->setClipRect($ev->rect); + for (my $i=0; $i<nqix; $i++) { + my $c = Qt::Color; + $c->setHsv( ($i*255)/nqix, 255, 255 ); # rainbow effect + $pn->setColor($c); + $p->setPen($pn); + $p->drawLine(ox->[0][$i], oy->[0][$i], ox->[1][$i], oy->[1][$i]); + } + $p->setPen(&white); + $p->drawText(rect(), &AlignCenter, label); +} + +sub inc +{ + my ($x, $dx, $b)= @_; + $x += $dx; + if ($x<0) { $x=0; $dx=rand(8)+2; } + elsif ($x>=$b) { $x=$b-1; $dx=-(rand(8)+2); } + return ($x, $dx) +} + +1; + +package CPUWaster; + +use Qt; +use Qt::isa "Qt::Widget"; +use Qt::attributes qw[ + menubar + file + options + rects + pb + td_id + ld_id + dl_id + cl_id + md_id + got_stop + timer_driven + default_label +]; +use Qt::slots + drawItemRects => ['int'], + doMenuItem => ['int'], + stopDrawing => [ ], + timerDriven => [ ], + loopDriven => [ ], + defaultLabel => [ ], + customLabel => [ ], + toggleMinimumDuration + => [ ]; +use AnimatedThingy; + +use constant first_draw_item => 1000; +use constant last_draw_item => 1006; + +sub NEW +{ + shift->SUPER::NEW(@_); + + menubar = MenuBar( this, "menu" ); + pb = 0; + + file = Qt::PopupMenu; + menubar->insertItem( "&File", file ); + for (my $i=first_draw_item; $i<=last_draw_item; $i++) + { file->insertItem( drawItemRects($i)." Rectangles", $i) } + Qt::Object::connect( menubar, SIGNAL "activated(int)", this, SLOT "doMenuItem(int)" ); + file->insertSeparator; + file->insertItem( "Quit", Qt::app(), SLOT "quit()" ); + options = Qt::PopupMenu; + menubar->insertItem( "&Options", options ); + td_id = options->insertItem( "Timer driven", this, SLOT "timerDriven()" ); + ld_id = options->insertItem( "Loop driven", this, SLOT "loopDriven()" ); + options->insertSeparator; + dl_id = options->insertItem( "Default label", this, SLOT "defaultLabel()" ); + cl_id = options->insertItem( "Custom label", this, SLOT "customLabel()" ); + options->insertSeparator; + md_id = options->insertItem( "No minimum duration", this, SLOT "toggleMinimumDuration()" ); + options->setCheckable( 1 ); + loopDriven(); + customLabel(); + + setFixedSize( 400, 300 ); + + setBackgroundColor( &black ); +} + + +sub drawItemRects +{ + my $id = shift; + my $n = $id - first_draw_item; + my $r = 100; + while($n--) + { $r *= $n%3 ? 5:4 } + return $r +} + + +sub doMenuItem +{ + my $id = shift; + draw(drawItemRects($id)) if ($id >= first_draw_item && $id <= last_draw_item) +} + +sub stopDrawing +{ got_stop = 1 } + +sub timerDriven() +{ + timer_driven = 1; + options->setItemChecked( td_id, 1 ); + options->setItemChecked( ld_id, 0 ); +} + +sub loopDriven +{ + timer_driven = 0; + options->setItemChecked( ld_id, 1 ); + options->setItemChecked( td_id, 0 ); +} + +sub defaultLabel +{ + default_label = 1; + options->setItemChecked( dl_id, 1 ); + options->setItemChecked( cl_id, 0 ); +} + +sub customLabel +{ + default_label = 0; + options->setItemChecked( dl_id, 0 ); + options->setItemChecked( cl_id, 1 ); +} + +sub toggleMinimumDuration +{ + options->setItemChecked( md_id, + !options->isItemChecked( md_id ) ); +} + +sub timerEvent +{ + pb->setProgress( pb->totalSteps - rects ) if(!(rects%100)); + rects--; + + { + my $p = Qt::Painter(this); + + my $ww = width(); + my $wh = height(); + + if ( $ww > 8 && $wh > 8 ) + { + my $c = Qt::Color(rand(255), rand(255), rand(255)); + my $x = rand($ww-8); + my $y = rand($wh-8); + my $w = rand($ww-$x); + my $h = rand($wh-$y); + $p->fillRect( $x, $y, $w, $h, Brush($c) ); + } + } + + if (!rects || got_stop) + { + pb->setProgress( pb->totalSteps ); + my $p = Qt::Painter(this); + $p->fillRect(0, 0, width(), height(), Brush(backgroundColor())); + enableDrawingItems(1); + killTimers(); + pb = 0; + } +} + +sub newProgressDialog +{ + my($label, $steps, $modal) = @_; + my $d = ProgressDialog($label, "Cancel", $steps, this, + "progress", $modal); + if ( options->isItemChecked( md_id ) ) + { $d->setMinimumDuration(0) } + if ( !default_label ) + { $d->setLabel( AnimatedThingy($d,$label) ) } + return $d; +} + +sub enableDrawingItems +{ + my $yes = shift; + for (my $i=first_draw_item; $i<=last_draw_item; $i++) + { + menubar->setItemEnabled($i, $yes); + } +} + +sub draw +{ + my $n = shift; + if ( timer_driven ) + { + if ( pb ) { + warn("This cannot happen!"); + return; + } + rects = $n; + pb = newProgressDialog("Drawing rectangles.\n". + "Using timer event.", $n, 0); + pb->setCaption("Please Wait"); + Qt::Object::connect(pb, SIGNAL "cancelled()", this, SLOT "stopDrawing()"); + enableDrawingItems(0); + startTimer(0); + got_stop = 0; + } + else + { + my $lpb = newProgressDialog("Drawing rectangles.\n". + "Using loop.", $n, 1); + $lpb->setCaption("Please Wait"); + + my $p = Qt::Painter(this); + for (my $i=0; $i<$n; $i++) + { + if(!($i%100)) + { + $lpb->setProgress($i); + last if ( $lpb->wasCancelled ); + } + my ($cw, $ch) = (width(), height()); + my $c = Qt::Color(rand(255), rand(255), rand(255)); + my $x = rand($cw-8); + my $y = rand($cw-8); + my $w = rand($cw-$x); + my $h = rand($cw-$y); + $p->fillRect($x, $y, $w, $h, Brush($c)); + } + $lpb->cancel; + $p->fillRect(0, 0, width(), height(), Brush(backgroundColor())); + } +} + +1; + +package main; + +use Qt; +use CPUWaster; + +my $a=Qt::Application(\@ARGV); +my $w=CPUWaster; + +$w->show; +$a->setMainWidget($w); +exit $a->exec; diff --git a/PerlQt/examples/richedit/imageCollection.pm b/PerlQt/examples/richedit/imageCollection.pm new file mode 100644 index 0000000..318d4e5 --- /dev/null +++ b/PerlQt/examples/richedit/imageCollection.pm @@ -0,0 +1,1461 @@ +# Image collection for project 'richedit'. +# +# Generated from reading image files: +# images/CVS +# images/editcopy +# images/editcut +# images/editpaste +# images/filenew +# images/fileopen +# images/filesave +# images/print +# images/redo +# images/searchfind +# images/textbold +# images/textcenter +# images/textitalic +# images/textleft +# images/textright +# images/textunder +# images/undo +# +# Created: jeu jun 13 20:03:44 2002 +# by: The PerlQt User Interface Compiler (puic) +# +# WARNING! All changes made in this file will be lost! + +use strict; + +package DesignerMimeSourceFactory_richedit; +use Qt; +use Qt::isa qw(Qt::MimeSourceFactory); + +# images/editcopy +my $image_0_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xff000000, + 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xffffffff, 0xffffffff, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xffffffff, 0xff000000, 0xff000082, 0xff000082, 0xff000082, 0xff000082, + 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, + 0xff000082, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xff000082, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xff000082, 0xffffffff, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xff000082, + 0xff3c3cfd, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000082, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xff000082, 0xff8b8bfd, 0xff3c3cfd, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, + 0xff000082, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xffffffff, 0xff000082, 0xffffffff, 0xff8b8bfd, 0xff3c3cfd, 0xff000082, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000082, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000082, + 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xffffffff, 0xff000082, 0xffffffff, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000082, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000082, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000082, 0xc6c6c6, 0xff000000, 0xffffffff, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xff000082, 0xffffffff, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xff000082, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000082, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000082, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000082, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000082, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xffffffff, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xffffffff, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xff000082, + 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xff000082, + 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xff000082, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/editcut +my $image_1_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xc6c6c6, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xff000000, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xff000082, 0xc6c6c6, 0xff000082, + 0xff000082, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000082, + 0xff000082, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000082, 0xff000082, 0xff000082, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/editpaste +my $image_2_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffff00, 0xffffff00, + 0xffffff00, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff848284, 0xff848200, 0xff848284, 0xff000000, 0xff000000, 0xffffff00, + 0xff000000, 0xff000000, 0xff000000, 0xffffff00, 0xff000000, 0xff000000, + 0xff848284, 0xff848200, 0xff848284, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848284, 0xff848200, 0xff848284, + 0xff000000, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, + 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xff000000, 0xff848284, + 0xff848200, 0xff848284, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff848200, 0xff848284, 0xff848200, 0xff000000, 0xffc6c3c6, + 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, 0xffc6c3c6, + 0xffc6c3c6, 0xffc6c3c6, 0xff000000, 0xff848200, 0xff848284, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848284, + 0xff848200, 0xff848284, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff848284, 0xff848200, 0xff848284, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, + 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, + 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, + 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848284, 0xff848200, 0xff848284, + 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff000084, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000084, 0xffffffff, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff000084, 0xffffffff, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xffffffff, 0xff000084, 0xffffffff, + 0xffffffff, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848284, + 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, + 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000084, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff000084, 0xffffffff, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xffffffff, + 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000084, + 0xff000000, 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, + 0xff848200, 0xff848284, 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000000, 0xff848200, + 0xff848284, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff000084, 0xffffffff, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xff000084, 0xff000000, 0xff848284, 0xff848200, 0xff848284, + 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff000084, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000084, + 0xff000000, 0xff848200, 0xff848284, 0xff848200, 0xff848284, 0xff848200, + 0xff848284, 0xff848200, 0xff000084, 0xffffffff, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xffffffff, 0xff000084, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000084, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/filenew +my $image_3_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xff2e2e2e, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xff5c5c5c, 0xff2e2e2e, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff878787, + 0xff5c5c5c, 0xff2e2e2e, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xffc2c2c2, 0xff878787, 0xff5c5c5c, + 0xff2e2e2e, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xffffffff, 0xffc2c2c2, 0xff878787, 0xff5c5c5c, 0xff2e2e2e, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/fileopen +my $image_4_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xc6c6c6, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xff000000, 0xffffff00, 0xffffffff, 0xffffff00, + 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, + 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, + 0xffffff00, 0xffffffff, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffff00, + 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, + 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xffffff00, 0xffffffff, + 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, + 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xffffff00, + 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, + 0xffffff00, 0xffffffff, 0xffffff00, 0xffffffff, 0xff000000, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff000000, 0xff000000, 0xff000000, 0xffffff00, 0xffffffff, 0xffffff00, + 0xffffffff, 0xff000000, 0xff000000, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xff000000, 0xc6c6c6, + 0xff000000, 0xffffffff, 0xffffff00, 0xffffffff, 0xff000000, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffff00, + 0xffffffff, 0xff000000, 0xff000000, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xffffffff, 0xff000000, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/filesave +my $image_5_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, + 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffcab5d1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffcab5d1, 0xffcab5d1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffcab5d1, 0xffcab5d1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff848200, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff848200, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff848200, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, + 0xff848200, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, + 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff848200, 0xff848200, 0xff848200, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, + 0xff848200, 0xff848200, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff848200, 0xff848200, 0xff848200, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xffc1c1c1, 0xffc1c1c1, 0xffc1c1c1, 0xff000000, 0xff848200, 0xff848200, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/print +my $image_6_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xffb5b5b5, 0xffbdbdbd, 0xffcecece, 0xffcecece, 0xffcecece, 0xffcecece, + 0xffc6c6c6, 0xffc6c6c6, 0xffbdbdbd, 0xffbdbdbd, 0xffadadad, 0xffbdbdbd, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xffefefef, + 0xffe7e7e7, 0xffe7e7e7, 0xffe7e7e7, 0xffe7e7e7, 0xffe7e7e7, 0xffefefef, + 0xffefefef, 0xffefefef, 0xffdedede, 0xffbdbdbd, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xffc6c6c6, 0xffc6c6c6, 0xffc6c6c6, + 0xffcecece, 0xffcecece, 0xffc6c6c6, 0xffc6c6c6, 0xffc6c6c6, 0xffc6c6c6, + 0xffbdbdbd, 0xffc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xffb5b5b5, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffb5b5b5, + 0xffbdbdbd, 0xffbdbdbd, 0xffb5b5b5, 0xffb5b5b5, 0xffadadad, 0xffbdbdbd, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffc6c6c6, 0xffadadad, 0xffc6c6c6, + 0xffbdbdbd, 0xffc6c6c6, 0xffc6c6c6, 0xffc6c6c6, 0xffbdbdbd, 0xffbdbdbd, + 0xffbdbdbd, 0xffc6c6c6, 0xffb5b5b5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xffbdbdbd, 0xffbdbdbd, 0xffb5b5b5, 0xffbdbdbd, 0xffbdbdbd, + 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffc6c6c6, 0xffc6c6c6, + 0xffb5b5b5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, + 0xffb5b5b5, 0xffc6c6c6, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, + 0xffbdbdbd, 0xffc6c6c6, 0xffbdbdbd, 0xffc6c6c6, 0xffadadad, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffc6c6c6, 0xffbdbdbd, 0xffbdbdbd, + 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, 0xffbdbdbd, + 0xffbdbdbd, 0xffbdbdbd, 0xffb5b5b5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xffadadad, 0xffcecece, 0xffe7e7e7, 0xffdedede, 0xffdedede, + 0xffdedede, 0xffdedede, 0xffdedede, 0xffdedede, 0xffd6d6d6, 0xffdedede, + 0xffa5a5a5, 0xffa5a5a5, 0xffadadb5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xff9c9c9c, 0xff736b73, + 0xffb5b5b5, 0xffd6d6d6, 0xffcecece, 0xffd6d6d6, 0xffcecece, 0xffd6d6d6, + 0xffcecece, 0xffd6d6d6, 0xffdedede, 0xffdedede, 0xff948c94, 0xff5a525a, + 0xff424242, 0xff6b6b6b, 0xffb5b5b5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xffbdbdbd, 0xff94949c, 0xff847b84, 0xff7b7384, 0xff7b737b, 0xff7b737b, + 0xff7b737b, 0xff7b737b, 0xff7b737b, 0xff7b737b, 0xff7b737b, 0xff847b8c, + 0xff8c7b94, 0xff8c8494, 0xff6b6b73, 0xff393942, 0xff212129, 0xff181821, + 0xff424242, 0xffa5a5a5, 0xc6c6c6, 0xffbdbdbd, 0xff9c9c9c, 0xffded6de, + 0xffe7e7ef, 0xffdedee7, 0xffded6de, 0xffd6d6de, 0xffd6d6de, 0xffd6d6de, + 0xffd6d6de, 0xffd6ced6, 0xffd6cede, 0xff9ccea5, 0xff5ace5a, 0xff94c694, + 0xffa59ca5, 0xff424242, 0xff211821, 0xff211821, 0xff181018, 0xff393942, + 0xffbdbdbd, 0xff9c9ca5, 0xffefe7ef, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffd6ffd6, 0xff29ff29, 0xff08ff08, 0xff29ff29, 0xffcecece, 0xff8c7b94, + 0xff313131, 0xff181821, 0xff101010, 0xff211821, 0xffada5ad, 0xfff7f7f7, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7ffe7, 0xff6bff63, + 0xff31ff31, 0xff7bff7b, 0xffffffff, 0xffded6e7, 0xff7b737b, 0xff181821, + 0xff000000, 0xff211821, 0xffa5a5ad, 0xffd6d6de, 0xffceced6, 0xffcec6ce, + 0xffceced6, 0xffd6d6d6, 0xffd6d6de, 0xffd6d6de, 0xffdedede, 0xffe7dee7, + 0xffdedee7, 0xffded6de, 0xffdedee7, 0xffd6d6de, 0xffbdd6bd, 0xffd6ced6, + 0xffceced6, 0xffcec6ce, 0xff8c8c94, 0xff181018, 0xff000000, 0xff181821, + 0xff948c94, 0xffb5adb5, 0xffadadb5, 0xffada5ad, 0xffa5a5ad, 0xffa59cad, + 0xffa5a5ad, 0xffa59ca5, 0xffa59cad, 0xffa59cad, 0xffa5a5a5, 0xffa59cad, + 0xffa59ca5, 0xffa59cad, 0xffad9cad, 0xff9c94a5, 0xff94949c, 0xff8c8c94, + 0xff6b636b, 0xff101018, 0xff000000, 0xff211821, 0xff948c94, 0xffadadb5, + 0xffadadb5, 0xffa59cad, 0xffa5a5ad, 0xffa59ca5, 0xffa59ca5, 0xffa59ca5, + 0xff9c9ca5, 0xffa59ca5, 0xff9c9ca5, 0xff9c9ca5, 0xff9c9ca5, 0xff9c9ca5, + 0xff9c94a5, 0xff9c949c, 0xff9c949c, 0xff8c8494, 0xff6b636b, 0xff101018, + 0xff000000, 0xff181818, 0xff949494, 0xffa59cad, 0xffa59cad, 0xffa59ca5, + 0xff9c9ca5, 0xffa59ca5, 0xff9c9ca5, 0xff9c9ca5, 0xff9c9ca5, 0xff9c94a5, + 0xff9c9c9c, 0xff9c94a5, 0xff9c949c, 0xff9c949c, 0xff9c949c, 0xff9c94a5, + 0xff948c94, 0xff84848c, 0xff6b636b, 0xff181018, 0xff000000, 0xff4a4a52, + 0xff948c94, 0xffa5a5ad, 0xffa59ca5, 0xffa59ca5, 0xff9c94a5, 0xff9c9c9c, + 0xff9c94a5, 0xff9c949c, 0xff9c94a5, 0xff9c9c9c, 0xff9c94a5, 0xff9c949c, + 0xff9c94a5, 0xff9c949c, 0xff94949c, 0xff948c94, 0xff8c8c94, 0xff8c848c, + 0xff6b6b73, 0xff101018, 0xff181818, 0xffadadad, 0xff949494, 0xff84848c, + 0xff8c848c, 0xff8c8494, 0xff8c8c8c, 0xff8c8494, 0xff8c848c, 0xff8c8c94, + 0xff8c8494, 0xff8c848c, 0xff8c8c94, 0xff8c8c94, 0xff948c94, 0xff8c8c94, + 0xff948c94, 0xff948c9c, 0xff8c8c94, 0xff8c8494, 0xff6b636b, 0xff181818, + 0xff949494, 0xc6c6c6, 0xffb5b5b5, 0xff736b73, 0xff212129, 0xff181821, + 0xff212121, 0xff212129, 0xff292129, 0xff292129, 0xff292129, 0xff292931, + 0xff312931, 0xff312931, 0xff313139, 0xff313139, 0xff393139, 0xff393139, + 0xff313139, 0xff312931, 0xff313139, 0xff949494, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffadadad, 0xff5a5a63, 0xff423942, 0xff423942, + 0xff393939, 0xff313139, 0xff313131, 0xff313131, 0xff313131, 0xff292929, + 0xff292929, 0xff212129, 0xff181818, 0xff181818, 0xff100810, 0xff424242, + 0xff9c9c9c, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/redo +my $image_7_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff848284, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff848284, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, + 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff848284, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, + 0xff000084, 0xff000084, 0xff848284, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/searchfind +my $image_8_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffb5b5b5, + 0xff949494, 0xff7b7b7b, 0xff6b7373, 0xff6b7373, 0xff7b7b7b, 0xff9c9c9c, + 0xffbdbdbd, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffadadad, 0xff737b7b, 0xff849c94, 0xffadcec6, + 0xffaddece, 0xffaddece, 0xff94bdad, 0xff6b7b7b, 0xff7b7b7b, 0xffb5b5b5, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffadadad, + 0xff5a5a5a, 0xff94a59c, 0xffceffef, 0xffceffef, 0xffc6f7e7, 0xffbdefde, + 0xffb5efd6, 0xffa5e7c6, 0xff6b8c7b, 0xff737373, 0xffbdbdbd, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xff737b73, 0xff9cbdb5, 0xffbdefde, + 0xffc6f7e7, 0xffc6def7, 0xffbdd6ff, 0xffbdc6f7, 0xffa5b5de, 0xff94ceb5, + 0xff94d6bd, 0xff738c84, 0xff8c8c8c, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff9c9c9c, 0xff849c94, 0xffd6fff7, 0xffbdefde, 0xffcedeff, 0xffb5bdde, + 0xffa5cece, 0xffa5cece, 0xffadadef, 0xff9c94d6, 0xff8cc6ad, 0xff94c6ad, + 0xff636b6b, 0xffb5b5b5, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff7b8484, 0xffadd6c6, + 0xffceffef, 0xffb5dede, 0xffadb5de, 0xff94ceb5, 0xff9ce7bd, 0xff8ccead, + 0xffa5b5de, 0xffa594de, 0xff84ada5, 0xff94ceb5, 0xff6b847b, 0xff9c9c9c, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff737b7b, 0xffbde7d6, 0xffbdf7de, 0xff9ce7c6, + 0xff9ce7c6, 0xff9cdebd, 0xff94d6b5, 0xff9ccece, 0xffa5b5ef, 0xff8484b5, + 0xff7bbd9c, 0xff94c6b5, 0xff739484, 0xff848484, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff737b7b, 0xffaddece, 0xffb5efd6, 0xff9cdebd, 0xff94debd, 0xff94d6b5, + 0xff9cbdd6, 0xffa5b5ef, 0xff8c94b5, 0xff7bad94, 0xff7bbda5, 0xff8cb5a5, + 0xff73948c, 0xff848484, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff737b73, 0xffadd6c6, + 0xffade7ce, 0xff94d6b5, 0xff94d6b5, 0xff8cceb5, 0xffa5b5de, 0xff8c8cbd, + 0xff7bbd9c, 0xff7bc69c, 0xff7bb59c, 0xff84bda5, 0xff6b847b, 0xff8c8c8c, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff8c8c8c, 0xff8cb5a5, 0xffa5dec6, 0xff8cceb5, + 0xff8cc6ad, 0xff84cead, 0xff8cadbd, 0xff84a5ad, 0xff73bd9c, 0xff73b594, + 0xff73b594, 0xff7bad9c, 0xff5a736b, 0xffadadad, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xffadadad, 0xff737b7b, 0xff9ccebd, 0xff84c6a5, 0xff84c6a5, 0xff7bbda5, + 0xff94a5ce, 0xff8484b5, 0xff63ad8c, 0xff6bad94, 0xff6bad94, 0xff6b9484, + 0xff737373, 0xffbdbdbd, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff8c8c8c, + 0xff6b8c7b, 0xff7bc6a5, 0xff7bbda5, 0xff7bbd9c, 0xff73a59c, 0xff73948c, + 0xff73b594, 0xff5a9c84, 0xff5a9c84, 0xff636363, 0xff9c9c9c, 0xffced6ce, + 0xffadadad, 0xffbdbdbd, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xff7b7b7b, 0xff6b7b73, + 0xff84b59c, 0xff84b5a5, 0xff84bda5, 0xff7bb59c, 0xff7bad94, 0xff739484, + 0xff5a5a5a, 0xff9c9c9c, 0xc6c6c6, 0xffadadad, 0xff636363, 0xff5a5a5a, + 0xffadadad, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffbdbdbd, 0xff8c8c8c, 0xff636b6b, 0xff6b7b73, + 0xff6b847b, 0xff6b847b, 0xff63736b, 0xff6b6b6b, 0xffadadad, 0xc6c6c6, + 0xc6c6c6, 0xffc6c6c6, 0xff7b7b7b, 0xff292929, 0xff393939, 0xff8c8c8c, + 0xffbdbdbd, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xffb5b5b5, 0xff9c9c9c, 0xff8c8c8c, 0xff949494, + 0xffa5a5a5, 0xffc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xffa5a5a5, 0xff424242, 0xff292929, 0xff6b6b6b, 0xffadadad, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xffbdbdbd, 0xff737373, 0xff212121, 0xff393939, 0xff949494, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff9c9c9c, 0xff393939, 0xff212121, 0xff6b6b6b, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xffb5b5b5, + 0xff636363, 0xff5a5a5a, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textbold +my $image_9_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textcenter +my $image_10_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textitalic +my $image_11_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textleft +my $image_12_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textright +my $image_13_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/textunder +my $image_14_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000000, 0xff000000, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +# images/undo +my $image_15_data = pack 'L*', + + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff848284, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff848284, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, 0xff000084, + 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff848284, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff848284, + 0xff000084, 0xff000084, 0xff000084, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xff000084, 0xff000084, 0xff000084, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, + 0xc6c6c6, 0xc6c6c6, 0xc6c6c6, 0xc6c6c6; + +my %embed_images = ( + "editcopy" => [$image_0_data, 22, 22, 32, undef, 1], + "editcut" => [$image_1_data, 22, 22, 32, undef, 1], + "editpaste" => [$image_2_data, 22, 22, 32, undef, 1], + "filenew" => [$image_3_data, 22, 22, 32, undef, 1], + "fileopen" => [$image_4_data, 22, 22, 32, undef, 1], + "filesave" => [$image_5_data, 22, 22, 32, undef, 1], + "print" => [$image_6_data, 22, 22, 32, undef, 1], + "redo" => [$image_7_data, 22, 22, 32, undef, 1], + "searchfind" => [$image_8_data, 22, 22, 32, undef, 1], + "textbold" => [$image_9_data, 22, 22, 32, undef, 1], + "textcenter" => [$image_10_data, 22, 22, 32, undef, 1], + "textitalic" => [$image_11_data, 22, 22, 32, undef, 1], + "textleft" => [$image_12_data, 22, 22, 32, undef, 1], + "textright" => [$image_13_data, 22, 22, 32, undef, 1], + "textunder" => [$image_14_data, 22, 22, 32, undef, 1], + "undo" => [$image_15_data, 22, 22, 32, undef, 1], +); + +my %images = (); + + +sub uic_findImage +{ + my $name = shift; + return $images{$name} if exists $images{$name}; + return Qt::Image() unless exists $embed_images{$name}; + + my $img = Qt::Image(@{$embed_images{$name}}[0..4], &Qt::Image::BigEndian); + ${$embed_images{$name}}[5] && $img->setAlphaBuffer(1); + $images{$name} = $img; + return $img; +} + +sub data +{ + my $abs_name = shift; + my $img = uic_findImage($abs_name); + if($img->isNull()) + { + Qt::MimeSourceFactory::removeFactory(this); + my $s = Qt::MimeSourceFactory::defaultFactory()->data($abs_name); + Qt::MimeSourceFactory::addFactory(this); + return $s; + } + Qt::MimeSourceFactory::defaultFactory()->setImage($abs_name, $img); + return Qt::MimeSourceFactory::defaultFactory()->data($abs_name); +} + + +package staticImages; +use Qt; +use DesignerMimeSourceFactory_richedit; +our %factories; + +my $factory = DesignerMimeSourceFactory_richedit; +Qt::MimeSourceFactory::defaultFactory()->addFactory($factory); +$factories{'DesignerMimeSourceFactory_richedit'} = $factory; + +END +{ + for( values %factories ) + { + Qt::MimeSourceFactory::defaultFactory()->removeFactory($_); + } + %factories = (); +} +1; + diff --git a/PerlQt/examples/richedit/richedit.pl b/PerlQt/examples/richedit/richedit.pl new file mode 100644 index 0000000..ef39e73 --- /dev/null +++ b/PerlQt/examples/richedit/richedit.pl @@ -0,0 +1,376 @@ +# Form implementation generated from reading ui file 'richedit.ui' +# +# Created: jeu jun 13 20:02:56 2002 +# by: The PerlQt User Interface Compiler (puic) +# + + +use strict; + +# the below is a manual addition... +# maybe puic should do that. +# Allows to run a modular application from anywhere +use FindBin; +use lib "$FindBin::Bin"; + +package EditorForm; +use Qt; +use Qt::isa qw(Qt::MainWindow); +use Qt::slots + init => [], + fileExit => [], + fileNew => [], + fileOpen => [], + fileSave => [], + fileSaveAs => [], + helpAbout => [], + helpContents => [], + helpIndex => [], + changeAlignment => ['QAction*'], + saveAndContinue => ['const QString&']; +use Qt::attributes qw( + textEdit + fontComboBox + SpinBox2 + menubar + fileMenu + editMenu + PopupMenu_2 + helpMenu + toolBar + Toolbar + fileNewAction + fileOpenAction + fileSaveAction + fileSaveAsAction + fileExitAction + editUndoAction + editRedoAction + editCutAction + editCopyAction + editPasteAction + helpContentsAction + helpIndexAction + helpAboutAction + boldAction + italicAction + underlineAction + alignActionGroup + leftAlignAction + rightAlignAction + centerAlignAction +); + + +sub uic_load_pixmap_EditorForm +{ + my $pix = Qt::Pixmap(); + my $m = Qt::MimeSourceFactory::defaultFactory()->data(shift); + + if($m) + { + Qt::ImageDrag::decode($m, $pix); + } + + return $pix; +} + + +sub NEW +{ + shift->SUPER::NEW(@_[0..2]); + this->statusBar(); + + if( this->name() eq "unnamed" ) + { + this->setName("EditorForm"); + } + this->resize(646,436); + this->setCaption(this->trUtf8("Rich Edit")); + + this->setCentralWidget(Qt::Widget(this, "qt_central_widget")); + my $EditorFormLayout = Qt::HBoxLayout(this->centralWidget(), 11, 6, '$EditorFormLayout'); + + textEdit = Qt::TextEdit(this->centralWidget(), "textEdit"); + textEdit->setSizePolicy(Qt::SizePolicy(7, 7, 0, 0, textEdit->sizePolicy()->hasHeightForWidth())); + textEdit->setTextFormat(&Qt::TextEdit::RichText); + $EditorFormLayout->addWidget(textEdit); + + fileNewAction= Qt::Action(this,"fileNewAction"); + fileNewAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("filenew"))); + fileNewAction->setText(this->trUtf8("New")); + fileNewAction->setMenuText(this->trUtf8("&New")); + fileNewAction->setAccel(Qt::KeySequence(int(4194382))); + fileOpenAction= Qt::Action(this,"fileOpenAction"); + fileOpenAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("fileopen"))); + fileOpenAction->setText(this->trUtf8("Open")); + fileOpenAction->setMenuText(this->trUtf8("&Open...")); + fileOpenAction->setAccel(Qt::KeySequence(int(4194383))); + fileSaveAction= Qt::Action(this,"fileSaveAction"); + fileSaveAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("filesave"))); + fileSaveAction->setText(this->trUtf8("Save")); + fileSaveAction->setMenuText(this->trUtf8("&Save")); + fileSaveAction->setAccel(Qt::KeySequence(int(4194387))); + fileSaveAsAction= Qt::Action(this,"fileSaveAsAction"); + fileSaveAsAction->setText(this->trUtf8("Save As")); + fileSaveAsAction->setMenuText(this->trUtf8("Save &As...")); + fileSaveAsAction->setAccel(Qt::KeySequence(int(0))); + fileExitAction= Qt::Action(this,"fileExitAction"); + fileExitAction->setText(this->trUtf8("Exit")); + fileExitAction->setMenuText(this->trUtf8("E&xit")); + fileExitAction->setAccel(Qt::KeySequence(int(0))); + editUndoAction= Qt::Action(this,"editUndoAction"); + editUndoAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("undo"))); + editUndoAction->setText(this->trUtf8("Undo")); + editUndoAction->setMenuText(this->trUtf8("&Undo")); + editUndoAction->setAccel(Qt::KeySequence(int(4194394))); + editRedoAction= Qt::Action(this,"editRedoAction"); + editRedoAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("redo"))); + editRedoAction->setText(this->trUtf8("Redo")); + editRedoAction->setMenuText(this->trUtf8("&Redo")); + editRedoAction->setAccel(Qt::KeySequence(int(4194393))); + editCutAction= Qt::Action(this,"editCutAction"); + editCutAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editcut"))); + editCutAction->setText(this->trUtf8("Cut")); + editCutAction->setMenuText(this->trUtf8("&Cut")); + editCutAction->setAccel(Qt::KeySequence(int(4194392))); + editCopyAction= Qt::Action(this,"editCopyAction"); + editCopyAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editcopy"))); + editCopyAction->setText(this->trUtf8("Copy")); + editCopyAction->setMenuText(this->trUtf8("C&opy")); + editCopyAction->setAccel(Qt::KeySequence(int(4194371))); + editPasteAction= Qt::Action(this,"editPasteAction"); + editPasteAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editpaste"))); + editPasteAction->setText(this->trUtf8("Paste")); + editPasteAction->setMenuText(this->trUtf8("&Paste")); + editPasteAction->setAccel(Qt::KeySequence(int(4194390))); + helpContentsAction= Qt::Action(this,"helpContentsAction"); + helpContentsAction->setText(this->trUtf8("Contents")); + helpContentsAction->setMenuText(this->trUtf8("&Contents...")); + helpContentsAction->setAccel(Qt::KeySequence(int(0))); + helpIndexAction= Qt::Action(this,"helpIndexAction"); + helpIndexAction->setText(this->trUtf8("Index")); + helpIndexAction->setMenuText(this->trUtf8("&Index...")); + helpIndexAction->setAccel(Qt::KeySequence(int(0))); + helpAboutAction= Qt::Action(this,"helpAboutAction"); + helpAboutAction->setText(this->trUtf8("About")); + helpAboutAction->setMenuText(this->trUtf8("&About...")); + helpAboutAction->setAccel(Qt::KeySequence(int(0))); + boldAction= Qt::Action(this,"boldAction"); + boldAction->setToggleAction(1); + boldAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textbold"))); + boldAction->setText(this->trUtf8("bold")); + boldAction->setMenuText(this->trUtf8("&Bold")); + boldAction->setAccel(Qt::KeySequence(int(272629826))); + italicAction= Qt::Action(this,"italicAction"); + italicAction->setToggleAction(1); + italicAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textitalic"))); + italicAction->setText(this->trUtf8("italic")); + italicAction->setMenuText(this->trUtf8("&Italic")); + italicAction->setAccel(Qt::KeySequence(int(272629833))); + underlineAction= Qt::Action(this,"underlineAction"); + underlineAction->setToggleAction(1); + underlineAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textunder"))); + underlineAction->setText(this->trUtf8("underline")); + underlineAction->setMenuText(this->trUtf8("&Underline")); + underlineAction->setAccel(Qt::KeySequence(int(272629845))); + alignActionGroup= Qt::ActionGroup(this,"alignActionGroup"); + alignActionGroup->setText(this->trUtf8("align")); + alignActionGroup->setUsesDropDown(0); + leftAlignAction= Qt::Action(alignActionGroup,"leftAlignAction"); + leftAlignAction->setToggleAction(1); + leftAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textleft"))); + leftAlignAction->setText(this->trUtf8("left")); + leftAlignAction->setMenuText(this->trUtf8("&Left")); + leftAlignAction->setAccel(Qt::KeySequence(int(272629836))); + rightAlignAction= Qt::Action(alignActionGroup,"rightAlignAction"); + rightAlignAction->setToggleAction(1); + rightAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textright"))); + rightAlignAction->setText(this->trUtf8("right")); + rightAlignAction->setMenuText(this->trUtf8("&Right")); + rightAlignAction->setAccel(Qt::KeySequence(int(272629842))); + centerAlignAction= Qt::Action(alignActionGroup,"centerAlignAction"); + centerAlignAction->setToggleAction(1); + centerAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textcenter"))); + centerAlignAction->setText(this->trUtf8("center")); + centerAlignAction->setMenuText(this->trUtf8("&Center")); + + + toolBar = Qt::ToolBar("", this, &DockTop); + + toolBar->setLabel(this->trUtf8("Tools")); + fileNewAction->addTo(toolBar); + fileOpenAction->addTo(toolBar); + fileSaveAction->addTo(toolBar); + toolBar->addSeparator; + editUndoAction->addTo(toolBar); + editRedoAction->addTo(toolBar); + editCutAction->addTo(toolBar); + editCopyAction->addTo(toolBar); + editPasteAction->addTo(toolBar); + Toolbar = Qt::ToolBar("", this, &DockTop); + + Toolbar->setLabel(this->trUtf8("Toolbar")); + leftAlignAction->addTo(Toolbar); + centerAlignAction->addTo(Toolbar); + rightAlignAction->addTo(Toolbar); + Toolbar->addSeparator; + boldAction->addTo(Toolbar); + italicAction->addTo(Toolbar); + underlineAction->addTo(Toolbar); + Toolbar->addSeparator; + + fontComboBox = Qt::ComboBox(0, Toolbar, "fontComboBox"); + + SpinBox2 = Qt::SpinBox(Toolbar, "SpinBox2"); + SpinBox2->setMinValue(int(6)); + SpinBox2->setValue(int(10)); + + + menubar= Qt::MenuBar( this, "menubar"); + + fileMenu= Qt::PopupMenu(this); + fileNewAction->addTo(fileMenu); + fileOpenAction->addTo(fileMenu); + fileSaveAction->addTo(fileMenu); + fileSaveAsAction->addTo(fileMenu); + fileMenu->insertSeparator; + fileExitAction->addTo(fileMenu); + menubar->insertItem(this->trUtf8("&File"), fileMenu); + + editMenu= Qt::PopupMenu(this); + editUndoAction->addTo(editMenu); + editRedoAction->addTo(editMenu); + editMenu->insertSeparator; + editCutAction->addTo(editMenu); + editCopyAction->addTo(editMenu); + editPasteAction->addTo(editMenu); + menubar->insertItem(this->trUtf8("&Edit"), editMenu); + + PopupMenu_2= Qt::PopupMenu(this); + leftAlignAction->addTo(PopupMenu_2); + rightAlignAction->addTo(PopupMenu_2); + centerAlignAction->addTo(PopupMenu_2); + PopupMenu_2->insertSeparator; + boldAction->addTo(PopupMenu_2); + italicAction->addTo(PopupMenu_2); + underlineAction->addTo(PopupMenu_2); + menubar->insertItem(this->trUtf8("F&ormat"), PopupMenu_2); + + helpMenu= Qt::PopupMenu(this); + helpContentsAction->addTo(helpMenu); + helpIndexAction->addTo(helpMenu); + helpMenu->insertSeparator; + helpAboutAction->addTo(helpMenu); + menubar->insertItem(this->trUtf8("&Help"), helpMenu); + + + + Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()"); + Qt::Object::connect(fileOpenAction, SIGNAL "activated()", this, SLOT "fileOpen()"); + Qt::Object::connect(fileSaveAction, SIGNAL "activated()", this, SLOT "fileSave()"); + Qt::Object::connect(fileSaveAsAction, SIGNAL "activated()", this, SLOT "fileSaveAs()"); + Qt::Object::connect(fileExitAction, SIGNAL "activated()", this, SLOT "fileExit()"); + Qt::Object::connect(helpIndexAction, SIGNAL "activated()", this, SLOT "helpIndex()"); + Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "helpContents()"); + Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()"); + Qt::Object::connect(SpinBox2, SIGNAL "valueChanged(int)", textEdit, SLOT "setPointSize(int)"); + Qt::Object::connect(editCutAction, SIGNAL "activated()", textEdit, SLOT "cut()"); + Qt::Object::connect(editPasteAction, SIGNAL "activated()", textEdit, SLOT "paste()"); + Qt::Object::connect(editCopyAction, SIGNAL "activated()", textEdit, SLOT "copy()"); + Qt::Object::connect(editRedoAction, SIGNAL "activated()", textEdit, SLOT "redo()"); + Qt::Object::connect(editUndoAction, SIGNAL "activated()", textEdit, SLOT "undo()"); + Qt::Object::connect(alignActionGroup, SIGNAL "selected(QAction*)", this, SLOT "changeAlignment(QAction*)"); + Qt::Object::connect(underlineAction, SIGNAL "toggled(bool)", textEdit, SLOT "setUnderline(bool)"); + Qt::Object::connect(italicAction, SIGNAL "toggled(bool)", textEdit, SLOT "setItalic(bool)"); + Qt::Object::connect(boldAction, SIGNAL "toggled(bool)", textEdit, SLOT "setBold(bool)"); + Qt::Object::connect(fontComboBox, SIGNAL "activated(const QString&)", textEdit, SLOT "setFamily(const QString&)"); + Qt::Object::connect(fontComboBox, SIGNAL "activated(const QString&)", textEdit, SLOT "setFocus()"); + + init(); +} + + +sub init +{ + + textEdit->setFocus; + my $fonts = Qt::FontDatabase; + fontComboBox->insertStringList($fonts->families); + my $font = lc textEdit->family; + for(my $i = 0; $i < fontComboBox->count; $i++) { + if($font eq fontComboBox->text($i)) { + fontComboBox->setCurrentItem($i); + last; + } + } + +} + +sub fileExit +{ + print "EditorForm->fileExit(): Not implemented yet.\n"; +} + +sub fileNew +{ + print "EditorForm->fileNew(): Not implemented yet.\n"; +} + +sub fileOpen +{ + print "EditorForm->fileOpen(): Not implemented yet.\n"; +} + +sub fileSave +{ + print "EditorForm->fileSave(): Not implemented yet.\n"; +} + +sub fileSaveAs +{ + print "EditorForm->fileSaveAs(): Not implemented yet.\n"; +} + +sub helpAbout +{ + print "EditorForm->helpAbout(): Not implemented yet.\n"; +} + +sub helpContents +{ + print "EditorForm->helpContents(): Not implemented yet.\n"; +} + +sub helpIndex +{ + print "EditorForm->helpIndex(): Not implemented yet.\n"; +} + +sub changeAlignment +{ + print "EditorForm->changeAlignment(QAction*): Not implemented yet.\n"; +} + +sub saveAndContinue +{ + print "EditorForm->saveAndContinue(const QString&): Not implemented yet.\n"; +} + +1; + + +package main; + +use Qt; +use EditorForm; +use imageCollection; + +my $a = Qt::Application(\@ARGV); +Qt::Object::connect($a, SIGNAL("lastWindowClosed()"), $a, SLOT("quit()")); +my $w = EditorForm; +$a->setMainWidget($w); +$w->show; +exit $a->exec; + + diff --git a/PerlQt/handlers.cpp b/PerlQt/handlers.cpp new file mode 100644 index 0000000..da0278c --- /dev/null +++ b/PerlQt/handlers.cpp @@ -0,0 +1,1347 @@ +#include <qstring.h> +#include <qregexp.h> +#include <qapplication.h> +#include <qmetaobject.h> +#include <qvaluelist.h> +#include <qwidgetlist.h> +#include <qcanvas.h> +#include <qobjectlist.h> +#include <qintdict.h> +#include <qtoolbar.h> +#include <qtabbar.h> +#include <qdir.h> +#include <qdockwindow.h> +#include <qnetworkprotocol.h> +#include <private/qucomextra_p.h> +#include "smoke.h" + +#undef DEBUG +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef __USE_POSIX +#define __USE_POSIX +#endif +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#if PERL_VERSION == 6 && PERL_SUBVERSION == 0 + #include <qtextcodec.h> +#endif + +#include "marshall.h" +#include "perlqt.h" +#include "smokeperl.h" + +#ifndef HINT_BYTES +#define HINT_BYTES HINT_BYTE +#endif + +#ifndef PERL_MAGIC_tiedscalar +#define PERL_MAGIC_tiedscalar 'q' +#endif + +extern HV* pointer_map; +static QIntDict<Smoke::Index> *dtorcache= 0; +static QIntDict<Smoke::Index> *cctorcache= 0; + +int smokeperl_free(pTHX_ SV *sv, MAGIC *mg) { + smokeperl_object *o = (smokeperl_object*)mg->mg_ptr; + + const char *className = o->smoke->classes[o->classId].className; + if(o->allocated && o->ptr) { + if(do_debug && (do_debug & qtdb_gc)) fprintf(stderr, "Deleting (%s*)%p\n", className, o->ptr); + SmokeClass sc(o->smoke, o->classId); + if(sc.hasVirtual()) + unmapPointer(o, o->classId, 0); + Smoke::Index *pmeth = dtorcache->find( o->classId ); + if(pmeth) { + Smoke::Method &m = o->smoke->methods[o->smoke->methodMaps[*pmeth].method]; + Smoke::ClassFn fn = o->smoke->classes[m.classId].classFn; + Smoke::StackItem i[1]; + (*fn)(m.method, o->ptr, i); + } else { + char *methodName = new char[strlen(className) + 2]; + methodName[0] = '~'; + strcpy(methodName + 1, className); + Smoke::Index nameId = o->smoke->idMethodName(methodName); + Smoke::Index meth = o->smoke->findMethod(o->classId, nameId); + if(meth > 0) { + dtorcache->insert(o->classId, new Smoke::Index(meth)); + Smoke::Method &m = o->smoke->methods[o->smoke->methodMaps[meth].method]; + Smoke::ClassFn fn = o->smoke->classes[m.classId].classFn; + Smoke::StackItem i[1]; + (*fn)(m.method, o->ptr, i); + } + delete[] methodName; + } + } + return 0; +} + +struct mgvtbl vtbl_smoke = { 0, 0, 0, 0, smokeperl_free }; + +bool matches_arg(Smoke *smoke, Smoke::Index meth, Smoke::Index argidx, const char *argtype) { + Smoke::Index *arg = smoke->argumentList + smoke->methods[meth].args + argidx; + SmokeType type = SmokeType(smoke, *arg); + if(type.name() && !strcmp(type.name(), argtype)) + return true; + return false; +} + +void *construct_copy(smokeperl_object *o) { + Smoke::Index *pccMeth = cctorcache->find(o->classId); + Smoke::Index ccMeth = 0; + if(!pccMeth) { + const char *className = o->smoke->className(o->classId); + int classNameLen = strlen(className); + char *ccSig = new char[classNameLen + 2]; // copy constructor signature + strcpy(ccSig, className); + strcat(ccSig, "#"); + Smoke::Index ccId = o->smoke->idMethodName(ccSig); + delete[] ccSig; + + char *ccArg = new char[classNameLen + 8]; + sprintf(ccArg, "const %s&", className); + + ccMeth = o->smoke->findMethod(o->classId, ccId); + + if(!ccMeth) { + cctorcache->insert(o->classId, new Smoke::Index(0)); + return 0; + } + Smoke::Index method = o->smoke->methodMaps[ccMeth].method; + if(method > 0) { + // Make sure it's a copy constructor + if(!matches_arg(o->smoke, method, 0, ccArg)) { + delete[] ccArg; + cctorcache->insert(o->classId, new Smoke::Index(0)); + return 0; + } + delete[] ccArg; + ccMeth = method; + } else { + // ambiguous method, pick the copy constructor + Smoke::Index i = -method; + while(o->smoke->ambiguousMethodList[i]) { + if(matches_arg(o->smoke, o->smoke->ambiguousMethodList[i], 0, ccArg)) + break; + i++; + } + delete[] ccArg; + ccMeth = o->smoke->ambiguousMethodList[i]; + if(!ccMeth) { + cctorcache->insert(o->classId, new Smoke::Index(0)); + return 0; + } + } + cctorcache->insert(o->classId, new Smoke::Index(ccMeth)); + } else { + ccMeth = *pccMeth; + if(!ccMeth) + return 0; + } + // Okay, ccMeth is the copy constructor. Time to call it. + Smoke::StackItem args[2]; + args[0].s_voidp = 0; + args[1].s_voidp = o->ptr; + Smoke::ClassFn fn = o->smoke->classes[o->classId].classFn; + (*fn)(o->smoke->methods[ccMeth].method, 0, args); + return args[0].s_voidp; +} + +static void marshall_basetype(Marshall *m) { + switch(m->type().elem()) { + case Smoke::t_bool: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_bool = SvTRUE(m->var()) ? true : false; + break; + case Marshall::ToSV: + sv_setsv_mg(m->var(), boolSV(m->item().s_bool)); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_char: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_char = (char)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_char); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_uchar: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_uchar = (unsigned char)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_uchar); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_short: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_short = (short)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_short); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_ushort: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_ushort = (unsigned short)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_ushort); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_int: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_int = (int)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_int); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_uint: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_uint = (unsigned int)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_uint); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_long: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_long = (long)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_long); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_ulong: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_ulong = (unsigned long)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_ulong); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_float: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_float = (float)SvNV(m->var()); + break; + case Marshall::ToSV: + sv_setnv_mg(m->var(), (NV)m->item().s_float); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_double: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_double = (double)SvNV(m->var()); + break; + case Marshall::ToSV: + sv_setnv_mg(m->var(), (NV)m->item().s_double); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_enum: + switch(m->action()) { + case Marshall::FromSV: + m->item().s_enum = (long)SvIV(m->var()); + break; + case Marshall::ToSV: + sv_setiv_mg(m->var(), (IV)m->item().s_enum); + break; + default: + m->unsupported(); + break; + } + break; + case Smoke::t_class: + switch(m->action()) { + case Marshall::FromSV: + { + smokeperl_object *o = sv_obj_info(m->var()); + if(!o || !o->ptr) { + if(m->type().isRef()) { + warn("References can't be null or undef\n"); + m->unsupported(); + } + m->item().s_class = 0; + break; + } + void *ptr = o->ptr; + if(!m->cleanup() && m->type().isStack()) { + void *p = construct_copy(o); + if(p) + ptr = p; + } + const Smoke::Class &c = m->smoke()->classes[m->type().classId()]; + ptr = o->smoke->cast( + ptr, // pointer + o->classId, // from + o->smoke->idClass(c.className) // to + ); + m->item().s_class = ptr; + break; + } + break; + case Marshall::ToSV: + { + if(!m->item().s_voidp) { + sv_setsv_mg(m->var(), &PL_sv_undef); + break; + } + void *p = m->item().s_voidp; + SV *obj = getPointerObject(p); + if(obj) { + sv_setsv_mg(m->var(), obj); + break; + } + HV *hv = newHV(); + obj = newRV_noinc((SV*)hv); + // TODO: Generic mapping from C++ classname to Qt classname + + smokeperl_object o; + o.smoke = m->smoke(); + o.classId = m->type().classId(); + o.ptr = p; + o.allocated = false; + + if(m->type().isStack()) + o.allocated = true; + + char *buf = m->smoke()->binding->className(m->type().classId()); + sv_bless(obj, gv_stashpv(buf, TRUE)); + delete[] buf; + if(m->type().isConst() && m->type().isRef()) { + p = construct_copy( &o ); + if(p) { + o.ptr = p; + o.allocated = true; + } + } + sv_magic((SV*)hv, sv_qapp, '~', (char*)&o, sizeof(o)); + MAGIC *mg = mg_find((SV*)hv, '~'); + mg->mg_virtual = &vtbl_smoke; + sv_setsv_mg(m->var(), obj); + SmokeClass sc( m->type() ); + if( sc.hasVirtual() ) + mapPointer(obj, &o, pointer_map, o.classId, 0); + SvREFCNT_dec(obj); + } + break; + default: + m->unsupported(); + break; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_void(Marshall *) {} +static void marshall_unknown(Marshall *m) { + m->unsupported(); +} + +static void marshall_charP(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(!SvOK(sv)) { + m->item().s_voidp = 0; + break; + } + if(m->cleanup()) + m->item().s_voidp = SvPV_nolen(sv); + else { + STRLEN len; + char *svstr = SvPV(sv, len); + char *str = new char [len + 1]; + strncpy(str, svstr, len); + str[len] = 0; + m->item().s_voidp = str; + } + } + break; + case Marshall::ToSV: + { + char *p = (char*)m->item().s_voidp; + if(p) + sv_setpv_mg(m->var(), p); + else + sv_setsv_mg(m->var(), &PL_sv_undef); + if(m->cleanup()) + delete[] p; + } + break; + default: + m->unsupported(); + break; + } +} + +void marshall_ucharP(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV* sv = m->var(); + QByteArray *s = 0; + MAGIC* mg = 0; + bool hasMagic = false; + if(SvOK(sv)) { + if( SvTYPE(sv) == SVt_PVMG && (mg = mg_find(sv, PERL_MAGIC_tiedscalar)) + && sv_derived_from(mg->mg_obj, "Qt::_internal::QByteArray") ) { + s = (QByteArray*)SvIV((SV*)SvRV(mg->mg_obj)); + hasMagic = true; + } else { + STRLEN len; + char* tmp = SvPV(sv, len); + s = new QByteArray(len); + Copy((void*)tmp, (void*)s->data(), len, char); + if( !m->type().isConst() && !SvREADONLY(sv) ) { + SV* rv = newSV(0); + sv_setref_pv(rv, "Qt::_internal::QByteArray", (void*)s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } + } else { + if( !m->type().isConst() ) { + if(SvREADONLY(sv) && m->type().isPtr()) { + m->item().s_voidp = 0; + break; + } + s = new QByteArray(0); + if( !SvREADONLY(sv) ) { + SV* rv = newSV(0); + sv_setpv_mg(sv, ""); + sv_setref_pv(rv, "Qt::_internal::QByteArray", s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } else + s = new QByteArray(0); + } + m->item().s_voidp = s->data(); + m->next(); + if(s && !hasMagic && m->cleanup()) + delete s; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_QString(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV* sv = m->var(); + QString *s = 0; + MAGIC* mg = 0; + bool hasMagic = false; + if(SvOK(sv) || m->type().isStack()) { + if( SvTYPE(sv) == SVt_PVMG && (mg = mg_find(sv, PERL_MAGIC_tiedscalar)) + && sv_derived_from(mg->mg_obj, "Qt::_internal::QString") ) { + s = (QString*)SvIV((SV*)SvRV(mg->mg_obj)); + hasMagic = true; + } else { + COP *cop = cxstack[cxstack_ix].blk_oldcop; + if(SvUTF8(sv)) + s = new QString(QString::fromUtf8(SvPV_nolen(sv))); + else if(cop->op_private & HINT_LOCALE) + s = new QString(QString::fromLocal8Bit(SvPV_nolen(sv))); + else + s = new QString(QString::fromLatin1(SvPV_nolen(sv))); + if( !m->type().isConst() && !m->type().isStack() && !SvREADONLY(sv)) { + SV* rv = newSV(0); + sv_setref_pv(rv, "Qt::_internal::QString", (void*)s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } + } else { + if(!m->type().isConst()) { + if(SvREADONLY(sv) && m->type().isPtr()) { + m->item().s_voidp = 0; + break; + } + s = new QString; + if( !SvREADONLY(sv) ) { + SV* rv = newSV(0); + sv_setpv_mg(sv, ""); + sv_setref_pv(rv, "Qt::_internal::QString", s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } else + s = new QString; + } + m->item().s_voidp = s; + m->next(); + if(s && !hasMagic && m->cleanup()) + delete s; + } + break; + case Marshall::ToSV: + { + QString *s = (QString*)m->item().s_voidp; + if(s) { + COP *cop = cxstack[cxstack_ix].blk_oldcop; + if(!(cop->op_private & HINT_BYTES)) + { + sv_setpv_mg(m->var(), (const char *)s->utf8()); + SvUTF8_on(m->var()); + } + else if(cop->op_private & HINT_LOCALE) + sv_setpv_mg(m->var(), (const char *)s->local8Bit()); + else + sv_setpv_mg(m->var(), (const char *)s->latin1()); + } + else + sv_setsv_mg(m->var(), &PL_sv_undef); + if(m->cleanup()) + delete s; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_QByteArray(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV* sv = m->var(); + QByteArray *s = 0; + MAGIC* mg = 0; + bool hasMagic = false; + if(SvOK(sv) || m->type().isStack()) { + if( SvTYPE(sv) == SVt_PVMG && (mg = mg_find(sv, PERL_MAGIC_tiedscalar)) + && sv_derived_from(mg->mg_obj, "Qt::_internal::QByteArray") ) { + s = (QByteArray*)SvIV((SV*)SvRV(mg->mg_obj)); + hasMagic = true; + } else { + STRLEN len; + char* tmp = SvPV(sv, len); + s = new QByteArray(len); + Copy((void*)tmp, (void*)s->data(), len, char); + if( !m->type().isConst() && !SvREADONLY(sv) ) { // we tie also stack because of the funny QDataStream behaviour + // fprintf(stderr, "Tying\n"); + SV* rv = newSV(0); + sv_setref_pv(rv, "Qt::_internal::QByteArray", (void*)s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } + } else { + if( !m->type().isConst() ) { + if(SvREADONLY(sv) && m->type().isPtr()) { + m->item().s_voidp = 0; + break; + } + s = new QByteArray(0); + if( !SvREADONLY(sv) ) { + SV* rv = newSV(0); + sv_setpv_mg(sv, ""); + sv_setref_pv(rv, "Qt::_internal::QByteArray", s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + hasMagic = true; + } + } else + s = new QByteArray(0); + } + m->item().s_voidp = s; + m->next(); + if(s && !hasMagic && m->cleanup()) + delete s; + } + break; +// ToSV is probably overkill here, but will do well as a template for other types. + case Marshall::ToSV: + { + bool hasMagic = false; + SV *sv = m->var(); + QByteArray *s = (QByteArray*)m->item().s_voidp; + if(s) { + if( !m->type().isConst() && !m->type().isStack() && !SvREADONLY(sv)) { + SV* rv = newSV(0); + sv_setref_pv(rv, "Qt::_internal::QByteArray", (void*)s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); // err, is a previous magic auto-untied here? + hasMagic = true; + } else + sv_setpvn_mg(sv, (const char *)s->data(), s->size()); + } + else + sv_setsv_mg(sv, &PL_sv_undef); + if(m->cleanup() && !hasMagic) + delete s; + } + break; + default: + m->unsupported(); + break; + } +} + +static const char *not_ascii(const char *s, uint &len) +{ + bool r = false; + for(; *s ; s++, len--) + if((uint)*s > 0x7F) + { + r = true; + break; + } + return r ? s : 0L; +} + +static void marshall_QCString(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + QCString *s = 0; + if(SvOK(m->var()) || m->type().isStack()) + s = new QCString(SvPV_nolen(m->var())); + m->item().s_voidp = s; + m->next(); + if(s && m->cleanup()) + delete s; + } + break; + case Marshall::ToSV: + { + QCString *s = (QCString*)m->item().s_voidp; + if(s) { + sv_setpv_mg(m->var(), (const char *)*s); + const char * p = (const char *)*s; + uint len = s->length(); + COP *cop = cxstack[cxstack_ix].blk_oldcop; + if(!(cop->op_private & HINT_BYTES) && not_ascii(p,len)) + { + #if PERL_VERSION == 6 && PERL_SUBVERSION == 0 + QTextCodec* c = QTextCodec::codecForMib(106); // utf8 + if(c->heuristicContentMatch(p,len) >= 0) + #else + if(is_utf8_string((U8 *)p,len)) + #endif + SvUTF8_on(m->var()); + } + } + else + sv_setsv_mg(m->var(), &PL_sv_undef); + + if(m->cleanup()) + delete s; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_QCOORD_array(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + m->item().s_voidp = 0; + break; + } + AV *av = (AV*)SvRV(sv); + int count = av_len(av); + QCOORD *coord = new QCOORD[count + 2]; + for(int i = 0; i <= count; i++) { + SV **svp = av_fetch(av, i, 0); + coord[i] = svp ? SvIV(*svp) : 0; + } + m->item().s_voidp = coord; + m->next(); + } + break; + default: + m->unsupported(); + } +} + +static void marshall_intR(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(m->type().isPtr() && // is pointer + !SvOK(sv) && SvREADONLY(sv)) { // and real undef + m->item().s_voidp = 0; // pass null pointer + break; + } + if(m->cleanup()) { + int i = SvIV(sv); + m->item().s_voidp = &i; + m->next(); + sv_setiv_mg(sv, (IV)i); + } else { + m->item().s_voidp = new int((int)SvIV(sv)); + if(PL_dowarn) + warn("Leaking memory from int& handler"); + } + } + break; + case Marshall::ToSV: + { + int *ip = (int*)m->item().s_voidp; + SV *sv = m->var(); + if(!ip) { + sv_setsv_mg(sv, &PL_sv_undef); + break; + } + sv_setiv_mg(sv, *ip); + m->next(); + if(!m->type().isConst()) + *ip = (int)SvIV(sv); + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_boolR(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(m->type().isPtr() && // is pointer + !SvOK(sv) && SvREADONLY(sv)) { // and real undef + m->item().s_voidp = 0; // pass null pointer + break; + } + if(m->cleanup()) { + bool i = SvTRUE(sv)? true : false; + m->item().s_voidp = &i; + m->next(); + sv_setsv_mg(sv, boolSV(i)); + } else { + m->item().s_voidp = new bool(SvTRUE(sv)?true:false); + if(PL_dowarn) + warn("Leaking memory from bool& handler"); + } + } + break; + case Marshall::ToSV: + { + bool *ip = (bool*)m->item().s_voidp; + SV *sv = m->var(); + if(!ip) { + sv_setsv_mg(sv, &PL_sv_undef); + break; + } + sv_setsv_mg(sv, boolSV(*ip)); + m->next(); + if(!m->type().isConst()) + *ip = SvTRUE(sv)? true : false; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_charP_array(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + m->item().s_voidp = 0; + break; + } + + AV *arglist = (AV*)SvRV(sv); + int count = av_len(arglist); + char **argv = new char *[count + 2]; + int i; + for(i = 0; i <= count; i++) { + SV **item = av_fetch(arglist, i, 0); + if(!item || !SvOK(*item)) { + argv[i] = new char[1]; + argv[i][0] = 0; // should undef warn? + continue; + } + + STRLEN len; + char *s = SvPV(*item, len); + argv[i] = new char[len + 1]; + strncpy(argv[i], s, len); + argv[i][len] = 0; // null terminazi? yes + } + argv[i] = 0; + m->item().s_voidp = argv; + m->next(); + if(m->cleanup()) { + av_clear(arglist); + for(i = 0; argv[i]; i++) + av_push(arglist, newSVpv(argv[i], 0)); + + // perhaps we should check current_method? + } + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_QStringList(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + m->item().s_voidp = 0; + break; + } + AV *list = (AV*)SvRV(sv); + int count = av_len(list); + QStringList *stringlist = new QStringList; + int i; + COP *cop = cxstack[cxstack_ix].blk_oldcop; + bool lc = cop->op_private & HINT_LOCALE; + for(i = 0; i <= count; i++) { + SV **item = av_fetch(list, i, 0); + if(!item || !SvOK(*item)) { + stringlist->append(QString()); + continue; + } + + if(SvUTF8(*item)) + stringlist->append(QString::fromUtf8(SvPV_nolen(*item))); + else if(lc) + stringlist->append(QString::fromLocal8Bit(SvPV_nolen(*item))); + else + stringlist->append(QString::fromLatin1(SvPV_nolen(*item))); + } + + m->item().s_voidp = stringlist; + m->next(); + + if(m->cleanup()) { + av_clear(list); + for(QStringList::Iterator it = stringlist->begin(); + it != stringlist->end(); + ++it) + av_push(list, newSVpv((const char *)*it, 0)); + delete stringlist; + } + } + break; + case Marshall::ToSV: + { + QStringList *stringlist = (QStringList*)m->item().s_voidp; + if(!stringlist) { + sv_setsv_mg(m->var(), &PL_sv_undef); + break; + } + + AV *av = newAV(); + { + SV *rv = newRV_noinc((SV*)av); + sv_setsv_mg(m->var(), rv); + SvREFCNT_dec(rv); + } + COP *cop = cxstack[cxstack_ix].blk_oldcop; + if(!(cop->op_private & HINT_BYTES)) + for(QStringList::Iterator it = stringlist->begin(); + it != stringlist->end(); + ++it) { + SV *sv = newSVpv((const char *)(*it).utf8(), 0); + SvUTF8_on(sv); + av_push(av, sv); + } + else if(cop->op_private & HINT_LOCALE) + for(QStringList::Iterator it = stringlist->begin(); + it != stringlist->end(); + ++it) { + SV *sv = newSVpv((const char *)(*it).local8Bit(), 0); + av_push(av, sv); + } + else + for(QStringList::Iterator it = stringlist->begin(); + it != stringlist->end(); + ++it) { + SV *sv = newSVpv((const char *)(*it).latin1(), 0); + av_push(av, sv); + } + if(m->cleanup()) + delete stringlist; + } + break; + default: + m->unsupported(); + break; + } +} + +static void marshall_QValueListInt(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + m->item().s_voidp = 0; + break; + } + AV *list = (AV*)SvRV(sv); + int count = av_len(list); + QValueList<int> *valuelist = new QValueList<int>; + int i; + for(i = 0; i <= count; i++) { + SV **item = av_fetch(list, i, 0); + if(!item || !SvOK(*item)) { + valuelist->append(0); + continue; + } + + valuelist->append(SvIV(*item)); + } + + m->item().s_voidp = valuelist; + m->next(); + + if(m->cleanup()) { + av_clear(list); + for(QValueListIterator<int> it = valuelist->begin(); + it != valuelist->end(); + ++it) + av_push(list, newSViv((int)*it)); + delete valuelist; + } + } + break; + case Marshall::ToSV: + { + QValueList<int> *valuelist = (QValueList<int>*)m->item().s_voidp; + if(!valuelist) { + sv_setsv_mg(m->var(), &PL_sv_undef); + break; + } + + AV *av = newAV(); + { + SV *rv = newRV_noinc((SV*)av); + sv_setsv_mg(m->var(), rv); + SvREFCNT_dec(rv); + } + + for(QValueListIterator<int> it = valuelist->begin(); + it != valuelist->end(); + ++it) + av_push(av, newSViv((int)*it)); + if(m->cleanup()) + delete valuelist; + } + break; + default: + m->unsupported(); + break; + } +} + +void marshall_voidP(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV *sv = m->var(); + if(SvROK(sv) && SvRV(sv) && SvOK(SvRV(sv))) + m->item().s_voidp = (void*)SvIV(SvRV(m->var())); + else + m->item().s_voidp = 0; + } + break; + case Marshall::ToSV: + { + SV *sv = newSViv((IV)m->item().s_voidp); + SV *rv = newRV_noinc(sv); + sv_setsv_mg(m->var(), rv); + SvREFCNT_dec(rv); + } + break; + default: + m->unsupported(); + break; + } +} + +void marshall_QRgb_array(Marshall *m) { + switch(m->action()) { + case Marshall::FromSV: + { + SV* sv = m->var(); + QRgb* s = 0; + MAGIC* mg = 0; + if( SvOK(sv) && SvTYPE(sv) == SVt_PVMG && (mg = mg_find(sv, PERL_MAGIC_tiedscalar)) + && sv_derived_from(mg->mg_obj, "Qt::_internal::QRgbStar") ) { + s = (QRgb*)SvIV((SV*)SvRV(mg->mg_obj)); + } else if(!SvROK(sv) || SvREADONLY(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || + av_len((AV*)SvRV(sv)) < 0) { + m->item().s_voidp = 0; + break; + } else { + AV *list = (AV*)SvRV(sv); + int count = av_len(list); + s = new QRgb[count + 2]; + int i; + for(i = 0; i <= count; i++) { + SV **item = av_fetch(list, i, 0); + if(!item || !SvOK(*item)) { + s[i] = 0; + continue; + } + s[i] = SvIV(*item); + } + s[i] = 0; + SV* rv = newSV(0); + sv_setref_pv(rv, "Qt::_internal::QRgbStar", (void*)s); + sv_magic(sv, rv, PERL_MAGIC_tiedscalar, Nullch, 0); + } + m->item().s_voidp = s; + } + break; + default: + m->unsupported(); + break; + } +} + +// Templated classes marshallers + +#define GET_PERL_OBJECT( CCLASS, PCLASS, IS_STACK ) \ + SV *sv = getPointerObject((void*)t); \ + SV *ret= newSV(0); \ + if(!sv || !SvROK(sv)){ \ + HV *hv = newHV(); \ + SV *obj = newRV_noinc((SV*)hv); \ + \ + smokeperl_object o; \ + o.smoke = m->smoke(); \ + o.classId = ix; \ + o.ptr = (void*)t; \ + o.allocated = IS_STACK; \ + \ + sv_bless(obj, gv_stashpv( PCLASS, TRUE)); \ + \ + if(m->type().isConst() && m->type().isRef()) { \ + void* p = construct_copy( &o ); \ + if(p) { \ + o.ptr = p; \ + o.allocated = true; \ + } \ + } \ + sv_magic((SV*)hv, sv_qapp, '~', (char*)&o, sizeof(o)); \ + MAGIC *mg = mg_find((SV*)hv, '~'); \ + mg->mg_virtual = &vtbl_smoke; \ + \ + sv_setsv_mg(ret, obj); \ + SvREFCNT_dec(obj); \ + } \ + else \ + sv_setsv_mg(ret, sv); + + + + + +#define MARSHALL_QPTRLIST( FNAME, TMPLNAME, CCLASSNAME, PCLASSNAME, IS_STACK ) \ +static void marshall_ ## FNAME (Marshall *m) { \ + switch(m->action()) { \ + case Marshall::FromSV: \ + { \ + SV *sv = m->var(); \ + if(!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVAV || \ + av_len((AV*)SvRV(sv)) < 0) { \ + if(m->type().isRef()) { \ + warn("References can't be null or undef\n"); \ + m->unsupported(); \ + } \ + m->item().s_voidp = 0; \ + break; \ + } \ + AV *list = (AV*)SvRV(sv); \ + int count = av_len(list); \ + TMPLNAME *ptrlist = new TMPLNAME; \ + int i; \ + for(i = 0; i <= count; i++) { \ + SV **item = av_fetch(list, i, 0); \ + if(!item || !SvROK(*item) || SvTYPE(SvRV(*item)) != SVt_PVHV) \ + continue; \ + smokeperl_object *o = sv_obj_info(*item); \ + if(!o || !o->ptr) \ + continue; \ + void *ptr = o->ptr; \ + ptr = o->smoke->cast( \ + ptr, \ + o->classId, \ + o->smoke->idClass( #CCLASSNAME ) \ + ); \ + \ + ptrlist->append( ( CCLASSNAME *) ptr); \ + } \ + \ + m->item().s_voidp = ptrlist; \ + m->next(); \ + \ + if(m->cleanup()) { \ + av_clear(list); \ + int ix = m->smoke()->idClass( #CCLASSNAME ); \ + for( CCLASSNAME *t = ptrlist->first(); t ; t = ptrlist->next()){ \ + GET_PERL_OBJECT( CCLASSNAME, PCLASSNAME, IS_STACK ) \ + av_push(list, ret); \ + } \ + delete ptrlist; \ + } \ + } \ + break; \ + case Marshall::ToSV: \ + { \ + TMPLNAME *list = ( TMPLNAME *)m->item().s_voidp; \ + if(!list) { \ + sv_setsv_mg(m->var(), &PL_sv_undef); \ + break; \ + } \ + \ + AV *av = newAV(); \ + { \ + SV *rv = newRV_noinc((SV*)av); \ + sv_setsv_mg(m->var(), rv); \ + SvREFCNT_dec(rv); \ + } \ + int ix = m->smoke()->idClass( #CCLASSNAME ); \ + for( CCLASSNAME *t = list->first(); t ; t = list->next()){ \ + GET_PERL_OBJECT( CCLASSNAME, PCLASSNAME, IS_STACK ) \ + av_push(av, ret); \ + } \ + if(m->cleanup()) \ + delete list; \ + } \ + break; \ + default: \ + m->unsupported(); \ + break; \ + } \ +} + +MARSHALL_QPTRLIST( QPtrListQNetworkOperation, QPtrList<QNetworkOperation>, QNetworkOperation, " Qt::NetworkOperation", FALSE ) +MARSHALL_QPTRLIST( QPtrListQToolBar, QPtrList<QToolBar>, QToolBar, " Qt::ToolBar", FALSE ) +MARSHALL_QPTRLIST( QPtrListQTab, QPtrList<QTab>, QTab, " Qt::Tab", FALSE ) +MARSHALL_QPTRLIST( QPtrListQDockWindow, QPtrList<QDockWindow>, QDockWindow, " Qt::DockWindow", FALSE ) +MARSHALL_QPTRLIST( QWidgetList, QWidgetList, QWidget, " Qt::Widget", FALSE ) +MARSHALL_QPTRLIST( QObjectList, QObjectList, QObject, " Qt::Object", FALSE ) +MARSHALL_QPTRLIST( QFileInfoList, QFileInfoList, QFileInfo, " Qt::FileInfo", FALSE ) + +void marshall_QCanvasItemList(Marshall *m) { + switch(m->action()) { + + case Marshall::ToSV: + { + QCanvasItemList *cilist = (QCanvasItemList*)m->item().s_voidp; + if(!cilist) { + sv_setsv_mg(m->var(), &PL_sv_undef); + break; + } + + AV *av = newAV(); + { + SV *rv = newRV_noinc((SV*)av); + sv_setsv_mg(m->var(), rv); + SvREFCNT_dec(rv); + } + + int ix = m->smoke()->idClass( "QCanvasItem" ); + for(QValueListIterator<QCanvasItem*> it = cilist->begin(); + it != cilist->end(); + ++it){ + QCanvasItem* t= *it; + GET_PERL_OBJECT( QCanvasItem, " Qt::CanvasItem", FALSE ) + av_push(av, ret); + } + if(m->cleanup()) + delete cilist; + } + break; + default: + m->unsupported(); + break; + } +} + + + +TypeHandler Qt_handlers[] = { + { "QString", marshall_QString }, + { "QString&", marshall_QString }, + { "QString*", marshall_QString }, + { "const QString", marshall_QString }, + { "const QString&", marshall_QString }, + { "const QString*", marshall_QString }, + { "QCString", marshall_QCString }, + { "QCString&", marshall_QCString }, + { "QCString*", marshall_QCString }, + { "const QCString", marshall_QCString }, + { "const QCString&", marshall_QCString }, + { "const QCString*", marshall_QCString }, + { "QStringList", marshall_QStringList }, + { "QStringList&", marshall_QStringList }, + { "QStringList*", marshall_QStringList }, + { "int&", marshall_intR }, + { "int*", marshall_intR }, + { "bool&", marshall_boolR }, + { "bool*", marshall_boolR }, + { "char*", marshall_charP }, + { "const char*", marshall_charP }, + { "char**", marshall_charP_array }, + { "uchar*", marshall_ucharP }, + { "QRgb*", marshall_QRgb_array }, + { "QUObject*", marshall_voidP }, + { "const QCOORD*", marshall_QCOORD_array }, + { "void", marshall_void }, + { "QByteArray", marshall_QByteArray }, + { "QByteArray&", marshall_QByteArray }, + { "QByteArray*", marshall_QByteArray }, + { "QValueList<int>", marshall_QValueListInt }, + { "QValueList<int>*", marshall_QValueListInt }, + { "QValueList<int>&", marshall_QValueListInt }, + { "QCanvasItemList", marshall_QCanvasItemList }, + { "QCanvasItemList*", marshall_QCanvasItemList }, + { "QCanvasItemList&", marshall_QCanvasItemList }, + { "QWidgetList", marshall_QWidgetList }, + { "QWidgetList*", marshall_QWidgetList }, + { "QWidgetList&", marshall_QWidgetList }, + { "QObjectList", marshall_QObjectList }, + { "QObjectList*", marshall_QObjectList }, + { "QObjectList&", marshall_QObjectList }, + { "QFileInfoList", marshall_QFileInfoList }, + { "QFileInfoList*", marshall_QFileInfoList }, + { "QFileInfoList&", marshall_QFileInfoList }, + { "QPtrList<QToolBar>", marshall_QPtrListQToolBar }, + { "QPtrList<QToolBar>*", marshall_QPtrListQToolBar }, + { "QPtrList<QToolBar>&", marshall_QPtrListQToolBar }, + { "QPtrList<QTab>", marshall_QPtrListQTab }, + { "QPtrList<QTab>*", marshall_QPtrListQTab }, + { "QPtrList<QTab>&", marshall_QPtrListQTab }, + { "QPtrList<QDockWindow>", marshall_QPtrListQDockWindow }, + { "QPtrList<QDockWindow>*", marshall_QPtrListQDockWindow }, + { "QPtrList<QDockWindow>&", marshall_QPtrListQDockWindow }, + { "QPtrList<QNetworkOperation>", marshall_QPtrListQNetworkOperation }, + { "QPtrList<QNetworkOperation>*", marshall_QPtrListQNetworkOperation }, + { "QPtrList<QNetworkOperation>&", marshall_QPtrListQNetworkOperation }, + { 0, 0 } +}; + +static HV *type_handlers = 0; + +void install_handlers(TypeHandler *h) { + if(!type_handlers) type_handlers = newHV(); + while(h->name) { + hv_store(type_handlers, h->name, strlen(h->name), newSViv((IV)h), 0); + h++; + } + if(!dtorcache){ + dtorcache = new QIntDict<Smoke::Index>(113); + dtorcache->setAutoDelete(1); + } + if(!cctorcache) { + cctorcache = new QIntDict<Smoke::Index>(113); + cctorcache->setAutoDelete(1); + } +} + +Marshall::HandlerFn getMarshallFn(const SmokeType &type) { + if(type.elem()) + return marshall_basetype; + if(!type.name()) + return marshall_void; + if(!type_handlers) { + return marshall_unknown; + } + U32 len = strlen(type.name()); + SV **svp = hv_fetch(type_handlers, type.name(), len, 0); + if(!svp && type.isConst() && len > 6) + svp = hv_fetch(type_handlers, type.name() + 6, len - 6, 0); + if(svp) { + TypeHandler *h = (TypeHandler*)SvIV(*svp); + return h->fn; + } + return marshall_unknown; +} diff --git a/PerlQt/lib/Qt/GlobalSpace.pm b/PerlQt/lib/Qt/GlobalSpace.pm new file mode 100644 index 0000000..65e481a --- /dev/null +++ b/PerlQt/lib/Qt/GlobalSpace.pm @@ -0,0 +1,25 @@ +package Qt::GlobalSpace; +use strict; +require Qt; +require Exporter; + +our @ISA = qw(Exporter); +our @EXPORT; +our $allMeth = Qt::_internal::findAllMethods( Qt::_internal::idClass("QGlobalSpace") ); +no strict 'refs'; + +for my $proto( keys %$allMeth ) +{ + next if $proto =~ /operator\W/; # skip operators + $proto =~ s/[\#\$\?]+$//; + *{ $proto } = sub + { + $Qt::_internal::autoload::AUTOLOAD = "Qt::GlobalSpace\::$proto"; + goto &Qt::GlobalSpace::AUTOLOAD + } unless defined &$proto; + push @EXPORT, $proto; +} + +our %EXPORT_TAGS = ( "all" => [@EXPORT] ); + +1;
\ No newline at end of file diff --git a/PerlQt/lib/Qt/attributes.pm b/PerlQt/lib/Qt/attributes.pm new file mode 100644 index 0000000..3a25487 --- /dev/null +++ b/PerlQt/lib/Qt/attributes.pm @@ -0,0 +1,51 @@ +package Qt::attributes; +# +# I plan to support public/protected/private attributes. here goes. +# Attributes default to protected. +# +# package MyBase; +# use Qt::attributes qw( +# private: +# foo +# protected: +# bar +# public: +# baz +# ); +# +# package MyDerived; +# use Qt::isa qw(MyBase); +# +# sub foo { +# # 1 way to access private attributes from derived class +# # +# # this->{$class} contains private attributes for $class +# # I specify it to always work that way, +# # so feel free to use it in code. +# this->{MyBase}{foo} = 10; +# +# # 2 ways to access protected attributes +# bar = 10; +# this->{bar} = 10; +# +# # 3 ways to access public attributes +# baz = 10; +# this->{baz} = 10; +# this->baz = 10; +# } +# +# Attributes override any method with the same name, so you may want +# to prefix them with _ to prevent conflicts. +# +sub import { + my $class = shift; + my $caller = (caller)[0]; + + for my $attribute (@_) { + exists ${ ${$caller . '::META'}{'attributes'} }{$attribute} and next; + Qt::_internal::installattribute($caller, $attribute); + ${ ${$caller . '::META'}{'attributes'} }{$attribute} = 1; + } +} + +1; diff --git a/PerlQt/lib/Qt/constants.pm b/PerlQt/lib/Qt/constants.pm new file mode 100644 index 0000000..9c7081c --- /dev/null +++ b/PerlQt/lib/Qt/constants.pm @@ -0,0 +1,62 @@ +package Qt::constants; + +require Exporter; + +our @ISA = qw(Exporter); +our @EXPORT = qw( + IO_Direct + IO_Sequential + IO_Combined + IO_TypeMask + IO_Raw + IO_Async + IO_ReadOnly + IO_WriteOnly + IO_ReadWrite + IO_Append + IO_Truncate + IO_Translate + IO_ModeMask + IO_Open + IO_StateMask + IO_Ok + IO_ReadError + IO_WriteError + IO_FatalError + IO_ResourceError + IO_OpenError + IO_ConnectError + IO_AbortError + IO_TimeOutError + IO_UnspecifiedError +); + +our %EXPORT_TAGS = ( 'IO' => [ @EXPORT ] ); + +sub IO_Direct () { 0x0100 } +sub IO_Sequential () { 0x0200 } +sub IO_Combined () { 0x0300 } +sub IO_TypeMask () { 0x0f00 } +sub IO_Raw () { 0x0040 } +sub IO_Async () { 0x0080 } +sub IO_ReadOnly () { 0x0001 } +sub IO_WriteOnly () { 0x0002 } +sub IO_ReadWrite () { 0x0003 } +sub IO_Append () { 0x0004 } +sub IO_Truncate () { 0x0008 } +sub IO_Translate () { 0x0010 } +sub IO_ModeMask () { 0x00ff } +sub IO_Open () { 0x1000 } +sub IO_StateMask () { 0xf000 } +sub IO_Ok () { 0 } +sub IO_ReadError () { 1 } +sub IO_WriteError () { 2 } +sub IO_FatalError () { 3 } +sub IO_ResourceError () { 4 } +sub IO_OpenError () { 5 } +sub IO_ConnectError () { 5 } +sub IO_AbortError () { 6 } +sub IO_TimeOutError () { 7 } +sub IO_UnspecifiedError() { 8 } + +1;
\ No newline at end of file diff --git a/PerlQt/lib/Qt/debug.pm b/PerlQt/lib/Qt/debug.pm new file mode 100644 index 0000000..28c0a43 --- /dev/null +++ b/PerlQt/lib/Qt/debug.pm @@ -0,0 +1,36 @@ +package Qt::debug; +use Qt; + +our %channel = ( + 'ambiguous' => 0x01, + 'autoload' => 0x02, + 'calls' => 0x04, + 'gc' => 0x08, + 'virtual' => 0x10, + 'verbose' => 0x20, + 'all' => 0xffff +); + +sub import { + shift; + my $db = (@_)? 0x0000 : (0x01|0x20); + my $usage = 0; + for my $ch(@_) { + if( exists $channel{$ch}) { + $db |= $channel{$ch}; + } else { + warn "Unknown debugging channel: $ch\n"; + $usage++; + } + } + Qt::_internal::setDebug($db); + print "Available channels: \n\t". + join("\n\t", sort keys %channel). + "\n" if $usage; +} + +sub unimport { + Qt::_internal::setDebug(0); +} + +1;
\ No newline at end of file diff --git a/PerlQt/lib/Qt/enumerations.pm b/PerlQt/lib/Qt/enumerations.pm new file mode 100644 index 0000000..003b65b --- /dev/null +++ b/PerlQt/lib/Qt/enumerations.pm @@ -0,0 +1,15 @@ +package Qt::enumerations; +# +# Proposed usage: +# +# package MyWidget; +# +# use Qt::enumerations MyInfo => { +# Foo => 1, +# Bar => 10, +# Baz => 64 +# }; +# +# use Qt::enumerations MyInfo => [qw(Foo Bar Baz)]; +# +1; diff --git a/PerlQt/lib/Qt/isa.pm b/PerlQt/lib/Qt/isa.pm new file mode 100644 index 0000000..fb4b646 --- /dev/null +++ b/PerlQt/lib/Qt/isa.pm @@ -0,0 +1,81 @@ +package Qt::isa; +use strict; + +sub import { + no strict 'refs'; + my $class = shift; + my $caller = (caller)[0]; + + # Trick 'use' into believing the file for this class has been read + my $pm = $caller . ".pm"; + $pm =~ s!::!/!g; + unless(exists $::INC{$pm}) { + $::INC{$pm} = $::INC{"Qt/isa.pm"}; + } + + for my $super (@_) { + push @{ $caller . '::ISA' }, $super; + push @{ ${$caller . '::META'}{'superClass'} }, $super; # if isa(QObject)? + } + + *{ $caller . '::className' } = sub { # closure on $caller + return $caller; + }; + + ${ $caller. '::_INTERNAL_STATIC_'}{'SUPER'} = bless {}, " $caller"; + Qt::_internal::installsuper($caller) unless defined &{ $caller.'::SUPER' }; + + *{ $caller . '::metaObject' } = sub { + Qt::_internal::getMetaObject($caller); + }; + + *{ $caller . '::import' } = sub { + my $name = shift; # classname = function-name + my $incaller = (caller)[0]; + $incaller = (caller(1))[0] if $incaller eq 'if'; # work-around bug in package 'if' pre 0.02 + (my $cname = $name) =~ s/.*::// and do + { + *{ "$name" } = sub { + $name->new(@_); + } unless defined &{ "$name" }; + }; + my $p = defined $&? $&:''; + $p eq ($incaller=~/.*::/?($p?$&:''):'') and + *{ "$incaller\::$cname" } = sub { + $name->new(@_); + }; + + if(defined @{ ${$caller.'::META'}{'superClass'} } && + @{ ${$caller.'::META'}{'superClass'} } ) + { + # attributes inheritance + for my $attribute( keys %{ ${$caller.'::META'}{'attributes'} } ) + { + if(! defined &{$incaller.'::'.$attribute }) + { + Qt::_internal::installattribute($incaller, $attribute); + ${ ${$incaller .'::META'}{'attributes'} }{$attribute} = 1; + } + } + } + }; + + Qt::_internal::installautoload(" $caller"); + Qt::_internal::installautoload(" $caller"); + Qt::_internal::installautoload($caller); + { + package Qt::AutoLoad; + my $autosub = \&{ " $caller\::_UTOLOAD" }; + *{ " $caller\::AUTOLOAD" } = sub { &$autosub }; + $autosub = \&{ " $caller\::_UTOLOAD" }; + *{ " $caller\::AUTOLOAD" } = sub { &$autosub }; + $autosub = \&{ "$caller\::_UTOLOAD" }; + *{ "$caller\::AUTOLOAD" } = sub { &$autosub }; + } + Qt::_internal::installthis($caller); + + # operator overloading + *{ " $caller\::ISA" } = ["Qt::base::_overload"]; +} + +1; diff --git a/PerlQt/lib/Qt/properties.pm b/PerlQt/lib/Qt/properties.pm new file mode 100644 index 0000000..5dfcdb7 --- /dev/null +++ b/PerlQt/lib/Qt/properties.pm @@ -0,0 +1,14 @@ +package Qt::properties; +# +# Proposed usage: +# +# use Qt::properties foo => { +# TYPE => 'bool', +# READ => 'getFoo', +# WRITE => 'setFoo', +# STORED => 0, +# RESET => 'unsetFoo', +# DESIGNABLE => 0 +# }; +# +1; diff --git a/PerlQt/lib/Qt/signals.pm b/PerlQt/lib/Qt/signals.pm new file mode 100644 index 0000000..00aa061 --- /dev/null +++ b/PerlQt/lib/Qt/signals.pm @@ -0,0 +1,77 @@ +package Qt::signals; +use Carp; +# +# Proposed usage: +# +# use Qt::signals fooActivated => ['int']; +# +# use Qt::signals fooActivated => { +# name => 'fooActivated(int)', +# args => ['int'] +# }; +# +# sub whatever { emit fooActivated(10); } +# + +sub import { + no strict 'refs'; + my $self = shift; + my $caller = $self eq "Qt::signals" ? (caller)[0] : $self; + my $parent = ${ $caller . '::ISA' }[0]; + my $parent_qt_emit = $parent . '::qt_emit'; + + Qt::_internal::installqt_invoke($caller . '::qt_emit') unless defined &{ $caller. '::qt_emit' }; + +# *{ $caller . '::qt_emit' } = sub { +# my $meta = \%{ $caller . '::META' }; +# die unless $meta->{object}; +# my $offset = $_[0] - $meta->{object}->signalOffset; +# if($offset >= 0) { +# Qt::_internal::invoke(Qt::this(), $meta->{signals}[$offset], $_[1]); +# return 1; +# } else { +# Qt::this()->$parent_qt_emit(@_); +# } +# } unless defined &{ $caller . '::qt_emit' }; + + my $meta = \%{ $caller . '::META' }; + croak "Odd number of arguments in signal declaration" if @_%2; + my(%signals) = @_; + for my $signalname (keys %signals) { + my $signal = { name => $signalname }; + my $args = $signals{$signalname}; + $signal->{arguments} = [map { s/\s(?=[*&])//; { type => $_, name => "" } } @$args]; + my $arglist = join ',', @$args; + $signal->{prototype} = $signalname . "($arglist)"; + $signal->{returns} = 'void'; + $signal->{method} = $signalname; + push @{$meta->{signals}}, $signal; + my $signal_index = $#{ $meta->{signals} }; + + my $argcnt = scalar @$args; + my $mocargs = Qt::_internal::allocateMocArguments($argcnt); + my $i = 0; + for my $arg (@$args) { + my $a = $arg; + $a =~ s/^const\s+//; + if($a =~ /^(bool|int|double|char\*|QString)&?$/) { + $a = $1; + } else { + $a = 'ptr'; + } + my $valid = Qt::_internal::setMocType($mocargs, $i, $arg, $a); + die "Invalid type for signal argument ($arg)\n" unless $valid; + $i++; + } + + $meta->{signal}{$signalname} = $signal; + $signal->{index} = $signal_index; + $signal->{mocargs} = $mocargs; + $signal->{argcnt} = $argcnt; + + Qt::_internal::installsignal("$caller\::$signalname"); + } + @_ and $meta->{changed} = 1; +} + +1; diff --git a/PerlQt/lib/Qt/slots.pm b/PerlQt/lib/Qt/slots.pm new file mode 100644 index 0000000..5d1daf6 --- /dev/null +++ b/PerlQt/lib/Qt/slots.pm @@ -0,0 +1,84 @@ +package Qt::slots; +use Carp; +# +# Proposed usage: +# +# use Qt::slots changeSomething => ['int']; +# +# use Qt::slots 'changeSomething(int)' => { +# args => ['int'], +# call => 'changeSomething' +# }; +# + +sub import { + no strict 'refs'; + my $self = shift; + my $caller = $self eq "Qt::slots" ? (caller)[0] : $self; + my $parent = ${ $caller . '::ISA' }[0]; + my $parent_qt_invoke = $parent . '::qt_invoke'; + + Qt::_internal::installqt_invoke($caller . '::qt_invoke') unless defined &{ $caller. '::qt_invoke' }; + +# *{ $caller . '::qt_invoke' } = sub { +# my $meta = \%{ $caller . '::META' }; +# die unless $meta->{object}; +# my $offset = $_[0] - $meta->{object}->slotOffset; +# if($offset >= 0) { +# Qt::_internal::invoke(Qt::this(), $meta->{slots}[$offset], $_[1]); +# return 1; +# } else { +# Qt::this()->$parent_qt_invoke(@_); +# } +# } unless defined &{ $caller . '::qt_invoke' }; + + my $meta = \%{ $caller . '::META' }; + croak "Odd number of arguments in slot declaration" if @_%2; + my(%slots) = @_; + for my $slotname (keys %slots) { + my $slot = { name => $slotname }; + my $args = $slots{$slotname}; + $slot->{arguments} = [map { s/\s(?=[*&])//; { type => $_, name => "" } } @$args]; + my $arglist = join ',', @$args; + + $slot->{prototype} = $slotname . "($arglist)"; + if ( exists $meta->{slot}{$slotname} ) { + (my $s1 = $slot->{prototype}) =~ s/\s+//g; + (my $s2 = $meta->{slot}{$slotname}{prototype}) =~ s/\s+//g; + if( $s1 ne $s2 ) { + warn( "Slot declaration:\n\t$slot->{prototype}\nwill override ". + "previous declaration:\n\t$meta->{slot}{$slotname}{prototype}"); + } else { + next; + } + } + $slot->{returns} = 'void'; + $slot->{method} = $slotname; + push @{$meta->{slots}}, $slot; + my $slot_index = $#{ $meta->{slots} }; + + my $argcnt = scalar @$args; + my $mocargs = Qt::_internal::allocateMocArguments($argcnt); + my $i = 0; + for my $arg (@$args) { + my $a = $arg; + $a =~ s/^const\s+//; + if($a =~ /^(bool|int|double|char\*|QString)&?$/) { + $a = $1; + } else { + $a = 'ptr'; + } + my $valid = Qt::_internal::setMocType($mocargs, $i, $arg, $a); + die "Invalid type for slot argument ($arg)\n" unless $valid; + $i++; + } + + $meta->{slot}{$slotname} = $slot; + $slot->{index} = $slot_index; + $slot->{mocargs} = $mocargs; + $slot->{argcnt} = $argcnt; + } + @_ and $meta->{changed} = 1; +} + +1; diff --git a/PerlQt/marshall.h b/PerlQt/marshall.h new file mode 100644 index 0000000..55be867 --- /dev/null +++ b/PerlQt/marshall.h @@ -0,0 +1,44 @@ +#ifndef MARSHALL_H +#define MARSHALL_H +#include "smoke.h" + +class SmokeType; + +class Marshall { +public: + /** + * FromSV is used for virtual function return values and regular + * method arguments. + * + * ToSV is used for method return-values and virtual function + * arguments. + */ + typedef void (*HandlerFn)(Marshall *); + enum Action { FromSV, ToSV }; + virtual SmokeType type() = 0; + virtual Action action() = 0; + virtual Smoke::StackItem &item() = 0; + virtual SV* var() = 0; + virtual void unsupported() = 0; + virtual Smoke *smoke() = 0; + /** + * For return-values, next() does nothing. + * For FromSV, next() calls the method and returns. + * For ToSV, next() calls the virtual function and returns. + * + * Required to reset Marshall object to the state it was + * before being called when it returns. + */ + virtual void next() = 0; + /** + * For FromSV, cleanup() returns false when the handler should free + * any allocated memory after next(). + * + * For ToSV, cleanup() returns true when the handler should delete + * the pointer passed to it. + */ + virtual bool cleanup() = 0; + + virtual ~Marshall() {} +}; +#endif diff --git a/PerlQt/perlqt.h b/PerlQt/perlqt.h new file mode 100644 index 0000000..e4a2c33 --- /dev/null +++ b/PerlQt/perlqt.h @@ -0,0 +1,54 @@ +#ifndef PERLQT_H +#define PERLQT_H + +#include "marshall.h" + +struct smokeperl_object { + bool allocated; + Smoke *smoke; + int classId; + void *ptr; +}; + +struct TypeHandler { + const char *name; + Marshall::HandlerFn fn; +}; + +extern int do_debug; // evil +extern SV *sv_qapp; +extern int object_count; + +// keep this enum in sync with lib/Qt/debug.pm + +enum QtDebugChannel { + qtdb_none = 0x00, + qtdb_ambiguous = 0x01, + qtdb_autoload = 0x02, + qtdb_calls = 0x04, + qtdb_gc = 0x08, + qtdb_virtual = 0x10, + qtdb_verbose = 0x20 +}; + +void unmapPointer(smokeperl_object *, Smoke::Index, void*); +SV *getPointerObject(void *ptr); +void mapPointer(SV *, smokeperl_object *, HV *, Smoke::Index, void *); + + +extern struct mgvtbl vtbl_smoke; + +inline smokeperl_object *sv_obj_info(SV *sv) { // ptr on success, null on fail + if(!sv || !SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV) + return 0; + SV *obj = SvRV(sv); + MAGIC *mg = mg_find(obj, '~'); + if(!mg || mg->mg_virtual != &vtbl_smoke) { + // FIXME: die or something? + return 0; + } + smokeperl_object *o = (smokeperl_object*)mg->mg_ptr; + return o; +} + +#endif // PERLQT_H diff --git a/PerlQt/smokeperl.cpp b/PerlQt/smokeperl.cpp new file mode 100644 index 0000000..12b6700 --- /dev/null +++ b/PerlQt/smokeperl.cpp @@ -0,0 +1,426 @@ +#include "smokeperl.h" + +class SmokePerlQt : public SmokePerl { +public: + SmokePerlQt(); + virtual ~SmokePerlQt(); + + void registerSmoke(const char *name, Smoke *smoke); + Smoke *getSmoke(const char *name); + + void registerHandlers(TypeHandler *h); + + SmokeObject newObject(void *p, const SmokeClass &c); + SmokeObject wrapObject(void *p, const SmokeClass &c); + SmokeObject getObject(void *p); + SmokeObject getObject(SV *sv); + +private: + HV *_registered_smoke; + HV *_registered_handlers; + HV *_remembered_pointers; + + void rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr = 0); + void rememberPointer(SmokeObject &o); + void forgetPointer(SmokeObject &o); + SmokeObject createObject(void *p, const SmokeClass &c); + + const char *getSmokeName(Smoke *smoke) { + static const char none[] = ""; + HE *he; + + hv_iterinit(_registered_smoke); + while(he = hv_iternext(_registered_smoke)) { + SV *sv = hv_iterval(_registered_smoke, he); + if((Smoke*)SvIV(sv) == smoke) { + I32 toss; + return hv_iterkey(he, &toss); + } + } + return none; + } + + HV *package(const SmokeClass &c) { + // for now, we cheat on the class names by assuming they're all Qt:: + if(!strcmp(c.className(), "Qt")) + return gv_stashpv(c.className(), TRUE); + + SV *name = newSVpv("Qt::", 0); + sv_catpv(name, c.className() + 1); + HV *stash = gv_stashpv(SvPV_nolen(name), TRUE); + SvREFCNT_dec(name); + + return stash; + } +}; + + +Marshall::HandlerFn getMarshallFn(const SmokeType &type); + +class VirtualMethodReturnValue : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + Smoke::Stack _stack; + SmokeType _st; + SV *_retval; +public: + const Smoke::Method &method() { return _smoke->methods[_method]; } + SmokeType type() { return _st; } + Marshall::Action action() { return Marshall::FromSV; } + Smoke::StackItem &item() { return _stack[0]; } + SV *var() { return _retval; } + void unsupported() { + croak("Cannot handle '%s' as return-type of virtual method %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void next() {} + bool cleanup() { return false; } + VirtualMethodReturnValue(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *retval) : + _smoke(smoke), _method(meth), _stack(stack), _retval(retval) { + _st.set(_smoke, method().ret); + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + } +}; + +extern SV *sv_this; +extern void *_current_object; +extern Smoke::Index _current_object_class; +extern int object_count; +extern bool temporary_virtual_function_success; +extern struct mgvtbl vtbl_smoke; + +class VirtualMethodCall : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + Smoke::Stack _stack; + GV *_gv; + int _cur; + Smoke::Index *_args; + SV **_sp; + bool _called; + SV *_savethis; + +public: + SmokeType type() { return SmokeType(_smoke, _args[_cur]); } + Marshall::Action action() { return Marshall::ToSV; } + Smoke::StackItem &item() { return _stack[_cur + 1]; } + SV *var() { return _sp[_cur]; } + const Smoke::Method &method() { return _smoke->methods[_method]; } + void unsupported() { + croak("Cannot handle '%s' as argument of virtual method %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void callMethod() { + dSP; + if(_called) return; + _called = true; + SP = _sp + method().numArgs - 1; + PUTBACK; + int count = call_sv((SV*)_gv, G_SCALAR); + SPAGAIN; + VirtualMethodReturnValue r(_smoke, _method, _stack, POPs); + PUTBACK; + FREETMPS; + LEAVE; + } + void next() { + int oldcur = _cur; + _cur++; + while(!_called && _cur < method().numArgs) { + Marshall::HandlerFn fn = getMarshallFn(type()); + _sp[_cur] = sv_newmortal(); + (*fn)(this); + _cur++; + } + callMethod(); + _cur = oldcur; + } + bool cleanup() { return false; } // is this right? + VirtualMethodCall(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *obj, GV *gv) : + _smoke(smoke), _method(meth), _stack(stack), _gv(gv), _cur(-1), _sp(0), _called(false) { + dSP; + ENTER; + SAVETMPS; + PUSHMARK(SP); + EXTEND(SP, method().numArgs); + _savethis = sv_this; + sv_this = newSVsv(obj); + _sp = SP + 1; + for(int i = 0; i < method().numArgs; i++) + _sp[i] = sv_newmortal(); + _args = _smoke->argumentList + method().args; + } + ~VirtualMethodCall() { + SvREFCNT_dec(sv_this); + sv_this = _savethis; + } +}; + +class MethodReturnValue : public Marshall { + Smoke *_smoke; + Smoke::Index _method; + SV *_retval; + Smoke::Stack _stack; +public: + MethodReturnValue(Smoke *smoke, Smoke::Index method, Smoke::Stack stack, SV *retval) : + _smoke(smoke), _method(method), _retval(retval), _stack(stack) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + } + const Smoke::Method &method() { return _smoke->methods[_method]; } + SmokeType type() { return SmokeType(_smoke, method().ret); } + Marshall::Action action() { return Marshall::ToSV; } + Smoke::StackItem &item() { return _stack[0]; } + SV *var() { return _retval; } + void unsupported() { + croak("Cannot handle '%s' as return-type of %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + void next() {} + bool cleanup() { return false; } +}; + +class MethodCall : public Marshall { + int _cur; + Smoke *_smoke; + Smoke::Stack _stack; + Smoke::Index _method; + Smoke::Index *_args; + SV **_sp; + int _items; + SV *_retval; + bool _called; +public: + MethodCall(Smoke *smoke, Smoke::Index method, SV **sp, int items) : + _smoke(smoke), _method(method), _sp(sp), _items(items), _cur(-1), _called(false) { + _args = _smoke->argumentList + _smoke->methods[_method].args; + _items = _smoke->methods[_method].numArgs; + _stack = new Smoke::StackItem[items + 1]; + _retval = newSV(0); + } + ~MethodCall() { + delete[] _stack; + SvREFCNT_dec(_retval); + } + SmokeType type() { return SmokeType(_smoke, _args[_cur]); } + Marshall::Action action() { return Marshall::FromSV; } + Smoke::StackItem &item() { return _stack[_cur + 1]; } + SV *var() { + if(_cur < 0) return _retval; + SvGETMAGIC(*(_sp + _cur)); + return *(_sp + _cur); + } + inline const Smoke::Method &method() { return _smoke->methods[_method]; } + void unsupported() { + croak("Cannot handle '%s' as argument to %s::%s", + type().name(), + _smoke->className(method().classId), + _smoke->methodNames[method().name]); + } + Smoke *smoke() { return _smoke; } + inline void callMethod() { + if(_called) return; + _called = true; + Smoke::ClassFn fn = _smoke->classes[method().classId].classFn; + void *ptr = _smoke->cast( + _current_object, + _current_object_class, + method().classId + ); + _items = -1; + (*fn)(method().method, ptr, _stack); + MethodReturnValue r(_smoke, _method, _stack, _retval); + } + void next() { + int oldcur = _cur; + _cur++; + + while(!_called && _cur < _items) { + Marshall::HandlerFn fn = getMarshallFn(type()); + (*fn)(this); + _cur++; + } + + callMethod(); + _cur = oldcur; + } + bool cleanup() { return true; } +}; + +class SmokeBindingQt : public SmokeBinding { + SmokePerlQt *_smokeperl; +public: + SmokeBindingQt(Smoke *s, SmokePerlQt *smokeperl) : + SmokeBinding(s), _smokeperl(smokeperl) {} + void deleted(Smoke::Index classId, void *ptr) { + if(do_debug) printf("%p->~%s()\n", ptr, smoke->className(classId)); + object_count--; + if(do_debug) printf("Remaining objects: %d\n", object_count); + SV *obj = getPointerObject(ptr); + smokeperl_object *o = sv_obj_info(obj); + if(!o || !o->ptr) { + return; + } + unmapPointer(o, o->classId, 0); + o->ptr = 0; + } + bool callMethod(Smoke::Index method, void *ptr, Smoke::Stack args, bool isAbstract) { + SV *obj = getPointerObject(ptr); + smokeperl_object *o = sv_obj_info(obj); + if(do_debug) printf("virtual %p->%s::%s() called\n", ptr, + smoke->classes[smoke->methods[method].classId].className, + smoke->methodNames[smoke->methods[method].name] + ); + + if(!o) { + if(!PL_dirty) // if not in global destruction + warn("Cannot find object for virtual method"); + return false; + } + HV *stash = SvSTASH(SvRV(obj)); + if(*HvNAME(stash) == ' ') + stash = gv_stashpv(HvNAME(stash) + 1, TRUE); + const char *methodName = smoke->methodNames[smoke->methods[method].name]; + GV *gv = gv_fetchmethod_autoload(stash, methodName, 0); + if(!gv) return false; + + VirtualMethodCall c(smoke, method, args, obj, gv); + // exception variable, just temporary + temporary_virtual_function_success = true; + c.next(); + bool ret = temporary_virtual_function_success; + temporary_virtual_function_success = true; + return ret; + } + char *className(Smoke::Index classId) { + const char *className = smoke->className(classId); + char *buf = new char[strlen(className) + 6]; + strcpy(buf, " Qt::"); + strcat(buf, className + 1); + return buf; + } +}; + +SmokePerlQt::SmokePerlQt() { + _registered_smoke = newHV(); + _registered_handlers = newHV(); + _remembered_pointers = newHV(); +} + +SmokePerlQt::~SmokePerlQt() { + SvREFCNT_dec((SV*)_registered_smoke); + SvREFCNT_dec((SV*)_registered_handlers); + SvREFCNT_dec((SV*)_remembered_pointers); +} + +void SmokePerlQt::registerSmoke(const char *name, Smoke *smoke) { + hv_store(_registered_smoke, name, strlen(name), newSViv((IV)smoke), 0); + + // This will also need to handle the per-class initialization + smoke->binding = new SmokeBindingQt(smoke, this); +} + +Smoke *SmokePerlQt::getSmoke(const char *name) { + SV **svp = hv_fetch(_registered_smoke, name, strlen(name), 0); + if(svp && SvOK(*svp)) + return (Smoke*)SvIV(*svp); + return 0; +} + +void SmokePerlQt::registerHandlers(TypeHandler *h) { + while(h->name) { + hv_store(_registered_handlers, h->name, strlen(h->name), newSViv((IV)h->fn), 0); + h++; + } +} + +SmokeObject SmokePerlQt::createObject(void *p, const SmokeClass &c) { + HV *hv = newHV(); + SV *obj = newRV_noinc((SV*)hv); + + Smoke_MAGIC m(p, c); + sv_magic((SV*)hv, (SV*)newAV(), '~', (char*)&m, sizeof(m)); + MAGIC *mg = mg_find((SV*)hv, '~'); + mg->mg_virtual = &vtbl_smoke; + + sv_bless(obj, package(c)); + + SmokeObject o(obj, (Smoke_MAGIC*)mg->mg_ptr); + SvREFCNT_dec(obj); + + if(c.hasVirtual()) + rememberPointer(o); + + return o; +} + +SmokeObject SmokePerlQt::newObject(void *p, const SmokeClass &c) { + SmokeObject o = createObject(p, c); + + if(c.isVirtual()) + rememberPointer(o); + o.setAllocated(true); + + return o; +} + +SmokeObject SmokePerlQt::wrapObject(void *p, const SmokeClass &c) { + SmokeObject o = createObject(p, c); + return o; +} + +void SmokePerlQt::rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr) { + void *ptr = o.cast(c); + if(ptr != lastptr) { + SV *keysv = newSViv((IV)o.ptr()); + STRLEN klen; + char *key = SvPV(keysv, klen); + + if(remember) + hv_store(_remembered_pointers, key, klen, + sv_rvweaken(newSVsv(o.var())), 0); + else + hv_delete(_remembered_pointers, key, klen, G_DISCARD); + + SvREFCNT_dec(keysv); + } + for(Smoke::Index *i = c.smoke()->inheritanceList + c.c().parents; + *i; + i++) + rememberPointer(o, SmokeClass(c.smoke(), *i), remember, ptr); +} + +void SmokePerlQt::rememberPointer(SmokeObject &o) { + rememberPointer(o, o.c(), true); +} + +void SmokePerlQt::forgetPointer(SmokeObject &o) { + rememberPointer(o, o.c(), false); +} + +SmokeObject SmokePerlQt::getObject(SV *sv) { + MAGIC *mg = mg_find(SvRV(sv), '~'); + Smoke_MAGIC *m = (Smoke_MAGIC*)mg->mg_ptr; + return SmokeObject(sv, m); +} + +SmokeObject SmokePerlQt::getObject(void *p) { + SV *keysv = newSViv((IV)p); + STRLEN klen; + char *key = SvPV(keysv, klen); + SV **svp = hv_fetch(_remembered_pointers, key, klen, 0); + if(svp && SvROK(*svp)) + return getObject(sv_2mortal(newRV(SvRV(*svp)))); // paranoid copy of a weak ref + return SmokeObject(&PL_sv_undef, 0); +} + diff --git a/PerlQt/smokeperl.h b/PerlQt/smokeperl.h new file mode 100644 index 0000000..21e8298 --- /dev/null +++ b/PerlQt/smokeperl.h @@ -0,0 +1,281 @@ +#ifndef SMOKEPERL_H +#define SMOKEPERL_H + +#include "smoke.h" + +#undef DEBUG +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef __USE_POSIX +#define __USE_POSIX +#endif +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "perlqt.h" +#include "marshall.h" + +class SmokePerl; + +class SmokeType { + Smoke::Type *_t; // derived from _smoke and _id, but cached + + Smoke *_smoke; + Smoke::Index _id; +public: + SmokeType() : _t(0), _smoke(0), _id(0) {} + SmokeType(Smoke *s, Smoke::Index i) : _smoke(s), _id(i) { + if(_id < 0 || _id > _smoke->numTypes) _id = 0; + _t = _smoke->types + _id; + } + // default copy constructors are fine, this is a constant structure + + // mutators + void set(Smoke *s, Smoke::Index i) { + _smoke = s; + _id = i; + _t = _smoke->types + _id; + } + + // accessors + Smoke *smoke() const { return _smoke; } + Smoke::Index typeId() const { return _id; } + const Smoke::Type &type() const { return *_t; } + unsigned short flags() const { return _t->flags; } + unsigned short elem() const { return _t->flags & Smoke::tf_elem; } + const char *name() const { return _t->name; } + Smoke::Index classId() const { return _t->classId; } + + // tests + bool isStack() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_stack); } + bool isPtr() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_ptr); } + bool isRef() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_ref); } + bool isConst() const { return (flags() & Smoke::tf_const); } + bool isClass() const { + if(elem() == Smoke::t_class) + return classId() ? true : false; + return false; + } + + bool operator ==(const SmokeType &b) const { + const SmokeType &a = *this; + if(a.name() == b.name()) return true; + if(a.name() && b.name() && !strcmp(a.name(), b.name())) + return true; + return false; + } + bool operator !=(const SmokeType &b) const { + const SmokeType &a = *this; + return !(a == b); + } + +}; + +class SmokeClass { + Smoke::Class *_c; + Smoke *_smoke; + Smoke::Index _id; +public: + SmokeClass(const SmokeType &t) { + _smoke = t.smoke(); + _id = t.classId(); + _c = _smoke->classes + _id; + } + SmokeClass(Smoke *smoke, Smoke::Index id) : _smoke(smoke), _id(id) { + _c = _smoke->classes + _id; + } + + Smoke *smoke() const { return _smoke; } + const Smoke::Class &c() const { return *_c; } + Smoke::Index classId() const { return _id; } + const char *className() const { return _c->className; } + Smoke::ClassFn classFn() const { return _c->classFn; } + Smoke::EnumFn enumFn() const { return _c->enumFn; } + bool operator ==(const SmokeClass &b) const { + const SmokeClass &a = *this; + if(a.className() == b.className()) return true; + if(a.className() && b.className() && !strcmp(a.className(), b.className())) + return true; + return false; + } + bool operator !=(const SmokeClass &b) const { + const SmokeClass &a = *this; + return !(a == b); + } + bool isa(const SmokeClass &sc) const { + // This is a sick function, if I do say so myself + if(*this == sc) return true; + Smoke::Index *parents = _smoke->inheritanceList + _c->parents; + for(int i = 0; parents[i]; i++) { + if(SmokeClass(_smoke, parents[i]).isa(sc)) return true; + } + return false; + } + + unsigned short flags() const { return _c->flags; } + bool hasConstructor() const { return flags() & Smoke::cf_constructor; } + bool hasCopy() const { return flags() & Smoke::cf_deepcopy; } + bool hasVirtual() const { return flags() & Smoke::cf_virtual; } + bool hasFire() const { return !(flags() & Smoke::cf_undefined); } +}; + +class SmokeMethod { + Smoke::Method *_m; + Smoke *_smoke; + Smoke::Index _id; +public: + SmokeMethod(Smoke *smoke, Smoke::Index id) : _smoke(smoke), _id(id) { + _m = _smoke->methods + _id; + } + + Smoke *smoke() const { return _smoke; } + const Smoke::Method &m() const { return *_m; } + SmokeClass c() const { return SmokeClass(_smoke, _m->classId); } + const char *name() const { return _smoke->methodNames[_m->name]; } + int numArgs() const { return _m->numArgs; } + unsigned short flags() const { return _m->flags; } + SmokeType arg(int i) const { + if(i >= numArgs()) return SmokeType(); + return SmokeType(_smoke, _smoke->argumentList[_m->args + i]); + } + SmokeType ret() const { return SmokeType(_smoke, _m->ret); } + Smoke::Index methodId() const { return _id; } + Smoke::Index method() const { return _m->method; } + + bool isStatic() const { return flags() & Smoke::mf_static; } + bool isConst() const { return flags() & Smoke::mf_const; } + + void call(Smoke::Stack args, void *ptr = 0) const { + Smoke::ClassFn fn = c().classFn(); + (*fn)(method(), ptr, args); + } +}; + +class Smoke_MAGIC { // to be rewritten + SmokeClass _c; + void *_ptr; + bool _isAllocated; +public: + Smoke_MAGIC(void *p, const SmokeClass &c) : + _c(c), _ptr(p), _isAllocated(false) {} + const SmokeClass &c() const { return _c; } + void *ptr() const { return _ptr; } + bool isAllocated() const { return _isAllocated; } + void setAllocated(bool isAllocated) { _isAllocated = isAllocated; } +}; + +/** + * SmokeObject is a thin wrapper around SV* objects. Each SmokeObject instance + * increments the refcount of its SV* for the duration of its existance. + * + * SmokeObject instances are only returned from SmokePerl, since the method + * of binding data to the scalar must be consistent across all modules. + */ +class SmokeObject { + SV *sv; + Smoke_MAGIC *m; + +public: + SmokeObject(SV *obj, Smoke_MAGIC *mag) : sv(obj), m(mag) { + SvREFCNT_inc(sv); + } + ~SmokeObject() { + SvREFCNT_dec(sv); + } + SmokeObject(const SmokeObject &other) { + sv = other.sv; + m = other.m; + SvREFCNT_inc(sv); + } + SmokeObject &operator =(const SmokeObject &other) { + sv = other.sv; + m = other.m; + SvREFCNT_inc(sv); + return *this; + } + + const SmokeClass &c() { return m->c(); } + Smoke *smoke() { return c().smoke(); } + SV *var() { return sv; } + void *ptr() { return m->ptr(); } + Smoke::Index classId() { return c().classId(); } + void *cast(const SmokeClass &toc) { + return smoke()->cast( + ptr(), + classId(), + smoke()->idClass(toc.className()) + ); + } + const char *className() { return c().className(); } + + bool isValid() const { return SvOK(sv) ? true : false; } + bool isAllocated() const { return m->isAllocated(); } + void setAllocated(bool i) { m->setAllocated(i); } +}; + +/** + * Since it's not easy to share functions between Perl modules, the common + * interface between all Smoked libraries and Perl will be defined in this + * class. There will be only one SmokePerl instance loaded for an entire Perl + * process. It has no data members here -- this is only an abstract interface. + */ + +class SmokePerl { + void *future_extension; +public: + SmokePerl() : future_extension(0) {} + + // don't need this, we're only defining an interface + virtual ~SmokePerl() = 0; + + /** + * Registers a Smoke object + */ + virtual void registerSmoke(const char *name, Smoke *smoke) = 0; + + /** + * Gets a smoke object from its name + */ + virtual Smoke *getSmoke(const char *name) = 0; + + /** + * Determines if the named smoke is registered. + */ + bool isSmokeRegistered(const char *name) { return getSmoke(name) ? true : false; } + + virtual void registerHandlers(TypeHandler *handlers) = 0; + + /** + * Returns a new blessed SV referring to the pointer passed. + * Use sv_2mortal() before passing it around. + * + * @param p pointer to the C++ object. The pointer isn't automatically deleted by SmokePerl. + * @param c class of the pointer + * @see #getObject + * @see #deleteObject + */ + virtual SmokeObject newObject(void *p, const SmokeClass &c) = 0; + + /** + * Same as newObject(), except it doesn't treat p as owned by Perl + */ + virtual SmokeObject wrapObject(void *p, const SmokeClass &c) = 0; + + /** + * Any SV* created with newObject() on a class with virtual methods can be + * retrieved again. + */ + virtual SmokeObject getObject(void *p) = 0; + + /** + * Create a SmokeObject from the given SV + */ + virtual SmokeObject getObject(SV *sv) = 0; +}; + +#endif // SMOKEPERL_H diff --git a/PerlQt/t/Foo/SubCodec.pm b/PerlQt/t/Foo/SubCodec.pm new file mode 100644 index 0000000..15ce08a --- /dev/null +++ b/PerlQt/t/Foo/SubCodec.pm @@ -0,0 +1,14 @@ +package Foo::SubCodec; +use Qt; +use My::Codec; +use Qt::isa qw( My::Codec ); + + +sub NEW +{ + shift->SUPER::NEW(@_); +} + +sub foo {} + +1; diff --git a/PerlQt/t/My/Codec.pm b/PerlQt/t/My/Codec.pm new file mode 100644 index 0000000..93e1d01 --- /dev/null +++ b/PerlQt/t/My/Codec.pm @@ -0,0 +1,10 @@ +package My::Codec; +use Qt; +use Qt::isa qw( Qt::TextCodec ); + +sub NEW +{ + shift->SUPER::NEW(@_); +} + +1;
\ No newline at end of file diff --git a/PerlQt/t/My/SubCodec.pm b/PerlQt/t/My/SubCodec.pm new file mode 100644 index 0000000..58f8987 --- /dev/null +++ b/PerlQt/t/My/SubCodec.pm @@ -0,0 +1,15 @@ + +package My::SubCodec; +use Qt; +use My::Codec; +use Qt::isa qw( My::Codec ); + + +sub NEW +{ + shift->SUPER::NEW(@_); +} + +sub bar {} + +1;
\ No newline at end of file diff --git a/PerlQt/t/a_loading.t b/PerlQt/t/a_loading.t new file mode 100644 index 0000000..4a9f4a1 --- /dev/null +++ b/PerlQt/t/a_loading.t @@ -0,0 +1,6 @@ + +BEGIN { print "1..1\n" } + +use Qt; + +print "ok 1\n" diff --git a/PerlQt/t/b_nogui.t b/PerlQt/t/b_nogui.t new file mode 100644 index 0000000..23bdd72 --- /dev/null +++ b/PerlQt/t/b_nogui.t @@ -0,0 +1,48 @@ + +BEGIN { print "1..6\n" } + +use Qt; +use Qt::constants; + +eval {my $c = Qt::TextCodec::codecForLocale()}; + +print +$@ ? "not ok\n" : "ok 1\n"; + +eval {my $s = Qt::Variant( Qt::DateTime::currentDateTime() ) }; + +print +$@ ? "not ok\n" : "ok 2\n"; + +my $ret; +eval {$ret = Qt::Point(20,20); $ret += Qt::Point(10,10); $ret *= 2 ; $ret /= 3 }; + +print +$@ ? "not ok\n" : "ok 3\n"; + +eval { $ret = ($ret->x != 20 or $ret->y != 20) ? 1 : 0 }; + +print +($@ || $ret) ? "not ok\n" : "ok 4\n"; + +eval { my $z = Qt::GlobalSpace::qVersion() }; + +if( $@ ) +{ + print "ok 5 # skip Smoke version too old\n"; + print "ok 6 # skip Smoke version too old\n"; +} +else +{ + eval{ my $p = Qt::Point( 20, 20 ); + my $p2 = Qt::Point( 30, 30 ); + $p = $p + $p2 + $p; + $p2 = $p * 2; + $p2 = -$p2; + $ret = ($p2->x != -140 or $p2->y != -140) ? 1 : 0 + }; + print +($@ || $ret) ? "not ok\n" : "ok 5\n"; + + eval { + $str = "Fooooooooooo"; + $ts = Qt::TextStream( $str, IO_WriteOnly ); + $ts << "pi = " << 3.14; + }; + print +($str eq "pi = 3.14ooo") ? "ok 6\n":"not ok\n"; +} diff --git a/PerlQt/t/c_qapp.t b/PerlQt/t/c_qapp.t new file mode 100644 index 0000000..ee28266 --- /dev/null +++ b/PerlQt/t/c_qapp.t @@ -0,0 +1,23 @@ +BEGIN { print "1..3\n" } + +use Qt; + +$a=0; + +# testing if the Qt::Application ctor works + +eval { $a=Qt::Application(\@ARGV) }; + +print +$@ ? "not ok\n" : "ok 1\n"; + +# testing wether the global object is properly setup + +eval { Qt::app()->libraryPaths() }; + +print +$@ ? "not ok\n" : "ok 2\n"; + +# one second test of the event loop + +Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" ); + +print Qt::app()->exec ? "not ok\n" : "ok 3\n"; diff --git a/PerlQt/t/ca_i18n.t b/PerlQt/t/ca_i18n.t new file mode 100644 index 0000000..fddbff7 --- /dev/null +++ b/PerlQt/t/ca_i18n.t @@ -0,0 +1,23 @@ +BEGIN { print "1..1\n" } + +use Qt; + +$a = Qt::Application(); +$pb=Qt::PushButton("Foooo", undef); + +{ + use bytes; + $pb->setText( "élégant" ); + + $b = $pb->text(); + $b2 = Qt::Widget::tr("élégant"); +} + + +$c = $pb->text(); +$c2= Qt::Widget::tr("élégant"); + +{ + use bytes; + print +($b ne $c and $b2 ne $c2) ? "ok 1\n":"not ok\n"; +} diff --git a/PerlQt/t/d_sigslot.t b/PerlQt/t/d_sigslot.t new file mode 100644 index 0000000..1b455e1 --- /dev/null +++ b/PerlQt/t/d_sigslot.t @@ -0,0 +1,49 @@ +BEGIN { print "1..3\n" } + +package MyApp; +use Qt; +use Qt::isa qw(Qt::Application); +use Qt::slots + foo => ['int'], + baz => []; +use Qt::signals + bar => ['int']; + +sub NEW { + shift->SUPER::NEW(@_); + + # 1) testing correct subclassing of Qt::Application and this pointer + print +(ref(this) eq " MyApp")? "ok 1\n" : "not ok\n"; + + this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)'); + + # 3) automatic quitting will test Qt sig to custom slot + this->connect(this, SIGNAL 'aboutToQuit()', SLOT 'baz()'); + + # 2) testing custom sig to custom slot + emit bar(3); +} + +sub foo +{ + print +($_[0] == 3) ? "ok 2\n" : "not ok\n"; +} + +sub baz +{ + print "ok 3\n"; +} + +1; + +package main; + +use Qt; +use MyApp; + +$a = 0; +$a = MyApp(\@ARGV); + +Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" ); + +exit Qt::app()->exec; diff --git a/PerlQt/t/e_sigslot_inherit.t b/PerlQt/t/e_sigslot_inherit.t new file mode 100644 index 0000000..aa3bd76 --- /dev/null +++ b/PerlQt/t/e_sigslot_inherit.t @@ -0,0 +1,72 @@ +BEGIN { print "1..6\n" } + +package MyApp; +use Qt; +use Qt::isa('Qt::Application'); +use Qt::slots + foo => ['int'], + baz => []; +use Qt::signals + bar => ['int']; + +sub NEW +{ + shift->SUPER::NEW(@_); + this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)'); + this->connect(this, SIGNAL 'aboutToQuit()', SLOT 'baz()'); +} + +sub foo +{ + # 1) testing correct inheritance of sig/slots + print +($_[0] == 3) ? "ok 1\n" : "not ok\n"; +} + +sub baz +{ + print "ok 3\n"; +} + +sub coincoin +{ + print +(@_ == 2) ? "ok 5\n":"not ok\n"; + print +(ref(this) eq " MySubApp") ? "ok 6\n":"not ok\n"; +} + +1; + +package MySubApp; +use Qt; +use Qt::isa('MyApp'); + + +sub NEW +{ + shift->SUPER::NEW(@_); + emit foo(3); +} + +sub baz +{ + # 2) testing further inheritance of sig/slots + print "ok 2\n"; + # 3) testing Perl to Perl SUPER + SUPER->baz(); + # 4) 5) 6) testing non-qualified enum calls vs. Perl method/static calls + eval { &blue }; print !$@ ? "ok 4\n":"not ok\n"; + coincoin("a","b"); +} + +1; + +package main; + +use Qt; +use MySubApp; + +$a = 0; +$a = MySubApp(\@ARGV); + +Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" ); + +exit Qt::app()->exec; diff --git a/PerlQt/t/f_import.t b/PerlQt/t/f_import.t new file mode 100644 index 0000000..c6467a3 --- /dev/null +++ b/PerlQt/t/f_import.t @@ -0,0 +1,19 @@ +BEGIN { push @INC, "./t" ; print "1..1\n" } + +package main; + +use Qt; +use My::SubCodec; +use Foo::SubCodec; + +$tc1 = My::SubCodec(); +$tc2 = Foo::SubCodec(); + +$tc1->bar(); +$tc2->foo(); + +$tc2->deleteAllCodecs; + +# all imports OK + +print "ok 1\n"; diff --git a/PerlQt/t/g_gui.t b/PerlQt/t/g_gui.t new file mode 100644 index 0000000..b47c0c0 --- /dev/null +++ b/PerlQt/t/g_gui.t @@ -0,0 +1,127 @@ + +BEGIN { print "1..1\n" } + +package ButtonsGroups; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + slotChangeGrp3State => []; +use Qt::attributes qw( + state + rb21 + rb22 + rb23 +); + +# +# Constructor +# +# Creates all child widgets of the ButtonGroups window +# + +sub NEW { + shift->SUPER::NEW(@_); + + # Create Widgets which allow easy layouting + my $vbox = Qt::VBoxLayout(this); + my $box1 = Qt::HBoxLayout($vbox); + my $box2 = Qt::HBoxLayout($vbox); + + # ------- first group + + # Create an exclusive button group + my $bgrp1 = Qt::ButtonGroup(1, &Horizontal, "Button Group &1 (exclusive)", this); + $box1->addWidget($bgrp1); + $bgrp1->setExclusive(1); + + # insert 3 radiobuttons + Qt::RadioButton("R&adiobutton 2", $bgrp1); + Qt::RadioButton("Ra&diobutton 3", $bgrp1); + + # ------- second group + + # Create a non-exclusive buttongroup + my $bgrp2 = Qt::ButtonGroup(1, &Horizontal, "Button Group &2 (non-exclusive)", this); + $box1->addWidget($bgrp2); + $bgrp2->setExclusive(0); + + # insert 3 checkboxes + Qt::CheckBox("&Checkbox 1", $bgrp2); + my $cb12 = Qt::CheckBox("C&heckbox 2", $bgrp2); + $cb12->setChecked(1); + my $cb13 = Qt::CheckBox("Triple &State Button", $bgrp2); + $cb13->setTristate(1); + $cb13->setChecked(1); + + # ----------- third group + + # create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons + my $bgrp3 = Qt::ButtonGroup(1, &Horizontal, "Button Group &3 (Radiobutton-exclusive)", this); + $box2->addWidget($bgrp3); + $bgrp3->setRadioButtonExclusive(1); + + # insert three radiobuttons + rb21 = Qt::RadioButton("Rad&iobutton 1", $bgrp3); + rb22 = Qt::RadioButton("Radi&obutton 2", $bgrp3); + rb23 = Qt::RadioButton("Radio&button 3", $bgrp3); + rb23->setChecked(1); + + # insert a checkbox + state = Qt::CheckBox("E&nable Radiobuttons", $bgrp3); + state->setChecked(1); + # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() + this->connect(state, SIGNAL('clicked()'), SLOT('slotChangeGrp3State()')); + + # ----------- fourth group + + # create a groupbox which layouts its childs in a columns + my $bgrp4 = Qt::ButtonGroup(1, &Horizontal, "Groupbox with &normal buttons", this); + $box2->addWidget($bgrp4); + + # insert three pushbuttons... + Qt::PushButton("&Push Button", $bgrp4); + my $tb2 = Qt::PushButton("&Toggle Button", $bgrp4); + my $tb3 = Qt::PushButton("&Flat Button", $bgrp4); + + # ... and make the second one a toggle button + $tb2->setToggleButton(1); + $tb2->setOn(1); + + # ... and make the third one a flat button + $tb3->setFlat(1); +} + +# +# SLOT slotChangeGrp3State() +# +# enables/disables the radiobuttons of the third buttongroup +# + +sub slotChangeGrp3State { + rb21->setEnabled(state->isChecked); + rb22->setEnabled(state->isChecked); + rb23->setEnabled(state->isChecked); +} + +1; + +package main; + +use Qt; +use ButtonsGroups; + +Qt::StyleFactory::keys(); # disable style plugins (hacky) + +my $a = Qt::Application(\@ARGV); + +my $buttonsgroups = ButtonsGroups; +$buttonsgroups->resize(500, 250); +$buttonsgroups->setCaption("PerlQt Test - Please wait"); +$a->setMainWidget($buttonsgroups); +$buttonsgroups->show; + +Qt::Timer::singleShot( 2000, Qt::app(), SLOT "quit()" ); +my $r = $a->exec; +print +$r?"not ok\n" : "ok 1\n"; +exit $r; diff --git a/PerlQt/tutorials/runall.pl b/PerlQt/tutorials/runall.pl new file mode 100644 index 0000000..d0363f1 --- /dev/null +++ b/PerlQt/tutorials/runall.pl @@ -0,0 +1,8 @@ +#!/usr/bin/perl -w +# Use the tutorials as a test suite +@tutorials = (sort(glob("t?")), sort(glob("t??"))); +for $tutorial (@tutorials) { + chdir($tutorial) || next; + system("$^X -w $tutorial.pl"); + chdir(".."); +} diff --git a/PerlQt/tutorials/t1/t1.pl b/PerlQt/tutorials/t1/t1.pl new file mode 100644 index 0000000..a1e2cd8 --- /dev/null +++ b/PerlQt/tutorials/t1/t1.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w +use strict; +use blib; +use Qt; + +my $a = Qt::Application(\@ARGV); + +my $hello = Qt::PushButton("Hello World!", undef); +$hello->resize(100, 30); + +$a->setMainWidget($hello); +$hello->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t10/CannonField.pm b/PerlQt/tutorials/t10/CannonField.pm new file mode 100644 index 0000000..27bfcee --- /dev/null +++ b/PerlQt/tutorials/t10/CannonField.pm @@ -0,0 +1,76 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + angleChanged => ['int'], + forceChanged => ['int']; +use Qt::slots + setAngle => ['int'], + setForce => ['int']; +use Qt::attributes qw( + ang + f +); +use POSIX qw(atan); + +sub angle () { ang } +sub force () { f } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + f = 0; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(cannonRect(), 0); + emit angleChanged(ang); +} + +sub setForce { + my $newton = shift; + $newton = 0 if $newton < 0; + return if f == $newton; + f = $newton; + emit forceChanged(f); +} + +sub paintEvent { + my $e = shift; + return unless $e->rect->intersects(cannonRect()); + my $cr = cannonRect(); + my $pix = Qt::Pixmap($cr->size); + $pix->fill(this, $cr->topLeft); + + my $p = Qt::Painter($pix); + $p->setBrush(&blue); + $p->setPen(&NoPen); + $p->translate(0, $pix->height - 1); + $p->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $p->rotate(- ang); + $p->drawRect(Qt::Rect(33, -4, 15, 8)); + $p->end; + + $p->begin(this); + $p->drawPixmap($cr->topLeft, $pix); +} + +sub cannonRect { + my $r = Qt::Rect(0, 0, 50, 50); + $r->moveBottomLeft(rect()->bottomLeft); + return $r; +} + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t10/LCDRange.pm b/PerlQt/tutorials/t10/LCDRange.pm new file mode 100644 index 0000000..be0f8ec --- /dev/null +++ b/PerlQt/tutorials/t10/LCDRange.pm @@ -0,0 +1,43 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider +); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); +} + +sub value { slider->value } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +1; diff --git a/PerlQt/tutorials/t10/t10.pl b/PerlQt/tutorials/t10/t10.pl new file mode 100644 index 0000000..d9b825e --- /dev/null +++ b/PerlQt/tutorials/t10/t10.pl @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange(this, "angle"); + $angle->setRange(5, 70); + + my $force = LCDRange(this, "force"); + $force->setRange(10, 50); + + my $cannonField = CannonField(this, "cannonField"); + + $cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + $cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); + $force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($cannonField, 1, 1); + $grid->setColStretch(1, 10); + + my $leftBox = Qt::VBoxLayout; + $grid->addLayout($leftBox, 1, 0); + $leftBox->addWidget($angle); + $leftBox->addWidget($force); + + $angle->setValue(60); + $force->setValue(25); + $angle->setFocus(); +} + +package main; +use Qt; +use MyWidget; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 500, 355); +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t11/CannonField.pm b/PerlQt/tutorials/t11/CannonField.pm new file mode 100644 index 0000000..7ddfb24 --- /dev/null +++ b/PerlQt/tutorials/t11/CannonField.pm @@ -0,0 +1,146 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + angleChanged => ['int'], + forceChanged => ['int']; +use Qt::slots + setAngle => ['int'], + setForce => ['int'], + shoot => [], + moveShot => []; +use Qt::attributes qw( + ang + f + + timerCount + autoShootTimer + shoot_ang + shoot_f +); +use POSIX qw(atan); + +sub angle () { ang } +sub force () { f } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + f = 0; + timerCount = 0; + autoShootTimer = Qt::Timer(this, "movement handler"); + this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()')); + shoot_ang = 0; + shoot_f = 0; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(cannonRect(), 0); + emit angleChanged(ang); +} + +sub setForce { + my $newton = shift; + $newton = 0 if $newton < 0; + return if f == $newton; + f = $newton; + emit forceChanged(f); +} + +sub shoot { + return if autoShootTimer->isActive; + timerCount = 0; + shoot_ang = ang; + shoot_f = f; + autoShootTimer->start(50); +} + +sub moveShot { + my $r = Qt::Region(shotRect()); + timerCount++; + + my $shotR = shotRect(); + + if($shotR->x > width() || $shotR->y > height()) { + autoShootTimer->stop; + } else { + $r = $r->unite(Qt::Region($shotR)); + } + repaint($r); +} + +sub paintEvent { + my $e = shift; + my $updateR = $e->rect; + my $p = Qt::Painter(this); + + paintCannon($p) if $updateR->intersects(cannonRect()); + paintShot($p) if autoShootTimer->isActive and $updateR->intersects(shotRect()); +} + +sub paintShot { + my $p = shift; + $p->setBrush(&black); + $p->setPen(&NoPen); + $p->drawRect(shotRect()); +} + +my $barrelRect = Qt::Rect(33, -4, 15, 8); + +sub paintCannon { + my $p = shift; + my $cr = cannonRect(); + my $pix = Qt::Pixmap($cr->size); + $pix->fill(this, $cr->topLeft); + + my $tmp = Qt::Painter($pix); + $tmp->setBrush(&blue); + $tmp->setPen(&NoPen); + + $tmp->translate(0, $pix->height - 1); + $tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $tmp->rotate(- ang); + $tmp->drawRect($barrelRect); + $tmp->end; + + $p->drawPixmap($cr->topLeft, $pix); +} + +sub cannonRect { + my $r = Qt::Rect(0, 0, 50, 50); + $r->moveBottomLeft(rect()->bottomLeft); + return $r; +} + +sub shotRect { + my $gravity = 4; + + my $time = timerCount / 4.0; + my $velocity = shoot_f; + my $radians = shoot_ang*3.14159265/180; + + my $velx = $velocity*cos($radians); + my $vely = $velocity*sin($radians); + my $x0 = ($barrelRect->right + 5)*cos($radians); + my $y0 = ($barrelRect->right + 5)*sin($radians); + my $x = $x0 + $velx*$time; + my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2; + + my $r = Qt::Rect(0, 0, 6, 6); + $r->moveCenter(Qt::Point(int($x), height() - 1 - int($y))); + return $r; +} + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t11/LCDRange.pm b/PerlQt/tutorials/t11/LCDRange.pm new file mode 100644 index 0000000..be0f8ec --- /dev/null +++ b/PerlQt/tutorials/t11/LCDRange.pm @@ -0,0 +1,43 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider +); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); +} + +sub value { slider->value } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +1; diff --git a/PerlQt/tutorials/t11/t11.pl b/PerlQt/tutorials/t11/t11.pl new file mode 100644 index 0000000..84d762d --- /dev/null +++ b/PerlQt/tutorials/t11/t11.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange(this, "angle"); + $angle->setRange(5, 70); + + my $force = LCDRange(this, "force"); + $force->setRange(10, 50); + + my $cannonField = CannonField(this, "cannonField"); + + $cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + $cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); + $force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + + my $shoot = Qt::PushButton('&Shoot', this, "shoot"); + $shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + $cannonField->connect($shoot, SIGNAL('clicked()'), SLOT('shoot()')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($cannonField, 1, 1); + $grid->setColStretch(1, 10); + + my $leftBox = Qt::VBoxLayout; + $grid->addLayout($leftBox, 1, 0); + $leftBox->addWidget($angle); + $leftBox->addWidget($force); + + my $topBox = Qt::HBoxLayout; + $grid->addLayout($topBox, 0, 1); + $topBox->addWidget($shoot); + $topBox->addStretch(1); + + $angle->setValue(60); + $force->setValue(25); + $angle->setFocus(); +} + +package main; +use Qt; +use MyWidget; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 500, 355); +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t12/CannonField.pm b/PerlQt/tutorials/t12/CannonField.pm new file mode 100644 index 0000000..df4eb96 --- /dev/null +++ b/PerlQt/tutorials/t12/CannonField.pm @@ -0,0 +1,177 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + hit => [], + missed => [], + angleChanged => ['int'], + forceChanged => ['int']; +use Qt::slots + setAngle => ['int'], + setForce => ['int'], + shoot => [], + moveShot => []; +use Qt::attributes qw( + ang + f + + timerCount + autoShootTimer + shoot_ang + shoot_f + + target +); +use POSIX qw(atan); + +sub angle () { ang } +sub force () { f } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + f = 0; + timerCount = 0; + autoShootTimer = Qt::Timer(this, "movement handler"); + this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()')); + shoot_ang = 0; + shoot_f = 0; + target = Qt::Point(0, 0); + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); + newTarget(); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(cannonRect(), 0); + emit angleChanged(ang); +} + +sub setForce { + my $newton = shift; + $newton = 0 if $newton < 0; + return if f == $newton; + f = $newton; + emit forceChanged(f); +} + +sub shoot { + return if autoShootTimer->isActive; + timerCount = 0; + shoot_ang = ang; + shoot_f = f; + autoShootTimer->start(50); +} + +sub newTarget { + my $r = Qt::Region(targetRect()); + target = Qt::Point(200 + int(rand(190)), + 10 + int(rand(255))); + repaint($r->unite(Qt::Region(targetRect()))); +} + +sub moveShot { + my $r = Qt::Region(shotRect()); + timerCount++; + + my $shotR = shotRect(); + + if($shotR->intersects(targetRect())) { + autoShootTimer->stop; + emit hit(); + } elsif($shotR->x > width() || $shotR->y > height()) { + autoShootTimer->stop; + emit missed(); + } else { + $r = $r->unite(Qt::Region($shotR)); + } + repaint($r); +} + +sub paintEvent { + my $e = shift; + my $updateR = $e->rect; + my $p = Qt::Painter(this); + + paintCannon($p) if $updateR->intersects(cannonRect()); + paintShot($p) if autoShootTimer->isActive and $updateR->intersects(shotRect()); + paintTarget($p) if $updateR->intersects(targetRect()); +} + +sub paintShot { + my $p = shift; + $p->setBrush(&black); + $p->setPen(&NoPen); + $p->drawRect(shotRect()); +} + +sub paintTarget { + my $p = shift; + $p->setBrush(&red); + $p->setPen(&black); + $p->drawRect(targetRect()); +} + +my $barrelRect = Qt::Rect(33, -4, 15, 8); + +sub paintCannon { + my $p = shift; + my $cr = cannonRect(); + my $pix = Qt::Pixmap($cr->size); + $pix->fill(this, $cr->topLeft); + + my $tmp = Qt::Painter($pix); + $tmp->setBrush(&blue); + $tmp->setPen(&NoPen); + + $tmp->translate(0, $pix->height - 1); + $tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $tmp->rotate(- ang); + $tmp->drawRect($barrelRect); + $tmp->end; + + $p->drawPixmap($cr->topLeft, $pix); +} + +sub cannonRect { + my $r = Qt::Rect(0, 0, 50, 50); + $r->moveBottomLeft(rect()->bottomLeft); + return $r; +} + +sub shotRect { + my $gravity = 4; + + my $time = timerCount / 4.0; + my $velocity = shoot_f; + my $radians = shoot_ang*3.14159265/180; + + my $velx = $velocity*cos($radians); + my $vely = $velocity*sin($radians); + my $x0 = ($barrelRect->right + 5)*cos($radians); + my $y0 = ($barrelRect->right + 5)*sin($radians); + my $x = $x0 + $velx*$time; + my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2; + + my $r = Qt::Rect(0, 0, 6, 6); + $r->moveCenter(Qt::Point(int($x), height() - 1 - int($y))); + return $r; +} + +sub targetRect { + my $r = Qt::Rect(0, 0, 20, 10); + $r->moveCenter(Qt::Point(target->x, height() - 1 - target->y)); + return $r; +} + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t12/LCDRange.pm b/PerlQt/tutorials/t12/LCDRange.pm new file mode 100644 index 0000000..3562fee --- /dev/null +++ b/PerlQt/tutorials/t12/LCDRange.pm @@ -0,0 +1,62 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int'], + setText => ['const char*']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider + label +); + +sub NEW { + my $class = shift; + my $s; + $s = shift if $_[0] and not ref $_[0]; + $class->SUPER::NEW(@_); + + init(); + setText($s) if $s; +} + + +sub init { + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + + label = Qt::Label(" ", this, "label"); + label->setAlignment(&AlignCenter); + + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); +} + +sub value { slider->value } + +sub text { label->text } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +sub setText { label->setText(shift) } + +1; diff --git a/PerlQt/tutorials/t12/t12.pl b/PerlQt/tutorials/t12/t12.pl new file mode 100644 index 0000000..87c50be --- /dev/null +++ b/PerlQt/tutorials/t12/t12.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange("ANGLE", this, "angle"); + $angle->setRange(5, 70); + + my $force = LCDRange("FORCE", this, "force"); + $force->setRange(10, 50); + + my $cannonField = CannonField(this, "cannonField"); + + $cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + $cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); + $force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + + my $shoot = Qt::PushButton('&Shoot', this, "shoot"); + $shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + $cannonField->connect($shoot, SIGNAL('clicked()'), SLOT('shoot()')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($cannonField, 1, 1); + $grid->setColStretch(1, 10); + + my $leftBox = Qt::VBoxLayout; + $grid->addLayout($leftBox, 1, 0); + $leftBox->addWidget($angle); + $leftBox->addWidget($force); + + my $topBox = Qt::HBoxLayout; + $grid->addLayout($topBox, 0, 1); + $topBox->addWidget($shoot); + $topBox->addStretch(1); + + $angle->setValue(60); + $force->setValue(25); + $angle->setFocus(); +} + +package main; +use Qt; +use MyWidget; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 500, 355); +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t13/CannonField.pm b/PerlQt/tutorials/t13/CannonField.pm new file mode 100644 index 0000000..a1475e5 --- /dev/null +++ b/PerlQt/tutorials/t13/CannonField.pm @@ -0,0 +1,207 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + hit => [], + missed => [], + angleChanged => ['int'], + forceChanged => ['int'], + canShoot => ['bool']; +use Qt::slots + setAngle => ['int'], + setForce => ['int'], + shoot => [], + moveShot => [], + newTarget => []; +use Qt::attributes qw( + ang + f + + timerCount + autoShootTimer + shoot_ang + shoot_f + + target + + gameEnded +); +use POSIX qw(atan); + +sub angle () { ang } +sub force () { f } +sub gameOver () { gameEnded } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + f = 0; + timerCount = 0; + autoShootTimer = Qt::Timer(this, "movement handler"); + this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()')); + shoot_ang = 0; + shoot_f = 0; + target = Qt::Point(0, 0); + gameEnded = 0; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); + newTarget(); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(cannonRect(), 0); + emit angleChanged(ang); +} + +sub setForce { + my $newton = shift; + $newton = 0 if $newton < 0; + return if f == $newton; + f = $newton; + emit forceChanged(f); +} + +sub shoot { + return if isShooting(); + timerCount = 0; + shoot_ang = ang; + shoot_f = f; + autoShootTimer->start(50); + emit canShoot(0); +} + +sub newTarget { + my $r = Qt::Region(targetRect()); + target = Qt::Point(200 + int(rand(190)), + 10 + int(rand(255))); + repaint($r->unite(Qt::Region(targetRect()))); +} + +sub setGameOver { + return if gameEnded; + autoShootTimer->stop if isShooting(); + gameEnded = 1; + repaint(); +} + +sub restartGame { + autoShootTimer->stop if isShooting(); + gameEnded = 0; + repaint(); + emit canShoot(1); +} + +sub moveShot { + my $r = Qt::Region(shotRect()); + timerCount++; + + my $shotR = shotRect(); + + if($shotR->intersects(targetRect())) { + autoShootTimer->stop; + emit hit(); + emit canShoot(1); + } elsif($shotR->x > width() || $shotR->y > height()) { + autoShootTimer->stop; + emit missed(); + emit canShoot(1); + } else { + $r = $r->unite(Qt::Region($shotR)); + } + repaint($r); +} + +sub paintEvent { + my $e = shift; + my $updateR = $e->rect; + my $p = Qt::Painter(this); + + if(gameEnded) { + $p->setPen(&black); + $p->setFont(Qt::Font("Courier", 48, &Qt::Font::Bold)); + $p->drawText(rect(), &AlignCenter, "Game Over"); + } + paintCannon($p) if $updateR->intersects(cannonRect()); + paintShot($p) if isShooting() and $updateR->intersects(shotRect()); + paintTarget($p) if !gameEnded and $updateR->intersects(targetRect()); +} + +sub paintShot { + my $p = shift; + $p->setBrush(&black); + $p->setPen(&NoPen); + $p->drawRect(shotRect()); +} + +sub paintTarget { + my $p = shift; + $p->setBrush(&red); + $p->setPen(&black); + $p->drawRect(targetRect()); +} + +my $barrelRect = Qt::Rect(33, -4, 15, 8); + +sub paintCannon { + my $p = shift; + my $cr = cannonRect(); + my $pix = Qt::Pixmap($cr->size); + $pix->fill(this, $cr->topLeft); + + my $tmp = Qt::Painter($pix); + $tmp->setBrush(&blue); + $tmp->setPen(&NoPen); + + $tmp->translate(0, $pix->height - 1); + $tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $tmp->rotate(- ang); + $tmp->drawRect($barrelRect); + $tmp->end; + + $p->drawPixmap($cr->topLeft, $pix); +} + +sub cannonRect { + my $r = Qt::Rect(0, 0, 50, 50); + $r->moveBottomLeft(rect()->bottomLeft); + return $r; +} + +sub shotRect { + my $gravity = 4; + + my $time = timerCount / 4.0; + my $velocity = shoot_f; + my $radians = shoot_ang*3.14159265/180; + + my $velx = $velocity*cos($radians); + my $vely = $velocity*sin($radians); + my $x0 = ($barrelRect->right + 5)*cos($radians); + my $y0 = ($barrelRect->right + 5)*sin($radians); + my $x = $x0 + $velx*$time; + my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2; + + my $r = Qt::Rect(0, 0, 6, 6); + $r->moveCenter(Qt::Point(int($x), height() - 1 - int($y))); + return $r; +} + +sub targetRect { + my $r = Qt::Rect(0, 0, 20, 10); + $r->moveCenter(Qt::Point(target->x, height() - 1 - target->y)); + return $r; +} + +sub isShooting { autoShootTimer->isActive } + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t13/GameBoard.pm b/PerlQt/tutorials/t13/GameBoard.pm new file mode 100644 index 0000000..1c4ab71 --- /dev/null +++ b/PerlQt/tutorials/t13/GameBoard.pm @@ -0,0 +1,114 @@ +package GameBoard; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + fire => [], + hit => [], + missed => [], + newGame => []; +use Qt::attributes qw( + hits + shotsLeft + cannonField +); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange("ANGLE", this, "angle"); + $angle->setRange(5, 70); + + my $force = LCDRange("FORCE", this, "force"); + $force->setRange(10, 50); + + cannonField = CannonField(this, "cannonField"); + + cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect(cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); + $force->connect(cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + + this->connect(cannonField, SIGNAL('hit()'), SLOT('hit()')); + this->connect(cannonField, SIGNAL('missed()'), SLOT('missed()')); + + my $shoot = Qt::PushButton('&Shoot', this, "shoot"); + $shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + this->connect($shoot, SIGNAL('clicked()'), SLOT('fire()')); + + $shoot->connect(cannonField, SIGNAL('canShoot(bool)'), SLOT('setEnabled(bool)')); + + my $restart = Qt::PushButton('&New Game', this, "newgame"); + $restart->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + this->connect($restart, SIGNAL('clicked()'), SLOT('newGame()')); + + hits = Qt::LCDNumber(2, this, "hits"); + shotsLeft = Qt::LCDNumber(2, this, "shotsleft"); + my $hitsL = Qt::Label("HITS", this, "hitsLabel"); + my $shotsLeftL = Qt::Label("SHOTS LEFT", this, "shotsLeftLabel"); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget(cannonField, 1, 1); + $grid->setColStretch(1, 10); + + my $leftBox = Qt::VBoxLayout; + $grid->addLayout($leftBox, 1, 0); + $leftBox->addWidget($angle); + $leftBox->addWidget($force); + + my $topBox = Qt::HBoxLayout; + $grid->addLayout($topBox, 0, 1); + $topBox->addWidget($shoot); + $topBox->addWidget(hits); + $topBox->addWidget($hitsL); + $topBox->addWidget(shotsLeft); + $topBox->addWidget($shotsLeftL); + $topBox->addStretch(1); + $topBox->addWidget($restart); + + $angle->setValue(60); + $force->setValue(25); + $angle->setFocus(); + + newGame(); +} + +sub fire { + return if cannonField->gameOver or cannonField->isShooting; + shotsLeft->display(int(shotsLeft->intValue - 1)); + cannonField->shoot; +} + +sub hit { + hits->display(int(hits->intValue + 1)); + if(shotsLeft->intValue == 0) { + cannonField->setGameOver; + } else { + cannonField->newTarget; + } +} + +sub missed { + cannonField->setGameOver if shotsLeft->intValue == 0; +} + +sub newGame { + shotsLeft->display(int(15)); + hits->display(0); + cannonField->restartGame; + cannonField->newTarget; +} + +1; diff --git a/PerlQt/tutorials/t13/LCDRange.pm b/PerlQt/tutorials/t13/LCDRange.pm new file mode 100644 index 0000000..b08827e --- /dev/null +++ b/PerlQt/tutorials/t13/LCDRange.pm @@ -0,0 +1,67 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int'], + setText => ['const char*']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider + label +); + +sub NEW { + my $class = shift; + my $s; + $s = shift if $_[0] and not ref $_[0]; + $class->SUPER::NEW(@_); + + init(); + setText($s) if $s; +} + + +sub init { + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + + label = Qt::Label(" ", this, "label"); + label->setAlignment(&AlignCenter); + + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); + + my $l = Qt::VBoxLayout(this); + $l->addWidget($lcd, 1); + $l->addWidget(slider); + $l->addWidget(label); +} + +sub value { slider->value } + +sub text { label->text } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +sub setText { label->setText(shift) } + +1; diff --git a/PerlQt/tutorials/t13/t13.pl b/PerlQt/tutorials/t13/t13.pl new file mode 100644 index 0000000..b0f5c25 --- /dev/null +++ b/PerlQt/tutorials/t13/t13.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w +use strict; +use blib; +use Qt; +use GameBoard; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $gb = GameBoard; +$gb->setGeometry(100, 100, 500, 355); +$a->setMainWidget($gb); +$gb->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t14/CannonField.pm b/PerlQt/tutorials/t14/CannonField.pm new file mode 100644 index 0000000..05fdbce --- /dev/null +++ b/PerlQt/tutorials/t14/CannonField.pm @@ -0,0 +1,256 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + hit => [], + missed => [], + angleChanged => ['int'], + forceChanged => ['int'], + canShoot => ['bool']; +use Qt::slots + setAngle => ['int'], + setForce => ['int'], + shoot => [], + moveShot => [], + newTarget => [], + setGameOver => [], + restartGame => []; +use Qt::attributes qw( + ang + f + + timerCount + autoShootTimer + shoot_ang + shoot_f + + target + + gameEnded + barrelPressed +); +use POSIX qw(atan); + +sub angle () { ang } +sub force () { f } +sub gameOver () { gameEnded } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + f = 0; + timerCount = 0; + autoShootTimer = Qt::Timer(this, "movement handler"); + this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()')); + shoot_ang = 0; + shoot_f = 0; + target = Qt::Point(0, 0); + gameEnded = 0; + barrelPressed = 0; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); + newTarget(); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(cannonRect(), 0); + emit angleChanged(ang); +} + +sub setForce { + my $newton = shift; + $newton = 0 if $newton < 0; + return if f == $newton; + f = $newton; + emit forceChanged(f); +} + +sub shoot { + return if isShooting(); + timerCount = 0; + shoot_ang = ang; + shoot_f = f; + autoShootTimer->start(50); + emit canShoot(0); +} + +sub newTarget { + my $r = Qt::Region(targetRect()); + target = Qt::Point(200 + int(rand(190)), + 10 + int(rand(255))); + repaint($r->unite(Qt::Region(targetRect()))); +} + +sub setGameOver { + return if gameEnded; + autoShootTimer->stop if isShooting(); + gameEnded = 1; + repaint(); +} + +sub restartGame { + autoShootTimer->stop if isShooting(); + gameEnded = 0; + repaint(); + emit canShoot(1); +} + +sub moveShot { + my $r = Qt::Region(shotRect()); + timerCount++; + + my $shotR = shotRect(); + + if($shotR->intersects(targetRect())) { + autoShootTimer->stop; + emit hit(); + emit canShoot(1); + } elsif($shotR->x > width() || $shotR->y > height() || + $shotR->intersects(barrierRect())) { + autoShootTimer->stop; + emit missed(); + emit canShoot(1); + } else { + $r = $r->unite(Qt::Region($shotR)); + } + repaint($r); +} + +sub mousePressEvent { + my $e = shift; + return if $e->button != &LeftButton; + barrelPressed = 1 if barrelHit($e->pos); +} + +sub mouseMoveEvent { + my $e = shift; + return unless barrelPressed; + my $pnt = $e->pos; + $pnt->setX(1) if $pnt->x <= 0; + $pnt->setY(height() - 1) if $pnt->y >= height(); + my $rad = atan((rect()->bottom - $pnt->y) / $pnt->x); + setAngle(int($rad*180/3.14159265)); +} + +sub mouseReleaseEvent { + my $e = shift; + barrelPressed = 0 if $e->button == &LeftButton; +} + +sub paintEvent { + my $e = shift; + my $updateR = $e->rect; + my $p = Qt::Painter(this); + + if(gameEnded) { + $p->setPen(&black); + $p->setFont(Qt::Font("Courier", 48, &Qt::Font::Bold)); + $p->drawText(rect(), &AlignCenter, "Game Over"); + } + paintCannon($p) if $updateR->intersects(cannonRect()); + paintBarrier($p) if $updateR->intersects(barrierRect()); + paintShot($p) if isShooting() and $updateR->intersects(shotRect()); + paintTarget($p) if !gameEnded and $updateR->intersects(targetRect()); +} + +sub paintShot { + my $p = shift; + $p->setBrush(&black); + $p->setPen(&NoPen); + $p->drawRect(shotRect()); +} + +sub paintTarget { + my $p = shift; + $p->setBrush(&red); + $p->setPen(&black); + $p->drawRect(targetRect()); +} + +sub paintBarrier { + my $p = shift; + $p->setBrush(&yellow); + $p->setPen(&black); + $p->drawRect(barrierRect()); +} + +my $barrelRect = Qt::Rect(33, -4, 15, 8); + +sub paintCannon { + my $p = shift; + my $cr = cannonRect(); + my $pix = Qt::Pixmap($cr->size); + $pix->fill(this, $cr->topLeft); + + my $tmp = Qt::Painter($pix); + $tmp->setBrush(&blue); + $tmp->setPen(&NoPen); + + $tmp->translate(0, $pix->height - 1); + $tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $tmp->rotate(- ang); + $tmp->drawRect($barrelRect); + $tmp->end; + + $p->drawPixmap($cr->topLeft, $pix); +} + +sub cannonRect { + my $r = Qt::Rect(0, 0, 50, 50); + $r->moveBottomLeft(rect()->bottomLeft); + return $r; +} + +sub shotRect { + my $gravity = 4; + + my $time = timerCount / 4.0; + my $velocity = shoot_f; + my $radians = shoot_ang*3.14159265/180; + + my $velx = $velocity*cos($radians); + my $vely = $velocity*sin($radians); + my $x0 = ($barrelRect->right + 5)*cos($radians); + my $y0 = ($barrelRect->right + 5)*sin($radians); + my $x = $x0 + $velx*$time; + my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2; + + my $r = Qt::Rect(0, 0, 6, 6); + $r->moveCenter(Qt::Point(int($x), height() - 1 - int($y))); + return $r; +} + +sub targetRect { + my $r = Qt::Rect(0, 0, 20, 10); + $r->moveCenter(Qt::Point(target->x, height() - 1 - target->y)); + return $r; +} + +sub barrierRect { + return Qt::Rect(145, height() - 100, 15, 100); +} + +sub barrelHit { + my $p = shift; + my $mtx = Qt::WMatrix; + $mtx->translate(0, height() - 1); + $mtx->rotate(- ang); + $mtx = $mtx->invert; + return $barrelRect->contains($mtx->map($p)); +} + +sub isShooting { autoShootTimer->isActive } + +sub sizeHint { Qt::Size(400, 300) } + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t14/GameBoard.pm b/PerlQt/tutorials/t14/GameBoard.pm new file mode 100644 index 0000000..96f9cbb --- /dev/null +++ b/PerlQt/tutorials/t14/GameBoard.pm @@ -0,0 +1,125 @@ +package GameBoard; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + fire => [], + hit => [], + missed => [], + newGame => []; +use Qt::attributes qw( + hits + shotsLeft + cannonField +); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange("ANGLE", this, "angle"); + $angle->setRange(5, 70); + + my $force = LCDRange("FORCE", this, "force"); + $force->setRange(10, 50); + + my $box = Qt::VBox(this, "cannonFrame"); + $box->setFrameStyle($box->WinPanel | $box->Sunken); + + cannonField = CannonField($box, "cannonField"); + + cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect(cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); + $force->connect(cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + + this->connect(cannonField, SIGNAL('hit()'), SLOT('hit()')); + this->connect(cannonField, SIGNAL('missed()'), SLOT('missed()')); + + my $shoot = Qt::PushButton('&Shoot', this, "shoot"); + $shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + this->connect($shoot, SIGNAL('clicked()'), SLOT('fire()')); + + $shoot->connect(cannonField, SIGNAL('canShoot(bool)'), SLOT('setEnabled(bool)')); + + my $restart = Qt::PushButton('&New Game', this, "newgame"); + $restart->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + this->connect($restart, SIGNAL('clicked()'), SLOT('newGame()')); + + hits = Qt::LCDNumber(2, this, "hits"); + shotsLeft = Qt::LCDNumber(2, this, "shotsleft"); + my $hitsL = Qt::Label("HITS", this, "hitsLabel"); + my $shotsLeftL = Qt::Label("SHOTS LEFT", this, "shotsLeftLabel"); + + my $accel = Qt::Accel(this); + $accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Enter)), + this, SLOT('fire()')); + $accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Return)), + this, SLOT('fire()')); + $accel->connectItem($accel->insertItem(Qt::KeySequence(int &CTRL+&Key_Q)), + Qt::app, SLOT('quit()')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($box, 1, 1); + $grid->setColStretch(1, 10); + + my $leftBox = Qt::VBoxLayout; + $grid->addLayout($leftBox, 1, 0); + $leftBox->addWidget($angle); + $leftBox->addWidget($force); + + my $topBox = Qt::HBoxLayout; + $grid->addLayout($topBox, 0, 1); + $topBox->addWidget($shoot); + $topBox->addWidget(hits); + $topBox->addWidget($hitsL); + $topBox->addWidget(shotsLeft); + $topBox->addWidget($shotsLeftL); + $topBox->addStretch(1); + $topBox->addWidget($restart); + + $angle->setValue(60); + $force->setValue(25); + $angle->setFocus(); + + newGame(); +} + +sub fire { + return if cannonField->gameOver or cannonField->isShooting; + shotsLeft->display(int(shotsLeft->intValue - 1)); + cannonField->shoot; +} + +sub hit { + hits->display(int(hits->intValue + 1)); + if(shotsLeft->intValue == 0) { + cannonField->setGameOver; + } else { + cannonField->newTarget; + } +} + +sub missed { + cannonField->setGameOver if shotsLeft->intValue == 0; +} + +sub newGame { + shotsLeft->display(int(15)); + hits->display(0); + cannonField->restartGame; + cannonField->newTarget; +} + +1; diff --git a/PerlQt/tutorials/t14/LCDRange.pm b/PerlQt/tutorials/t14/LCDRange.pm new file mode 100644 index 0000000..b08827e --- /dev/null +++ b/PerlQt/tutorials/t14/LCDRange.pm @@ -0,0 +1,67 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int'], + setText => ['const char*']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider + label +); + +sub NEW { + my $class = shift; + my $s; + $s = shift if $_[0] and not ref $_[0]; + $class->SUPER::NEW(@_); + + init(); + setText($s) if $s; +} + + +sub init { + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + + label = Qt::Label(" ", this, "label"); + label->setAlignment(&AlignCenter); + + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); + + my $l = Qt::VBoxLayout(this); + $l->addWidget($lcd, 1); + $l->addWidget(slider); + $l->addWidget(label); +} + +sub value { slider->value } + +sub text { label->text } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +sub setText { label->setText(shift) } + +1; diff --git a/PerlQt/tutorials/t14/t14.pl b/PerlQt/tutorials/t14/t14.pl new file mode 100644 index 0000000..b0f5c25 --- /dev/null +++ b/PerlQt/tutorials/t14/t14.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w +use strict; +use blib; +use Qt; +use GameBoard; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $gb = GameBoard; +$gb->setGeometry(100, 100, 500, 355); +$a->setMainWidget($gb); +$gb->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t2/t2.pl b/PerlQt/tutorials/t2/t2.pl new file mode 100644 index 0000000..970ccb4 --- /dev/null +++ b/PerlQt/tutorials/t2/t2.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl -w +use strict; +use blib; +use Qt; + +my $a = Qt::Application(\@ARGV); + +my $quit = Qt::PushButton("Quit", undef); +$quit->resize(75, 30); +$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + +$a->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + +$a->setMainWidget($quit); +$quit->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t3/t3.pl b/PerlQt/tutorials/t3/t3.pl new file mode 100644 index 0000000..bdd27fd --- /dev/null +++ b/PerlQt/tutorials/t3/t3.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl -w +use strict; +use blib; +use Qt; + +my $a = Qt::Application(\@ARGV); + +my $box = Qt::VBox; +$box->resize(200, 120); + +my $quit = Qt::PushButton("Quit", $box); +$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + +$a->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + +$a->setMainWidget($box); +$box->show; + +exit $a->exec; diff --git a/PerlQt/tutorials/t4/t4.pl b/PerlQt/tutorials/t4/t4.pl new file mode 100644 index 0000000..889a96a --- /dev/null +++ b/PerlQt/tutorials/t4/t4.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use Qt; +use Qt::isa qw(Qt::Widget); + +sub NEW { + shift->SUPER::NEW(@_); + + setMinimumSize(200, 120); + setMaximumSize(200, 120); + + my $quit = Qt::PushButton("Quit", this, "quit"); + $quit->setGeometry(62, 40, 75, 30); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); +} + +package main; +use MyWidget; + +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 200, 120); +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t5/t5.pl b/PerlQt/tutorials/t5/t5.pl new file mode 100644 index 0000000..d2dc201 --- /dev/null +++ b/PerlQt/tutorials/t5/t5.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use Qt; +use Qt::isa qw(Qt::VBox); + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + my $slider = Qt::Slider(&Horizontal, this, "slider"); + $slider->setRange(0, 99); + $slider->setValue(0); + + $lcd->connect($slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); +} + +package main; +use MyWidget; + +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t6/t6.pl b/PerlQt/tutorials/t6/t6.pl new file mode 100644 index 0000000..210626a --- /dev/null +++ b/PerlQt/tutorials/t6/t6.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package LCDRange; +use Qt; +use Qt::isa qw(Qt::VBox); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + my $slider = Qt::Slider(&Horizontal, this, "slider"); + $slider->setRange(0, 99); + $slider->setValue(0); + $lcd->connect($slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); +} + +package MyWidget; +use Qt; +use Qt::isa qw(Qt::VBox); +use LCDRange; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $grid = Qt::Grid(4, this); + + for(0..3) { + for(0..3) { + LCDRange($grid); + } + } +} + +package main; +use MyWidget; + +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t7/LCDRange.pm b/PerlQt/tutorials/t7/LCDRange.pm new file mode 100644 index 0000000..8a79e39 --- /dev/null +++ b/PerlQt/tutorials/t7/LCDRange.pm @@ -0,0 +1,29 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots setValue => ['int']; +use Qt::signals valueChanged => ['int']; +use Qt::attributes qw(slider); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + my $slider = Qt::Slider(&Horizontal, this, "slider"); + slider = $slider; + slider->setRange(0, 99); + slider->setValue(0); + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); +} + +sub value { slider->value } + +sub setValue { + my $value = shift; + slider->setValue($value); +} + +1; diff --git a/PerlQt/tutorials/t7/t7.pl b/PerlQt/tutorials/t7/t7.pl new file mode 100644 index 0000000..c798e28 --- /dev/null +++ b/PerlQt/tutorials/t7/t7.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use Qt; +use Qt::isa qw(Qt::VBox); + +use LCDRange; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $grid = Qt::Grid(4, this); + + my $previous; + for my $r (0..3) { + for my $c (0..3) { + my $lr = LCDRange($grid); + $previous->connect( + $lr, SIGNAL('valueChanged(int)'), + SLOT('setValue(int)')) if $previous; + $previous = $lr; + } + } +} + +package main; +use MyWidget; + +my $a = Qt::Application(\@ARGV); +my $w = MyWidget; +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t8/CannonField.pm b/PerlQt/tutorials/t8/CannonField.pm new file mode 100644 index 0000000..28e4986 --- /dev/null +++ b/PerlQt/tutorials/t8/CannonField.pm @@ -0,0 +1,43 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + angleChanged => ['int']; +use Qt::slots + setAngle => ['int']; +use Qt::attributes qw( + ang +); +use POSIX qw(atan); + +sub angle () { ang } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(); + emit angleChanged(ang); +} + +sub paintEvent { + my $s = "Angle = " . ang; + my $p = Qt::Painter(this); + $p->drawText(200, 200, $s); +} + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t8/LCDRange.pm b/PerlQt/tutorials/t8/LCDRange.pm new file mode 100644 index 0000000..be0f8ec --- /dev/null +++ b/PerlQt/tutorials/t8/LCDRange.pm @@ -0,0 +1,43 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider +); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); +} + +sub value { slider->value } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +1; diff --git a/PerlQt/tutorials/t8/t8.pl b/PerlQt/tutorials/t8/t8.pl new file mode 100644 index 0000000..51967ca --- /dev/null +++ b/PerlQt/tutorials/t8/t8.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange(this, "angle"); + $angle->setRange(5, 70); + + my $cannonField = CannonField(this, "cannonField"); + + $cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($angle, 1, 0, &AlignTop); + $grid->addWidget($cannonField, 1, 1); + $grid->setColStretch(1, 10); + + $angle->setValue(60); + $angle->setFocus(); +} + +package main; +use Qt; +use MyWidget; + +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 500, 355); +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/PerlQt/tutorials/t9/CannonField.pm b/PerlQt/tutorials/t9/CannonField.pm new file mode 100644 index 0000000..e12489a --- /dev/null +++ b/PerlQt/tutorials/t9/CannonField.pm @@ -0,0 +1,48 @@ +package CannonField; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); +use Qt::signals + angleChanged => ['int']; +use Qt::slots + setAngle => ['int']; +use Qt::attributes qw( + ang +); +use POSIX qw(atan); + +sub angle () { ang } + +sub NEW { + shift->SUPER::NEW(@_); + + ang = 45; + setPalette(Qt::Palette(Qt::Color(250, 250, 200))); +} + +sub setAngle { + my $degrees = shift; + $degrees = 5 if $degrees < 5; + $degrees = 70 if $degrees > 70; + return if ang == $degrees; + ang = $degrees; + repaint(); + emit angleChanged(ang); +} + +sub paintEvent { + my $p = Qt::Painter(this); + $p->setBrush(&blue); + $p->setPen(&NoPen); + + $p->translate(0, rect()->bottom); + $p->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16); + $p->rotate(- ang); + $p->drawRect(Qt::Rect(33, -4, 15, 8)); +} + +sub sizePolicy { + Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding); +} + +1; diff --git a/PerlQt/tutorials/t9/LCDRange.pm b/PerlQt/tutorials/t9/LCDRange.pm new file mode 100644 index 0000000..be0f8ec --- /dev/null +++ b/PerlQt/tutorials/t9/LCDRange.pm @@ -0,0 +1,43 @@ +package LCDRange; +use strict; +use Qt; +use Qt::isa qw(Qt::VBox); +use Qt::slots + setValue => ['int'], + setRange => ['int', 'int']; +use Qt::signals + valueChanged => ['int']; +use Qt::attributes qw( + slider +); + +sub NEW { + shift->SUPER::NEW(@_); + + my $lcd = Qt::LCDNumber(2, this, "lcd"); + + slider = Qt::Slider(&Horizontal, this, "slider"); + slider->setRange(0, 99); + slider->setValue(0); + $lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)')); + this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')); + + setFocusProxy(slider); +} + +sub value { slider->value } + +sub setValue { slider->setValue(shift) } + +sub setRange { + my($minVal, $maxVal) = @_; + if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) { + warn "LCDRange::setRange($minVal,$maxVal)\n" . + "\tRange must be 0..99\n" . + "\tand minVal must not be greater than maxVal\n"; + return; + } + slider->setRange($minVal, $maxVal); +} + +1; diff --git a/PerlQt/tutorials/t9/t9.pl b/PerlQt/tutorials/t9/t9.pl new file mode 100644 index 0000000..192041c --- /dev/null +++ b/PerlQt/tutorials/t9/t9.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl -w +use strict; +use blib; + +package MyWidget; +use strict; +use Qt; +use Qt::isa qw(Qt::Widget); + +use LCDRange; +use CannonField; + +sub NEW { + shift->SUPER::NEW(@_); + + my $quit = Qt::PushButton("&Quit", this, "quit"); + $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + + Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + + my $angle = LCDRange(this, "angle"); + $angle->setRange(5, 70); + + my $cannonField = CannonField(this, "cannonField"); + + $cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); + $angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + + my $grid = Qt::GridLayout(this, 2, 2, 10); + $grid->addWidget($quit, 0, 0); + $grid->addWidget($angle, 1, 0, &AlignTop); + $grid->addWidget($cannonField, 1, 1); + $grid->setColStretch(1, 10); + + $angle->setValue(60); + $angle->setFocus(); +} + +package main; +use Qt; +use MyWidget; + +Qt::Application::setColorSpec(&Qt::Application::CustomColor); +my $a = Qt::Application(\@ARGV); + +my $w = MyWidget; +$w->setGeometry(100, 100, 500, 355); +$a->setMainWidget($w); +$w->show; +exit $a->exec; @@ -0,0 +1,23 @@ + +PerlQt is a Perl Object Oriented interface to Trolltech's Qt v3.x - a well known +C++ GUI toolkit. + +See INSTALL for quick installation instructions + +See doc/en/index.html or doc/fr/index.html for installation procedure and detailed +documentation. + +See also PerlQt/tutorials and PerlQt/examples to get started. + + + +Requirements : +------------ + + - Perl >= 5.6 + + - Qt >= 3.0 + + - GNU tools : automake(>=1.5), autoconf (>=2.13), aclocal... + + @@ -0,0 +1,3 @@ + +- support templated classes +- PerlKDE diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..ad3c9ac --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,10824 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +dnl ------------------------------------------------------------------------ +dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), +dnl thanks to Raja R Harinath. +dnl ------------------------------------------------------------------------ +dnl +ifdef([_AC_PATH_X_XMKMF],[], + [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) +ifdef([AC_OUTPUT_SUBDIRS],[], + [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])]) + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(KDE_PATH_X_DIRECT, +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK(, [${x_direct_test_function}()], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_FIND_FILE, +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN(KDE_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN(KDE_MOC_ERROR_MESSAGE, +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN(KDE_UIC_ERROR_MESSAGE, +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN(KDE_CHECK_UIC_FLAG, +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui <<EOT + <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI> +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_MOC_UIC, +[ + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + elif test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistant],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + UIC=$UIC_PATH + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN(KDE_1_CHECK_PATHS, +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN(KDE_SET_PATHS, +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN(KDE_SET_DEFAULT_PATHS, +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${prefix}/share/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${prefix}/share/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${prefix}/share/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${prefix}/share/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${prefix}/share/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${prefix}/share/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${prefix}/share/config' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${prefix}/share/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${prefix}/share/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${prefix}/share/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${prefix}/share/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${prefix}/share/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${prefix}/share/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "xdg_directorydir" + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN(KDE_MISSING_PROG_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN(KDE_MISSING_ARTS_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly. +]) +]) + +AC_DEFUN(KDE_SUBST_PROGRAMS, +[ + AC_ARG_WITH(arts, + [ --without-arts build without aRts [default=detect] ], + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" != "no") + + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" != "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(KDECONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + + if test -x "$KDECONFIG"; then # it can be "compiled" + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + else + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + fi + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) +])dnl + +AC_DEFUN(AC_CREATE_KFSSTND, +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN(AC_SUBST_KFSSTND, +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN(KDE_MISC_TESTS, +[ + AC_LANG_C + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_LANG_C + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # darwin needs this to initialize the environment + AC_CHECK_HEADERS(crt_externs.h) + AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-framework CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(K_PATH_X, +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + [ --enable-embedded link to Qt-embedded, don't use X], + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + [ --enable-qtopia link to Qt-embedded, link to the Qtopia Environment], + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +if test "$kde_use_qt_emb" = "no"; then + +AC_MSG_CHECKING(for X) +AC_LANG_SAVE +AC_LANG_C +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS" + +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_libraries) +AC_SUBST(x_includes) + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +AC_SUBST(LIBSM) +LDFLAGS="$ac_save_LDFLAGS" + +AC_SUBST(X_PRE_LIBS) + +LIB_X11='-lX11 $(LIBSOCKET)' +AC_SUBST(LIB_X11) + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include <stdio.h> +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no + ) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe + ]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +else + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" + AC_SUBST(X_PRE_LIBS) + AC_SUBST(LIB_X11) + AC_SUBST(LIBSM) + AC_SUBST(X_INCLUDES) + AC_SUBST(X_LDFLAGS) + AC_SUBST(x_includes) + AC_SUBST(x_libraries) +fi +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + + +AC_LANG_RESTORE + +]) + +AC_DEFUN(KDE_PRINT_QT_PROGRAM, +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qglobal.h> +#include <qapplication.h> +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF +#include <qevent.h> +#include <qstring.h> +#include <qstyle.h> +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF +#if QT_VERSION < 210 +#error 1 +#endif +EOF +fi +fi + +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF +#include <qcursor.h> +#include <qstylefactory.h> +#include <private/qucomextra_p.h> +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <<EOF +#error 1 +#endif + +int main() { +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF + QStringList *t = new QStringList(); + Q_UNUSED(t); +EOF +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF + QString s; + s.setLatin1("Elvis is alive", 14); +EOF +fi +fi +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF + (void)QStyleFactory::create(QString::null); + QCursor c(Qt::WhatsThisCursor); +EOF +fi +cat >> conftest.$ac_ext <<EOF + return 0; +} +EOF +]) + +AC_DEFUN(KDE_USE_QT, +[ +if test -z "$1"; then + # Current default Qt version: 3.1 + kde_qtver=3 + kde_qtsubver=1 +else + kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'` + # following is the check if subversion isnt found in passed argument + if test "$kde_qtsubver" = "$1"; then + kde_qtsubver=1 + fi + kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'` + if test "$kde_qtver" = "1"; then + kde_qtsubver=42 + fi +fi + +if test -z "$2"; then + if test "$kde_qtver" = "2"; then + if test $kde_qtsubver -gt 0; then + kde_qt_minversion=">= Qt 2.2.2" + else + kde_qt_minversion=">= Qt 2.0.2" + fi + fi + if test "$kde_qtver" = "3"; then + if test $kde_qtsubver -gt 0; then + kde_qt_minversion=">= Qt 3.1 (20021021)" + else + kde_qt_minversion=">= Qt 3.0" + fi + fi + if test "$kde_qtver" = "1"; then + kde_qt_minversion=">= 1.42 and < 2.0" + fi +else + kde_qt_minversion=$2 +fi + +if test -z "$3"; then + if test $kde_qtver = 3; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 0x030100" + else + kde_qt_verstring="QT_VERSION >= 300" + fi + fi + if test $kde_qtver = 2; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 222" + else + kde_qt_verstring="QT_VERSION >= 200" + fi + fi + if test $kde_qtver = 1; then + kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" + fi +else + kde_qt_verstring=$3 +fi + +if test $kde_qtver = 3; then + kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3" +fi +if test $kde_qtver = 2; then + kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt" +fi +if test $kde_qtver = 1; then + kde_qt_dirs="$QTDIR /usr/lib/qt" +fi +]) + +AC_DEFUN(KDE_CHECK_QT_DIRECT, +[ +AC_REQUIRE([KDE_USE_QT]) +AC_MSG_CHECKING([if Qt compiles without flags]) +AC_CACHE_VAL(kde_cv_qt_direct, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_includes" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$LIBQT -lXext -lX11 $LIBSOCKET" +else +LIBS="$LIBQT $LIBSOCKET" +fi +LD_LIBRARY_PATH= +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + kde_cv_qt_direct="yes" +else + kde_cv_qt_direct="no" + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_1_3, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + [ --disable-mt link to non-threaded Qt (deprecated)], + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +if test -z "$LIBQT"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" + else + qtlib="qt" + fi + + kde_int_qt="-l$qtlib" +else + kde_int_qt="$LIBQT" + kde_lib_qt_set=yes +fi + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + if test -z "$LIBQT"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + else + LIBQT="$qtlib-mt" + kde_int_qt="$qtlib-mt" + fi + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" + kde_int_qt="$kde_int_qt $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + [ --with-qt-dir=DIR where the root of Qt is installed ], + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + [ --with-qt-includes=DIR where the Qt includes are. ], + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + [ --with-qt-libraries=DIR where the Qt library is installed.], + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes"; then +KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$all_libraries $QT_LDFLAGS" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "' $(LIBRESOLV) $(LIBPNG) $(X_PRE_LIBS) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN(AC_PATH_QT, +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN(KDE_CHECK_UIC_PLUGINS, +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>NewConnectionDialog</class> +<widget class="QDialog"> + <widget class="KLineEdit"> + <property name="name"> + <cstring>testInput</cstring> + </property> + </widget> +</widget> +</UI> +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +if test "$kde_cv_uic_plugins" = yes; then + AC_MSG_RESULT([yes]) +else + AC_MSG_ERROR([not found - you need to install kdelibs first.]) +fi +fi +]) + +AC_DEFUN(KDE_CHECK_FINAL, +[ + AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN(KDE_CHECK_CLOSURE, +[ + AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], + kde_use_closure=$enableval, kde_use_closure=yes) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +AC_DEFUN(KDE_CHECK_NMCHECK, +[ + AC_ARG_ENABLE(nmcheck, [ --enable-nmcheck enable automatic namespace cleanness check], + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_BASE_PATH_KDE, +[ +AC_PREREQ([2.13]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${prefix}/include + ac_kde_includes=$prefix/include + + if test "${exec_prefix}" != NONE; then + kde_libraries=${libdir} + ac_kde_libraries=$libdir + if test "$ac_kde_libraries" = '${exec_prefix}/lib'${kdelibsuff}; then + ac_kde_libraries=$exec_prefix/lib${kdelibsuff} + fi + else + kde_libraries=${prefix}/lib${kdelibsuff} + ac_kde_libraries=$prefix/lib${kdelibsuff} + fi +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes=${ac_kde_prefix}/include + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN(KDE_CHECK_EXTRA_LIBS, +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR + adds non standard include paths], + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include "confdefs.h" +#include <kapp.h> + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_KDEQTADDON, +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include <qdom.h> + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN(KDE_CHECK_KIMGIO, +[ + AC_REQUIRE([AC_BASE_PATH_KDE]) + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + AC_REQUIRE([AC_FIND_TIFF]) + AC_REQUIRE([AC_FIND_JPEG]) + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JASPER]) + AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) + + if test "$1" = "existance"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" + AC_CHECK_LIB(kimgio, kimgioRegister, [ + LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) + LIBS="$kde_save_LIBS" + AC_LANG_RESTORE + else + LIBKIMGIO_EXISTS=yes + fi + + if test "$LIBKIMGIO_EXISTS" = "yes"; then + LIB_KIMGIO='-lkimgio' + else + LIB_KIMGIO='' + fi + AC_SUBST(LIB_KIMGIO) +]) + +AC_DEFUN(KDE_CREATE_LIBS_ALIASES, +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN(AC_PATH_KDE, +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN(KDE_CHECK_FUNC_EXT, +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" +#endif +$4; +#endif +]) +]) + +AC_DEFUN(AC_CHECK_SETENV, +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include <stdlib.h> +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN(AC_CHECK_UNSETENV, +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include <stdlib.h> +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN(AC_CHECK_GETDOMAINNAME, +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [int getdomainname (char *, int)], + [GETDOMAINNAME]) +]) + +AC_DEFUN(AC_CHECK_GETHOSTNAME, +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN(AC_CHECK_USLEEP, +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include <unistd.h> +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN(AC_CHECK_RANDOM, +[ + KDE_CHECK_FUNC_EXT(random, [ +#include <stdlib.h> +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include <stdlib.h> +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN(AC_CHECK_INITGROUPS, +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include <sys/types.h> +#include <unistd.h> +#include <grp.h> +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN(AC_CHECK_MKSTEMPS, +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN(AC_CHECK_MKDTEMP, +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN(AC_CHECK_RES_INIT, +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + AC_MSG_CHECKING([if res_init is available]) + AC_TRY_COMPILE( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) +]) + +AC_DEFUN(AC_CHECK_STRLCPY, +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include <string.h> +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN(AC_CHECK_STRLCAT, +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include <string.h> +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN(AC_FIND_GIF, + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN(KDE_FIND_JPEG_HELPER, +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +AC_LANG_C +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN(AC_FIND_JPEG, +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN(KDE_CHECK_QT_JPEG, +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include <qapplication.h>], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN(AC_FIND_ZLIB, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include<zlib.h> +], + [return (zlibVersion() == ZLIB_VERSION); ], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_SUBST(LIBZ) + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. Check your installation and look into config.log) + LIBZ="" + AC_SUBST(LIBZ) +fi +]) + +AC_DEFUN(KDE_TRY_TIFFLIB, +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include<tiffio.h> +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN(AC_FIND_TIFF, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN(AC_FIND_PNG, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include<png.h> + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN(AC_FIND_JASPER, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper 1.600]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include<jasper/jasper.h> + ], + [ + return( jas_init() && JAS_IMAGE_CS_RGB ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN(AC_CHECK_BOOL, +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include <features.h> + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN(KDE_CHECK_COMPILER_FLAG, +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN(AC_REMOVE_FORBIDDEN, +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN(AC_VALIDIFY_CXXFLAGS, +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN(AC_CHECK_COMPILERS, +[ + AC_ARG_ENABLE(debug,[ --enable-debug[=ARG] enables debug symbols (yes|no|full) [default=no]], + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) + + AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,[ --disable-warnings disables compilation with -Wall and similiar], + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 $CFLAGS" + else + CFLAGS="-g -O2 $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 $CXXFLAGS" + else + CXXFLAGS="-g -O2 $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + case $host in + *-*-linux-gnu) + CFLAGS="-ansi -W -Wall -pedantic -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"; CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + CXXFLAGS="-Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + if test "$GXX" = "yes"; then + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + fi + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + AC_ARG_ENABLE(pch,[ --enable-pch enables precompiled header support (currently only KCC) [default=no]], + [ + kde_use_pch=$enableval + ],[kde_use_pch=no]) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CXXFLAGS=-O0 + NOOPT_CFLAGS=-O0 + fi + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN(KDE_ADD_DEPENDENCIES, +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN(KDE_PROG_LIBTOOL, +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_LANG_SAVE +AC_LANG_C +AC_OBJEXT +AC_EXEEXT +AC_LANG_RESTORE + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +AC_ARG_ENABLE(objprelink, [ --enable-objprelink prelink apps using objprelink (obsolete)], + kde_use_objprelink=$enableval, kde_use_objprelink=no) + if test "x$kde_use_objprelink" = "xyes"; then + AC_MSG_WARN([ +------------------------------------------------------------ +Configuration option --enable-objprelink is no longer useful. +See http:://objprelink.sourceforge.net for details: +1- Recent binutils are fast enough to do without objprelink. +2- Newer versions of objprelink do not need this option. +------------------------------------------------------------ +]) + fi +]) + +AC_DEFUN(KDE_CHECK_LIB64, +[ + kdelibsuff=none + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none[=default])]), + kdelibsuff=$enableval) + # TODO: add an auto case that compiles a little C app to check + # where the glibc is + if test "$kdelibsuff" = "none"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["\"${kdelibsuff}\""], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN(KDE_CHECK_TYPES, +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +AC_DEFUN(KDE_DO_IT_ALL, +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN(AC_CHECK_RPATH, +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + [ --disable-rpath do not use the rpath feature of ld], + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(kde_libraries)" + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN(AC_CHECK_SOCKLEN_T, [ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(ac_cv_socklen_t, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=socklen_t, + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=int, + ac_cv_socklen_t=size_t + ) + ) + AC_LANG_RESTORE + ]) + + AC_MSG_RESULT($ac_cv_socklen_t) + if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) + fi + AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) + +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN(AM_KDE_WITH_NLS, + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper <drepper@cygnus.com>, 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in <locale.h>. +# Ulrich Drepper <drepper@cygnus.com>, 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper <drepper@cygnus.com>, 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN(AM_KDE_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Wmissing-prototypes -Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include <string.h> + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN(AC_HAVE_XPM, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <X11/xpm.h>],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN(AC_HAVE_DPMS, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN(AC_HAVE_GL, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags="$LDFLAGS" + ac_save_cxxflags="$CXXFLAGS" + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU" + test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="mesa", ac_cv_have_gl="no") + if test "x$ac_cv_have_gl" = "xno"; then + LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGLU -lGL" + test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$ac_save_cflags $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + fi + AC_LANG_RESTORE + LDFLAGS="$ac_save_ldflags" + CXXFLAGS="$ac_save_cxxflags" + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB='-lMesaGLU -lMesaGL $(LIB_X11)' + else + GLLIB='-lGLU -lGL $(LIB_X11)' + fi + else + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB="$GL_LDFLAGS -lMesaGLU -lMesaGL "'$(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN(KDE_PAM, [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + AC_ARG_WITH(pam, + [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], + [ if test "x$withval" = "xyes"; then + use_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + use_pam=no + else + use_pam=yes + pam_service=$withval + fi + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ], [ + AC_CACHE_VAL(ac_cv_path_pam, + [ use_pam=no + AC_CHECK_LIB(pam, pam_start, + [ AC_CHECK_HEADER(security/pam_appl.h, + [ use_pam=yes + pam_service=kde ]) + ], , $LIBDL) + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ]) + ]) + eval "$ac_cv_path_pam" + + AC_MSG_CHECKING(for PAM) + if test "x$use_pam" = xno; then + AC_MSG_RESULT(no) + PAMLIBS="" + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, + [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN(DEF_PAM_SERVICE, [ + AC_ARG_WITH($1-pam, + [ --with-$1-pam=[val] override PAM service from --with-pam for $2], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$withval" + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN(KDE_SHADOWPASSWD, [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + [ --with-shadow If you want shadow password support ], + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN(KDE_PASSWDLIBS, [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN(KDE_CHECK_LIBDL, +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN(KDE_CHECK_DLOPEN, +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +[ --disable-dlopen link statically [default=no]] , +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN(KDE_ADD_INCLUDES, +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + + +AC_DEFUN(KDE_CHECK_MICO, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_MISC_TESTS]) +AC_MSG_CHECKING(for MICO) + +if test -z "$MICODIR"; then + kde_micodir=/usr/local + else + kde_micodir="$MICODIR" +fi + +AC_ARG_WITH(micodir, + [ --with-micodir=micodir where mico is installed ], + kde_micodir=$withval, + kde_micodir=$kde_micodir +) + +AC_CACHE_VAL(kde_cv_mico_incdir, +[ + mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" +AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) + +]) +kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` + +if test ! -r $kde_micodir/include/CORBA.h; then + AC_MSG_ERROR([No CORBA.h found, specify another micodir]) +fi + +AC_MSG_RESULT($kde_micodir) + +MICO_INCLUDES=-I$kde_micodir/include +AC_SUBST(MICO_INCLUDES) +MICO_LDFLAGS=-L$kde_micodir/lib +AC_SUBST(MICO_LDFLAGS) +micodir=$kde_micodir +AC_SUBST(micodir) + +AC_MSG_CHECKING([for MICO version]) +AC_CACHE_VAL(kde_cv_mico_version, +[ +AC_LANG_C +cat >conftest.$ac_ext <<EOF +#include <stdio.h> +#include <mico/version.h> +int main() { + + printf("MICO_VERSION=%s\n",MICO_VERSION); + return (0); +} +EOF +ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' +if AC_TRY_EVAL(ac_compile); then + if eval `./conftest 2>&5`; then + kde_cv_mico_version=$MICO_VERSION + else + AC_MSG_ERROR([your system is not able to execute a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) + fi +else + AC_MSG_ERROR([your system is not able to compile a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) +fi +]) + +dnl installed MICO version +mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "x$1" = "x"; then + req_version="2.3.0" +else + req_version=$1 +fi + +dnl required MICO version +req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "$mico_v_maj" -lt "$req_v_maj" || \ + ( test "$mico_v_maj" -eq "$req_v_maj" && \ + test "$mico_v_mid" -lt "$req_v_mid" ) || \ + ( test "$mico_v_mid" -eq "$req_v_mid" && \ + test "$mico_v_min" -lt "$req_v_min" ) + +then + AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ +at least is required. You should upgrade MICO.]) +else + AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) +fi + +LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" +AC_SUBST(LIBMICO) +if test -z "$IDL"; then + IDL='$(kde_bindir)/cuteidl' +fi +AC_SUBST(IDL) +IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' +AC_SUBST(IDL_DEPENDENCIES) + +idldir="\$(includedir)/idl" +AC_SUBST(idldir) + +]) + +AC_DEFUN(KDE_CHECK_MINI_STL, +[ +AC_REQUIRE([KDE_CHECK_MICO]) + +AC_MSG_CHECKING(if we use mico's mini-STL) +AC_CACHE_VAL(kde_cv_have_mini_stl, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_cxxflags="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" +AC_TRY_COMPILE( +[ +#include <mico/config.h> +], +[ +#ifdef HAVE_MINI_STL +#error "nothing" +#endif +], +kde_cv_have_mini_stl=no, +kde_cv_have_mini_stl=yes) +CXXFLAGS="$kde_save_cxxflags" +AC_LANG_RESTORE +]) + +if test "x$kde_cv_have_mini_stl" = "xyes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +]) + + +AC_DEFUN(KDE_CHECK_LIBPTHREAD, +[ +AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) +AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, +[ + AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], + kde_use_kernthreads=$enableval, kde_use_kernthreads=no) + + if test "$kde_use_kernthreads" = "yes"; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_CFLAGS="$CFLAGS" + CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" + CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" + AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) + CXXFLAGS="$ac_save_CXXFLAGS" + CFLAGS="$ac_save_CFLAGS" + if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then + kde_use_kernthreads=no + else + dnl Add proper -I and -l statements + AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD + if test "x$LIBPTHREAD" = "x"; then + kde_use_kernthreads=no + else + USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" + fi + fi + else + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) + fi + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_THREADING, +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN(KDE_TRY_LINK_PYTHON, +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +AC_LANG_SAVE +AC_LANG_C +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include <Python.h> +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi +AC_LANG_RESTORE + +fi + +]) + +AC_DEFUN(KDE_CHECK_PYTHON_DIR, +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +[ --with-pythondir=pythondir use python installed in pythondir ], +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN(KDE_CHECK_PYTHON_INTERN, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Pleae set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN(KDE_CHECK_PYTHON, +[ + KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ])]) +]) + +AC_DEFUN(KDE_CHECK_STL_SGI, +[ + AC_MSG_CHECKING([if STL implementation is SGI like]) + AC_CACHE_VAL(kde_cv_stl_type_sgi, + [ + AC_TRY_COMPILE([ +#include <string> +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_type_sgi=yes, + kde_cv_stl_type_sgi=no) +]) + + AC_MSG_RESULT($kde_cv_stl_type_sgi) + + if test "$kde_cv_stl_type_sgi" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL_HP, +[ + AC_MSG_CHECKING([if STL implementation is HP like]) + AC_CACHE_VAL(kde_cv_stl_type_hp, + [ + AC_TRY_COMPILE([ +#include <string> +using namespace std; +],[ + string astring="Hello World"; + astring.remove(0, 6); // now astring is "World" + return 0; +], kde_cv_stl_type_hp=yes, + kde_cv_stl_type_hp=no) +]) + AC_MSG_RESULT($kde_cv_stl_type_hp) + + if test "$kde_cv_stl_type_hp" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + KDE_CHECK_STL_SGI + + if test "$kde_cv_stl_type_sgi" = "no"; then + KDE_CHECK_STL_HP + + if test "$kde_cv_stl_type_hp" = "no"; then + AC_MSG_ERROR("no known STL type found - did you forget to install libstdc++[-devel] ?") + fi + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN(AC_FIND_QIMGIO, + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include <qimageio.h> +#include <qstring.h> +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN(KDE_CHECK_ANSI, +[ +]) + +AC_DEFUN(KDE_CHECK_INSURE, +[ + AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], + [ + if test $enableval = "no"; dnl + then ac_use_insure="no" + else ac_use_insure="yes" + fi + ], [ac_use_insure="no"]) + + AC_MSG_CHECKING(if we will use Insure++ to debug) + AC_MSG_RESULT($ac_use_insure) + if test "$ac_use_insure" = "yes"; dnl + then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? + fi +]) + +AC_DEFUN(AM_DISABLE_LIBRARIES, +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN(AC_CHECK_UTMP_FILE, +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN(KDE_CREATE_SUBDIRSLIST, +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + TOPSUBDIRS="" + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +else + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN(KDE_CHECK_NAMESPACES, +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_NEWLIBS, +[ + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_S_ISSOCK, +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_LANG_SAVE +AC_LANG_C +AC_TRY_LINK( +[ +#include <sys/stat.h> +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +AC_LANG_C +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include <sys/param.h> +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN(KDE_CHECK_HEADER, +[ + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER($1, $2, $3, $4) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_HEADERS, +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_FAST_CONFIGURE, +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN(KDE_CONF_FILES, +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +AC_DEFUN(KDE_SET_PREFIX, +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superflous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN(KDE_LANG_CPLUSPLUS, +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN(KDE_CHECK_LONG_LONG, +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN(KDE_CHECK_LIB, +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN(KDE_JAVA_PREFIX, +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN(KDE_CHECK_JAVA_DIR, +[ + +AC_ARG_WITH(java, +[ --with-java=javadir use java installed in javadir, --without-java disables ], +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> look in $PATH + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + javadirs="$javadirs $dir" + done + IFS=$kde_save_IFS + jredirs= + + for dir in $javadirs; do + if test ! -d $dir; then break; fi + if test -x "$dir/java"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + done + + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + + else + JAVAC= + jni_includes= + fi + + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include <jni.h> + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +else # no + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. (matz@kde.org) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], [mm_car($2)])$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN(KDE_NEED_FLEX, +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN(AC_PATH_QTOPIA, +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + [ --with-qtopia-dir=DIR where the root of Qtopia is installed ], + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qpe/qpeapplication.h> +#include <qpe/version.h> + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN(KDE_INIT_DOXYGEN, +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN(AC_FIND_BZIP2, +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include<bzlib.h> +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include<bzlib.h> + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(KDE_CHECK_SSL, +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + [ --with-ssl-dir=DIR where the root of OpenSSL is installed], + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + [ --without-ssl disable SSL checks], + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + AC_LANG_SAVE + AC_LANG_C + + ac_cflags_safe="$CFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CFLAGS="$CFLAGS -I$ssl_incdir $all_includes" + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + CFLAGS="$ac_cflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + AC_LANG_SAVE + AC_LANG_C + + cat >conftest.$ac_ext <<EOF +#include <openssl/opensslv.h> +#include <stdio.h> + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_compile='${CC-gcc} $CFLAGS -I$ac_ssl_includes conftest.$ac_ext -o conftest' + if AC_TRY_EVAL(ac_compile); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <faure@kde.org>, attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <faure@kde.org>, attaching your config.log]) + fi + + AC_LANG_RESTORE + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +if test "$ssl_includes" = "/usr/include" || test "$ssl_includes" = "/usr/local/include" || test -z "$ssl_includes"; then + SSL_INCLUDES=""; +else + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN(KDE_CHECK_STRLCPY, +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail kde-devel@kde.org with a description of your system! + ]) + ]) +]) + +AC_DEFUN(KDE_CHECK_BINUTILS, +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([LT_AC_PROG_SED])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +[$]* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 32"*) + LINUX_64_MODE="32" + ;; + *"ELF 64"*) + LINUX_64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $3" + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + if (eval $ac_compile 2>conftest.err) && test -s $ac_outfile; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + CFLAGS="$save_CFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $host_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + ifelse([$1],[],[save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"], + [$1],[CXX],[save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -o out/conftest2.$ac_objext"], + [$1],[GCJ],[save_GCJFLAGS="$GCJFLAGS" + GCJFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + if (eval $ac_compile 2>out/conftest.err) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + # Append any errors to the config.log. + cat out/conftest.err 1>&AS_MESSAGE_LOG_FD + else + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + ifelse([$1],[],[CFLAGS="$save_CFLAGS"], + [$1],[CXX],[CXXFLAGS="$save_CXXFLAGS"], + [$1],[GCJ],[GCJFLAGS="$save_GCJFLAGS"]) + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)"; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://"` + if echo "$sys_lib_search_path_spec" | [egrep ';[C-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + if test "$host_cpu" = ia64; then + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + else + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + fi + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags=TAGS], + [include additional configurations @<:@CXX,GCJ@:>@])], + [tagnames="$withval"], + [tagnames="CXX,GCJ" + case $host_os in + mingw*|cygwin*) tagnames="$tagnames,RC" ;; + esac]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + AC_LIBTOOL_LANG_CXX_CONFIG + ;; + + GCJ) + AC_LIBTOOL_LANG_GCJ_CONFIG + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + available_tags="$available_tags $tagname" + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +])# AC_PROG_LD + + +# AC_PROG_LD_GNU +# -------------- +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + if test "$host_cpu" = ia64; then + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + else + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + fi + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ("$tmp_nm" -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ("$tmp_nm" -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([AC_PROG_RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C test sources. +ac_ext=cc + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int char *[]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${CXX-"c++"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ + egrep 'GNU ld' > /dev/null; then + with_gnu_ld=yes + + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + egrep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux*) + if test $with_gnu_ld = no; then + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + fi + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + # NetBSD uses g++ - do we need to do anything? + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | egrep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# Figure out "hidden" C++ library dependencies from verbose +# compiler output whening linking a shared library. +cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF + + +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then + _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext|*.$libext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then + _LT_AC_TAGVAR(predep_objects, $1)="$p" + else + _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then + _LT_AC_TAGVAR(postdep_objects, $1)="$p" + else + _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out +else + echo "libtool.m4: error: problem compiling C++ test program" +fi + +$rm -f confest.$objext + +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ;; +esac + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_CXX_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for C test sources. +ac_ext=java + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A sed program that does not truncate output. +SED=$lt_SED + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "$cfgfile" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments + _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments + _LT_AC_FILE_IMPGEN_C +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions -c conftest.$ac_ext], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + cygwin* | mingw* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + if test "x$host_vendor" = xsni; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-LD' + else + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + fi + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -DPIC], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -DPIC" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + cygwin* | mingw* | pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an egrep regular expression of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + ;; + esac + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && strip -s $export_symbols' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9* | hpux10* | hpux11*) + if test "$GCC" = yes; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + esac + else + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + ;; + esac + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + if test "x$host_vendor" = xsni; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac +fi +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_FILE_IMPGEN_C +# -------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_IMPGEN_C], [ +# /* impgen.c starts here */ +# /* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ +])# _LT_AC_FILE_IMPGEN_C + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break; + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 10000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" +]) +AC_MSG_RESULT([$SED]) +]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..6553d5d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,11632 @@ +# generated automatically by aclocal 1.7.2 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +dnl ------------------------------------------------------------------------ +dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), +dnl thanks to Raja R Harinath. +dnl ------------------------------------------------------------------------ +dnl +ifdef([_AC_PATH_X_XMKMF],[], + [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) +ifdef([AC_OUTPUT_SUBDIRS],[], + [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])]) + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(KDE_PATH_X_DIRECT, +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK(, [${x_direct_test_function}()], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_FIND_FILE, +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN(KDE_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN(KDE_MOC_ERROR_MESSAGE, +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN(KDE_UIC_ERROR_MESSAGE, +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN(KDE_CHECK_UIC_FLAG, +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui <<EOT + <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI> +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_MOC_UIC, +[ + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + elif test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistant],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + UIC=$UIC_PATH + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN(KDE_1_CHECK_PATHS, +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN(KDE_SET_PATHS, +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN(KDE_SET_DEFAULT_PATHS, +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${prefix}/share/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${prefix}/share/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${prefix}/share/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${prefix}/share/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${prefix}/share/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${prefix}/share/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${prefix}/share/config' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${prefix}/share/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${prefix}/share/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${prefix}/share/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${prefix}/share/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${prefix}/share/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${prefix}/share/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "xdg_directorydir" + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN(KDE_MISSING_PROG_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN(KDE_MISSING_ARTS_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly. +]) +]) + +AC_DEFUN(KDE_SUBST_PROGRAMS, +[ + AC_ARG_WITH(arts, + [ --without-arts build without aRts [default=detect] ], + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" != "no") + + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" != "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(KDECONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + + if test -x "$KDECONFIG"; then # it can be "compiled" + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + else + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + fi + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) +])dnl + +AC_DEFUN(AC_CREATE_KFSSTND, +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN(AC_SUBST_KFSSTND, +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN(KDE_MISC_TESTS, +[ + AC_LANG_C + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_LANG_C + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # darwin needs this to initialize the environment + AC_CHECK_HEADERS(crt_externs.h) + AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-framework CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(K_PATH_X, +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + [ --enable-embedded link to Qt-embedded, don't use X], + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + [ --enable-qtopia link to Qt-embedded, link to the Qtopia Environment], + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +if test "$kde_use_qt_emb" = "no"; then + +AC_MSG_CHECKING(for X) +AC_LANG_SAVE +AC_LANG_C +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS" + +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_libraries) +AC_SUBST(x_includes) + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +AC_SUBST(LIBSM) +LDFLAGS="$ac_save_LDFLAGS" + +AC_SUBST(X_PRE_LIBS) + +LIB_X11='-lX11 $(LIBSOCKET)' +AC_SUBST(LIB_X11) + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include <stdio.h> +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no + ) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe + ]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +else + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" + AC_SUBST(X_PRE_LIBS) + AC_SUBST(LIB_X11) + AC_SUBST(LIBSM) + AC_SUBST(X_INCLUDES) + AC_SUBST(X_LDFLAGS) + AC_SUBST(x_includes) + AC_SUBST(x_libraries) +fi +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + + +AC_LANG_RESTORE + +]) + +AC_DEFUN(KDE_PRINT_QT_PROGRAM, +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qglobal.h> +#include <qapplication.h> +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF +#include <qevent.h> +#include <qstring.h> +#include <qstyle.h> +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF +#if QT_VERSION < 210 +#error 1 +#endif +EOF +fi +fi + +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF +#include <qcursor.h> +#include <qstylefactory.h> +#include <private/qucomextra_p.h> +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <<EOF +#error 1 +#endif + +int main() { +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF + QStringList *t = new QStringList(); + Q_UNUSED(t); +EOF +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF + QString s; + s.setLatin1("Elvis is alive", 14); +EOF +fi +fi +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF + (void)QStyleFactory::create(QString::null); + QCursor c(Qt::WhatsThisCursor); +EOF +fi +cat >> conftest.$ac_ext <<EOF + return 0; +} +EOF +]) + +AC_DEFUN(KDE_USE_QT, +[ +if test -z "$1"; then + # Current default Qt version: 3.1 + kde_qtver=3 + kde_qtsubver=1 +else + kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'` + # following is the check if subversion isnt found in passed argument + if test "$kde_qtsubver" = "$1"; then + kde_qtsubver=1 + fi + kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'` + if test "$kde_qtver" = "1"; then + kde_qtsubver=42 + fi +fi + +if test -z "$2"; then + if test "$kde_qtver" = "2"; then + if test $kde_qtsubver -gt 0; then + kde_qt_minversion=">= Qt 2.2.2" + else + kde_qt_minversion=">= Qt 2.0.2" + fi + fi + if test "$kde_qtver" = "3"; then + if test $kde_qtsubver -gt 0; then + kde_qt_minversion=">= Qt 3.1 (20021021)" + else + kde_qt_minversion=">= Qt 3.0" + fi + fi + if test "$kde_qtver" = "1"; then + kde_qt_minversion=">= 1.42 and < 2.0" + fi +else + kde_qt_minversion=$2 +fi + +if test -z "$3"; then + if test $kde_qtver = 3; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 0x030100" + else + kde_qt_verstring="QT_VERSION >= 300" + fi + fi + if test $kde_qtver = 2; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 222" + else + kde_qt_verstring="QT_VERSION >= 200" + fi + fi + if test $kde_qtver = 1; then + kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" + fi +else + kde_qt_verstring=$3 +fi + +if test $kde_qtver = 3; then + kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3" +fi +if test $kde_qtver = 2; then + kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt" +fi +if test $kde_qtver = 1; then + kde_qt_dirs="$QTDIR /usr/lib/qt" +fi +]) + +AC_DEFUN(KDE_CHECK_QT_DIRECT, +[ +AC_REQUIRE([KDE_USE_QT]) +AC_MSG_CHECKING([if Qt compiles without flags]) +AC_CACHE_VAL(kde_cv_qt_direct, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_includes" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$LIBQT -lXext -lX11 $LIBSOCKET" +else +LIBS="$LIBQT $LIBSOCKET" +fi +LD_LIBRARY_PATH= +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + kde_cv_qt_direct="yes" +else + kde_cv_qt_direct="no" + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_1_3, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + [ --disable-mt link to non-threaded Qt (deprecated)], + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +if test -z "$LIBQT"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" + else + qtlib="qt" + fi + + kde_int_qt="-l$qtlib" +else + kde_int_qt="$LIBQT" + kde_lib_qt_set=yes +fi + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + if test -z "$LIBQT"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + else + LIBQT="$qtlib-mt" + kde_int_qt="$qtlib-mt" + fi + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" + kde_int_qt="$kde_int_qt $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + [ --with-qt-dir=DIR where the root of Qt is installed ], + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + [ --with-qt-includes=DIR where the Qt includes are. ], + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + [ --with-qt-libraries=DIR where the Qt library is installed.], + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes"; then +KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$all_libraries $QT_LDFLAGS" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "' $(LIBRESOLV) $(LIBPNG) $(X_PRE_LIBS) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN(AC_PATH_QT, +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN(KDE_CHECK_UIC_PLUGINS, +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>NewConnectionDialog</class> +<widget class="QDialog"> + <widget class="KLineEdit"> + <property name="name"> + <cstring>testInput</cstring> + </property> + </widget> +</widget> +</UI> +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +if test "$kde_cv_uic_plugins" = yes; then + AC_MSG_RESULT([yes]) +else + AC_MSG_ERROR([not found - you need to install kdelibs first.]) +fi +fi +]) + +AC_DEFUN(KDE_CHECK_FINAL, +[ + AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN(KDE_CHECK_CLOSURE, +[ + AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], + kde_use_closure=$enableval, kde_use_closure=yes) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +AC_DEFUN(KDE_CHECK_NMCHECK, +[ + AC_ARG_ENABLE(nmcheck, [ --enable-nmcheck enable automatic namespace cleanness check], + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_BASE_PATH_KDE, +[ +AC_PREREQ([2.13]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${prefix}/include + ac_kde_includes=$prefix/include + + if test "${exec_prefix}" != NONE; then + kde_libraries=${libdir} + ac_kde_libraries=$libdir + if test "$ac_kde_libraries" = '${exec_prefix}/lib'${kdelibsuff}; then + ac_kde_libraries=$exec_prefix/lib${kdelibsuff} + fi + else + kde_libraries=${prefix}/lib${kdelibsuff} + ac_kde_libraries=$prefix/lib${kdelibsuff} + fi +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes=${ac_kde_prefix}/include + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN(KDE_CHECK_EXTRA_LIBS, +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR + adds non standard include paths], + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include "confdefs.h" +#include <kapp.h> + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_KDEQTADDON, +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include <qdom.h> + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN(KDE_CHECK_KIMGIO, +[ + AC_REQUIRE([AC_BASE_PATH_KDE]) + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + AC_REQUIRE([AC_FIND_TIFF]) + AC_REQUIRE([AC_FIND_JPEG]) + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JASPER]) + AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) + + if test "$1" = "existance"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" + AC_CHECK_LIB(kimgio, kimgioRegister, [ + LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) + LIBS="$kde_save_LIBS" + AC_LANG_RESTORE + else + LIBKIMGIO_EXISTS=yes + fi + + if test "$LIBKIMGIO_EXISTS" = "yes"; then + LIB_KIMGIO='-lkimgio' + else + LIB_KIMGIO='' + fi + AC_SUBST(LIB_KIMGIO) +]) + +AC_DEFUN(KDE_CREATE_LIBS_ALIASES, +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN(AC_PATH_KDE, +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN(KDE_CHECK_FUNC_EXT, +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" +#endif +$4; +#endif +]) +]) + +AC_DEFUN(AC_CHECK_SETENV, +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include <stdlib.h> +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN(AC_CHECK_UNSETENV, +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include <stdlib.h> +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN(AC_CHECK_GETDOMAINNAME, +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [int getdomainname (char *, int)], + [GETDOMAINNAME]) +]) + +AC_DEFUN(AC_CHECK_GETHOSTNAME, +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN(AC_CHECK_USLEEP, +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include <unistd.h> +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN(AC_CHECK_RANDOM, +[ + KDE_CHECK_FUNC_EXT(random, [ +#include <stdlib.h> +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include <stdlib.h> +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN(AC_CHECK_INITGROUPS, +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include <sys/types.h> +#include <unistd.h> +#include <grp.h> +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN(AC_CHECK_MKSTEMPS, +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN(AC_CHECK_MKDTEMP, +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN(AC_CHECK_RES_INIT, +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + AC_MSG_CHECKING([if res_init is available]) + AC_TRY_COMPILE( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) +]) + +AC_DEFUN(AC_CHECK_STRLCPY, +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include <string.h> +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN(AC_CHECK_STRLCAT, +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include <string.h> +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN(AC_FIND_GIF, + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN(KDE_FIND_JPEG_HELPER, +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +AC_LANG_C +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN(AC_FIND_JPEG, +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN(KDE_CHECK_QT_JPEG, +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include <qapplication.h>], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN(AC_FIND_ZLIB, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include<zlib.h> +], + [return (zlibVersion() == ZLIB_VERSION); ], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_SUBST(LIBZ) + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. Check your installation and look into config.log) + LIBZ="" + AC_SUBST(LIBZ) +fi +]) + +AC_DEFUN(KDE_TRY_TIFFLIB, +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include<tiffio.h> +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN(AC_FIND_TIFF, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN(AC_FIND_PNG, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include<png.h> + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN(AC_FIND_JASPER, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper 1.600]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include<jasper/jasper.h> + ], + [ + return( jas_init() && JAS_IMAGE_CS_RGB ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN(AC_CHECK_BOOL, +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include <features.h> + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN(KDE_CHECK_COMPILER_FLAG, +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN(AC_REMOVE_FORBIDDEN, +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN(AC_VALIDIFY_CXXFLAGS, +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN(AC_CHECK_COMPILERS, +[ + AC_ARG_ENABLE(debug,[ --enable-debug[=ARG] enables debug symbols (yes|no|full) [default=no]], + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) + + AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,[ --disable-warnings disables compilation with -Wall and similiar], + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 $CFLAGS" + else + CFLAGS="-g -O2 $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 $CXXFLAGS" + else + CXXFLAGS="-g -O2 $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + case $host in + *-*-linux-gnu) + CFLAGS="-ansi -W -Wall -pedantic -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"; CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + CXXFLAGS="-Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + if test "$GXX" = "yes"; then + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + fi + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + AC_ARG_ENABLE(pch,[ --enable-pch enables precompiled header support (currently only KCC) [default=no]], + [ + kde_use_pch=$enableval + ],[kde_use_pch=no]) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CXXFLAGS=-O0 + NOOPT_CFLAGS=-O0 + fi + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN(KDE_ADD_DEPENDENCIES, +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN(KDE_PROG_LIBTOOL, +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_LANG_SAVE +AC_LANG_C +AC_OBJEXT +AC_EXEEXT +AC_LANG_RESTORE + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +AC_ARG_ENABLE(objprelink, [ --enable-objprelink prelink apps using objprelink (obsolete)], + kde_use_objprelink=$enableval, kde_use_objprelink=no) + if test "x$kde_use_objprelink" = "xyes"; then + AC_MSG_WARN([ +------------------------------------------------------------ +Configuration option --enable-objprelink is no longer useful. +See http:://objprelink.sourceforge.net for details: +1- Recent binutils are fast enough to do without objprelink. +2- Newer versions of objprelink do not need this option. +------------------------------------------------------------ +]) + fi +]) + +AC_DEFUN(KDE_CHECK_LIB64, +[ + kdelibsuff=none + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none[=default])]), + kdelibsuff=$enableval) + # TODO: add an auto case that compiles a little C app to check + # where the glibc is + if test "$kdelibsuff" = "none"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["\"${kdelibsuff}\""], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN(KDE_CHECK_TYPES, +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +AC_DEFUN(KDE_DO_IT_ALL, +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN(AC_CHECK_RPATH, +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + [ --disable-rpath do not use the rpath feature of ld], + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(kde_libraries)" + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN(AC_CHECK_SOCKLEN_T, [ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(ac_cv_socklen_t, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=socklen_t, + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=int, + ac_cv_socklen_t=size_t + ) + ) + AC_LANG_RESTORE + ]) + + AC_MSG_RESULT($ac_cv_socklen_t) + if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) + fi + AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) + +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN(AM_KDE_WITH_NLS, + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper <drepper@cygnus.com>, 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in <locale.h>. +# Ulrich Drepper <drepper@cygnus.com>, 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper <drepper@cygnus.com>, 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN(AM_KDE_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Wmissing-prototypes -Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include <string.h> + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN(AC_HAVE_XPM, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <X11/xpm.h>],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN(AC_HAVE_DPMS, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN(AC_HAVE_GL, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags="$LDFLAGS" + ac_save_cxxflags="$CXXFLAGS" + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU" + test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="mesa", ac_cv_have_gl="no") + if test "x$ac_cv_have_gl" = "xno"; then + LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGLU -lGL" + test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$ac_save_cflags $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + fi + AC_LANG_RESTORE + LDFLAGS="$ac_save_ldflags" + CXXFLAGS="$ac_save_cxxflags" + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB='-lMesaGLU -lMesaGL $(LIB_X11)' + else + GLLIB='-lGLU -lGL $(LIB_X11)' + fi + else + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB="$GL_LDFLAGS -lMesaGLU -lMesaGL "'$(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN(KDE_PAM, [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + AC_ARG_WITH(pam, + [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], + [ if test "x$withval" = "xyes"; then + use_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + use_pam=no + else + use_pam=yes + pam_service=$withval + fi + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ], [ + AC_CACHE_VAL(ac_cv_path_pam, + [ use_pam=no + AC_CHECK_LIB(pam, pam_start, + [ AC_CHECK_HEADER(security/pam_appl.h, + [ use_pam=yes + pam_service=kde ]) + ], , $LIBDL) + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ]) + ]) + eval "$ac_cv_path_pam" + + AC_MSG_CHECKING(for PAM) + if test "x$use_pam" = xno; then + AC_MSG_RESULT(no) + PAMLIBS="" + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, + [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN(DEF_PAM_SERVICE, [ + AC_ARG_WITH($1-pam, + [ --with-$1-pam=[val] override PAM service from --with-pam for $2], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$withval" + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN(KDE_SHADOWPASSWD, [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + [ --with-shadow If you want shadow password support ], + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN(KDE_PASSWDLIBS, [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN(KDE_CHECK_LIBDL, +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN(KDE_CHECK_DLOPEN, +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +[ --disable-dlopen link statically [default=no]] , +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN(KDE_ADD_INCLUDES, +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + + +AC_DEFUN(KDE_CHECK_MICO, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_MISC_TESTS]) +AC_MSG_CHECKING(for MICO) + +if test -z "$MICODIR"; then + kde_micodir=/usr/local + else + kde_micodir="$MICODIR" +fi + +AC_ARG_WITH(micodir, + [ --with-micodir=micodir where mico is installed ], + kde_micodir=$withval, + kde_micodir=$kde_micodir +) + +AC_CACHE_VAL(kde_cv_mico_incdir, +[ + mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" +AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) + +]) +kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` + +if test ! -r $kde_micodir/include/CORBA.h; then + AC_MSG_ERROR([No CORBA.h found, specify another micodir]) +fi + +AC_MSG_RESULT($kde_micodir) + +MICO_INCLUDES=-I$kde_micodir/include +AC_SUBST(MICO_INCLUDES) +MICO_LDFLAGS=-L$kde_micodir/lib +AC_SUBST(MICO_LDFLAGS) +micodir=$kde_micodir +AC_SUBST(micodir) + +AC_MSG_CHECKING([for MICO version]) +AC_CACHE_VAL(kde_cv_mico_version, +[ +AC_LANG_C +cat >conftest.$ac_ext <<EOF +#include <stdio.h> +#include <mico/version.h> +int main() { + + printf("MICO_VERSION=%s\n",MICO_VERSION); + return (0); +} +EOF +ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' +if AC_TRY_EVAL(ac_compile); then + if eval `./conftest 2>&5`; then + kde_cv_mico_version=$MICO_VERSION + else + AC_MSG_ERROR([your system is not able to execute a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) + fi +else + AC_MSG_ERROR([your system is not able to compile a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) +fi +]) + +dnl installed MICO version +mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "x$1" = "x"; then + req_version="2.3.0" +else + req_version=$1 +fi + +dnl required MICO version +req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "$mico_v_maj" -lt "$req_v_maj" || \ + ( test "$mico_v_maj" -eq "$req_v_maj" && \ + test "$mico_v_mid" -lt "$req_v_mid" ) || \ + ( test "$mico_v_mid" -eq "$req_v_mid" && \ + test "$mico_v_min" -lt "$req_v_min" ) + +then + AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ +at least is required. You should upgrade MICO.]) +else + AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) +fi + +LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" +AC_SUBST(LIBMICO) +if test -z "$IDL"; then + IDL='$(kde_bindir)/cuteidl' +fi +AC_SUBST(IDL) +IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' +AC_SUBST(IDL_DEPENDENCIES) + +idldir="\$(includedir)/idl" +AC_SUBST(idldir) + +]) + +AC_DEFUN(KDE_CHECK_MINI_STL, +[ +AC_REQUIRE([KDE_CHECK_MICO]) + +AC_MSG_CHECKING(if we use mico's mini-STL) +AC_CACHE_VAL(kde_cv_have_mini_stl, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_cxxflags="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" +AC_TRY_COMPILE( +[ +#include <mico/config.h> +], +[ +#ifdef HAVE_MINI_STL +#error "nothing" +#endif +], +kde_cv_have_mini_stl=no, +kde_cv_have_mini_stl=yes) +CXXFLAGS="$kde_save_cxxflags" +AC_LANG_RESTORE +]) + +if test "x$kde_cv_have_mini_stl" = "xyes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +]) + + +AC_DEFUN(KDE_CHECK_LIBPTHREAD, +[ +AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) +AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, +[ + AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], + kde_use_kernthreads=$enableval, kde_use_kernthreads=no) + + if test "$kde_use_kernthreads" = "yes"; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_CFLAGS="$CFLAGS" + CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" + CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" + AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) + CXXFLAGS="$ac_save_CXXFLAGS" + CFLAGS="$ac_save_CFLAGS" + if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then + kde_use_kernthreads=no + else + dnl Add proper -I and -l statements + AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD + if test "x$LIBPTHREAD" = "x"; then + kde_use_kernthreads=no + else + USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" + fi + fi + else + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) + fi + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_THREADING, +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN(KDE_TRY_LINK_PYTHON, +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +AC_LANG_SAVE +AC_LANG_C +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include <Python.h> +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi +AC_LANG_RESTORE + +fi + +]) + +AC_DEFUN(KDE_CHECK_PYTHON_DIR, +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +[ --with-pythondir=pythondir use python installed in pythondir ], +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN(KDE_CHECK_PYTHON_INTERN, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Pleae set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN(KDE_CHECK_PYTHON, +[ + KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ])]) +]) + +AC_DEFUN(KDE_CHECK_STL_SGI, +[ + AC_MSG_CHECKING([if STL implementation is SGI like]) + AC_CACHE_VAL(kde_cv_stl_type_sgi, + [ + AC_TRY_COMPILE([ +#include <string> +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_type_sgi=yes, + kde_cv_stl_type_sgi=no) +]) + + AC_MSG_RESULT($kde_cv_stl_type_sgi) + + if test "$kde_cv_stl_type_sgi" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL_HP, +[ + AC_MSG_CHECKING([if STL implementation is HP like]) + AC_CACHE_VAL(kde_cv_stl_type_hp, + [ + AC_TRY_COMPILE([ +#include <string> +using namespace std; +],[ + string astring="Hello World"; + astring.remove(0, 6); // now astring is "World" + return 0; +], kde_cv_stl_type_hp=yes, + kde_cv_stl_type_hp=no) +]) + AC_MSG_RESULT($kde_cv_stl_type_hp) + + if test "$kde_cv_stl_type_hp" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + KDE_CHECK_STL_SGI + + if test "$kde_cv_stl_type_sgi" = "no"; then + KDE_CHECK_STL_HP + + if test "$kde_cv_stl_type_hp" = "no"; then + AC_MSG_ERROR("no known STL type found - did you forget to install libstdc++[-devel] ?") + fi + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN(AC_FIND_QIMGIO, + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include <qimageio.h> +#include <qstring.h> +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN(KDE_CHECK_ANSI, +[ +]) + +AC_DEFUN(KDE_CHECK_INSURE, +[ + AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], + [ + if test $enableval = "no"; dnl + then ac_use_insure="no" + else ac_use_insure="yes" + fi + ], [ac_use_insure="no"]) + + AC_MSG_CHECKING(if we will use Insure++ to debug) + AC_MSG_RESULT($ac_use_insure) + if test "$ac_use_insure" = "yes"; dnl + then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? + fi +]) + +AC_DEFUN(AM_DISABLE_LIBRARIES, +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN(AC_CHECK_UTMP_FILE, +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN(KDE_CREATE_SUBDIRSLIST, +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + TOPSUBDIRS="" + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +else + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN(KDE_CHECK_NAMESPACES, +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_NEWLIBS, +[ + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_S_ISSOCK, +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_LANG_SAVE +AC_LANG_C +AC_TRY_LINK( +[ +#include <sys/stat.h> +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +AC_LANG_C +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include <sys/param.h> +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN(KDE_CHECK_HEADER, +[ + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER($1, $2, $3, $4) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_HEADERS, +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_FAST_CONFIGURE, +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN(KDE_CONF_FILES, +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +AC_DEFUN(KDE_SET_PREFIX, +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superflous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN(KDE_LANG_CPLUSPLUS, +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN(KDE_CHECK_LONG_LONG, +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN(KDE_CHECK_LIB, +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN(KDE_JAVA_PREFIX, +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN(KDE_CHECK_JAVA_DIR, +[ + +AC_ARG_WITH(java, +[ --with-java=javadir use java installed in javadir, --without-java disables ], +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> look in $PATH + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + javadirs="$javadirs $dir" + done + IFS=$kde_save_IFS + jredirs= + + for dir in $javadirs; do + if test ! -d $dir; then break; fi + if test -x "$dir/java"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + done + + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + + else + JAVAC= + jni_includes= + fi + + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include <jni.h> + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +else # no + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. (matz@kde.org) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], [mm_car($2)])$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN(KDE_NEED_FLEX, +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN(AC_PATH_QTOPIA, +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + [ --with-qtopia-dir=DIR where the root of Qtopia is installed ], + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qpe/qpeapplication.h> +#include <qpe/version.h> + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN(KDE_INIT_DOXYGEN, +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN(AC_FIND_BZIP2, +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include<bzlib.h> +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include<bzlib.h> + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(KDE_CHECK_SSL, +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + [ --with-ssl-dir=DIR where the root of OpenSSL is installed], + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + [ --without-ssl disable SSL checks], + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + AC_LANG_SAVE + AC_LANG_C + + ac_cflags_safe="$CFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CFLAGS="$CFLAGS -I$ssl_incdir $all_includes" + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + CFLAGS="$ac_cflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + AC_LANG_SAVE + AC_LANG_C + + cat >conftest.$ac_ext <<EOF +#include <openssl/opensslv.h> +#include <stdio.h> + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_compile='${CC-gcc} $CFLAGS -I$ac_ssl_includes conftest.$ac_ext -o conftest' + if AC_TRY_EVAL(ac_compile); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <faure@kde.org>, attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <faure@kde.org>, attaching your config.log]) + fi + + AC_LANG_RESTORE + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +if test "$ssl_includes" = "/usr/include" || test "$ssl_includes" = "/usr/local/include" || test -z "$ssl_includes"; then + SSL_INCLUDES=""; +else + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN(KDE_CHECK_STRLCPY, +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail kde-devel@kde.org with a description of your system! + ]) + ]) +]) + +AC_DEFUN(KDE_CHECK_BINUTILS, +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 47 AC_PROG_LIBTOOL + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([LT_AC_PROG_SED])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +[$]* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 32"*) + LINUX_64_MODE="32" + ;; + *"ELF 64"*) + LINUX_64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $3" + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + if (eval $ac_compile 2>conftest.err) && test -s $ac_outfile; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + CFLAGS="$save_CFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $host_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + ifelse([$1],[],[save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"], + [$1],[CXX],[save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -o out/conftest2.$ac_objext"], + [$1],[GCJ],[save_GCJFLAGS="$GCJFLAGS" + GCJFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + if (eval $ac_compile 2>out/conftest.err) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + # Append any errors to the config.log. + cat out/conftest.err 1>&AS_MESSAGE_LOG_FD + else + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + ifelse([$1],[],[CFLAGS="$save_CFLAGS"], + [$1],[CXX],[CXXFLAGS="$save_CXXFLAGS"], + [$1],[GCJ],[GCJFLAGS="$save_GCJFLAGS"]) + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)"; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://"` + if echo "$sys_lib_search_path_spec" | [egrep ';[C-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + if test "$host_cpu" = ia64; then + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + else + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + fi + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags=TAGS], + [include additional configurations @<:@CXX,GCJ@:>@])], + [tagnames="$withval"], + [tagnames="CXX,GCJ" + case $host_os in + mingw*|cygwin*) tagnames="$tagnames,RC" ;; + esac]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + AC_LIBTOOL_LANG_CXX_CONFIG + ;; + + GCJ) + AC_LIBTOOL_LANG_GCJ_CONFIG + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + available_tags="$available_tags $tagname" + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +])# AC_PROG_LD + + +# AC_PROG_LD_GNU +# -------------- +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + if test "$host_cpu" = ia64; then + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + else + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + fi + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ("$tmp_nm" -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ("$tmp_nm" -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([AC_PROG_RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C test sources. +ac_ext=cc + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int char *[]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${CXX-"c++"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ + egrep 'GNU ld' > /dev/null; then + with_gnu_ld=yes + + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + egrep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux*) + if test $with_gnu_ld = no; then + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + fi + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + # NetBSD uses g++ - do we need to do anything? + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | egrep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# Figure out "hidden" C++ library dependencies from verbose +# compiler output whening linking a shared library. +cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF + + +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then + _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext|*.$libext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then + _LT_AC_TAGVAR(predep_objects, $1)="$p" + else + _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then + _LT_AC_TAGVAR(postdep_objects, $1)="$p" + else + _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out +else + echo "libtool.m4: error: problem compiling C++ test program" +fi + +$rm -f confest.$objext + +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ;; +esac + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_CXX_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for C test sources. +ac_ext=java + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A sed program that does not truncate output. +SED=$lt_SED + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "$cfgfile" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments + _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments + _LT_AC_FILE_IMPGEN_C +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions -c conftest.$ac_ext], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + cygwin* | mingw* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + if test "x$host_vendor" = xsni; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-LD' + else + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + fi + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -DPIC], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -DPIC" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + cygwin* | mingw* | pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an egrep regular expression of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + ;; + esac + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && strip -s $export_symbols' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9* | hpux10* | hpux11*) + if test "$GCC" = yes; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + esac + else + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + ;; + esac + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + if test "x$host_vendor" = xsni; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac +fi +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_FILE_IMPGEN_C +# -------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_IMPGEN_C], [ +# /* impgen.c starts here */ +# /* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ +])# _LT_AC_FILE_IMPGEN_C + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break; + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 10000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" +]) +AC_MSG_RESULT([$SED]) +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +AC_PREREQ([2.54]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[_am_stamp_count=`expr ${_am_stamp_count-0} + 1` +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.7.2])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST(am__include) +AC_SUBST(am__quote) +AC_MSG_RESULT($_am_result) +rm -f confinc confmf +]) + + +# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +AC_PREREQ(2.50) + +# AM_PROG_LEX +# ----------- +# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a +# "missing" invocation, for better error output. +AC_DEFUN([AM_PROG_LEX], +[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl +AC_REQUIRE([AC_PROG_LEX])dnl +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..5287984 --- /dev/null +++ b/config.h.in @@ -0,0 +1,199 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the <crt_externs.h> header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Define to 1 if you have the <pthread/linuxthreads/pthread.h> header file. + */ +#undef HAVE_PTHREAD_LINUXTHREADS_PTHREAD_H + +/* Define if you have the res_init function */ +#undef HAVE_RES_INIT + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of a `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of a `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif + + + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#endif + + + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#endif + + + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* Compatibility define */ +#undef ksize_t + +/* Define the real type of socklen_t */ +#undef socklen_t diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..4d9b50a --- /dev/null +++ b/configure.in @@ -0,0 +1,525 @@ +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +# Original Author was Kalle@kde.org +# I lifted it in some mater. (Stephan Kulow) +# I used much code from Janos Farkas + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(acinclude.m4) dnl a source file from your sub dir + +AC_PREREQ(2.50) + +dnl This is so we can use kde-common +AC_CONFIG_AUX_DIR(admin) + +dnl This ksh/zsh feature conflicts with `cd blah ; pwd` +unset CDPATH + +dnl Checking host/target/build systems, for make, install etc. +AC_CANONICAL_BUILD +dnl Perform program name transformation +AC_ARG_PROGRAM + +dnl Automake doc recommends to do this only here. (Janos) +AM_INIT_AUTOMAKE(PerlQt, 3.008) dnl searches for some needed programs + +KDE_SET_PREFIX + +dnl generate the config header +AM_CONFIG_HEADER(config.h) dnl at the distribution this done + +dnl Checks for programs. +AC_CHECK_COMPILERS +AC_ENABLE_SHARED(yes) +AC_ENABLE_STATIC(no) +KDE_PROG_LIBTOOL + +dnl for NLS support. Call them in this order! +dnl WITH_NLS is for the po files +dnl AM_KDE_WITH_NLS + +KDE_USE_QT(3.0) + + +dnl ------------------------------------------------------------------------ +dnl Reimplementation of AC_BASE_PATH_KDE avoiding the need for +dnl a prefix pointing to KDEDIR. +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if any) +dnl and $(kde_includes) will be the kdehdrlocation (if any) +dnl ------------------------------------------------------------------------ +dnl + +AC_DEFUN(AC_BASE_PATH_INSTALL, +[ +AC_PREREQ([2.13]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +dnl PQT +AC_MSG_CHECKING([for KDE or an Install directory]) +dnl /PQT +if test "${prefix}" != NONE; then + kde_includes=${prefix}/include + ac_kde_includes=$prefix/include + + if test "${exec_prefix}" != NONE; then + kde_libraries=${libdir} + ac_kde_libraries=$libdir + if test "$ac_kde_libraries" = '${exec_prefix}/lib'${kdelibsuff}; then + ac_kde_libraries=$exec_prefix/lib${kdelibsuff} + fi + else + kde_libraries=${prefix}/lib${kdelibsuff} + ac_kde_libraries=$prefix/lib${kdelibsuff} + fi +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +dnl PQT +kde_check_header="kdeversion.h" +kde_check_lib="libkdefx.la" +dnl /PQT + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then +dnl PQT + AC_MSG_WARN([ +in the prefix, you've chosen, are no KDE headers installed.]) +dnl /PQT +fi + +kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +dnl PQT +AC_MSG_WARN([ +in the prefix, you've chosen, are no KDE libraries installed.]) +dnl /PQT +fi +dnl PQT +dnl if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +dnl AC_MSG_ERROR([ +dnl I can't find the designer plugins. These are required and should have been installed +dnl by kdelibs]) +dnl fi +dnl /PQT + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + + + + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" +dnl PQT + AC_MSG_RESULT([will use $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will use $ac_kde_prefix and $ac_kde_exec_prefix]) +dnl /PQT + fi + + kde_libraries="${libdir}" + kde_includes=${ac_kde_prefix}/include + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_LDFLAGS="-L$kde_libraries" +dnl PQT +if test "$kde_libraries" != "$x_libraries" && test "$kde_libraries" != "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi +dnl /PQT + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_SUBST(AUTODIRS) + +]) + +dnl------------------------------- +dnl +dnl Check for the SMOKE Library +dnl +dnl------------------------------- + +AC_DEFUN(KDE_CHECK_SMOKE, +[ +AC_MSG_CHECKING(for SmokeQt) +AC_CACHE_VAL(kde_have_smokeqt, +[ + + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + kde_ldpath_save="$LD_LIBRARY_PATH" + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + LIBS="-lsmokeqt" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + LD_LIBRARY_PATH="$qt_libraries" + + AC_TRY_LINK([ +#include <smoke.h> + + ], + [ + Smoke::Index i; + ], + kde_have_smokeqt=yes, + kde_have_smokeqt=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe + LD_LIBRARY_PATH=$kde_ldpath_save +]) + +AC_LANG_RESTORE + +AC_MSG_RESULT($kde_have_smokeqt) + +$1=$kde_have_smokeqt +]) + + +dnl @synopsis MDL_HAVE_OPENGL +dnl +dnl Search for OpenGL. We search first for Mesa (a GPL'ed version of +dnl OpenGL) before a vendor's version of OpenGL, unless we were +dnl specifically asked not to with `--with-Mesa=no' or `--without-Mesa'. +dnl +dnl The four "standard" OpenGL libraries are searched for: "-lGL", +dnl "-lGLU", "-lGLX" (or "-lMesaGL", "-lMesaGLU" as the case may be) and +dnl "-lglut". +dnl +dnl All of the libraries that are found (since "-lglut" or "-lGLX" might +dnl be missing) are added to the shell output variable "GL_LIBS", along +dnl with any other libraries that are necessary to successfully link an +dnl OpenGL application (e.g. the X11 libraries). Care has been taken to +dnl make sure that all of the libraries in "GL_LIBS" are listed in the +dnl proper order. +dnl +dnl Additionally, the shell output variable "GL_CFLAGS" is set to any +dnl flags (e.g. "-I" flags) that are necessary to successfully compile +dnl an OpenGL application. +dnl +dnl The following shell variable (which are not output variables) are +dnl also set to either "yes" or "no" (depending on which libraries were +dnl found) to help you determine exactly what was found. +dnl +dnl have_GL +dnl have_GLU +dnl have_GLX +dnl have_glut +dnl +dnl A complete little toy "Automake `make distcheck'" package of how to +dnl use this macro is available at: +dnl +dnl ftp://ftp.slac.stanford.edu/users/langston/autoconf/ac_opengl-0.01.tar.gz +dnl +dnl Please note that as the ac_opengl macro and the toy example evolves, +dnl the version number increases, so you may have to adjust the above +dnl URL accordingly. +dnl +dnl @version 0.01 $Id: configure.in,v 1.18 2003/09/07 14:18:50 germaingarand Exp $ +dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU> + +AC_DEFUN(MDL_HAVE_OPENGL, +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_PATH_X]) + AC_REQUIRE([AC_PATH_XTRA]) + AC_REQUIRE([MDL_CHECK_LIBM]) + + AC_CACHE_CHECK([for OpenGL], mdl_cv_have_OpenGL, + [ +dnl Check for Mesa first, unless we were asked not to. + AC_HELP_STRING() + AC_ARG_ENABLE(Mesa, [ --with-Mesa Prefer the Mesa library over a vendors native OpenGL library (default=yes)], + , use_Mesa=$enableval + , use_Mesa=yes) + + if test x"$use_Mesa" = xyes; then + GL_search_list="MesaGL GL" + GLU_search_list="MesaGLU GLU" + GLX_search_list="MesaGLX GLX" + else + GL_search_list="GL MesaGL" + GLU_search_list="GLU MesaGLU" + GLX_search_list="GLX MesaGLX" + fi + + AC_LANG_SAVE + AC_LANG_C + +dnl If we are running under X11 then add in the appropriate libraries. + if test x"$no_x" != xyes; then +dnl Add everything we need to compile and link X programs to GL_CFLAGS +dnl and GL_X_LIBS. + GL_CFLAGS="$X_CFLAGS" + GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM" + fi + GL_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$GL_CFLAGS" + + GL_save_LIBS="$LIBS" + LIBS="$GL_X_LIBS" + + # Save the "AC_MSG_RESULT file descriptor" to FD 8. + exec 8>&AC_FD_MSG + + # Temporarily turn off AC_MSG_RESULT so that the user gets pretty + # messages. + exec AC_FD_MSG>/dev/null + + AC_SEARCH_LIBS(glAccum, $GL_search_list, have_GL=yes, have_GL=no) + AC_SEARCH_LIBS(gluBeginCurve, $GLU_search_list, have_GLU=yes, have_GLU=no) + AC_SEARCH_LIBS(glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no) + AC_SEARCH_LIBS(glutInit, glut, have_glut=yes, have_glut=no) + + # Restore pretty messages. + exec AC_FD_MSG>&8 + + if test -n "$LIBS"; then + mdl_cv_have_OpenGL=yes + GL_LIBS="$LIBS" + AC_SUBST(GL_CFLAGS) + AC_SUBST(GL_LIBS) + else + mdl_cv_have_OpenGL=no + GL_CFLAGS= + fi + +dnl Reset GL_X_LIBS regardless, since it was just a temporary variable +dnl and we don't want to be global namespace polluters. + GL_X_LIBS= + + LIBS="$GL_save_LIBS" + CPPFLAGS="$GL_save_CPPFLAGS" + + AC_LANG_RESTORE + ]) +]) + +dnl ####################### -*- Mode: M4 -*- ########################### +dnl Copyright (C) 98, 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU> +dnl +dnl This file is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This file is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this file; if not, write to: +dnl +dnl Free Software Foundation, Inc. +dnl Suite 330 +dnl 59 Temple Place +dnl Boston, MA 02111-1307, USA. +dnl #################################################################### + + +dnl @synopsis MDL_CHECK_LIBM +dnl +dnl Search for math library (typically -lm). +dnl +dnl The variable LIBM (which is not an output variable by default) is +dnl set to a value which is suitable for use in a Makefile (for example, +dnl in make's LOADLIBES macro) provided you AC_SUBST it first. +dnl +dnl @version 0.01 $Id: configure.in,v 1.18 2003/09/07 14:18:50 germaingarand Exp $ +dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU> + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(MDL_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$host" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +dnl PACKAGE set before + +AC_BASE_PATH_INSTALL +#MIN_CONFIG(3) + +HAVE_SMOKE="no" +KDE_CHECK_SMOKE(HAVE_SMOKE) + +AC_ARG_ENABLE( + smoke, + [ --enable-smoke generate libsmoke, even if it has been found on your system], + kde_force_smoke=$enableval, + kde_force_smoke=no +) + +AC_ARG_ENABLE( + GL, + [ --disable-GL do not try to compile Qt's OpenGL module in smoke], + kde_enable_GL=$enableval, + kde_enable_GL=yes +) + +KDE_HAVE_GL="no" + +if test "$HAVE_SMOKE" = "yes" && test "$kde_force_smoke" = "no"; then + DO_NOT_COMPILE="$DO_NOT_COMPILE smoke" +else + if test "X$kde_enable_GL" = "Xyes"; then + dnl check for OpenGL + MDL_HAVE_OPENGL + have_gl_headers="no" + AC_CHECK_HEADER([GL/gl.h], + [ AC_CHECK_HEADER([GL/glu.h], [have_gl_headers="yes"])]) + if test "X$have_GL" = "Xyes" && test "X$have_GLU" = "Xyes" && test "X$have_gl_headers" = "Xyes"; then + KDE_HAVE_GL="yes" + fi + fi +fi + +AC_SUBST(KDE_HAVE_GL) + +KDE_CREATE_SUBDIRSLIST +AC_SUBST(USE_RPATH) + +AC_CONFIG_FILES(PerlQt/Makefile.PL, [cd PerlQt && perl Makefile.PL INSTALLDIRS=vendor && cd ..]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([puic/Makefile]) + +AC_ARG_WITH( + threshold, + [ --with-threshold[=ARG] Qt tests threshold ARG=[0..15] Default:14 Lower=more tests], + [ qt_test_threshold="$withval" ], + [ qt_test_threshold=14 ] +) +AC_SUBST(qt_test_threshold) + + +if test "$HAVE_SMOKE" = "no" || test "$kde_force_smoke" != "no"; then + AC_CONFIG_FILES(smoke/qt/qtguess.pl, [cd smoke/qt && perl qtguess.pl && cd ../..] ) + AC_CONFIG_FILES(smoke/qt/generate.pl, [cd smoke/qt && perl generate.pl && cd ../..]) + AC_CONFIG_FILES([smoke/Makefile]) + AC_CONFIG_FILES([smoke/qt/Makefile]) +fi + +AC_OUTPUT + +all_tests=fine + +dnl +dnl latest tests goes here +dnl + + +if test "$all_tests" = "fine"; then + echo "" + echo "Good - your configure finished. Start make now" + echo "" +fi diff --git a/cvs2cl.pl b/cvs2cl.pl new file mode 100644 index 0000000..686ffe1 --- /dev/null +++ b/cvs2cl.pl @@ -0,0 +1,2337 @@ +#!/bin/sh +exec perl -w -x $0 ${1+"$@"} # -*- mode: perl; perl-indent-level: 2; -*- +#!perl -w + + +############################################################## +### ### +### cvs2cl.pl: produce ChangeLog(s) from `cvs log` output. ### +### ### +############################################################## + +## $Revision: 1.1 $ +## $Date: 2003/09/09 09:45:39 $ +## $Author: germaingarand $ +## +## (C) 2001,2002,2003 Martyn J. Pearce <fluffy@cpan.org>, under the GNU GPL. +## (C) 1999 Karl Fogel <kfogel@red-bean.com>, under the GNU GPL. +## +## (Extensively hacked on by Melissa O'Neill <oneill@cs.sfu.ca>.) +## (Gecos hacking by Robin Johnson <robbat2@orbis-terrarum.net>.) +## +## cvs2cl.pl is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## cvs2cl.pl is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You may have received a copy of the GNU General Public License +## along with cvs2cl.pl; see the file COPYING. If not, write to the +## Free Software Foundation, Inc., 59 Temple Place - Suite 330, +## Boston, MA 02111-1307, USA. + + +use strict; +use Text::Wrap; +use Time::Local; +use File::Basename qw( fileparse ); +use User::pwent; + + +# The Plan: +# +# Read in the logs for multiple files, spit out a nice ChangeLog that +# mirrors the information entered during `cvs commit'. +# +# The problem presents some challenges. In an ideal world, we could +# detect files with the same author, log message, and checkin time -- +# each <filelist, author, time, logmessage> would be a changelog entry. +# We'd sort them; and spit them out. Unfortunately, CVS is *not atomic* +# so checkins can span a range of times. Also, the directory structure +# could be hierarchical. +# +# Another question is whether we really want to have the ChangeLog +# exactly reflect commits. An author could issue two related commits, +# with different log entries, reflecting a single logical change to the +# source. GNU style ChangeLogs group these under a single author/date. +# We try to do the same. +# +# So, we parse the output of `cvs log', storing log messages in a +# multilevel hash that stores the mapping: +# directory => author => time => message => filelist +# As we go, we notice "nearby" commit times and store them together +# (i.e., under the same timestamp), so they appear in the same log +# entry. +# +# When we've read all the logs, we twist this mapping into +# a time => author => message => filelist mapping for each directory. +# +# If we're not using the `--distributed' flag, the directory is always +# considered to be `./', even as descend into subdirectories. + + +############### Globals ################ + +use constant MAILNAME => "/etc/mailname"; + +# What we run to generate it: +my $Log_Source_Command = "cvs log"; + +# In case we have to print it out: +my $VERSION = '$Revision: 1.1 $'; +$VERSION =~ s/\S+\s+(\S+)\s+\S+/$1/; + +## Vars set by options: + +# Print debugging messages? +my $Debug = 0; + +# Just show version and exit? +my $Print_Version = 0; + +# Just print usage message and exit? +my $Print_Usage = 0; + +# Single top-level ChangeLog, or one per subdirectory? +my $Distributed = 0; + +# What file should we generate (defaults to "ChangeLog")? +my $Log_File_Name = "ChangeLog"; + +# Grab most recent entry date from existing ChangeLog file, just add +# to that ChangeLog. +my $Cumulative = 0; + +# `cvs log -d`, this will repeat the last entry in the old log. This is OK, +# as it guarantees at least one entry in the update changelog, which means +# that there will always be a date to extract for the next update. The repeat +# entry can be removed in postprocessing, if necessary. +my $Update = 0; + +# Expand usernames to email addresses based on a map file? +my $User_Map_File = ""; +my $User_Passwd_File; +my $Mail_Domain; + +# Output log in chronological order? [default is reverse chronological order] +my $Chronological_Order = 0; + +# Grab user details via gecos +my $Gecos = 0; + +# User domain for gecos email addresses +my $Domain = ""; + +# Output to a file or to stdout? +my $Output_To_Stdout = 0; + +# Eliminate empty log messages? +my $Prune_Empty_Msgs = 0; + +# Tags of which not to output +my %ignore_tags; + +# Show only revisions with Tags +my %show_tags; + +# Don't call Text::Wrap on the body of the message +my $No_Wrap = 0; + +# Don't do any pretty print processing +my $Summary = 0; + +# Separates header from log message. Code assumes it is either " " or +# "\n\n", so if there's ever an option to set it to something else, +# make sure to go through all conditionals that use this var. +my $After_Header = " "; + +# XML Encoding +my $XML_Encoding = ''; + +# Format more for programs than for humans. +my $XML_Output = 0; + +# Do some special tweaks for log data that was written in FSF +# ChangeLog style. +my $FSF_Style = 0; + +# Show times in UTC instead of local time +my $UTC_Times = 0; + +# Show times in output? +my $Show_Times = 1; + +# Show day of week in output? +my $Show_Day_Of_Week = 0; + +# Show revision numbers in output? +my $Show_Revisions = 0; + +# Show dead files in output? +my $Show_Dead = 0; + +# Show tags (symbolic names) in output? +my $Show_Tags = 0; + +# Show tags separately in output? +my $Show_Tag_Dates = 0; + +# Show branches by symbolic name in output? +my $Show_Branches = 0; + +# Show only revisions on these branches or their ancestors. +my @Follow_Branches; + +# Don't bother with files matching this regexp. +my @Ignore_Files; + +# How exactly we match entries. We definitely want "o", +# and user might add "i" by using --case-insensitive option. +my $Case_Insensitive = 0; + +# Maybe only show log messages matching a certain regular expression. +my $Regexp_Gate = ""; + +# Pass this global option string along to cvs, to the left of `log': +my $Global_Opts = ""; + +# Pass this option string along to the cvs log subcommand: +my $Command_Opts = ""; + +# Read log output from stdin instead of invoking cvs log? +my $Input_From_Stdin = 0; + +# Don't show filenames in output. +my $Hide_Filenames = 0; + +# Don't shorten directory names from filenames. +my $Common_Dir = 1; + +# Max checkin duration. CVS checkin is not atomic, so we may have checkin +# times that span a range of time. We assume that checkins will last no +# longer than $Max_Checkin_Duration seconds, and that similarly, no +# checkins will happen from the same users with the same message less +# than $Max_Checkin_Duration seconds apart. +my $Max_Checkin_Duration = 180; + +# What to put at the front of [each] ChangeLog. +my $ChangeLog_Header = ""; + +# Whether to enable 'delta' mode, and for what start/end tags. +my $Delta_Mode = 0; +my $Delta_From = ""; +my $Delta_To = ""; + +my $TestCode; + +# Whether to parse filenames from the RCS filename, and if so what +# prefix to strip. +my $RCS_Mode = 0; +my $RCS_Root = ""; + +## end vars set by options. + +# latest observed times for the start/end tags in delta mode +my $Delta_StartTime = 0; +my $Delta_EndTime = 0; + +# In 'cvs log' output, one long unbroken line of equal signs separates +# files: +my $file_separator = "=======================================" + . "======================================"; + +# In 'cvs log' output, a shorter line of dashes separates log messages +# within a file: +my $logmsg_separator = "----------------------------"; + +my $No_Ancestors = 0; + +############### End globals ############ + + + +&parse_options (); +if ( defined $TestCode ) { + eval $TestCode; + die "Eval failed: '$@'\n" + if $@; +} else { + &derive_change_log (); +} + + +### Everything below is subroutine definitions. ### + +sub run_ext { + my ($cmd) = @_; + $cmd = [$cmd] + unless ref $cmd; + local $" = ' '; + my $out = qx"@$cmd 2>&1"; + my $rv = $?; + my ($sig, $core, $exit) = ($? & 127, $? & 128, $? >> 8); + return $out, $exit, $sig, $core; +} + +# If accumulating, grab the boundary date from pre-existing ChangeLog. +sub maybe_grab_accumulation_date () +{ + if (! $Cumulative || $Update) { + return ""; + } + + # else + + open (LOG, "$Log_File_Name") + or die ("trouble opening $Log_File_Name for reading ($!)"); + + my $boundary_date; + while (<LOG>) + { + if (/^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) + { + $boundary_date = "$1"; + last; + } + } + + close (LOG); + return $boundary_date; +} + +# Fills up a ChangeLog structure in the current directory. +sub derive_change_log () +{ + # See "The Plan" above for a full explanation. + + my %grand_poobah; + + my $file_full_path; + my $time; + my $revision; + my $author; + my $state; + my $lines; + my $cvsstate; + my $msg_txt; + my $detected_file_separator; + + my %tag_date_printed; + + # Might be adding to an existing ChangeLog + my $accumulation_date = &maybe_grab_accumulation_date (); + if ($accumulation_date) { + # Insert -d immediately after 'cvs log' + my $Log_Date_Command = "-d\'>${accumulation_date}\'"; + $Log_Source_Command =~ s/(^.*log\S*)/$1 $Log_Date_Command/; + &debug ("(adding log msg starting from $accumulation_date)\n"); + } + + # We might be expanding usernames + my %usermap; + + # In general, it's probably not very maintainable to use state + # variables like this to tell the loop what it's doing at any given + # moment, but this is only the first one, and if we never have more + # than a few of these, it's okay. + my $collecting_symbolic_names = 0; + my %symbolic_names; # Where tag names get stored. + my %branch_names; # We'll grab branch names while we're at it. + my %branch_numbers; # Save some revisions for @Follow_Branches + my @branch_roots; # For showing which files are branch ancestors. + + # Bleargh. Compensate for a deficiency of custom wrapping. + if (($After_Header ne " ") and $FSF_Style) + { + $After_Header .= "\t"; + } + + if (! $Input_From_Stdin) { + &debug ("(run \"${Log_Source_Command}\")\n"); + open (LOG_SOURCE, "$Log_Source_Command |") + or die "unable to run \"${Log_Source_Command}\""; + } + else { + open (LOG_SOURCE, "-") or die "unable to open stdin for reading"; + } + + binmode LOG_SOURCE; + + %usermap = &maybe_read_user_map_file (); + + while (<LOG_SOURCE>) + { + # Canonicalize line endings + s/\r$//; + my $new_full_path; + + # If on a new file and don't see filename, skip until we find it, and + # when we find it, grab it. + if (! (defined $file_full_path)) + { + if (/^Working file: (.*)/) { + $new_full_path = $1; + } elsif ($RCS_Mode && m|^RCS file: $RCS_Root/(.*),v$|) { + $new_full_path = $1; + } + } + + if (defined $new_full_path) + { + $file_full_path = $new_full_path; + if (@Ignore_Files) + { + my $base; + ($base, undef, undef) = fileparse ($file_full_path); + # Ouch, I wish trailing operators in regexps could be + # evaluated on the fly! + if ($Case_Insensitive) { + if (grep ($file_full_path =~ m|$_|i, @Ignore_Files)) { + undef $file_full_path; + } + } + elsif (grep ($file_full_path =~ m|$_|, @Ignore_Files)) { + undef $file_full_path; + } + } + next; + } + + # Just spin wheels if no file defined yet. + next if (! $file_full_path); + + # Collect tag names in case we're asked to print them in the output. + if (/^symbolic names:$/) { + $collecting_symbolic_names = 1; + next; # There's no more info on this line, so skip to next + } + if ($collecting_symbolic_names) + { + # All tag names are listed with whitespace in front in cvs log + # output; so if see non-whitespace, then we're done collecting. + if (/^\S/) { + $collecting_symbolic_names = 0; + } + else # we're looking at a tag name, so parse & store it + { + # According to the Cederqvist manual, in node "Tags", tag + # names must start with an uppercase or lowercase letter and + # can contain uppercase and lowercase letters, digits, `-', + # and `_'. However, it's not our place to enforce that, so + # we'll allow anything CVS hands us to be a tag: + /^\s+([^:]+): ([\d.]+)$/; + my $tag_name = $1; + my $tag_rev = $2; + + # A branch number either has an odd number of digit sections + # (and hence an even number of dots), or has ".0." as the + # second-to-last digit section. Test for these conditions. + my $real_branch_rev = ""; + if (($tag_rev =~ /^(\d+\.\d+\.)+\d+$/) # Even number of dots... + and (! ($tag_rev =~ /^(1\.)+1$/))) # ...but not "1.[1.]1" + { + $real_branch_rev = $tag_rev; + } + elsif ($tag_rev =~ /(\d+\.(\d+\.)+)0.(\d+)/) # Has ".0." + { + $real_branch_rev = $1 . $3; + } + # If we got a branch, record its number. + if ($real_branch_rev) + { + $branch_names{$real_branch_rev} = $tag_name; + if (@Follow_Branches) { + if (grep ($_ eq $tag_name, @Follow_Branches)) { + $branch_numbers{$tag_name} = $real_branch_rev; + } + } + } + else { + # Else it's just a regular (non-branch) tag. + push (@{$symbolic_names{$tag_rev}}, $tag_name); + } + } + } + # End of code for collecting tag names. + + # If have file name, but not revision, and see revision, then grab + # it. (We collect unconditionally, even though we may or may not + # ever use it.) + if ((! (defined $revision)) and (/^revision (\d+\.[\d.]+)/)) + { + $revision = $1; + + if (@Follow_Branches) + { + foreach my $branch (@Follow_Branches) + { + # Special case for following trunk revisions + if (($branch =~ /^trunk$/i) and ($revision =~ /^[0-9]+\.[0-9]+$/)) + { + goto dengo; + } + + my $branch_number = $branch_numbers{$branch}; + if ($branch_number) + { + # Are we on one of the follow branches or an ancestor of + # same? + # + # If this revision is a prefix of the branch number, or + # possibly is less in the minormost number, OR if this + # branch number is a prefix of the revision, then yes. + # Otherwise, no. + # + # So below, we determine if any of those conditions are + # met. + + # Trivial case: is this revision on the branch? + # (Compare this way to avoid regexps that screw up Emacs + # indentation, argh.) + if ((substr ($revision, 0, ((length ($branch_number)) + 1))) + eq ($branch_number . ".")) + { + goto dengo; + } + # Non-trivial case: check if rev is ancestral to branch + elsif ((length ($branch_number)) > (length ($revision)) + and + $No_Ancestors) + { + $revision =~ /^((?:\d+\.)+)(\d+)$/; + my $r_left = $1; # still has the trailing "." + my $r_end = $2; + + $branch_number =~ /^((?:\d+\.)+)(\d+)\.\d+$/; + my $b_left = $1; # still has trailing "." + my $b_mid = $2; # has no trailing "." + + if (($r_left eq $b_left) + && ($r_end <= $b_mid)) + { + goto dengo; + } + } + } + } + } + else # (! @Follow_Branches) + { + next; + } + + # Else we are following branches, but this revision isn't on the + # path. So skip it. + undef $revision; + dengo: + next; + } + + # If we don't have a revision right now, we couldn't possibly + # be looking at anything useful. + if (! (defined ($revision))) { + $detected_file_separator = /^$file_separator$/o; + if ($detected_file_separator) { + # No revisions for this file; can happen, e.g. "cvs log -d DATE" + goto CLEAR; + } + else { + next; + } + } + + # If have file name but not date and author, and see date or + # author, then grab them: + unless (defined $time) + { + if (/^date: .*/) + { + ($time, $author, $state, $lines) = + &parse_date_author_and_state ($_); + if (defined ($usermap{$author}) and $usermap{$author}) { + $author = $usermap{$author}; + } elsif($Domain ne "" or $Gecos == 1) { + my $email = $author; + if($Domain ne "") { + $email = $author."@".$Domain; + } + my $pw = getpwnam($author); + my $fullname; + my $office; + my $workphone; + my $homephone; + for (($fullname, $office, $workphone, $homephone) = split /\s*,\s*/, $pw->gecos) { + s/&/ucfirst(lc($pw->name))/ge; + } + if($fullname ne "") { + $author = $fullname . " <" . $email . ">"; + } + } + } + else { + $detected_file_separator = /^$file_separator$/o; + if ($detected_file_separator) { + # No revisions for this file; can happen, e.g. "cvs log -d DATE" + goto CLEAR; + } + } + # If the date/time/author hasn't been found yet, we couldn't + # possibly care about anything we see. So skip: + next; + } + + # A "branches: ..." line here indicates that one or more branches + # are rooted at this revision. If we're showing branches, then we + # want to show that fact as well, so we collect all the branches + # that this is the latest ancestor of and store them in + # @branch_roots. Just for reference, the format of the line we're + # seeing at this point is: + # + # branches: 1.5.2; 1.5.4; ...; + # + # Okay, here goes: + + if (/^branches:\s+(.*);$/) + { + if ($Show_Branches) + { + my $lst = $1; + $lst =~ s/(1\.)+1;|(1\.)+1$//; # ignore the trivial branch 1.1.1 + if ($lst) { + @branch_roots = split (/;\s+/, $lst); + } + else { + undef @branch_roots; + } + next; + } + else + { + # Ugh. This really bothers me. Suppose we see a log entry + # like this: + # + # ---------------------------- + # revision 1.1 + # date: 1999/10/17 03:07:38; author: jrandom; state: Exp; + # branches: 1.1.2; + # Intended first line of log message begins here. + # ---------------------------- + # + # The question is, how we can tell the difference between that + # log message and a *two*-line log message whose first line is + # + # "branches: 1.1.2;" + # + # See the problem? The output of "cvs log" is inherently + # ambiguous. + # + # For now, we punt: we liberally assume that people don't + # write log messages like that, and just toss a "branches:" + # line if we see it but are not showing branches. I hope no + # one ever loses real log data because of this. + next; + } + } + + # If have file name, time, and author, then we're just grabbing + # log message texts: + $detected_file_separator = /^$file_separator$/o; + if ($detected_file_separator && ! (defined $revision)) { + # No revisions for this file; can happen, e.g. "cvs log -d DATE" + goto CLEAR; + } + unless ($detected_file_separator || /^$logmsg_separator$/o) + { + $msg_txt .= $_; # Normally, just accumulate the message... + next; + } + # ... until a msg separator is encountered: + # Ensure the message contains something: + if ((! $msg_txt) + || ($msg_txt =~ /^\s*\.\s*$|^\s*$/) + || ($msg_txt =~ /\*\*\* empty log message \*\*\*/)) + { + if ($Prune_Empty_Msgs) { + goto CLEAR; + } + # else + $msg_txt = "[no log message]\n"; + } + + ### Store it all in the Grand Poobah: + { + my $dir_key; # key into %grand_poobah + my %qunk; # complicated little jobbie, see below + + # Each revision of a file has a little data structure (a `qunk') + # associated with it. That data structure holds not only the + # file's name, but any additional information about the file + # that might be needed in the output, such as the revision + # number, tags, branches, etc. The reason to have these things + # arranged in a data structure, instead of just appending them + # textually to the file's name, is that we may want to do a + # little rearranging later as we write the output. For example, + # all the files on a given tag/branch will go together, followed + # by the tag in parentheses (so trunk or otherwise non-tagged + # files would go at the end of the file list for a given log + # message). This rearrangement is a lot easier to do if we + # don't have to reparse the text. + # + # A qunk looks like this: + # + # { + # filename => "hello.c", + # revision => "1.4.3.2", + # time => a timegm() return value (moment of commit) + # tags => [ "tag1", "tag2", ... ], + # branch => "branchname" # There should be only one, right? + # branchroots => [ "branchtag1", "branchtag2", ... ] + # } + + if ($Distributed) { + # Just the basename, don't include the path. + ($qunk{'filename'}, $dir_key, undef) = fileparse ($file_full_path); + } + else { + $dir_key = "./"; + $qunk{'filename'} = $file_full_path; + } + + # This may someday be used in a more sophisticated calculation + # of what other files are involved in this commit. For now, we + # don't use it much except for delta mode, because the + # common-commit-detection algorithm is hypothesized to be + # "good enough" as it stands. + $qunk{'time'} = $time; + + # We might be including revision numbers and/or tags and/or + # branch names in the output. Most of the code from here to + # loop-end deals with organizing these in qunk. + + $qunk{'revision'} = $revision; + $qunk{'state'} = $state; + if ( defined( $lines )) { + $qunk{'lines'} = $lines; + } + + # Grab the branch, even though we may or may not need it: + $qunk{'revision'} =~ /((?:\d+\.)+)\d+/; + my $branch_prefix = $1; + $branch_prefix =~ s/\.$//; # strip off final dot + if ($branch_names{$branch_prefix}) { + $qunk{'branch'} = $branch_names{$branch_prefix}; + } + + # Keep a record of the file's cvs state. + $qunk{'cvsstate'} = $state; + + # If there's anything in the @branch_roots array, then this + # revision is the root of at least one branch. We'll display + # them as branch names instead of revision numbers, the + # substitution for which is done directly in the array: + if (@branch_roots) { + my @roots = map { $branch_names{$_} } @branch_roots; + $qunk{'branchroots'} = \@roots; + } + + # Save tags too. + if (defined ($symbolic_names{$revision})) { + $qunk{'tags'} = $symbolic_names{$revision}; + delete $symbolic_names{$revision}; + + # If we're in 'delta' mode, update the latest observed + # times for the beginning and ending tags, and + # when we get around to printing output, we will simply restrict + # ourselves to that timeframe... + + if ($Delta_Mode) { + if (($time > $Delta_StartTime) && + (grep { $_ eq $Delta_From } @{$qunk{'tags'}})) + { + $Delta_StartTime = $time; + } + + if (($time > $Delta_EndTime) && + (grep { $_ eq $Delta_To } @{$qunk{'tags'}})) + { + $Delta_EndTime = $time; + } + } + } + + # Add this file to the list + # (We use many spoonfuls of autovivication magic. Hashes and arrays + # will spring into existence if they aren't there already.) + + &debug ("(pushing log msg for ${dir_key}$qunk{'filename'})\n"); + + # Store with the files in this commit. Later we'll loop through + # again, making sure that revisions with the same log message + # and nearby commit times are grouped together as one commit. + push (@{$grand_poobah{$dir_key}{$author}{$time}{$msg_txt}}, \%qunk); + } + + CLEAR: + # Make way for the next message + undef $msg_txt; + undef $time; + undef $revision; + undef $author; + undef @branch_roots; + + # Maybe even make way for the next file: + if ($detected_file_separator) { + undef $file_full_path; + undef %branch_names; + undef %branch_numbers; + undef %symbolic_names; + } + } + + close (LOG_SOURCE); + + ### Process each ChangeLog + + while (my ($dir,$authorhash) = each %grand_poobah) + { + &debug ("DOING DIR: $dir\n"); + + # Here we twist our hash around, from being + # author => time => message => filelist + # in %$authorhash to + # time => author => message => filelist + # in %changelog. + # + # This is also where we merge entries. The algorithm proceeds + # through the timeline of the changelog with a sliding window of + # $Max_Checkin_Duration seconds; within that window, entries that + # have the same log message are merged. + # + # (To save space, we zap %$authorhash after we've copied + # everything out of it.) + + my %changelog; + while (my ($author,$timehash) = each %$authorhash) + { + my $lasttime; + my %stamptime; + foreach my $time (sort {$main::a <=> $main::b} (keys %$timehash)) + { + my $msghash = $timehash->{$time}; + while (my ($msg,$qunklist) = each %$msghash) + { + my $stamptime = $stamptime{$msg}; + if ((defined $stamptime) + and (($time - $stamptime) < $Max_Checkin_Duration) + and (defined $changelog{$stamptime}{$author}{$msg})) + { + push(@{$changelog{$stamptime}{$author}{$msg}}, @$qunklist); + } + else { + $changelog{$time}{$author}{$msg} = $qunklist; + $stamptime{$msg} = $time; + } + } + } + } + undef (%$authorhash); + + ### Now we can write out the ChangeLog! + + my ($logfile_here, $logfile_bak, $tmpfile); + + if (! $Output_To_Stdout) { + $logfile_here = $dir . $Log_File_Name; + $logfile_here =~ s/^\.\/\//\//; # fix any leading ".//" problem + $tmpfile = "${logfile_here}.cvs2cl$$.tmp"; + $logfile_bak = "${logfile_here}.bak"; + + open (LOG_OUT, ">$tmpfile") or die "Unable to open \"$tmpfile\""; + } + else { + open (LOG_OUT, ">-") or die "Unable to open stdout for writing"; + } + + print LOG_OUT $ChangeLog_Header; + + if ($XML_Output) { + my $encoding = + length $XML_Encoding ? qq'encoding="$XML_Encoding"' : ''; + my $version = 'version="1.0"'; + my $declaration = + sprintf '<?xml %s?>', join ' ', grep length, $version, $encoding; + my $root = + '<changelog xmlns="http://www.red-bean.com/xmlns/cvs2cl/">'; + print LOG_OUT "$declaration\n\n$root\n\n"; + } + + my @key_list = (); + if($Chronological_Order) { + @key_list = sort {$main::a <=> $main::b} (keys %changelog); + } else { + @key_list = sort {$main::b <=> $main::a} (keys %changelog); + } + foreach my $time (@key_list) + { + next if ($Delta_Mode && + (($time <= $Delta_StartTime) || + ($time > $Delta_EndTime && $Delta_EndTime))); + + # Set up the date/author line. + # kff todo: do some more XML munging here, on the header + # part of the entry: + my ($ignore,$min,$hour,$mday,$mon,$year,$wday) + = $UTC_Times ? gmtime($time) : localtime($time); + + # XML output includes everything else, we might as well make + # it always include Day Of Week too, for consistency. + if ($Show_Day_Of_Week or $XML_Output) { + $wday = ("Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday")[$wday]; + $wday = ($XML_Output) ? "<weekday>${wday}</weekday>\n" : " $wday"; + } + else { + $wday = ""; + } + + my $authorhash = $changelog{$time}; + if ($Show_Tag_Dates) { + my %tags; + while (my ($author,$mesghash) = each %$authorhash) { + while (my ($msg,$qunk) = each %$mesghash) { + foreach my $qunkref2 (@$qunk) { + if (defined ($$qunkref2{'tags'})) { + foreach my $tag (@{$$qunkref2{'tags'}}) { + $tags{$tag} = 1; + } + } + } + } + } + foreach my $tag (keys %tags) { + if (!defined $tag_date_printed{$tag}) { + $tag_date_printed{$tag} = $time; + if ($XML_Output) { + # NOT YET DONE + } + else { + if ($Show_Times) { + printf LOG_OUT ("%4u-%02u-%02u${wday} %02u:%02u tag %s\n\n", + $year+1900, $mon+1, $mday, $hour, $min, $tag); + } else { + printf LOG_OUT ("%4u-%02u-%02u${wday} tag %s\n\n", + $year+1900, $mon+1, $mday, $tag); + } + } + } + } + } + while (my ($author,$mesghash) = each %$authorhash) + { + # If XML, escape in outer loop to avoid compound quoting: + if ($XML_Output) { + $author = &xml_escape ($author); + } + + FOOBIE: + # We sort here to enable predictable ordering for the testing porpoises + for my $msg (sort keys %$mesghash) + { + my $qunklist = $mesghash->{$msg}; + + ## MJP: 19.xii.01 : Exclude @ignore_tags + for my $ignore_tag (keys %ignore_tags) { + next FOOBIE + if grep($_ eq $ignore_tag, map(@{$_->{tags}}, + grep(defined $_->{tags}, + @$qunklist))); + } + ## MJP: 19.xii.01 : End exclude @ignore_tags + + # show only files with tag --show-tag $show_tag + if ( keys %show_tags ) { + next FOOBIE + if !grep(exists $show_tags{$_}, map(@{$_->{tags}}, + grep(defined $_->{tags}, + @$qunklist))); + } + + my $files = &pretty_file_list ($qunklist); + my $header_line; # date and author + my $body; # see below + my $wholething; # $header_line + $body + + if ($XML_Output) { + $header_line = + sprintf ("<date>%4u-%02u-%02u</date>\n" + . "${wday}" + . "<time>%02u:%02u</time>\n" + . "<author>%s</author>\n", + $year+1900, $mon+1, $mday, $hour, $min, $author); + } + else { + if ($Show_Times) { + $header_line = + sprintf ("%4u-%02u-%02u${wday} %02u:%02u %s\n\n", + $year+1900, $mon+1, $mday, $hour, $min, $author); + } else { + $header_line = + sprintf ("%4u-%02u-%02u${wday} %s\n\n", + $year+1900, $mon+1, $mday, $author); + } + } + + $Text::Wrap::huge = 'overflow' + if $Text::Wrap::VERSION >= 2001.0130; + # Reshape the body according to user preferences. + if ($XML_Output) + { + $msg = &preprocess_msg_text ($msg); + $body = $files . $msg; + } + elsif ($No_Wrap && !$Summary) + { + $msg = &preprocess_msg_text ($msg); + $files = wrap ("\t", " ", "$files"); + $msg =~ s/\n(.*)/\n\t$1/g; + unless ($After_Header eq " ") { + $msg =~ s/^(.*)/\t$1/g; + } + $body = $files . $After_Header . $msg; + } + elsif ($Summary) + { + my( $filelist, $qunk ); + my( @DeletedQunks, @AddedQunks, @ChangedQunks ); + + $msg = &preprocess_msg_text ($msg); + # + # Sort the files (qunks) according to the operation that was + # performed. Files which were added have no line change + # indicator, whereas deleted files have state dead. + # + foreach $qunk ( @$qunklist ) + { + if ( "dead" eq $qunk->{'state'}) + { + push( @DeletedQunks, $qunk ); + } + elsif ( !exists( $qunk->{'lines'})) + { + push( @AddedQunks, $qunk ); + } + else + { + push( @ChangedQunks, $qunk ); + } + } + # + # The qunks list was originally in tree search order. Let's + # get that back. The lists, if they exist, will be reversed upon + # processing. + # + + # + # Now write the three sections onto $filelist + # + if ( @DeletedQunks ) + { + $filelist .= "\tDeleted:\n"; + foreach $qunk ( @DeletedQunks ) + { + $filelist .= "\t\t" . $qunk->{'filename'}; + $filelist .= " (" . $qunk->{'revision'} . ")"; + $filelist .= "\n"; + } + undef( @DeletedQunks ); + } + if ( @AddedQunks ) + { + $filelist .= "\tAdded:\n"; + foreach $qunk ( @AddedQunks ) + { + $filelist .= "\t\t" . $qunk->{'filename'}; + $filelist .= " (" . $qunk->{'revision'} . ")"; + $filelist .= "\n"; + } + undef( @AddedQunks ); + } + if ( @ChangedQunks ) + { + $filelist .= "\tChanged:\n"; + foreach $qunk ( @ChangedQunks ) + { + $filelist .= "\t\t" . $qunk->{'filename'}; + $filelist .= " (" . $qunk->{'revision'} . ")"; + $filelist .= ", \"" . $qunk->{'state'} . "\""; + $filelist .= ", lines: " . $qunk->{'lines'}; + $filelist .= "\n"; + } + undef( @ChangedQunks ); + } + chomp( $filelist ); + $msg =~ s/\n(.*)/\n\t$1/g; + unless ($After_Header eq " ") { + $msg =~ s/^(.*)/\t$1/g; + } + $body = $filelist . $After_Header . $msg; + } + else # do wrapping, either FSF-style or regular + { + if ($FSF_Style) + { + $files = wrap ("\t", " ", "$files"); + + my $files_last_line_len = 0; + if ($After_Header eq " ") + { + $files_last_line_len = &last_line_len ($files); + $files_last_line_len += 1; # for $After_Header + } + + $msg = &wrap_log_entry + ($msg, "\t", 69 - $files_last_line_len, 69); + $body = $files . $After_Header . $msg; + } + else # not FSF-style + { + $msg = &preprocess_msg_text ($msg); + $body = $files . $After_Header . $msg; + $body = wrap ("\t", " ", "$body"); + } + } + + $wholething = $header_line . $body; + + if ($XML_Output) { + $wholething = "<entry>\n${wholething}</entry>\n"; + } + + # One last check: make sure it passes the regexp test, if the + # user asked for that. We have to do it here, so that the + # test can match against information in the header as well + # as in the text of the log message. + + # How annoying to duplicate so much code just because I + # can't figure out a way to evaluate scalars on the trailing + # operator portion of a regular expression. Grrr. + if ($Case_Insensitive) { + unless ($Regexp_Gate && ($wholething !~ /$Regexp_Gate/oi)) { + print LOG_OUT "${wholething}\n"; + } + } + else { + unless ($Regexp_Gate && ($wholething !~ /$Regexp_Gate/o)) { + print LOG_OUT "${wholething}\n"; + } + } + } + } + } + + if ($XML_Output) { + print LOG_OUT "</changelog>\n"; + } + + close (LOG_OUT); + + if (! $Output_To_Stdout) + { + # If accumulating, append old data to new before renaming. But + # don't append the most recent entry, since it's already in the + # new log due to CVS's idiosyncratic interpretation of "log -d". + if ($Cumulative && -f $logfile_here) + { + open (NEW_LOG, ">>$tmpfile") + or die "trouble appending to $tmpfile ($!)"; + + open (OLD_LOG, "<$logfile_here") + or die "trouble reading from $logfile_here ($!)"; + + my $started_first_entry = 0; + my $passed_first_entry = 0; + while (<OLD_LOG>) + { + if (! $passed_first_entry) + { + if ((! $started_first_entry) + && /^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) { + $started_first_entry = 1; + } + elsif (/^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) { + $passed_first_entry = 1; + print NEW_LOG $_; + } + } + else { + print NEW_LOG $_; + } + } + + close (NEW_LOG); + close (OLD_LOG); + } + + if (-f $logfile_here) { + rename ($logfile_here, $logfile_bak); + } + rename ($tmpfile, $logfile_here); + } + } +} + +sub parse_date_author_and_state () +{ + # Parses the date/time and author out of a line like: + # + # date: 1999/02/19 23:29:05; author: apharris; state: Exp; + + my $line = shift; + + my ($year, $mon, $mday, $hours, $min, $secs, $author, $state, $rest) = + $line =~ + m#(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+([^;]+);\s+state:\s+([^;]+);(.*)# + or die "Couldn't parse date ``$line''"; + die "Bad date or Y2K issues" unless ($year > 1969 and $year < 2258); + # Kinda arbitrary, but useful as a sanity check + my $time = timegm($secs,$min,$hours,$mday,$mon-1,$year-1900); + my $lines; + if ( $rest =~ m#\s+lines:\s+(.*)# ) + { + $lines =$1; + } + return ($time, $author, $state, $lines); +} + +# Here we take a bunch of qunks and convert them into printed +# summary that will include all the information the user asked for. +sub pretty_file_list () +{ + if ($Hide_Filenames and (! $XML_Output)) { + return ""; + } + + my $qunksref = shift; + + my @qunkrefs = + grep +((! exists $_->{'tags'} or + ! grep exists $ignore_tags{$_}, @{$_->{'tags'}}) and + (! keys %show_tags or + (exists $_->{'tags'} and + grep exists $show_tags{$_}, @{$_->{'tags'}})) + ), + @$qunksref; + my @filenames; + my $beauty = ""; # The accumulating header string for this entry. + my %non_unanimous_tags; # Tags found in a proper subset of qunks + my %unanimous_tags; # Tags found in all qunks + my %all_branches; # Branches found in any qunk + my $common_dir = undef; # Dir prefix common to all files ("" if none) + my $fbegun = 0; # Did we begin printing filenames yet? + + # First, loop over the qunks gathering all the tag/branch names. + # We'll put them all in non_unanimous_tags, and take out the + # unanimous ones later. + QUNKREF: + foreach my $qunkref (@qunkrefs) + { + # Keep track of whether all the files in this commit were in the + # same directory, and memorize it if so. We can make the output a + # little more compact by mentioning the directory only once. + if ($Common_Dir && (scalar (@qunkrefs)) > 1) + { + if (! (defined ($common_dir))) + { + my ($base, $dir); + ($base, $dir, undef) = fileparse ($$qunkref{'filename'}); + + if ((! (defined ($dir))) # this first case is sheer paranoia + or ($dir eq "") + or ($dir eq "./") + or ($dir eq ".\\")) + { + $common_dir = ""; + } + else + { + $common_dir = $dir; + } + } + elsif ($common_dir ne "") + { + # Already have a common dir prefix, so how much of it can we preserve? + $common_dir = &common_path_prefix ($$qunkref{'filename'}, $common_dir); + } + } + else # only one file in this entry anyway, so common dir not an issue + { + $common_dir = ""; + } + + if (defined ($$qunkref{'branch'})) { + $all_branches{$$qunkref{'branch'}} = 1; + } + if (defined ($$qunkref{'tags'})) { + foreach my $tag (@{$$qunkref{'tags'}}) { + $non_unanimous_tags{$tag} = 1; + } + } + } + + # Any tag held by all qunks will be printed specially... but only if + # there are multiple qunks in the first place! + if ((scalar (@qunkrefs)) > 1) { + foreach my $tag (keys (%non_unanimous_tags)) { + my $everyone_has_this_tag = 1; + foreach my $qunkref (@qunkrefs) { + if ((! (defined ($$qunkref{'tags'}))) + or (! (grep ($_ eq $tag, @{$$qunkref{'tags'}})))) { + $everyone_has_this_tag = 0; + } + } + if ($everyone_has_this_tag) { + $unanimous_tags{$tag} = 1; + delete $non_unanimous_tags{$tag}; + } + } + } + + if ($XML_Output) + { + # If outputting XML, then our task is pretty simple, because we + # don't have to detect common dir, common tags, branch prefixing, + # etc. We just output exactly what we have, and don't worry about + # redundancy or readability. + + foreach my $qunkref (@qunkrefs) + { + my $filename = $$qunkref{'filename'}; + my $cvsstate = $$qunkref{'cvsstate'}; + my $revision = $$qunkref{'revision'}; + my $tags = $$qunkref{'tags'}; + my $branch = $$qunkref{'branch'}; + my $branchroots = $$qunkref{'branchroots'}; + + $filename = &xml_escape ($filename); # probably paranoia + $revision = &xml_escape ($revision); # definitely paranoia + + $beauty .= "<file>\n"; + $beauty .= "<name>${filename}</name>\n"; + $beauty .= "<cvsstate>${cvsstate}</cvsstate>\n"; + $beauty .= "<revision>${revision}</revision>\n"; + if ($branch) { + $branch = &xml_escape ($branch); # more paranoia + $beauty .= "<branch>${branch}</branch>\n"; + } + foreach my $tag (@$tags) { + $tag = &xml_escape ($tag); # by now you're used to the paranoia + $beauty .= "<tag>${tag}</tag>\n"; + } + foreach my $root (@$branchroots) { + $root = &xml_escape ($root); # which is good, because it will continue + $beauty .= "<branchroot>${root}</branchroot>\n"; + } + $beauty .= "</file>\n"; + } + + # Theoretically, we could go home now. But as long as we're here, + # let's print out the common_dir and utags, as a convenience to + # the receiver (after all, earlier code calculated that stuff + # anyway, so we might as well take advantage of it). + + if ((scalar (keys (%unanimous_tags))) > 1) { + foreach my $utag ((keys (%unanimous_tags))) { + $utag = &xml_escape ($utag); # the usual paranoia + $beauty .= "<utag>${utag}</utag>\n"; + } + } + if ($common_dir) { + $common_dir = &xml_escape ($common_dir); + $beauty .= "<commondir>${common_dir}</commondir>\n"; + } + + # That's enough for XML, time to go home: + return $beauty; + } + + # Else not XML output, so complexly compactify for chordate + # consumption. At this point we have enough global information + # about all the qunks to organize them non-redundantly for output. + + if ($common_dir) { + # Note that $common_dir still has its trailing slash + $beauty .= "$common_dir: "; + } + + if ($Show_Branches) + { + # For trailing revision numbers. + my @brevisions; + + foreach my $branch (keys (%all_branches)) + { + foreach my $qunkref (@qunkrefs) + { + if ((defined ($$qunkref{'branch'})) + and ($$qunkref{'branch'} eq $branch)) + { + if ($fbegun) { + # kff todo: comma-delimited in XML too? Sure. + $beauty .= ", "; + } + else { + $fbegun = 1; + } + my $fname = substr ($$qunkref{'filename'}, length ($common_dir)); + $beauty .= $fname; + $$qunkref{'printed'} = 1; # Just setting a mark bit, basically + + if ($Show_Tags && (defined @{$$qunkref{'tags'}})) { + my @tags = grep ($non_unanimous_tags{$_}, @{$$qunkref{'tags'}}); + + if (@tags) { + $beauty .= " (tags: "; + $beauty .= join (', ', @tags); + $beauty .= ")"; + } + } + + if ($Show_Revisions) { + # Collect the revision numbers' last components, but don't + # print them -- they'll get printed with the branch name + # later. + $$qunkref{'revision'} =~ /.+\.([\d]+)$/; + push (@brevisions, $1); + + # todo: we're still collecting branch roots, but we're not + # showing them anywhere. If we do show them, it would be + # nifty to just call them revision "0" on a the branch. + # Yeah, that's the ticket. + } + } + } + $beauty .= " ($branch"; + if (@brevisions) { + if ((scalar (@brevisions)) > 1) { + $beauty .= ".["; + $beauty .= (join (',', @brevisions)); + $beauty .= "]"; + } + else { + # Square brackets are spurious here, since there's no range to + # encapsulate + $beauty .= ".$brevisions[0]"; + } + } + $beauty .= ")"; + } + } + + # Okay; any qunks that were done according to branch are taken care + # of, and marked as printed. Now print everyone else. + + my %fileinfo_printed; + foreach my $qunkref (@qunkrefs) + { + next if (defined ($$qunkref{'printed'})); # skip if already printed + + my $b = substr ($$qunkref{'filename'}, length ($common_dir)); + # todo: Shlomo's change was this: + # $beauty .= substr ($$qunkref{'filename'}, + # (($common_dir eq "./") ? "" : length ($common_dir))); + $$qunkref{'printed'} = 1; # Set a mark bit. + + if ($Show_Revisions || $Show_Tags || $Show_Dead) + { + my $started_addendum = 0; + + if ($Show_Revisions) { + $started_addendum = 1; + $b .= " ("; + $b .= "$$qunkref{'revision'}"; + } + if ($Show_Dead && $$qunkref{'cvsstate'} =~ /dead/) + { + # Deliberately not using $started_addendum. Keeping it simple. + $b .= "[DEAD]"; + } + if ($Show_Tags && (defined $$qunkref{'tags'})) { + my @tags = grep ($non_unanimous_tags{$_}, @{$$qunkref{'tags'}}); + if ((scalar (@tags)) > 0) { + if ($started_addendum) { + $b .= ", "; + } + else { + $b .= " (tags: "; + } + $b .= join (', ', @tags); + $started_addendum = 1; + } + } + if ($started_addendum) { + $b .= ")"; + } + } + + unless ( exists $fileinfo_printed{$b} ) { + if ($fbegun) { + $beauty .= ", "; + } else { + $fbegun = 1; + } + $beauty .= $b, $fileinfo_printed{$b} = 1; + } + } + + # Unanimous tags always come last. + if ($Show_Tags && %unanimous_tags) + { + $beauty .= " (utags: "; + $beauty .= join (', ', sort keys (%unanimous_tags)); + $beauty .= ")"; + } + + # todo: still have to take care of branch_roots? + + $beauty = "* $beauty:"; + + return $beauty; +} + +sub min ($$) { $_[0] < $_[1] ? $_[0] : $_[1] } + +sub common_path_prefix ($$) +{ + my ($path1, $path2) = @_; + + # For compatibility (with older versions of cvs2cl.pl), we think in UN*X + # terms, and mould windoze filenames to match. Is this really appropriate? + # If a file is checked in under UN*X, and cvs log run on windoze, which way + # do the path separators slope? Can we use fileparse as per the local + # conventions? If so, we should probably have a user option to specify an + # OS to emulate to handle stdin-fed logs. If we did this, we could avoid + # the nasty \-/ transmogrification below. + + my ($dir1, $dir2) = map +(fileparse($_))[1], $path1, $path2; + + # Transmogrify Windows filenames to look like Unix. + # (It is far more likely that someone is running cvs2cl.pl under + # Windows than that they would genuinely have backslashes in their + # filenames.) + tr!\\!/! + for $dir1, $dir2; + + my ($accum1, $accum2, $last_common_prefix) = ('') x 3; + + my @path1 = grep length($_), split qr!/!, $dir1; + my @path2 = grep length($_), split qr!/!, $dir2; + + my @common_path; + for (0..min($#path1,$#path2)) { + if ( $path1[$_] eq $path2[$_]) { + push @common_path, $path1[$_]; + } else { + last; + } + } + + return join '', map "$_/", @common_path; +} + +sub preprocess_msg_text () +{ + my $text = shift; + + # Strip out carriage returns (as they probably result from DOSsy editors). + $text =~ s/\r\n/\n/g; + + # If it *looks* like two newlines, make it *be* two newlines: + $text =~ s/\n\s*\n/\n\n/g; + + if ($XML_Output) + { + $text = &xml_escape ($text); + $text = "<msg>${text}</msg>\n"; + } + elsif (! $No_Wrap) + { + # Strip off lone newlines, but only for lines that don't begin with + # whitespace or a mail-quoting character, since we want to preserve + # that kind of formatting. Also don't strip newlines that follow a + # period; we handle those specially next. And don't strip + # newlines that precede an open paren. + 1 while ($text =~ s/(^|\n)([^>\s].*[^.\n])\n([^>\n])/$1$2 $3/g); + + # If a newline follows a period, make sure that when we bring up the + # bottom sentence, it begins with two spaces. + 1 while ($text =~ s/(^|\n)([^>\s].*)\n([^>\n])/$1$2 $3/g); + } + + return $text; +} + +sub last_line_len () +{ + my $files_list = shift; + my @lines = split (/\n/, $files_list); + my $last_line = pop (@lines); + return length ($last_line); +} + +# A custom wrap function, sensitive to some common constructs used in +# log entries. +sub wrap_log_entry () +{ + my $text = shift; # The text to wrap. + my $left_pad_str = shift; # String to pad with on the left. + + # These do NOT take left_pad_str into account: + my $length_remaining = shift; # Amount left on current line. + my $max_line_length = shift; # Amount left for a blank line. + + my $wrapped_text = ""; # The accumulating wrapped entry. + my $user_indent = ""; # Inherited user_indent from prev line. + + my $first_time = 1; # First iteration of the loop? + my $suppress_line_start_match = 0; # Set to disable line start checks. + + my @lines = split (/\n/, $text); + while (@lines) # Don't use `foreach' here, it won't work. + { + my $this_line = shift (@lines); + chomp $this_line; + + if ($this_line =~ /^(\s+)/) { + $user_indent = $1; + } + else { + $user_indent = ""; + } + + # If it matches any of the line-start regexps, print a newline now... + if ($suppress_line_start_match) + { + $suppress_line_start_match = 0; + } + elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/) + || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/) + || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/) + || ($this_line =~ /^(\s+)(\S+)/) + || ($this_line =~ /^(\s*)- +/) + || ($this_line =~ /^()\s*$/) + || ($this_line =~ /^(\s*)\*\) +/) + || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/)) + { + # Make a line break immediately, unless header separator is set + # and this line is the first line in the entry, in which case + # we're getting the blank line for free already and shouldn't + # add an extra one. + unless (($After_Header ne " ") and ($first_time)) + { + if ($this_line =~ /^()\s*$/) { + $suppress_line_start_match = 1; + $wrapped_text .= "\n${left_pad_str}"; + } + + $wrapped_text .= "\n${left_pad_str}"; + } + + $length_remaining = $max_line_length - (length ($user_indent)); + } + + # Now that any user_indent has been preserved, strip off leading + # whitespace, so up-folding has no ugly side-effects. + $this_line =~ s/^\s*//; + + # Accumulate the line, and adjust parameters for next line. + my $this_len = length ($this_line); + if ($this_len == 0) + { + # Blank lines should cancel any user_indent level. + $user_indent = ""; + $length_remaining = $max_line_length; + } + elsif ($this_len >= $length_remaining) # Line too long, try breaking it. + { + # Walk backwards from the end. At first acceptable spot, break + # a new line. + my $idx = $length_remaining - 1; + if ($idx < 0) { $idx = 0 }; + while ($idx > 0) + { + if (substr ($this_line, $idx, 1) =~ /\s/) + { + my $line_now = substr ($this_line, 0, $idx); + my $next_line = substr ($this_line, $idx); + $this_line = $line_now; + + # Clean whitespace off the end. + chomp $this_line; + + # The current line is ready to be printed. + $this_line .= "\n${left_pad_str}"; + + # Make sure the next line is allowed full room. + $length_remaining = $max_line_length - (length ($user_indent)); + + # Strip next_line, but then preserve any user_indent. + $next_line =~ s/^\s*//; + + # Sneak a peek at the user_indent of the upcoming line, so + # $next_line (which will now precede it) can inherit that + # indent level. Otherwise, use whatever user_indent level + # we currently have, which might be none. + my $next_next_line = shift (@lines); + if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) { + $next_line = $1 . $next_line if (defined ($1)); + # $length_remaining = $max_line_length - (length ($1)); + $next_next_line =~ s/^\s*//; + } + else { + $next_line = $user_indent . $next_line; + } + if (defined ($next_next_line)) { + unshift (@lines, $next_next_line); + } + unshift (@lines, $next_line); + + # Our new next line might, coincidentally, begin with one of + # the line-start regexps, so we temporarily turn off + # sensitivity to that until we're past the line. + $suppress_line_start_match = 1; + + last; + } + else + { + $idx--; + } + } + + if ($idx == 0) + { + # We bottomed out because the line is longer than the + # available space. But that could be because the space is + # small, or because the line is longer than even the maximum + # possible space. Handle both cases below. + + if ($length_remaining == ($max_line_length - (length ($user_indent)))) + { + # The line is simply too long -- there is no hope of ever + # breaking it nicely, so just insert it verbatim, with + # appropriate padding. + $this_line = "\n${left_pad_str}${this_line}"; + } + else + { + # Can't break it here, but may be able to on the next round... + unshift (@lines, $this_line); + $length_remaining = $max_line_length - (length ($user_indent)); + $this_line = "\n${left_pad_str}"; + } + } + } + else # $this_len < $length_remaining, so tack on what we can. + { + # Leave a note for the next iteration. + $length_remaining = $length_remaining - $this_len; + + if ($this_line =~ /\.$/) + { + $this_line .= " "; + $length_remaining -= 2; + } + else # not a sentence end + { + $this_line .= " "; + $length_remaining -= 1; + } + } + + # Unconditionally indicate that loop has run at least once. + $first_time = 0; + + $wrapped_text .= "${user_indent}${this_line}"; + } + + # One last bit of padding. + $wrapped_text .= "\n"; + + return $wrapped_text; +} + +sub xml_escape () +{ + my $txt = shift; + $txt =~ s/&/&/g; + $txt =~ s/</</g; + $txt =~ s/>/>/g; + return $txt; +} + +sub maybe_read_user_map_file () +{ + my %expansions; + + if ($User_Map_File) + { + open (MAPFILE, "<$User_Map_File") + or die ("Unable to open $User_Map_File ($!)"); + + while (<MAPFILE>) + { + next if /^\s*#/; # Skip comment lines. + next if not /:/; # Skip lines without colons. + + # It is now safe to split on ':'. + my ($username, $expansion) = split ':'; + chomp $expansion; + $expansion =~ s/^'(.*)'$/$1/; + $expansion =~ s/^"(.*)"$/$1/; + + # If it looks like the expansion has a real name already, then + # we toss the username we got from CVS log. Otherwise, keep + # it to use in combination with the email address. + + if ($expansion =~ /^\s*<{0,1}\S+@.*/) { + # Also, add angle brackets if none present + if (! ($expansion =~ /<\S+@\S+>/)) { + $expansions{$username} = "$username <$expansion>"; + } + else { + $expansions{$username} = "$username $expansion"; + } + } + else { + $expansions{$username} = $expansion; + } + } # fi ($User_Map_File) + + close (MAPFILE); + } + + if (defined $User_Passwd_File) + { + if ( ! defined $Mail_Domain ) { + if ( -e MAILNAME ) { + chomp($Mail_Domain = slurp_file(MAILNAME)); + } else { + MAILDOMAIN_CMD: + for ([qw(hostname -d)], 'dnsdomainname', 'domainname') { + my ($text, $exit, $sig, $core) = run_ext($_); + if ( $exit == 0 && $sig == 0 && $core == 0 ) { + chomp $text; + if ( length $text ) { + $Mail_Domain = $text; + last MAILDOMAIN_CMD; + } + } + } + } + } + + die "No mail domain found\n" + unless defined $Mail_Domain; + + open (MAPFILE, "<$User_Passwd_File") + or die ("Unable to open $User_Passwd_File ($!)"); + while (<MAPFILE>) + { + # all lines are valid + my ($username, $pw, $uid, $gid, $gecos, $homedir, $shell) = split ':'; + my $expansion = ''; + ($expansion) = split (',', $gecos) + if defined $gecos && length $gecos; + + $expansions{$username} = "$expansion <$username\@$Mail_Domain>"; + } + close (MAPFILE); + } + + return %expansions; +} + +sub parse_options () +{ + # Check this internally before setting the global variable. + my $output_file; + + # If this gets set, we encountered unknown options and will exit at + # the end of this subroutine. + my $exit_with_admonishment = 0; + + while (my $arg = shift (@ARGV)) + { + if ($arg =~ /^-h$|^-help$|^--help$|^--usage$|^-?$/) { + $Print_Usage = 1; + } + elsif ($arg =~ /^--delta$/) { + my $narg = shift(@ARGV) || die "$arg needs argument.\n"; + if ($narg =~ /^([A-Za-z][A-Za-z0-9_\-]*):([A-Za-z][A-Za-z0-9_\-]*)$/) { + $Delta_From = $1; + $Delta_To = $2; + $Delta_Mode = 1; + } else { + die "--delta FROM_TAG:TO_TAG is what you meant to say.\n"; + } + } + elsif ($arg =~ /^--debug$/) { # unadvertised option, heh + $Debug = 1; + } + elsif ($arg =~ /^--version$/) { + $Print_Version = 1; + } + elsif ($arg =~ /^-g$|^--global-opts$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + # Don't assume CVS is called "cvs" on the user's system: + $Log_Source_Command =~ s/(^\S*)/$1 $narg/; + } + elsif ($arg =~ /^-l$|^--log-opts$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $Log_Source_Command .= " $narg"; + } + elsif ($arg =~ /^-f$|^--file$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $output_file = $narg; + } + elsif ($arg =~ /^--accum$/) { + $Cumulative = 1; + } + elsif ($arg =~ /^--update$/) { + $Update = 1; + } + elsif ($arg =~ /^--fsf$/) { + $FSF_Style = 1; + } + elsif ($arg =~ /^--FSF$/) { + $Show_Times = 0; + $Common_Dir = 0; + } + elsif ($arg =~ /^--rcs/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $RCS_Root = $narg; + $RCS_Mode = 1; + } + elsif ($arg =~ /^-U$|^--usermap$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $User_Map_File = $narg; + } + elsif ($arg =~ /^--gecos$/) { + $Gecos = 1; + } + elsif ($arg =~ /^--domain$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $Domain = $narg; + } + elsif ($arg =~ /^--passwd$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $User_Passwd_File = $narg; + } + elsif ($arg =~ /^--mailname$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $Mail_Domain = $narg; + } + elsif ($arg =~ /^-W$|^--window$/) { + defined(my $narg = shift (@ARGV)) || die "$arg needs argument.\n"; + $Max_Checkin_Duration = $narg; + } + elsif ($arg =~ /^--chrono$/) { + $Chronological_Order = 1; + } + elsif ($arg =~ /^-I$|^--ignore$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + push (@Ignore_Files, $narg); + } + elsif ($arg =~ /^-C$|^--case-insensitive$/) { + $Case_Insensitive = 1; + } + elsif ($arg =~ /^-R$|^--regexp$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $Regexp_Gate = $narg; + } + elsif ($arg =~ /^--stdout$/) { + $Output_To_Stdout = 1; + } + elsif ($arg =~ /^--version$/) { + $Print_Version = 1; + } + elsif ($arg =~ /^-d$|^--distributed$/) { + $Distributed = 1; + } + elsif ($arg =~ /^-P$|^--prune$/) { + $Prune_Empty_Msgs = 1; + } + elsif ($arg =~ /^-S$|^--separate-header$/) { + $After_Header = "\n\n"; + } + elsif ($arg =~ /^--no-wrap$/) { + $No_Wrap = 1; + } + elsif ($arg =~ /^--summary$/) { + $Summary = 1; + $After_Header = "\n\n"; # Summary implies --separate-header + } + elsif ($arg =~ /^--gmt$|^--utc$/) { + $UTC_Times = 1; + } + elsif ($arg =~ /^-w$|^--day-of-week$/) { + $Show_Day_Of_Week = 1; + } + elsif ($arg =~ /^--no-times$/) { + $Show_Times = 0; + } + elsif ($arg =~ /^-r$|^--revisions$/) { + $Show_Revisions = 1; + } + elsif ($arg =~ /^--show-dead$/) { + $Show_Dead = 1; + } + elsif ($arg =~ /^-t$|^--tags$/) { + $Show_Tags = 1; + } + elsif ($arg =~ /^-T$|^--tagdates$/) { + $Show_Tag_Dates = 1; + } + elsif ($arg =~ /^-b$|^--branches$/) { + $Show_Branches = 1; + } + elsif ($arg =~ /^-F$|^--follow$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + push (@Follow_Branches, $narg); + } + elsif ($arg =~ /^--stdin$/) { + $Input_From_Stdin = 1; + } + elsif ($arg =~ /^--header$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $ChangeLog_Header = &slurp_file ($narg); + if (! defined ($ChangeLog_Header)) { + $ChangeLog_Header = ""; + } + } + elsif ($arg =~ /^--xml-encoding$/) { + my $narg = shift (@ARGV) || die "$arg needs argument.\n"; + $XML_Encoding = $narg ; + } + elsif ($arg =~ /^--xml$/) { + $XML_Output = 1; + } + elsif ($arg =~ /^--hide-filenames$/) { + $Hide_Filenames = 1; + $After_Header = ""; + } + elsif ($arg =~ /^--no-common-dir$/) { + $Common_Dir = 0; + } + elsif ($arg =~ /^--ignore-tag$/ ) { + die "$arg needs argument.\n" + unless @ARGV; + $ignore_tags{shift @ARGV} = 1; + } + elsif ($arg =~ /^--show-tag$/ ) { + die "$arg needs argument.\n" + unless @ARGV; + $show_tags{shift @ARGV} = 1; + } + elsif ( lc ($arg) eq '--test-code' ) { + # Deliberately undocumented. This is not a public interface, + # and may change/disappear at any time. + die "$arg needs argument.\n" + unless @ARGV; + $TestCode = shift @ARGV; + } + elsif ($arg =~ /^--no-ancestors$/) { + $No_Ancestors = 1; + } + else { + # Just add a filename as argument to the log command + $Log_Source_Command .= " '$arg'"; + } + } + + ## Check for contradictions... + + if ($Output_To_Stdout && $Distributed) { + print STDERR "cannot pass both --stdout and --distributed\n"; + $exit_with_admonishment = 1; + } + + if ($Output_To_Stdout && $output_file) { + print STDERR "cannot pass both --stdout and --file\n"; + $exit_with_admonishment = 1; + } + + if ($XML_Output && $Cumulative) { + print STDERR "cannot pass both --xml and --accum\n"; + $exit_with_admonishment = 1; + } + + # Or if any other error message has already been printed out, we + # just leave now: + if ($exit_with_admonishment) { + &usage (); + exit (1); + } + elsif ($Print_Usage) { + &usage (); + exit (0); + } + elsif ($Print_Version) { + &version (); + exit (0); + } + + ## Else no problems, so proceed. + + if ($output_file) { + $Log_File_Name = $output_file; + } +} + +sub slurp_file () +{ + my $filename = shift || die ("no filename passed to slurp_file()"); + my $retstr; + + open (SLURPEE, "<${filename}") or die ("unable to open $filename ($!)"); + my $saved_sep = $/; + undef $/; + $retstr = <SLURPEE>; + $/ = $saved_sep; + close (SLURPEE); + return $retstr; +} + +sub debug () +{ + if ($Debug) { + my $msg = shift; + print STDERR $msg; + } +} + +sub version () +{ + print "cvs2cl.pl version ${VERSION}; distributed under the GNU GPL.\n"; +} + +sub usage () +{ + &version (); + print <<'END_OF_INFO'; +Generate GNU-style ChangeLogs in CVS working copies. + +Notes about the output format(s): + + The default output of cvs2cl.pl is designed to be compact, formally + unambiguous, but still easy for humans to read. It is largely + self-explanatory, I hope; the one abbreviation that might not be + obvious is "utags". That stands for "universal tags" -- a + universal tag is one held by all the files in a given change entry. + + If you need output that's easy for a program to parse, use the + --xml option. Note that with XML output, just about all available + information is included with each change entry, whether you asked + for it or not, on the theory that your parser can ignore anything + it's not looking for. + +Notes about the options and arguments (the actual options are listed +last in this usage message): + + * The -I and -F options may appear multiple times. + + * To follow trunk revisions, use "-F trunk" ("-F TRUNK" also works). + This is okay because no would ever, ever be crazy enough to name a + branch "trunk", right? Right. + + * For the -U option, the UFILE should be formatted like + CVSROOT/users. That is, each line of UFILE looks like this + jrandom:jrandom@red-bean.com + or maybe even like this + jrandom:'Jesse Q. Random <jrandom@red-bean.com>' + Don't forget to quote the portion after the colon if necessary. + + * Many people want to filter by date. To do so, invoke cvs2cl.pl + like this: + cvs2cl.pl -l "-d'DATESPEC'" + where DATESPEC is any date specification valid for "cvs log -d". + (Note that CVS 1.10.7 and below requires there be no space between + -d and its argument). + +Options/Arguments: + + -h, -help, --help, or -? Show this usage and exit + --version Show version and exit + -r, --revisions Show revision numbers in output + -b, --branches Show branch names in revisions when possible + -t, --tags Show tags (symbolic names) in output + -T, --tagdates Show tags in output on their first occurance + --show-dead Show dead files + --stdin Read from stdin, don't run cvs log + --stdout Output to stdout not to ChangeLog + -d, --distributed Put ChangeLogs in subdirs + -f FILE, --file FILE Write to FILE instead of "ChangeLog" + --fsf Use this if log data is in FSF ChangeLog style + --FSF Attempt strict FSF-standard compatible output + -W SECS, --window SECS Window of time within which log entries unify + -U UFILE, --usermap UFILE Expand usernames to email addresses from UFILE + --passwd PASSWORDFILE Use system passwd file for user name expansion + --mailname MAILDOMAIN Mail domainname to attach to user names for + email addresses. Only used with --passwd. + Defaults to contents, of /etc/mailname else + output of hostname -d / dnsdomainname / + domainname + --domain DOMAIN Domain to build email addresses from + --gecos Get user information from GECOS data + -R REGEXP, --regexp REGEXP Include only entries that match REGEXP + -I REGEXP, --ignore REGEXP Ignore files whose names match REGEXP + -C, --case-insensitive Any regexp matching is done case-insensitively + -F BRANCH, --follow BRANCH Show only revisions on or ancestral to BRANCH + --no-ancestors When using -F, only track changes since the + BRANCH started + -S, --separate-header Blank line between each header and log message + --summary Add CVS change summary information + --no-wrap Don't auto-wrap log message (recommend -S also) + --gmt, --utc Show times in GMT/UTC instead of local time + --accum Add to an existing ChangeLog (incompat w/ --xml) + --update As --accum, but lists only files changed since + last run + -w, --day-of-week Show day of week + --no-times Don't show times in output + --header FILE Get ChangeLog header from FILE ("-" means stdin) + --xml Output XML instead of ChangeLog format + --xml-encoding ENCODING Insert encoding clause in XML header + --hide-filenames Don't show filenames (ignored for XML output) + --no-common-dir Don't shorten directory names from filenames. + --rcs CVSROOT Handle filenames from raw RCS, for instance + those produced by "cvs rlog" output, stripping + the prefix CVSROOT. + -P, --prune Don't show empty log messages + --ignore-tag TAG Ignore individual changes that are associated + with a given tag. May be repeated, if so, + changes that are associated with any of the + given tags are ignored. + --show-tag TAG Log only individual changes that are associated + with a given tag. May be repeated, if so, + changes that are associated with any of the + given tags are logged. + --delta FROM_TAG:TO_TAG Attempt a delta between two tags (since FROM_TAG + up to & including TO_TAG). The algorithm is a + simple date-based one (this is a *hard* problem) + so results are imperfect + -g OPTS, --global-opts OPTS Invoke like this "cvs OPTS log ..." + -l OPTS, --log-opts OPTS Invoke like this "cvs ... log OPTS" + FILE1 [FILE2 ...] Show only log information for the named FILE(s) + +See http://www.red-bean.com/cvs2cl for maintenance and bug info. +END_OF_INFO +} + +__END__ + +=head1 NAME + +cvs2cl.pl - produces GNU-style ChangeLogs in CVS working copies, by + running "cvs log" and parsing the output. Shared log entries are + unified in an intuitive way. + +=head1 DESCRIPTION + +This script generates GNU-style ChangeLog files from CVS log +information. Basic usage: just run it inside a working copy and a +ChangeLog will appear. It requires repository access (i.e., 'cvs log' +must work). Run "cvs2cl.pl --help" to see more advanced options. + +See http://www.red-bean.com/cvs2cl for updates, and for instructions +on getting anonymous CVS access to this script. + +Maintainer: Karl Fogel <kfogel@red-bean.com> +Please report bugs to <bug-cvs2cl@red-bean.com>. + +=head1 README + +This script generates GNU-style ChangeLog files from CVS log +information. Basic usage: just run it inside a working copy and a +ChangeLog will appear. It requires repository access (i.e., 'cvs log' +must work). Run "cvs2cl.pl --help" to see more advanced options. + +See http://www.red-bean.com/cvs2cl for updates, and for instructions +on getting anonymous CVS access to this script. + +Maintainer: Karl Fogel <kfogel@red-bean.com> +Please report bugs to <bug-cvs2cl@red-bean.com>. + +=head1 PREREQUISITES + +This script requires C<Text::Wrap>, C<Time::Local>, and +C<File::Basename>. +It also seems to require C<Perl 5.004_04> or higher. + +=pod OSNAMES + +any + +=pod SCRIPT CATEGORIES + +Version_Control/CVS + +=cut + +-*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- + +Note about a bug-slash-opportunity: +----------------------------------- + +There's a bug in Text::Wrap, which affects cvs2cl. This script +reveals it: + + #!/usr/bin/perl -w + + use Text::Wrap; + + my $test_text = + "This script demonstrates a bug in Text::Wrap. The very long line + following this paragraph will be relocated relative to the surrounding + text: + + ==================================================================== + + See? When the bug happens, we'll get the line of equal signs below + this paragraph, even though it should be above."; + + # Print out the test text with no wrapping: + print "$test_text"; + print "\n"; + print "\n"; + + # Now print it out wrapped, and see the bug: + print wrap ("\t", " ", "$test_text"); + print "\n"; + print "\n"; + +If the line of equal signs were one shorter, then the bug doesn't +happen. Interesting. + +Anyway, rather than fix this in Text::Wrap, we might as well write a +new wrap() which has the following much-needed features: + +* initial indentation, like current Text::Wrap() +* subsequent line indentation, like current Text::Wrap() +* user chooses among: force-break long words, leave them alone, or die()? +* preserve existing indentation: chopped chunks from an indented line + are indented by same (like this line, not counting the asterisk!) +* optional list of things to preserve on line starts, default ">" + +Note that the last two are essentially the same concept, so unify in +implementation and give a good interface to controlling them. + +And how about: + +Optionally, when encounter a line pre-indented by same as previous +line, then strip the newline and refill, but indent by the same. +Yeah... + diff --git a/doc/css/pod.css b/doc/css/pod.css new file mode 100644 index 0000000..6f7bd52 --- /dev/null +++ b/doc/css/pod.css @@ -0,0 +1,132 @@ +/* standard elements */ +body + { + background: #FFFFFF; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + } +p + { + color: #000000; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + } +blockquote + { + color: #000000; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + } +ul + { + color: #000000; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + list-style-type: disc; + } +ol + { + color: #000000; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + } +h1 + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 18px; + font-weight: bold; + color: #2660C9; + } +h2 + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; + font-weight: bold; + color: #2660C9; + background-color: #EAE2BB; + } +h3 + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; + color: #000000; + } +h4 + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: bold; + color: #2660C9; + } + +pre + { + font-size: 120%; + padding-bottom: 5px; + } +tt + { + font-size: 120%; + } +code + { + font-size: 120%; + } +kbd + { + font-size: 120%; + } + +/* documentation link formatting */ +a:link + { + color: #2660C9; + text-decoration: underline; + } +a:visited + { + color: #2660C9; + text-decoration: underline; + } +a:hover + { + color: #000000; + text-decoration: underline; + } +a:active + { + color: #2660C9; + text-decoration: underline; + } +.docsubheading + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; + font-weight: bold; + color: #B82619; + background-color: #EAE2BB; + } +.docsubheadinggrey + { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; + font-weight: bold; + color: #B82619; + background-color: #cccccc; + } +.error + { + color: #B82619; + } +.err + { + color: #B82619; + } + +/* unordered list without bullets */ +ul.sans + { + list-style-type: none; + } + diff --git a/doc/en/Makefile b/doc/en/Makefile new file mode 100644 index 0000000..1d300c0 --- /dev/null +++ b/doc/en/Makefile @@ -0,0 +1,7 @@ + +index.html: PerlQt.pod + pod2html --css ../css/pod.css PerlQt.pod > index.html + perl -pi -e 's/cgibin/cgi-bin/' index.html + perl -pi -e 's/#http/http/g' index.html + rm -f pod2*~~ + diff --git a/doc/en/PerlQt.pod b/doc/en/PerlQt.pod new file mode 100644 index 0000000..b05a0a9 --- /dev/null +++ b/doc/en/PerlQt.pod @@ -0,0 +1,1147 @@ + +=head1 Programming PerlQt + +B<Germain Garand> + +This document describes a set of Perl bindings for the Qt toolkit. Contact +the author at <germain@ebooksfrance.com> + +=head1 Introduction + +PerlQt-3 is Ashley Winters' full featured object oriented interface to +L<Trolltech|"http://www.trolltech.com">'s C++ Qt toolkit v3.0. + +It is based on the +L<SMOKE|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> +library, a language independent low-level wrapper generated from Qt headers by +Richard Dale's +L<kalyptus|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus"> +thanks to David Faure's module. + +This document describes the principles of PerlQt programming. +It assumes you have some basic Perl Object Oriented programming knowledge. + +Some C++ knowledge is recommended but not required. +It would mostly help you to find your way through L<Qt's +excellent documentation|"http://doc.trolltech.com"> which is our +ultimate and only reference. +If Qt is installed on your system, then you most probably +also have its documentation. Try the C<$QTDIR/bin/assistant> program. + + +=head1 Installation + +=head2 Requirements + +To compile and use PerlQt, you'll need : + +=over 4 + +=item * + +a POSIX system + +=item * + +GNU tools : automake(>=1.5), autoconf (>=2.13), aclocal... + +=item * + +L<Perl E<gt>= v5.6.0|"http://www.perl.org"> + +=item * + +L<Qt E<gt>= +v3.0|"http://www.trolltech.com/developer/download/qt-x11.html"> + +=item * + +L<SmokeQt 1.2.1|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> +The SMOKE library (Scripting Meta Object Kompiler) is part of L<KDE|"http://www.kde.org">'s B<kdebindings> module. +You may want to check if a precompiled version of this module exists for your +system. +PerlQt is packaged with its own copy, so you don't need to check it out. + +=back + +Perl and Qt's installation is out of the scope of this document. Please refer +to those projects' documentation. + +=head2 Compilation + +PerlQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven +by the Makefile.PL wrapper. All options are forwarded to ./configure : + + perl Makefile.PL + +If SMOKE is missing, C<configure> will generate its sources. +Then : + + make + + make install + +This will install PerlQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities. + +The preferred install location for SMOKE and Puic is in the KDE3 file system. +If you don't have KDE3 installed, specify a location with C<configure>'s +C<--prefix> option. e.g: + + perl Makefile.PL --prefix=/usr + +=head2 Troubleshooting and Configure Options + +If Smoke's linking fails or your Qt library was built with very specific +options, run Makefile.PL again with: + + perl Makefile.PL --with-threshold=0 + +When building smoke, configure will check for OpenGL and try to compile +support for it if it is properly installed and supported by Qt. + +You may disable this checking with: + + --disable-GL + +Also, default behaviour is to prefer the Mesa GL library over a proprietary +implementation. +If your system features a proprietary OpenGL library, and you'd like to use +it, specify: + + --without-Mesa + +=head2 How to install PerlQt with user rights + +To install PerlQt without super-user rights, simply follow this procedure: + +=over 4 + +=item * + +Perform a normal configuration, specifying as prefix a directory where you have write permissions : + + perl Makefile.PL --prefix=~ + +The above would install the Smoke library in ~/lib and the puic binary in ~/bin + +=item * + +Reconfigure the Perl module so that it doesn't target the standard perl hierarchy: + + cd PerlQt + perl Makefile.PL PREFIX=~ + cd .. + +Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlQt +subdirectory + +=item * + +Compile and Install + + make && make install + +In order to use such an installation, you must tell to Perl where to find this extern hierarchy. +This can be done either on the command line: + + perl -Mlib="~/local/lib/perl/5.x.x" program.pl + +or at the top of your program: + + use lib qw( ~/local/lib/perl/5.x.x ); + +"5.x.x" should be changed to whatever Perl version your system is running. + +=back + +=head1 Anatomy of PerlQt + +A typical Qt program using GUI components is based on an event loop. + +This basically means that such a program is no more envisioned as a straight +flow where you would need to handle yourself every single events (such as a +mouse click or a key press). + +Instead, you just create an B<Application> object, create the GUI components it +uses, +define what objects methods need to be called when an event occurs, +and then start the main event loop. + +That's all! +Qt will handle all events and dispatch them to the correct subroutine. + +Lets see how this process is implemented in a minimal PerlQt program. + +=head2 Hello World + + 1: use Qt; + 2: my $a = Qt::Application(\@ARGV); + 3: my $hello = Qt::PushButton("Hello World!", undef); + 4: $hello->resize(160, 25); + 5: $a->setMainWidget($hello); + 6: $hello->show; + 7: exit $a->exec; + +=for html +<br/> +<div class='image'><img src="../images/ex1.png"/></div> + +This program first loads the Qt interface [line 1] and creates the application +object, passing it a reference to the command line arguments array C<@ARGV> +[l.2]. +This application object is unique, and may later be accessed from +anywhere through the B<Qt::app()> pointer. + +At line 3, we create a PushButton, which has no parent (i.e : it won't be +contained nor owned by another widget). +Therefore, we pass to the constructor an B<undef> value for the parent argument, +which is PerlQt's way of passing a Null pointer. + +After some layouting at [l.4], we tell the application object that our main +widget is this PushButton [l.5]... that way, it will know that closing the +window associated with this widget means : I<quit the application>. + +Now the last steps are to make this widget visible (as opposed to +hidden, which is the default) by calling the B<show> method on it [l.6] and +to start the application loop [l.7]. + +B<Syntax elements summary :> + +=over 4 + +=item 1 + +All Qt classes are accessed through the prefix B<Qt::>, which replaces the +initial B<Q> of Qt classes. +When browsing the L<Qt +documentation|"http://doc.trolltech.com>, you simply need to change the +name of classes so that B<QFoo> reads B<Qt::Foo>. + +=item 2 + +An object is created by calling the B<constructor> of the class. It has the +same name as the class itself. + +You don't need to say C<new Qt::Foo> or C<Qt::Foo-E<gt>new()> as most Perl +programmers would have expected. + +Instead, you just say : + + my $object = Qt::<classname>(arg_1, ..., arg_n); + + +If you don't need to pass any argument to the constructor, simply say : + + my $object = Qt::<classname>; + + +=item 3 + +Whenever you need to pass a Null pointer as an argument, use Perl's B<undef> +keyword. Do not pass zero. + Beware: this is by far the most common error in PerlQt programs. + +Pointers are arguments preceded by an B<*> +character in Qt's documentation (e.g: "C<QWidget * widget>"). + +=back + +=head2 Inheritance and Objects + +Before we can discuss how Perl subroutines can be called back from Qt, we need +to introduce PerlQt's inheritance mechanism. + +PerlQt was designed to couple as tightly as possible Qt's simplicity and Perl's +power and flexibility. + +In order to achieve that goal, the classical Object Oriented Perl paradigm had +to be extended, much in the same way than Qt itself +had to extend C++'s paradigm with B<metaobjects>. + +=head3 A Custom Widget + +Lets rewrite the "Hello World!" program, this time using a custom version +of PushButton: + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: + 7: sub NEW + 8: { + 9: shift->SUPER::NEW(@_[0..2]); + 10: resize(130, 40); + 11: } + 12: + 13: 1; + 14: + 15: package main; + 16: + 17: use Qt; + 18: use Button; + 19: + 20: my $a = Qt::Application(\@ARGV); + 21: my $w = Button("Hello World!", undef); + 22: $a->setMainWidget($w); + 23: $w->show; + 24: exit $a->exec; + +Here, we want to create our own version of the PushButton widget. +Therefore, we create a new package for it [l.3] and import Qt [l.4]. + +We now want to declare our widget as subclassing PushButton. +This is done through the use of the C<Qt::isa> pragma [l.5], which accepts a +list of one or more parent Qt classes. + +It is now time to create a B<constructor> for our new widget. +This is done by creating a subroutine called B<NEW> I<(note the capitalized +form, which differentate it from the usual "new" constructor. PerlQt's NEW +constructor is called >B<implicitly>I< as can be seen on line 21)>. + +Since we want our widget to call its parent's constructor first, we call the +B<superclass's constructor> (here: Qt::PushButton) on line 9, passing it all +arguments we received. + +At this time, a class instance has been created and stored into a special +object holder named B<this> (not C<$this> but really just C<this>). + +Each time you invoke a method from within your package, you may now +indifferently say C<method()> or C<this-E<gt>method()>; + +=head3 Using Attributes + +When building a new composite widget, you may just create its different +parts inside B<my> variables, since widgets are only deleted by their parents +and not necessarily when their container goes out of scope. + +In other words, PerlQt performs clever reference counting to prevent +indesirable deletion of objects. + +Now, you'll often want to keep an access to those parts from anywhere inside +your package. +For this purpose, you may use the B<this> object's blessed hash, as is usual in Perl, +but that isn't really convenient and you don't have any compile time +checking... + +Here come B<Attributes>. Attributes are data holders where you can +store any kind of properties for your object. + +Declaring new attributes is done through the C<use Qt::attributes> pragma, as is +demonstrated in the following package implementation : + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw( + 7: itsTime + 8: pData + 9: ); + 10: + 11: sub NEW + 12: { + 13: shift->SUPER::NEW(@_[0..2]); + 14: itsTime = Qt::Time; + 15: itsTime->start; + 16: pData = " Foo "; + 17: } + 18: + 19: sub resizeEvent + 20: { + 21: setText( "w: ". width() ." h: ". height() . + 22: "\nt: ". itsTime->elapsed . pData ); + 23: } + 24: + 25: 1; + +=for html +<br/> +<div class='image'><img src="../images/ex2.png"/></div> + + +An attribute itsTime is declared at line 7, and loaded with a C<Qt::Time> object +at line 14. + +Since we reimplement the virtual function "resizeEvent" [l.19]. +each time the main widget is resized, this function will be triggered and +our Button's text updated with values coming from the object [l.21] and from the +attributes we defined [l.22]. + +B<Recapitulation> + +=over 4 + +=item * + +In order to inherit a Qt class, a package must contain a +C<use Qt::isa> pragma. +e.g: + + use Qt::isa "Qt::widget"; + +=item * + +The object constructor is named B<NEW> and is implicitly called. +Thus you should not say : + + my $o = MyButton->NEW("Hello"); + +But say : + + my $o = MyButton("Hello"); + +=item * + +Within a package, the current instance can be accessed through the B<this> +variable. + +When a member function is called, arguments are loaded as usual in the B<@_> +array, but B<without> the object pointer itself. + +Hence, you shouldn't say : + + sub myMember + { + my $self = shift; + my $arg = shift; + $arg->doThat($self); + $self->doIt; + } + +But : + + sub myMember + { + my $arg = shift; + $arg->doThat(this); + doIt; + } + +Furthermore, if you want to call a base class method from a derived class, +you'd use the specal attribute SUPER : + + sub example + { + print "Now calling the base class\n"; + SUPER->example(@_) + } + +Note that the : + + this->SUPER::Example(@_); + +construct is also available, but will pass the object as first argument. + + +=item * + +Whenever you need to store a contained object in your package, you may define it +as an B<Attribute> : + + use Qt::attributes qw( + firstAttribute + ... + lastAttribute); + +and then use it as a convenient accessor : + + firstAttribute = myContainedWidget( this ); + firstAttribute->resize( 100, 100 ); + +=item * + +To reimplement a B<virtual function>, simply create a B<sub> with the +same name in your object. + +Existing virtual functions are marked as such in Qt's documentation +(they are prefixed with the "virtual" keyword). + +You can inspect what virtual function names are being called by Qt at runtime by +putting a C<use Qt::debug qw( virtual )> statement at the top of your program. + +=back + +=head2 Signals and Slots + +We'll now learn how Qt objects can communicate with each other, +allowing an event occuring, for instance, in a given widget to trigger the +execution of one or several subroutines anywhere inside your program. + +Most other toolkits use callbacks for that purpose, but Qt has a much more +powerful and flexible mechanism called B<Signals and Slots>. + +Signals and slots are used for communication between objects. + +This can be thought off as something similar to the wiring between several Hi-fI +components : an amplificator, for instance, has a set of output signals, wich are +emitted wether a listening device is connected to them or not. Also, a tape +recorder deck can start to record when it receives a signal wired to it's input +slot, and it doesn't need to know that this signal is also received by a CD +recorder device, or listened through headphones. + +A Qt component behaves just like that. It has several output B<Signals> and +several input B<Slots> - and each signal can be connected to an unlimited number +of listening slots of the same type, wether they are inside or outside the +component. + +The general syntax of this connection process is either : + +Qt::Object::connect( sender, SIGNAL 'mysignal(arg_type)', +receiver, SLOT 'myslot(arg_type)'); + +or + +myObject->connect( sender, SIGNAL 'mysignal(arg_type)', SLOT +'myslot(arg_type)'); + +This mechanism can be extended at will by the declaration of custom Signals and +Slots, through the C<use Qt::signals> and C<use Qt::slots> pragma +(see also the other syntax, later on). + +Each declared slot will call the corresponding subroutine in your object, +each declared signal can be raised through the B<emit> keyword. + +B<As an example, lets rewrite again our Button package :> + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw(itsTime); + 7: use Qt::slots + 8: wasClicked => [], + 9: change => ['int', 'int']; + 10: use Qt::signals + 11: changeIt => ['int', 'int']; + 12: + 13: sub NEW + 14: { + 15: shift->SUPER::NEW(@_[0..2]); + 16: itsTime = Qt::Time; + 17: itsTime->start; + 18: this->connect(this, SIGNAL 'clicked()', SLOT 'wasClicked()'); + 19: this->connect(this, SIGNAL 'changeIt(int,int)', SLOT 'change(int,int)'); + 20: } + 21: + 22: sub wasClicked + 23: { + 24: my $w = width(); + 25: my $h = height(); + 26: setText( "w: $w h: $h\nt: ". itsTime->elapsed ); + 27: emit changeIt($w, $h); + 28: } + 29: + 30: sub change + 31: { + 32: my ($w, $h) = @_; + 33: print STDERR "w: $w h: $h \n"; + 34: } + 35: + 36: 1; + +In this package, we define two extra slots and one extra signal. + +We know from the Qt Documentation that a clicked PushButton emits a C<clicked()> +signal, so we connect it to our new slot at line 18. + +We also connect our signal C<changeIt> to our own C<change> slot- which is +quite stupid, but as an example. + +Now, whenever our Button is clicked, the C<clicked()> signal is raised and +triggers the C<wasClicked()> slot. C<wasClicked> then proceeds to emit +the C<changeIt(int,int)> signal [l.27], hence triggering the C<change(int,int)> +slot with two arguments. + +Finally, since PerlQt-3.008, an alternative syntax can be used to declare Signals and Slots: + + sub a_slot : SLOT(int, QString) + { + $int = shift; + $string = shift; + # do something + } + +and + + sub a_signal : SIGNAL(QString); + +This syntax is perfectly compatible with the traditional +C<use Qt::signals> and C<use Qt::slots> declarations. + +Eventually, it can prove good programming practice to mix both syntaxes, by first declaring +Signals/Slots with C<use Qt::slots/signals>, then repeat this declaration +in the actual implementation with the second syntax. + +Declarations will be checked for consistency at compile time, and any mismatch +in arguments would trigger a warning. + +=head1 RAD prototyping with Qt Designer and Puic + +=head2 Introduction + +=over 4 + +=item * Note: + +As of PerlQt-3.008, a separate PerlQt plugin for Qt Designer is available, +bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlQt project +entirely from the Designer GUI. +Nevertheless, the below is still accurate with regard to puic command line interaction +and with regard to using Qt Designer I<without> the specific plugin. + +=back + +As efficient and intuitive as Qt can be, building a complete GUI from scratch +is often a tedious task. + +Hopefully, Qt comes with a very sophisticated GUI Builder named Qt +Designer, which is close to a complete integrated development environment. +It features Project management, drag'n drop GUI building, a complete object +browser, graphical interconnection of signals and slots, and much much more. + +Qt Designer's output is XML which can be parsed by several command line tools, +among whose is B<puic> (the PerlQt User Interface Compiler). + +Assuming you have already built an interface file with the Designer, +translating it to a PerlQt program is simply a matter of issuing +one command : + + puic -x -o program.pl program.ui + +This will generate the package defined in your ui file and a basic main package +for testing purposes. + +You may prefer : + + puic -o package.pm program.ui + +This will only generate the package, which can then be used by a separate +program. + +=head2 Embedding Images + +If you need to B<embed images or icons>, it can be done in two ways +: + +=over 4 + +=item * Inline embedding + +For this, you need to check the "Edit->Form Settings->Pixmaps->Save inline" +checkbox inside Qt Designer. +Then : puic -x -o F<program.pl> F<program.ui> + +=item * Image Collection + +This option is more complex but also far more powerful and clean. + +puic -o F<Collection.pm> -embed F<unique_identifier> F<image-1> ... F<image-n> + +Then add a C<use Collection.pm> statement to your program's main package. + +If you've created a project file in Qt Designer, and added all images +you want to group (through "Project->Image Collection"), you'll find all those +images inside the directory where your project file (*.pro) is stored, under +/images. +You can then generate the corresponding image collection by issuing : + +puic -o F<Collection.pm> -embed F<identifier> ../images/* + +You can use as many image collections as you want in a program. Simply add a +B<use> statement for each collection. + +=back + +=head2 Working With B<.ui> Files + +It will often happen that you need to regenerate your user interface -either +because you changed your initial design, or you want to extend it. +Thus writing your program's code straight in the auto-generated Perl file is +quite a bad idea. +You'd run constantly the risk of overwriting your handcrafted code, or end +up doing lot of copy-paste. + +Instead, you may : + +=over 4 + +=item * Write slots implementation in the Designer + +In Qt Designer, select the I<Source> tab of the B<Object Explorer>. +There you can see a tree-like representation of your classes. +Now if you double-click on the I<Slots/public> entry, +you are prompted with a dialog where you can create a new custom slot for +your module. +Once this is done, the new slot appear inside the B<Object Explorer> tree and +clicking on it will bring you to a B<E<lt>Your ClassE<gt>.ui.h> file where you can write +the actual implementation of your slot. + +Keeping all the defaults, it should look like this : + + void Form1::newSlot() + { + + } + +The slot declaration is actually C++ code, but simply ignore it and write +your Perl code straight between the two braces, paying special attention to +indent it at least by one space. + + void Form1::newSlot() + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # do something + } + } + +All Perl code written this way will be saved to the ui.h file, and B<puic> will take care of +placing it back in the final program. + +Here, after running B<puic> on the Form1.ui file, you'd have: + + sub newSlot + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # do something + } + } + +=item * Subclassing your GUI + +By using B<puic>'s I<-subimpl> option, you may generate a derived module +inheriting your original user interface. + +You'd typically generate the derived module once, and write any handcrafted +code in this child. +Then, whenever you need to modify your GUI module, simply regenerate the +parent module, and your child will inherit those changes. + +To generate the base module : + + puic -o Form1.pm form1.ui + +(do this as often as needed, never edit by hand) + +To generate the child : + + puic -o Form2.pm -subimpl Form2 form1.ui + +or + + puic -o program.pl -x -subimpl Form2 form1.ui + +(do this once and work on the resulting file) + +=back + +=head1 More development tools + +PerlQt comes bundled with two simple programs that can help you to find your way through +the Qt API: + +=head2 pqtapi + +pqtapi is a commandline driven introspection tool. + + usage: pqtapi [-r <re>] [<class>] + + options: + -r <re> : find all functions matching regular expression/keyword <re> + -i : together with -r, performs a case insensitive search + -v : print PerlQt and Qt versions + -h : print this help message + +e.g: + + $>pqtapi -ir 'setpoint.* int' + void QCanvasLine::setPoints(int, int, int, int) + void QPointArray::setPoint(uint, int, int) + +=head2 pqtsh + +B<pqtsh> is a graphical shell that can be used to test the API interactively. +It is fairly self explanatory and includes an interactive example (C<Help-E<gt>Example>) + +=for html +<br/> +<div class='image'><img src="../images/pqtsh.png"/></div> + +=head1 Known Limitations + +Templated classes aren't available yet (classes derived from templated classes are). + +=head1 Credits + +PerlQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand) + +Kalyptus and the Smoke generation engine are (c) David Faure and Richard Dale + +Puic is (c) TrollTech AS., Phil Thompson and Germain Garand, + +The mentioned software is released under the GNU Public Licence v.2 or later. + + +=head1 Appendix 1 : C++ conventions and their Perl counterpart + +Whenever you want to use a class/method described in Qt's +L<documentation|"http://doc.trolltech.com"> (see also the 'assistant' program bundled with Qt) +from PerlQt, you need to follow some simple translation rules. + +=over 4 + +=item Classnames + +=over 4 + +=item * + +All classnames are changed from a B<Q> prefix in Qt to a B<Qt::> prefix +in Perl. +e.g: QComboBox is named Qt::ComboBox within PerlQt. + +=back + +=item Functions + +=over 4 + +=item * + +Functions referenced as B<static> are accessed directly, and not through +an object. Thus the static function Foo in class QBar would be accessed from +PerlQt as + + Qt::Bar::Foo( arg-1,...,arg-n); + +The only notable exceptions are : + + qApp() will map to Qt::app() + qVersion() will map to Qt::version() # not really needed anymore: we have qVersion(). See Global Functions below. + +=item * + +Functions referenced as B<members> or B<Signals> are accessed through an object +with the B<-E<gt>> operator. +e.g: + + $widget->show; + +There are no fundamental differences between methods and signals, however PerlQt +provides the B<emit> keyword as a convenient mnemonic, so that it is clear you +are emitting a signal : + + emit $button->clicked; + +=back + +=item Arguments + +=over 4 + +=item * By value + +When an argument isn't preceded by the B<&> or B<*> character, it is passed by +value. For all basic types such as int, char, float and double, PerlQt will +automatically convert litteral and scalar values to the corresponding C++ type. + +Thus for a constructor prototype written as follow in the documentation : + + QSize ( int w, int h ) + + +You'd say : + + Qt::Size(8, 12); + + +=item * By reference + +When an argument is preceded by the B<&> character, it means a reference to an +object or to a type is expected. You may either provide a variable name or a +temporary object : + + $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $widget->setAccel( $keyseq ); + +or + + $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + +If the argument isn't qualified as B<const> (constant), it means the passed +object may be altered during the process - you must then provide a variable. + +=item * By pointer + +When an argument is preceded by the B<*> character, it means a +pointer to an object or to a type is expected. You may provide a variable +name or the Perl B<undef> keyword for a Null pointer. + +Similarly, if the argument isn't B<const>, the passed object may be altered by +the method call. + +=back + +=item Enumerations + +Enumerations are sort of named aliases for numeric values that would be hard to +remember otherwise. + +A C++ example would be : + + enum Strange { Apple, Orange, Lemon } + +where C<Strange> is the generic enumeration name, and C<Apple>, C<Orange>, +C<Lemon> its possible values, which are only aliases for numbers (here 0, 1 +and 2). + +Access to enumerations values in Perl Qt is very similar to a static function +call. In fact, it B<is> a static function call. + +Therefore, since you probably want to avoid some readability problems, we +recommend the use of the alternate function call syntax : C<&function>. + +Lets now go back to our C<Strange> example. + +If its definition was encountered in the class C<QFruits>, you'd write from +PerlQt : + + $apple_plus_orange = &Qt::Fruit::Apple + &Qt::Fruit::Orange; + +=item Operators + +Within PerlQt, B<operators overloading> works transparently. +If a given operator is overloaded in a Qt class (which means using it triggers a custom method) +it will behave identically in PerlQt. +Beware though that due to limitations of the Smoke binding library, not all overloaded operators are +available in PerlQt. +You can check the availability of a given operator by using the pqtapi program. +Also, due to outstanding differences between C++'s and Perl's object paradigm, the copy constructor operator (a.k.a '=') +has been disabled. + +e.g-1: '+=' overload + + $p1 = Qt::Point(10, 10) + $p2 = Qt::Point(30,40) + $p2 += $p1; # $p2 becomes (40,50) + +e.g-2: '<<' overload + + $f = Qt::File("example"); + $f->open( IO_WriteOnly ); # see 'Constants' below + $s = Qt::TextStream( $f ); + $s << "What can I do with " << 12 << " apples?"; + +=item Constants + +Qt doesn't use many constants, but there is at least one place where they are used : for setting +Input/Output flags on files. +In order to avoid the namespace pollution induced by global constants, PerlQt group them in the B<Qt::constants> module. +For instance, requesting the importation of all IO constants into the current namespace would be done with: + + use Qt::constants; + +You may also import specific symbols: + + use Qt::constants qw( IO_ReadOnly IO_WriteOnly ); + +=item Global Functions + + +Qt has also some utilitarian functions such as bitBlt, qCompress, etc. + +Those were global scope functions and have been grouped in a common namespace: +C<Qt::GlobalSpace>. + +Hence, you shall access this namespace either with a fully qualified call: + + Qt::GlobalSpace::qUncompress( $buffer ) + +Or directly, after importation in the current namespace: + + use Qt::GlobalSpace; + qUncompress( $buffer ) + +Of course, you may selectively import a few functions: + + use Qt::GlobalSpace qw( qUncompress bitBlt ) + +B<Note:> GlobalSpace has also operators, such has the one performing an addition on two +Qt::Point(). Those operators are called automatically. + +e.g: + + $p1 = Qt::Point(10, 10) + Qt::Point(20, 20) + +=back + + +=head1 Appendix 2 : Internationalization + +PerlQt handles internationalization by always converting B<QString> back to B<utf8> in Perl. + +Conversions from Perl strings to QStrings are made according to context : + +=over 4 + +=item * If the Perl string is already utf8-encoded + +then the string will be converted straight to QString. + +This is the most convenient and seemless way of internationalizing your application. Typically, one would just enable +the use of utf8 in source code with the C<use utf8> pragma and write its application with an utf8 aware editor. + +=item * If the string isn't tagged as utf8, and the B<use locale> pragma is not set + +then the string will be converted to QString's utf8 from B<ISO-Latin-1>. + +=item * If the string isn't tagged as utf8 and the B<use locale> pragma is set + +then the string will be converted to QString's utf8 according to the currently set B<locale>. + +=back + +Once a string contains utf8, you can convert it back to any locale by setting up B<converters> : + + $tr1=Qt::TextCodec::codecForLocale(); # this one will use current locale + $tr2=Qt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian) + + print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr2->fromUnicode($my_utf8_string); + +Or, with Perl >= 5.8.0, you may use Perl's B<Encode> modules (see C<perldoc Encode>). + +=head3 disabling utf-8 + +Developers who don't want to use UTF-8 or want to temporarily disable UTF-8 marshalling +for handling legacy programs may use the B<use bytes> pragma (and the corresponding B<no bytes>). + +Within the scope of this pragma, QStrings are marshalled back to ISO-Latin1 (default) or to your locale +(if B<use locale> has been set). + +Frivole use of this pragma is strongly discouraged as it ruins worldwide standardization efforts. + +=head1 Appendix 3 : Debugging Channels + +The B<Qt::debug> module offers various debugging channels/features. + + use Qt::debug; + + use Qt::debug qw|calls autoload verbose|; + +With the simple C<use Qt::debug> statement, the B<verbose> and B<ambiguous> channels are activated. +If you specify a list of channels within the use statement, then only the specified channels will be enabled. + +B<Available channels :> + +=over 4 + +=item * ambiguous + +Check if method and function calls are ambiguous, and tell which of the alternatives +was finally elected. + +=item * verbose + +Enable more verbose debugging. + +Together with B<ambiguous>, tell you the nearest matches in case +a method or function call fails. +e.g: + + use Qt; + use Qt::debug; + $a= Qt::Application(\@ARGV); + $a->libraryPath("foo"); + + --- No method to call for : + QApplication::libraryPath('foo') + Closer candidates are : + static void QApplication::addLibraryPath(const QString&) + static QStringList QApplication::libraryPaths() + static void QApplication::removeLibraryPath(const QString&) + static void QApplication::setLibraryPaths(const QStringList&) + +=item * calls + +For every call, tell what corresponding Qt method is called +(detailing the arguments if B<verbose> is on). + +=item * autoload + +Track the intermediate code between a method invocation in Perl +and its resolution to either a Qt or Perl call. + +=item * gc + +Give informations about garbage collection +whenever a Qt object is deleted and/or a Perl object is destroyed + +=item * virtual + +Report whenever a virtual function tries to access its Perl +reimplementation (wether it exists or not). + +=item * all + +Enable all channels + +=back + + +=head1 Appendix 4 : Marshallers + +A marshaller is a piece of "glue code" translating a given datatype to another. + +Within PerlQt, most Qt objects keep their object nature, so that one may invoke methods on them. +However, some classes and datatypes map so naturally to some Perl types that keeping their object nature would +would feel unnatural and clumsy. + +For instance, instead of returning a Qt::StringList object, which would require an iterator to retrieve its content, +PerlQt will translate it to an array reference containing all the object's strings. + +In the other way, instead of providing a Qt::StringList object as an argument of a method, one would simply +provide the reference to an array of Perl strings. + +Here is the list of Marshallers as of PerlQt-3.008 : + + ----------------------------------------------------------------- + float, double <=> Perl real (NV) + char, uchar, int, uint, enum + long, ulong, short, ushort <=> Perl integer (IV) + QString, -&, -* => Perl string (utf8) + QString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) + QCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) + QByteArray, -&, -* <=> Perl string (bytes) + QStringList, -&, -* => Reference to an array of Perl strings (utf8) + QString, -&, -* => Perl string (utf8 or iso-latin1 or locale) + int&, -* <=> Perl integer (IV) + bool&, -* <=> Perl boolean + char* <=> Perl string (bytes) + char** <= Reference to an array of Perl strings (bytes) + uchar* <= Perl string (bytes) + QRgb* <= Reference to an array of Perl integers (IV) + QCOORD* <= Reference to an array of Perl integers (IV) + void* <=> Reference to a Perl integer (IV) + QValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) + QCanvasItemList, - *, - & => Reference to an array of Qt::CanvasItem + QWidgetList, - *, - & <=> Reference to an array of Qt::Widget + QObjectList, - *, - & <=> Reference to an array of Qt::Object + QFileInfoList, - *, - & <=> Reference to an array of Qt::FileInfo + QPtrList<QTab>, - *, - & <=> Reference to an array of Qt::Tab + QPtrList<QToolBar>, - *, - & <=> Reference to an array of Qt::ToolBar + QPtrList<QNetworkOperation>, - *, - & <=> Reference to an array of Qt::NetworkOperation + QPtrList<QDockWindow>, - *, - & <=> Reference to an array of Qt::DockWindow + (QUObject*) + + + + + diff --git a/doc/en/index.html b/doc/en/index.html new file mode 100644 index 0000000..6a4cc7b --- /dev/null +++ b/doc/en/index.html @@ -0,0 +1,1081 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Programming PerlQt</title> +<link rel="stylesheet" href="../css/pod.css" type="text/css" /> +<link rev="made" href="mailto:root@localhost" /> +</head> + +<body> + +<p><a name="__index__"></a></p> +<!-- INDEX BEGIN --> + +<ul> + + <li><a href="#programming_perlqt">Programming PerlQt</a></li> + <li><a href="#introduction">Introduction</a></li> + <li><a href="#installation">Installation</a></li> + <ul> + + <li><a href="#requirements">Requirements</a></li> + <li><a href="#compilation">Compilation</a></li> + <li><a href="#troubleshooting_and_configure_options">Troubleshooting and Configure Options</a></li> + <li><a href="#how_to_install_perlqt_with_user_rights">How to install PerlQt with user rights</a></li> + </ul> + + <li><a href="#anatomy_of_perlqt">Anatomy of PerlQt</a></li> + <ul> + + <li><a href="#hello_world">Hello World</a></li> + <li><a href="#inheritance_and_objects">Inheritance and Objects</a></li> + <ul> + + <li><a href="#a_custom_widget">A Custom Widget</a></li> + <li><a href="#using_attributes">Using Attributes</a></li> + </ul> + + <li><a href="#signals_and_slots">Signals and Slots</a></li> + </ul> + + <li><a href="#rad_prototyping_with_qt_designer_and_puic">RAD prototyping with Qt Designer and Puic</a></li> + <ul> + + <li><a href="#introduction">Introduction</a></li> + <li><a href="#embedding_images">Embedding Images</a></li> + <li><a href="#working_with_.ui_files">Working With <strong>.ui</strong> Files</a></li> + </ul> + + <li><a href="#more_development_tools">More development tools</a></li> + <ul> + + <li><a href="#pqtapi">pqtapi</a></li> + <li><a href="#pqtsh">pqtsh</a></li> + </ul> + + <li><a href="#known_limitations">Known Limitations</a></li> + <li><a href="#credits">Credits</a></li> + <li><a href="#appendix_1_:_c++_conventions_and_their_perl_counterpart">Appendix 1 : C++ conventions and their Perl counterpart</a></li> + <li><a href="#appendix_2_:_internationalization">Appendix 2 : Internationalization</a></li> + <ul> + + <ul> + + <li><a href="#disabling_utf8">disabling utf-8</a></li> + </ul> + + </ul> + + <li><a href="#appendix_3_:_debugging_channels">Appendix 3 : Debugging Channels</a></li> + <li><a href="#appendix_4_:_marshallers">Appendix 4 : Marshallers</a></li> +</ul> +<!-- INDEX END --> + +<hr /> +<p> +</p> +<h1><a name="programming_perlqt">Programming PerlQt</a></h1> +<p><strong>Germain Garand</strong></p> +<p>This document describes a set of Perl bindings for the Qt toolkit. Contact +the author at <<a href="mailto:germain@ebooksfrance.com">germain@ebooksfrance.com</a>></p> +<p> +</p> +<hr /> +<h1><a name="introduction">Introduction</a></h1> +<p>PerlQt-3 is Ashley Winters' full featured object oriented interface to +<a href="http://www.trolltech.com">Trolltech</a>'s C++ Qt toolkit v3.0.</p> +<p>It is based on the +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SMOKE</a> +library, a language independent low-level wrapper generated from Qt headers by +Richard Dale's +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus">kalyptus</a> +thanks to David Faure's module.</p> +<p>This document describes the principles of PerlQt programming. +It assumes you have some basic Perl Object Oriented programming knowledge.</p> +<p>Some C++ knowledge is recommended but not required. +It would mostly help you to find your way through <a href="http://doc.trolltech.com">Qt's excellent documentation</a> which is our +ultimate and only reference. +If Qt is installed on your system, then you most probably +also have its documentation. Try the <code>$QTDIR/bin/assistant</code> program.</p> +<p> +</p> +<hr /> +<h1><a name="installation">Installation</a></h1> +<p> +</p> +<h2><a name="requirements">Requirements</a></h2> +<p>To compile and use PerlQt, you'll need :</p> +<ul> +<li></li> +a POSIX system +<p></p> +<li></li> +GNU tools : automake(>=1.5), autoconf (>=2.13), aclocal... +<p></p> +<li></li> +<a href="http://www.perl.org">Perl >= v5.6.0</a> +<p></p> +<li></li> +<a href="http://www.trolltech.com/developer/download/qtx11.html">Qt >= v3.0</a> +<p></p> +<li></li> +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SmokeQt 1.2.1</a> +The SMOKE library (Scripting Meta Object Kompiler) is part of <a href="http://www.kde.org">KDE</a>'s <strong>kdebindings</strong> module. +You may want to check if a precompiled version of this module exists for your +system. +PerlQt is packaged with its own copy, so you don't need to check it out. +<p></p></ul> +<p>Perl and Qt's installation is out of the scope of this document. Please refer +to those projects' documentation.</p> +<p> +</p> +<h2><a name="compilation">Compilation</a></h2> +<p>PerlQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven +by the Makefile.PL wrapper. All options are forwarded to ./configure :</p> +<pre> + perl Makefile.PL</pre> +<p>If SMOKE is missing, <code>configure</code> will generate its sources. +Then :</p> +<pre> + make</pre> +<pre> + make install</pre> +<p>This will install PerlQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities.</p> +<p>The preferred install location for SMOKE and Puic is in the KDE3 file system. +If you don't have KDE3 installed, specify a location with <code>configure</code>'s +<code>--prefix</code> option. e.g:</p> +<pre> + perl Makefile.PL --prefix=/usr</pre> +<p> +</p> +<h2><a name="troubleshooting_and_configure_options">Troubleshooting and Configure Options</a></h2> +<p>If Smoke's linking fails or your Qt library was built with very specific +options, run Makefile.PL again with:</p> +<pre> + perl Makefile.PL --with-threshold=0</pre> +<p>When building smoke, configure will check for OpenGL and try to compile +support for it if it is properly installed and supported by Qt.</p> +<p>You may disable this checking with:</p> +<pre> + --disable-GL</pre> +<p>Also, default behaviour is to prefer the Mesa GL library over a proprietary +implementation. +If your system features a proprietary OpenGL library, and you'd like to use +it, specify:</p> +<pre> + --without-Mesa</pre> +<p> +</p> +<h2><a name="how_to_install_perlqt_with_user_rights">How to install PerlQt with user rights</a></h2> +<p>To install PerlQt without super-user rights, simply follow this procedure:</p> +<ul> +<li></li> +Perform a normal configuration, specifying as prefix a directory where you have write permissions : +<pre> + perl Makefile.PL --prefix=~</pre> +<p>The above would install the Smoke library in ~/lib and the puic binary in ~/bin</p> +<p></p> +<li></li> +Reconfigure the Perl module so that it doesn't target the standard perl hierarchy: +<pre> + cd PerlQt + perl Makefile.PL PREFIX=~ + cd ..</pre> +<p>Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlQt +subdirectory</p> +<p></p> +<li></li> +Compile and Install +<pre> + make && make install</pre> +<p>In order to use such an installation, you must tell to Perl where to find this extern hierarchy. +This can be done either on the command line:</p> +<pre> + perl -Mlib="~/local/lib/perl/5.x.x" program.pl</pre> +<p>or at the top of your program:</p> +<pre> + use lib qw( ~/local/lib/perl/5.x.x );</pre> +<p>``5.x.x'' should be changed to whatever Perl version your system is running.</p> +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="anatomy_of_perlqt">Anatomy of PerlQt</a></h1> +<p>A typical Qt program using GUI components is based on an event loop.</p> +<p>This basically means that such a program is no more envisioned as a straight +flow where you would need to handle yourself every single events (such as a +mouse click or a key press).</p> +<p>Instead, you just create an <strong>Application</strong> object, create the GUI components it +uses, +define what objects methods need to be called when an event occurs, +and then start the main event loop.</p> +<p>That's all! +Qt will handle all events and dispatch them to the correct subroutine.</p> +<p>Lets see how this process is implemented in a minimal PerlQt program.</p> +<p> +</p> +<h2><a name="hello_world">Hello World</a></h2> +<pre> + 1: use Qt; + 2: my $a = Qt::Application(\@ARGV); + 3: my $hello = Qt::PushButton("Hello World!", undef); + 4: $hello->resize(160, 25); + 5: $a->setMainWidget($hello); + 6: $hello->show; + 7: exit $a->exec;</pre> +<br/> +<div class='image'><img src="../images/ex1.png"/></div><p>This program first loads the Qt interface [line 1] and creates the application +object, passing it a reference to the command line arguments array <code>@ARGV</code> +[l.2]. +This application object is unique, and may later be accessed from +anywhere through the <strong>Qt::app()</strong> pointer.</p> +<p>At line 3, we create a PushButton, which has no parent (i.e : it won't be +contained nor owned by another widget). +Therefore, we pass to the constructor an <strong>undef</strong> value for the parent argument, +which is PerlQt's way of passing a Null pointer.</p> +<p>After some layouting at [l.4], we tell the application object that our main +widget is this PushButton [l.5]... that way, it will know that closing the +window associated with this widget means : <em>quit the application</em>.</p> +<p>Now the last steps are to make this widget visible (as opposed to +hidden, which is the default) by calling the <strong>show</strong> method on it [l.6] and +to start the application loop [l.7].</p> +<p><strong>Syntax elements summary :</strong></p> +<ol> +<li></li> +All Qt classes are accessed through the prefix <strong>Qt::</strong>, which replaces the +initial <strong>Q</strong> of Qt classes. +When browsing the <a href="http://doc.trolltech.com">Qt documentation</a>, you simply need to change the +name of classes so that <strong>QFoo</strong> reads <strong>Qt::Foo</strong>. +<p></p> +<li></li> +An object is created by calling the <strong>constructor</strong> of the class. It has the +same name as the class itself. +<p>You don't need to say <code>new Qt::Foo</code> or <code>Qt::Foo->new()</code> as most Perl +programmers would have expected.</p> +<p>Instead, you just say :</p> +<pre> + my $object = Qt::<classname>(arg_1, ..., arg_n);</pre> +<p>If you don't need to pass any argument to the constructor, simply say :</p> +<pre> + my $object = Qt::<classname>;</pre> +<p></p> +<li></li> +Whenever you need to pass a Null pointer as an argument, use Perl's <strong>undef</strong> +keyword. Do not pass zero. + Beware: this is by far the most common error in PerlQt programs. +<p>Pointers are arguments preceded by an <strong>*</strong> +character in Qt's documentation (e.g: ``<code>QWidget * widget</code>'').</p> +<p></p></ol> +<p> +</p> +<h2><a name="inheritance_and_objects">Inheritance and Objects</a></h2> +<p>Before we can discuss how Perl subroutines can be called back from Qt, we need +to introduce PerlQt's inheritance mechanism.</p> +<p>PerlQt was designed to couple as tightly as possible Qt's simplicity and Perl's +power and flexibility.</p> +<p>In order to achieve that goal, the classical Object Oriented Perl paradigm had +to be extended, much in the same way than Qt itself +had to extend C++'s paradigm with <strong>metaobjects</strong>.</p> +<p> +</p> +<h3><a name="a_custom_widget">A Custom Widget</a></h3> +<p>Lets rewrite the ``Hello World!'' program, this time using a custom version +of PushButton:</p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: + 7: sub NEW + 8: { + 9: shift->SUPER::NEW(@_[0..2]); + 10: resize(130, 40); + 11: } + 12: + 13: 1; + 14: + 15: package main; + 16: + 17: use Qt; + 18: use Button; + 19: + 20: my $a = Qt::Application(\@ARGV); + 21: my $w = Button("Hello World!", undef); + 22: $a->setMainWidget($w); + 23: $w->show; + 24: exit $a->exec;</pre> +<p>Here, we want to create our own version of the PushButton widget. +Therefore, we create a new package for it [l.3] and import Qt [l.4].</p> +<p>We now want to declare our widget as subclassing PushButton. +This is done through the use of the <code>Qt::isa</code> pragma [l.5], which accepts a +list of one or more parent Qt classes.</p> +<p>It is now time to create a <strong>constructor</strong> for our new widget. +This is done by creating a subroutine called <strong>NEW</strong> <em>(note the capitalized +form, which differentate it from the usual ``new'' constructor. PerlQt's NEW +constructor is called </em><strong>implicitly</strong><em> as can be seen on line 21)</em>.</p> +<p>Since we want our widget to call its parent's constructor first, we call the +<strong>superclass's constructor</strong> (here: Qt::PushButton) on line 9, passing it all +arguments we received.</p> +<p>At this time, a class instance has been created and stored into a special +object holder named <strong>this</strong> (not <code>$this</code> but really just <code>this</code>).</p> +<p>Each time you invoke a method from within your package, you may now +indifferently say <code>method()</code> or <code>this->method()</code>;</p> +<p> +</p> +<h3><a name="using_attributes">Using Attributes</a></h3> +<p>When building a new composite widget, you may just create its different +parts inside <strong>my</strong> variables, since widgets are only deleted by their parents +and not necessarily when their container goes out of scope.</p> +<p>In other words, PerlQt performs clever reference counting to prevent +indesirable deletion of objects.</p> +<p>Now, you'll often want to keep an access to those parts from anywhere inside +your package. +For this purpose, you may use the <strong>this</strong> object's blessed hash, as is usual in Perl, +but that isn't really convenient and you don't have any compile time +checking...</p> +<p>Here come <strong>Attributes</strong>. Attributes are data holders where you can +store any kind of properties for your object.</p> +<p>Declaring new attributes is done through the <code>use Qt::attributes</code> pragma, as is +demonstrated in the following package implementation :</p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw( + 7: itsTime + 8: pData + 9: ); + 10: + 11: sub NEW + 12: { + 13: shift->SUPER::NEW(@_[0..2]); + 14: itsTime = Qt::Time; + 15: itsTime->start; + 16: pData = " Foo "; + 17: } + 18: + 19: sub resizeEvent + 20: { + 21: setText( "w: ". width() ." h: ". height() . + 22: "\nt: ". itsTime->elapsed . pData ); + 23: } + 24: + 25: 1;</pre> +<br/> +<div class='image'><img src="../images/ex2.png"/></div><p>An attribute itsTime is declared at line 7, and loaded with a <code>Qt::Time</code> object +at line 14.</p> +<p>Since we reimplement the virtual function ``resizeEvent'' [l.19]. +each time the main widget is resized, this function will be triggered and +our Button's text updated with values coming from the object [l.21] and from the +attributes we defined [l.22].</p> +<p><strong>Recapitulation</strong></p> +<ul> +<li></li> +In order to inherit a Qt class, a package must contain a +<code>use Qt::isa</code> pragma. +e.g: + +<pre> + + use Qt::isa "Qt::widget";</pre> +<p></p> +<li></li> +The object constructor is named <strong>NEW</strong> and is implicitly called. +Thus you should not say : +<pre> + my $o = MyButton->NEW("Hello");</pre> +<p>But say :</p> +<pre> + my $o = MyButton("Hello");</pre> +<p></p> +<li></li> +Within a package, the current instance can be accessed through the <strong>this</strong> +variable. +<p>When a member function is called, arguments are loaded as usual in the <strong>@_</strong> +array, but <strong>without</strong> the object pointer itself.</p> +<p>Hence, you shouldn't say :</p> +<pre> + sub myMember + { + my $self = shift; + my $arg = shift; + $arg->doThat($self); + $self->doIt; + } + +But :</pre> +<pre> + sub myMember + { + my $arg = shift; + $arg->doThat(this); + doIt; + }</pre> +<p>Furthermore, if you want to call a base class method from a derived class, +you'd use the specal attribute SUPER :</p> +<pre> + sub example + { + print "Now calling the base class\n"; + SUPER->example(@_) + }</pre> +<p>Note that the :</p> +<pre> + this->SUPER::Example(@_);</pre> +<p>construct is also available, but will pass the object as first argument.</p> +<p></p> +<li></li> +Whenever you need to store a contained object in your package, you may define it +as an <strong>Attribute</strong> : +<pre> + use Qt::attributes qw( + firstAttribute + ... + lastAttribute);</pre> +<p>and then use it as a convenient accessor :</p> +<pre> + firstAttribute = myContainedWidget( this ); + firstAttribute->resize( 100, 100 );</pre> +<p></p> +<li></li> +To reimplement a <strong>virtual function</strong>, simply create a <strong>sub</strong> with the +same name in your object. +<p>Existing virtual functions are marked as such in Qt's documentation +(they are prefixed with the ``virtual'' keyword).</p> +<p>You can inspect what virtual function names are being called by Qt at runtime by +putting a <code>use Qt::debug qw( virtual )</code> statement at the top of your program.</p> +<p></p></ul> +<p> +</p> +<h2><a name="signals_and_slots">Signals and Slots</a></h2> +<p>We'll now learn how Qt objects can communicate with each other, +allowing an event occuring, for instance, in a given widget to trigger the +execution of one or several subroutines anywhere inside your program.</p> +<p>Most other toolkits use callbacks for that purpose, but Qt has a much more +powerful and flexible mechanism called <strong>Signals and Slots</strong>.</p> +<p>Signals and slots are used for communication between objects.</p> +<p>This can be thought off as something similar to the wiring between several Hi-fI +components : an amplificator, for instance, has a set of output signals, wich are +emitted wether a listening device is connected to them or not. Also, a tape +recorder deck can start to record when it receives a signal wired to it's input +slot, and it doesn't need to know that this signal is also received by a CD +recorder device, or listened through headphones.</p> +<p>A Qt component behaves just like that. It has several output <strong>Signals</strong> and +several input <strong>Slots</strong> - and each signal can be connected to an unlimited number +of listening slots of the same type, wether they are inside or outside the +component.</p> +<p>The general syntax of this connection process is either :</p> +<p>Qt::Object::connect( sender, SIGNAL 'mysignal(arg_type)', +receiver, SLOT 'myslot(arg_type)');</p> +<p>or</p> +<p>myObject->connect( sender, SIGNAL 'mysignal(arg_type)', SLOT +'myslot(arg_type)');</p> +<p>This mechanism can be extended at will by the declaration of custom Signals and +Slots, through the <code>use Qt::signals</code> and <code>use Qt::slots</code> pragma +(see also the other syntax, later on).</p> +<p>Each declared slot will call the corresponding subroutine in your object, +each declared signal can be raised through the <strong>emit</strong> keyword.</p> +<p><strong>As an example, lets rewrite again our Button package :</strong></p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw(itsTime); + 7: use Qt::slots + 8: wasClicked => [], + 9: change => ['int', 'int']; + 10: use Qt::signals + 11: changeIt => ['int', 'int']; + 12: + 13: sub NEW + 14: { + 15: shift->SUPER::NEW(@_[0..2]); + 16: itsTime = Qt::Time; + 17: itsTime->start; + 18: this->connect(this, SIGNAL 'clicked()', SLOT 'wasClicked()'); + 19: this->connect(this, SIGNAL 'changeIt(int,int)', SLOT 'change(int,int)'); + 20: } + 21: + 22: sub wasClicked + 23: { + 24: my $w = width(); + 25: my $h = height(); + 26: setText( "w: $w h: $h\nt: ". itsTime->elapsed ); + 27: emit changeIt($w, $h); + 28: } + 29: + 30: sub change + 31: { + 32: my ($w, $h) = @_; + 33: print STDERR "w: $w h: $h \n"; + 34: } + 35: + 36: 1;</pre> +<p>In this package, we define two extra slots and one extra signal.</p> +<p>We know from the Qt Documentation that a clicked PushButton emits a <code>clicked()</code> +signal, so we connect it to our new slot at line 18.</p> +<p>We also connect our signal <code>changeIt</code> to our own <code>change</code> slot- which is +quite stupid, but as an example.</p> +<p>Now, whenever our Button is clicked, the <code>clicked()</code> signal is raised and +triggers the <code>wasClicked()</code> slot. <code>wasClicked</code> then proceeds to emit +the <code>changeIt(int,int)</code> signal [l.27], hence triggering the <code>change(int,int)</code> +slot with two arguments.</p> +<p>Finally, since PerlQt-3.008, an alternative syntax can be used to declare Signals and Slots:</p> +<pre> + sub a_slot : SLOT(int, QString) + { + $int = shift; + $string = shift; + # do something + }</pre> +<p>and</p> +<pre> + sub a_signal : SIGNAL(QString);</pre> +<p>This syntax is perfectly compatible with the traditional +<code>use Qt::signals</code> and <code>use Qt::slots</code> declarations.</p> +<p>Eventually, it can prove good programming practice to mix both syntaxes, by first declaring +Signals/Slots with <code>use Qt::slots/signals</code>, then repeat this declaration +in the actual implementation with the second syntax.</p> +<p>Declarations will be checked for consistency at compile time, and any mismatch +in arguments would trigger a warning.</p> +<p> +</p> +<hr /> +<h1><a name="rad_prototyping_with_qt_designer_and_puic">RAD prototyping with Qt Designer and Puic</a></h1> +<p> +</p> +<h2><a name="introduction">Introduction</a></h2> +<ul> +<li><strong><a name="item_note%3a">Note:</a></strong><br /> +</li> +As of PerlQt-3.008, a separate PerlQt plugin for Qt Designer is available, +bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlQt project +entirely from the Designer GUI. +Nevertheless, the below is still accurate with regard to puic command line interaction +and with regard to using Qt Designer <em>without</em> the specific plugin. +<p></p></ul> +<p>As efficient and intuitive as Qt can be, building a complete GUI from scratch +is often a tedious task.</p> +<p>Hopefully, Qt comes with a very sophisticated GUI Builder named Qt +Designer, which is close to a complete integrated development environment. +It features Project management, drag'n drop GUI building, a complete object +browser, graphical interconnection of signals and slots, and much much more.</p> +<p>Qt Designer's output is XML which can be parsed by several command line tools, +among whose is <strong>puic</strong> (the PerlQt User Interface Compiler).</p> +<p>Assuming you have already built an interface file with the Designer, +translating it to a PerlQt program is simply a matter of issuing +one command :</p> +<pre> + puic -x -o program.pl program.ui</pre> +<p>This will generate the package defined in your ui file and a basic main package +for testing purposes.</p> +<p>You may prefer :</p> +<pre> + puic -o package.pm program.ui</pre> +<p>This will only generate the package, which can then be used by a separate +program.</p> +<p> +</p> +<h2><a name="embedding_images">Embedding Images</a></h2> +<p>If you need to <strong>embed images or icons</strong>, it can be done in two ways +:</p> +<ul> +<li><strong><a name="item_inline_embedding">Inline embedding</a></strong><br /> +</li> +For this, you need to check the ``Edit->Form Settings->Pixmaps->Save inline'' +checkbox inside Qt Designer. +Then : puic -x -o <em>program.pl</em> <em>program.ui</em> +<p></p> +<li><strong><a name="item_image_collection">Image Collection</a></strong><br /> +</li> +This option is more complex but also far more powerful and clean. +<p>puic -o <em>Collection.pm</em> -embed <em>unique_identifier</em> <em>image-1</em> ... <em>image-n</em></p> +<p>Then add a <code>use Collection.pm</code> statement to your program's main package.</p> +<p>If you've created a project file in Qt Designer, and added all images +you want to group (through ``Project->Image Collection''), you'll find all those +images inside the directory where your project file (*.pro) is stored, under +/images. +You can then generate the corresponding image collection by issuing :</p> +<p>puic -o <em>Collection.pm</em> -embed <em>identifier</em> ../images/*</p> +<p>You can use as many image collections as you want in a program. Simply add a +<strong>use</strong> statement for each collection.</p> +<p></p></ul> +<p> +</p> +<h2><a name="working_with_.ui_files">Working With <strong>.ui</strong> Files</a></h2> +<p>It will often happen that you need to regenerate your user interface -either +because you changed your initial design, or you want to extend it. +Thus writing your program's code straight in the auto-generated Perl file is +quite a bad idea. +You'd run constantly the risk of overwriting your handcrafted code, or end +up doing lot of copy-paste.</p> +<p>Instead, you may :</p> +<ul> +<li><strong><a name="item_write_slots_implementation_in_the_designer">Write slots implementation in the Designer</a></strong><br /> +</li> +In Qt Designer, select the <em>Source</em> tab of the <strong>Object Explorer</strong>. +There you can see a tree-like representation of your classes. +Now if you double-click on the <em>Slots/public</em> entry, +you are prompted with a dialog where you can create a new custom slot for +your module. +Once this is done, the new slot appear inside the <strong>Object Explorer</strong> tree and +clicking on it will bring you to a <strong><Your Class>.ui.h</strong> file where you can write +the actual implementation of your slot. +<p>Keeping all the defaults, it should look like this :</p> +<pre> + void Form1::newSlot() + { + + }</pre> +<p>The slot declaration is actually C++ code, but simply ignore it and write +your Perl code straight between the two braces, paying special attention to +indent it at least by one space.</p> +<pre> + void Form1::newSlot() + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # do something + } + }</pre> +<p>All Perl code written this way will be saved to the ui.h file, and <strong>puic</strong> will take care of +placing it back in the final program.</p> +<p>Here, after running <strong>puic</strong> on the Form1.ui file, you'd have:</p> +<pre> + sub newSlot + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # do something + } + }</pre> +<p></p> +<li><strong><a name="item_subclassing_your_gui">Subclassing your GUI</a></strong><br /> +</li> +By using <strong>puic</strong>'s <em>-subimpl</em> option, you may generate a derived module +inheriting your original user interface. +<p>You'd typically generate the derived module once, and write any handcrafted +code in this child. +Then, whenever you need to modify your GUI module, simply regenerate the +parent module, and your child will inherit those changes.</p> +<p>To generate the base module :</p> +<pre> + puic -o Form1.pm form1.ui</pre> +<p>(do this as often as needed, never edit by hand)</p> +<p>To generate the child :</p> +<pre> + puic -o Form2.pm -subimpl Form2 form1.ui</pre> +<p>or</p> +<pre> + puic -o program.pl -x -subimpl Form2 form1.ui</pre> +<p>(do this once and work on the resulting file)</p> +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="more_development_tools">More development tools</a></h1> +<p>PerlQt comes bundled with two simple programs that can help you to find your way through +the Qt API:</p> +<p> +</p> +<h2><a name="pqtapi">pqtapi</a></h2> +<p>pqtapi is a commandline driven introspection tool.</p> +<pre> + usage: pqtapi [-r <re>] [<class>]</pre> +<pre> + options: + -r <re> : find all functions matching regular expression/keyword <re> + -i : together with -r, performs a case insensitive search + -v : print PerlQt and Qt versions + -h : print this help message</pre> +<p>e.g:</p> +<pre> + $>pqtapi -ir 'setpoint.* int' + void QCanvasLine::setPoints(int, int, int, int) + void QPointArray::setPoint(uint, int, int)</pre> +<p> +</p> +<h2><a name="pqtsh">pqtsh</a></h2> +<p><strong>pqtsh</strong> is a graphical shell that can be used to test the API interactively. +It is fairly self explanatory and includes an interactive example (<code>Help->Example</code>)</p> +<br/> +<div class='image'><img src="../images/pqtsh.png"/></div><p> +</p> +<hr /> +<h1><a name="known_limitations">Known Limitations</a></h1> +<p>Templated classes aren't available yet (classes derived from templated classes are).</p> +<p> +</p> +<hr /> +<h1><a name="credits">Credits</a></h1> +<p>PerlQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand)</p> +<p>Kalyptus and the Smoke generation engine are (c) David Faure and Richard Dale</p> +<p>Puic is (c) TrollTech AS., Phil Thompson and Germain Garand,</p> +<p>The mentioned software is released under the GNU Public Licence v.2 or later.</p> +<p> +</p> +<hr /> +<h1><a name="appendix_1_:_c++_conventions_and_their_perl_counterpart">Appendix 1 : C++ conventions and their Perl counterpart</a></h1> +<p>Whenever you want to use a class/method described in Qt's +<a href="http://doc.trolltech.com">documentation</a> (see also the 'assistant' program bundled with Qt) +from PerlQt, you need to follow some simple translation rules.</p> +<dl> +<dt><strong><a name="item_classnames">Classnames</a></strong><br /> +</dt> +<ul> +<li></li> +All classnames are changed from a <strong>Q</strong> prefix in Qt to a <strong>Qt::</strong> prefix +in Perl. +e.g: QComboBox is named Qt::ComboBox within PerlQt. +<p></p></ul> +<dt><strong><a name="item_functions">Functions</a></strong><br /> +</dt> +<ul> +<li></li> +Functions referenced as <strong>static</strong> are accessed directly, and not through +an object. Thus the static function Foo in class QBar would be accessed from +PerlQt as +<pre> + Qt::Bar::Foo( arg-1,...,arg-n);</pre> +<p>The only notable exceptions are :</p> +<pre> + qApp() will map to Qt::app() + qVersion() will map to Qt::version() # not really needed anymore: we have qVersion(). See Global Functions below.</pre> +<p></p> +<li></li> +Functions referenced as <strong>members</strong> or <strong>Signals</strong> are accessed through an object +with the <strong>-></strong> operator. +e.g: +<pre> + $widget->show;</pre> +<p>There are no fundamental differences between methods and signals, however PerlQt +provides the <strong>emit</strong> keyword as a convenient mnemonic, so that it is clear you +are emitting a signal :</p> +<pre> + emit $button->clicked;</pre> +<p></p></ul> +<dt><strong><a name="item_arguments">Arguments</a></strong><br /> +</dt> +<ul> +<li><strong><a name="item_by_value">By value</a></strong><br /> +</li> +When an argument isn't preceded by the <strong>&</strong> or <strong>*</strong> character, it is passed by +value. For all basic types such as int, char, float and double, PerlQt will +automatically convert litteral and scalar values to the corresponding C++ type. +<p>Thus for a constructor prototype written as follow in the documentation :</p> +<pre> + QSize ( int w, int h )</pre> +<p>You'd say :</p> +<pre> + Qt::Size(8, 12);</pre> +<p></p> +<li><strong><a name="item_by_reference">By reference</a></strong><br /> +</li> +When an argument is preceded by the <strong>&</strong> character, it means a reference to an +object or to a type is expected. You may either provide a variable name or a +temporary object : +<pre> + $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $widget->setAccel( $keyseq ); + +or</pre> +<pre> + $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 );</pre> +<p>If the argument isn't qualified as <strong>const</strong> (constant), it means the passed +object may be altered during the process - you must then provide a variable.</p> +<p></p> +<li><strong><a name="item_by_pointer">By pointer</a></strong><br /> +</li> +When an argument is preceded by the <strong>*</strong> character, it means a +pointer to an object or to a type is expected. You may provide a variable +name or the Perl <strong>undef</strong> keyword for a Null pointer. +<p>Similarly, if the argument isn't <strong>const</strong>, the passed object may be altered by +the method call.</p> +<p></p></ul> +<dt><strong><a name="item_enumerations">Enumerations</a></strong><br /> +</dt> +<dd> +Enumerations are sort of named aliases for numeric values that would be hard to +remember otherwise. +</dd> +<dd> +<p>A C++ example would be :</p> +</dd> +<dd> +<pre> + enum Strange { Apple, Orange, Lemon }</pre> +</dd> +<dd> +<p>where <code>Strange</code> is the generic enumeration name, and <code>Apple</code>, <code>Orange</code>, +<code>Lemon</code> its possible values, which are only aliases for numbers (here 0, 1 +and 2).</p> +</dd> +<dd> +<p>Access to enumerations values in Perl Qt is very similar to a static function +call. In fact, it <strong>is</strong> a static function call.</p> +</dd> +<dd> +<p>Therefore, since you probably want to avoid some readability problems, we +recommend the use of the alternate function call syntax : <code>&function</code>.</p> +</dd> +<dd> +<p>Lets now go back to our <code>Strange</code> example.</p> +</dd> +<dd> +<p>If its definition was encountered in the class <code>QFruits</code>, you'd write from +PerlQt :</p> +</dd> +<dd> +<pre> + $apple_plus_orange = &Qt::Fruit::Apple + &Qt::Fruit::Orange;</pre> +</dd> +<p></p> +<dt><strong><a name="item_operators">Operators</a></strong><br /> +</dt> +<dd> +Within PerlQt, <strong>operators overloading</strong> works transparently. +If a given operator is overloaded in a Qt class (which means using it triggers a custom method) +it will behave identically in PerlQt. +Beware though that due to limitations of the Smoke binding library, not all overloaded operators are +available in PerlQt. +You can check the availability of a given operator by using the pqtapi program. +Also, due to outstanding differences between C++'s and Perl's object paradigm, the copy constructor operator (a.k.a '=') +has been disabled. +</dd> +<dd> +<p>e.g-1: '+=' overload</p> +</dd> +<dd> +<pre> + $p1 = Qt::Point(10, 10) + $p2 = Qt::Point(30,40) + $p2 += $p1; # $p2 becomes (40,50) + +e.g-2: '<<' overload</pre> +</dd> +<dd> +<pre> + $f = Qt::File("example"); + $f->open( IO_WriteOnly ); # see 'Constants' below + $s = Qt::TextStream( $f ); + $s << "What can I do with " << 12 << " apples?";</pre> +</dd> +<p></p> +<dt><strong><a name="item_constants">Constants</a></strong><br /> +</dt> +<dd> +Qt doesn't use many constants, but there is at least one place where they are used : for setting +Input/Output flags on files. +In order to avoid the namespace pollution induced by global constants, PerlQt group them in the <strong>Qt::constants</strong> module. +For instance, requesting the importation of all IO constants into the current namespace would be done with: +</dd> +<dd> +<pre> + use Qt::constants;</pre> +</dd> +<dd> +<p>You may also import specific symbols:</p> +</dd> +<dd> +<pre> + use Qt::constants qw( IO_ReadOnly IO_WriteOnly );</pre> +</dd> +<p></p> +<dt><strong><a name="item_global_functions">Global Functions</a></strong><br /> +</dt> +<dd> +Qt has also some utilitarian functions such as bitBlt, qCompress, etc. +</dd> +<dd> +<p>Those were global scope functions and have been grouped in a common namespace: +<code>Qt::GlobalSpace</code>.</p> +</dd> +<dd> +<p>Hence, you shall access this namespace either with a fully qualified call:</p> +</dd> +<dd> +<pre> + Qt::GlobalSpace::qUncompress( $buffer )</pre> +</dd> +<dd> +<p>Or directly, after importation in the current namespace:</p> +</dd> +<dd> +<pre> + use Qt::GlobalSpace; + qUncompress( $buffer )</pre> +</dd> +<dd> +<p>Of course, you may selectively import a few functions:</p> +</dd> +<dd> +<pre> + use Qt::GlobalSpace qw( qUncompress bitBlt )</pre> +</dd> +<dd> +<p><strong>Note:</strong> GlobalSpace has also operators, such has the one performing an addition on two +Qt::Point(). Those operators are called automatically.</p> +</dd> +<dd> +<p>e.g:</p> +</dd> +<dd> +<pre> + $p1 = Qt::Point(10, 10) + Qt::Point(20, 20)</pre> +</dd> +<p></p></dl> +<p> +</p> +<hr /> +<h1><a name="appendix_2_:_internationalization">Appendix 2 : Internationalization</a></h1> +<p>PerlQt handles internationalization by always converting <strong>QString</strong> back to <strong>utf8</strong> in Perl.</p> +<p>Conversions from Perl strings to QStrings are made according to context :</p> +<ul> +<li><strong><a name="item_if_the_perl_string_is_already_utf8%2dencoded">If the Perl string is already utf8-encoded</a></strong><br /> +</li> +then the string will be converted straight to QString. +<p>This is the most convenient and seemless way of internationalizing your application. Typically, one would just enable +the use of utf8 in source code with the <code>use utf8</code> pragma and write its application with an utf8 aware editor.</p> +<p></p> +<li><strong><a name="item_if_the_string_isn%27t_tagged_as_utf8%2c_and_the_us">If the string isn't tagged as utf8, and the <strong>use locale</strong> pragma is not set</a></strong><br /> +</li> +then the string will be converted to QString's utf8 from <strong>ISO-Latin-1</strong>. +<p></p> +<li><strong><a name="item_if_the_string_isn%27t_tagged_as_utf8_and_the_use_l">If the string isn't tagged as utf8 and the <strong>use locale</strong> pragma is set</a></strong><br /> +</li> +then the string will be converted to QString's utf8 according to the currently set <strong>locale</strong>. +<p></p></ul> +<p>Once a string contains utf8, you can convert it back to any locale by setting up <strong>converters</strong> :</p> +<pre> + $tr1=Qt::TextCodec::codecForLocale(); # this one will use current locale + $tr2=Qt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian)</pre> +<pre> + print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr2->fromUnicode($my_utf8_string);</pre> +<p>Or, with Perl >= 5.8.0, you may use Perl's <strong>Encode</strong> modules (see <code>perldoc Encode</code>).</p> +<p> +</p> +<h3><a name="disabling_utf8">disabling utf-8</a></h3> +<p>Developers who don't want to use UTF-8 or want to temporarily disable UTF-8 marshalling +for handling legacy programs may use the <strong>use bytes</strong> pragma (and the corresponding <strong>no bytes</strong>).</p> +<p>Within the scope of this pragma, QStrings are marshalled back to ISO-Latin1 (default) or to your locale +(if <strong>use locale</strong> has been set).</p> +<p>Frivole use of this pragma is strongly discouraged as it ruins worldwide standardization efforts.</p> +<p> +</p> +<hr /> +<h1><a name="appendix_3_:_debugging_channels">Appendix 3 : Debugging Channels</a></h1> +<p>The <strong>Qt::debug</strong> module offers various debugging channels/features.</p> +<pre> + use Qt::debug;</pre> +<pre> + use Qt::debug qw|calls autoload verbose|;</pre> +<p>With the simple <code>use Qt::debug</code> statement, the <strong>verbose</strong> and <strong>ambiguous</strong> channels are activated. +If you specify a list of channels within the use statement, then only the specified channels will be enabled.</p> +<p><strong>Available channels :</strong></p> +<ul> +<li><strong><a name="item_ambiguous">ambiguous</a></strong><br /> +</li> +Check if method and function calls are ambiguous, and tell which of the alternatives +was finally elected. +<p></p> +<li><strong><a name="item_verbose">verbose</a></strong><br /> +</li> +Enable more verbose debugging. +<p>Together with <strong>ambiguous</strong>, tell you the nearest matches in case +a method or function call fails. +e.g:</p> +<pre> + use Qt; + use Qt::debug; + $a= Qt::Application(\@ARGV); + $a->libraryPath("foo");</pre> +<pre> + --- No method to call for : + QApplication::libraryPath('foo') + Closer candidates are : + static void QApplication::addLibraryPath(const QString&) + static QStringList QApplication::libraryPaths() + static void QApplication::removeLibraryPath(const QString&) + static void QApplication::setLibraryPaths(const QStringList&)</pre> +<p></p> +<li><strong><a name="item_calls">calls</a></strong><br /> +</li> +For every call, tell what corresponding Qt method is called +(detailing the arguments if <strong>verbose</strong> is on). +<p></p> +<li><strong><a name="item_autoload">autoload</a></strong><br /> +</li> +Track the intermediate code between a method invocation in Perl +and its resolution to either a Qt or Perl call. +<p></p> +<li><strong><a name="item_gc">gc</a></strong><br /> +</li> +Give informations about garbage collection +whenever a Qt object is deleted and/or a Perl object is destroyed +<p></p> +<li><strong><a name="item_virtual">virtual</a></strong><br /> +</li> +Report whenever a virtual function tries to access its Perl +reimplementation (wether it exists or not). +<p></p> +<li><strong><a name="item_all">all</a></strong><br /> +</li> +Enable all channels +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="appendix_4_:_marshallers">Appendix 4 : Marshallers</a></h1> +<p>A marshaller is a piece of ``glue code'' translating a given datatype to another.</p> +<p>Within PerlQt, most Qt objects keep their object nature, so that one may invoke methods on them. +However, some classes and datatypes map so naturally to some Perl types that keeping their object nature would +would feel unnatural and clumsy.</p> +<p>For instance, instead of returning a Qt::StringList object, which would require an iterator to retrieve its content, +PerlQt will translate it to an array reference containing all the object's strings.</p> +<p>In the other way, instead of providing a Qt::StringList object as an argument of a method, one would simply +provide the reference to an array of Perl strings.</p> +<p>Here is the list of Marshallers as of PerlQt-3.008 :</p> +<pre> + ----------------------------------------------------------------- + float, double <=> Perl real (NV) + char, uchar, int, uint, enum + long, ulong, short, ushort <=> Perl integer (IV) + QString, -&, -* => Perl string (utf8) + QString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) + QCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) + QByteArray, -&, -* <=> Perl string (bytes) + QStringList, -&, -* => Reference to an array of Perl strings (utf8) + QString, -&, -* => Perl string (utf8 or iso-latin1 or locale) + int&, -* <=> Perl integer (IV) + bool&, -* <=> Perl boolean + char* <=> Perl string (bytes) + char** <= Reference to an array of Perl strings (bytes) + uchar* <= Perl string (bytes) + QRgb* <= Reference to an array of Perl integers (IV) + QCOORD* <= Reference to an array of Perl integers (IV) + void* <=> Reference to a Perl integer (IV) + QValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) + QCanvasItemList, - *, - & => Reference to an array of Qt::CanvasItem + QWidgetList, - *, - & <=> Reference to an array of Qt::Widget + QObjectList, - *, - & <=> Reference to an array of Qt::Object + QFileInfoList, - *, - & <=> Reference to an array of Qt::FileInfo + QPtrList<QTab>, - *, - & <=> Reference to an array of Qt::Tab + QPtrList<QToolBar>, - *, - & <=> Reference to an array of Qt::ToolBar + QPtrList<QNetworkOperation>, - *, - & <=> Reference to an array of Qt::NetworkOperation + QPtrList<QDockWindow>, - *, - & <=> Reference to an array of Qt::DockWindow + (QUObject*) + +</pre> + +</body> + +</html> diff --git a/doc/fr/Makefile b/doc/fr/Makefile new file mode 100644 index 0000000..1d300c0 --- /dev/null +++ b/doc/fr/Makefile @@ -0,0 +1,7 @@ + +index.html: PerlQt.pod + pod2html --css ../css/pod.css PerlQt.pod > index.html + perl -pi -e 's/cgibin/cgi-bin/' index.html + perl -pi -e 's/#http/http/g' index.html + rm -f pod2*~~ + diff --git a/doc/fr/PerlQt.pod b/doc/fr/PerlQt.pod new file mode 100644 index 0000000..5036239 --- /dev/null +++ b/doc/fr/PerlQt.pod @@ -0,0 +1,1189 @@ + +=head1 Programmer avec PerlQt + +B<Germain Garand> traduit par B<Stéphane Payrard>, révisé et augmenté par l'auteur. + +Ce document décrit l'interface Perl au toolkit Qt 3.x. Contacter +l'auteur à <germain@ebooksfrance.com> ou le traducteur à +<stef@mongueurs.net>. Vous trouverez le document original sur le site +L<perlqt.sourceforge.net|"http://perlqt.sourceforge.net"> + +=head1 Introduction + +PerlQt-3, crée par Ashley Winters, est une interface perl aux composants +graphiques (et non graphiques) fournis par Qt3. + +Le toolkit Qt 3.0 auquel PerlQt accède à été écrit en C++ par la société +Trolltech: L<Trolltech|"http://www.trolltech.com">. + +PerlQt3 est fondé sur la librairie +L<SMOKE|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">, +une surcouche fine indépendante du langage. Cette couche a été générée +à partir des fichiers d'en tête de Qt par le +L<kalyptus|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus"> +de Richard Dale grâce au module de David Faure. + +Le présent document décrit les principes de la programmation PerlQt. +Vous devez avoir des notions de programmation orientée objet en Perl pour le +lire. Une connaissance de C++ est recommandée mais non requise. Avec +celle de l'anglais, elle vous facilitera la consultation des L<manuels +en ligne de Qt|"http://doc.trolltech.com">. Ladite documentation est +la seule référence qui fasse autorité. + +Si Qt est installé sur votre système, sa documentation l'est +certainement aussi : voyez le programme $QTDIR/bin/assistant. + +=head1 Installation + +=head2 Conditions requises + +Pour compiler et utiliser PerlQt, vous devez avoir: + + +=over 4 + +=item * + +un système conforme à la norme POSIX. + +=item * + +L<Perl E<gt>= v5.6.0|"http://www.perl.org"> + +=item * + +L<Qt E<gt>= +v3.0|"http://www.trolltech.com/developer/download/qt-x11.html"> + +=item * + +L<SmokeQt +1.2.1|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> La +librarie SMOKE (Scripting Meta Object Kompiler) fait partie du module +L<KDE|"http://www.kde.org">'s B<kdebindings>. Vous pouvez vérifier si +une version précompilée de ce module existe pour votre système. Mais +perlQt inclut une copie, donc la version précompilée n'est pas +nécessaire. + +=item * + +Les outils GNU : automake(>=1.5), autoconf (>=2.13), aclocal... + +=back + +L'installation de Perl et de Qt sont en dehors du sujet du présent +document. Se référer aux documentations respectives de ces logiciels. + +=head2 Compilation de PerlQt + +Les instructions de cette section présupposent que le répertoire courant est +le répertoire racine de l'arborescence des sources de PerlQt. + +PerlQt utilise le système GNU Autoconf, mais il est préférable de le lancer via +le script standard C<Makefile.PL> : + + perl Makefile.PL + +B<N.B :> Si la variable d'environnement B<QTDIR> n'est pas définie, vous devrez +peut-être spécifier manuellement l'emplacement de Qt à l'aide de l'option : + + --with-qtdir=/emplacement/de/Qt + +Si la bibliothèque SMOKE est manquante, C<configure> générera ses sources dans +un sous-répertoire. + + make + + make install + +Cela installera PerlQt, Puic et les utilitaires pqtsh et pqtapi. + +Le lieu d'installation privilégié de SMOKE et de PUIC est le système de +fichiers de KDE3. Si KDE3 n'est pas installé (ou que la variable KDEDIR n'est pas +définie), spécifier ce lieu avec l'option C<--prefix> de C<configure>'s. Ainsi : + + perl Makefile.PL --prefix=/usr + +=head2 Installation avec les droits d'utilisateur + +Pour réaliser une installation locale, sans les droits de super-utilisateur, +suivez les instructions suivantes : + +=over 4 + +=item * + +Réalisez tout d'abord une configuration normale, en spécifiant le préfixe de la hiérarchie de fichier +dans laquelle la bibliothèque Smoke et l'exécutable 'puic' seront installés : + + perl Makefile.PL --prefix=~ + +Ceci installera Smoke dans ~/lib et puic dans ~/bin + +=item * + +Reconfigurez le module PerlQt pour qu'il ne s'installe pas dans la hiérarchie Perl ordinaire : + + cd PerlQt + perl Makefile.PL PREFIX=~ + cd .. + +Attention : il ne s'agit pas du Makefile.PL situé à la racine de l'arborescence mais bien de celui +situé dans le sous-répertoire PerlQt + +=item * + +Lancez la compilation et l'installation + + make && make install + +Pour exécuter des programmes PerlQt, il vous faudra désormais indiquer à Perl l'emplacement de cette hiérarchie externe, +à l'aide d'une ligne de la forme : + + perl -Mlib="~/local/lib/perl/5.x.x" programme.pl + +où 5.x.x représente la version de Perl utilisée, ligne qui peut également être placée en tête de programme : + + use lib qw( ~/local/lib/perl/5.x.x ); + +=back + +=head1 Anatomie de PerlQt + +Un programme Qt typique utilisant des composants GUI est fondé sur une +boucle événementielle. + +Il ne se comporte pas comme une suite séquentielle +d'instructions où vous devriez gérer vous-même chaque événement (tels +que le clic de la souris ou l'enfoncement d'une touche). + +Au lieu de cela, vous créez un objet B<Qt::Application> et les composants +du GUI qu'il utilise, puis vous définissez les méthodes d'objet à appeler +lors de l'occurrence d'un événement, puis démarrez la boucle événementielle. + +C'est tout. Qt gérera les événements et les dirigera vers les +routines appropriées. + +Voyons un programme PerlQt minimal. + +=head2 Hello World + + 1: use Qt; + 2: my $a = Qt::Application(\@ARGV); + 3: my $hello = Qt::PushButton("Hello World!", undef); + 4: $hello->resize(160, 25); + 5: $a->setMainWidget($hello); + 6: $hello->show; + 7: exit $a->exec; + +=for html +<br/> +<div class='image'><img src="../images/ex1.png"/></div> + +Ce programme charge d'abord le module Qt [line 1] puis crée l'objet +application B<$a> en lui passant une référence au tableau C<@ARGV> +contenant les arguments de la ligne de commande [l.2]. Cet objet +application est unique pour un interpréteur Perl donné et peut être +ensuite accédé par la fonction pure B<Qt::app()>. + +La ligne 3, crée un PushButton orphelin (c.à.d sans parent: non +contenu dans un autre widget) dont nous passons la valeur B<undef> +comme argument pour le parent. B<undef> est l'équivalent perlQt d'un +pointeur null en C++. + +Après les instructions de "mise en page" [l.4], nous indiquons à +l'objet application que le widget principal est ce +PushButton... Ainsi, il saura que fermer la fenêtre associée à ce +widget signifie: I<sortir de l'application>. + +Pour rendre ce widget visible (qui est par défaut caché), on +appelle la méthode B<show> [l.6] et lance la boucle +événementielle [l.7]. + +B<Sommaire de la syntaxe :> + +=over 4 + +=item 1 + +Les classes PerlQt sont accessibles par le préfixe B<Qt::> au lieu du +B<Q> initial des classes Qt en C++. En consultant la L<documentation +Qt|"http://doc.trolltech.com">, vous devez donc mentalement changer le +nom d'une clasee B<QFoo> en B<Qt::Foo>. + +=item 2 + +De manière similaire à C++, un objet est créé par l'appel d'un +B<constructeur> de même nom que la classe dont il est une méthode. + +Vous ne devez donc pas dire C<new Qt::Foo> ou C<Qt::Foo-E<gt>new()> +contrairement à l'usage commun en Perl. + +Dites simplement: + + my $object = Qt::<classname>(arg_1, ..., arg_n); + +Un constructeur sans argument s'énonce encore plus brièvement : + + my $object = Qt::<classname>; + + +=item 3 + +Comme il a déjà été dit, l'équivalent Perl d'un pointeur C++ est le mot-clé +Perl B<undef>. + +Les pointeurs sont les arguments précédés par le caractère B<*> dans la +documentation Qt (Par exemple: "C<QWidget* widget>"). + +=back + +=head2 L'héritage et les objets + +Avant d'expliquer comment les routines Perl peuvent être appelées de Qt, +parlons du mécanisme d'héritage vu de PerlQt. + +PerlQt est conçu pour allier la simplicité de Qt à la puissance et à la +flexibilité de Perl. Pour ce faire, PerlQt étend le paradigme objet de +Perl pour mimer Qt et son mécanisme de B<métaobjets>. + +=head3 Un Widget personnalisé + +Réécrivons le programme "Hello World!" avec une version personnalisée +de PushButton: + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: + 7: sub NEW + 8: { + 9: shift->SUPER::NEW(@_[0..2]); + 10: resize(130, 40); + 11: } + 12: + 13: 1; + 14: + 15: package main; + 16: + 17: use Qt; + 18: use Button; + 19: + 20: my $a = Qt::Application(\@ARGV); + 21: my $w = Button("Hello World!", undef); + 22: $a->setMainWidget($w); + 23: $w->show; + 24: exit $a->exec; + +Pour implanter notre propre version de PushButton, nous créons un nouveau +package [l.3] et importons Qt [l.4]. + +Nous utilisons le pragma C<Qt::isa> [l.5] pour déclarer notre widget +comme sous-classe de PushButton. Ce pragma accepte une liste de une ou +plusieurs classes dont dérive la classe à définir. + +Créons maintenant un constructeur pour notre nouveau widget +en écrivant une routine appelée B<NEW> I<(notez les majuscules qui +marquent une méthode différente du constructeur "new" usuel)>. +Le constructeur PerlQt est appelé B<implicitement> I<comme ligne 21>. + +Note widget doit d'abord appeler le constructeur de sa classe de base +(ici: Qt::PushButton) à la ligne 9, avec tous les arguments que nous +avons reçus. + +Nous créons ainsi un objet instance de notre classe. Cette objet est +accessible par la fonction B<this> (Attention: ce n'est pas la +variable C<$this> mais simplement C<this>). + +Chaque fois que nous invoquons une méthode à partir de notre package +nous pouvons écrire indifféremment C<method()> ou +C<this-E<gt>method()>; + +=head3 L'utilisation d'attributs + +Lors de la construction d'un objet composite, vous pouvez simplement créer +ses différents composants à l'intérieur de variables de scope lexical +(c.à.d déclarées par B<my>) puisque les widgets sont seulement détruits +par leur parent et non nécessairement quand leur conteneur disparaît +du scope. + +En d'autres termes, PerlQt utilise un système de comptage de +références pour gérer la destruction des objets. + +Souvent cependant, vous souhaiterez accéder aux composants de votre objet depuis +un tout autre endroit que celui où vous l'avez créé (par exemple pour modifier une +légende de bouton dynamiquement). Dans ce cas, la syntaxe traditionnelle de perl +propose de stocker une référence à ces composants dans la table associative (hash) de +l'objet lui-même. Mais cette syntaxe s'avère peu pratique à l'usage et beaucoup +trop libre - il n'y a pas de vérification à la compilation de sorte que vous pouvez +accéder à des clefs non existantes sans déclencher d'erreur. + +En lieu et place de cette syntaxe, PerlQt introduit le concept d'B<attributs>. + +Les attributs sont de simples variables perl, écrites sans le signe dollar initial, et +pouvant contenir toute donnée qui est une propriété de votre objet. +Leur principal avantage est de fournir une syntaxe très rapide et vérifiable à la compilation. + +Pour définir et pouvoir utiliser de nouveaux attributs, il suffit d'utiliser +le pragma C<use Qt::attributes>, suivi d'une liste des noms d'attributs souhaités. +Ainsi: + + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw( + 7: itsTime + 8: pData + 9: ); + 10: + 11: sub NEW + 12: { + 13: shift->SUPER::NEW(@_[0..2]); + 14: itsTime = Qt::Time; + 15: itsTime->start; + 16: pData->{'key'} = " Foo "; + 17: } + 18: + 19: sub resizeEvent + 20: { + 21: setText( "w: ". width() ." h: ". height() . + 22: "\nt: ". itsTime->elapsed . pData->{'key'} ); + 23: } + 24: + 25: 1; + +=for html +<br/> +<div class='image'><img src="../images/ex2.png"/></div> + + +L'attribut itsTime est déclaré à la ligne 7 et initialisé par un objet C<Qt::Time> +à la ligne 14. + +Puisque nous réimplémentons la fonction virtuelle "resizeEvent" +[l.19], chaque fois que le widget principal est redimensionné, cette +fonction "resizeEvent" sera déclenchée et le texte de notre Button mis +à jour avec les valeurs venant de l'objet [1.21] et les attributs que +nous avons définis [1.22]. + +B<Récapitulation> + +=over 4 + +=item * + +Pour hériter d'une classe Qt, un package doit contenir un +pragma C<use Qt::isa>. + +Ainsi: + + use Qt::isa "Qt::widget"; + +=item * + +Le constructeur d'objet est nommé B<NEW> et est appelé implicitement. +Vous ne devez donc pas dire: + + my $o = MyButton->NEW("Hello"); + +Mais bien : + + my $o = MyButton("Hello"); + +=item * + +A l'intérieur d'un package, on accéde l'instance courante par la +fonction B<this>. + +Quand une fonction membre est appelée, les arguments sont accessibles +par le tableau B<@_>, mais le premier élément de B<@_> n'est pas une +référence à l'objet contrairement à l'usage commun en Perl. + +Vous ne pouvez donc pas dire : + + sub myMember + { + my $moi = shift; + my $arg = shift; + $arg->doThat($moi); + $moi->doIt; + } + +Écrivez plutôt : + + sub myMember + { + my $arg = shift; + $arg->doThat(this); + doIt(); + } + +De plus, si vous voulez appeler une méthode dans une classe de base à +partir d'une classe dérivée, utilisez l'attribut spécial SUPER : + + sub exemple + { + print "Appel de la méthode 'exemple' dans la classe de base"; + SUPER->exemple(@_) + } + +Notez aussi que la construction : + + this->SUPER::Exemple(@_); + +est possible, mais qu'elle passe l'objet comme premier argument. + +=item * + +Lorsque vous devez stocker dans votre package un objet contenu, vous +devez le définir comme B<attribut> : + + use Qt::attributes qw( + firstAttribute + ... + lastAttribute); + +Il sera alors disponible comme accesseur : + + firstAttribute = myContainedWidget( this ); + firstAttribute->resize( 100, 100 ); + +B<NB:> Pour ceux qui souhaitent en savoir plus, les attributs sont implémentés +à l'aide de sub lvalue, c'est à dire de fonctions assignables. +En interne, elles ne font que pointer sur la clef de hachage correspondante dans +l'objet B<this>, ce qui rend les tournures "unAttribut->fonction()" et +"this->{'unAttribut'}->fonction()" strictement équivalentes +(si ce n'est que la première est vérifiée au moment de la compilation). + +=item * + +Pour réimplémenter une B<fonction virtuelle>, créez simplement une +B<sub> de même nom que cette fonction. + +Les fonctions virtuelles existantes sont marquées comme telles dans +la documentation de Qt (ce sont les méthodes précédées du mot clef "virtual"). + +Vous pouvez visualiser les noms de méthodes virtuelles que Qt tentera d'appeler +dans votre classe en plaçant C<use Qt::debug qw|virtual|> en tête de +votre programme. + +=back + +=head2 Signaux et Slots + +Voyons maintenant comment les objets Qt peuvent communiquer entre eux +de manière à ce qu'un événement concernant un objet puisse déclencher +l'exécution d'une routine en un quelconque endroit de votre programme. + +Dans d'autres toolkits, les callbacks (appels en retour) sont généralement +utilisés à cet effet. Mais Qt dispose d'un mécanisme beaucoup plus puissant +et plus flexible : les B<Signaux et Slots>. + +On peut se le représenter comme le cablage entre les composants d'une +chaîne Hi-Fi. Un amplificateur, par exemple, émet des signaux de sortie +sans chercher à savoir si des enceintes lui sont connectées ou non. +Un magnétophone peut attendre un signal sur sa prise d'entrée +pour commencer à enregistrer, et il ne cherchera pas à savoir s'il est +l'unique destinataire de ce signal ou si ce dernier est aussi reçu par un graveur de CD +ou écouté au casque. + +Un composant Qt se comporte comme notre amplificateur ou notre +magnétophone. Il a des sorties ou B<Signaux> et des entrées ou +B<Slots>. Chaque sortie (signal) est connectable à un nombre illimité +d'entrées (slots). La sortie d'un composant peut être potentiellement +branchée à toute entrée d'un composant (y compris lui-même), + + +La syntaxe de ce système de connexion est soit: + +Qt::Object::connect( envoyeur, SIGNAL 'mon_signal(types_d_arguments)', +recepteur, SLOT 'monslot(types_d_arguments)'); + +soit: + +unObjet->connect( envoyeur, SIGNAL 'mon_signal(types_d_arguments)', +SLOT 'monslot(types_d_arguments)'); + +Dans le second cas, le récepteur est omis car c'est l'objet lui-même, + +Ce mécanisme est extensible à volonté par la déclaration de nouveaux Signaux et +Slots par l'usage des pragma C<use Qt::signals> et C<use Qt::slots> +(voir aussi la deuxième syntaxe décrite plus bas). + +Chaque slot déclaré appellera la routine correspondante de votre +objet. Chaque signal déclaré peut être déclenché via le mot-clé B<emit>. + +B<Réécrivons encore notre exemple pour illustrer nos propos :> + + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw(itsTime); + 7: use Qt::slots + 8: aEteClicke => [], + 9: changement => ['int', 'int']; + 10: use Qt::signals + 11: changeLe => ['int', 'int']; + 12: + 13: sub NEW + 14: { + 15: shift->SUPER::NEW(@_[0..2]); + 16: itsTime = Qt::Time; + 17: itsTime->start; + 18: this->connect(this, SIGNAL 'clicked()', SLOT 'aEteClicke()'); + 19: this->connect(this, SIGNAL 'changeLe(int,int)', SLOT 'changement(int,int)'); + 20: } + 21: + 22: sub aEteClicke + 23: { + 24: my $w = width(); + 25: my $h = height(); + 26: setText( "w: $w h: $h\nt: ". itsTime->elapsed ); + 27: emit changeLe($w, $h); + 28: } + 29: + 30: sub changement + 31: { + 32: my ($w, $h) = @_; + 33: print STDERR "w: $w h: $h \n"; + 34: } + 35: + 36: 1; + +Nous définissons dans ce package deux nouveaux slots et un nouveau signal. + + +La documentation Qt nous dit que tout PushButton clické émet un signal +C<clicked()> ; nous le connectons donc à notre nouveau slot [ligne 18]. + +Nous connectons aussi notre signal C<ChangeLe> à notre slot +C<changement>. + +Ainsi, quand on appuie (clique) sur notre Button , le signal +C<clicked()> est émit et déclenche le slot C<aEteClicke()>. +C<aEteClicke()> émet à son tour le signal C<changeLe(int,int)>[l.27], +appelant de ce fait le slot C<changement(int,int)>, avec deux arguments. + +Enfin, il existe une syntaxe alternative introduite dans PerlQt-3.008 : + + sub un_slot : SLOT(int, QString) + { + $int = shift; + $string = shift; + # faire quelque chose + } + +et + + sub un_signal : SIGNAL(QString); + +Cette syntaxe est parfaitement compatible avec la déclaration par le biais de +C<use Qt::signals> et C<use Qt::slots>. +Il peut d'ailleurs d'avérer très profitable pour la clarté du programme de déclarer tout d'abord +les signaux/slots au moyen de C<use Qt::slots/signals>, puis de rappeler cette déclaration au niveau de +l'implémentation à l'aide de la seconde syntaxe. +Les déclarations seront alors vérifiées à la compilation, et le moindre conflit +générera un avertissement. + +=head1 Développement rapide (RAD) avec Qt Designer et Puic + + +=head2 Introduction + +=over 4 + +=item * N.B: + +Depuis la version 3.008, il existe un plugin spécifique à PerlQt pour Qt Designer. +Ce plugin (disponible sur les pages internet du projet) apporte le confort d'une intégration poussée, +la coloration syntaxique Perl, la complétion automatique, et permet de lancer et déboguer un projet +sans quitter l'interface du Designer. +Ce qui suit reste néanmoins parfaitement valable pour ce qui est de l'utilisation de puic en ligne de commande, +et pour l'utilisation de Qt Designer I<sans> le plugin spécifique. + +=back + +Aussi puissant et intuitif que soit Qt, écrire une GUI complète reste un exercice +fastidieux. + +Heureusement, Qt est fourni avec un constructeur de GUI sophistiqué +appelé Qt Designer qui est quasiment un environnement de développement +intégré. Il comporte la gestion de Projets, la création d'un GUI par +des actions de "drag and drop", un butineur d'objet complet, +l'interconnexion graphique de signaux et de slots, et plus encore. + +L'information générée par Qt Designer's est en format XML et peut donc +être parsée par différentes commandes comme dont B<puic> (le +compilateur d'interface utilisateur PerlQt). + +Supposons que vous avez déja construit un fichier d'interface avec +Qt Designer, la transcription en un programme PerlQt se fait par +la simple exécution de la commande : + + puic -x -o program.pl program.ui + +Cela génèrera le package défini dans votre fichier ui et un package +principal à fins de test, + +Vous pouvez préférer : + + puic -o package.pm program.ui + +Cela ne générera que le package qui pourra être utilisé par un programme séparé. + +=head2 Inclure des Images + + +Il y a deux manières d'inclure des B<images ou icônes>: + +=over 4 + +=item * Inclusion Inline + +A cette fin, nous devons sélectionner "Edit->Form +Settings->Pixmaps->Save inline" dans Qt Designer et executer ensuite: + + puic -x -o F<program.pl> F<program.ui> + + +=item * Image Collection + +Cette stratégie est plus complexe, mais plus propre et plus puissante. + + puic -o F<Collection.pm> -embed F<unique_identifier> F<image-1> ... F<image-n> + +Ajoutez l'instruction C<use Collection.pm> dans le package principal +de votre programme. + +Si vous avez créé un fichier projet dans Qt Designer et ajouté toutes +les images dans un groupe (par "Project->Image Collection"), vous +disposez ensuite de ces images dans le répertoire où votre fichier +projet (*.pro) est stocké, dans le sous-répertoire B<image>. Vous pouvez +alors générer la collection d'images par: + + puic -o F<Collection.pm> -embed F<identifier> images/* + +Vous pouvez utiliser autant de collections d'images que vous voulez +dans un programme en ajoutant simplement une instruction B<use> +pour chaque collection. + +=back + +=head2 Travailler avec des fichiers B<.ui> + +Souvent, vous voudrez regénérez votre interface utilisateur à +à cause d'une modification ou extension de votre design initial. +C'est donc une mauvais idée d'écrire votre code dans le fichier Perl +autogénéré car vous risquerez d'écraser le code que vous avez écrit +manuellement ou vous devrez faire des copier-coller intensifs. + +Voici une meilleure méthode : + +=over 4 + +=item * Écrire l'implémentation de slots dans le Designer + +Dans Qt Designer, selectionnez l'onglet I<Source> dans l'explorateur +d'objets (B<Object Explorer>). Vous pouvez ainsi voir représentées +sous forme d'arbre les classes que vous avez générées. Maintenant, si +vous cliquez deux fois sur l'entrée I<Slots/public>, +un dialogue vous demande si vous voulez créer un nouveau slot pour +votre module. Une fois cela fait, le nouveau slot apparait à +l'intérieur de l'arbre l'explorateur d'objet; cliquer dessus vous +amènera à votre fichier B<E<lt>Votre ClasseE<gt>.ui.h> où vous pouvez +écrire l'implémentation de votre slot. + +Par défaut, il devrait ressembler à ceci : + + void Form1::newSlot() + { + + } + + +La déclaration du slot est réellement du code C++, mais ignorons cela +et écrivons du code Perl entre les deux accolades en faisant bien +attention d'indenter notre code avec au moins un espace. + + void Form1::newSlot() + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # faire quelque chose + } + } + +Notre code Perl ainsi écrit sera sauvé dans le fichier ui.h et +B<puic> prendra soin de le placer dans notre programme final. + +Ici, après l'exécution de B<puic> sur le ficier Form1.ui, vous +devriez avoir: + + sub newSlot + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # faire quelque chose + } + } + +=item * Sous-classez votre GUI + +En utilisant l'option I<-subimpl> de B<puic>, vous pouvez générer un +module dérivé qui hérite l'interface utilisateur originelle. + +Typiquement, vous générez le module dérivé une fois, et écrivez votre +code dans ce module dérivé. Ainsi, quand vous devez modifier votre +module GUI, regénérez le module dont il dérive et il héritera les +changements. + +Pour générer le module de base : + + puic -o Form1.pm form1.ui + +(faîtes cela aussi souvent que nécessaire: n'éditez jamais +manuellement form1.ui puisqu'il serait écrasé) + + +Pour générer le GUI dérivé : + + puic -o Form2.pm -subimpl Form2 form1.ui + +ou + + puic -o program.pl -x -subimpl Form2 form1.ui + +(faites cela une fois et travaillez avec le fichier résultant) + +=back + +=head1 Autres outils de développement + +PerlQt comprend également deux programmes pouvant vous aider à maîtriser l'API de Qt : + +=head2 pqtapi + +pqtapi est un outil d'introspection en ligne de commande. + + utilisation: pqtapi [-r <re>] [<class>] + + options: + -r <re> : chercher les méthodes correspondant à l'expression régulière <re> + -i : avec -r, effectue une recherche insensible à la casse + -v : afficher les versions de PerlQt et de Qt + -h : afficher ce message d'aide + +ex: + + $>pqtapi -ir 'setpoint.* int' + void QCanvasLine::setPoints(int, int, int, int) + void QPointArray::setPoint(uint, int, int) + +=head2 pqtsh + +B<pqtsh> est un shell graphique permettant de tester l'API de manière interactive. +Un exemple dynamique est accessible dans l'entrée de menu C<Help-E<gt>Example>. + +=for html +<br/> +<div class='image'><img src="../images/pqtsh.png"/></div> + +=head1 Limitations + +Les classes à modèle (templates) ne sont pas encore accessibles par PerlQt. +En revanche, les classes dérivées de classes à modèle sont disponibles. + +Vous pouvez reconnaître ce type de classe en ce que leurs arguments comprennent un type générique placé entre +les signes "<" et ">". + +ex: + QDictIterator ( const QDict<type> & dict ) + + +=head1 Crédits + +PerlQt-3 est (c) 2002 Ashley Winters (et (c) 2003 Germain Garand) + +Kalyptus et l'engin de génération Smoke sont (c) David Faure and Richard Dale + +Puic is (c) TrollTech AS., Phil Thompson et Germain Garand, + +Ledit logiciel est délivré sous la GNU Public Licence v.2 or later. + + +=head1 Appendice: Les conventions de C++ et leur traduction en Perl + +Lorsque vous voulez utiliser depuis PerlQt une classe ou méthode décrite +dans la L<documentation|"http://doc.trolltech.com"> Qt (voyez aussi le programme +$QTDIR/bin/assistant livré avec Qt), vous devez suivre des règles de translation simples. + +=over 4 + +=item Noms de classe + +=over 4 + +=item * + +Les noms de classes utilisent le préfixe B<Qt::> au lieu de B<Q> pour +être conforme à l'usage Perl. Ainsi: QComboBox est nommé Qt::ComboBox +dans PerlQt. + +=back + +=item Fonctions + +=over 4 + +=item * + +Les fonctions décrites comme B<static> sont accédées directement et non +à travers un objet. Ainsi la fonction statique Foo de la classe B<QBar> +peut être accédée de PerlQt par + + Qt::Bar::Foo( arg-1,...,arg-n); + +=item * + +Les fonctions décrites comme B<members> ou B<Signals> sont +accessibles à travers l'objet par l'opérateur + B<-E<gt>> . +Par exemple: + + $widget->show; + +Il n'y a pas de différence fondamentale entre les méthodes et les +signaux, néanmoins PerlQt fournit le mot-clé B<emit> comme une +mnémonique pratique pour rendre clair que vous émettez un signal : + + emit $button->clicked; + +=back + +=item Arguments + +=over 4 + +=item * Par valeur + +Lorsqu'un argument n'est pas précédé par un des caractères B<&> or +B<*>, il est passé par valeur. Pour tous les types basiques tels que +int, char, float and double, PerlQt convertira automatiquement les +valeurs litérales et scalaires dans le type correspondants C++. + +Ainsi pour le prototype d'un constructeur écrit dans la documentation +comme ceci: + QSize ( int w, int h ) + + +Vous écrirez : + + Qt::Size(8, 12); + +=item * Par référence + +Lorsqu'un argument est précédé par le caractère B<&>, Il est une +référence à un objet ou à un type. Vous pouvez alors fournir un nom de +variable ou un objet temporaire : + + $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $widget->setAccel( $keyseq ); + +ou + + $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + +Si l'argument n'est I<pas> qualifié par B<const> (constante), l'argument +est un objet qui peut être altéré par la méthode, vous devez +donc passer une variable. + +=item * Par pointeur + +Lorsqu'un argument est précédé par le caractère B<*>, +un pointeur vers un objet ou un type est attendu. En PerlQt, vous +pouvez fournir un nom de variable ou le mot clé B<undef> à la place +du pointer Null. + +De plus, si l'argument est const, l'objet passé en argument est en +lecture seule: il ne peut pas être modifié. + +=back + +=item Énumérations + +Les Énumerations sont une forme d'alias pour des valeurs numériques +dont il serait autrement difficile de se souvenir: + +Exemple C++: + + enum Strange { Apple, Orange, Lemon } + +Ici, C<Strange> est le type (au sens de C++) de l'énumération, et +C<Apple>, C<Orange> et +C<Lemon> ses valeurs possible , qui sont des aliases pour des +nombres (ici 0, 1 et 2) + +L'accès aux valeurs d'énumération en Perl Qt est un appel +de fonction statique. + +Donc, si vous voulez éviter des prblèmes de lisibilité, nous vous +recommandons l'usage d'une syntaxe alternative d'appel de fonction +pour marquer l'utilisation d'un alias d'énumération: C<&fonction>. + + +Revenons à notre exemple C<Strange>. + +Si nous rencontrons sa définition dans la classe C<QFruits>, vous +écrirez en PerlQt : + + $pomme_plus_orange = &Qt::Fruit::Pomme + &Qt::Fruit::Orange; + +=item Opérateurs + +Dans PerlQt, la B<surcharge d'opérateurs> fonctionne de manière transparente. +Si un opérateur est surchargé dans une classe Qt (ce qui signifie que son utilisation +déclenchera un appel de méthode, au lieu d'utiliser l'opérateur générique) +il sera également surchargé dans PerlQt. + +ex-1: surcharge de '+=' + + $p1 = Qt::Point(10, 10) + $p2 = Qt::Point(30,40) + $p2 += $p1; # $p2 devient (40,50) + +ex-2: surcharge de '<<' + + $f = Qt::File("example"); + $f->open( IO_WriteOnly ); # voir l'entrée 'Constantes' plus bas + $s = Qt::TextStream( $f ); + $s << "Que faire avec " << 12 << " pommes ?"; + + +B<Exception notable> : le constructeur de copie (signe égal, '=') n'est jamais surchargé, +attendu qu'il ne pourrait fonctionner que partiellement et que le paradigme de +Perl est très différent de C++ en matière de copie d'objets. + +=item Constantes + +Qt n'utilise pas beaucoup de constantes, mais on en trouve cependant dans le module d'Entrées/Sorties, +où elles font office de drapeaux pour les modes d'ouverture de fichiers. + +Pour éviter de polluer inutilement l'espace de nom, nous avons regroupé les constantes dans le module +B<Qt::constants>, d'où elles seront chargées à la demande. + +Ainsi, pour importer l'ensemble des constantes d'E/S, on écrira : + + use Qt::constants; + +Et pour importer quelques symboles seulement : + + use Qt::constants qw( IO_ReadOnly IO_WriteOnly ); + +=item Fonctions globales + +Qt dispose de fonctions utilitaires, telles bitBlt, qCompress, etc. + +Ces fonctions ont été rassemblées dans un espace de nom commun: +C<Qt::GlobalSpace>. + +Vous pourrez donc y accéder soit par un appel pleinement qualifié : + + Qt::GlobalSpace::qUncompress( $buffer ) + +Soit en important préalablement ces fonctions dans l'espace de nom courant : + + use Qt::GlobalSpace; + qUncompress( $buffer ) + +Bien entendu, vous pouvez aussi n'importer que les fonctions souhaitées : + + use Qt::GlobalSpace qw( qUncompress bitBlt ) + +B<N.B:> GlobalSpace renferme également des opérateurs de portée globale, tels +celui permettant d'aditionner deux Qt::Point(). Ces opérateurs seront appelés +automatiquement. + +ex: + + $p1 = Qt::Point(10, 10) + Qt::Point(20, 20) + +=back + +=head1 Annexe 2 : Internationalisation + +PerlQt résout les problèmes d'internationalisation en convertissant systématiquement les B<QString> +de Qt en B<utf8> côté Perl. + +Les conversions en sens inverse, depuis Perl vers Qt sont traitées différemment suivant le contexte : + +=over 4 + +=item * Si la chaîne de caractère est déjà marquée comme étant utf8 + +alors elle sera convertie en QString directement. + +C'est la manière privilégiée d'opérer, et la plus simple : +Il vous suffit d'insérer un pragma B<use utf8> en tête de vos programmes, puis d'utiliser un éditeur de +texte supportant l'utf8 (quasiment tous de nos jours) pour élaborer votre code source. +Les chaînes seront marquées par Perl automatiquement. + +=item * Si la chaîne n'est pas marquée comme utf8, et le pragma 'use locale' n'est pas actif + +alors la conversion en QString se fera depuis l'B<ISO-Latin-1>. + +=item * Si la chaîne n'est pas marquée comme utf8, et le pragma 'use locale' est actif + +alors la conversion en QString se fera depuis votre B<locale>. + +=back + +Lorsque des chaînes contiennent de l'utf8, Perl adapte automatiquement ses opérateurs pour que +leur gestion soit entièrement transparente (comprendre opaque, comme toujours...). +Cependant, vous pourrez avoir besoin à l'occasion de les transcrire en d'autres jeux d'encodage. +Ceci peut se faire soit avec Qt : + + $tr1=Qt::TextCodec::codecForLocale(); # ceci utilisera la locale en vigueur + $tr2=Qt::TextCodec::codecForName("KOI8-R"); # ceci force l'emploi d'une locale spécifique (Russe) + + print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr2->fromUnicode($une_chaine_utf8); + +Soit avec les outils de Perl (pour perl >= 5.8.0). +Se reporter à ce sujet à la documentation du module B<Encode> (C<perldoc Encode>). + +=head3 désactiver l'encodage utf8 + +Les programmeurs souhaitant désactiver temporairement l'encodage utf8 +(pour la gestion de programmes externes ou de modules anciens ne supportant pas cet encodage) +pourront utiliser le pragma B<use bytes> (et sa réciproque : B<no bytes>). + +Dans la portée de ce pragma, les conversions depuis QString vers les chaînes Perl se feront en ISO-Latin1 +(par défaut) ou suivant la locale en vigueur (si B<use locale> est actif). + +Notez bien qu'il est préférable de I<ne pas utiliser ce pragma à la légère>, en ce qu'il ruine totalement les +efforts de standardisations autour d'utf8 entrepris depuis plusieurs années déjà. +Il est très préférable de corriger les programmes fautifs. + +=head1 Annexe 3 : Canaux de déboguage + +Le module B<Qt::debug> offre divers canaux de déboguage permettant de filtrer +le flux conséquent d'informations disponibles pour l'adapter à vos besoins. + + use Qt::debug; + + use Qt::debug qw|calls autoload verbose|; + +Avec le pragma C<use Qt::debug>, seuls les canaux B<verbose> et B<ambiguous> sont activés. +Si vous le faites suivre d'une liste précise de canaux, seuls ceux-ci seront affichés. + +B<Liste et descriptif des canaux :> + +=over 4 + +=item * ambiguous + +Vérifier si les appels de méthodes sont ambigus, et dire quelle méthode, parmi le jeux +d'alternatives, à finalement été choisie. + +=item * verbose + +Donner davantage d'informations. + +Utilisé avec B<ambiguous>, vous donnera les correspondances les plus proches lorsqu'un appel de méthode échoue. + +ex: + + use Qt; + use Qt::debug; + $a= Qt::Application(\@ARGV); + $a->libraryPath("chose"); + + --- No method to call for : + QApplication::libraryPath('chose') + Closer candidates are : + static void QApplication::addLibraryPath(const QString&) + static QStringList QApplication::libraryPaths() + static void QApplication::removeLibraryPath(const QString&) + static void QApplication::setLibraryPaths(const QStringList&) + +=item * calls + +Pour chaque appel de méthode, vous dira quelle méthode Qt est finalement appelée, +en précisant les arguments si B<verbose> est actif. + +=item * autoload + +Détaille le passage dans le code intermédiaire faisant la jonction entre Perl et Qt. + +=item * gc + +Donne des informations sur la collection des déchets, c'est à dire sur la destruction des objets, +qu'ils soient détruits depuis Perl ou Qt. + +=item * virtual + +Vous averti chaque fois qu'une fonction virtuelle tente d'accéder à sa réimplémentation en Perl +(que cette réimplémentation existe ou non). + +=item * all + +Activer tous les canaux. + +=back + +=head1 Annexe 4 : Marshalleurs + +Un marshalleur est un convertisseur permettant de transcrire un type de données en un autre. + +Dans PerlQt, la plupart des objets Qt gardent leurs propriétés d'objet, ce qui permet d'invoquer leurs méthodes +et de changer leurs propriétés comme il se doit. +Cependant, il arrive que l'objet d'origine corresponde à ce point à un type natif de Perl qu'il serait malséant +d'utiliser l'interface C++ et beaucoup plus naturel de lui substituer son équivalent. + +Ici interviennent les marshalleurs. +Plutôt que de retourner un objet Qt::StringList, qui serait délicat à manipuler, +PerlQt le transformera en référence de liste Perl. +Dès lors, tous les opérateurs de manipulation de liste pourront lui être appliqué : +on gagne en densité, en cohérence et en simplicité. + +Cette transformation s'appliquera aussi en sens inverse, et n'importe quelle liste de chaînes Perl +pourra être donnée en argument à une méthode attendant une Qt::StringList. + + Liste des marshalleurs (PerlQt-3.008) + ----------------------------------------------------------------- + float, double <=> réel Perl (NV) + char, uchar, int, uint, enum + long, ulong, short, ushort <=> entier Perl (IV) + QString, -&, -* => chaîne Perl (utf8) + QString, -&, -* <= chaîne Perl (utf8 ou iso-latin1 ou locale) + QCString, -&, -* <=> chaîne Perl (utf8 ou octets, suivant contenu ou pragma "bytes") + QStringList, -&, -* => référence à une liste de chaînes Perl (utf8) + QByteArray, -&, -* <=> chaîne Perl (octets) + int&, -* <=> entier Perl (IV) + bool&, -* <=> booléen Perl + char* <=> chaîne Perl (octets) + char** <= référence à une liste de chaînes Perl (octets) + uchar* <= chaîne Perl(octets) + QRgb* <= référence à une liste d'entiers Perl (IV) + QCOORD* <= référence à une liste d'entiers Perl (IV) + void* <=> référence à un entier Perl (IV) + QValueList<int>, - *, - & <=> référence à une liste d'entiers Perl (IV) + QCanvasItemList, - *, - & => réference à une liste de Qt::CanvasItem + QWidgetList, - *, - & <=> réference à une liste de Qt::Widget + QObjectList, - *, - & <=> réference à une liste de Qt::Object + QFileInfoList, - *, - & <=> réference à une liste de Qt::FileInfo + QPtrList<QTab>, - *, - & <=> réference à une liste de Qt::Tab + QPtrList<QToolBar>, - *, - & <=> réference à une liste de Qt::ToolBar + QPtrList<QNetworkOperation>, - *, - & <=> réference à une liste de Qt::NetworkOperation + QPtrList<QDockWindow>, - *, - & <=> réference à une liste de Qt::DockWindow + (QUObject*) + diff --git a/doc/fr/index.html b/doc/fr/index.html new file mode 100644 index 0000000..2f5e788 --- /dev/null +++ b/doc/fr/index.html @@ -0,0 +1,1120 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Programmer avec PerlQt</title> +<link rel="stylesheet" href="../css/pod.css" type="text/css" /> +<link rev="made" href="mailto:root@localhost" /> +</head> + +<body> + +<p><a name="__index__"></a></p> +<!-- INDEX BEGIN --> + +<ul> + + <li><a href="#programmer_avec_perlqt">Programmer avec PerlQt</a></li> + <li><a href="#introduction">Introduction</a></li> + <li><a href="#installation">Installation</a></li> + <ul> + + <li><a href="#conditions_requises">Conditions requises</a></li> + <li><a href="#compilation_de_perlqt">Compilation de PerlQt</a></li> + <li><a href="#installation_avec_les_droits_d'utilisateur">Installation avec les droits d'utilisateur</a></li> + </ul> + + <li><a href="#anatomie_de_perlqt">Anatomie de PerlQt</a></li> + <ul> + + <li><a href="#hello_world">Hello World</a></li> + <li><a href="#l'héritage_et_les_objets">L'héritage et les objets</a></li> + <ul> + + <li><a href="#un_widget_personnalisé">Un Widget personnalisé</a></li> + <li><a href="#l'utilisation_d'attributs">L'utilisation d'attributs</a></li> + </ul> + + <li><a href="#signaux_et_slots">Signaux et Slots</a></li> + </ul> + + <li><a href="#développement_rapide_(rad)_avec_qt_designer_et_puic">Développement rapide (RAD) avec Qt Designer et Puic</a></li> + <ul> + + <li><a href="#introduction">Introduction</a></li> + <li><a href="#inclure_des_images">Inclure des Images</a></li> + <li><a href="#travailler_avec_des_fichiers_.ui">Travailler avec des fichiers <strong>.ui</strong></a></li> + </ul> + + <li><a href="#autres_outils_de_développement">Autres outils de développement</a></li> + <ul> + + <li><a href="#pqtapi">pqtapi</a></li> + <li><a href="#pqtsh">pqtsh</a></li> + </ul> + + <li><a href="#limitations">Limitations</a></li> + <li><a href="#crédits">Crédits</a></li> + <li><a href="#appendice:_les_conventions_de_c++_et_leur_traduction_en_perl">Appendice: Les conventions de C++ et leur traduction en Perl</a></li> + <li><a href="#annexe_2_:_internationalisation">Annexe 2 : Internationalisation</a></li> + <ul> + + <ul> + + <li><a href="#désactiver_l'encodage_utf8">désactiver l'encodage utf8</a></li> + </ul> + + </ul> + + <li><a href="#annexe_3_:_canaux_de_déboguage">Annexe 3 : Canaux de déboguage</a></li> + <li><a href="#annexe_4_:_marshalleurs">Annexe 4 : Marshalleurs</a></li> +</ul> +<!-- INDEX END --> + +<hr /> +<p> +</p> +<h1><a name="programmer_avec_perlqt">Programmer avec PerlQt</a></h1> +<p><strong>Germain Garand</strong> traduit par <strong>Stéphane Payrard</strong>, révisé et augmenté par l'auteur.</p> +<p>Ce document décrit l'interface Perl au toolkit Qt 3.x. Contacter +l'auteur à <<a href="mailto:germain@ebooksfrance.com">germain@ebooksfrance.com</a>> ou le traducteur à +<<a href="mailto:stef@mongueurs.net">stef@mongueurs.net</a>>. Vous trouverez le document original sur le site +<a href="http://perlqt.sourceforge.net">perlqt.sourceforge.net</a></p> +<p> +</p> +<hr /> +<h1><a name="introduction">Introduction</a></h1> +<p>PerlQt-3, crée par Ashley Winters, est une interface perl aux composants +graphiques (et non graphiques) fournis par Qt3.</p> +<p>Le toolkit Qt 3.0 auquel PerlQt accède à été écrit en C++ par la société +Trolltech: <a href="http://www.trolltech.com">Trolltech</a>.</p> +<p>PerlQt3 est fondé sur la librairie +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SMOKE</a>, +une surcouche fine indépendante du langage. Cette couche a été générée +à partir des fichiers d'en tête de Qt par le +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus">kalyptus</a> +de Richard Dale grâce au module de David Faure.</p> +<p>Le présent document décrit les principes de la programmation PerlQt. +Vous devez avoir des notions de programmation orientée objet en Perl pour le +lire. Une connaissance de C++ est recommandée mais non requise. Avec +celle de l'anglais, elle vous facilitera la consultation des <a href="http://doc.trolltech.com">manuels en ligne de Qt</a>. Ladite documentation est +la seule référence qui fasse autorité.</p> +<p>Si Qt est installé sur votre système, sa documentation l'est +certainement aussi : voyez le programme $QTDIR/bin/assistant.</p> +<p> +</p> +<hr /> +<h1><a name="installation">Installation</a></h1> +<p> +</p> +<h2><a name="conditions_requises">Conditions requises</a></h2> +<p>Pour compiler et utiliser PerlQt, vous devez avoir:</p> +<ul> +<li></li> +un système conforme à la norme POSIX. +<p></p> +<li></li> +<a href="http://www.perl.org">Perl >= v5.6.0</a> +<p></p> +<li></li> +<a href="http://www.trolltech.com/developer/download/qtx11.html">Qt >= v3.0</a> +<p></p> +<li></li> +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SmokeQt 1.2.1</a> La +librarie SMOKE (Scripting Meta Object Kompiler) fait partie du module +<a href="http://www.kde.org">KDE</a>'s <strong>kdebindings</strong>. Vous pouvez vérifier si +une version précompilée de ce module existe pour votre système. Mais +perlQt inclut une copie, donc la version précompilée n'est pas +nécessaire. +<p></p> +<li></li> +Les outils GNU : automake(>=1.5), autoconf (>=2.13), aclocal... +<p></p></ul> +<p>L'installation de Perl et de Qt sont en dehors du sujet du présent +document. Se référer aux documentations respectives de ces logiciels.</p> +<p> +</p> +<h2><a name="compilation_de_perlqt">Compilation de PerlQt</a></h2> +<p>Les instructions de cette section présupposent que le répertoire courant est +le répertoire racine de l'arborescence des sources de PerlQt.</p> +<p>PerlQt utilise le système GNU Autoconf, mais il est préférable de le lancer via +le script standard <code>Makefile.PL</code> :</p> +<pre> + perl Makefile.PL</pre> +<p><strong>N.B :</strong> Si la variable d'environnement <strong>QTDIR</strong> n'est pas définie, vous devrez +peut-être spécifier manuellement l'emplacement de Qt à l'aide de l'option :</p> +<pre> + --with-qtdir=/emplacement/de/Qt</pre> +<p>Si la bibliothèque SMOKE est manquante, <code>configure</code> générera ses sources dans +un sous-répertoire.</p> +<pre> + make</pre> +<pre> + make install</pre> +<p>Cela installera PerlQt, Puic et les utilitaires pqtsh et pqtapi.</p> +<p>Le lieu d'installation privilégié de SMOKE et de PUIC est le système de +fichiers de KDE3. Si KDE3 n'est pas installé (ou que la variable KDEDIR n'est pas +définie), spécifier ce lieu avec l'option <code>--prefix</code> de <code>configure</code>'s. Ainsi :</p> +<pre> + perl Makefile.PL --prefix=/usr</pre> +<p> +</p> +<h2><a name="installation_avec_les_droits_d'utilisateur">Installation avec les droits d'utilisateur</a></h2> +<p>Pour réaliser une installation locale, sans les droits de super-utilisateur, +suivez les instructions suivantes :</p> +<ul> +<li></li> +Réalisez tout d'abord une configuration normale, en spécifiant le préfixe de la hiérarchie de fichier +dans laquelle la bibliothèque Smoke et l'exécutable 'puic' seront installés : +<pre> + perl Makefile.PL --prefix=~</pre> +<p>Ceci installera Smoke dans ~/lib et puic dans ~/bin</p> +<p></p> +<li></li> +Reconfigurez le module PerlQt pour qu'il ne s'installe pas dans la hiérarchie Perl ordinaire : +<pre> + cd PerlQt + perl Makefile.PL PREFIX=~ + cd ..</pre> +<p>Attention : il ne s'agit pas du Makefile.PL situé à la racine de l'arborescence mais bien de celui +situé dans le sous-répertoire PerlQt</p> +<p></p> +<li></li> +Lancez la compilation et l'installation +<pre> + make && make install</pre> +<p>Pour exécuter des programmes PerlQt, il vous faudra désormais indiquer à Perl l'emplacement de cette hiérarchie externe, +à l'aide d'une ligne de la forme :</p> +<pre> + perl -Mlib="~/local/lib/perl/5.x.x" programme.pl</pre> +<p>où 5.x.x représente la version de Perl utilisée, ligne qui peut également être placée en tête de programme :</p> +<pre> + use lib qw( ~/local/lib/perl/5.x.x );</pre> +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="anatomie_de_perlqt">Anatomie de PerlQt</a></h1> +<p>Un programme Qt typique utilisant des composants GUI est fondé sur une +boucle événementielle.</p> +<p>Il ne se comporte pas comme une suite séquentielle +d'instructions où vous devriez gérer vous-même chaque événement (tels +que le clic de la souris ou l'enfoncement d'une touche).</p> +<p>Au lieu de cela, vous créez un objet <strong>Qt::Application</strong> et les composants +du GUI qu'il utilise, puis vous définissez les méthodes d'objet à appeler +lors de l'occurrence d'un événement, puis démarrez la boucle événementielle.</p> +<p>C'est tout. Qt gérera les événements et les dirigera vers les +routines appropriées.</p> +<p>Voyons un programme PerlQt minimal.</p> +<p> +</p> +<h2><a name="hello_world">Hello World</a></h2> +<pre> + 1: use Qt; + 2: my $a = Qt::Application(\@ARGV); + 3: my $hello = Qt::PushButton("Hello World!", undef); + 4: $hello->resize(160, 25); + 5: $a->setMainWidget($hello); + 6: $hello->show; + 7: exit $a->exec;</pre> +<br/> +<div class='image'><img src="../images/ex1.png"/></div><p>Ce programme charge d'abord le module Qt [line 1] puis crée l'objet +application <strong>$a</strong> en lui passant une référence au tableau <code>@ARGV</code> +contenant les arguments de la ligne de commande [l.2]. Cet objet +application est unique pour un interpréteur Perl donné et peut être +ensuite accédé par la fonction pure <strong>Qt::app()</strong>.</p> +<p>La ligne 3, crée un PushButton orphelin (c.à.d sans parent: non +contenu dans un autre widget) dont nous passons la valeur <strong>undef</strong> +comme argument pour le parent. <strong>undef</strong> est l'équivalent perlQt d'un +pointeur null en C++.</p> +<p>Après les instructions de ``mise en page'' [l.4], nous indiquons à +l'objet application que le widget principal est ce +PushButton... Ainsi, il saura que fermer la fenêtre associée à ce +widget signifie: <em>sortir de l'application</em>.</p> +<p>Pour rendre ce widget visible (qui est par défaut caché), on +appelle la méthode <strong>show</strong> [l.6] et lance la boucle +événementielle [l.7].</p> +<p><strong>Sommaire de la syntaxe :</strong></p> +<ol> +<li></li> +Les classes PerlQt sont accessibles par le préfixe <strong>Qt::</strong> au lieu du +<strong>Q</strong> initial des classes Qt en C++. En consultant la <a href="http://doc.trolltech.com">documentation Qt</a>, vous devez donc mentalement changer le +nom d'une clasee <strong>QFoo</strong> en <strong>Qt::Foo</strong>. +<p></p> +<li></li> +De manière similaire à C++, un objet est créé par l'appel d'un +<strong>constructeur</strong> de même nom que la classe dont il est une méthode. +<p>Vous ne devez donc pas dire <code>new Qt::Foo</code> ou <code>Qt::Foo->new()</code> +contrairement à l'usage commun en Perl.</p> +<p>Dites simplement:</p> +<pre> + my $object = Qt::<classname>(arg_1, ..., arg_n);</pre> +<p>Un constructeur sans argument s'énonce encore plus brièvement :</p> +<pre> + my $object = Qt::<classname>;</pre> +<p></p> +<li></li> +Comme il a déjà été dit, l'équivalent Perl d'un pointeur C++ est le mot-clé +Perl <strong>undef</strong>. +<p>Les pointeurs sont les arguments précédés par le caractère <strong>*</strong> dans la +documentation Qt (Par exemple: ``<code>QWidget* widget</code>'').</p> +<p></p></ol> +<p> +</p> +<h2><a name="l'héritage_et_les_objets">L'héritage et les objets</a></h2> +<p>Avant d'expliquer comment les routines Perl peuvent être appelées de Qt, +parlons du mécanisme d'héritage vu de PerlQt.</p> +<p>PerlQt est conçu pour allier la simplicité de Qt à la puissance et à la +flexibilité de Perl. Pour ce faire, PerlQt étend le paradigme objet de +Perl pour mimer Qt et son mécanisme de <strong>métaobjets</strong>.</p> +<p> +</p> +<h3><a name="un_widget_personnalisé">Un Widget personnalisé</a></h3> +<p>Réécrivons le programme ``Hello World!'' avec une version personnalisée +de PushButton:</p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: + 7: sub NEW + 8: { + 9: shift->SUPER::NEW(@_[0..2]); + 10: resize(130, 40); + 11: } + 12: + 13: 1; + 14: + 15: package main; + 16: + 17: use Qt; + 18: use Button; + 19: + 20: my $a = Qt::Application(\@ARGV); + 21: my $w = Button("Hello World!", undef); + 22: $a->setMainWidget($w); + 23: $w->show; + 24: exit $a->exec;</pre> +<p>Pour implanter notre propre version de PushButton, nous créons un nouveau +package [l.3] et importons Qt [l.4].</p> +<p>Nous utilisons le pragma <code>Qt::isa</code> [l.5] pour déclarer notre widget +comme sous-classe de PushButton. Ce pragma accepte une liste de une ou +plusieurs classes dont dérive la classe à définir.</p> +<p>Créons maintenant un constructeur pour notre nouveau widget +en écrivant une routine appelée <strong>NEW</strong> <em>(notez les majuscules qui +marquent une méthode différente du constructeur ``new'' usuel)</em>. +Le constructeur PerlQt est appelé <strong>implicitement</strong> <em>comme ligne 21</em>.</p> +<p>Note widget doit d'abord appeler le constructeur de sa classe de base +(ici: Qt::PushButton) à la ligne 9, avec tous les arguments que nous +avons reçus.</p> +<p>Nous créons ainsi un objet instance de notre classe. Cette objet est +accessible par la fonction <strong>this</strong> (Attention: ce n'est pas la +variable <code>$this</code> mais simplement <code>this</code>).</p> +<p>Chaque fois que nous invoquons une méthode à partir de notre package +nous pouvons écrire indifféremment <code>method()</code> ou +<code>this->method()</code>;</p> +<p> +</p> +<h3><a name="l'utilisation_d'attributs">L'utilisation d'attributs</a></h3> +<p>Lors de la construction d'un objet composite, vous pouvez simplement créer +ses différents composants à l'intérieur de variables de scope lexical +(c.à.d déclarées par <strong>my</strong>) puisque les widgets sont seulement détruits +par leur parent et non nécessairement quand leur conteneur disparaît +du scope.</p> +<p>En d'autres termes, PerlQt utilise un système de comptage de +références pour gérer la destruction des objets.</p> +<p>Souvent cependant, vous souhaiterez accéder aux composants de votre objet depuis +un tout autre endroit que celui où vous l'avez créé (par exemple pour modifier une +légende de bouton dynamiquement). Dans ce cas, la syntaxe traditionnelle de perl +propose de stocker une référence à ces composants dans la table associative (hash) de +l'objet lui-même. Mais cette syntaxe s'avère peu pratique à l'usage et beaucoup +trop libre - il n'y a pas de vérification à la compilation de sorte que vous pouvez +accéder à des clefs non existantes sans déclencher d'erreur.</p> +<p>En lieu et place de cette syntaxe, PerlQt introduit le concept d'<strong>attributs</strong>.</p> +<p>Les attributs sont de simples variables perl, écrites sans le signe dollar initial, et +pouvant contenir toute donnée qui est une propriété de votre objet. +Leur principal avantage est de fournir une syntaxe très rapide et vérifiable à la compilation.</p> +<p>Pour définir et pouvoir utiliser de nouveaux attributs, il suffit d'utiliser +le pragma <code>use Qt::attributes</code>, suivi d'une liste des noms d'attributs souhaités. +Ainsi:</p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw( + 7: itsTime + 8: pData + 9: ); + 10: + 11: sub NEW + 12: { + 13: shift->SUPER::NEW(@_[0..2]); + 14: itsTime = Qt::Time; + 15: itsTime->start; + 16: pData->{'key'} = " Foo "; + 17: } + 18: + 19: sub resizeEvent + 20: { + 21: setText( "w: ". width() ." h: ". height() . + 22: "\nt: ". itsTime->elapsed . pData->{'key'} ); + 23: } + 24: + 25: 1;</pre> +<br/> +<div class='image'><img src="../images/ex2.png"/></div><p>L'attribut itsTime est déclaré à la ligne 7 et initialisé par un objet <code>Qt::Time</code> +à la ligne 14.</p> +<p>Puisque nous réimplémentons la fonction virtuelle ``resizeEvent'' +[l.19], chaque fois que le widget principal est redimensionné, cette +fonction ``resizeEvent'' sera déclenchée et le texte de notre Button mis +à jour avec les valeurs venant de l'objet [1.21] et les attributs que +nous avons définis [1.22].</p> +<p><strong>Récapitulation</strong></p> +<ul> +<li></li> +Pour hériter d'une classe Qt, un package doit contenir un +pragma <code>use Qt::isa</code>. +<p>Ainsi:</p> +<pre> + use Qt::isa "Qt::widget";</pre> +<p></p> +<li></li> +Le constructeur d'objet est nommé <strong>NEW</strong> et est appelé implicitement. +Vous ne devez donc pas dire: +<pre> + my $o = MyButton->NEW("Hello");</pre> +<p>Mais bien :</p> +<pre> + my $o = MyButton("Hello");</pre> +<p></p> +<li></li> +A l'intérieur d'un package, on accéde l'instance courante par la +fonction <strong>this</strong>. +<p>Quand une fonction membre est appelée, les arguments sont accessibles +par le tableau <strong>@_</strong>, mais le premier élément de <strong>@_</strong> n'est pas une +référence à l'objet contrairement à l'usage commun en Perl.</p> +<p>Vous ne pouvez donc pas dire :</p> +<pre> + sub myMember + { + my $moi = shift; + my $arg = shift; + $arg->doThat($moi); + $moi->doIt; + }</pre> +<p>Écrivez plutôt :</p> +<pre> + sub myMember + { + my $arg = shift; + $arg->doThat(this); + doIt(); + }</pre> +<p>De plus, si vous voulez appeler une méthode dans une classe de base à +partir d'une classe dérivée, utilisez l'attribut spécial SUPER :</p> +<pre> + sub exemple + { + print "Appel de la méthode 'exemple' dans la classe de base"; + SUPER->exemple(@_) + }</pre> +<p>Notez aussi que la construction :</p> +<pre> + this->SUPER::Exemple(@_);</pre> +<p>est possible, mais qu'elle passe l'objet comme premier argument.</p> +<p></p> +<li></li> +Lorsque vous devez stocker dans votre package un objet contenu, vous +devez le définir comme <strong>attribut</strong> : +<pre> + use Qt::attributes qw( + firstAttribute + ... + lastAttribute);</pre> +<p>Il sera alors disponible comme accesseur :</p> +<pre> + firstAttribute = myContainedWidget( this ); + firstAttribute->resize( 100, 100 );</pre> +<p><strong>NB:</strong> Pour ceux qui souhaitent en savoir plus, les attributs sont implémentés +à l'aide de sub lvalue, c'est à dire de fonctions assignables. +En interne, elles ne font que pointer sur la clef de hachage correspondante dans +l'objet <strong>this</strong>, ce qui rend les tournures ``unAttribut->fonction()'' et +``this->{'unAttribut'}->fonction()'' strictement équivalentes +(si ce n'est que la première est vérifiée au moment de la compilation).</p> +<p></p> +<li></li> +Pour réimplémenter une <strong>fonction virtuelle</strong>, créez simplement une +<strong>sub</strong> de même nom que cette fonction. +<p>Les fonctions virtuelles existantes sont marquées comme telles dans +la documentation de Qt (ce sont les méthodes précédées du mot clef ``virtual'').</p> +<p>Vous pouvez visualiser les noms de méthodes virtuelles que Qt tentera d'appeler +dans votre classe en plaçant <code>use Qt::debug qw|virtual|</code> en tête de +votre programme.</p> +<p></p></ul> +<p> +</p> +<h2><a name="signaux_et_slots">Signaux et Slots</a></h2> +<p>Voyons maintenant comment les objets Qt peuvent communiquer entre eux +de manière à ce qu'un événement concernant un objet puisse déclencher +l'exécution d'une routine en un quelconque endroit de votre programme.</p> +<p>Dans d'autres toolkits, les callbacks (appels en retour) sont généralement +utilisés à cet effet. Mais Qt dispose d'un mécanisme beaucoup plus puissant +et plus flexible : les <strong>Signaux et Slots</strong>.</p> +<p>On peut se le représenter comme le cablage entre les composants d'une +chaîne Hi-Fi. Un amplificateur, par exemple, émet des signaux de sortie +sans chercher à savoir si des enceintes lui sont connectées ou non. +Un magnétophone peut attendre un signal sur sa prise d'entrée +pour commencer à enregistrer, et il ne cherchera pas à savoir s'il est +l'unique destinataire de ce signal ou si ce dernier est aussi reçu par un graveur de CD +ou écouté au casque.</p> +<p>Un composant Qt se comporte comme notre amplificateur ou notre +magnétophone. Il a des sorties ou <strong>Signaux</strong> et des entrées ou +<strong>Slots</strong>. Chaque sortie (signal) est connectable à un nombre illimité +d'entrées (slots). La sortie d'un composant peut être potentiellement +branchée à toute entrée d'un composant (y compris lui-même),</p> +<p>La syntaxe de ce système de connexion est soit:</p> +<p>Qt::Object::connect( envoyeur, SIGNAL 'mon_signal(types_d_arguments)', +recepteur, SLOT 'monslot(types_d_arguments)');</p> +<p>soit:</p> +<p>unObjet->connect( envoyeur, SIGNAL 'mon_signal(types_d_arguments)', +SLOT 'monslot(types_d_arguments)');</p> +<p>Dans le second cas, le récepteur est omis car c'est l'objet lui-même,</p> +<p>Ce mécanisme est extensible à volonté par la déclaration de nouveaux Signaux et +Slots par l'usage des pragma <code>use Qt::signals</code> et <code>use Qt::slots</code> +(voir aussi la deuxième syntaxe décrite plus bas).</p> +<p>Chaque slot déclaré appellera la routine correspondante de votre +objet. Chaque signal déclaré peut être déclenché via le mot-clé <strong>emit</strong>.</p> +<p><strong>Réécrivons encore notre exemple pour illustrer nos propos :</strong></p> +<pre> + 1: use strict; + 2: + 3: package Button; + 4: use Qt; + 5: use Qt::isa qw(Qt::PushButton); + 6: use Qt::attributes qw(itsTime); + 7: use Qt::slots + 8: aEteClicke => [], + 9: changement => ['int', 'int']; + 10: use Qt::signals + 11: changeLe => ['int', 'int']; + 12: + 13: sub NEW + 14: { + 15: shift->SUPER::NEW(@_[0..2]); + 16: itsTime = Qt::Time; + 17: itsTime->start; + 18: this->connect(this, SIGNAL 'clicked()', SLOT 'aEteClicke()'); + 19: this->connect(this, SIGNAL 'changeLe(int,int)', SLOT 'changement(int,int)'); + 20: } + 21: + 22: sub aEteClicke + 23: { + 24: my $w = width(); + 25: my $h = height(); + 26: setText( "w: $w h: $h\nt: ". itsTime->elapsed ); + 27: emit changeLe($w, $h); + 28: } + 29: + 30: sub changement + 31: { + 32: my ($w, $h) = @_; + 33: print STDERR "w: $w h: $h \n"; + 34: } + 35: + 36: 1;</pre> +<p>Nous définissons dans ce package deux nouveaux slots et un nouveau signal.</p> +<p>La documentation Qt nous dit que tout PushButton clické émet un signal +<code>clicked()</code> ; nous le connectons donc à notre nouveau slot [ligne 18].</p> +<p>Nous connectons aussi notre signal <code>ChangeLe</code> à notre slot +<code>changement</code>.</p> +<p>Ainsi, quand on appuie (clique) sur notre Button , le signal +<code>clicked()</code> est émit et déclenche le slot <code>aEteClicke()</code>. +<code>aEteClicke()</code> émet à son tour le signal <code>changeLe(int,int)</code>[l.27], +appelant de ce fait le slot <code>changement(int,int)</code>, avec deux arguments.</p> +<p>Enfin, il existe une syntaxe alternative introduite dans PerlQt-3.008 :</p> +<pre> + sub un_slot : SLOT(int, QString) + { + $int = shift; + $string = shift; + # faire quelque chose + }</pre> +<p>et</p> +<pre> + sub un_signal : SIGNAL(QString);</pre> +<p>Cette syntaxe est parfaitement compatible avec la déclaration par le biais de +<code>use Qt::signals</code> et <code>use Qt::slots</code>. +Il peut d'ailleurs d'avérer très profitable pour la clarté du programme de déclarer tout d'abord +les signaux/slots au moyen de <code>use Qt::slots/signals</code>, puis de rappeler cette déclaration au niveau de +l'implémentation à l'aide de la seconde syntaxe. +Les déclarations seront alors vérifiées à la compilation, et le moindre conflit +générera un avertissement.</p> +<p> +</p> +<hr /> +<h1><a name="développement_rapide_(rad)_avec_qt_designer_et_puic">Développement rapide (RAD) avec Qt Designer et Puic</a></h1> +<p> +</p> +<h2><a name="introduction">Introduction</a></h2> +<ul> +<li><strong><a name="item_n%2eb%3a">N.B:</a></strong><br /> +</li> +Depuis la version 3.008, il existe un plugin spécifique à PerlQt pour Qt Designer. +Ce plugin (disponible sur les pages internet du projet) apporte le confort d'une intégration poussée, +la coloration syntaxique Perl, la complétion automatique, et permet de lancer et déboguer un projet +sans quitter l'interface du Designer. +Ce qui suit reste néanmoins parfaitement valable pour ce qui est de l'utilisation de puic en ligne de commande, +et pour l'utilisation de Qt Designer <em>sans</em> le plugin spécifique. +<p></p></ul> +<p>Aussi puissant et intuitif que soit Qt, écrire une GUI complète reste un exercice +fastidieux.</p> +<p>Heureusement, Qt est fourni avec un constructeur de GUI sophistiqué +appelé Qt Designer qui est quasiment un environnement de développement +intégré. Il comporte la gestion de Projets, la création d'un GUI par +des actions de ``drag and drop'', un butineur d'objet complet, +l'interconnexion graphique de signaux et de slots, et plus encore.</p> +<p>L'information générée par Qt Designer's est en format XML et peut donc +être parsée par différentes commandes comme dont <strong>puic</strong> (le +compilateur d'interface utilisateur PerlQt).</p> +<p>Supposons que vous avez déja construit un fichier d'interface avec +Qt Designer, la transcription en un programme PerlQt se fait par +la simple exécution de la commande :</p> +<pre> + puic -x -o program.pl program.ui</pre> +<p>Cela génèrera le package défini dans votre fichier ui et un package +principal à fins de test,</p> +<p>Vous pouvez préférer :</p> +<pre> + puic -o package.pm program.ui</pre> +<p>Cela ne générera que le package qui pourra être utilisé par un programme séparé.</p> +<p> +</p> +<h2><a name="inclure_des_images">Inclure des Images</a></h2> +<p>Il y a deux manières d'inclure des <strong>images ou icônes</strong>:</p> +<ul> +<li><strong><a name="item_inclusion_inline">Inclusion Inline</a></strong><br /> +</li> +A cette fin, nous devons sélectionner ``Edit->Form +Settings->Pixmaps->Save inline'' dans Qt Designer et executer ensuite: +<pre> + puic -x -o F<program.pl> F<program.ui></pre> +<p></p> +<li><strong><a name="item_image_collection">Image Collection</a></strong><br /> +</li> +Cette stratégie est plus complexe, mais plus propre et plus puissante. +<pre> + puic -o F<Collection.pm> -embed F<unique_identifier> F<image-1> ... F<image-n></pre> +<p>Ajoutez l'instruction <code>use Collection.pm</code> dans le package principal +de votre programme.</p> +<p>Si vous avez créé un fichier projet dans Qt Designer et ajouté toutes +les images dans un groupe (par ``Project->Image Collection''), vous +disposez ensuite de ces images dans le répertoire où votre fichier +projet (*.pro) est stocké, dans le sous-répertoire <strong>image</strong>. Vous pouvez +alors générer la collection d'images par:</p> +<pre> + puic -o F<Collection.pm> -embed F<identifier> images/*</pre> +<p>Vous pouvez utiliser autant de collections d'images que vous voulez +dans un programme en ajoutant simplement une instruction <strong>use</strong> +pour chaque collection.</p> +<p></p></ul> +<p> +</p> +<h2><a name="travailler_avec_des_fichiers_.ui">Travailler avec des fichiers <strong>.ui</strong></a></h2> +<p>Souvent, vous voudrez regénérez votre interface utilisateur à +à cause d'une modification ou extension de votre design initial. +C'est donc une mauvais idée d'écrire votre code dans le fichier Perl +autogénéré car vous risquerez d'écraser le code que vous avez écrit +manuellement ou vous devrez faire des copier-coller intensifs.</p> +<p>Voici une meilleure méthode :</p> +<ul> +<li><strong><a name="item_écrire_l%27implémentation_de_slots_dans_le_designe">Écrire l'implémentation de slots dans le Designer</a></strong><br /> +</li> +Dans Qt Designer, selectionnez l'onglet <em>Source</em> dans l'explorateur +d'objets (<strong>Object Explorer</strong>). Vous pouvez ainsi voir représentées +sous forme d'arbre les classes que vous avez générées. Maintenant, si +vous cliquez deux fois sur l'entrée <em>Slots/public</em>, +un dialogue vous demande si vous voulez créer un nouveau slot pour +votre module. Une fois cela fait, le nouveau slot apparait à +l'intérieur de l'arbre l'explorateur d'objet; cliquer dessus vous +amènera à votre fichier <strong><Votre Classe>.ui.h</strong> où vous pouvez +écrire l'implémentation de votre slot. +<p>Par défaut, il devrait ressembler à ceci :</p> +<pre> + void Form1::newSlot() + {</pre> +<pre> + }</pre> +<p>La déclaration du slot est réellement du code C++, mais ignorons cela +et écrivons du code Perl entre les deux accolades en faisant bien +attention d'indenter notre code avec au moins un espace.</p> +<pre> + void Form1::newSlot() + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # faire quelque chose + } + }</pre> +<p>Notre code Perl ainsi écrit sera sauvé dans le fichier ui.h et +<strong>puic</strong> prendra soin de le placer dans notre programme final.</p> +<p>Ici, après l'exécution de <strong>puic</strong> sur le ficier Form1.ui, vous +devriez avoir:</p> +<pre> + sub newSlot + { + print STDERR "Hello world from Form1::newSlot(); + if(this->foo()) + { + # faire quelque chose + } + }</pre> +<p></p> +<li><strong><a name="item_sous%2dclassez_votre_gui">Sous-classez votre GUI</a></strong><br /> +</li> +En utilisant l'option <em>-subimpl</em> de <strong>puic</strong>, vous pouvez générer un +module dérivé qui hérite l'interface utilisateur originelle. +<p>Typiquement, vous générez le module dérivé une fois, et écrivez votre +code dans ce module dérivé. Ainsi, quand vous devez modifier votre +module GUI, regénérez le module dont il dérive et il héritera les +changements.</p> +<p>Pour générer le module de base :</p> +<pre> + puic -o Form1.pm form1.ui</pre> +<p>(faîtes cela aussi souvent que nécessaire: n'éditez jamais +manuellement form1.ui puisqu'il serait écrasé)</p> +<p>Pour générer le GUI dérivé :</p> +<pre> + puic -o Form2.pm -subimpl Form2 form1.ui</pre> +<p>ou</p> +<pre> + puic -o program.pl -x -subimpl Form2 form1.ui</pre> +<p>(faites cela une fois et travaillez avec le fichier résultant)</p> +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="autres_outils_de_développement">Autres outils de développement</a></h1> +<p>PerlQt comprend également deux programmes pouvant vous aider à maîtriser l'API de Qt :</p> +<p> +</p> +<h2><a name="pqtapi">pqtapi</a></h2> +<p>pqtapi est un outil d'introspection en ligne de commande.</p> +<pre> + utilisation: pqtapi [-r <re>] [<class>]</pre> +<pre> + options: + -r <re> : chercher les méthodes correspondant à l'expression régulière <re> + -i : avec -r, effectue une recherche insensible à la casse + -v : afficher les versions de PerlQt et de Qt + -h : afficher ce message d'aide</pre> +<p>ex:</p> +<pre> + $>pqtapi -ir 'setpoint.* int' + void QCanvasLine::setPoints(int, int, int, int) + void QPointArray::setPoint(uint, int, int)</pre> +<p> +</p> +<h2><a name="pqtsh">pqtsh</a></h2> +<p><strong>pqtsh</strong> est un shell graphique permettant de tester l'API de manière interactive. +Un exemple dynamique est accessible dans l'entrée de menu <code>Help->Example</code>.</p> +<br/> +<div class='image'><img src="../images/pqtsh.png"/></div><p> +</p> +<hr /> +<h1><a name="limitations">Limitations</a></h1> +<p>Les classes à modèle (templates) ne sont pas encore accessibles par PerlQt. +En revanche, les classes dérivées de classes à modèle sont disponibles.</p> +<p>Vous pouvez reconnaître ce type de classe en ce que leurs arguments comprennent un type générique placé entre +les signes ``<'' et ``>''.</p> +<p>ex: + QDictIterator ( const QDict<type> & dict )</p> +<p> +</p> +<hr /> +<h1><a name="crédits">Crédits</a></h1> +<p>PerlQt-3 est (c) 2002 Ashley Winters (et (c) 2003 Germain Garand)</p> +<p>Kalyptus et l'engin de génération Smoke sont (c) David Faure and Richard Dale</p> +<p>Puic is (c) TrollTech AS., Phil Thompson et Germain Garand,</p> +<p>Ledit logiciel est délivré sous la GNU Public Licence v.2 or later.</p> +<p> +</p> +<hr /> +<h1><a name="appendice:_les_conventions_de_c++_et_leur_traduction_en_perl">Appendice: Les conventions de C++ et leur traduction en Perl</a></h1> +<p>Lorsque vous voulez utiliser depuis PerlQt une classe ou méthode décrite +dans la <a href="http://doc.trolltech.com">documentation</a> Qt (voyez aussi le programme +$QTDIR/bin/assistant livré avec Qt), vous devez suivre des règles de translation simples.</p> +<dl> +<dt><strong><a name="item_noms_de_classe">Noms de classe</a></strong><br /> +</dt> +<ul> +<li></li> +Les noms de classes utilisent le préfixe <strong>Qt::</strong> au lieu de <strong>Q</strong> pour +être conforme à l'usage Perl. Ainsi: QComboBox est nommé Qt::ComboBox +dans PerlQt. +<p></p></ul> +<dt><strong><a name="item_fonctions">Fonctions</a></strong><br /> +</dt> +<ul> +<li></li> +Les fonctions décrites comme <strong>static</strong> sont accédées directement et non +à travers un objet. Ainsi la fonction statique Foo de la classe <strong>QBar</strong> +peut être accédée de PerlQt par +<pre> + Qt::Bar::Foo( arg-1,...,arg-n);</pre> +<p></p> +<li></li> +Les fonctions décrites comme <strong>members</strong> ou <strong>Signals</strong> sont +accessibles à travers l'objet par l'opérateur + <strong>-></strong> . +Par exemple: +<pre> + $widget->show;</pre> +<p>Il n'y a pas de différence fondamentale entre les méthodes et les +signaux, néanmoins PerlQt fournit le mot-clé <strong>emit</strong> comme une +mnémonique pratique pour rendre clair que vous émettez un signal :</p> +<pre> + emit $button->clicked;</pre> +<p></p></ul> +<dt><strong><a name="item_arguments">Arguments</a></strong><br /> +</dt> +<ul> +<li><strong><a name="item_par_valeur">Par valeur</a></strong><br /> +</li> +Lorsqu'un argument n'est pas précédé par un des caractères <strong>&</strong> or +<strong>*</strong>, il est passé par valeur. Pour tous les types basiques tels que +int, char, float and double, PerlQt convertira automatiquement les +valeurs litérales et scalaires dans le type correspondants C++. +<p>Ainsi pour le prototype d'un constructeur écrit dans la documentation +comme ceci: + QSize ( int w, int h )</p> +<p>Vous écrirez :</p> +<pre> + Qt::Size(8, 12);</pre> +<p></p> +<li><strong><a name="item_par_référence">Par référence</a></strong><br /> +</li> +Lorsqu'un argument est précédé par le caractère <strong>&</strong>, Il est une +référence à un objet ou à un type. Vous pouvez alors fournir un nom de +variable ou un objet temporaire : +<pre> + $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $widget->setAccel( $keyseq );</pre> +<p>ou</p> +<pre> + $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 );</pre> +<p>Si l'argument n'est <em>pas</em> qualifié par <strong>const</strong> (constante), l'argument +est un objet qui peut être altéré par la méthode, vous devez +donc passer une variable.</p> +<p></p> +<li><strong><a name="item_par_pointeur">Par pointeur</a></strong><br /> +</li> +Lorsqu'un argument est précédé par le caractère <strong>*</strong>, +un pointeur vers un objet ou un type est attendu. En PerlQt, vous +pouvez fournir un nom de variable ou le mot clé <strong>undef</strong> à la place +du pointer Null. +<p>De plus, si l'argument est const, l'objet passé en argument est en +lecture seule: il ne peut pas être modifié.</p> +<p></p></ul> +<dt><strong><a name="item_énumérations">Énumérations</a></strong><br /> +</dt> +<dd> +Les Énumerations sont une forme d'alias pour des valeurs numériques +dont il serait autrement difficile de se souvenir: +</dd> +<dd> +<p>Exemple C++:</p> +</dd> +<dd> +<pre> + enum Strange { Apple, Orange, Lemon }</pre> +</dd> +<dd> +<p>Ici, <code>Strange</code> est le type (au sens de C++) de l'énumération, et +<code>Apple</code>, <code>Orange</code> et +<code>Lemon</code> ses valeurs possible , qui sont des aliases pour des +nombres (ici 0, 1 et 2)</p> +</dd> +<dd> +<p>L'accès aux valeurs d'énumération en Perl Qt est un appel +de fonction statique.</p> +</dd> +<dd> +<p>Donc, si vous voulez éviter des prblèmes de lisibilité, nous vous +recommandons l'usage d'une syntaxe alternative d'appel de fonction +pour marquer l'utilisation d'un alias d'énumération: <code>&fonction</code>.</p> +</dd> +<dd> +<p>Revenons à notre exemple <code>Strange</code>.</p> +</dd> +<dd> +<p>Si nous rencontrons sa définition dans la classe <code>QFruits</code>, vous +écrirez en PerlQt :</p> +</dd> +<dd> +<pre> + $pomme_plus_orange = &Qt::Fruit::Pomme + &Qt::Fruit::Orange;</pre> +</dd> +<p></p> +<dt><strong><a name="item_opérateurs">Opérateurs</a></strong><br /> +</dt> +<dd> +Dans PerlQt, la <strong>surcharge d'opérateurs</strong> fonctionne de manière transparente. +Si un opérateur est surchargé dans une classe Qt (ce qui signifie que son utilisation +déclenchera un appel de méthode, au lieu d'utiliser l'opérateur générique) +il sera également surchargé dans PerlQt. +</dd> +<dd> +<p>ex-1: surcharge de '+='</p> +</dd> +<dd> +<pre> + $p1 = Qt::Point(10, 10) + $p2 = Qt::Point(30,40) + $p2 += $p1; # $p2 devient (40,50)</pre> +</dd> +<dd> +<p>ex-2: surcharge de '<<'</p> +</dd> +<dd> +<pre> + $f = Qt::File("example"); + $f->open( IO_WriteOnly ); # voir l'entrée 'Constantes' plus bas + $s = Qt::TextStream( $f ); + $s << "Que faire avec " << 12 << " pommes ?";</pre> +</dd> +<dd> +<p><strong>Exception notable</strong> : le constructeur de copie (signe égal, '=') n'est jamais surchargé, +attendu qu'il ne pourrait fonctionner que partiellement et que le paradigme de +Perl est très différent de C++ en matière de copie d'objets.</p> +</dd> +<p></p> +<dt><strong><a name="item_constantes">Constantes</a></strong><br /> +</dt> +<dd> +Qt n'utilise pas beaucoup de constantes, mais on en trouve cependant dans le module d'Entrées/Sorties, +où elles font office de drapeaux pour les modes d'ouverture de fichiers. +</dd> +<dd> +<p>Pour éviter de polluer inutilement l'espace de nom, nous avons regroupé les constantes dans le module +<strong>Qt::constants</strong>, d'où elles seront chargées à la demande.</p> +</dd> +<dd> +<p>Ainsi, pour importer l'ensemble des constantes d'E/S, on écrira :</p> +</dd> +<dd> +<pre> + use Qt::constants;</pre> +</dd> +<dd> +<p>Et pour importer quelques symboles seulement :</p> +</dd> +<dd> +<pre> + use Qt::constants qw( IO_ReadOnly IO_WriteOnly );</pre> +</dd> +<p></p> +<dt><strong><a name="item_fonctions_globales">Fonctions globales</a></strong><br /> +</dt> +<dd> +Qt dispose de fonctions utilitaires, telles bitBlt, qCompress, etc. +</dd> +<dd> +<p>Ces fonctions ont été rassemblées dans un espace de nom commun: +<code>Qt::GlobalSpace</code>.</p> +</dd> +<dd> +<p>Vous pourrez donc y accéder soit par un appel pleinement qualifié :</p> +</dd> +<dd> +<pre> + Qt::GlobalSpace::qUncompress( $buffer )</pre> +</dd> +<dd> +<p>Soit en important préalablement ces fonctions dans l'espace de nom courant :</p> +</dd> +<dd> +<pre> + use Qt::GlobalSpace; + qUncompress( $buffer )</pre> +</dd> +<dd> +<p>Bien entendu, vous pouvez aussi n'importer que les fonctions souhaitées :</p> +</dd> +<dd> +<pre> + use Qt::GlobalSpace qw( qUncompress bitBlt )</pre> +</dd> +<dd> +<p><strong>N.B:</strong> GlobalSpace renferme également des opérateurs de portée globale, tels +celui permettant d'aditionner deux Qt::Point(). Ces opérateurs seront appelés +automatiquement.</p> +</dd> +<dd> +<p>ex:</p> +</dd> +<dd> +<pre> + $p1 = Qt::Point(10, 10) + Qt::Point(20, 20)</pre> +</dd> +<p></p></dl> +<p> +</p> +<hr /> +<h1><a name="annexe_2_:_internationalisation">Annexe 2 : Internationalisation</a></h1> +<p>PerlQt résout les problèmes d'internationalisation en convertissant systématiquement les <strong>QString</strong> +de Qt en <strong>utf8</strong> côté Perl.</p> +<p>Les conversions en sens inverse, depuis Perl vers Qt sont traitées différemment suivant le contexte :</p> +<ul> +<li><strong><a name="item_si_la_chaîne_de_caractère_est_déjà_marquée_comme_é">Si la chaîne de caractère est déjà marquée comme étant utf8</a></strong><br /> +</li> +alors elle sera convertie en QString directement. +<p>C'est la manière privilégiée d'opérer, et la plus simple : +Il vous suffit d'insérer un pragma <strong>use utf8</strong> en tête de vos programmes, puis d'utiliser un éditeur de +texte supportant l'utf8 (quasiment tous de nos jours) pour élaborer votre code source. +Les chaînes seront marquées par Perl automatiquement.</p> +<p></p> +<li><strong><a name="item_si_la_chaîne_n%27est_pas_marquée_comme_utf8%2c_et_">Si la chaîne n'est pas marquée comme utf8, et le pragma 'use locale' n'est pas actif</a></strong><br /> +</li> +alors la conversion en QString se fera depuis l'<strong>ISO-Latin-1</strong>. +<p></p> +<li><strong>Si la chaîne n'est pas marquée comme utf8, et le pragma 'use locale' est actif</strong><br /> +</li> +alors la conversion en QString se fera depuis votre <strong>locale</strong>. +<p></p></ul> +<p>Lorsque des chaînes contiennent de l'utf8, Perl adapte automatiquement ses opérateurs pour que +leur gestion soit entièrement transparente (comprendre opaque, comme toujours...). +Cependant, vous pourrez avoir besoin à l'occasion de les transcrire en d'autres jeux d'encodage. +Ceci peut se faire soit avec Qt :</p> +<pre> + $tr1=Qt::TextCodec::codecForLocale(); # ceci utilisera la locale en vigueur + $tr2=Qt::TextCodec::codecForName("KOI8-R"); # ceci force l'emploi d'une locale spécifique (Russe)</pre> +<pre> + print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr2->fromUnicode($une_chaine_utf8);</pre> +<p>Soit avec les outils de Perl (pour perl >= 5.8.0). +Se reporter à ce sujet à la documentation du module <strong>Encode</strong> (<code>perldoc Encode</code>).</p> +<p> +</p> +<h3><a name="désactiver_l'encodage_utf8">désactiver l'encodage utf8</a></h3> +<p>Les programmeurs souhaitant désactiver temporairement l'encodage utf8 +(pour la gestion de programmes externes ou de modules anciens ne supportant pas cet encodage) +pourront utiliser le pragma <strong>use bytes</strong> (et sa réciproque : <strong>no bytes</strong>).</p> +<p>Dans la portée de ce pragma, les conversions depuis QString vers les chaînes Perl se feront en ISO-Latin1 +(par défaut) ou suivant la locale en vigueur (si <strong>use locale</strong> est actif).</p> +<p>Notez bien qu'il est préférable de <em>ne pas utiliser ce pragma à la légère</em>, en ce qu'il ruine totalement les +efforts de standardisations autour d'utf8 entrepris depuis plusieurs années déjà. +Il est très préférable de corriger les programmes fautifs.</p> +<p> +</p> +<hr /> +<h1><a name="annexe_3_:_canaux_de_déboguage">Annexe 3 : Canaux de déboguage</a></h1> +<p>Le module <strong>Qt::debug</strong> offre divers canaux de déboguage permettant de filtrer +le flux conséquent d'informations disponibles pour l'adapter à vos besoins.</p> +<pre> + use Qt::debug;</pre> +<pre> + use Qt::debug qw|calls autoload verbose|;</pre> +<p>Avec le pragma <code>use Qt::debug</code>, seuls les canaux <strong>verbose</strong> et <strong>ambiguous</strong> sont activés. +Si vous le faites suivre d'une liste précise de canaux, seuls ceux-ci seront affichés.</p> +<p><strong>Liste et descriptif des canaux :</strong></p> +<ul> +<li><strong><a name="item_ambiguous">ambiguous</a></strong><br /> +</li> +Vérifier si les appels de méthodes sont ambigus, et dire quelle méthode, parmi le jeux +d'alternatives, à finalement été choisie. +<p></p> +<li><strong><a name="item_verbose">verbose</a></strong><br /> +</li> +Donner davantage d'informations. +<p>Utilisé avec <strong>ambiguous</strong>, vous donnera les correspondances les plus proches lorsqu'un appel de méthode échoue.</p> +<p>ex:</p> +<pre> + use Qt; + use Qt::debug; + $a= Qt::Application(\@ARGV); + $a->libraryPath("chose");</pre> +<pre> + --- No method to call for : + QApplication::libraryPath('chose') + Closer candidates are : + static void QApplication::addLibraryPath(const QString&) + static QStringList QApplication::libraryPaths() + static void QApplication::removeLibraryPath(const QString&) + static void QApplication::setLibraryPaths(const QStringList&)</pre> +<p></p> +<li><strong><a name="item_calls">calls</a></strong><br /> +</li> +Pour chaque appel de méthode, vous dira quelle méthode Qt est finalement appelée, +en précisant les arguments si <strong>verbose</strong> est actif. +<p></p> +<li><strong><a name="item_autoload">autoload</a></strong><br /> +</li> +Détaille le passage dans le code intermédiaire faisant la jonction entre Perl et Qt. +<p></p> +<li><strong><a name="item_gc">gc</a></strong><br /> +</li> +Donne des informations sur la collection des déchets, c'est à dire sur la destruction des objets, +qu'ils soient détruits depuis Perl ou Qt. +<p></p> +<li><strong><a name="item_virtual">virtual</a></strong><br /> +</li> +Vous averti chaque fois qu'une fonction virtuelle tente d'accéder à sa réimplémentation en Perl +(que cette réimplémentation existe ou non). +<p></p> +<li><strong><a name="item_all">all</a></strong><br /> +</li> +Activer tous les canaux. +<p></p></ul> +<p> +</p> +<hr /> +<h1><a name="annexe_4_:_marshalleurs">Annexe 4 : Marshalleurs</a></h1> +<p>Un marshalleur est un convertisseur permettant de transcrire un type de données en un autre.</p> +<p>Dans PerlQt, la plupart des objets Qt gardent leurs propriétés d'objet, ce qui permet d'invoquer leurs méthodes +et de changer leurs propriétés comme il se doit. +Cependant, il arrive que l'objet d'origine corresponde à ce point à un type natif de Perl qu'il serait malséant +d'utiliser l'interface C++ et beaucoup plus naturel de lui substituer son équivalent.</p> +<p>Ici interviennent les marshalleurs. +Plutôt que de retourner un objet Qt::StringList, qui serait délicat à manipuler, +PerlQt le transformera en référence de liste Perl. +Dès lors, tous les opérateurs de manipulation de liste pourront lui être appliqué : +on gagne en densité, en cohérence et en simplicité.</p> +<p>Cette transformation s'appliquera aussi en sens inverse, et n'importe quelle liste de chaînes Perl +pourra être donnée en argument à une méthode attendant une Qt::StringList.</p> +<pre> + Liste des marshalleurs (PerlQt-3.008) + ----------------------------------------------------------------- + float, double <=> réel Perl (NV) + char, uchar, int, uint, enum + long, ulong, short, ushort <=> entier Perl (IV) + QString, -&, -* => chaîne Perl (utf8) + QString, -&, -* <= chaîne Perl (utf8 ou iso-latin1 ou locale) + QCString, -&, -* <=> chaîne Perl (utf8 ou octets, suivant contenu ou pragma "bytes") + QStringList, -&, -* => référence à une liste de chaînes Perl (utf8) + QByteArray, -&, -* <=> chaîne Perl (octets) + int&, -* <=> entier Perl (IV) + bool&, -* <=> booléen Perl + char* <=> chaîne Perl (octets) + char** <= référence à une liste de chaînes Perl (octets) + uchar* <= chaîne Perl(octets) + QRgb* <= référence à une liste d'entiers Perl (IV) + QCOORD* <= référence à une liste d'entiers Perl (IV) + void* <=> référence à un entier Perl (IV) + QValueList<int>, - *, - & <=> référence à une liste d'entiers Perl (IV) + QCanvasItemList, - *, - & => réference à une liste de Qt::CanvasItem + QWidgetList, - *, - & <=> réference à une liste de Qt::Widget + QObjectList, - *, - & <=> réference à une liste de Qt::Object + QFileInfoList, - *, - & <=> réference à une liste de Qt::FileInfo + QPtrList<QTab>, - *, - & <=> réference à une liste de Qt::Tab + QPtrList<QToolBar>, - *, - & <=> réference à une liste de Qt::ToolBar + QPtrList<QNetworkOperation>, - *, - & <=> réference à une liste de Qt::NetworkOperation + QPtrList<QDockWindow>, - *, - & <=> réference à une liste de Qt::DockWindow + (QUObject*)</pre> + +</body> + +</html> diff --git a/doc/images/ex1.png b/doc/images/ex1.png Binary files differnew file mode 100644 index 0000000..140b380 --- /dev/null +++ b/doc/images/ex1.png diff --git a/doc/images/ex2.png b/doc/images/ex2.png Binary files differnew file mode 100644 index 0000000..5e44a51 --- /dev/null +++ b/doc/images/ex2.png diff --git a/doc/images/pqtsh.png b/doc/images/pqtsh.png Binary files differnew file mode 100644 index 0000000..f5929b3 --- /dev/null +++ b/doc/images/pqtsh.png diff --git a/inst-apps b/inst-apps new file mode 100644 index 0000000..dc486f7 --- /dev/null +++ b/inst-apps @@ -0,0 +1,3 @@ +smoke +PerlQt +puic diff --git a/kalyptus/Ast.pm b/kalyptus/Ast.pm new file mode 100644 index 0000000..0fb4bd0 --- /dev/null +++ b/kalyptus/Ast.pm @@ -0,0 +1,91 @@ +package Ast; +use strict; + +use vars qw/ $this $pack @endCodes /; + +#----------------------------------------------------------------------------- +# This package is used to create a simple Abstract Syntax tree. Each node +# in the AST is an associative array and supports two kinds of properties - +# scalars and lists of scalars. +# See SchemParser.pm for an example of usage. +# ... Sriram +#----------------------------------------------------------------------------- + +# Constructor +# e.g AST::New ("personnel") +# Stores the argument in a property called astNodeName whose sole purpose +# is to support Print() + +sub New { + my ($this) = {"astNodeName" => $_[0]}; + bless ($this); + return $this; +} + +# Add a property to this object +# $astNode->AddProp("className", "Employee"); + +sub AddProp { + my ($this) = $_[0]; + $this->{$_[1]} = $_[2]; +} + +# Equivalent to AddProp, except the property name is associated +# with a list of values +# $classAstNode->AddProp("attrList", $attrAstNode); + +sub AddPropList { + my ($this) = $_[0]; + if (! exists $this->{$_[1]}) { + $this->{$_[1]} = []; + } + push (@{$this->{$_[1]}}, $_[2]); +} + +# Returns a list of all the property names of this object +sub GetProps { + my ($this) = $_[0]; + return keys %{$this}; +} + +sub Visit { + # Converts each of this AstNode's properties into global variables. + # The global variables are introduced into package "main" + # At the same time, a piece of code is formed to undo this work above - + # $endCode essentially contains the values of these global variables + # before they are mangled. endCode gets pushed into a stack (endCodes), + # which is unwound by UnVisit(). + + local ($this, $pack) = @_; + + + my $code = ""; + my $endCode = ""; + + + foreach my $k (keys %{$this}) { + + my $glob = $pack."::".$k; + + if ( defined $$glob ) { + + if ( ${$glob} ne "" ) { + $$glob =~ s/\'/\\\'/g; + } + + $endCode .= '$'.$pack.'::'.$k. " = '".$$glob."';"; + } else { + $endCode .= '$'.$pack . "::". $k . ' = "";'; + } + $code .= '$'.$pack . "::" . $k . "= \$this->{\"$k\"};"; + } + push (@endCodes, $endCode); + eval($code) if $code; +} + +sub UnVisit { + my $code = pop(@endCodes); + eval($code) if ($code); +} + +1; diff --git a/kalyptus/ChangeLog b/kalyptus/ChangeLog new file mode 100644 index 0000000..9f67a8c --- /dev/null +++ b/kalyptus/ChangeLog @@ -0,0 +1,82 @@ +2003-08-30 Richard Dale <Richard_Dale@tipitina.demon.co.uk> + + * Applied Germain Garand's patch to no longer rename operator methods + in the QGlobalSpace pseudo class + +2003-08-21 Alexander Kellett <lypanov@kde.org> + + * Added .kidl generation option (dcopidl replacement) + * Handled of several new constructs in the parsing: + * k_dcop: / k_dcop_signals: / K_DCOP: + * Use STDERR not STDOUT thus removing need for temporary file + +2003-08-21 Richard Dale <Richard_Dale@tipitina.demon.co.uk> + + * Added missing getClassLoader() call to Proxy constructor + +2003-08-21 Richard Dale <Richard_Dale@tipitina.demon.co.uk> + + * Rewritten java code generation for a Dynamic Proxy based SMOKE adaptor version of QtJava. + * Based on David Faure's SMOKE generation code in the '-fsmoke' option. + +2003-08-11 Richard Dale <Richard_Dale@tipitina.demon.co.uk> + + * Removed old SWIG style ruby generation option + +2003-08-09 Alexander Kellett <lypanov@kde.org> + + * Parse static friend operator methods and place into a pseudo class (for smoke) + +2002-06-03 David Faure <faure@kde.org> + + * The Smoke generation is in good shape. Removed old PerlPig and PerlQK + modules. + +2002-04-23 Richard Dale <duke@tipitina.demon.co.uk> + + * Added patch from David Faure to correctly handle nested struct + or class names in perl .pig generation + +2002-03-15 Richard Dale <duke@tipitina.demon.co.uk> + * Added C# P/Invoke bindings generation option from Adam Treat +2002-02-10 Richard Dale <duke@tipitina.demon.co.uk> + * Improved C destructor code generation + * QCanvasItemList mapped onto java.util.ArrayList + * 'bool *' type converted to java 'boolean[]' type. +2002-02-03 Richard Dale <duke@tipitina.demon.co.uk> + + * More fixes to .pig generation from Germain. Perl porting now + motoring 24*7... +2002-02-02 Richard Dale <duke@tipitina.demon.co.uk> + * Various improvements to Perl .pig generation from Germain Garand +2002-01-31 Richard Dale <duke@tipitina.demon.co.uk> + * Fixed bug in code generation for NULL default arguments + * Added some new KDE 3 types +2002-01-26 Richard Dale <duke@tipitina.demon.co.uk> + * Perl .pig generation improved +2002-01-25 Richard Dale <duke@tipitina.demon.co.uk> + * Added '-fperl' option to autogenerate .pig (Perl Interface + Generator) files, suitable for generating Ashley Winters' PerlQt/KDEQt + bindings +2002-01-23 Richard Dale <duke@tipitina.demon.co.uk> + * Made dispose() public, added isDisposed() after SWT. +2002-01-23 Richard Dale <duke@tipitina.demon.co.uk> + * Added generation of dispose() methods, to allow large resources, + such as pixmaps, to be freed before finalize() is called. +2002-01-20 Richard Dale <duke@tipitina.demon.co.uk> + * Ruby bindings generation - initial checkin. +2002-01-04 Richard Dale <duke@tipitina.demon.co.uk> + * Fixed bug in parsing decimal point in default argument values +2001-12-29 Richard Dale <duke@tipitina.demon.co.uk + * JNI event handling methods are now generated. + * Some additions for KDevelop types. + * Removed assumption that a class ending in '..Interface' should always + be a java interface. +2001-12-17 Richard Dale <duke@tipitina.demon.co.uk + * Improved code generation for String f'ns with default arguments. + * An implementation is no longer generated for classes which are + just interfaces. +2001-12-03 Richard Dale <duke@tipitina.demon.co.uk + * Added new KDE 3 data types + * Improved code generation for classes defined within namespaces + diff --git a/kalyptus/Iter.pm b/kalyptus/Iter.pm new file mode 100644 index 0000000..7279a6f --- /dev/null +++ b/kalyptus/Iter.pm @@ -0,0 +1,532 @@ +package Iter; + +=head1 Iterator Module + +A set of iterator functions for traversing the various trees and indexes. +Each iterator expects closures that operate on the elements in the iterated +data structure. + + +=head2 Generic + + Params: $node, &$loopsub, &$skipsub, &$applysub, &$recursesub + +Iterate over $node\'s children. For each iteration: + +If loopsub( $node, $kid ) returns false, the loop is terminated. +If skipsub( $node, $kid ) returns true, the element is skipped. + +Applysub( $node, $kid ) is called +If recursesub( $node, $kid ) returns true, the function recurses into +the current node. + +=cut + +sub Generic +{ + my ( $root, $loopcond, $skipcond, $applysub, $recursecond ) = @_; + + return sub { + foreach my $node ( @{$root->{Kids}} ) { + + if ( defined $loopcond ) { + return 0 unless $loopcond->( $root, $node ); + } + + if ( defined $skipcond ) { + next if $skipcond->( $root, $node ); + } + + my $ret = $applysub->( $root, $node ); + return $ret if defined $ret && $ret; + + if ( defined $recursecond + && $recursecond->( $root, $node ) ) { + $ret = Generic( $node, $loopcond, $skipcond, + $applysub, $recursecond)->(); + if ( $ret ) { + return $ret; + } + } + } + + return 0; + }; +} + +sub Class +{ + my ( $root, $applysub, $recurse ) = @_; + + return Generic( $root, undef, + sub { + return !( $node->{NodeType} eq "class" + || $node->{NodeType} eq "struct" ); + }, + $applysub, $recurse ); +} + +=head2 Tree + + Params: $root, $recurse?, $commonsub, $compoundsub, $membersub, + $skipsub + +Traverse the ast tree starting at $root, skipping if skipsub returns true. + +Applying $commonsub( $node, $kid), +then $compoundsub( $node, $kid ) or $membersub( $node, $kid ) depending on +the Compound flag of the node. + +=cut + +sub Tree +{ + my ( $rootnode, $recurse, $commonsub, $compoundsub, $membersub, + $skipsub ) = @_; + + my $recsub = $recurse ? sub { return 1 if $_[1]->{Compound}; } + : undef; + + Generic( $rootnode, undef, $skipsub, + sub { # apply + my ( $root, $node ) = @_; + my $ret; + + if ( defined $commonsub ) { + $ret = $commonsub->( $root, $node ); + return $ret if defined $ret; + } + + if ( $node->{Compound} && defined $compoundsub ) { + $ret = $compoundsub->( $root, $node ); + return $ret if defined $ret; + } + + if( !$node->{Compound} && defined $membersub ) { + $ret = $membersub->( $root, $node ); + return $ret if defined $ret; + } + return; + }, + $recsub # skip + )->(); +} + +=head2 LocalCompounds + +Apply $compoundsub( $node ) to all locally defined compound nodes +(ie nodes that are not external to the library being processed). + +=cut + +sub LocalCompounds +{ + my ( $rootnode, $compoundsub ) = @_; + + return unless defined $rootnode && defined $rootnode->{Kids}; + + foreach my $kid ( sort { $a->{astNodeName} cmp $b->{astNodeName} } + @{$rootnode->{Kids}} ) { + next if !defined $kid->{Compound}; + + $compoundsub->( $kid ) unless defined $kid->{ExtSource}; + LocalCompounds( $kid, $compoundsub ); + } +} + +=head2 Hierarchy + + Params: $node, $levelDownSub, $printSub, $levelUpSub + +This allows easy hierarchy traversal and printing. + +Traverses the inheritance hierarchy starting at $node, calling printsub +for each node. When recursing downward into the tree, $levelDownSub($node) is +called, the recursion takes place, and $levelUpSub is called when the +recursion call is completed. + +=cut + +sub Hierarchy +{ + my ( $node, $ldownsub, $printsub, $lupsub, $nokidssub ) = @_; + + return if defined $node->{ExtSource} + && (!defined $node->{InBy} + || !kdocAstUtil::hasLocalInheritor( $node )); + + $printsub->( $node ); + + if ( defined $node->{InBy} ) { + $ldownsub->( $node ); + + foreach my $kid ( + sort {$a->{astNodeName} cmp $b->{astNodeName}} + @{ $node->{InBy} } ) { + Hierarchy( $kid, $ldownsub, $printsub, $lupsub ); + } + + $lupsub->( $node ); + } + elsif ( defined $nokidssub ) { + $nokidssub->( $node ); + } + + return; +} + +=head2 + + Call $printsub for each *direct* ancestor of $node. + Only multiple inheritance can lead to $printsub being called more than once. + +=cut +sub Ancestors +{ + my ( $node, $rootnode, $noancessub, $startsub, $printsub, + $endsub ) = @_; + my @anlist = (); + + return if $node eq $rootnode; + + if ( !exists $node->{InList} ) { + $noancessub->( $node ) unless !defined $noancessub; + return; + } + + foreach my $innode ( @{ $node->{InList} } ) { + my $nref = $innode->{Node}; # real ancestor + next if defined $nref && $nref == $rootnode; + + push @anlist, $innode; + } + + if ( $#anlist < 0 ) { + $noancessub->( $node ) unless !defined $noancessub; + return; + } + + $startsub->( $node ) unless !defined $startsub; + + foreach my $innode ( sort { $a->{astNodeName} cmp $b->{astNodeName} } + @anlist ) { + + # print + $printsub->( $innode->{Node}, $innode->{astNodeName}, + $innode->{Type}, $innode->{TmplType} ) + unless !defined $printsub; + } + + $endsub->( $node ) unless !defined $endsub; + + return; + +} + +sub Descendants +{ + my ( $node, $nodescsub, $startsub, $printsub, $endsub ) = @_; + + if ( !exists $node->{InBy} ) { + $nodescsub->( $node ) unless !defined $nodescsub; + return; + } + + + my @desclist = (); + DescendantList( \@desclist, $node ); + + if ( $#desclist < 0 ) { + $nodescsub->( $node ) unless !defined $nodescsub; + return; + } + + $startsub->( $node ) unless !defined $startsub; + + foreach my $innode ( sort { $a->{astNodeName} cmp $b->{astNodeName} } + @desclist ) { + + $printsub->( $innode) + unless !defined $printsub; + } + + $endsub->( $node ) unless !defined $endsub; + + return; + +} + +sub DescendantList +{ + my ( $list, $node ) = @_; + + return unless exists $node->{InBy}; + + foreach my $kid ( @{ $node->{InBy} } ) { + push @$list, $kid; + DescendantList( $list, $kid ); + } +} + +=head2 DocTree + +=cut + +sub DocTree +{ + my ( $rootnode, $allowforward, $recurse, + $commonsub, $compoundsub, $membersub ) = @_; + + Generic( $rootnode, undef, + sub { # skip + my( $node, $kid ) = @_; + + unless (!(defined $kid->{ExtSource}) + && ($allowforward || $kid->{NodeType} ne "Forward") + && ($main::doPrivate || !($kid->{Access} =~ /private/)) + && exists $kid->{DocNode} ) { + + return 1; + } + + return; + }, + sub { # apply + my ( $root, $node ) = @_; + + my $ret; + + if ( defined $commonsub ) { + $ret = $commonsub->( $root, $node ); + return $ret if defined $ret; + } + + if ( $node->{Compound} && defined $compoundsub ) { + $ret = $compoundsub->( $root, $node ); + return $ret if defined $ret; + } + elsif( defined $membersub ) { + $ret = $membersub->( $root, $node ); + return $ret if defined $ret; + } + + return; + }, + sub { return 1 if $recurse; return; } # recurse + )->(); + +} + +sub MembersByType +{ + my ( $node, $startgrpsub, $methodsub, $endgrpsub, $nokidssub ) = @_; + +# public + # types + # data + # methods + # signals + # slots + # static +# protected +# private (if enabled) + + if ( !defined $node->{Kids} ) { + $nokidssub->( $node ) if defined $nokidssub; + return; + } + + foreach my $acc ( qw/public protected private/ ) { + next if $acc eq "private" && !$main::doPrivate; + $access = $acc; + + my @types = (); + my @data = (); + my @signals = (); + my @k_dcops = (); + my @k_dcop_signals = (); + my @k_dcop_hiddens = (); + my @slots =(); + my @methods = (); + my @static = (); + my @modules = (); + my @interfaces = (); + + # Build lists + foreach my $kid ( @{$node->{Kids}} ) { + next unless ( $kid->{Access} =~ /$access/ + && !$kid->{ExtSource}) + || ( $access eq "public" + && ( $kid->{Access} eq "signals" + || $kid->{Access} =~ "k_dcop" # note the =~ + || $kid->{Access} eq "K_DCOP")); + + my $type = $kid->{NodeType}; + + if ( $type eq "method" ) { + if ( $kid->{Flags} =~ "s" ) { + push @static, $kid; + } + elsif ( $kid->{Flags} =~ "l" ) { + push @slots, $kid; + } + elsif ( $kid->{Flags} =~ "n" ) { + push @signals, $kid; + } + elsif ( $kid->{Flags} =~ "d" ) { + push @k_dcops, $kid; + } + elsif ( $kid->{Flags} =~ "z" ) { + push @k_dcop_signals, $kid; + } + elsif ( $kid->{Flags} =~ "y" ) { + push @k_dcop_hiddens, $kid; + } + else { + push @methods, $kid; } + } + elsif ( $kid->{Compound} ) { + if ( $type eq "module" ) { + push @modules, $kid; + } + elsif ( $type eq "interface" ) { + push @interfaces, $kid; + } + else { + push @types, $kid; + } + } + elsif ( $type eq "typedef" || $type eq "enum" ) { + push @types, $kid; + } + else { + push @data, $kid; + } + } + + # apply + $uc_access = ucfirst( $access ); + + doGroup( "$uc_access Types", $node, \@types, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "Modules", $node, \@modules, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "Interfaces", $node, \@interfaces, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "$uc_access Methods", $node, \@methods, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "$uc_access Slots", $node, \@slots, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "Signals", $node, \@signals, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "k_dcop", $node, \@k_dcops, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "k_dcop_signals", $node, \@k_dcop_signals, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "k_dcop_hiddens", $node, \@k_dcop_hiddens, $startgrpsub, + $methodsub, $endgrpsub); + doGroup( "$uc_access Static Methods", $node, \@static, + $startgrpsub, $methodsub, $endgrpsub); + doGroup( "$uc_access Members", $node, \@data, $startgrpsub, + $methodsub, $endgrpsub); + } +} + +sub doGroup +{ + my ( $name, $node, $list, $startgrpsub, $methodsub, $endgrpsub ) = @_; + + my ( $hasMembers ) = 0; + foreach my $kid ( @$list ) { + if ( !exists $kid->{DocNode}->{Reimplemented} ) { + $hasMembers = 1; + break; + } + } + return if !$hasMembers; + + if ( defined $methodsub ) { + foreach my $kid ( @$list ) { + if ( !exists $kid->{DocNode}->{Reimplemented} ) { + $methodsub->( $node, $kid ); + } + } + } + + $endgrpsub->( $name ) if defined $endgrpsub; +} + +sub ByGroupLogical +{ + my ( $root, $startgrpsub, $itemsub, $endgrpsub ) = @_; + + return 0 unless defined $root->{Groups}; + + foreach my $groupname ( sort keys %{$root->{Groups}} ) { + next if $groupname eq "astNodeName"||$groupname eq "NodeType"; + + my $group = $root->{Groups}->{ $group }; + next unless $group->{Kids}; + + $startgrpsub->( $group->{astNodeName}, $group->{Desc} ); + + foreach my $kid (sort {$a->{astNodeName} cmp $b->{astNodeName}} + @group->{Kids} ) { + $itemsub->( $root, $kid ); + } + $endgrpsub->( $group->{Desc} ); + } + + return 1; +} + +sub SeeAlso +{ + my ( $node, $nonesub, $startsub, $printsub, $endsub ) = @_; + + if( !defined $node ) { + $nonesub->(); + return; + } + + my $doc = $node; + + if ( $node->{NodeType} ne "DocNode" ) { + $doc = $node->{DocNode}; + if ( !defined $doc ) { + $nonesub->() if defined $nonesub; + return; + } + } + + if ( !defined $doc->{See} ) { + $nonesub->() if defined $nonesub; + return; + } + + my $see = $doc->{See}; + my $ref = $doc->{SeeRef}; + + if ( $#$see < 1 ) { + $nonesub->() if defined $nonesub; + return; + } + + $startsub->( $node ) if defined $startsub; + + for my $i ( 0..$#$see ) { + my $seelabel = $see->[ $i ]; + my $seenode = undef; + if ( defined $ref ) { + $seenode = $ref->[ $i ]; + } + + $printsub->( $seelabel, $seenode ) if defined $printsub; + } + + $endsub->( $node ) if defined $endsub; + + return; +} + +1; diff --git a/kalyptus/README b/kalyptus/README new file mode 100644 index 0000000..373e400 --- /dev/null +++ b/kalyptus/README @@ -0,0 +1,92 @@ + +KALYPTUS -- C, Objective-C and Java bindings generator + +Version 0.9 + +KALYPTUS creates language bindings for Qt and KDE C++ libraries +directly from the headers. Documentation embedded in special doc +comments in the source is translated to an appropriate format for +the target language. + +REQUIREMENTS + +You need perl 5.005 or greater to run kalyptus. + +HOWTO + +If you are running this straight from CVS, you will need to run + + make -f Makefile.cvs + +before building. + +This should install kalyptus: + +./configure; make; make install + +CREDITS +------- + +Richard Dale - kdoc adaption, C/Objective-C/Java code generation. + +Sirtaj Singh Kang for writing the original kdoc utility (kalyptus was +derived from kdoc). + +Copyright(C) 2001, Lost Highway Ltd + +------ + +Copyright(C) 1999, Sirtaj Singh Kang <taj@kde.org> +Distributed under the GPL. + +NOTES ON USING THE CONVERTER +---------------------------- + +JAVA +---- + +Here are some of the shell commands that were used in the conversion process: + +Remove any Q_OVERRIDE macros from the Qt headers, and remove EXPORT_DOCKCLASS from the +KDE headers + +# Generate Java and C++ sources. Copy all the target headers to directory 'test/tmp' +kalyptus -fjava test/tmp/*.h test/tmp/dom/*.h test/tmp/kio/*.h test/tmp/kdeprint/*.h \ + test/tmp/kjs/*.h test/tmp/kparts/*.h test/tmp/kdesu/*.h test/ktextedit/*.h test/tmp/libkmid/*.h + +# Shorten generated filenames +mv DOM__Node.cpp DOMNode.cpp +mv DOM__Node.java DOMNode.java +mv DOM__Document.cpp DOMDocument.cpp +mv DOM__Document.java DOMDocument.java +for FILE in *__* ; do + NAME=`echo $FILE | sed -e 's/^.*__//'`; + echo $NAME; + mv $FILE $NAME; +done +mv SlaveInterface.cpp Slave.cpp +mv SlaveInterface.java Slave.java + +# Edit and Compile the generated java +cd kdejava/koala/org/kde/koala +make + +# Build C++ JNI .h header files +cd qtjava/javalib/org/kde/qt +for FILE in *.class ; do NAME=`echo $FILE | sed 's/.class//'`; echo $NAME; javah -classpath '../../..' org.kde.qt.$NAME ; done +for FILE in org_kde* ; do NAME=`echo $FILE | sed -e 's/org_kde_qt_//'`; echo $NAME; mv $FILE $NAME; done + +cd kdejava/koala/org/kde/koala +for FILE in *.class ; do NAME=`echo $FILE | sed 's/.class//'`; echo $NAME; javah -classpath '../../..:../../../../../qtjava/javalib/qtjava.jar' org.kde.koala.$NAME ; done +for FILE in org_kde* ; do NAME=`echo $FILE | sed -e 's/org_kde_koala_//'`; echo $NAME; mv $FILE $NAME; done +# Copy headers to kdejava/koala/kdejava + +# Check that the JNI .h function names match the .cpp ones +cd kdejava/koala/org/kde/koala +grep ^Java_ *.cpp | sed -e 's/^[^:]*:\([^(]*\).*/\1/' | grep -v '[/]' | sort | uniq > cpp.fns +grep Java_ *.h | awk '{ print $4 }' | grep -v '[/]' | sort | uniq > h.fns +kompare h.fns cpp.fns +# Reconcile and fix any differences + +# Edit and compile the generated .cpp and .h files with KDevelop + diff --git a/kalyptus/TODO b/kalyptus/TODO new file mode 100644 index 0000000..2f90a44 --- /dev/null +++ b/kalyptus/TODO @@ -0,0 +1,7 @@ +Add more target languages, such as PHP and Pascal + +Use a perl parser generator to define the grammar for + C++ method arguments. + +Write documentation for a how to on bindings generation. + diff --git a/kalyptus/Version b/kalyptus/Version new file mode 100644 index 0000000..0ac647c --- /dev/null +++ b/kalyptus/Version @@ -0,0 +1 @@ +0.91 diff --git a/kalyptus/kalyptus b/kalyptus/kalyptus new file mode 100644 index 0000000..1a7df3d --- /dev/null +++ b/kalyptus/kalyptus @@ -0,0 +1,1645 @@ +#!/usr/bin/perl -I/Users/duke/src/kde/kdebindings/kalyptus + +# KDOC -- C++ and CORBA IDL interface documentation tool. +# Sirtaj Singh Kang <taj@kde.org>, Jan 1999. +# $Id: kalyptus,v 1.9 2003/08/31 15:35:11 germaingarand Exp $ + +# All files in this project are distributed under the GNU General +# Public License. This is Free Software. + +require 5.000; + +use Carp; +use Getopt::Long; +use File::Basename; +use strict; + +use Ast; + +use kdocUtil; +use kdocAstUtil; +use kdocParseDoc; + +use vars qw/ %rootNodes $declNodeType @includes_list %options @formats_wanted $allow_k_dcop_accessors + @includeclasses $includeclasses $skipInternal %defines $defines $match_qt_defines + $libdir $libname $outputdir @libs $parse_global_space $striphpath $doPrivate $readstdin + $Version $quiet $debug $debuggen $parseonly $currentfile $cSourceNode $exe + %formats %flagnames @allowed_k_dcop_accesors $allowed_k_dcop_accesors_re $rootNode + @classStack $cNode $globalSpaceClassName + $lastLine $docNode @includes $cpp $defcppcmd $cppcmd $docincluded + $inExtern %stats %definitions @inputqueue @codeqobject /; + +## globals + +%rootNodes = (); # root nodes for each file type +$declNodeType = undef; # last declaration type + +@includes_list = (); # list of files included from the parsed .h + +# All options + +%options = (); # hash of options (set getopt below) +@formats_wanted = (); +$libdir = $ENV{KDOCLIBS}; +$libname = ""; +$outputdir = "."; +@libs = (); # list of includes +$striphpath = 0; + +@includeclasses = (); # names of classes to include +$includeclasses = ""; + +$doPrivate = 0; +$Version = "0.9"; + +$quiet = 0; +$debug = 0; +$debuggen = 0; +$parseonly = 0; +$globalSpaceClassName = "QGlobalSpace"; + +$currentfile = ""; + +$cpp = 0; +$defcppcmd = "g++ -Wp,-C -E"; +$cppcmd = ""; + +$exe = basename $0; + +@inputqueue = (); +@codeqobject = split "\n", <<CODE; +public: + virtual QMetaObject *metaObject() const; + virtual const char *className() const; + virtual void* qt_cast( const char* ); + virtual bool qt_invoke( int, QUObject* ); + virtual bool qt_emit( int, QUObject* ); + virtual bool qt_property( int, int, QVariant* ); + static QMetaObject* staticMetaObject(); + QObject* qObject(); + static QString tr( const char *, const char * = 0 ); + static QString trUtf8( const char *, const char * = 0 ); +private: +CODE + +# Supported formats +%formats = ( "java" => "kalyptusCxxToJava", "c" => "kalyptusCxxToC", + "objc" => "kalyptusCxxToObjc", "dcopidl" => "kalyptusCxxToDcopIDL", + "smoke" => "kalyptusCxxToSmoke", "csharp" => "kalyptusCxxToCSharp", + "ECMA" => "kalyptusCxxToECMA", "swig" => "kalyptusCxxToSwig" ); + +# these are for expansion of method flags +%flagnames = ( v => 'virtual', 's' => 'static', p => 'pure', + c => 'const', l => 'slot', i => 'inline', n => 'signal', + d => 'k_dcop', z => 'k_dcop_signals', y => 'k_dcop_hidden' ); + +@allowed_k_dcop_accesors = qw(k_dcop k_dcop_hidden k_dcop_signals); +$allowed_k_dcop_accesors_re = join("|", @allowed_k_dcop_accesors); + +%definitions = { + _STYLE_CDE => '', + _STYLE_MOTIF => '', + _STYLE_MOTIF_PLUS => '', + PLUS => '', + _STYLE_PLATINUM => '', + _STYLE_SGI => '', + _STYLE_WINDOWS => '', + QT_STATIC_CONST => 'static const', + Q_EXPORT => '', + Q_REFCOUNT => '', + QM_EXPORT_CANVAS => '', + QM_EXPORT_DNS => '', + QM_EXPORT_ICONVIEW => '', + QM_EXPORT_NETWORK => '', + QM_EXPORT_SQL => '', + QM_EXPORT_WORKSPACE => '', + QT_NO_REMOTE => 'QT_NO_REMOTE', + QT_ACCESSIBILITY_SUPPORT => 'QT_ACCESSIBILITY_SUPPORT', + Q_WS_X11 => 'Q_WS_X11', + Q_DISABLE_COPY => 'Q_DISABLE_COPY', + Q_WS_QWS => 'undef', + Q_WS_MAC => 'undef', + Q_OBJECT => <<'CODE', +public: + virtual QMetaObject *metaObject() const; + virtual const char *className() const; + virtual bool qt_invoke( int, QUObject* ); + virtual bool qt_emit( int, QUObject* ); + static QString tr( const char *, const char * = 0 ); + static QString trUtf8( const char *, const char * = 0 ); +private: +CODE +}; + +=head1 KDOC -- Source documentation tool + + Sirtaj Singh Kang <taj@kde.org>, Dec 1998. + +=cut + +# read options + +Getopt::Long::config qw( no_ignore_case permute bundling auto_abbrev ); + +GetOptions( \%options, + "format|f=s", \@formats_wanted, + "url|u=s", + "skip-internal", \$skipInternal, + "skip-deprecated|e", + "document-all|a", + "compress|z", + "no-cache", # do not create $HOME/.kalyptus cache + # HTML options + "html-cols=i", + "html-logo=s", + + "strip-h-path", \$striphpath, + "outputdir|d=s", \$outputdir, + "stdin|i", \$readstdin, + "name|n=s", \$libname, + "help|h", \&show_usage, + "version|v|V", \&show_version, + "private|p", \$doPrivate, + "libdir|L=s", \$libdir, + "xref|l=s", \@libs, + "classes|c=s", \@includeclasses, + "globspace", \$parse_global_space, + "allow_k_dcop_accessors", \$allow_k_dcop_accessors, + + "cpp|P", \$cpp, + "docincluded", \$docincluded, + "cppcmd|C=s", \$cppcmd, + "includedir|I=s", \@includes, + "define=s", \%defines, # define a single preprocessing symbol + "defines=s", \$defines, # file containing preprocessing symbols, one per line + + "quiet|q", \$quiet, + "debug|D", \$debug, # debug the parsing + "debuggen", \$debuggen, # debug the file generation + "parse-only", \$parseonly ) + || exit 1; + +$| = 1 if $debug or $debuggen; + +# preprocessor settings + +if ( $cppcmd eq "" ) { + $cppcmd = $defcppcmd; +} +else { + $cpp = 1; +} + +if ($#includeclasses>=0) +{ + $includeclasses = join (" ", @includeclasses); + print "Using Classes: $includeclasses\n" unless $quiet; +} + +if ( $#includes >= 0 && !$cpp ) { + die "$exe: --includedir requires --cpp\n"; +} + +# Check output formats. HTML is the default +if( $#formats_wanted < 0 ) { + push @formats_wanted, "java"; +} + +foreach my $format ( @formats_wanted ) { + die "$exe: unsupported format '$format'.\n" + if !defined $formats{$format}; +} + +if( $defines ) +{ + open( DEFS, $defines ) or die "Couldn't open $defines: $!\n"; + my @defs = <DEFS>; + chomp @defs; + close DEFS; + foreach (@defs) + { + $defines{ $_ } = 1 unless exists $defines{ $_ }; + } +} + +# Check the %defines hash for QT_* symbols and compile the corresponding RE +# Otherwise, compile the default ones. Used for filtering in readCxxLine. +if ( my @qt_defines = map { ($_=~m/^QT_(.*)/)[0] } keys %defines) +{ + my $regexp = "m/^#\\s*ifn?def\\s+QT_(?:" . join('|', map { "\$qt_defines[$_]" } 0..$#qt_defines).")/o"; + $match_qt_defines = eval "sub { my \$s=shift; + \$s=~/^#\\s*if(n)?def/ || return 0; + if(!\$1) { return \$s=~$regexp ? 0:1 } + else { return \$s=~$regexp ? 1:0 } + }"; + die if $@; +} +else +{ + $match_qt_defines = eval q£ + sub + { + my $s = shift; + $s =~ m/^\#\s*ifndef\s+QT_NO_(?:REMOTE| # not in the default compile options + NIS| # ... + XINERAMA| + IMAGEIO_(?:MNG|JPEG)| + STYLE_(?:MAC|INTERLACE|COMPACT) + )/x; + } + £; + die if $@; +} +# Check if there any files to process. +# We do it here to prevent the libraries being loaded up first. + +checkFileArgs(); + +# work out libdir. This is created by kdocLib:writeDoc when +# required. +$libdir = $ENV{HOME}."/.kalyptus" unless $libdir ne ""; + + +###### +###### main program +###### + readLibraries(); + parseFiles(); + + if ( $parseonly ) { + print "\n\tParse Tree\n\t------------\n\n"; + kdocAstUtil::dumpAst( $rootNode ); + } + else { + writeDocumentation(); + writeLibrary() unless $libname eq ""; + } + + kdocAstUtil::printDebugStats() if $debug; + + exit 0; +###### + +sub checkFileArgs +{ + return unless $#ARGV < 0; + + die "$exe: no input files.\n" unless $readstdin; + + # read filenames from standard input + while (<STDIN>) { + chop; + $_ =~ s,\\,/,g; # back to fwd slash (for Windows) + foreach my $file ( split( /\s+/, $_ ) ) { + push @ARGV, $file; + } + } +} + +sub readLibraries +{ + return if $#libs < 0; + + require kdocLib; + foreach my $lib ( @libs ) { + print "$exe: reading lib: $lib\n" unless $quiet; + + my $relpath = exists $options{url} ? + $options{url} : $outputdir; + kdocLib::readLibrary( \&getRoot, $lib, $libdir, $relpath ); + } +} + +sub parseFiles +{ + foreach $currentfile ( @ARGV ) { + my $lang = "CXX"; + + if ( $currentfile =~ /\.idl\s*$/ ) { + # IDL file + $lang = "IDL"; + } + + # assume cxx file + if( $cpp ) { + # pass through preprocessor + my $cmd = $cppcmd; + foreach my $dir ( @includes ) { + $cmd .= " -I $dir "; + } + + $cmd .= " -DQOBJECTDEFS_H $currentfile"; + + open( INPUT, "$cmd |" ) + || croak "Can't preprocess $currentfile"; + } + else { + open( INPUT, "$currentfile" ) + || croak "Can't read from $currentfile"; + } + + print STDERR "$exe: processing $currentfile\n" unless $quiet; + + # reset vars + $rootNode = getRoot( $lang ); + + + # add to file lookup table + my $showname = $striphpath ? basename( $currentfile ) + : $currentfile; + $cSourceNode = Ast::New( $showname ); + $cSourceNode->AddProp( "NodeType", "source" ); + $cSourceNode->AddProp( "Path", $currentfile ); + $rootNode->AddPropList( "Sources", $cSourceNode ); + + # reset state + @classStack = (); + $cNode = $rootNode; + $inExtern = 0; + + # parse + my $k = undef; + while ( defined ($k = readDecl()) ) { + print "\nDecl: <$k>[$declNodeType]\n" if $debug; + if( identifyDecl( $k ) && $k =~ /{/ ) { + readCxxCodeBlock(); + } + } + close INPUT; + } +} + + +sub writeDocumentation +{ + foreach my $node ( values %rootNodes ) { + # postprocess + kdocAstUtil::linkNamespaces( $node ); + kdocAstUtil::makeInherit( $node, $node ); + kdocAstUtil::linkReferences( $node, $node ); + kdocAstUtil::calcStats( \%stats, $node, $node ); + + # write + no strict "refs"; + foreach my $format ( @formats_wanted ) { + my $pack = $formats{ $format }; + require $pack.".pm"; + + print STDERR "Generating bindings for $format ", + "language...\n" unless $quiet; + + my $f = "$pack\::writeDoc"; + &$f( $libname, $node, $outputdir, \%options ); + } + } +} + +sub writeLibrary +{ + if( $libname ne "" and !exists $options{'no-cache'} ) { + require kdocLib; + foreach my $lang ( keys %rootNodes ) { + my $node = $rootNodes{ $lang }; + kdocLib::writeDoc( $libname, $node, $lang, $libdir, + $outputdir, $options{url}, + exists $options{compress} ? 1 : 0 ); + } + } +} + +###### Parser routines + +=head2 readSourceLine + + Returns a raw line read from the current input file. + This is used by routines outside main, since I don t know + how to share fds. + +=cut + +sub readSourceLine +{ + return <INPUT>; +} + +=head2 readCxxLine + + Reads a C++ source line, skipping comments, blank lines, + preprocessor tokens and the Q_OBJECT macro + +=cut + +sub readCxxLine +{ + my( $p ); + my( $l ); + + while( 1 ) { + $p = shift @inputqueue || <INPUT>; + return undef if !defined ($p); + + $p =~ s#//.*$##g; # C++ comment + $p =~ s#/\*(?!\*).*?\*/##g; # C comment + + # join all multiline comments + if( $p =~ m#/\*(?!\*)#s ) { + # unterminated comment +LOOP: + while( defined ($l = <INPUT>) ) { + $l =~ s#//.*$##g; # C++ comment + $p .= $l; + $p =~ s#/\*(?!\*).*?\*/##sg; # C comment + last LOOP unless $p =~ m#(/\*(?!\*))|(\*/)#sg; + } + } + + if ( $p =~ /^\s*Q_OBJECT/ ) { + push @inputqueue, @codeqobject; + next; + } + # Hack, waiting for real handling of preprocessor defines + $p =~ s/QT_STATIC_CONST/static const/; + $p =~ s/KSVG_GET/KJS::Value get();/; + $p =~ s/KSVG_BASECLASS_GET/KJS::Value get();/; + $p =~ s/KSVG_BRIDGE/KJS::ObjectImp *bridge();/; + $p =~ s/KSVG_FORWARDGET/KJS::Value getforward();/; + $p =~ s/KSVG_PUT/bool put();/; + $p =~ s/KSVG_FORWARDPUT/bool putforward();/; + $p =~ s/KSVG_BASECLASS/virtual KJS::Value cache();/; + if ( $p =~ m/KSVG_DEFINE_PROTOTYPE\((\w+)\)/ ) { + push @inputqueue, split('\n',"namespace KSVG {\nclass $1 {\n};\n};"); + } + + next if ( $p =~ /^\s*$/s ); # blank lines +# || $p =~ /^\s*Q_OBJECT/ # QObject macro +# ); +# + + next if ( $p =~ /^\s*Q_ENUMS/ # ignore Q_ENUMS + || $p =~ /^\s*Q_PROPERTY/ # and Q_PROPERTY + || $p =~ /^\s*Q_OVERRIDE/ # and Q_OVERRIDE + || $p =~ /^\s*Q_SETS/ + || $p =~ /^\s*Q_DUMMY_COMPARISON_OPERATOR/ + || $p =~ /^\s*K_SYCOCATYPE/ # and K_SYCOCA stuff + || $p =~ /^\s*K_SYCOCAFACTORY/ # + || $p =~ /^\s*KSVG_/ # and KSVG stuff ;) + ); + + push @includes_list, $1 if $p =~ /^#include\s+<?(.*?)>?\s*$/; + + # remove all preprocessor macros + if( $p =~ /^\s*#\s*(\w+)/ ) { + # Handling of preprocessed sources: skip anything included from + # other files, unless --docincluded was passed. + if (!$docincluded && $p =~ /^\s*#\s*[0-9]+\s*\".*$/ + && not($p =~ /\"$currentfile\"/)) { + # include file markers + while( <INPUT> ) { + last if(/\"$currentfile\"/); + print "Overread $_" if $debug; + }; + print "Cont: $_" if $debug; + } + else { + # Skip platform-specific stuff, or #if 0 stuff + # or #else of something we parsed (e.g. for QKeySequence) + if ( $p =~ m/^#\s*ifdef\s*Q_WS_/ or + $p =~ m/^#\s*if\s+defined\(Q_WS_/ or + $p =~ m/^#\s*if\s+defined\(Q_OS_/ or + $p =~ m/^#\s*if\s+defined\(Q_CC_/ or + $p =~ m/^#\s*if\s+defined\(QT_THREAD_SUPPORT/ or + $p =~ m/^#\s*else/ or + $p =~ m/^#\s*if\s+defined\(Q_FULL_TEMPLATE_INSTANTIATION/ or + $p =~ m/^#\s*ifdef\s+CONTAINER_CUSTOM_WIDGETS/ or + &$match_qt_defines( $p ) or + $p =~ m/^#\s*if\s+0\s+/ ) { + my $if_depth = 1; + while ( defined $p && $if_depth > 0 ) { + $p = <INPUT>; + last if !defined $p; + $if_depth++ if $p =~ m/^#\s*if/; + $if_depth-- if $p =~ m/^#\s*endif/; + # Exit at #else in the #ifdef QT_NO_ACCEL/#else/#endif case + last if $if_depth == 1 && $p =~ m/^#\s*else\s/; + #ignore elif for now + print "Skipping ifdef'ed line: $p" if $debug; + } + } + + # multiline macros + while ( defined $p && $p =~ m#\\\s*$# ) { + $p = <INPUT>; + } + } + next; + } + + $lastLine = $p; + return $p; + } +} + +=head2 readCxxCodeBlock + + Reads a C++ code block (recursive curlies), returning the last line + or undef on error. + + Parameters: none + +=cut + +sub readCxxCodeBlock +{ +# Code: begins in a {, ends in }\s*;? +# In between: cxx source, including {} + my ( $count ) = 0; + my $l = undef; + + if ( defined $lastLine ) { + print "lastLine: '$lastLine'" if $debug; + + my $open = kdocUtil::countReg( $lastLine, "{" ); + my $close = kdocUtil::countReg( $lastLine, "}" ); + $count = $open - $close; + + return $lastLine if ( $open || $close) && $count == 0; + } + + # find opening brace + if ( $count == 0 ) { + while( $count == 0 ) { + $l = readCxxLine(); + return undef if !defined $l; + $l =~ s/\\.//g; + $l =~ s/'.?'//g; + $l =~ s/".*?"//g; + + $count += kdocUtil::countReg( $l, "{" ); + print "c ", $count, " at '$l'" if $debug; + } + $count -= kdocUtil::countReg( $l, "}" ); + } + + # find associated closing brace + while ( $count > 0 ) { + $l = readCxxLine(); + croak "Confused by unmatched braces" if !defined $l; + $l =~ s/\\.//g; + $l =~ s/'.?'//g; + $l =~ s/".*?"//g; + + my $add = kdocUtil::countReg( $l, "{" ); + my $sub = kdocUtil::countReg( $l, "}" ); + $count += $add - $sub; + + print "o ", $add, " c ", $sub, " at '$l'" if $debug; + } + + undef $lastLine; + return $l; +} + +=head2 readDecl + + Returns a declaration and sets the $declNodeType variable. + + A decl starts with a type or keyword and ends with [{};] + The entire decl is returned in a single line, sans newlines. + + declNodeType values: undef for error, "a" for access specifier, + "c" for doc comment, "d" for other decls. + + readCxxLine is used to read the declaration. + +=cut + +sub readDecl +{ + undef $declNodeType; + my $l = readCxxLine(); + my ( $decl ) = ""; + + my $allowed_accesors = "private|public|protected|signals"; + $allowed_accesors .= "|$allowed_k_dcop_accesors_re" if $allow_k_dcop_accessors; + + if( !defined $l ) { + return undef; + } + elsif ( $l =~ /^\s*($allowed_accesors) + (\s+\w+)?\s*:/x) { # access specifier + $declNodeType = "a"; + return $l; + } + elsif ( $l =~ /K_DCOP/ ) { + $declNodeType = "k"; + return $l; + } + elsif ( $l =~ m#^\s*/\*\*# ) { # doc comment + $declNodeType = "c"; + return $l; + } + + do { + $decl .= $l; + + if ( $l =~ /[{};]/ ) { + $decl =~ s/\n/ /gs; + $declNodeType = "d"; + return $decl; + } + return undef if !defined ($l = readCxxLine()); + + } while ( 1 ); +} + +#### AST Generator Routines + +=head2 getRoot + + Return a root node for the given type of input file. + +=cut + +sub getRoot +{ + my $type = shift; + carp "getRoot called without type" unless defined $type; + + if ( !exists $rootNodes{ $type } ) { + my $node = Ast::New( "Global" ); # parent of all nodes + $node->AddProp( "NodeType", "root" ); + $node->AddProp( "RootType", $type ); + $node->AddProp( "Compound", 1 ); + $node->AddProp( "KidAccess", "public" ); + + $rootNodes{ $type } = $node; + } + print "getRoot: call for $type\n" if $debug; + + return $rootNodes{ $type }; +} + +=head2 identifyDecl + + Parameters: decl + + Identifies a declaration returned by readDecl. If a code block + needs to be skipped, this subroutine returns a 1, or 0 otherwise. + +=cut + +sub identifyDecl +{ + my( $decl ) = @_; + + my $newNode = undef; + my $skipBlock = 0; + + # Doc comment + if ( $declNodeType eq "c" ) { + $docNode = kdocParseDoc::newDocComment( $decl ); + + # if it's the main doc, it is attached to the root node + if ( defined $docNode->{LibDoc} ) { + kdocParseDoc::attachDoc( $rootNode, $docNode, + $rootNode ); + undef $docNode; + } + + } + elsif ( $declNodeType eq "a" ) { + newAccess( $decl ); + } + elsif ( $declNodeType eq "k" ) { + $cNode->AddProp( "DcopExported", 1 ); + } + + # Typedef struct/class + elsif ( $decl =~ /^\s*typedef + \s+(struct|union|class|enum) + \s*([_\w\:]*) + \s*([;{]) + /xs ) { + my ($type, $name, $endtag, $rest ) = ($1, $2, $3, $' ); + $name = "--" if $name eq ""; + + warn "typedef '$type' n:'$name'\n" if $debug; + + if ( $rest =~ /}\s*([\w_]+(?:::[\w_])*)\s*;/ ) { + # TODO: Doesn't parse members yet! + $endtag = ";"; + $name = $1; + } + + $newNode = newTypedefComp( $type, $name, $endtag ); + } + + # Typedef + elsif ( $decl =~ /^\s*typedef\s+ + (?:typename\s+)? # `typename' keyword + (.*?\s*[\*&]?) # type + \s+([-\w_\:]+) # name + \s*((?:\[[-\w_\:<>\s]*\])*) # array + \s*[{;]\s*$/xs ) { + + print "Typedef: <$1 $3> <$2>\n" if $debug; + $newNode = newTypedef( $1." ".$3, $2 ); + } + + # Enum + elsif ( $decl =~ /^\s*enum\s+([-\w_:]*)?\s*\{(.*)/s ) { + + print "Enum: <$1>\n" if $debug; + my $enumname = defined $2 ? $1 : ""; + + $newNode = newEnum( $enumname ); + } + + # Class/Struct + elsif ( $decl =~ /^\s*((?:template\s*<.*>)?) # 1 template + \s*(class|struct|union|namespace) # 2 struct type + (?:\s*Q[A-Z_]*EXPORT[A-Z_]*)? + (?:\s*Q_PACKED)? + (?:\s*Q_REFCOUNT)? + \s+([\w_]+ # 3 name + (?:<[\w_ :,]+?>)? # maybe explicit template + # (eat chars between <> non-hungry) + (?:::[\w_]+)* # maybe nested + ) + (.*?) # 4 inheritance + ([;{])/xs ) { # 5 rest + + print "Class: [$1]\n\t[$2]\n\t[$3]\n\t[$4]\n\t[$5]\n" if $debug; + my ( $tmpl, $ntype, $name, $rest, $endtag ) = + ( $1, $2, $3, $4, $5 ); + + if ($includeclasses) + { + if (! ($includeclasses =~ /$name/) ) + { + return 1; + + } + } + + my @inherits = (); + + $tmpl =~ s/<(.*)>/$1/ if $tmpl ne ""; + + if( $rest =~ /^\s*:\s*/ ) { + # inheritance + $rest = $'; + @inherits = parseInheritance( $rest ); + } + + $newNode = newClass( $tmpl, $ntype, + $name, $endtag, @inherits ); + } + # IDL compound node + elsif( $decl =~ /^\s*(module|interface|exception) # struct type + \s+([-\w_]+) # name + (.*?) # inheritance? + ([;{])/xs ) { + + my ( $type, $name, $rest, $fwd, $complete ) + = ( $1, $2, $3, $4 eq ";" ? 1 : 0, + 0 ); + my @in = (); + print "IDL: [$type] [$name] [$rest] [$fwd]\n" if $debug; + + if( $rest =~ /^\s*:\s*/ ) { + $rest = $'; + $rest =~ s/\s+//g; + @in = split ",", $rest; + } + if( $decl =~ /}\s*;/ ) { + $complete = 1; + } + + $newNode = newIDLstruct( $type, $name, $fwd, $complete, @in ); + } + # Method + elsif ( $decl =~ /^\s*([^=]+?(?:operator\s*(?:\(\)|.?=)\s*)?) # ret+nm + \( (.*?) \) # parameters + \s*((?:const)?)\s* + \s*((?:=\s*0(?:L?))?)\s* # Pureness. is "0L" allowed? + \s*[;{]+/xs ) { # rest + + my $tpn = $1; # type + name + my $params = $2; + # Remove constructor initializer, that's not in the params + if ( $params =~ /\s*\)\s*:\s*/ ) { + # Hack: first .* made non-greedy for QSizePolicy using a?(b):c in ctor init + $params =~ s/(.*?)\s*\)\s*:\s*.*$/$1/; + } + + my $const = $3 eq "" ? 0 : 1; + my $pure = $4 eq "" ? 0 : 1; + $tpn =~ s/\s+/ /g; + $params =~ s/\s+/ /g; + + print "Method: R+N:[$tpn]\n\tP:[$params]\n\t[$const]\n" if $debug; + + if ( $tpn =~ /((?:\w+\s*::\s*)?operator.*?)\s*$/ # operator + || $tpn =~ /((?:\w*\s*::\s*~?)?[-\w:]+)\s*$/ ) { # normal + my $name = $1; + $tpn = $`; + $newNode = newMethod( $tpn, $name, + $params, $const, $pure ); + } + + $skipBlock = 1; # FIXME check end token before doing this! + } + # Using: import namespace + elsif ( $decl =~ /^\s*using\s+namespace\s+(\w+)/ ) { + newNamespace( $1 ); + + } + + # extern block + elsif ( $decl =~ /^\s*extern\s*"(.*)"\s*{/ ) { + $inExtern = 1 unless $decl =~ /}/; + } + + # Single variable + elsif ( $decl =~ /^ + \s*( (?:[\w_:]+(?:\s+[\w_:]+)*? )# type + \s*(?:<.+>)? # template + \s*(?:[\&\*])? # ptr or ref + (?:\s*(?:const|volatile))* ) + \s*([\w_:]+) # name + \s*( (?:\[[^\[\]]*\] (?:\s*\[[^\[\]]*\])*)? ) # array + \s*((?:=.*)?) # value + \s*([;{])\s*$/xs ) { + my $type = $1; + my $name = $2; + my $arr = $3; + my $val = $4; + my $end = $5; + + if ( $type !~ /^friend\s+class\s*/ ) { + print "Var: [$name] type: [$type$arr] val: [$val]\n" + if $debug; + + $newNode = newVar( $type.$arr, $name, $val ); + } + + $skipBlock = 1 if $end eq '{'; + } + + # Multi variables + elsif ( $decl =~ m/^ + \s*( (?:[\w_:]+(?:\s+[\w_:]+)*? ) # type + \s*(?:<.+>)?) # template + + \s*( (?:\s*(?: [\&\*][\&\*\s]*)? # ptr or ref + [\w_:]+) # name + \s*(?:\[[^\[\]]*\] (?:\s*\[[^\[\]]*\])*)? # array + \s*(?:, # extra vars + \s*(?: [\&\*][\&\*\s]*)? # ptr or ref + \s*(?:[\w_:]+) # name + \s*(?:\[[^\[\]]*\] (?:\s*\[[^\[\]]*\])*)? # array + )* + \s*(?:=.*)?) # value + \s*[;]/xs ) { + + my $type = $1; + my $names = $2; + my $end = $3; + my $doc = $docNode; + + print "Multivar: type: [$type] names: [$names] \n" if $debug; + + foreach my $vardecl ( split( /\s*,\s*/, $names ) ) { + next unless $vardecl =~ m/ + \s*((?: [\&\*][\&\*\s]*)?) # ptr or ref + \s*([\w_:]+) # name + \s*( (?:\[[^\[\]]*\] (?:\s*\[[^\[\]]*\])*)? ) # array + \s*((?:=.*)?) # value + /xs; + my ($ptr, $name, $arr, $val) = ($1, $2, $3, $4); + + print "Split: type: [$type$ptr$arr] ", + " name: [$name] val: [$val] \n" if $debug; + + my $node = newVar( $type.$ptr.$arr, $name, $val ); + + $docNode = $doc; # reuse docNode for each + postInitNode( $node ) unless !defined $node; + } + + $skipBlock = 1 if $end eq '{'; + } + # end of an "extern" block + elsif ( $decl =~ /^\s*}\s*$/ ) { + $inExtern = 0; + } + # end of an in-block declaration + elsif ( $decl =~ /^\s*}\s*(.*?)\s*;\s*$/ ) { + + if ( $cNode->{astNodeName} eq "--" ) { + # structure typedefs should have no name preassigned. + # If they do, then the name in + # "typedef struct <name> { ..." is kept instead. + # TODO: Buglet. You should fix YOUR code dammit. ;) + + + $cNode->{astNodeName} = $1; + my $siblings = $cNode->{Parent}->{KidHash}; + undef $siblings->{"--"}; + $siblings->{ $1 } = $cNode; + } + + if ( $#classStack < 0 ) { + confess "close decl found, but no class in stack!" ; + $cNode = $rootNode; + } + else { + $cNode = pop @classStack; + print "end decl: popped $cNode->{astNodeName}\n" + if $debug; + } + } + # unidentified block start + elsif ( $decl =~ /{/ ) { + print "Unidentified block start: $decl\n" if $debug; + $skipBlock = 1; + } + # explicit template instantiation, or friend template + elsif ( $decl =~ /(template|friend)\s+class\s+(?:Q[A-Z_]*EXPORT[A-Z_]*\s*)?\w+\s*<.*>\s*;/x ) { + # Nothing to be done with those. + } + else { + + ## decl is unidentified. + warn "Unidentified decl: $decl\n"; + } + + # once we get here, the last doc node is already used. + # postInitNode should NOT be called for forward decls + postInitNode( $newNode ) unless !defined $newNode; + + return $skipBlock; +} + +sub postInitNode +{ + my $newNode = shift; + + carp "Cannot postinit undef node." if !defined $newNode; + + # The reasoning here: + # Forward decls never get a source node. + # Once a source node is defined, don't assign another one. + + if ( $newNode->{NodeType} ne "Forward" && !defined $newNode->{Source}) { + $newNode->AddProp( "Source", $cSourceNode ); + } elsif ( $newNode->{NodeType} eq "Forward" ) { + if ($debug) { + print "postInit: skipping fwd: $newNode->{astNodeName}\n"; + } + undef $docNode; + return; + } + + if( defined $docNode ) { + kdocParseDoc::attachDoc( $newNode, $docNode, $rootNode ); + undef $docNode; + } +} + + +##### Node generators + +=head2 newEnum + + Reads the parameters of an enumeration. + + Returns the parameters, or undef on error. + +=cut + +sub newEnum +{ + my ( $enum ) = @_; + my $k = undef; + my $params = ""; + + $k = $lastLine if defined $lastLine; + + if( defined $lastLine && $lastLine =~ /{/ ) { + $params = $'; + if ( $lastLine =~ /}(.*?);/ ) { + return initEnum( $enum, $1, $params ); + } + } + + while ( defined ( $k = readCxxLine() ) ) { + $params .= $k; + + if ( $k =~ /}(.*?);/ ) { + return initEnum( $enum, $1, $params ); + } + } + + return undef; +} + +=head2 initEnum + + Parameters: name, (ref) params + + Returns an initialized enum node. + +=cut + +sub initEnum +{ + my( $name, $end, $params ) = @_; + + ($name = $end) if $name eq "" && $end ne ""; + + $params =~ s#\s+# #sg; # no newlines + $params = $1 if $params =~ /^\s*{?(.*)}/; + print "$name params: [$params]\n" if $debug; + + + my ( $node ) = Ast::New( $name ); + $node->AddProp( "NodeType", "enum" ); + $node->AddProp( "Params", $params ); + makeParamList( $node, $params, 1 ); # Adds the ParamList property containing the list of param nodes + kdocAstUtil::attachChild( $cNode, $node ); + + return $node; +} + +=head2 newIDLstruct + + Parameters: type, name, forward, complete, inherits... + + Handles an IDL structure definition (ie module, interface, + exception). + +=cut + +sub newIDLstruct +{ + my ( $type, $name, $fwd, $complete ) = @_; + + my $node = exists $cNode->{KidHash} ? + $cNode->{KidHash}->{ $name } : undef; + + if( !defined $node ) { + $node = Ast::New( $name ); + $node->AddProp( "NodeType", $fwd ? "Forward" : $type ); + $node->AddProp( "KidAccess", "public" ); + $node->AddProp( "Compound", 1 ) unless $fwd; + kdocAstUtil::attachChild( $cNode, $node ); + } + elsif ( $fwd ) { + # If we have a node already, we ignore forwards. + return undef; + } + elsif ( $node->{NodeType} eq "Forward" ) { + # we are defining a previously forward node. + $node->AddProp( "NodeType", $type ); + $node->AddProp( "Compound", 1 ); + $node->AddProp( "Source", $cSourceNode ); + } + + # register ancestors. + foreach my $ances ( splice ( @_, 4 ) ) { + my $n = kdocAstUtil::newInherit( $node, $ances ); + } + + if( !( $fwd || $complete) ) { + print "newIDL: pushing $cNode->{astNodeName},", + " new is $node->{astNodeName}\n" + if $debug; + push @classStack, $cNode; + $cNode = $node; + } + + return $node; +} + +=head2 newClass + + Parameters: tmplArgs, cNodeType, name, endTag, @inheritlist + + Handles a class declaration (also fwd decls). + +=cut + +sub newClass +{ + my( $tmplArgs, $cNodeType, $name, $endTag ) = @_; + + my $access = "private"; + $access = "public" if $cNodeType ne "class"; + + # try to find an exisiting node, or create a new one + my $oldnode = kdocAstUtil::findRef( $cNode, $name ); + my $node = defined $oldnode ? $oldnode : Ast::New( $name ); + + if ( $endTag ne "{" ) { + # forward + if ( !defined $oldnode ) { + # new forward node + $node->AddProp( "NodeType", "Forward" ); + $node->AddProp( "KidAccess", $access ); + kdocAstUtil::attachChild( $cNode, $node ); + } + return $node; + } + + # this is a class declaration + + print "ClassName: $name\n" if $debug; + + $node->AddProp( "NodeType", $cNodeType ); + $node->AddProp( "Compound", 1 ); + $node->AddProp( "Source", $cSourceNode ); + + $node->AddProp( "KidAccess", $access ); + $node->AddProp( "Tmpl", $tmplArgs ) unless $tmplArgs eq ""; + + if ( !defined $oldnode ) { + kdocAstUtil::attachChild( $cNode, $node ); + } + + # inheritance + + foreach my $ances ( splice (@_, 4) ) { + my $type = ""; + my $name = $ances; + my $intmpl = undef; + +WORD: + foreach my $word ( split ( /([\w:]+(:?\s*<.*>)?)/, $ances ) ) { + next WORD unless $word =~ /^[\w:]/; + if ( $word =~ /(private|public|protected|virtual)/ ) { + $type .= "$1 "; + } + else { + + if ( $word =~ /<(.*)>/ ) { + # FIXME: Handle multiple tmpl args + $name = $`; + $intmpl = $1; + } + else { + $name = $word; + } + + last WORD; + } + } + + # set inheritance access specifier if none specified + if ( $type eq "" ) { + $type = $cNodeType eq "class" ? "private ":"public "; + } + chop $type; + + # attach inheritance information + my $n = kdocAstUtil::newInherit( $node, $name ); + $n->AddProp( "Type", $type ); + + $n->AddProp( "TmplType", $intmpl ) if defined $intmpl; + + print "In: $name type: $type, tmpl: $intmpl\n" if $debug; + } + + # new current node + print "newClass: Pushing $cNode->{astNodeName}\n" if $debug; + push ( @classStack, $cNode ); + $cNode = $node; + + return $node; +} + + +=head3 parseInheritance + + Param: inheritance decl string + Returns: list of superclasses (template decls included) + + This will fail if < and > appear in strings in the decl. + +=cut + +sub parseInheritance +{ + my $instring = shift; + my @inherits = (); + + my $accum = ""; + foreach $instring ( split (/\s*,\s*/, $instring) ) { + $accum .= $instring.", "; + next unless (kdocUtil::countReg( $accum, "<" ) + - kdocUtil::countReg( $accum, ">" ) ) == 0; + + # matching no. of < and >, so assume the parent is + # complete + $accum =~ s/,\s*$//; + print "Inherits: '$accum'\n" if $debug; + push @inherits, $accum; + $accum = ""; + } + + return @inherits; +} + + +=head2 newNamespace + + Param: namespace name. + Returns nothing. + + Imports a namespace into the current node, for ref searches etc. + Triggered by "using namespace ..." + +=cut + +sub newNamespace +{ + $cNode->AddPropList( "ImpNames", shift ); +} + + + +=head2 newTypedef + + Parameters: realtype, name + + Handles a type definition. + +=cut + +sub newTypedef +{ + my ( $realtype, $name ) = @_; + + my ( $node ) = Ast::New( $name ); + + $node->AddProp( "NodeType", "typedef" ); + $node->AddProp( "Type", $realtype ); + + kdocAstUtil::attachChild( $cNode, $node ); + + return $node; +} + +=head2 newTypedefComp + + Params: realtype, name endtoken + + Creates a new compound type definition. + +=cut + +sub newTypedefComp +{ + my ( $realtype, $name, $endtag ) = @_; + + my ( $node ) = Ast::New( $name ); + + $node->AddProp( "NodeType", "typedef" ); + $node->AddProp( "Type", $realtype ); + + kdocAstUtil::attachChild( $cNode, $node ); + + if ( $endtag eq '{' ) { + print "newTypedefComp: Pushing $cNode->{astNodeName}\n" + if $debug; + push ( @classStack, $cNode ); + $cNode = $node; + } + + return $node; +} + + +=head2 newMethod + + Parameters: retType, name, params, const, pure? + + Handles a new method declaration or definition. + +=cut +BEGIN { + +my $theSourceNode = $cSourceNode; + +sub newMethod +{ + my ( $retType, $name, $params, $const, $pure ) = @_; + my $parent = $cNode; + my $class; + + print "Cracked: [$retType] [$name]\n\t[$params]\n\t[$const]\n" + if $debug; + + if ( $retType =~ /([\w\s_<>,]+)\s*::\s*$/ ) { + # check if stuff before :: got into rettype by mistake. + $retType = $`; + ($name = $1."::".$name); + $name =~ s/\s+/ /g; + print "New name = \"$name\" and type = '$retType'\n" if $debug; + } + + # A 'friend method' declaration isn't a real method declaration + return undef if ( $retType =~ /^friend\s+/ || $retType =~ /^friend\s+class\s+/ ); + + my $isGlobalSpace = 0; + + if( $name =~ /^\s*(.*?)\s*::\s*(.*?)\s*$/ ) { + # Fully qualified method name. + $name = $2; + $class = $1; + + if( $class =~ /^\s*$/ ) { + $parent = $rootNode; + } + elsif ( $class eq $cNode->{astNodeName} ) { + $parent = $cNode; + } + else { + # ALWAYS IGNORE... + return undef; + + my $node = kdocAstUtil::findRef( $cNode, $class ); + + if ( !defined $node ) { + # if we couldn't find the name, try again with + # all template parameters stripped off: + my $strippedClass = $class; + $strippedClass =~ s/<[^<>]*>//g; + + $node = kdocAstUtil::findRef( $cNode, $strippedClass ); + + # if still not found: give up + if ( !defined $node ) { + warn "$exe: Unidentified class: $class ". + "in $currentfile\:$.\n"; + return undef; + } + } + + $parent = $node; + } + } + # TODO fix for $retType =~ /template<.*?>/ + elsif( $parse_global_space && $parent->{NodeType} eq "root" && $name !~ /\s*qt_/ && $retType !~ /template\s*<.*?>/ ) { + $class = $globalSpaceClassName; # FIXME - sanitize the naming system? + $isGlobalSpace = 1; + + my $opsNode = kdocAstUtil::findRef( $cNode, $class ); + if (!$opsNode) { + # manually create a "GlobalSpace" class + $opsNode = Ast::New( $class ); + $opsNode->AddProp( "NodeType", "class" ); + $opsNode->AddProp( "Compound", 1 ); + $opsNode->AddProp( "Source", $cSourceNode ); # dummy + $opsNode->AddProp( "KidAccess", "public" ); + kdocAstUtil::attachChild( $cNode, $opsNode ); + } + unless( $theSourceNode == $cSourceNode ) { + $theSourceNode = $cSourceNode; + $opsNode->AddPropList( "Sources", $theSourceNode ); # sources are scattered across Qt + } + $parent = $opsNode; + } + + # flags + + my $flags = ""; + + if( $retType =~ /static/ || $isGlobalSpace ) { + $flags .= "s"; + $retType =~ s/static//g; + } + + if( $const && !$isGlobalSpace ) { + $flags .= "c"; + } + + if( $pure ) { + $flags .= "p"; + } + + if( $retType =~ /virtual/ ) { + $flags .= "v"; + $retType =~ s/virtual//g; + } + + print "\n" if $flags ne "" && $debug; + + if ( !defined $parent->{KidAccess} ) { + warn "'", $parent->{astNodeName}, "' has no KidAccess ", + exists $parent->{Forward} ? "(forward)\n" :"\n"; + } + + # NB, these are =~, so make sure they are listed in correct order + if ( $parent->{KidAccess} =~ /slot/ ) { + $flags .= "l"; + } + elsif ( $parent->{KidAccess} =~ /k_dcop_signals/ ) { + $flags .= "z"; + } + elsif ( $parent->{KidAccess} =~ /k_dcop_hidden/ ) { + $flags .= "y"; + } + elsif ( $parent->{KidAccess} =~ /k_dcop/ ) { + $flags .= "d"; + } + elsif ( $parent->{KidAccess} =~ /signal/ ) { + $flags .= "n"; + } + + $retType =~ s/QM?_EXPORT[_A-Z]*\s*//; + $retType =~ s/inline\s+//; + $retType =~ s/extern\s+//; + $retType =~ s/^\s*//g; + $retType =~ s/\s*$//g; + + # node + + my $node = Ast::New( $name ); + $node->AddProp( "NodeType", "method" ); + $node->AddProp( "Flags", $flags ); + $node->AddProp( "ReturnType", $retType ); + $node->AddProp( "Params", $params ); # The raw string with the whole param list + makeParamList( $node, $params, 0 ); # Adds the ParamList property containing the list of param nodes + + $parent->AddProp( "Pure", 1 ) if $pure; + + kdocAstUtil::attachChild( $parent, $node ); + return $node; +} + +} + +=head2 makeParamList + + Parameters: + * method (or enum) node + * string containing the whole param list + * 1 for enums + + Adds a property "ParamList" to the method node. + This property contains a list of nodes, one for each parameter. + + Each parameter node has the following properties: + * ArgType the type of the argument, e.g. const QString& + * ArgName the name of the argument - optionnal + * DefaultValue the default value of the argument - optionnal + + For enum values, ArgType is unset, ArgName is the name, DefaultValue its value. + + Author: David Faure <david@mandrakesoft.com> +=cut + +sub makeParamList($$$) +{ + my ( $methodNode, $params, $isEnum ) = @_; + $params =~ s/\s+/ /g; # normalize multiple spaces/tabs into a single one + $params =~ s/\s*([,\*\&])\s*/$1 /g; # normalize spaces before and after *, & and ',' + $params =~ s/^\s*void\s*$//; # foo(void) ==> foo() + $params =~ s/^\s*$//; + # Make sure the property always exists, makes iteration over it easier + $methodNode->AddProp( "ParamList", [] ); + + my @args = kdocUtil::splitUnnested( ',', $params); + + my $argId = 0; + foreach my $arg ( @args ) { + my $argType; + my $argName; + my $defaultparam; + $arg =~ s/\s*([^\s].*[^\s])\s*/$1/; # stripWhiteSpace + $arg =~ s/(\w+)\[\]/\* $1/; # Turn [] array into * + + # The RE below reads as: = ( string constant or char + # or some word/number, with optional bitwise shifts, OR'ed or +'ed flags, and/or function call ). + if ( $arg =~ s/\s*=\s*(("[^\"]*")|(\'.\')|(([-\w:~]*)\s*([<>\|\+-]*\s*\w*\s*)*(\([^(]*\))?))// ) { + $defaultparam = $1; + } + + # Separate arg type from arg name, if the latter is specified + if ( $arg =~ /(.*)\s+([\w_]+)\s*$/ || $arg =~ /(.*)\(\s*\*\s([\w_]+)\)\s*\((.*)\)\s*$/ ) { + if ( defined $3 ) { # function pointer + $argType = $1."(*)($3)"; + $argName = $2; + } else { + $argType = $1; + $argName = $2; + } + } else { # unnamed arg - or enum value + $argType = $arg if (!$isEnum); + $argName = $arg if ($isEnum); + } + $argId++; + + my $node = Ast::New( $argId ); # let's make the arg index the node "name" + $node->AddProp( "NodeType", "param" ); + $node->AddProp( "ArgType", $argType ); + $node->AddProp( "ArgName", $argName ) if (defined $argName); + $node->AddProp( "DefaultValue", $defaultparam ) if (defined $defaultparam); + $methodNode->AddPropList( "ParamList", $node ); + print STDERR "ArgType: $argType ArgName: $argName\n" if ($debug); + } +} + +=head2 newAccess + + Parameters: access + + Sets the default "Access" specifier for the current class node. If + the access is a "slot" type, "_slots" is appended to the access + string. + +=cut + +sub newAccess +{ + my ( $access ) = @_; + + return undef unless ($access =~ /^\s*(\w+)\s*(slots|$allowed_k_dcop_accesors_re)?/); + + print "Access: [$1] [$2]\n" if $debug; + + $access = $1; + + if ( defined $2 && $2 ne "" ) { + $access .= "_" . $2; + } + + $cNode->AddProp( "KidAccess", $access ); + + return $cNode; +} + + +=head2 newVar + + Parameters: type, name, value + + New variable. Value is ignored if undef + +=cut + +sub newVar +{ + my ( $type, $name, $val ) = @_; + + my $node = Ast::New( $name ); + $node->AddProp( "NodeType", "var" ); + + my $static = 0; + if ( $type =~ /static/ ) { + # $type =~ s/static//; + $static = 1; + } + + $node->AddProp( "Type", $type ); + $node->AddProp( "Flags", 's' ) if $static; + $node->AddProp( "Value", $val ) if defined $val; + kdocAstUtil::attachChild( $cNode, $node ); + + return $node; +} + + + +=head2 show_usage + + Display usage information and quit. + +=cut + +sub show_usage +{ +print<<EOF; +usage: + $exe [options] [-f format] [-d outdir] [-n name] files... [-llib..] + +See the man page kdoc[1] for more info. +EOF + exit 1; +} + + +=head2 show_version + + Display short version information and quit. + +=cut + +sub show_version +{ + die "$exe: $Version (c) Sirtaj S. Kang <taj\@kde.org>\n"; +} + + diff --git a/kalyptus/kalyptusCxxToSmoke.pm b/kalyptus/kalyptusCxxToSmoke.pm new file mode 100644 index 0000000..8549d39 --- /dev/null +++ b/kalyptus/kalyptusCxxToSmoke.pm @@ -0,0 +1,2221 @@ +#*************************************************************************** +# kalyptusCxxToSmoke.pm - Generates x_*.cpp files for smoke +# ------------------- +# begin : Fri Jan 25 12:00:00 2000 +# copyright : (C) 2002 Lost Highway Ltd. All Rights Reserved. +# email : david@mandrakesoft.com +# author : David Faure. +#***************************************************************************/ + +#/*************************************************************************** +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation; either version 2 of the License, or * +# * (at your option) any later version. * +# * * +#***************************************************************************/ + +package kalyptusCxxToSmoke; + +use File::Path; +use File::Basename; +use constant numSourceFiles => 20; # Total number of generated source files. + # All classes will be distributed across those. + +use Carp; +use Ast; +use kdocAstUtil; +use kdocUtil; +use Iter; +use kalyptusDataDict; + +use strict; +no strict "subs"; + +use vars qw/ + $libname $rootnode $outputdir $opt $debug + $methodNumber + %builtins %typeunion %allMethods %allTypes %enumValueToType %typedeflist %mungedTypeMap + %skippedClasses /; + +BEGIN +{ + +# Types supported by the StackItem union +# Key: C++ type Value: Union field of that type +%typeunion = ( + 'void*' => 's_voidp', + 'bool' => 's_bool', + 'char' => 's_char', + 'uchar' => 's_uchar', + 'short' => 's_short', + 'ushort' => 's_ushort', + 'int' => 's_int', + 'uint' => 's_uint', + 'long' => 's_long', + 'ulong' => 's_ulong', + 'float' => 's_float', + 'double' => 's_double', + 'enum' => 's_enum', + 'class' => 's_class' +); + +# Mapping for iterproto, when making up the munged method names +%mungedTypeMap = ( + 'QString' => '$', + 'QString*' => '$', + 'QString&' => '$', + 'QCString' => '$', + 'QCString*' => '$', + 'QCString&' => '$', + 'QByteArray' => '$', + 'QByteArray&' => '$', + 'QByteArray*' => '$', + 'char*' => '$', + 'QCOORD*' => '?', + 'QRgb*' => '?', +); + +# Yes some of this is in kalyptusDataDict's ctypemap +# but that one would need to be separated (builtins vs normal classes) +%typedeflist = +( + 'signed char' => 'char', + 'unsigned char' => 'uchar', + 'signed short' => 'short', + 'unsigned short' => 'ushort', + 'signed' => 'int', + 'signed int' => 'int', + 'unsigned' => 'uint', + 'unsigned int' => 'uint', + 'signed long' => 'long', + 'unsigned long' => 'ulong', + +# Anything that is not known is mapped to void*, so no need for those here anymore +# 'QWSEvent*' => 'void*', +# 'QDiskFont*' => 'void*', +# 'XEvent*' => 'void*', +# 'QStyleHintReturn*' => 'void*', +# 'FILE*' => 'void*', +# 'QUnknownInterface*' => 'void*', +# 'GDHandle' => 'void*', +# '_NPStream*' => 'void*', +# 'QTextFormat*' => 'void*', +# 'QTextDocument*' => 'void*', +# 'QTextCursor*' => 'void*', +# 'QTextParag**' => 'void*', +# 'QTextParag*' => 'void*', +# 'QRemoteInterface*' => 'void*', +# 'QSqlRecordPrivate*' => 'void*', +# 'QTSMFI' => 'void*', # QTextStream's QTSManip +# 'const GUID&' => 'void*', +# 'QWidgetMapper*' => 'void*', +# 'MSG*' => 'void*', +# 'const QSqlFieldInfoList&' => 'void*', # QSqlRecordInfo - TODO (templates) + + 'QPtrCollection::Item' => 'void*', # to avoid a warning + + 'mode_t' => 'long', + 'QProcess::PID' => 'long', + 'size_type' => 'int', # QSqlRecordInfo + 'Qt::ComparisonFlags' => 'uint', + 'Qt::ToolBarDock' => 'int', # compat thing, Qt shouldn't use it + 'QIODevice::Offset' => 'ulong', + 'WState' => 'int', + 'WId' => 'ulong', + 'QRgb' => 'uint', + 'QCOORD' => 'int', + 'QTSMFI' => 'int', + 'Qt::WState' => 'int', + 'Qt::WFlags' => 'int', + 'Qt::HANDLE' => 'uint', + 'QEventLoop::ProcessEventsFlags' => 'uint', + 'QStyle::SCFlags' => 'int', + 'QStyle::SFlags' => 'int', + 'Q_INT16' => 'short', + 'Q_INT32' => 'int', + 'Q_INT8' => 'char', + 'Q_LONG' => 'long', + 'Q_UINT16' => 'ushort', + 'Q_UINT32' => 'uint', + 'Q_UINT8' => 'uchar', + 'Q_ULONG' => 'long', +); + +} + +sub writeDoc +{ + ( $libname, $rootnode, $outputdir, $opt ) = @_; + + print STDERR "Starting writeDoc for $libname...\n"; + + $debug = $main::debuggen; + + mkpath( $outputdir ) unless -f $outputdir; + + # Define QPtrCollection::Item, for resolveType + unless ( kdocAstUtil::findRef( $rootnode, "QPtrCollection::Item" ) ) { + my $cNode = kdocAstUtil::findRef( $rootnode, "QPtrCollection" ); + warn "QPtrCollection not found" if (!$cNode); + my $node = Ast::New( 'Item' ); + $node->AddProp( "NodeType", "Forward" ); + $node->AddProp( "Source", $cNode->{Source} ) if ($cNode); + kdocAstUtil::attachChild( $cNode, $node ) if ($cNode); + $node->AddProp( "Access", "public" ); + } + + print STDERR "Preparsing...\n"; + + # Preparse everything, to prepare some additional data in the classes and methods + Iter::LocalCompounds( $rootnode, sub { preParseClass( shift ); } ); + + # Have a look at each class again, to propagate CanBeCopied + Iter::LocalCompounds( $rootnode, sub { propagateCanBeCopied( shift ); } ); + + print STDERR "Writing smokedata.cpp...\n"; + + # Write out smokedata.cpp + writeSmokeDataFile($rootnode); + + print STDERR "Writing x_*.cpp...\n"; + + # Generate x_*cpp file for each class + + my $numclasses; + Iter::LocalCompounds( $rootnode, sub { $numclasses++ } ); + my $classperfile = int($numclasses/numSourceFiles); + print STDERR "Total number of classes: ". $numclasses ."\n" if $debug; + my $nodelist = []; + my $currentfile = 1; + my $currentclass = 1; + Iter::LocalCompounds( $rootnode, sub { + push @$nodelist, shift; + if(@$nodelist == $classperfile and $currentfile != numSourceFiles) + { + print STDERR "Calling writeClassDoc for ". (scalar @$nodelist) . " classes\n" if $debug; + writeClassDoc( $nodelist ); + $currentfile++; + $nodelist = [] + } + if(@$nodelist and $currentclass == $numclasses) + { + print STDERR "Calling writeClassDoc for remaining ". (scalar @$nodelist) . " classes\n" if $debug; + writeClassDoc( $nodelist ) + } + $currentclass++ + }); + + print STDERR "Done.\n"; +} + +=head2 preParseClass + Called for each class +=cut +sub preParseClass +{ + my( $classNode ) = @_; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + + if( $#{$classNode->{Kids}} < 0 || + $classNode->{Access} eq "private" || + $classNode->{Access} eq "protected" || # e.g. QPixmap::QPixmapData + exists $classNode->{Tmpl} || + # Don't generate standard bindings for QString, this class is handled as a native type + $className eq 'QString' || + $className eq 'QConstString' || + $className eq 'QCString' || + # Don't map classes which are really arrays + $className eq 'QStringList' || + $className eq 'QCanvasItemList' || + $className eq 'QWidgetList' || + $className eq 'QObjectList' || + $className eq 'QStrList' || + # Those are template related + $className eq 'QTSManip' || # cause compiler errors with several gcc versions + $className eq 'QGDict' || + $className eq 'QGList' || + $className eq 'QGVector' || + $className eq 'QStrIList' || + $className eq 'QStrIVec' || + $className eq 'QByteArray' || + $className eq 'QBitArray' || + $classNode->{NodeType} eq 'union' # Skip unions for now, e.g. QPDevCmdParam + ) { + print STDERR "Skipping $className\n" if ($debug); + print STDERR "Skipping union $className\n" if ( $classNode->{NodeType} eq 'union'); + $skippedClasses{$className} = 1; + delete $classNode->{Compound}; # Cheat, to get it excluded from Iter::LocalCompounds + return; + } + + my $signalCount = 0; + my $eventHandlerCount = 0; + my $defaultConstructor = 'none'; # none, public, protected or private. 'none' will become 'public'. + my $constructorCount = 0; # total count of _all_ ctors + # If there are ctors, we need at least one public/protected one to instanciate the class + my $hasPublicProtectedConstructor = 0; + # We need a public dtor to destroy the object --- ### aren't protected dtors ok too ?? + my $hasPublicDestructor = 1; # by default all classes have a public dtor! + #my $hasVirtualDestructor = 0; + my $hasDestructor = 0; + my $hasPrivatePureVirtual = 0; + my $hasCopyConstructor = 0; + my $hasPrivateCopyConstructor = 0; + # Note: no need for hasPureVirtuals. $classNode{Pure} has that. + + my $doPrivate = $main::doPrivate; + $main::doPrivate = 1; + # Look at each class member (looking for methods and enums in particular) + Iter::MembersByType ( $classNode, undef, + sub { + + my( $classNode, $m ) = @_; + my $name = $m->{astNodeName}; + + if( $m->{NodeType} eq "method" ) { + if ( $m->{ReturnType} eq 'typedef' # QFile's EncoderFn/DecoderFn callback, very badly parsed + ) { + $m->{NodeType} = 'deleted'; + next; + } + + print STDERR "preParseClass: looking at $className\::$name $m->{Params}\n" if ($debug); + + if ( $name eq $classNode->{astNodeName} ) { + if ( $m->{ReturnType} =~ /~/ ) { + # A destructor + $hasPublicDestructor = 0 if $m->{Access} ne 'public'; + #$hasVirtualDestructor = 1 if ( $m->{Flags} =~ "v" && $m->{Access} ne 'private' ); + $hasDestructor = 1; + } else { + # A constructor + $constructorCount++; + $defaultConstructor = $m->{Access} if ( $m->{Params} eq '' ); + $hasPublicProtectedConstructor = 1 if ( $m->{Access} ne 'private' ); + + # Copy constructor? + if ( $#{$m->{ParamList}} == 0 ) { + my $theArgType = @{$m->{ParamList}}[0]->{ArgType}; + if ($theArgType =~ /$className\s*\&/) { + $hasCopyConstructor = 1; + $hasPrivateCopyConstructor = 1 if ( $m->{Access} eq 'private' ); + } + } + # Hack the return type for constructors, since constructors return an object pointer + $m->{ReturnType} = $className."*"; + } + } + + if ( $name =~ /~$classNode->{astNodeName}/ && $m->{Access} ne "private" ) { # not used + $hasPublicDestructor = 0 if $m->{Access} ne 'public'; + #$hasVirtualDestructor = 1 if ( $m->{Flags} =~ "v" ); + $hasDestructor = 1; + } + + if ( $m->{Flags} =~ "p" && $m->{Access} =~ /private/ ) { + $hasPrivatePureVirtual = 1; # ouch, can't inherit from that one + } + + # All we want from private methods is to check for virtuals, nothing else + next if ( $m->{Access} =~ /private/ ); + + my $argId = 0; + my $firstDefaultParam; + foreach my $arg ( @{$m->{ParamList}} ) { + # Look for first param with a default value + if ( defined $arg->{DefaultValue} && !defined $firstDefaultParam ) { + $firstDefaultParam = $argId; + } + + if ( $arg->{ArgType} eq '...' # refuse a method with variable arguments + or $arg->{ArgType} eq 'image_io_handler' # QImage's callback + or $arg->{ArgType} eq 'DecoderFn' # QFile's callback + or $arg->{ArgType} eq 'EncoderFn' # QFile's callback + or $arg->{ArgType} =~ /bool \(\*\)\(QObject/ # QMetaObject's ctor + or $arg->{ArgType} eq 'QtStaticMetaObjectFunction' # QMetaObjectCleanUp's ctor with func pointer + or $arg->{ArgType} eq 'const QTextItem&' # ref to a private class in 3.2.0b1 + or $arg->{ArgType} eq 'FILE*' # won't be able to handle that I think + ) { + $m->{NodeType} = 'deleted'; + } + else + { + # Resolve type in full, e.g. for QSessionManager::RestartHint + # (x_QSessionManager doesn't inherit QSessionManager) + $arg->{ArgType} = kalyptusDataDict::resolveType($arg->{ArgType}, $classNode, $rootnode); + registerType( $arg->{ArgType} ); + $argId++; + } + } + $m->AddProp( "FirstDefaultParam", $firstDefaultParam ); + $m->{ReturnType} = kalyptusDataDict::resolveType($m->{ReturnType}, $classNode, $rootnode) if ($m->{ReturnType}); + registerType( $m->{ReturnType} ); + } + elsif( $m->{NodeType} eq "enum" ) { + my $fullEnumName = $className."::".$m->{astNodeName}; + $classNode->{enumerations}{$m->{astNodeName}} = $fullEnumName + if $m->{astNodeName} and $m->{Access} ne 'private'; + + # Define a type for this enum + registerType( $fullEnumName ); + + # Remember that it's an enum + findTypeEntry( $fullEnumName )->{isEnum} = 1; + + #print STDERR "$fullEnumName is an enum\n"; + } + elsif( $m->{NodeType} eq 'var' ) { + my $varType = $m->{Type}; + # We are interested in public static vars, like QColor::blue + if ( $varType =~ s/static\s+// && $m->{Access} ne 'private' ) + { + $varType =~ s/const\s+(.*)\s*&/$1/; + $varType =~ s/\s*$//; + print STDERR "var: $m->{astNodeName} '$varType'\n" if ($debug); + + # Register the type + registerType( $varType ); + + } else { + # To avoid duplicating the above test, we just get rid of any other var + $m->{NodeType} = 'deleted'; + } + } + }, + undef + ); + $main::doPrivate = $doPrivate; + + print STDERR "$className: ctor count: $constructorCount, hasPublicProtectedConstructor: $hasPublicProtectedConstructor, hasCopyConstructor: $hasCopyConstructor:, defaultConstructor: $defaultConstructor, hasPublicDestructor: $hasPublicDestructor, hasPrivatePureVirtual:$hasPrivatePureVirtual\n" if ($debug); + + my $isGlobalSpace = ($className eq $main::globalSpaceClassName); + + # Note that if the class has _no_ constructor, the default ctor applies. Let's even generate it. + if ( !$constructorCount && $defaultConstructor eq 'none' && !$hasPrivatePureVirtual && !$isGlobalSpace ) { + # Create a method node for the constructor + my $methodNode = Ast::New( $classNode->{astNodeName} ); + $methodNode->AddProp( "NodeType", "method" ); + $methodNode->AddProp( "Flags", "" ); + $methodNode->AddProp( "Params", "" ); + $methodNode->AddProp( "ParamList", [] ); + kdocAstUtil::attachChild( $classNode, $methodNode ); + + # Hack the return type for constructors, since constructors return an object pointer + $methodNode->AddProp( "ReturnType", $className."*" ); + registerType( $className."*" ); + $methodNode->AddProp( "Access", "public" ); # after attachChild + $defaultConstructor = 'public'; + $hasPublicProtectedConstructor = 1; + } + + # Also, if the class has no explicit destructor, generate a default one. + if ( !$hasDestructor && !$hasPrivatePureVirtual && !$isGlobalSpace ) { + my $methodNode = Ast::New( "$classNode->{astNodeName}" ); + $methodNode->AddProp( "NodeType", "method" ); + $methodNode->AddProp( "Flags", "" ); + $methodNode->AddProp( "Params", "" ); + $methodNode->AddProp( "ParamList", [] ); + kdocAstUtil::attachChild( $classNode, $methodNode ); + + $methodNode->AddProp( "ReturnType", "~" ); + $methodNode->AddProp( "Access", "public" ); + } + + # If we have a private pure virtual, then the class can't be instanciated (e.g. QCanvasItem) + # Same if the class has only private constructors (e.g. QInputDialog) + $classNode->AddProp( "CanBeInstanciated", $hasPublicProtectedConstructor && !$hasPrivatePureVirtual ); + + # We will derive from the class only if it has public or protected constructors. + # (_Even_ if it has pure virtuals. But in that case the x_ class can't be instantiated either.) + $classNode->AddProp( "BindingDerives", $hasPublicProtectedConstructor ); + + # We need a public dtor to destroy the object --- ### aren't protected dtors ok too ?? + $classNode->AddProp( "HasPublicDestructor", $hasPublicDestructor ); + + # Hack for QAsyncIO. We don't implement the "if a class has no explicit copy ctor, + # then all of its member variables must be copiable, otherwise the class isn't copiable". + $hasPrivateCopyConstructor = 1 if ( $className eq 'QAsyncIO' ); + + # Remember if this class can't be copied - it means all its descendants can't either + $classNode->AddProp( "CanBeCopied", !$hasPrivateCopyConstructor ); + $classNode->AddProp( "HasCopyConstructor", $hasCopyConstructor ); +} + + +sub propagateCanBeCopied($) +{ + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + my @super = superclass_list($classNode); + # A class can only be copied if none of its ancestors have a private copy ctor. + for my $s (@super) { + if (!$s->{CanBeCopied}) { + $classNode->{CanBeCopied} = 0; + print STDERR "$classNode->{astNodeName} cannot be copied\n" if ($debug); + last; + } + } + # If the class has no explicit copy constructor, and it can be copied, + # generate the copy constructor. + if ( !$classNode->{HasCopyConstructor} && $classNode->{CanBeCopied} && $classNode->{CanBeInstanciated} ) { + my $methodNode = Ast::New( "$classNode->{astNodeName}" ); + $methodNode->AddProp( "NodeType", "method" ); + $methodNode->AddProp( "Flags", "" ); + my $argType = "const ".$className."&"; + registerType( $argType ); + $methodNode->AddProp( "Params", $argType ); + # The param node + my $node = Ast::New( 1 ); # let's make the arg index the node "name" + $node->AddProp( "NodeType", "param" ); + $node->AddProp( "ArgType", $argType ); + $methodNode->AddPropList( "ParamList", $node ); + kdocAstUtil::attachChild( $classNode, $methodNode ); + + # Hack the return type for constructors, since constructors return an object pointer + $methodNode->AddProp( "ReturnType", $className."*" ); + registerType( $className."*" ); + $methodNode->AddProp( "Access", "public" ); # after attachChild + } + + # Prepare the {case} dict for the class + prepareCaseDict( $classNode ); +} + +=head2 writeClassDoc + + Called by writeDoc for each series of classes to be written out + +=cut + +BEGIN { + +my $fhn =1; # static + + sub writeClassDoc + { + my $nodelist = shift; + my $file = "$outputdir/x_${fhn}.cpp"; + open( my $fh, ">$file" ) || die "Couldn't create $file\n"; + + print $fh "//Auto-generated by $0. DO NOT EDIT.\n"; + print $fh "#include <smoke.h>\n"; + print $fh "#include <${libname}_smoke.h>\n"; + + my @code; + for my $node ( @$nodelist ) + { + push @code, [generateAllMethods( $node )] + } + my %includes; + map { for my $incl (keys %{$_->[2]}){ $includes{$incl}++ } } @code; + + foreach my $incl (keys %includes) { + die if $incl eq ''; + print $fh "#include <$incl>\n"; + } + print $fh "\n"; + for my $c( 0..$#code ) + { + my ($methodCode, $switchCode, $incl) = @{ $code[$c] }; + my $node = $$nodelist[$c]; + my $className = join( "::", kdocAstUtil::heritage($node) ); + my $legacyClassName = join( "__", kdocAstUtil::heritage($node) ); + print $fh "class x_$legacyClassName "; + print $fh ": public $className " if $node->{BindingDerives}; + print $fh "{\n"; + print $fh $methodCode; + print $fh "};\n"; + if(keys %{$node->{enumerations}}) { + print $fh "void xenum_${legacyClassName}(Smoke::EnumOperation xop, Smoke::Index xtype, void *&xdata, long &xvalue) {\n"; + print $fh " x_${legacyClassName}\::xenum_operation(xop, xtype, xdata, xvalue);\n"; + print $fh "}\n"; + } + print $fh "void xcall_${legacyClassName}(Smoke::Index xi, void *obj, Smoke::Stack args) {\n"; + print $fh $switchCode; + print $fh "}\n\n"; + } + #if ( $className =~ /^(QBrush|QColor|QCursor|QFont|QImage|QPalette|QPixmap|QPoint|QPointArray|QRect|QRegion|QSize|QWMatrix)$/ ) { + # print XCPPFILE " const char *{serial} operator << () const : pig_serialize(\$this);\n"; + # print XCPPFILE " void operator >> (const char *{serial}) : pig_deserialize(\$this, \$1);\n"; + #} + + close $fh; + $fhn++ + } + +} + +# Generate the prototypes for a method (one per arg with a default value) +# Helper for makeprotos +sub iterproto($$$$$) { + my $classidx = shift; # to check if a class exists + my $method = shift; + my $proto = shift; + my $idx = shift; + my $protolist = shift; + + my $argcnt = scalar @{ $method->{ParamList} } - 1; + if($idx > $argcnt) { + push @$protolist, $proto; + return; + } + if(defined $method->{FirstDefaultParam} and $method->{FirstDefaultParam} <= $idx) { + push @$protolist, $proto; + } + + my $arg = $method->{ParamList}[$idx]->{ArgType}; + + my $typeEntry = findTypeEntry( $arg ); + my $realType = $typeEntry->{realType}; + + # A scalar ? + $arg =~ s/\bconst\b//g; + $arg =~ s/\s+//g; + if($typeEntry->{isEnum} || $allTypes{$realType}{isEnum} || exists $typeunion{$realType} || exists $mungedTypeMap{$arg}) + { + my $id = '$'; # a 'scalar + $id = '?' if $arg =~ /[*&]{2}/; + $id = $mungedTypeMap{$arg} if exists $mungedTypeMap{$arg}; + iterproto($classidx, $method, $proto . $id, $idx + 1, $protolist); + return; + } + + # A class ? + if(exists $classidx->{$realType}) { + iterproto($classidx, $method, $proto . '#', $idx + 1, $protolist); + return; + } + + # A non-scalar (reference to array or hash, undef) + iterproto($classidx, $method, $proto . '?', $idx + 1, $protolist); + return; +} + +# Generate the prototypes for a method (one per arg with a default value) +sub makeprotos($$$) { + my $classidx = shift; + my $method = shift; + my $protolist = shift; + iterproto($classidx, $method, $method->{astNodeName}, 0, $protolist); +} + +# Return the string containing the signature for this method (without return type). +# If the 2nd arg is not the size of $m->{ParamList}, this method returns a +# partial signature (this is used to handle default values). +sub methodSignature($$) { + my $method = shift; + my $last = shift; + my $sig = $method->{astNodeName}; + my @argTypeList; + my $argId = 0; + foreach my $arg ( @{$method->{ParamList}} ) { + last if $argId > $last; + push @argTypeList, $arg->{ArgType}; + $argId++; + } + $sig .= "(". join(", ",@argTypeList) .")"; + $sig .= " const" if $method->{Flags} =~ "c"; + return $sig; +} + +sub coerce_type($$$$) { + #my $m = shift; + my $union = shift; + my $var = shift; + my $type = shift; + my $new = shift; # 1 if this is a return value, 0 for a normal param + + my $typeEntry = findTypeEntry( $type ); + my $realType = $typeEntry->{realType}; + + my $unionfield = $typeEntry->{typeId}; + die "$type" unless defined( $unionfield ); + $unionfield =~ s/t_/s_/; + + $type =~ s/\s+const$//; # for 'char* const' + $type =~ s/\s+const\s*\*$/\*/; # for 'char* const*' + + my $code = "$union.$unionfield = "; + if($type =~ /&$/) { + $code .= "(void*)&$var;\n"; + } elsif($type =~ /\*$/) { + $code .= "(void*)$var;\n"; + } else { + if ( $unionfield eq 's_class' + or ( $unionfield eq 's_voidp' and $type ne 'void*' ) + or $type eq 'QString' ) { # hack + $type =~ s/^const\s+//; + if($new) { + $code .= "(void*)new $type($var);\n"; + } else { + $code .= "(void*)&$var;\n"; + } + } else { + $code .= "$var;\n"; + } + } + + return $code; +} + +# Generate the list of args casted to their real type, e.g. +# (QObject*)x[1].s_class,(QEvent*)x[2].s_class,x[3].s_int +sub makeCastedArgList +{ + my @castedList; + my $i = 1; # The args start at x[1]. x[0] is the return value + my $arg; + foreach $arg (@_) { + my $type = $arg; + my $cast; + + my $typeEntry = findTypeEntry( $type ); + my $unionfield = $typeEntry->{typeId}; + die "$type" unless defined( $unionfield ); + $unionfield =~ s/t_/s_/; + + $type =~ s/\s+const$//; # for 'char* const' + $type =~ s/\s+const\s*\*$/\*/; # for 'char* const*' + + my $v .= "x[$i].$unionfield"; + if($type =~ s/&$//) { + $cast = "*($type *)"; + } elsif($type =~ /\*$/) { + $cast = "($type)"; + } elsif($type =~ /\(\*\)\s*\(/) { # function pointer ... (*)(...) + $cast = "($type)"; + } else { + if ( $unionfield eq 's_class' + or ( $unionfield eq 's_voidp' and $type ne 'void*' ) + or $type eq 'QString' ) { # hack + $cast = "*($type *)"; + } else { + $cast = "($type)"; + } + } + push @castedList, "$cast$v"; + $i++; + } + return @castedList; +} + +# Adds the header for node $1 to be included in $2 if not already there +# Prints out debug stuff if $3 +sub addIncludeForClass($$$) +{ + my ( $node, $addInclude, $debugMe ) = @_; + my $sourcename = $node->{Source}->{astNodeName}; + $sourcename =~ s!.*/(.*)!$1!m; + die "Empty source name for $node->{astNodeName}" if ( $sourcename eq '' ); + unless ( defined $addInclude->{$sourcename} ) { + print " Including $sourcename\n" if ($debugMe); + $addInclude->{$sourcename} = 1; + } + else { print " $sourcename already included.\n" if ($debugMe); } +} + +sub checkIncludesForObject($$) +{ + my $type = shift; + my $addInclude = shift; + + my $debugCI = 0; #$debug + #print "checkIncludesForObject $type\n"; + $type =~ s/const\s+//; + my $it = $type; + if (!($it and exists $typeunion{$it}) and $type !~ /\*/ + #and $type !~ /&/ # in fact we also want refs, due to the generated code + ) { + $type =~ s/&//; + print " Detecting an object by value/ref: $type\n" if ($debugCI); + my $node = kdocAstUtil::findRef( $rootnode, $type ); + if ($node) { + addIncludeForClass( $node, $addInclude, $debugCI ); + } + else { print " No header found for $type\n" if ($debugCI); } + } +} + +sub generateVirtualMethod($$$$$) +{ + # Generating methods for $class. + # $m: method node. $methodClass: the node of the class in which the method is really declared + # (can be different from $class when the method comes from a super class) + # This is important because of $allMethods, which has no entry for class::method in that case. + + my( $classNode, $signature, $m, $methodClass, $addInclude ) = @_; + my $methodCode = ''; # output + my $returnType = $m->{ReturnType}; + return ('', '') if $returnType eq '~'; # skip destructors + + my $className = $classNode->{astNodeName}; + my $flags = $m->{Flags}; + my @argList = @{$m->{ParamList}}; + + print "generateVirtualMethod $className: $signature ($m->{Access})\n" if ($debug); + + # Detect objects returned by value + checkIncludesForObject( $returnType, $addInclude ) if ($returnType ne 'void'); + + # Generate a matching virtual method in the x_ class + $methodCode .= " virtual $returnType $m->{astNodeName}("; + my $i = 0; + foreach my $arg ( @argList ) { + $methodCode .= ", " if $i++; + $methodCode .= $arg->{ArgType}; + $methodCode .= " x$i"; + + # Detect objects passed by value + checkIncludesForObject( $arg->{ArgType}, $addInclude ); + } + $methodCode .= ") "; + $methodCode .= "const " if ($flags =~ "c"); + $methodCode .= "\{\n"; + + # Now the code of the method + my $this = $classNode->{BindingDerives} > 0 ? "this" : "xthis"; + + $i++; # Now the number of args + $methodCode .= "\tSmoke::StackItem x[$i];\n"; + $i = 1; + for my $arg (@argList) { + $methodCode .= "\t"; + $methodCode .= coerce_type("x[$i]", "x$i", $arg->{ArgType}, 0); + $i++; + } + + my $sig = $methodClass->{astNodeName} . "::" . $signature; + my $idx = $allMethods{$sig}; + die "generateVirtualMethod: $className: No method found for $sig\n" if !defined $idx; + if($flags =~ "p") { # pure virtual + $methodCode .= "\t${libname}_Smoke->binding->callMethod($idx, (void*)$this, x, true /*pure virtual*/);\n"; + } else { + $methodCode .= "\tif(${libname}_Smoke->binding->callMethod($idx, (void*)$this, x)) "; + } + + $returnType = undef if ($returnType eq 'void'); + if($returnType) { + my $arg = $returnType; + my $it = $arg; + my $cast; + my $v = "x[0]"; + my $indent = ($flags =~ "p") ? "\t" : ""; + if($it and exists $typeunion{$it}) { + $v .= ".$typeunion{$it}"; + $cast = "($arg)"; + $methodCode .= "${indent}return $cast$v;\n"; + } else { + $v .= ".s_class"; + if($arg =~ s/&//) { + $cast = "*($arg *)"; + $methodCode .= "${indent}return $cast$v;\n"; + } elsif($arg !~ /\*/) { + unless($flags =~ "p") { + $indent = "\t "; + $methodCode .= "{\n"; + } + # we assume it's a new thing, and handle it + $methodCode .= "${indent}$arg *xptr = ($arg *)$v;\n"; + $methodCode .= "${indent}$arg xret(*xptr);\n"; + $methodCode .= "${indent}delete xptr;\n"; + $methodCode .= "${indent}return xret;\n"; + $methodCode .= "\t}\n" unless $flags =~ "p"; + } else { + $cast = "($arg)"; + $methodCode .= "${indent}return $cast$v;\n"; + } + } + } else { + $methodCode .= "\t" if $flags =~ "p"; + $methodCode .= "return;\n"; + } + if($flags =~ "p") { + $methodCode .= "\t// ABSTRACT\n"; + $methodCode .= " }\n"; + return ( $methodCode ); + } + $methodCode .= "\t"; + if($returnType) { + $methodCode .= "return "; + } + $methodCode .= "$this\->$methodClass->{astNodeName}\::$m->{astNodeName}("; + $i = 0; + for my $arg (@argList) { + $methodCode .= ", " if $i++; + $methodCode .= "x$i"; + } + $methodCode .= ");\n"; + $methodCode .= " }\n"; + return ( $methodCode ); +} + +sub generateMethod($$$) +{ + my( $classNode, $m, $addInclude ) = @_; # input + my $methodCode = ''; # output + my $switchCode = ''; # output + + my $name = $m->{astNodeName}; # method name + my @heritage = kdocAstUtil::heritage($classNode); + my $className = join( "::", @heritage ); + my $xClassName = "x_" . join( "__", @heritage ); + + # Check some method flags: constructor, destructor etc. + my $flags = $m->{Flags}; + + if ( !defined $flags ) { + warn "Method ".$name. " has no flags\n"; + } + + my $returnType = $m->{ReturnType}; + $returnType = undef if ($returnType eq 'void'); + + # Don't use $className here, it's never the fully qualified (A::B) name for a ctor. + my $isConstructor = ($name eq $classNode->{astNodeName} ); + my $isDestructor = ($returnType eq '~'); + + if ($debug) { + print STDERR " Method $name"; + print STDERR ", is DTOR" if $isDestructor; + print STDERR ", returns $returnType" if $returnType; + #print STDERR " ($m->{Access})"; + print STDERR "\n"; + } + + # Don't generate anything for destructors + return if $isDestructor; + + return if ( $m->{SkipFromSwitch} ); # pure virtuals, etc. + +# # Skip internal methods, which return unknown types +# # Hmm, the C# bindings have a list of those too. +# return if ( $returnType =~ m/QGfx\s*\*/ ); +# return if ( $returnType eq 'CGContextRef' ); +# return if ( $returnType eq 'QWSDisplay *' ); +# # This stuff needs callback, or ** +# return if ( $name eq 'defineIOHandler' or $name eq 'qt_init_internal' ); +# # Skip casting operators, but not == < etc. +# return if ( $name =~ /operator \w+/ ); +# # QFile's EncoderFn/DecoderFn +# return if ( $name =~ /set[ED][ne]codingFunction/ ); +# # How to implement this? (QXmlDefaultHandler/QXmlEntityResolver::resolveEntity, needs A*&) +# return if ( $name eq 'resolveEntity' and $className =~ /^QXml/ ); +# return if ( $className eq 'QBitArray' && $m->{Access} eq 'protected' ); + + #print STDERR "Tests passed, generating.\n"; + + # Detect objects returned by value + checkIncludesForObject( $returnType, $addInclude ) if ($returnType); + + my $argId = 0; + + my @argTypeList=(); + + foreach my $arg ( @{$m->{ParamList}} ) { + + print STDERR " Param ".$arg->{astNodeName}." type: ".$arg->{ArgType}." name:".$arg->{ArgName}." default: ".$arg->{DefaultValue}."\n" if ($debug); + + my $argType = $arg->{ArgType}; + push @argTypeList, $argType; + + # Detect objects passed by value + checkIncludesForObject( $argType, $addInclude ); + } + + my @castedArgList = makeCastedArgList( @argTypeList ); + + my $isStatic = $flags =~ "s"; + + my $extra = ""; + $extra .= "static " if $isStatic || $isConstructor; + + my $attr = ""; + $attr .= "const " if $flags =~ "c"; + + my $this = $classNode->{BindingDerives} > 0 ? "this" : "xthis"; + + # We iterate as many times as we have default params + my $firstDefaultParam = $m->{FirstDefaultParam}; + $firstDefaultParam = scalar(@argTypeList) unless defined $firstDefaultParam; + my $iterationCount = scalar(@argTypeList) - $firstDefaultParam; + + my $xretCode = ''; + if($returnType) { + $xretCode .= coerce_type('x[0]', 'xret', $returnType, 1); + } + + print STDERR " ". ($iterationCount+1). " iterations for $name\n" if ($debug); + + while($iterationCount >= 0) { + + local($") = ","; + # Handle case of a class with constructors, but with a private pure virtual + # so we can't create an instance of it + if($isConstructor and !$classNode->{CanBeInstanciated}) { + + # We still generate "forwarder constructors" for x_className though + $methodCode .= " $xClassName("; + my $i = 0; + for my $arg (@argTypeList) { + $methodCode .= ", " if $i++; + $methodCode .= "$arg x$i"; + } + $methodCode .= ") : $className("; + $i = 0; + for my $arg (@argTypeList) { + $methodCode .= ", " if $i++; + $methodCode .= "x$i"; + } + $methodCode .= ") {}\n"; + + } else { + + $switchCode .= "\tcase $methodNumber: "; + if ($flags =~ "s" || $isConstructor) { # static or constructor + $switchCode .= "$xClassName\::"; + } else { + $switchCode .= "xself->" + } + $switchCode .= "x_$methodNumber(args);"; + $switchCode .= "\tbreak;\n"; + + $methodCode .= " ${extra}void x_$methodNumber\(Smoke::Stack x) $attr\{\n"; + my $cplusplusparams = join( ", ", @argTypeList ); + $methodCode .= "\t// $name($cplusplusparams)\n"; + $methodCode .= "\t"; + + if ($isConstructor) { + + $methodCode .= "$xClassName* xret = new $xClassName(@castedArgList[0..$#argTypeList]);\n"; + #$m->{retnew} = 1; + $methodCode .= "\tx[0].s_class = (void*)xret;\n"; # the return value, containing the new object + $methodCode .= " }\n"; + + # Now generate the actual constructor for x_className + # (Simply a forwarder to the className constructor with the same args + $methodCode .= " $xClassName("; + my $i = 0; + for my $arg (@argTypeList) { + $methodCode .= ", " if $i++; + if ($arg =~ s/\(\*\)/(* x$i)/) { # function pointer... need to insert argname inside + $methodCode .= $arg; + } else { + $methodCode .= "$arg x$i"; + } + } + $methodCode .= ") : $className("; + $i = 0; + for my $arg (@argTypeList) { + $methodCode .= ", " if $i++; + $methodCode .= "x$i"; + } + $methodCode .= ") {\n"; + + } else { + $methodCode .= $returnType . " xret = " if $returnType; + $methodCode .= "$this\->" unless $isStatic; + if ($className ne $main::globalSpaceClassName) { + $methodCode .= "$className\::$name(@castedArgList[0..$#argTypeList]);\n"; + } elsif ($name =~ /^operator\s?\W+/) { + ( my $op = $name ) =~ s/^operator(.*)$/$1/; + if (scalar(@argTypeList) == 2) { + $methodCode .= "(@castedArgList[0] $op @castedArgList[1]);\n"; # a + b + } elsif (scalar(@argTypeList) == 1) { + $methodCode .= "($op@castedArgList[0]);\n"; # -a + } else { + die "shouldn't reach here!"; + } + } else { + $methodCode .= "$name(@castedArgList[0..$#argTypeList]);\n"; + } + $methodCode .= "\t" . $xretCode if $returnType; + # To avoid unused parameter warning, add this to void methods: + $methodCode .= "\t(void)x; // noop (for compiler warning)\n" unless $returnType; + } + $methodCode .= " }\n"; + } + + #} else { + # if ( $m->{Access} =~ /slots/ ) { + # print PIGSOURCE "$extra$returnType $name(", $cplusplusparams, ") slot;\n", + # } elsif ( $m->{Access} =~ /signals/ ) { + # print PIGSOURCE "$extra$returnType $name(", $cplusplusparams, ") signal;\n", + # } elsif ( $name =~ /operator(.*)/ ) { + # if ( $argId == 2 ) { + # print PIGSOURCE "$extra$returnType operator $1 (", $cplusplusparams, ") : operator $1 (\$0, \$1);\n", + # } else { + # print PIGSOURCE "$extra$returnType operator $1 (", $cplusplusparams, ")", ($m->{Flags} =~ "c" ? " const" : ""), ";\n", + # } + # } else { + # print PIGSOURCE "$extra$returnType $name(", $cplusplusparams, ")", ($m->{Flags} =~ "c" ? " const" : ""), ";\n", + # } + #} + + pop @argTypeList; + $methodNumber++; + $iterationCount--; + } # Iteration loop + + return ( $methodCode, $switchCode ); +} + + +sub generateEnum($$) +{ + my( $classNode, $m ) = @_; # input + my $methodCode = ''; # output + my $switchCode = ''; # output + + my @heritage = kdocAstUtil::heritage($classNode); + my $className = join( "::", @heritage ); + my $xClassName = "x_" . join( "__", @heritage ); + + foreach my $enum ( @{$m->{ParamList}} ) { + my $enumName = $enum->{ArgName}; + my $fullEnumName = "$className\::$enumName"; + + die "Invalid index for $fullEnumName: $classNode->{case}{$fullEnumName} instead of $methodNumber" if $classNode->{case}{$fullEnumName} != $methodNumber; + $methodCode .= " static void x_$methodNumber(Smoke::Stack x) {\n"; + $methodCode .= "\tx[0].s_enum = (long)$fullEnumName;\n"; + $methodCode .= " }\n"; + $switchCode .= "\tcase $methodNumber: $xClassName\::x_$methodNumber(args);\tbreak;\n"; + $methodNumber++; + } + + return ( $methodCode, $switchCode ); +} + +sub generateVar($$$) +{ + my( $classNode, $m, $addInclude ) = @_; # input + my $methodCode = ''; # output + my $switchCode = ''; # output + + my @heritage = kdocAstUtil::heritage($classNode); + my $className = join( "::", @heritage ); + my $xClassName = "x_" . join( "__", @heritage ); + + my $name = $m->{astNodeName}; + my $varType = $m->{Type}; + $varType =~ s/static\s//; + $varType =~ s/const\s+(.*)\s*&/$1/; + $varType =~ s/\s*$//; + my $fullName = "$className\::$name"; + + checkIncludesForObject( $varType, $addInclude ); + + die "Invalid index for $fullName: $classNode->{case}{$fullName} instead of $methodNumber" if $classNode->{case}{$fullName} != $methodNumber; + $methodCode .= " static void x_$methodNumber(Smoke::Stack x) {\n"; + $methodCode .= "\tx[0].s_class = (void*)new $varType($fullName);\n"; + $methodCode .= " }\n"; + $switchCode .= "\tcase $methodNumber: $xClassName\::x_$methodNumber(args);\tbreak;\n"; + $methodNumber++; + + return ( $methodCode, $switchCode ); +} + +sub generateEnumCast($) +{ + my( $classNode ) = @_; + my $methodCode = ''; + return unless keys %{$classNode->{enumerations}}; + $methodCode .= " static void xenum_operation(Smoke::EnumOperation xop, Smoke::Index xtype, void *&xdata, long &xvalue) {\n"; + $methodCode .= "\tswitch(xtype) {\n"; + for my $enum (values %{$classNode->{enumerations}}) { + my $type = findTypeEntry($enum); + $methodCode .= "\t case $type->{index}: //$enum\n"; + $methodCode .= "\t switch(xop) {\n"; + $methodCode .= "\t case Smoke::EnumNew:\n"; + $methodCode .= "\t\txdata = (void*)new $enum;\n"; + $methodCode .= "\t\tbreak;\n"; + $methodCode .= "\t case Smoke::EnumDelete:\n"; # unnecessary + $methodCode .= "\t\tdelete ($enum*)xdata;\n"; + $methodCode .= "\t\tbreak;\n"; + $methodCode .= "\t case Smoke::EnumFromLong:\n"; + $methodCode .= "\t\t*($enum*)xdata = ($enum)xvalue;\n"; + $methodCode .= "\t\tbreak;\n"; + $methodCode .= "\t case Smoke::EnumToLong:\n"; + $methodCode .= "\t\txvalue = (long)*($enum*)xdata;\n"; + $methodCode .= "\t\tbreak;\n"; + $methodCode .= "\t }\n"; + $methodCode .= "\t break;\n"; + } + $methodCode .= "\t}\n"; + $methodCode .= " }\n"; + + return $methodCode; +} + +## Called by writeClassDoc +sub generateAllMethods +{ + my ($classNode) = @_; + my $methodCode = ''; + my $switchCode = ''; + $methodNumber = 0; + + #my $className = $classNode->{astNodeName}; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + my $xClassName = "x_" . join( "__", kdocAstUtil::heritage($classNode) ); + my $isGlobalSpace = ($xClassName eq ("x_".$main::globalSpaceClassName)); + my $sourcename = $classNode->{Source}->{astNodeName}; + + $sourcename =~ s!.*/(.*)!$1!m; + die "Empty source name for $classNode->{astNodeName}" if ( $sourcename eq '' ); + + my %addInclude = ( $sourcename => 1 ); + + if (!$isGlobalSpace) { + if(! $classNode->{BindingDerives}) { + $methodCode .= "private:\n"; + $methodCode .= " $className *xthis;\n"; + $methodCode .= "public:\n"; + $methodCode .= " $xClassName\(void *x) : xthis(($className*)x) {}\n"; + $switchCode .= " $xClassName xtmp(obj), *xself = &xtmp;\n"; + } else { + $switchCode .= " $xClassName *xself = ($xClassName*)obj;\n"; + $methodCode .= "public:\n"; + } + } else { + my $s; + for my $sn( @{$classNode->{Sources}} ) { + ($s = $sn->{astNodeName}) =~ s!.*/(.*)!$1!m; + $addInclude{ $s } = 1; + } + $methodCode .= "public:\n"; + $switchCode .= " (void) obj;\n"; + } + $switchCode .= " switch(xi) {\n"; + + # Do all enums first + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $methodNode ) = @_; + + if ( $methodNode->{NodeType} eq 'enum' ) { + my ($meth, $swit) = generateEnum( $classNode, $methodNode ); + $methodCode .= $meth; + $switchCode .= $swit; + } + }, undef ); + + # Then all static vars + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $methodNode ) = @_; + + if ( $methodNode->{NodeType} eq 'var' ) { + my ($meth, $swit) = generateVar( $classNode, $methodNode, \%addInclude ); + $methodCode .= $meth; + $switchCode .= $swit; + } + }, undef ); + + # Then all methods + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $methodNode ) = @_; + + if ( $methodNode->{NodeType} eq 'method' ) { + my ($meth, $swit) = generateMethod( $classNode, $methodNode, \%addInclude ); + $methodCode .= $meth; + $switchCode .= $swit; + } + }, undef ); + + # Virtual methods + if ($classNode->{BindingDerives}) { + my %virtualMethods; + allVirtualMethods( $classNode, \%virtualMethods ); + + for my $sig (sort keys %virtualMethods) { + my ($meth) = generateVirtualMethod( $classNode, $sig, $virtualMethods{$sig}{method}, $virtualMethods{$sig}{class}, \%addInclude ); + $methodCode .= $meth; + } + } + + $methodCode .= generateEnumCast( $classNode ); + + # Destructor + # "virtual" is useless, if the base class has a virtual destructor then the x_* class too. + #if($classNode->{HasVirtualDestructor} and $classNode->{HasDestructor}) { + # $methodCode .= " virtual ~$xClassName() {}\n"; + #} + # We generate a dtor though, because we might want to add stuff into it + if ( !$isGlobalSpace ) { + $methodCode .= " ~$xClassName() { ${libname}_Smoke->binding->deleted($classNode->{ClassIndex}, (void*)this); }\n"; + } + + if ($classNode->{CanBeInstanciated} and $classNode->{HasPublicDestructor}) { + die "$className destructor: methodNumber=$methodNumber != case entry=".$classNode->{case}{"~$className()"}."\n" + if $methodNumber != $classNode->{case}{"~$className()"}; + $switchCode .= "\tcase $methodNumber: delete ($className*)xself;\tbreak;\n"; + $methodNumber++; + } + + $switchCode .= " }\n"; + return ( $methodCode, $switchCode, \%addInclude ); +} + +# Return 0 if the class has no virtual dtor, 1 if it has, 2 if it's private +sub hasVirtualDestructor($) +{ + my ( $classNode ) = @_; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + return if ( $skippedClasses{$className} ); + + my $parentHasIt; + # Look at ancestors, and (recursively) call hasVirtualDestructor for each + # It's enough to have one parent with a prot/public virtual dtor + Iter::Ancestors( $classNode, $rootnode, undef, undef, sub { + my $vd = hasVirtualDestructor( $_[0] ); + $parentHasIt = $vd unless $parentHasIt > $vd; + } ); + return $parentHasIt if $parentHasIt; # 1 or 2 + + # Now look in $classNode - including private methods + my $doPrivate = $main::doPrivate; + $main::doPrivate = 1; + my $result; + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + return unless( $m->{NodeType} eq "method" && $m->{ReturnType} eq '~' ); + + if ( $m->{Flags} =~ /[vp]/ ) { + if ( $m->{Access} =~ /private/ ) { + $result=2; # private virtual + } else { + $result=1; # [protected or public] virtual + } + } + }, + undef + ); + $main::doPrivate = $doPrivate; + $result=0 if (!defined $result); + return $result; +} + +=head2 allVirtualMethods + + Parameters: class node, dict + + Adds to the dict, for all method nodes that are virtual, in this class and in parent classes : + {method} the method node, {class} the class node (the one where the virtual is implemented) + +=cut + +sub allVirtualMethods($$) +{ + my ( $classNode, $virtualMethods ) = @_; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + return if ( $skippedClasses{$className} ); + + # Look at ancestors, and (recursively) call allVirtualMethods for each + # This is done first, so that virtual methods that are reimplemented as 'private' + # can be removed from the list afterwards (below) + Iter::Ancestors( $classNode, $rootnode, undef, undef, sub { + allVirtualMethods( @_[0], $virtualMethods ); + }, undef + ); + + # Now look for virtual methods in $classNode - including private ones + my $doPrivate = $main::doPrivate; + $main::doPrivate = 1; + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + # Only interested in methods, and skip destructors + return unless( $m->{NodeType} eq "method" && $m->{ReturnType} ne '~' ); + + my $signature = methodSignature( $m, $#{$m->{ParamList}} ); + print STDERR $signature . " ($m->{Access})\n" if ($debug); + + # A method is virtual if marked as such (v=virtual p=pure virtual) + # or if a parent method with same signature was virtual + if ( $m->{Flags} =~ /[vp]/ or defined $virtualMethods->{$signature} ) { + if ( $m->{Access} =~ /private/ ) { + if ( defined $virtualMethods->{$signature} ) { # remove previously defined + delete $virtualMethods->{$signature}; + } + # else, nothing, just ignore private virtual method + } else { + $virtualMethods->{$signature}{method} = $m; + $virtualMethods->{$signature}{class} = $classNode; + } + } + }, + undef + ); + $main::doPrivate = $doPrivate; +} + +# Known typedef? If so, apply it. +sub applyTypeDef($) +{ + my $type = shift; + # Parse 'const' in front of it, and '*' or '&' after it + my $prefix = $type =~ s/^const\s+// ? 'const ' : ''; + my $suffix = $type =~ s/\s*([\&\*]+)$// ? $1 : ''; + + if (exists $typedeflist{$type}) { + return $prefix.$typedeflist{$type}.$suffix; + } + return $prefix.$type.$suffix; +} + +# Register type ($1) into %allTypes if not already there +sub registerType($$) { + my $type = shift; + #print "registerType: $type\n" if ($debug); + + $type =~ s/\s+const$//; # for 'char* const' + $type =~ s/\s+const\s*\*$/\*/; # for 'char* const*' + + return if ( $type eq 'void' or $type eq '' or $type eq '~' ); + die if ( $type eq '...' ); # ouch + + # Let's register the real type, not its known equivalent + #$type = applyTypeDef($type); + + # Enum _value_ -> get corresponding type + if (exists $enumValueToType{$type}) { + $type = $enumValueToType{$type}; + } + + # Already in allTypes + if(exists $allTypes{$type}) { + return; + } + + die if $type eq 'QTextEdit::UndoRedoInfo::Type'; + die if $type eq ''; + + my $realType = $type; + + # Look for references (&) and pointers (* or **) - this will not handle *& correctly. + # We do this parsing here because both the type list and iterproto need it + if($realType =~ s/&$//) { + $allTypes{$type}{typeFlags} = 'Smoke::tf_ref'; + } + elsif($realType ne 'void*' && $realType =~ s/\*$//) { + $allTypes{$type}{typeFlags} = 'Smoke::tf_ptr'; + } + else { + $allTypes{$type}{typeFlags} = 'Smoke::tf_stack'; + } + + if ( $realType =~ s/^const\s+// ) { # Remove 'const' + $allTypes{$type}{typeFlags} .= ' | Smoke::tf_const'; + } + + # Apply typedefs, and store the resulting type. + # For instance, if $type was Q_UINT16&, realType will be ushort + $allTypes{$type}{realType} = applyTypeDef( $realType ); + + # In the first phase we only create entries into allTypes. + # The values (indexes) are calculated afterwards, once the list is full. + $allTypes{$type}{index} = -1; + #print STDERR "Register $type. Realtype: $realType\n" if($debug); +} + +# Get type from %allTypes +# This returns a hash with {index}, {isEnum}, {typeFlags}, {realType} +# (and {typeId} after the types array is written by writeSmokeDataFile) +sub findTypeEntry($) { + my $type = shift; + my $typeIndex = -1; + $type =~ s/\s+const$//; # for 'char* const' + $type =~ s/\s+const\s*\*$/\*/; # for 'char* const*' + + return undef if ( $type =~ '~' or $type eq 'void' or $type eq '' ); + + # Enum _value_ -> get corresponding type + if (exists $enumValueToType{$type}) { + $type = $enumValueToType{$type}; + } + + die "type not known: $type" unless defined $allTypes{$type}; + return $allTypes{ $type }; +} + +# List of all super-classes for a given class +sub superclass_list($) +{ + my $classNode = shift; + my @super; + Iter::Ancestors( $classNode, $rootnode, undef, undef, sub { + push @super, @_[0]; + push @super, superclass_list( @_[0] ); + }, undef ); + return @super; +} + +# Store the {case} dict in the class Node (method signature -> index in the "case" switch) +# This also determines which methods should NOT be in the switch, and sets {SkipFromSwitch} for them +sub prepareCaseDict($) { + + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + $classNode->AddProp("case", {}); + my $methodNumber = 0; + + # First look at all enums for this class + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + next unless $m->{NodeType} eq 'enum'; + foreach my $val ( @{$m->{ParamList}} ) { + my $fullEnumName = "$className\::".$val->{ArgName}; + print STDERR "Enum: $fullEnumName -> case $methodNumber\n" if ($debug); + $classNode->{case}{$fullEnumName} = $methodNumber; + $enumValueToType{$fullEnumName} = "$className\::$m->{astNodeName}"; + $methodNumber++; + } + }, undef ); + + # Check for static vars + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + next unless $m->{NodeType} eq 'var'; + my $name = "$className\::".$m->{astNodeName}; + print STDERR "Var: $name -> case $methodNumber\n" if ($debug); + $classNode->{case}{$name} = $methodNumber; + $methodNumber++; + + }, undef ); + + + # Now look at all methods for this class + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + next unless $m->{NodeType} eq 'method'; + my $name = $m->{astNodeName}; + my $isConstructor = ($name eq $classNode->{astNodeName} ); + if ($isConstructor and ($m->{ReturnType} eq '~')) # destructor + { + # Remember whether we'll generate a switch entry for the destructor + $m->{SkipFromSwitch} = 1 unless ($classNode->{CanBeInstanciated} and $classNode->{HasPublicDestructor}); + next; + } + + # Don't generate bindings for protected methods (incl. signals) if + # we're not deriving from the C++ class. Only take public and public_slots + my $ok = ( $classNode->{BindingDerives} or $m->{Access} =~ /public/ ) ? 1 : 0; + + # Don't generate bindings for pure virtuals - we can't call them ;) + $ok = 0 if ( $ok && $m->{Flags} =~ "p" ); + + # Bugfix for Qt-3.0.4: those methods are NOT implemented (report sent). + $ok = 0 if ( $ok && $className eq 'QLineEdit' && ( $name eq 'setPasswordChar' || $name eq 'passwordChar' ) ); + $ok = 0 if ( $ok && $className eq 'QWidgetItem' && $name eq 'widgetSizeHint' ); + + if ( !$ok ) + { + #print STDERR "Skipping $className\::$name\n" if ($debug); + $m->{SkipFromSwitch} = 1; + next; + } + + my @args = @{ $m->{ParamList} }; + my $last = $m->{FirstDefaultParam}; + $last = scalar @args unless defined $last; + my $iterationCount = scalar(@args) - $last; + while($iterationCount >= 0) { + my $sig = methodSignature( $m, $#args ); + $classNode->{case}{$sig} = $methodNumber; + #print STDERR "prepareCaseDict: registered case number $methodNumber for $sig in $className()\n" if ($debug); + pop @args; + $iterationCount--; + $methodNumber++; + } + }, undef ); + + # Add the destructor, at the end + if ($classNode->{CanBeInstanciated} and $classNode->{HasPublicDestructor}) { + $classNode->{case}{"~$className()"} = $methodNumber; + # workaround for ~Sub::Class() being seen as Sub::~Class() + $classNode->{case}{"~$classNode->{astNodeName}()"} = $methodNumber; + #print STDERR "prepareCaseDict: registered case number $methodNumber for ~$className()\n" if ($debug); + } +} + +=head2 + Write out the smokedata.cpp file containing all the arrays. +=cut + +sub writeSmokeDataFile($) { + my $rootnode = shift; + + # Make list of classes + my %allIncludes; # list of all header files for all classes + my @classlist; + push @classlist, ""; # Prepend empty item for "no class" + my %enumclasslist; + Iter::LocalCompounds( $rootnode, sub { + my $classNode = $_[0]; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + push @classlist, $className; + $enumclasslist{$className}++ if keys %{$classNode->{enumerations}}; + $classNode->{ClassIndex} = $#classlist; + addIncludeForClass( $classNode, \%allIncludes, undef ); + } ); + + my %classidx = do { my $i = 0; map { $_ => $i++ } @classlist }; + + my $file = "$outputdir/smokedata.cpp"; + open OUT, ">$file" or die "Couldn't create $file\n"; + + foreach my $incl (sort{ + return 1 if $a=~/qmotif/; # move qmotif* at bottom (they include dirty X11 headers) + return -1 if $b=~/qmotif/; + $a cmp $b + } keys %allIncludes) { + die if $incl eq ''; + print OUT "#include <$incl>\n"; + } + + print OUT "\n"; + print OUT "#include <smoke.h>\n\n"; + print OUT "#include <qt_smoke.h>\n\n"; + + # gcc optimizes this method like crazy. switch() is godly + print OUT "static void *${libname}_cast(void *xptr, Smoke::Index from, Smoke::Index to) {\n"; + print OUT " switch(from) {\n"; + + print STDERR "Writing ${libname}_cast function\n" if ($debug); + + # Prepare descendants information for each class + my %descendants; # classname -> list of descendant nodes + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + # Get _all_ superclasses (up any number of levels) + # and store that $classNode is a descendant of $s + my @super = superclass_list($classNode); + for my $s (@super) { + my $superClassName = join( "::", kdocAstUtil::heritage($s) ); + Ast::AddPropList( \%descendants, $superClassName, $classNode ); + } + } ); + + # Iterate over all classes, to write the xtypecast function + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + # @super will contain superclasses, the class itself, and all descendants + my @super = superclass_list($classNode); + push @super, $classNode; + if ( defined $descendants{$className} ) { + push @super, @{$descendants{$className}}; + } + my $cur = $classidx{$className}; + print OUT " case $cur:\t//$className\n"; + print OUT "\tswitch(to) {\n"; + $cur = -1; + for my $s (@super) { + my $superClassName = join( "::", kdocAstUtil::heritage($s) ); + next if !defined $classidx{$superClassName}; # inherits from unknown class, see below + next if $classidx{$superClassName} == $cur; # shouldn't happen in Qt + $cur = $classidx{$superClassName}; + print OUT "\t case $cur: return (void*)($superClassName*)($className*)xptr;\n"; + } + print OUT "\t default: return xptr;\n"; + print OUT "\t}\n"; + } ); + print OUT " default: return xptr;\n"; + print OUT " }\n"; + print OUT "}\n\n"; + + + # Write inheritance array + # Imagine you have "Class : public super1, super2" + # The inheritlist array will get 3 new items: super1, super2, 0 + my %inheritfinder; # key = (super1, super2) -> data = (index in @inheritlist). This one allows reuse. + my %classinherit; # we store that index in %classinherit{className} + # We don't actually need to store inheritlist in memory, we write it + # directly to the file. We only need to remember its current size. + my $inheritlistsize = 1; + + print OUT "// Group of class IDs (0 separated) used as super class lists.\n"; + print OUT "// Classes with super classes have an index into this array.\n"; + print OUT "static short ${libname}_inheritanceList[] = {\n"; + print OUT "\t0,\t// 0: (no super class)\n"; + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "__", kdocAstUtil::heritage($classNode) ); + print STDERR "inheritanceList: looking at $className\n" if ($debug); + + # Make list of direct ancestors + my @super; + Iter::Ancestors( $classNode, $rootnode, undef, undef, sub { + my $superClassName = join( "::", kdocAstUtil::heritage($_[0]) ); + push @super, $superClassName; + }, undef ); + # Turn that into a list of class indexes + my $key = ''; + foreach my $superClass( @super ) { + if (defined $classidx{$superClass}) { + $key .= ', ' if ( length $key > 0 ); + $key .= $classidx{$superClass}; + } + } + if ( $key ne '' ) { + if ( !defined $inheritfinder{$key} ) { + print OUT "\t"; + my $index = $inheritlistsize; # Index of first entry (for this group) in inheritlist + foreach my $superClass( @super ) { + if (defined $classidx{$superClass}) { + print OUT "$classidx{$superClass}, "; + $inheritlistsize++; + } + } + $inheritlistsize++; + my $comment = join( ", ", @super ); + print OUT "0,\t// $index: $comment\n"; + $inheritfinder{$key} = $index; + } + $classinherit{$className} = $inheritfinder{$key}; + } else { # No superclass + $classinherit{$className} = 0; + } + } ); + print OUT "};\n\n"; + + + print OUT "// These are the xenum functions for manipulating enum pointers\n"; + for my $className (keys %enumclasslist) { + my $c = $className; + $c =~ s/::/__/g; + print OUT "void xenum_$c\(Smoke::EnumOperation, Smoke::Index, void*&, long&);\n"; + } + print OUT "\n"; + print OUT "// Those are the xcall functions defined in each x_*.cpp file, for dispatching method calls\n"; + my $firstClass = 1; + for my $className (@classlist) { + if ($firstClass) { + $firstClass = 0; + next; + } + my $c = $className; # make a copy + $c =~ s/::/__/g; + print OUT "void xcall_$c\(Smoke::Index, void*, Smoke::Stack);\n"; + } + print OUT "\n"; + + # Write class list afterwards because it needs offsets to the inheritance array. + print OUT "// List of all classes\n"; + print OUT "// Name, index into inheritanceList, method dispatcher, enum dispatcher, class flags\n"; + print OUT "static Smoke::Class ${libname}_classes[] = {\n"; + my $firstClass = 1; + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "__", kdocAstUtil::heritage($classNode) ); + + if ($firstClass) { + $firstClass = 0; + print OUT "\t{ 0L, 0, 0, 0, 0 }, \t// 0 (no class)\n"; + } + my $c = $className; + $c =~ s/::/__/g; + my $xcallFunc = "xcall_$c"; + my $xenumFunc = "0"; + $xenumFunc = "xenum_$c" if exists $enumclasslist{$className}; + # %classinherit needs Foo__Bar, not Foo::Bar? + die "problem with $className" unless defined $classinherit{$c}; + + my $xClassFlags = 0; + $xClassFlags .= "|Smoke::cf_constructor" if $classNode->{CanBeInstanciated}; # correct? + $xClassFlags .= "|Smoke::cf_deepcopy" if $classNode->{CanBeCopied}; # HasCopyConstructor would be wrong (when it's private) + $xClassFlags .= "|Smoke::cf_virtual" if hasVirtualDestructor($classNode) == 1; + # $xClassFlags .= "|Smoke::cf_undefined" if ...; + $xClassFlags =~ s/0\|//; # beautify + print OUT "\t{ \"$className\", $classinherit{$c}, $xcallFunc, $xenumFunc, $xClassFlags }, \t//$classidx{$className}\n"; + } ); + print OUT "};\n\n"; + + + print OUT "// List of all types needed by the methods (arguments and return values)\n"; + print OUT "// Name, class ID if arg is a class, and TypeId\n"; + print OUT "static Smoke::Type ${libname}_types[] = {\n"; + my $typeCount = 0; + $allTypes{''}{index} = 0; # We need an "item 0" + for my $type (sort keys %allTypes) { + $allTypes{$type}{index} = $typeCount; # Register proper index in allTypes + if ( $typeCount == 0 ) { + print OUT "\t{ 0, 0, 0 },\t//0 (no type)\n"; + $typeCount++; + next; + } + my $isEnum = $allTypes{$type}{isEnum}; + my $typeId; + my $typeFlags = $allTypes{$type}{typeFlags}; + my $realType = $allTypes{$type}{realType}; + die "$type" if !defined $typeFlags; + die "$realType" if $realType =~ /\(/; + # First write the name + print OUT "\t{ \"$type\", "; + # Then write the classId (and find out the typeid at the same time) + if(exists $classidx{$realType}) { # this one first, we want t_class for QBlah* + $typeId = 't_class'; + print OUT "$classidx{$realType}, "; + } + elsif($type =~ /&$/ || $type =~ /\*$/) { + $typeId = 't_voidp'; + print OUT "0, "; # no classId + } + elsif($isEnum || $allTypes{$realType}{isEnum}) { + $typeId = 't_enum'; + if($realType =~ /(.*)::/) { + my $c = $1; + if($classidx{$c}) { + print OUT "$classidx{$c}, "; + } else { + print OUT "0 /* unknown class $c */, "; + } + } else { + print OUT "0 /* unknown $realType */, "; # no classId + } + } + else { + $typeId = $typeunion{$realType}; + if (defined $typeId) { + $typeId =~ s/s_/t_/; # from s_short to t_short for instance + } + else { + # Not a known class - ouch, this happens quite a lot + # (private classes, typedefs, template-based types, etc) + if ( $skippedClasses{$realType} ) { +# print STDERR "$realType has been skipped, using t_voidp for it\n"; + } else { + unless( $realType =~ /</ ) { # Don't warn for template stuff... + print STDERR "$realType isn't a known type (type=$type)\n"; + } + } + $typeId = 't_voidp'; # Unknown -> map to a void * + } + print OUT "0, "; # no classId + } + # Then write the flags + die "$type" if !defined $typeId; + print OUT "Smoke::$typeId | $typeFlags },"; + print OUT "\t//$typeCount\n"; + $typeCount++; + # Remember it for coerce_type + $allTypes{$type}{typeId} = $typeId; + } + print OUT "};\n\n"; + + + my %arglist; # registers the needs for argumentList (groups of type ids) + my %methods; + # Look for all methods and all enums, in all classes + # And fill in methods and arglist. This loop writes nothing to OUT. + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + print STDERR "writeSmokeDataFile: arglist: looking at $className\n" if ($debug); + + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + my $methName = $m->{astNodeName}; + # For destructors, get a proper signature that includes the '~' + if ( $m->{ReturnType} eq '~' ) + { + $methName = '~' . $methName ; + # Let's even store that change, otherwise we have to do it many times + $m->{astNodeName} = $methName; + } + + if( $m->{NodeType} eq "enum" ) { + + foreach my $enum ( @{$m->{ParamList}} ) { + my $enumName = $enum->{ArgName}; + $methods{$enumName}++; + } + + } elsif ( $m->{NodeType} eq 'var' ) { + + $methods{$m->{astNodeName}}++; + + } elsif( $m->{NodeType} eq "method" ) { + + $methods{$methName}++; + my @protos; + makeprotos(\%classidx, $m, \@protos); + + #print "made @protos from $className $methName $m->{Signature})\n" if ($debug); + for my $p (@protos) { + $methods{$p}++; + my $argcnt = 0; + $argcnt = length($1) if $p =~ /([\$\#\?]+)/; + my $sig = methodSignature($m, $argcnt-1); + # Store in a class hash named "proto", a proto+signature => method association + $classNode->{proto}{$p}{$sig} = $m; + #$classNode->{signature}{$sig} = $p; + # There's probably a way to do this better, but this is the fastest way + # to get the old code going: store classname into method + $m->{class} = $className; + } + + my $firstDefaultParam = $m->{FirstDefaultParam}; + $firstDefaultParam = scalar(@{ $m->{ParamList} }) unless defined $firstDefaultParam; + my $argNames = ''; + my $args = ''; + for(my $i = 0; $i < @{ $m->{ParamList} }; $i++) { + $args .= ', ' if $i; + $argNames .= ', ' if $i; + my $argType = $m->{ParamList}[$i]{ArgType}; + my $typeEntry = findTypeEntry( $argType ); + $args .= defined $typeEntry ? $typeEntry->{index} : 0; + $argNames .= $argType; + + if($i >= ($firstDefaultParam - 1)) { + #print "arglist entry: $args\n"; + $arglist{$args} = $argNames; + } + + } + # create an entry for e.g. "arg0,arg1,arg2" where argN is index in allTypes of type for argN + # The value, $argNames, is temporarily stored, to be written out as comment + # It gets replaced with the index in the next loop. + #print "arglist entry : $args\n"; + $arglist{$args} = $argNames; + } + }, # end of sub + undef + ); + }); + + + $arglist{''} = 0; + # Print arguments array + print OUT "static Smoke::Index ${libname}_argumentList[] = {\n"; + my $argListCount = 0; + for my $args (sort keys %arglist) { + my $numTypes = scalar(split ',', $args); + if ($args eq '') { + print OUT "\t0,\t//0 (void)\n"; + } else { + # This is a nice trick : args can be written in one go ;) + print OUT "\t$args, 0,\t//$argListCount $arglist{$args} \n"; + } + $arglist{$args} = $argListCount; # Register proper index in argList + $argListCount += $numTypes + 1; # Move forward by as much as we wrote out + } + print OUT "};\n\n"; + + $methods{''} = 0; + my @methodlist = sort keys %methods; + my %methodidx = do { my $i = 0; map { $_ => $i++ } @methodlist }; + + print OUT "// Raw list of all methods, using munged names\n"; + print OUT "static const char *${libname}_methodNames[] = {\n"; + my $methodNameCount = $#methodlist; + for my $m (@methodlist) { + print OUT qq( "$m",\t//$methodidx{$m}\n); + } + print OUT "};\n\n"; + + print OUT "// (classId, name (index in methodNames), argumentList index, number of args, method flags, return type (index in types), xcall() index)\n"; + print OUT "static Smoke::Method ${libname}_methods[] = {\n"; + my @methods; + %allMethods = (); + my $methodCount = 0; + # Look at all classes and all enums again + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + my $classIndex = $classidx{$className}; + print STDERR "writeSmokeDataFile: methods: looking at $className\n" if ($debug); + + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + if( $m->{NodeType} eq "enum" ) { + + foreach my $enum ( @{$m->{ParamList}} ) { + my $enumName = $enum->{ArgName}; + my $fullEnumName = "$className\::$enumName"; + my $sig = "$className\::$enumName\()"; + my $xmethIndex = $methodidx{$enumName}; + die "'Method index' for enum $sig not found" unless defined $xmethIndex; + my $typeId = findTypeEntry( $fullEnumName )->{index}; + die "enum has no {case} value in $className: $fullEnumName" unless defined $classNode->{case}{$fullEnumName}; + print OUT "\t{$classIndex, $xmethIndex, 0, 0, Smoke::mf_static, $typeId, $classNode->{case}{$fullEnumName}},\t//$methodCount $fullEnumName (enum)\n"; + $allMethods{$sig} = $methodCount; + print STDERR "Added entry for " . $sig . " into \$allMethods\n" if ($debug); + $methods[$methodCount] = { + c => $classIndex, + methIndex => $xmethIndex, + argcnt => '0', + args => 0, + retTypeIndex => 0, + idx => $classNode->{case}{$fullEnumName} + }; + $methodCount++; + } + + } elsif( $m->{NodeType} eq 'var' ) { + + my $name = $m->{astNodeName}; + my $fullName = "$className\::$name"; + my $sig = "$fullName\()"; + my $xmethIndex = $methodidx{$name}; + die "'Method index' for var $sig not found" unless defined $xmethIndex; + my $varType = $m->{Type}; + $varType =~ s/static\s//; + $varType =~ s/const\s+(.*)\s*&/$1/; + $varType =~ s/\s*$//; + my $typeId = findTypeEntry( $varType )->{index}; + die "var has no {case} value in $className: $fullName" unless defined $classNode->{case}{$fullName}; + print OUT "\t{$classIndex, $xmethIndex, 0, 0, Smoke::mf_static, $typeId, $classNode->{case}{$fullName}},\t//$methodCount $fullName (static var)\n"; + $allMethods{$sig} = $methodCount; + print STDERR "Added entry for " . $sig . " into \$allMethods\n" if ($debug); + $methods[$methodCount] = { + c => $classIndex, + methIndex => $xmethIndex, + argcnt => '0', + args => 0, + retTypeIndex => 0, + idx => $classNode->{case}{$fullName} + }; + $methodCount++; + + + } elsif( $m->{NodeType} eq "method" ) { + + # We generate a method entry only if the method is in the switch() code + # BUT: for pure virtuals, they need to have a method entry, even though they + # do NOT have a switch code. + return if ( $m->{SkipFromSwitch} && $m->{Flags} !~ "p" ); + + # No switch code for destructors if we didn't derive from the class (e.g. it has private ctors only) + return if ( $m->{ReturnType} eq '~' && ! ( $classNode->{BindingDerives} and $classNode->{HasPublicDestructor}) ); + + # Is this sorting really important? + #for my $m (sort {$a->{name} cmp $b->{name}} @{ $self->{$c}{method} }) { + + my $methName = $m->{astNodeName}; + my $def = $m->{FirstDefaultParam}; + $def = scalar(@{ $m->{ParamList} }) unless defined $def; + my $last = scalar(@{ $m->{ParamList} }) - 1; + #print STDERR "writeSmokeDataFile: methods: generating for method $methName, def=$def last=$last\n" if ($debug); + + while($last >= ($def-1)) { + last if $last < -1; + my $args = [ @{ $m->{ParamList} }[0..$last] ]; + my $sig = methodSignature($m, $last); + #my $methodSig = $classNode->{signature}{$sig}; # Munged signature + #print STDERR "writeSmokeDataFile: methods: sig=$className\::$sig methodSig=$methodSig\n" if ($debug); + #my $methodIndex = $methodidx{$methodSig}; + #die "$methodSig" if !defined $methodIndex; + + my $methodIndex = $methodidx{$methName}; + die "$methName" if !defined $methodIndex; + my $case = $classNode->{case}{$sig}; + my $typeEntry = findTypeEntry( $m->{ReturnType} ); + my $retTypeIndex = defined $typeEntry ? $typeEntry->{index} : 0; + + my $i = 0; + my $t = ''; + for my $arg (@$args) { + $t .= ', ' if $i++; + my $typeEntry = findTypeEntry( $arg->{ArgType} ); + $t .= defined $typeEntry ? $typeEntry->{index} : 0; + } + my $arglist = $t eq '' ? 0 : $arglist{$t}; + die "arglist for $t not found" unless defined $arglist; + if ( $m->{Flags} =~ "p" ) { + # Pure virtuals don't have a {case} number, that's normal + die if defined $case; + $case = -1; # This remains -1, not 0 ! + } else { + die "$className\::$methName has no case number for sig=$sig" unless defined $case; + } + my $argcnt = $last + 1; + my $methodFlags = '0'; + $methodFlags .= "|Smoke::mf_static" if $m->{Flags} =~ "s"; + $methodFlags .= "|Smoke::mf_const" if $m->{Flags} =~ "c"; # useful?? probably not + $methodFlags =~ s/0\|//; # beautify + + print OUT "\t{$classIndex, $methodIndex, $arglist, $argcnt, $methodFlags, $retTypeIndex, $case},\t//$methodCount $className\::$sig"; + print OUT " [pure virtual]" if ( $m->{Flags} =~ "p" ); # explain why $case = -1 ;) + print OUT "\n"; + + $allMethods{$className . "::" . $sig} = $methodCount; + $methods[$methodCount] = { + c => $classIndex, + methIndex => $methodIndex, + argcnt => $argcnt, + args => $arglist, + retTypeIndex => $retTypeIndex, + idx => $case + }; + $methodCount++; + $last--; + } # while + } # if method + } ); # Method Iter + } ); # Class Iter + print OUT "};\n\n"; + + my @protos; + Iter::LocalCompounds( $rootnode, sub { + my $classNode = shift; + my $className = join( "::", kdocAstUtil::heritage($classNode) ); + my $classIndex = $classidx{$className}; + print STDERR "writeSmokeDataFile: protos: looking at $className\n" if ($debug); + + Iter::MembersByType ( $classNode, undef, + sub { my ($classNode, $m ) = @_; + + if( $m->{NodeType} eq "enum" ) { + foreach my $enum ( @{$m->{ParamList}} ) { + my $enumName = $enum->{ArgName}; + my $sig = "$className\::$enumName\()"; + my $xmeth = $allMethods{$sig}; + die "'Method' for enum $sig not found" unless defined $xmeth; + my $xmethIndex = $methodidx{$enumName}; + die "'Method index' for enum $enumName not found" unless defined $xmethIndex; + push @protos, { + methIndex => $xmethIndex, + c => $classIndex, + over => { + $sig => { + sig => $sig, + } + }, + meth => $xmeth + }; + } + + } elsif( $m->{NodeType} eq 'var' ) { + + my $name = $m->{astNodeName}; + my $fullName = "$className\::$name"; + my $sig = "$fullName\()"; + my $xmeth = $allMethods{$sig}; + die "'Method' for var $sig not found" unless defined $xmeth; + my $xmethIndex = $methodidx{$name}; + die "'Method index' for var $name not found" unless defined $xmethIndex; + push @protos, { + methIndex => $xmethIndex, + c => $classIndex, + over => { + $sig => { + sig => $sig, + } + }, + meth => $xmeth + }; + + } + }); + + for my $p (keys %{ $classNode->{proto} }) { + # For each prototype + my $scratch = { %{ $classNode->{proto}{$p} } }; # sig->method association + # first, grab all the superclass voodoo + for my $supNode (superclass_list($classNode)) { + my $i = $supNode->{proto}{$p}; + next unless $i; + for my $k (keys %$i) { + $scratch->{$k} = $i->{$k} unless exists $scratch->{$k}; + } + } + + # Ok, now we have a full list + #if(scalar keys %$scratch > 1) { + #print STDERR "Overload: $p (@{[keys %$scratch]})\n" if ($debug); + #} + my $xmethIndex = $methodidx{$p}; + my $classIndex = $classidx{$className}; + for my $sig (keys %$scratch) { + #my $xsig = $scratch->{$sig}{class} . "::" . $sig; + my $xsig = $className . "::" . $sig; + $scratch->{$sig}{sig} = $xsig; + delete $scratch->{$sig} + if $scratch->{$sig}{Flags} =~ "p" # pure virtual + or not exists $allMethods{$xsig}; + } + push @protos, { + methIndex => $xmethIndex, + c => $classIndex, + over => $scratch + } if scalar keys %$scratch; + } + }); + + my @protolist = sort { $a->{c} <=> $b->{c} || $a->{methIndex} <=> $b->{methIndex} } @protos; +#for my $abc (@protos) { +#print "$abc->{methIndex}.$abc->{c}\n"; +#} + + print STDERR "Writing methodmap table\n" if ($debug); + my @resolve = (); + print OUT "// Class ID, munged name ID (index into methodNames), method def (see methods) if >0 or number of overloads if <0\n"; + my $methodMapCount = 1; + print OUT "static Smoke::MethodMap ${libname}_methodMaps[] = {\n"; + print OUT "\t{ 0, 0, 0 },\t//0 (no method)\n"; + for my $cur (@protolist) { + if(scalar keys %{ $cur->{over} } > 1) { + print OUT "\t{$cur->{c}, $cur->{methIndex}, -@{[1+scalar @resolve]}},\t//$methodMapCount $classlist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n"; + $methodMapCount++; + for my $k (keys %{ $cur->{over} }) { + my $p = $cur->{over}{$k}; + my $xsig = $p->{class} ? "$p->{class}\::$k" : $p->{sig}; + push @resolve, { k => $k, p => $p, cur => $cur, id => $allMethods{$xsig} }; + } + push @resolve, 0; + } else { + for my $k (keys %{ $cur->{over} }) { + my $p = $cur->{over}{$k}; + my $xsig = $p->{class} ? "$p->{class}\::$k" : $p->{sig}; + print OUT "\t{$cur->{c}, $cur->{methIndex}, $allMethods{$xsig}},\t//$methodMapCount $classlist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n"; + $methodMapCount++; + } + } + } + print OUT "};\n\n"; + + + print STDERR "Writing ambiguousMethodList\n" if ($debug); + print OUT "static Smoke::Index ${libname}_ambiguousMethodList[] = {\n"; + print OUT " 0,\n"; + for my $r (@resolve) { + unless($r) { + print OUT " 0,\n"; + next; + } + my $xsig = $r->{p}{class} ? "$r->{p}{class}\::$r->{k}" : $r->{p}{sig}; + die "ambiguousMethodList: no method found for $xsig\n" if !defined $allMethods{$xsig}; + print OUT " $allMethods{$xsig}, // $xsig\n"; + } + print OUT "};\n\n"; + +# print OUT "extern \"C\" { // needed?\n"; +# print OUT " void init_${libname}_Smoke();\n"; +# print OUT "}\n"; + print OUT "\n"; + print OUT "Smoke* qt_Smoke = 0L;\n"; + print OUT "\n"; + print OUT "// Create the Smoke instance encapsulating all the above.\n"; + print OUT "void init_${libname}_Smoke() {\n"; + print OUT " qt_Smoke = new Smoke(\n"; + print OUT " ${libname}_classes, ".$#classlist.",\n"; + print OUT " ${libname}_methods, $methodCount,\n"; + print OUT " ${libname}_methodMaps, $methodMapCount,\n"; + print OUT " ${libname}_methodNames, $methodNameCount,\n"; + print OUT " ${libname}_types, $typeCount,\n"; + print OUT " ${libname}_inheritanceList,\n"; + print OUT " ${libname}_argumentList,\n"; + print OUT " ${libname}_ambiguousMethodList,\n"; + print OUT " ${libname}_cast );\n"; + print OUT "}\n"; + close OUT; + +#print "@{[keys %allMethods ]}\n"; +} + +1; diff --git a/kalyptus/kalyptusDataDict.pm b/kalyptus/kalyptusDataDict.pm new file mode 100644 index 0000000..0de2480 --- /dev/null +++ b/kalyptus/kalyptusDataDict.pm @@ -0,0 +1,3042 @@ +#*************************************************************************** +# kalyptusDataDict.pm - A Qt/KDE types data dictionary +# ------------------- +# begin : Fri Oct 20 12:00:00 2000 +# copyright : (C) 2000-2001 Lost Highway Ltd. All Rights Reserved. +# email : Richard_Dale@tipitina.demon.co.uk +# author : Richard Dale. +#***************************************************************************/ + +#/*************************************************************************** +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation; either version 2 of the License, or * +# * (at your option) any later version. * +# * * +#***************************************************************************/ + +package kalyptusDataDict; + +use strict; +no strict "subs"; + +use vars qw/ %interfacemap %ctypemap %builtins /; + +BEGIN +{ + +%interfacemap = ( +'QPaintDevice' => 'QPaintDeviceInterface', +'QMenuData' => 'QMenuDataInterface', +'QRangeControl' => 'QRangeControlInterface', +'QMimeSource' => 'QMimeSourceInterface', +'QLayoutItem' => 'QLayoutItemInterface', +'QUrl' => 'QUrlInterface', +'QIODevice' => 'QIODeviceInterface', +'QXmlContentHandler' => 'QXmlContentHandlerInterface', +'QXmlErrorHandler' => 'QXmlErrorHandlerInterface', +'QXmlDTDHandler' => 'QXmlDTDHandlerInterface', +'QXmlEntityResolver' => 'QXmlEntityResolverInterface', +'QXmlLexicalHandler' => 'QXmlLexicalHandlerInterface', +'QXmlDeclHandler' => 'QXmlDeclHandlerInterface', +'KInstance' => 'KInstanceInterface', +'QwAbsSpriteFieldView' => 'QwAbsSpriteFieldViewInterface', +'PartBase' => 'PartBaseInterface', +'KCompletionBase' => 'KCompletionBaseInterface', +'KDirNotify' => 'KDirNotifyInterface', +'KXMLGUIClient' => 'KXMLGUIClientInterface', +'KFileView' => 'KFileViewInterface', +'KXMLGUIBuilder' => 'KXMLGUIBuilderInterface', +'DCOPObject' => 'DCOPObjectInterface', +'KDevCore' => 'KDevCoreInterface', +'QSqlQuery' => 'QSqlQueryInterface', + +); + +# A hard coded type translation table (the idea from the Roberto Alsina's Qtc +# python conversion scripts). The particular format used here makes it possible to use +# the same table with three different kdoc based Qt/KDE language binding generators; +# C, Objective-C and Java. +%ctypemap = ( + +'ASConsumer*' => 'kde_ASConsumer*', +'ASProducer*' => 'kde_ASProducer*', +'ASYNC' => 'void' , +'Address&' => 'kde_Address*' , +'Address*' => 'kde_Address*', +'AddressBook*' => 'kde_AddressBook*', +'AddressBook::Entry&' => 'kde_Entry*' , +'Addressee&' => 'kde_Addressee*', +'Addressee*' => 'kde_Addressee*', +'AddresseeData*' => 'kde_AddresseeData*', +'AddresseeDialog*' => 'kde_AddresseeDialog*', +'AddresseeItem*' => 'kde_AddresseeItem*', +'AlsaOut*' => 'kde_AlsaOut*', +'AnyConstRef&' => 'kde_AnyConstRef*', +'AnyConstRef*' => 'kde_AnyConstRef*', +'AnyRef&' => 'kde_AnyRef*', +'AnyRef*' => 'kde_AnyRef*', +'AnyRefBase&' => 'kde_AnyRefBase*', +'AnyRefBase*' => 'kde_AnyRefBase*', +'ArgList' => 'int' , +'ArrowType' => 'int' , +'Arts*' => 'kde_Arts*', +'Arts::AudioManagerClient' => 'int', +'Arts::Buffer&' => 'kde_Arts_Buffer*', +'Arts::Buffer*' => 'kde_Arts_Buffer*', +'Arts::ByteSoundProducer' => 'kde_Arts_ByteSoundProducer*', +'Arts::Connection*' => 'kde_Arts_Connection*', +'Arts::DynamicCast&' => 'kde_Arts_DynamicCast*', +'Arts::FlowSystemReceiver' => 'kde_Arts_FlowSystemReceiver*', +'Arts::FlowSystemSender' => 'kde_Arts_FlowSystemSender*', +'Arts::Format&' => 'kde_Arts_Format*', +'Arts::Format' => 'kde_Arts_Format', +'Arts::GenericAsyncStream*' => 'kde_Arts_GenericAsyncStream*', +'Arts::GenericDataChannel*' => 'kde_Arts_GenericDataChannel*', +'Arts::InterfaceDef' => 'kde_Arts_InterfaceDef*', +'Arts::MethodDef&' => 'kde_Arts_MethodDef*', +'Arts::ModuleDef&' => 'kde_Arts_ModuleDef*', +'Arts::Notification&' => 'kde_Arts_Notification*', +'Arts::Object' => 'kde_Arts_Object*', +'Arts::Object::Pool&' => 'kde_Arts_Object_Pool*', +'Arts::ObjectReference' => 'kde_Arts_ObjectReference*', +'Arts::PlayObject' => 'kde_Arts_PlayObject*', +'Arts::Reference&' => 'kde_Arts_Reference*', +'Arts::StereoEffect' => 'kde_Arts_StereoEffect*', +'Arts::StereoEffectStack' => 'kde_Arts_StereoEffectStack*', +'Arts::SubClass&' => 'kde_Arts_SubClass*', +'Arts::TypeDef' => 'kde_Arts_TypeDef*', +'Arts::poTime&' => 'kde_Arts_poTime*', +'Arts::poTime' => 'kde_Arts_poTime', +'AsyncStream*' => 'kde_AsyncStream*', +'Attr&' => 'kde_Attr*', +'Attr' => 'kde_Attr*', +'Attr*' => 'kde_Attr*', +'AttrImpl*' => 'kde_AttrImpl*', +'AttributeDef&' => 'kde_AttributeDef*', +'AttributeDef*' => 'kde_AttributeDef*', +'AudioManager&' => 'kde_AudioManager*', +'AudioManager' => 'kde_AudioManager*', +'AudioManager*' => 'kde_AudioManager*', +'AudioManagerClient&' => 'kde_AudioManagerClient*', +'AudioManagerClient' => 'kde_AudioManagerClient*', +'AudioManagerClient*' => 'kde_AudioManagerClient*', +'AudioManagerClient_base*' => 'kde_AudioManagerClient_base*', +'AudioManagerClient_skel*' => 'kde_AudioManagerClient_skel*', +'AudioManagerClient_stub*' => 'kde_AudioManagerClient_stub*', +'AudioManagerInfo&' => 'kde_AudioManagerInfo*', +'AudioManagerInfo*' => 'kde_AudioManagerInfo*', +'AudioManager_base*' => 'kde_AudioManager_base*', +'AudioManager_skel*' => 'kde_AudioManager_skel*', +'AudioManager_stub*' => 'kde_AudioManager_stub*', +'AudioPort*' => 'kde_AudioPort*', +'AudioSubSystem*' => 'kde_AudioSubSystem*', +'AudioSubSystemStart*' => 'kde_AudioSubSystemStart*', +'AuthAccept&' => 'kde_AuthAccept*', +'AuthAccept*' => 'kde_AuthAccept*', +'AuthInfo&' => 'kde_AuthInfo*', +'AuthInfo*' => 'kde_AuthInfo*', +'BGMode' => 'int', +'BMToken*' => 'kde_BMToken*', +'BackgroundMode' => 'int', +'BlockSelectionInterface*' => 'kde_BlockSelectionInterface*', +'BookmarkTokenizer*' => 'kde_BookmarkTokenizer*', +'Bool' => 'int' , +'Boolean&' => 'kde_Boolean*', +'Boolean*' => 'kde_Boolean*', +'BrowserExtension*' => 'kde_BrowserExtension*', +'BrowserHostExtension*' => 'kde_BrowserHostExtension*', +'BrowserInterface*' => 'kde_BrowserInterface*', +'BrushStyle' => 'int', +'Buffer&' => 'kde_Buffer*', +'Buffer*' => 'kde_Buffer*', +'ButtonCode' => 'int' , +'ButtonState' => 'int' , +'ByteAsyncStream*' => 'kde_ByteAsyncStream*', +'ByteDataPacket*' => 'kde_ByteDataPacket*', +'ByteSoundProducer&' => 'kde_ByteSoundProducer*', +'ByteSoundProducer' => 'kde_ByteSoundProducer*', +'ByteSoundProducer*' => 'kde_ByteSoundProducer*', +'ByteSoundProducer_base*' => 'kde_ByteSoundProducer_base*', +'ByteSoundProducer_skel*' => 'kde_ByteSoundProducer_skel*', +'ByteSoundProducer_stub*' => 'kde_ByteSoundProducer_stub*', +'ByteStreamToAudio&' => 'kde_ByteStreamToAudio*', +'ByteStreamToAudio' => 'kde_ByteStreamToAudio*', +'ByteStreamToAudio*' => 'kde_ByteStreamToAudio*', +'ByteStreamToAudio_base*' => 'kde_ByteStreamToAudio_base*', +'ByteStreamToAudio_skel*' => 'kde_ByteStreamToAudio_skel*', +'ByteStreamToAudio_stub*' => 'kde_ByteStreamToAudio_stub*', +'CDATASection&' => 'kde_CDATASection*', +'CDATASection' => 'kde_CDATASection*', +'CDATASection*' => 'kde_CDATASection*', +'CFlags' => 'int', +'COORD' => 'short' , +'CSSCharsetRule&' => 'kde_CSSCharsetRule*', +'CSSCharsetRule*' => 'kde_CSSCharsetRule*', +'CSSCharsetRuleImpl*' => 'kde_CSSCharsetRuleImpl*', +'CSSException&' => 'kde_CSSException*', +'CSSException*' => 'kde_CSSException*', +'CSSFontFaceRule&' => 'kde_CSSFontFaceRule*', +'CSSFontFaceRule*' => 'kde_CSSFontFaceRule*', +'CSSFontFaceRuleImpl*' => 'kde_CSSFontFaceRuleImpl*', +'CSSImportRule&' => 'kde_CSSImportRule*', +'CSSImportRule*' => 'kde_CSSImportRule*', +'CSSImportRuleImpl*' => 'kde_CSSImportRuleImpl*', +'CSSMediaRule&' => 'kde_CSSMediaRule*', +'CSSMediaRule*' => 'kde_CSSMediaRule*', +'CSSMediaRuleImpl*' => 'kde_CSSMediaRuleImpl*', +'CSSPageRule&' => 'kde_CSSPageRule*', +'CSSPageRule*' => 'kde_CSSPageRule*', +'CSSPageRuleImpl*' => 'kde_CSSPageRuleImpl*', +'CSSPrimitiveValue&' => 'kde_CSSPrimitiveValue*', +'CSSPrimitiveValue' => 'kde_CSSPrimitiveValue*', +'CSSPrimitiveValue*' => 'kde_CSSPrimitiveValue*', +'CSSPrimitiveValueImpl*' => 'kde_CSSPrimitiveValueImpl*', +'CSSRule&' => 'kde_CSSRule*', +'CSSRule' => 'kde_CSSRule*', +'CSSRule*' => 'kde_CSSRule*', +'CSSRuleImpl*' => 'kde_CSSRuleImpl*', +'CSSRuleList&' => 'kde_CSSRuleList*', +'CSSRuleList' => 'kde_CSSRuleList*', +'CSSRuleList*' => 'kde_CSSRuleList*', +'CSSRuleListImpl*' => 'kde_CSSRuleListImpl*', +'CSSStyleDeclaration&' => 'kde_CSSStyleDeclaration*', +'CSSStyleDeclaration' => 'kde_CSSStyleDeclaration*', +'CSSStyleDeclaration*' => 'kde_CSSStyleDeclaration*', +'CSSStyleDeclarationImpl*' => 'kde_CSSStyleDeclarationImpl*', +'CSSStyleRule&' => 'kde_CSSStyleRule*', +'CSSStyleRule*' => 'kde_CSSStyleRule*', +'CSSStyleRuleImpl*' => 'kde_CSSStyleRuleImpl*', +'CSSStyleSheet&' => 'kde_CSSStyleSheet*', +'CSSStyleSheet' => 'kde_CSSStyleSheet*', +'CSSStyleSheet*' => 'kde_CSSStyleSheet*', +'CSSStyleSheetImpl*' => 'kde_CSSStyleSheetImpl*', +'CSSUnknownRule&' => 'kde_CSSUnknownRule*', +'CSSUnknownRule*' => 'kde_CSSUnknownRule*', +'CSSUnknownRuleImpl*' => 'kde_CSSUnknownRuleImpl*', +'CSSValue&' => 'kde_CSSValue*', +'CSSValue' => 'kde_CSSValue*', +'CSSValue*' => 'kde_CSSValue*', +'CSSValueImpl*' => 'kde_CSSValueImpl*', +'CSSValueList&' => 'kde_CSSValueList*', +'CSSValueList*' => 'kde_CSSValueList*', +'CSSValueListImpl*' => 'kde_CSSValueListImpl*', +'CString&' => 'kde_CString*', +'CString' => 'kde_CString*', +'CString*' => 'kde_CString*', +'Cache*' => 'kde_Cache*', +'CacheInfo*' => 'kde_CacheInfo*', +'CachedObject*' => 'kde_CachedObject*', +'CachedWav*' => 'kde_CachedWav*', +'Cardinal' => 'int' , +'CharSet' => 'int', +'CharacterData&' => 'kde_CharacterData*', +'CharacterData*' => 'kde_CharacterData*', +'CharacterDataImpl*' => 'kde_CharacterDataImpl*', +'ChmodJob*' => 'kde_ChmodJob*', +'ClassInfo*' => 'kde_ClassInfo*', +'ClassStore*' => 'kde_ClassStore*', +'ClassTreeNode*' => 'kde_ClassTreeNode*', +'ClientHello&' => 'kde_ClientHello*', +'ClientHello*' => 'kde_ClientHello*', +'ClipboardInterface*' => 'kde_ClipboardInterface*', +'CodeCompletionInterface*' => 'kde_CodeCompletionInterface*', +'ColorMode' => 'int', +'Comment&' => 'kde_Comment*', +'Comment' => 'kde_Comment*', +'Comment*' => 'kde_Comment*', +'CommentImpl*' => 'kde_CommentImpl*', +'ComparisonFlags' => 'int', +'Compl' => 'kde_Compl', +'Completion&' => 'kde_Completion*', +'Completion*' => 'kde_Completion*', +'CompletionEntry&' => 'kde_CompletionEntry*', +'CompletionEntry*' => 'kde_CompletionEntry*', +'ComplexControl' => 'int', +'ComponentFactory*' => 'kde_ComponentFactory*', +'ConfigInterface*' => 'kde_ConfigInterface*', +'Connection*' => 'kde_Connection*', +'ConstIterator' => 'int' , +'Constructor' => 'kde_Constructor*', +'Constructor*' => 'kde_Constructor*', +'ConstructorImp*' => 'kde_ConstructorImp*', +'ContentsType' => 'int', +'Context&' => 'kde_Context*', +'Context*' => 'kde_Context*', +'ControlElement' => 'int', +'CopyInfo*' => 'kde_CopyInfo*', +'CopyJob*' => 'kde_CopyJob*', +'Core*' => 'kde_Core*', +'Counter&' => 'kde_Counter*', +'Counter' => 'kde_Counter*', +'Counter*' => 'kde_Counter*', +'Cursor*' => 'kde_Cursor*', +'CursorInterface*' => 'kde_CursorInterface*', +'DCOPClient*' => 'kde_DCOPClient*', +'DCOPClientTransaction*' => 'kde_DCOPClientTransaction*' , +'DCOPObject*' => 'kde_DCOPObject*', +'DCOPObjectProxy*' => 'kde_DCOPObjectProxy*', +'DCOPRef&' => 'kde_DCOPRef*' , +'DCOPRef*' => 'kde_DCOPRef*', +'DCOPStub*' => 'kde_DCOPStub*', +'DOM*' => 'kde_DOM*', +'DOM::CSSProperty*' => 'kde_CSSProperty*' , +'DOM::DOMString&' => 'kde_DOMString*' , +'DOM::DOMString' => 'kde_DOMString*' , +'DOM::Document&' => 'kde_DOMDocument*' , +'DOM::Document' => 'kde_DOMDocument*' , +'DOM::Document*' => 'kde_DOMDocument*' , +'DOM::ElementImpl*' => 'kde_DOM_ElementImpl*' , +'DOM::HTMLDocument' => 'kde_HTMLDocument*' , +'DOM::MediaList&' => 'kde_MediaList*', +'DOM::MediaList' => 'kde_MediaList', +'DOM::MediaList*' => 'kde_MediaList*', +'DOM::Node&' => 'kde_DOMNode*' , +'DOM::Node' => 'kde_DOMNode*' , +'DOM::NodeList&' => 'kde_DOMNodeList*', +'DOM::NodeList' => 'kde_DOMNodeList*', +'DOM::NodeList*' => 'kde_DOMNodeList*', +'DOM::Range' => 'kde_Range*' , +'DOM::StyleSheetList&' => 'kde_StyleSheetList*', +'DOM::StyleSheetList' => 'kde_StyleSheetList', +'DOM::StyleSheetList*' => 'kde_StyleSheetList*', +'DOMException&' => 'kde_DOMException*', +'DOMException*' => 'kde_DOMException*', +'DOMImplementation&' => 'kde_DOMImplementation*', +'DOMImplementation' => 'kde_DOMImplementation*', +'DOMImplementation*' => 'kde_DOMImplementation*', +'DOMImplementationImpl*' => 'kde_DOMImplementationImpl*', +'DOMString&' => 'kde_DOMString*', +'DOMString' => 'kde_DOMString*', +'DOMString*' => 'kde_DOMString*', +'DOMStringImpl*' => 'kde_DOMStringImpl*', +'DW_EXPORT*' => 'void*', +'DataPacket*' => 'kde_DataPacket*', +'DateFormat' => 'int', +'Debug*' => 'kde_Debug*', +'DecoderFn' => 'int' , +'DefaultProgress*' => 'kde_DefaultProgress*', +'DeleteJob*' => 'kde_DeleteJob*', +'DeviceManager*' => 'kde_DeviceManager*', +'Direction' => 'int', +'DispatchFunction' => 'kde_DispatchFunction*', +'Dispatcher*' => 'kde_Dispatcher*', +'Display' => 'Display', +'Display*' => 'Display*', +'DistributionList*' => 'kde_DistributionList*', +'DistributionListEditor*' => 'kde_DistributionListEditor*', +'DistributionListManager*' => 'kde_DistributionListManager*', +'Dock&' => 'int', +'Dock' => 'int', +'DockMainWindow*' => 'kde_DockMainWindow*', +'DockPosData&' => 'kde_DockPosData*' , +'DockPosData*' => 'kde_DockPosData*', +'DockWindowData*' => 'long', +'Document&' => 'kde_Document*', +'Document' => 'kde_Document*', +'Document*' => 'kde_Document*', +'DocumentFragment&' => 'kde_DocumentFragment*', +'DocumentFragment' => 'kde_DocumentFragment*', +'DocumentFragment*' => 'kde_DocumentFragment*', +'DocumentFragmentImpl*' => 'kde_DocumentFragmentImpl*', +'DocumentImpl*' => 'kde_DocumentImpl*', +'DocumentStyle&' => 'kde_DocumentStyle*', +'DocumentStyle*' => 'kde_DocumentStyle*', +'DocumentType&' => 'kde_DocumentType*', +'DocumentType' => 'kde_DocumentType*', +'DocumentType*' => 'kde_DocumentType*', +'DocumentationContext*' => 'kde_DocumentationContext*', +'DomShared*' => 'kde_DomShared*', +'DrageMode' => 'int', +'DrawContentsEvent*' => 'kde_DrawContentsEvent*', +'DwAddress&' => 'kde_DwAddress*', +'DwAddress*' => 'kde_DwAddress*', +'DwAddressList&' => 'kde_DwAddressList*', +'DwAddressList*' => 'kde_DwAddressList*', +'DwBody&' => 'kde_DwBody*', +'DwBody*' => 'kde_DwBody*', +'DwBodyPart&' => 'kde_DwBodyPart*', +'DwBodyPart*' => 'kde_DwBodyPart*', +'DwBool' => 'int', +'DwDateTime&' => 'kde_DwDateTime*', +'DwDateTime*' => 'kde_DwDateTime*', +'DwDispositionType&' => 'kde_DwDispositionType*', +'DwDispositionType*' => 'kde_DwDispositionType*', +'DwEntity&' => 'kde_DwEntity*', +'DwField&' => 'kde_DwField*', +'DwField*' => 'kde_DwField*', +'DwFieldBody&' => 'kde_DwFieldBody*', +'DwFieldBody*' => 'kde_DwFieldBody*', +'DwGroup&' => 'kde_DwGroup*', +'DwGroup*' => 'kde_DwGroup*', +'DwHeaders&' => 'kde_DwHeaders*', +'DwHeaders*' => 'kde_DwHeaders*', +'DwInt32' => 'int', +'DwMailbox&' => 'kde_DwMailbox*', +'DwMailbox*' => 'kde_DwMailbox*', +'DwMailboxList&' => 'kde_DwMailboxList*', +'DwMailboxList*' => 'kde_DwMailboxList*', +'DwMechanism&' => 'kde_DwMechanism*', +'DwMechanism*' => 'kde_DwMechanism*', +'DwMediaType&' => 'kde_DwMediaType*', +'DwMediaType*' => 'kde_DwMediaType*', +'DwMessage&' => 'kde_DwMessage*', +'DwMessage*' => 'kde_DwMessage*', +'DwMessageComponent&' => 'kde_DwMessageComponent*', +'DwMessageComponent*' => 'kde_DwMessageComponent*', +'DwMime*' => 'kde_DwMime*', +'DwMsgId&' => 'kde_DwMsgId*', +'DwMsgId*' => 'kde_DwMsgId*', +'DwObserver*' => 'kde_DwObserver*', +'DwParameter&' => 'kde_DwParameter*', +'DwParameter*' => 'kde_DwParameter*', +'DwProtocolClient*' => 'kde_DwProtocolClient*', +'DwString&' => 'kde_DwString*', +'DwString' => 'kde_DwString', +'DwString*' => 'kde_DwString*', +'DwText&' => 'kde_DwText*', +'DwText*' => 'kde_DwText*', +'DwTokenizer&' => 'kde_DwTokenizer*', +'DwUint16' => 'unsigned short', +'DwUint32' => 'unsigned int', +'DwUint8' => 'unsigned char', +'DynamicCast*' => 'kde_DynamicCast*', +'DynamicRequest&' => 'kde_DynamicRequest*', +'DynamicRequest*' => 'kde_DynamicRequest*', +'EXPORT_DOCKCLASS*' => 'kde_EXPORT_DOCKCLASS*', +'EchoMode' => 'int', +'EditInterface*' => 'kde_EditInterface*', +'Editor*' => 'kde_Editor*', +'EditorContext*' => 'kde_EditorContext*', +'Element&' => 'kde_Element*', +'Element' => 'kde_Element*', +'Element*' => 'kde_Element*', +'ElementImpl*' => 'kde_ElementImpl*', +'EmailSelectDialog*' => 'kde_EmailSelectDialog*', +'EncoderFn' => 'int' , +'Endian' => 'int', +'Entity&' => 'kde_Entity*', +'Entity*' => 'kde_Entity*', +'EntityReference&' => 'kde_EntityReference*', +'EntityReference' => 'kde_EntityReference*', +'EntityReference*' => 'kde_EntityReference*', +'Entry&' => 'kde_Entry*' , +'Entry*' => 'kde_Entry*', +'Entry::Address&' => 'kde_EntryAddress' , +'EnumComponent&' => 'kde_EnumComponent*', +'EnumComponent*' => 'kde_EnumComponent*', +'EnumDef&' => 'kde_EnumDef*', +'EnumDef*' => 'kde_EnumDef*', +'EnumEntry*' => 'kde_EnumEntry*', +'Error*' => 'kde_Error*', +'Event*' => 'kde_Event*', +'ExecState*' => 'kde_ExecState*', +'ExtensionLoader*' => 'kde_ExtensionLoader*', +'FALSE' => '0', +'FILE*' => 'FILE*', +'FMOut*' => 'kde_FMOut*', +'Factory*' => 'kde_Factory*', +'False' => '0', +'FileCopyJob*' => 'kde_FileCopyJob*', +'FileProtocol*' => 'kde_FileProtocol*', +'FileView&' => 'int' , +'FloatAsyncStream*' => 'kde_FloatAsyncStream*', +'FloatDataPacket*' => 'kde_FloatDataPacket*', +'FlowSystem&' => 'kde_FlowSystem*', +'FlowSystem' => 'kde_FlowSystem*', +'FlowSystem*' => 'kde_FlowSystem*', +'FlowSystemReceiver&' => 'kde_FlowSystemReceiver*', +'FlowSystemReceiver' => 'kde_FlowSystemReceiver*', +'FlowSystemReceiver*' => 'kde_FlowSystemReceiver*', +'FlowSystemReceiver_base*' => 'kde_FlowSystemReceiver_base*', +'FlowSystemReceiver_skel*' => 'kde_FlowSystemReceiver_skel*', +'FlowSystemReceiver_stub*' => 'kde_FlowSystemReceiver_stub*', +'FlowSystemSender&' => 'kde_FlowSystemSender*', +'FlowSystemSender' => 'kde_FlowSystemSender*', +'FlowSystemSender*' => 'kde_FlowSystemSender*', +'FlowSystemSender_base*' => 'kde_FlowSystemSender_base*', +'FlowSystemSender_skel*' => 'kde_FlowSystemSender_skel*', +'FlowSystemSender_stub*' => 'kde_FlowSystemSender_stub*', +'FlowSystem_base*' => 'kde_FlowSystem_base*', +'FlowSystem_impl*' => 'kde_FlowSystem_impl*', +'FlowSystem_skel*' => 'kde_FlowSystem_skel*', +'FlowSystem_stub*' => 'kde_FlowSystem_stub*', +'FocusPolicy' => 'int', +'Format&' => 'kde_Format*', +'Format*' => 'kde_Format*', +'Function*' => 'kde_Function*', +'FunctionImp*' => 'kde_FunctionImp*', +'GCI&' => 'GCI*' , +'GCI' => 'GCI*' , +'GCI*' => 'GCI*' , +'GUIActivateEvent*' => 'kde_GUIActivateEvent*', +'GUIStyle' => 'int', +'GUSOut*' => 'kde_GUSOut*', +'GenericAsyncStream*' => 'kde_GenericAsyncStream*', +'GenericDataChannel*' => 'kde_GenericDataChannel*', +'GenericDataPacket*' => 'kde_GenericDataPacket*', +'GenericFactory*' => 'kde_GenericFactory*', +'GenericFactoryBase*' => 'kde_GenericFactoryBase*', +'Global*' => 'kde_Global*', +'GlobalComm&' => 'kde_GlobalComm*', +'GlobalComm' => 'kde_GlobalComm*', +'GlobalComm*' => 'kde_GlobalComm*', +'GlobalComm_base*' => 'kde_GlobalComm_base*', +'GlobalComm_skel*' => 'kde_GlobalComm_skel*', +'GlobalComm_stub*' => 'kde_GlobalComm_stub*', +'HANDLE' => 'unsigned int', +'HBITMAP' => 'void *' , +'HCURSOR' => 'void *' , +'HDC' => 'void *' , +'HFONT' => 'void *' , +'HPALETTE' => 'void *' , +'HRGN' => 'void *' , +'HTMLAnchorElement&' => 'kde_HTMLAnchorElement*', +'HTMLAnchorElement*' => 'kde_HTMLAnchorElement*', +'HTMLAnchorElementImpl*' => 'kde_HTMLAnchorElementImpl*', +'HTMLAppletElement&' => 'kde_HTMLAppletElement*', +'HTMLAppletElement*' => 'kde_HTMLAppletElement*', +'HTMLAppletElementImpl*' => 'kde_HTMLAppletElementImpl*', +'HTMLAreaElement&' => 'kde_HTMLAreaElement*', +'HTMLAreaElement*' => 'kde_HTMLAreaElement*', +'HTMLAreaElementImpl*' => 'kde_HTMLAreaElementImpl*', +'HTMLBRElement&' => 'kde_HTMLBRElement*', +'HTMLBRElement*' => 'kde_HTMLBRElement*', +'HTMLBRElementImpl*' => 'kde_HTMLBRElementImpl*', +'HTMLBaseElement&' => 'kde_HTMLBaseElement*', +'HTMLBaseElement*' => 'kde_HTMLBaseElement*', +'HTMLBaseElementImpl*' => 'kde_HTMLBaseElementImpl*', +'HTMLBaseFontElement&' => 'kde_HTMLBaseFontElement*', +'HTMLBaseFontElement*' => 'kde_HTMLBaseFontElement*', +'HTMLBaseFontElementImpl*' => 'kde_HTMLBaseFontElementImpl*', +'HTMLBlockquoteElement&' => 'kde_HTMLBlockquoteElement*', +'HTMLBlockquoteElement*' => 'kde_HTMLBlockquoteElement*', +'HTMLBlockquoteElementImpl*' => 'kde_HTMLBlockquoteElementImpl*', +'HTMLBodyElement&' => 'kde_HTMLBodyElement*', +'HTMLBodyElement*' => 'kde_HTMLBodyElement*', +'HTMLBodyElementImpl*' => 'kde_HTMLBodyElementImpl*', +'HTMLButtonElement&' => 'kde_HTMLButtonElement*', +'HTMLButtonElement*' => 'kde_HTMLButtonElement*', +'HTMLButtonElementImpl*' => 'kde_HTMLButtonElementImpl*', +'HTMLCollection&' => 'kde_HTMLCollection*', +'HTMLCollection' => 'kde_HTMLCollection*', +'HTMLCollection*' => 'kde_HTMLCollection*', +'HTMLCollectionImpl*' => 'kde_HTMLCollectionImpl*', +'HTMLDListElement&' => 'kde_HTMLDListElement*', +'HTMLDListElement*' => 'kde_HTMLDListElement*', +'HTMLDListElementImpl*' => 'kde_HTMLDListElementImpl*', +'HTMLDirectoryElement&' => 'kde_HTMLDirectoryElement*', +'HTMLDirectoryElement*' => 'kde_HTMLDirectoryElement*', +'HTMLDirectoryElementImpl*' => 'kde_HTMLDirectoryElementImpl*', +'HTMLDivElement&' => 'kde_HTMLDivElement*', +'HTMLDivElement*' => 'kde_HTMLDivElement*', +'HTMLDivElementImpl*' => 'kde_HTMLDivElementImpl*', +'HTMLDocument&' => 'kde_HTMLDocument*', +'HTMLDocument*' => 'kde_HTMLDocument*', +'HTMLDocumentImpl*' => 'kde_HTMLDocumentImpl*', +'HTMLElement&' => 'kde_HTMLElement*', +'HTMLElement' => 'kde_HTMLElement*', +'HTMLElement*' => 'kde_HTMLElement*', +'HTMLElementImpl*' => 'kde_HTMLElementImpl*', +'HTMLFieldSetElement&' => 'kde_HTMLFieldSetElement*', +'HTMLFieldSetElement*' => 'kde_HTMLFieldSetElement*', +'HTMLFieldSetElementImpl*' => 'kde_HTMLFieldSetElementImpl*', +'HTMLFontElement&' => 'kde_HTMLFontElement*', +'HTMLFontElement*' => 'kde_HTMLFontElement*', +'HTMLFontElementImpl*' => 'kde_HTMLFontElementImpl*', +'HTMLFormElement&' => 'kde_HTMLFormElement*', +'HTMLFormElement' => 'kde_HTMLFormElement*', +'HTMLFormElement*' => 'kde_HTMLFormElement*', +'HTMLFormElementImpl*' => 'kde_HTMLFormElementImpl*', +'HTMLFrameElement&' => 'kde_HTMLFrameElement*', +'HTMLFrameElement*' => 'kde_HTMLFrameElement*', +'HTMLFrameElementImpl*' => 'kde_HTMLFrameElementImpl*', +'HTMLFrameSetElement&' => 'kde_HTMLFrameSetElement*', +'HTMLFrameSetElement*' => 'kde_HTMLFrameSetElement*', +'HTMLFrameSetElementImpl*' => 'kde_HTMLFrameSetElementImpl*', +'HTMLHRElement&' => 'kde_HTMLHRElement*', +'HTMLHRElement*' => 'kde_HTMLHRElement*', +'HTMLHRElementImpl*' => 'kde_HTMLHRElementImpl*', +'HTMLHeadElement&' => 'kde_HTMLHeadElement*', +'HTMLHeadElement*' => 'kde_HTMLHeadElement*', +'HTMLHeadElementImpl*' => 'kde_HTMLHeadElementImpl*', +'HTMLHeadingElement&' => 'kde_HTMLHeadingElement*', +'HTMLHeadingElement*' => 'kde_HTMLHeadingElement*', +'HTMLHeadingElementImpl*' => 'kde_HTMLHeadingElementImpl*', +'HTMLHtmlElement&' => 'kde_HTMLHtmlElement*', +'HTMLHtmlElement*' => 'kde_HTMLHtmlElement*', +'HTMLHtmlElementImpl*' => 'kde_HTMLHtmlElementImpl*', +'HTMLIFrameElement&' => 'kde_HTMLIFrameElement*', +'HTMLIFrameElement*' => 'kde_HTMLIFrameElement*', +'HTMLIFrameElementImpl*' => 'kde_HTMLIFrameElementImpl*', +'HTMLImageElement&' => 'kde_HTMLImageElement*', +'HTMLImageElement*' => 'kde_HTMLImageElement*', +'HTMLImageElementImpl*' => 'kde_HTMLImageElementImpl*', +'HTMLInputElement&' => 'kde_HTMLInputElement*', +'HTMLInputElement*' => 'kde_HTMLInputElement*', +'HTMLInputElementImpl*' => 'kde_HTMLInputElementImpl*', +'HTMLIsIndexElement&' => 'kde_HTMLIsIndexElement*', +'HTMLIsIndexElement*' => 'kde_HTMLIsIndexElement*', +'HTMLIsIndexElementImpl*' => 'kde_HTMLIsIndexElementImpl*', +'HTMLLIElement&' => 'kde_HTMLLIElement*', +'HTMLLIElement*' => 'kde_HTMLLIElement*', +'HTMLLIElementImpl*' => 'kde_HTMLLIElementImpl*', +'HTMLLabelElement&' => 'kde_HTMLLabelElement*', +'HTMLLabelElement*' => 'kde_HTMLLabelElement*', +'HTMLLabelElementImpl*' => 'kde_HTMLLabelElementImpl*', +'HTMLLegendElement&' => 'kde_HTMLLegendElement*', +'HTMLLegendElement*' => 'kde_HTMLLegendElement*', +'HTMLLegendElementImpl*' => 'kde_HTMLLegendElementImpl*', +'HTMLLinkElement&' => 'kde_HTMLLinkElement*', +'HTMLLinkElement*' => 'kde_HTMLLinkElement*', +'HTMLLinkElementImpl*' => 'kde_HTMLLinkElementImpl*', +'HTMLMapElement&' => 'kde_HTMLMapElement*', +'HTMLMapElement*' => 'kde_HTMLMapElement*', +'HTMLMapElementImpl*' => 'kde_HTMLMapElementImpl*', +'HTMLMenuElement&' => 'kde_HTMLMenuElement*', +'HTMLMenuElement*' => 'kde_HTMLMenuElement*', +'HTMLMenuElementImpl*' => 'kde_HTMLMenuElementImpl*', +'HTMLMetaElement&' => 'kde_HTMLMetaElement*', +'HTMLMetaElement*' => 'kde_HTMLMetaElement*', +'HTMLMetaElementImpl*' => 'kde_HTMLMetaElementImpl*', +'HTMLModElement&' => 'kde_HTMLModElement*', +'HTMLModElement*' => 'kde_HTMLModElement*', +'HTMLModElementImpl*' => 'kde_HTMLModElementImpl*', +'HTMLOListElement&' => 'kde_HTMLOListElement*', +'HTMLOListElement*' => 'kde_HTMLOListElement*', +'HTMLOListElementImpl*' => 'kde_HTMLOListElementImpl*', +'HTMLObjectElement&' => 'kde_HTMLObjectElement*', +'HTMLObjectElement*' => 'kde_HTMLObjectElement*', +'HTMLObjectElementImpl*' => 'kde_HTMLObjectElementImpl*', +'HTMLOptGroupElement&' => 'kde_HTMLOptGroupElement*', +'HTMLOptGroupElement*' => 'kde_HTMLOptGroupElement*', +'HTMLOptGroupElementImpl*' => 'kde_HTMLOptGroupElementImpl*', +'HTMLOptionElement&' => 'kde_HTMLOptionElement*', +'HTMLOptionElement*' => 'kde_HTMLOptionElement*', +'HTMLOptionElementImpl*' => 'kde_HTMLOptionElementImpl*', +'HTMLParagraphElement&' => 'kde_HTMLParagraphElement*', +'HTMLParagraphElement*' => 'kde_HTMLParagraphElement*', +'HTMLParagraphElementImpl*' => 'kde_HTMLParagraphElementImpl*', +'HTMLParamElement&' => 'kde_HTMLParamElement*', +'HTMLParamElement*' => 'kde_HTMLParamElement*', +'HTMLParamElementImpl*' => 'kde_HTMLParamElementImpl*', +'HTMLPreElement&' => 'kde_HTMLPreElement*', +'HTMLPreElement*' => 'kde_HTMLPreElement*', +'HTMLPreElementImpl*' => 'kde_HTMLPreElementImpl*', +'HTMLQuoteElement&' => 'kde_HTMLQuoteElement*', +'HTMLQuoteElement*' => 'kde_HTMLQuoteElement*', +'HTMLQuoteElementImpl*' => 'kde_HTMLQuoteElementImpl*', +'HTMLScriptElement&' => 'kde_HTMLScriptElement*', +'HTMLScriptElement*' => 'kde_HTMLScriptElement*', +'HTMLScriptElementImpl*' => 'kde_HTMLScriptElementImpl*', +'HTMLSelectElement&' => 'kde_HTMLSelectElement*', +'HTMLSelectElement*' => 'kde_HTMLSelectElement*', +'HTMLSelectElementImpl*' => 'kde_HTMLSelectElementImpl*', +'HTMLStyleElement&' => 'kde_HTMLStyleElement*', +'HTMLStyleElement*' => 'kde_HTMLStyleElement*', +'HTMLStyleElementImpl*' => 'kde_HTMLStyleElementImpl*', +'HTMLTableCaptionElement&' => 'kde_HTMLTableCaptionElement*', +'HTMLTableCaptionElement' => 'kde_HTMLTableCaptionElement*', +'HTMLTableCaptionElement*' => 'kde_HTMLTableCaptionElement*', +'HTMLTableCaptionElementImpl*' => 'kde_HTMLTableCaptionElementImpl*', +'HTMLTableCellElement&' => 'kde_HTMLTableCellElement*', +'HTMLTableCellElement*' => 'kde_HTMLTableCellElement*', +'HTMLTableCellElementImpl*' => 'kde_HTMLTableCellElementImpl*', +'HTMLTableColElement&' => 'kde_HTMLTableColElement*', +'HTMLTableColElement*' => 'kde_HTMLTableColElement*', +'HTMLTableColElementImpl*' => 'kde_HTMLTableColElementImpl*', +'HTMLTableElement&' => 'kde_HTMLTableElement*', +'HTMLTableElement*' => 'kde_HTMLTableElement*', +'HTMLTableElementImpl*' => 'kde_HTMLTableElementImpl*', +'HTMLTableRowElement&' => 'kde_HTMLTableRowElement*', +'HTMLTableRowElement*' => 'kde_HTMLTableRowElement*', +'HTMLTableRowElementImpl*' => 'kde_HTMLTableRowElementImpl*', +'HTMLTableSectionElement&' => 'kde_HTMLTableSectionElement*', +'HTMLTableSectionElement' => 'kde_HTMLTableSectionElement*', +'HTMLTableSectionElement*' => 'kde_HTMLTableSectionElement*', +'HTMLTableSectionElementImpl*' => 'kde_HTMLTableSectionElementImpl*', +'HTMLTextAreaElement&' => 'kde_HTMLTextAreaElement*', +'HTMLTextAreaElement*' => 'kde_HTMLTextAreaElement*', +'HTMLTextAreaElementImpl*' => 'kde_HTMLTextAreaElementImpl*', +'HTMLTitleElement&' => 'kde_HTMLTitleElement*', +'HTMLTitleElement*' => 'kde_HTMLTitleElement*', +'HTMLTitleElementImpl*' => 'kde_HTMLTitleElementImpl*', +'HTMLUListElement&' => 'kde_HTMLUListElement*', +'HTMLUListElement*' => 'kde_HTMLUListElement*', +'HTMLUListElementImpl*' => 'kde_HTMLUListElementImpl*', +'HandlerType' => 'qt_HandlerType*' , +'HashEntry*' => 'kde_HashEntry*', +'HashTable*' => 'kde_HashTable*', +'Header&' => 'kde_Header*', +'Header*' => 'kde_Header*', +'HighlightingInterface*' => 'kde_HighlightingInterface*', +'HistoryProvider*' => 'kde_HistoryProvider*', +'HostImp*' => 'kde_HostImp*', +'IDLFileReg*' => 'kde_IDLFileReg*', +'IOManager*' => 'kde_IOManager*', +'IONotify*' => 'kde_IONotify*', +'IOType*' => 'kde_IOType*', +'IOWatchFD*' => 'kde_IOWatchFD*', +'Icon' => 'int', +'IconListBox*' => 'kde_IconListBox*', +'Imp*' => 'void*', +'Info*' => 'kde_Info*', +'InterfaceDef&' => 'kde_InterfaceDef*', +'InterfaceDef' => 'kde_InterfaceDef*', +'InterfaceDef*' => 'kde_InterfaceDef*', +'InterfaceEntry*' => 'kde_InterfaceEntry*', +'InterfaceRepo&' => 'kde_InterfaceRepo*', +'InterfaceRepo' => 'kde_InterfaceRepo*', +'InterfaceRepo*' => 'kde_InterfaceRepo*', +'InterfaceRepo_base*' => 'kde_InterfaceRepo_base*', +'InterfaceRepo_impl*' => 'kde_InterfaceRepo_impl*', +'InterfaceRepo_skel*' => 'kde_InterfaceRepo_skel*', +'InterfaceRepo_stub*' => 'kde_InterfaceRepo_stub*', +'InternalFunctionImp*' => 'kde_InternalFunctionImp*', +'Interpreter*' => 'kde_Interpreter*', +'Invocation&' => 'kde_Invocation*', +'Invocation*' => 'kde_Invocation*', +'Iterator' => 'Iterator*' , +'Job*' => 'void*', +'K&' => 'K*' , +'KAboutApplication*' => 'kde_KAboutApplication*', +'KAboutContainer*' => 'kde_KAboutContainer*' , +'KAboutContributor*' => 'kde_KAboutContributor*', +'KAboutData*' => 'kde_KAboutData*' , +'KAboutDialog*' => 'kde_KAboutDialog*', +'KAboutKDE*' => 'kde_KAboutKDE*', +'KAboutPerson*' => 'kde_KAboutPerson*', +'KAboutTranslator*' => 'kde_KAboutTranslator*', +'KAboutWidget*' => 'kde_KAboutWidget*', +'KAccel*' => 'kde_KAccel*' , +'KAccelAction&' => 'kde_KAccelAction*', +'KAccelAction*' => 'kde_KAccelAction*', +'KAccelActions&' => 'kde_KAccelActions*', +'KAccelActions*' => 'kde_KAccelActions*', +'KAccelBase*' => 'kde_KAccelBase*', +'KAccelGen*' => 'kde_KAccelGen*', +'KAccelMenu*' => 'kde_KAccelMenu*', +'KAccelSequence&' => 'kde_KAccelSequence*', +'KAccelSequence' => 'kde_KAccelSequence*', +'KAccelSequence*' => 'kde_KAccelSequence*', +'KAccelShortcut&' => 'kde_KAccelShortcut*', +'KAccelShortcut' => 'kde_KAccelShortcut*', +'KAccelShortcut*' => 'kde_KAccelShortcut*', +'KAccelShortcuts&' => 'kde_KAccelShortcuts*', +'KAccelShortcuts*' => 'kde_KAccelShortcuts*', +'KAction*' => 'kde_KAction*' , +'KActionCollection&' => 'kde_KActionCollection*' , +'KActionCollection' => 'kde_KActionCollection*' , +'KActionCollection*' => 'kde_KActionCollection*' , +'KActionMenu*' => 'kde_KActionMenu*', +'KActionSeparator*' => 'kde_KActionSeparator*', +'KAddressInfo*' => 'kde_KAddressInfo*', +'KAlphaPainter*' => 'kde_KAlphaPainter*', +'KAnimWidget*' => 'kde_KAnimWidget*' , +'KAppTreeListItem*' => 'kde_KAppTreeListItem*' , +'KApplication*' => 'kde_KApplication*' , +'KApplicationPropsPlugin*' => 'kde_KApplicationPropsPlugin*', +'KApplicationTree*' => 'kde_KApplicationTree*', +'KArchive*' => 'kde_KArchive*', +'KArchiveDirectory*' => 'kde_KArchiveDirectory*', +'KArchiveEntry*' => 'kde_KArchiveEntry*', +'KArchiveFile*' => 'kde_KArchiveFile*', +'KArrowButton*' => 'kde_KArrowButton*', +'KArtsDispatcher*' => 'kde_KArtsDispatcher*', +'KArtsFloatWatch*' => 'kde_KArtsFloatWatch*', +'KAsyncIO*' => 'kde_KAsyncIO*', +'KAudioPlayer*' => 'kde_KAudioPlayer*', +'KAuthIcon*' => 'kde_KAuthIcon*', +'KAutoMount*' => 'kde_KAutoMount*', +'KAutoUnmount*' => 'kde_KAutoUnmount*', +'KBindingPropsPlugin*' => 'kde_KBindingPropsPlugin*', +'KBlankEffect*' => 'kde_KBlankEffect*', +'KBufferedIO*' => 'kde_KBufferedIO*', +'KBugReport*' => 'kde_KBugReport*', +'KButtonBox*' => 'kde_KButtonBox*', +'KCModule*' => 'kde_KCModule*' , +'KCatalogue&' => 'kde_KCatalogue*', +'KCatalogue*' => 'kde_KCatalogue*', +'KCharSelect*' => 'kde_KCharSelect*', +'KCharSelectTable*' => 'kde_KCharSelectTable*', +'KCharsets*' => 'kde_KCharsets*' , +'KCmdLineArgs*' => 'kde_KCmdLineArgs*' , +'KCmdLineOptions*' => 'kde_KCmdLineOptions*' , +'KCodecs*' => 'kde_KCodecs*', +'KColor&' => 'kde_KColor*' , +'KColor*' => 'kde_KColor*', +'KColorButton*' => 'kde_KColorButton*', +'KColorCells*' => 'kde_KColorCells*', +'KColorCombo*' => 'kde_KColorCombo*', +'KColorDialog*' => 'kde_KColorDialog*', +'KColorDrag*' => 'kde_KColorDrag*' , +'KColorPatch*' => 'kde_KColorPatch*', +'KCombiView*' => 'kde_KCombiView*', +'KComboBox*' => 'kde_KComboBox*' , +'KCommand*' => 'kde_KCommand*', +'KCommandHistory*' => 'kde_KCommandHistory*', +'KCompletion*' => 'kde_KCompletion*' , +'KCompletionBase*' => 'kde_KCompletionBase*', +'KCompletionBase::KeyBindingType' => 'kde_KCompletionBase_KeyBindingType*' , +'KCompletionBox*' => 'kde_KCompletionBox*', +'KConfig*' => 'kde_KConfig*' , +'KConfigBackEnd*' => 'kde_KConfigBackEnd*', +'KConfigBase&' => 'kde_KConfigBase*', +'KConfigBase*' => 'kde_KConfigBase*' , +'KConfigBase::ConfigState' => 'kde_KConfigBase_ConfigState' , +'KConfigGroup*' => 'kde_KConfigGroup*', +'KConfigGroupSaver*' => 'kde_KConfigGroupSaver*', +'KConfigINIBackEnd*' => 'kde_KConfigINIBackEnd*', +'KContainerLayout*' => 'kde_KContainerLayout*', +'KContainerLayoutItem*' => 'kde_KContainerLayoutItem*' , +'KContextMenuManager*' => 'kde_KContextMenuManager*', +'KCookie*' => 'kde_KCookie*', +'KCrash*' => 'kde_KCrash*', +'KCursor*' => 'kde_KCursor*', +'KDBGFUNC' => 'void *' , +'KDCOPActionProxy*' => 'kde_KDCOPActionProxy*', +'KDCOPPropertyProxy*' => 'kde_KDCOPPropertyProxy*', +'KDEAniMenu*' => 'kde_KDEAniMenu*', +'KDEDModule*' => 'kde_KDEDModule*', +'KDEDesktopMimeType*' => 'kde_KDEDesktopMimeType*', +'KDEDesktopMimeType::Service&' => 'kde_KDEDesktopMimeType_Service*' , +'KDESasl*' => 'kde_KDESasl*', +'KDEStyle*' => 'kde_KDEStyle*', +'KDEsuClient*' => 'kde_KDEsuClient*', +'KDataTool*' => 'kde_KDataTool*', +'KDataToolAction*' => 'kde_KDataToolAction*', +'KDataToolInfo&' => 'kde_KDataToolInfo*', +'KDataToolInfo*' => 'kde_KDataToolInfo*', +'KDateInternalMonthPicker*' => 'kde_KDateInternalMonthPicker*', +'KDateInternalYearSelector*' => 'kde_KDateInternalYearSelector*', +'KDatePicker*' => 'kde_KDatePicker*', +'KDateTable*' => 'kde_KDateTable*', +'KDateValidator*' => 'kde_KDateValidator*', +'KDateWidget*' => 'kde_KDateWidget*', +'KDesktopFile*' => 'kde_KDesktopFile*' , +'KDevApi*' => 'kde_KDevApi*', +'KDevAppFrontend*' => 'kde_KDevAppFrontend*', +'KDevCompilerOptions*' => 'kde_KDevCompilerOptions*', +'KDevCore*' => 'kde_KDevCore*', +'KDevFactory*' => 'kde_KDevFactory*', +'KDevLanguageSupport*' => 'kde_KDevLanguageSupport*', +'KDevMakeFrontend*' => 'kde_KDevMakeFrontend*', +'KDevPart*' => 'kde_KDevPart*', +'KDevProject*' => 'kde_KDevProject*', +'KDevVersionControl*' => 'kde_KDevVersionControl*', +'KDevicePropsPlugin*' => 'kde_KDevicePropsPlugin*', +'KDialog*' => 'kde_KDialog*', +'KDialogBase*' => 'kde_KDialogBase*' , +'KDialogBaseTile*' => 'kde_KDialogBaseTile*', +'KDialogQueue*' => 'kde_KDialogQueue*', +'KDirLister*' => 'kde_KDirLister*', +'KDirNotify*' => 'kde_KDirNotify*', +'KDirNotify_stub*' => 'kde_KDirNotify_stub*', +'KDirOperator*' => 'kde_KDirOperator*', +'KDirSelectDialog*' => 'kde_KDirSelectDialog*', +'KDirSize*' => 'kde_KDirSize*' , +'KDirWatch*' => 'kde_KDirWatch*' , +'KDirectionButton*' => 'kde_KDirectionButton*', +'KDockArea*' => 'kde_KDockArea*', +'KDockMainWindow*' => 'kde_KDockMainWindow*', +'KDockManager*' => 'kde_KDockManager*' , +'KDockTabBar*' => 'kde_KDockTabBar*', +'KDockTabBar::TabPos' => 'int', +'KDockTabBarPainter*' => 'kde_KDockTabBarPainter*', +'KDockTabCtl*' => 'kde_KDockTabCtl*', +'KDockTabCtl_PrivateStruct*' => 'kde_KDockTabCtl_PrivateStruct*' , +'KDockTabGroup*' => 'kde_KDockTabGroup*' , +'KDockWidget*' => 'kde_KDockWidget*' , +'KDockWidgetAbstractHeader*' => 'kde_KDockWidgetAbstractHeader*' , +'KDockWidgetAbstractHeaderDrag*' => 'kde_KDockWidgetAbstractHeaderDrag*', +'KDockWidgetHeader*' => 'kde_KDockWidgetHeader*', +'KDockWidgetHeaderDrag*' => 'kde_KDockWidgetHeaderDrag*', +'KDockWindow*' => 'kde_KDockWindow*', +'KDoubleNumInput*' => 'kde_KDoubleNumInput*', +'KDualColorButton*' => 'kde_KDualColorButton*', +'KEMailSettings*' => 'kde_KEMailSettings*', +'KEdFind*' => 'kde_KEdFind*', +'KEdGotoLine*' => 'kde_KEdGotoLine*', +'KEdReplace*' => 'kde_KEdReplace*', +'KEdit*' => 'kde_KEdit*', +'KEditListBox*' => 'kde_KEditListBox*', +'KEditToolbar*' => 'kde_KEditToolbar*', +'KEditToolbarWidget*' => 'kde_KEditToolbarWidget*', +'KEntry&' => 'kde_KEntry*' , +'KEntry' => 'kde_KEntry*' , +'KEntry*' => 'kde_KEntry*', +'KEntryKey&' => 'kde_KEntryKey*' , +'KEntryKey*' => 'kde_KEntryKey*', +'KEntryMap' => 'kde_KEntryMap*' , +'KEntryMap*' => 'kde_KEntryMap*' , +'KExecMimeType*' => 'kde_KExecMimeType*', +'KExecPropsPlugin*' => 'kde_KExecPropsPlugin*', +'KExtendedSocket*' => 'kde_KExtendedSocket*', +'KFile*' => 'kde_KFile*', +'KFile::FileView' => 'int' , +'KFile::Mode' => 'int' , +'KFile::SelectionMode' => 'int' , +'KFileBookmark*' => 'kde_KFileBookmark*' , +'KFileBookmarkManager*' => 'kde_KFileBookmarkManager*', +'KFileComboBox*' => 'kde_KFileComboBox*', +'KFileDetailView*' => 'kde_KFileDetailView*', +'KFileDialog*' => 'kde_KFileDialog*' , +'KFileFilter*' => 'kde_KFileFilter*', +'KFileFilterCombo*' => 'kde_KFileFilterCombo*', +'KFileIconView*' => 'kde_KFileIconView*', +'KFileIconViewItem*' => 'kde_KFileIconViewItem*', +'KFileItem&' => 'kde_KFileItem*', +'KFileItem*' => 'kde_KFileItem*' , +'KFileItemList&' => 'kde_KFileItemList*' , +'KFileItemList' => 'kde_KFileItemList*' , +'KFileItemList*' => 'kde_KFileItemList*' , +'KFileListViewItem*' => 'kde_KFileListViewItem*', +'KFileMetaInfo*' => 'kde_KFileMetaInfo*', +'KFileMetaInfoItem*' => 'kde_KFileMetaInfoItem*', +'KFileMetaInfoProvider*' => 'kde_KFileMetaInfoProvider*', +'KFileOpenWithHandler*' => 'kde_KFileOpenWithHandler*', +'KFilePermissionsPropsPlugin*' => 'kde_KFilePermissionsPropsPlugin*', +'KFilePlugin*' => 'kde_KFilePlugin*', +'KFilePreview*' => 'kde_KFilePreview*', +'KFilePropsPlugin*' => 'kde_KFilePropsPlugin*', +'KFileReader*' => 'kde_KFileReader*' , +'KFileTreeBranch*' => 'kde_KFileTreeBranch*', +'KFileTreeView*' => 'kde_KFileTreeView*', +'KFileTreeViewItem*' => 'kde_KFileTreeViewItem*', +'KFileTreeViewToolTip*' => 'kde_KFileTreeViewToolTip*', +'KFileView*' => 'kde_KFileView*' , +'KFileView::FileView' => 'int', +'KFileViewItem&' => 'kde_KFileViewItem*', +'KFileViewItem*' => 'kde_KFileViewItem*' , +'KFileViewItem**' => 'kde_KFileViewItem**' , +'KFileViewItemList&' => 'kde_KFileViewItemList*' , +'KFileViewItemList*' => 'kde_KFileViewItemList*' , +'KFileViewSignaler*' => 'kde_KFileViewSignaler*', +'KFilterBase*' => 'kde_KFilterBase*', +'KFilterDev*' => 'kde_KFilterDev*', +'KFloatValidator*' => 'kde_KFloatValidator*', +'KFloatWatchProxy&' => 'kde_KFloatWatchProxy*', +'KFloatWatchProxy' => 'kde_KFloatWatchProxy*', +'KFloatWatchProxy*' => 'kde_KFloatWatchProxy*', +'KFolderType*' => 'kde_KFolderType*', +'KFontAction*' => 'kde_KFontAction*', +'KFontChooser*' => 'kde_KFontChooser*', +'KFontCombo*' => 'kde_KFontCombo*', +'KFontDialog*' => 'kde_KFontDialog*', +'KFontSizeAction*' => 'kde_KFontSizeAction*', +'KGenericFactory*' => 'kde_KGenericFactory*', +'KGenericFactoryBase*' => 'kde_KGenericFactoryBase*', +'KGlobal*' => 'kde_KGlobal*', +'KGlobalAccel*' => 'kde_KGlobalAccel*' , +'KGlobalSettings*' => 'kde_KGlobalSettings*', +'KGlobalSettings::Completion' => 'int' , +'KGradientSelector*' => 'kde_KGradientSelector*', +'KGuiItem&' => 'kde_KGuiItem*', +'KGuiItem' => 'kde_KGuiItem*', +'KGuiItem*' => 'kde_KGuiItem*', +'KHSSelector*' => 'kde_KHSSelector*', +'KHTMLPart*' => 'kde_KHTMLPart*' , +'KHTMLSettings&' => 'kde_KHTMLSettings*', +'KHTMLSettings*' => 'kde_KHTMLSettings*' , +'KHTMLView*' => 'kde_KHTMLView*' , +'KHelpMenu*' => 'kde_KHelpMenu*', +'KHistoryCombo*' => 'kde_KHistoryCombo*', +'KIO*' => 'kde_KIO*', +'KIO::AuthInfo&' => 'kde_AuthInfo*', +'KIO::CopyJob*' => 'kde_CopyJob*' , +'KIO::DeleteJob*' => 'kde_DeleteJob*' , +'KIO::Job*' => 'kde_Job*' , +'KIO::ListJob*' => 'kde_ListJob*' , +'KIO::MetaData&' => 'kde_MetaData*', +'KIO::RenameDlg_Mode' => 'int', +'KIO::RenameDlg_Result' => 'int', +'KIO::SimpleJob*' => 'kde_SimpleJob*', +'KIO::SkipDlg_Result' => 'int', +'KIO::Slave*' => 'kde_Slave*', +'KIO::UDSEntry&' => 'kde_UDSEntry*' , +'KIO::UDSEntryList&' => 'kde_UDSEntryList*' , +'KIOInputStream&' => 'kde_KIOInputStream*', +'KIOInputStream*' => 'kde_KIOInputStream*', +'KIOTestSlow&' => 'kde_KIOTestSlow*', +'KIOTestSlow' => 'kde_KIOTestSlow*', +'KIOTestSlow*' => 'kde_KIOTestSlow*', +'KIPC*' => 'kde_KIPC*', +'KIcon' => 'kde_KIcon*' , +'KIcon*' => 'kde_KIcon*', +'KIconButton*' => 'kde_KIconButton*', +'KIconCanvas*' => 'kde_KIconCanvas*', +'KIconDialog*' => 'kde_KIconDialog*', +'KIconEffect*' => 'kde_KIconEffect*' , +'KIconLoader*' => 'kde_KIconLoader*' , +'KIconSelectAction*' => 'kde_KIconSelectAction*', +'KIconTheme*' => 'kde_KIconTheme*' , +'KIconView*' => 'kde_KIconView*', +'KIconViewItem*' => 'kde_KIconViewItem*', +'KImageEffect*' => 'kde_KImageEffect*', +'KImageFilePreview*' => 'kde_KImageFilePreview*', +'KImageIO*' => 'kde_KImageIO*', +'KInetSocketAddress&' => 'kde_KInetSocketAddress*', +'KInetSocketAddress*' => 'kde_KInetSocketAddress*', +'KInstance&' => 'kde_KInstance*' , +'KInstance' => 'kde_KInstance*' , +'KInstance*' => 'kde_KInstance*' , +'KIntNumInput*' => 'kde_KIntNumInput*', +'KIntSpinBox*' => 'kde_KIntSpinBox*', +'KIntValidator*' => 'kde_KIntValidator*', +'KJS*' => 'kde_KJS*', +'KJS::KJSO&' => 'kde_KJS_KJSO*', +'KJS::UString&' => 'kde_KJS_UString*', +'KJSO&' => 'kde_KJSO*', +'KJSO' => 'kde_KJSO*', +'KJSO*' => 'kde_KJSO*', +'KJScript*' => 'kde_KJScript*', +'KJanusWidget*' => 'kde_KJanusWidget*', +'KJavaApplet*' => 'kde_KJavaApplet*' , +'KJavaAppletContext*' => 'kde_KJavaAppletContext*' , +'KJavaAppletServer*' => 'kde_KJavaAppletServer*' , +'KJavaAppletWidget*' => 'kde_KJavaAppletWidget*', +'KJavaProcess*' => 'kde_KJavaProcess*', +'KJavaScriptAdvice&' => 'kde_KJavaScriptAdvice*' , +'KKeyChooser*' => 'kde_KKeyChooser*', +'KKeyChooserItem*' => 'kde_KKeyChooserItem*', +'KKeyDialog*' => 'kde_KKeyDialog*', +'KKeyEntry&' => 'kde_KKeyEntry*' , +'KKeyEntry*' => 'kde_KKeyEntry*', +'KKeyEntryMap&' => 'kde_KKeyEntryMap*' , +'KKeyEntryMap' => 'kde_KKeyEntryMap*' , +'KKeyEntryMap*' => 'kde_KKeyEntryMap*' , +'KKeySequence&' => 'kde_KKeySequence*', +'KKeySequence' => 'kde_KKeySequence*', +'KKeySequence*' => 'kde_KKeySequence*', +'KKeySequence::I18N' => 'int', +'KKeySequences&' => 'kde_KKeySequences*', +'KKeySequences' => 'kde_KKeySequences*', +'KKeySequences*' => 'kde_KKeySequences*', +'KLed*' => 'kde_KLed*', +'KLibFactory*' => 'kde_KLibFactory*' , +'KLibLoader*' => 'kde_KLibLoader*' , +'KLibrary*' => 'kde_KLibrary*' , +'KLineEdit*' => 'kde_KLineEdit*' , +'KLineEditDlg*' => 'kde_KLineEditDlg*', +'KListAction*' => 'kde_KListAction*', +'KListBox*' => 'kde_KListBox*', +'KListView*' => 'kde_KListView*' , +'KListViewItem*' => 'kde_KListViewItem*', +'KLocale&' => 'kde_KLocale*' , +'KLocale*' => 'kde_KLocale*' , +'KMJobViewer*' => 'kde_KMJobViewer*', +'KMMainView*' => 'kde_KMMainView*', +'KMManager*' => 'kde_KMManager*', +'KMObject*' => 'kde_KMObject*', +'KMPrinter&' => 'kde_KMPrinter*', +'KMPrinter*' => 'kde_KMPrinter*', +'KMPrinterList*' => 'kde_KMPrinterList*', +'KMPrinterPage*' => 'kde_KMPrinterPage*', +'KMacroCommand*' => 'kde_KMacroCommand*', +'KMainWindow*' => 'kde_KMainWindow*', +'KMainWindowInterface*' => 'kde_KMainWindowInterface*', +'KMenuBar*' => 'kde_KMenuBar*' , +'KMessageBox*' => 'kde_KMessageBox*', +'KMidSimpleAPI*' => 'kde_KMidSimpleAPI*', +'KMimeMagic*' => 'kde_KMimeMagic*' , +'KMimeMagicResult*' => 'kde_KMimeMagicResult*' , +'KMimeSourceFactory*' => 'kde_KMimeSourceFactory*' , +'KMimeType*' => 'kde_KMimeType*', +'KMimeType::List&' => 'kde_KMimeType_List*' , +'KMimeType::Ptr&' => 'kde_KMimeType_Ptr*' , +'KMimeType::Ptr' => 'kde_KMimeType_Ptr' , +'KMouseSettings*' => 'kde_KMouseSettings*', +'KMultipleDrag*' => 'kde_KMultipleDrag*', +'KNDBGFUNC' => 'void *' , +'KNotifyClient*' => 'kde_KNotifyClient*', +'KNumInput*' => 'kde_KNumInput*' , +'KOCRDialog*' => 'kde_KOCRDialog*', +'KOCRDialogFactory*' => 'kde_KOCRDialogFactory*', +'KOpenSSLProxy*' => 'kde_KOpenSSLProxy*', +'KOpenWithDlg*' => 'kde_KOpenWithDlg*', +'KOpenWithHandler*' => 'kde_KOpenWithHandler*' , +'KPAC*' => 'kde_KPAC*', +'KPReloadObject*' => 'kde_KPReloadObject*', +'KPalette&' => 'kde_KPalette*' , +'KPalette*' => 'kde_KPalette*', +'KPaletteTable*' => 'kde_KPaletteTable*', +'KPanelAppMenu*' => 'kde_KPanelAppMenu*', +'KPanelApplet*' => 'kde_KPanelApplet*', +'KPanelExtension*' => 'kde_KPanelExtension*', +'KPanelMenu*' => 'kde_KPanelMenu*' , +'KParts*' => 'kde_KParts*', +'KParts::BrowserExtension*' => 'kde_BrowserExtension*' , +'KParts::GUIActivateEvent*' => 'kde_GUIActivateEvent*' , +'KParts::Part*' => 'kde_Part*', +'KParts::PartManager*' => 'kde_PartManager*' , +'KParts::ReadOnlyPart*' => 'kde_ReadOnlyPart*' , +'KParts::URLArgs&' => 'kde_URLArgs*' , +'KParts::URLArgs' => 'kde_URLArgs*', +'KPasswordDialog*' => 'kde_KPasswordDialog*', +'KPasswordEdit*' => 'kde_KPasswordEdit*', +'KPixmap&' => 'kde_KPixmap*' , +'KPixmap' => 'kde_KPixmap*' , +'KPixmap*' => 'kde_KPixmap*', +'KPixmapEffect*' => 'kde_KPixmapEffect*', +'KPixmapIO*' => 'kde_KPixmapIO*', +'KPixmapProvider*' => 'kde_KPixmapProvider*' , +'KPixmapSplitter*' => 'kde_KPixmapSplitter*', +'KPlayObject*' => 'kde_KPlayObject*', +'KPlayObjectFactory*' => 'kde_KPlayObjectFactory*', +'KPopupFrame*' => 'kde_KPopupFrame*', +'KPopupMenu*' => 'kde_KPopupMenu*' , +'KPopupTitle*' => 'kde_KPopupTitle*', +'KPreviewWidgetBase*' => 'kde_KPreviewWidgetBase*', +'KPrintAction*' => 'kde_KPrintAction*', +'KPrintDialogPage*' => 'kde_KPrintDialogPage*', +'KPrinter*' => 'kde_KPrinter*', +'KPrinterWrapper*' => 'kde_KPrinterWrapper*', +'KProcIO*' => 'kde_KProcIO*' , +'KProcess&' => 'kde_KProcess*' , +'KProcess*' => 'kde_KProcess*' , +'KProcessController*' => 'kde_KProcessController*', +'KProcessRunner*' => 'kde_KProcessRunner*', +'KProgress*' => 'kde_KProgress*', +'KPropertiesDialog*' => 'kde_KPropertiesDialog*' , +'KPropsDlgPlugin*' => 'kde_KPropsDlgPlugin*' , +'KProtocolInfo*' => 'kde_KProtocolInfo*', +'KProtocolManager*' => 'kde_KProtocolManager*', +'KPushButton*' => 'kde_KPushButton*', +'KRFCDate*' => 'kde_KRFCDate*', +'KRadioAction*' => 'kde_KRadioAction*', +'KRandomSequence*' => 'kde_KRandomSequence*', +'KRecentDocument*' => 'kde_KRecentDocument*', +'KRecentFilesAction*' => 'kde_KRecentFilesAction*' , +'KRegExp*' => 'kde_KRegExp*', +'KRegExpEditor*' => 'kde_KRegExpEditor*', +'KRegExpEditorInterface*' => 'kde_KRegExpEditorInterface*', +'KRestrictedLine*' => 'kde_KRestrictedLine*', +'KRootPermsIcon*' => 'kde_KRootPermsIcon*', +'KRootPixmap*' => 'kde_KRootPixmap*', +'KRootProp*' => 'kde_KRootProp*', +'KRuler*' => 'kde_KRuler*', +'KRun*' => 'kde_KRun*', +'KSSL&' => 'kde_KSSL*', +'KSSL*' => 'kde_KSSL*', +'KSSLAuthAction' => 'int', +'KSSLAuthAction*' => 'int*', +'KSSLCertBox*' => 'kde_KSSLCertBox*', +'KSSLCertChain&' => 'kde_KSSLCertChain*', +'KSSLCertChain*' => 'kde_KSSLCertChain*', +'KSSLCertDlg*' => 'kde_KSSLCertDlg*', +'KSSLCertDlgRet' => 'kde_KSSLCertDlgRet*', +'KSSLCertDlgRet*' => 'kde_KSSLCertDlgRet*', +'KSSLCertificate&' => 'kde_KSSLCertificate*', +'KSSLCertificate*' => 'kde_KSSLCertificate*', +'KSSLCertificateCache*' => 'kde_KSSLCertificateCache*', +'KSSLCertificateFactory*' => 'kde_KSSLCertificateFactory*', +'KSSLCertificateHome*' => 'kde_KSSLCertificateHome*', +'KSSLConnectionInfo&' => 'kde_KSSLConnectionInfo*', +'KSSLConnectionInfo*' => 'kde_KSSLConnectionInfo*', +'KSSLInfoDlg*' => 'kde_KSSLInfoDlg*', +'KSSLKeyGen*' => 'kde_KSSLKeyGen*', +'KSSLKeyType' => 'kde_KSSLKeyType', +'KSSLPKCS12*' => 'kde_KSSLPKCS12*', +'KSSLPKCS7*' => 'kde_KSSLPKCS7*', +'KSSLPeerInfo&' => 'kde_KSSLPeerInfo*', +'KSSLPeerInfo*' => 'kde_KSSLPeerInfo*', +'KSSLSettings*' => 'kde_KSSLSettings*', +'KSSLSigners*' => 'kde_KSSLSigners*', +'KSSLX509Map*' => 'kde_KSSLX509Map*', +'KSSLX509V3&' => 'kde_KSSLX509V3*', +'KSSLX509V3*' => 'kde_KSSLX509V3*', +'KSaveFile*' => 'kde_KSaveFile*', +'KScanDialog*' => 'kde_KScanDialog*', +'KScanDialogFactory*' => 'kde_KScanDialogFactory*', +'KScreenSaver*' => 'kde_KScreenSaver*', +'KScriptClientInterface*' => 'kde_KScriptClientInterface*', +'KScriptClientInterface::Result' => 'int', +'KScriptInterface*' => 'kde_KScriptInterface*', +'KScriptManager*' => 'kde_KScriptManager*', +'KSelectAction*' => 'kde_KSelectAction*', +'KSelector*' => 'kde_KSelector*', +'KSeparator*' => 'kde_KSeparator*', +'KServerSocket*' => 'kde_KServerSocket*', +'KService&' => 'kde_KService*' , +'KService*' => 'kde_KService*', +'KService::List' => 'kde_KService_List*' , +'KService::Ptr' => 'kde_KService_Ptr*' , +'KServiceGroup*' => 'kde_KServiceGroup*', +'KServiceOffer&' => 'kde_KServiceOffer*' , +'KServiceOffer*' => 'kde_KServiceOffer*', +'KServiceType*' => 'kde_KServiceType*', +'KServiceTypeProfile*' => 'kde_KServiceTypeProfile*' , +'KSessionManaged*' => 'kde_KSessionManaged*', +'KShared&' => 'kde_KShared*' , +'KShared*' => 'kde_KShared*', +'KSharedPixmap*' => 'kde_KSharedPixmap*', +'KSharedPtr&' => 'kde_KSharedPtr*' , +'KSharedPtr*' => 'kde_KSharedPtr*', +'KShellCompletion*' => 'kde_KShellCompletion*', +'KShellProcess*' => 'kde_KShellProcess*', +'KShortcuts&' => 'kde_KShortcuts*', +'KShortcuts' => 'kde_KShortcuts*', +'KShortcuts*' => 'kde_KShortcuts*', +'KShred*' => 'kde_KShred*', +'KSimpleConfig&' => 'kde_KSimpleConfig*' , +'KSimpleConfig*' => 'kde_KSimpleConfig*', +'KSimpleFileFilter*' => 'kde_KSimpleFileFilter*', +'KSocket*' => 'kde_KSocket*', +'KSocketAddress&' => 'kde_KSocketAddress*', +'KSocketAddress*' => 'kde_KSocketAddress*', +'KSocks*' => 'kde_KSocks*', +'KSpell*' => 'kde_KSpell*', +'KSpellConfig&' => 'kde_KSpellConfig*' , +'KSpellConfig' => 'kde_KSpellConfig*' , +'KSpellConfig*' => 'kde_KSpellConfig*' , +'KSpellDlg*' => 'kde_KSpellDlg*', +'KSqueezedTextLabel*' => 'kde_KSqueezedTextLabel*', +'KStandardDirs*' => 'kde_KStandardDirs*' , +'KStartupInfo*' => 'kde_KStartupInfo*', +'KStartupInfoData&' => 'kde_KStartupInfoData*', +'KStartupInfoData*' => 'kde_KStartupInfoData*', +'KStartupInfoId&' => 'kde_KStartupInfoId*', +'KStartupInfoId' => 'kde_KStartupInfoId*', +'KStartupInfoId*' => 'kde_KStartupInfoId*', +'KStaticDeleter*' => 'kde_KStaticDeleter*', +'KStaticDeleterBase*' => 'kde_KStaticDeleterBase*' , +'KStatusBar*' => 'kde_KStatusBar*' , +'KStatusBar::BarStatusstat::Toggle' => 'int' , +'KStatusBarLabel*' => 'kde_KStatusBarLabel*', +'KStdAccel*' => 'kde_KStdAccel*', +'KStdAccel::StdAccel' => 'int' , +'KStdAction*' => 'kde_KStdAction*', +'KStdGuiItem*' => 'kde_KStdGuiItem*', +'KStringHandler*' => 'kde_KStringHandler*', +'KStyle*' => 'kde_KStyle*' , +'KSycoca*' => 'kde_KSycoca*' , +'KSycocaEntry*' => 'kde_KSycocaEntry*' , +'KSycocaFactory*' => 'kde_KSycocaFactory*' , +'KSycocaFactoryId' => 'kde_KSycocaFactoryId' , +'KSycocaType&' => 'kde_KSycocaType*' , +'KSycocaType' => 'kde_KSycocaType*' , +'KSystemTray*' => 'kde_KSystemTray*', +'KTMainWindow*' => 'kde_KTMainWindow*', +'KTabButton*' => 'kde_KTabButton*', +'KTabCtl*' => 'kde_KTabCtl*', +'KTar*' => 'kde_KTar*', +'KTarBase*' => 'kde_KTarBase*' , +'KTarData*' => 'kde_KTarData*', +'KTarDirectory*' => 'kde_KTarDirectory*' , +'KTarEntry*' => 'kde_KTarEntry*' , +'KTarFile*' => 'kde_KTarFile*', +'KTarGz*' => 'kde_KTarGz*', +'KTempFile*' => 'kde_KTempFile*', +'KTextBrowser*' => 'kde_KTextBrowser*', +'KTextEditor*' => 'kde_KTextEditor*', +'KTextEditor__View&' => 'kde_KTextEditor__View*', +'KTextEditor__View' => 'kde_KTextEditor__View*', +'KTextEditor__View*' => 'kde_KTextEditor__View*', +'KThemeBase*' => 'kde_KThemeBase*', , +'KThemeCache*' => 'kde_KThemeCache*', +'KThemePixmap&' => 'kde_KThemePixmap*' , +'KThemePixmap*' => 'kde_KThemePixmap*' , +'KThemeStyle*' => 'kde_KThemeStyle*', +'KTipDatabase*' => 'kde_KTipDatabase*', +'KTipDialog*' => 'kde_KTipDialog*', +'KToggleAction*' => 'kde_KToggleAction*' , +'KToolBar*' => 'kde_KToolBar*' , +'KToolBar::BarStatus' => 'int', +'KToolBar::BarStatusstat::Toggle' => 'int' , +'KToolBarButton*' => 'kde_KToolBarButton*' , +'KToolBarButtonList*' => 'kde_KToolBarButtonList*', +'KToolBarPopupAction*' => 'kde_KToolBarPopupAction*', +'KToolBarPos' => 'int' , +'KToolBarRadioGroup*' => 'kde_KToolBarRadioGroup*', +'KToolBarSeparator*' => 'kde_KToolBarSeparator*', +'KToolButtonType' => 'int' , +'KTrader*' => 'kde_KTrader*' , +'KTypeList*' => 'kde_KTypeList*', +'KURIFilter*' => 'kde_KURIFilter*' , +'KURIFilterData&' => 'kde_KURIFilterData*' , +'KURIFilterData*' => 'kde_KURIFilterData*', +'KURIFilterPlugin*' => 'kde_KURIFilterPlugin*', +'KURIFilterPluginList*' => 'kde_KURIFilterPluginList*', +'KURL& url ()' => 'kde_KURL*', +'KURL& urlName ()' => 'kde_KURL*', +'KURL&' => 'kde_KURL*' , +'KURL' => 'kde_KURL*' , +'KURL*' => 'kde_KURL*', +'KURL::List&' => 'kde_KURLList*' , +'KURL::List' => 'kde_KURLList*' , +'KURLComboBox*' => 'kde_KURLComboBox*', +'KURLComboItem*' => 'kde_KURLComboItem*' , +'KURLCompletion*' => 'kde_KURLCompletion*', +'KURLDrag*' => 'kde_KURLDrag*', +'KURLLabel*' => 'kde_KURLLabel*', +'KURLPixmapProvider*' => 'kde_KURLPixmapProvider*', +'KURLPropsPlugin*' => 'kde_KURLPropsPlugin*', +'KURLRequester*' => 'kde_KURLRequester*', +'KURLRequesterDlg*' => 'kde_KURLRequesterDlg*', +'KUniqueApplication*' => 'kde_KUniqueApplication*', +'KUnixSocketAddress*' => 'kde_KUnixSocketAddress*', +'KValueSelector*' => 'kde_KValueSelector*', +'KWin*' => 'kde_KWin*', +'KWinModule*' => 'kde_KWinModule*', +'KWindowListMenu*' => 'kde_KWindowListMenu*', +'KWizard*' => 'kde_KWizard*', +'KWordWrap*' => 'kde_KWordWrap*', +'KWritePermsIcon*' => 'kde_KWritePermsIcon*', +'KXMLGUIBuilder*' => 'kde_KXMLGUIBuilder*' , +'KXMLGUIClient*' => 'kde_KXMLGUIClient*' , +'KXMLGUIFactory*' => 'kde_KXMLGUIFactory*' , +'KXMessages*' => 'kde_KXMessages*', +'KXYSelector*' => 'kde_KXYSelector*', +'KZoneAllocator*' => 'kde_KZoneAllocator*', +'KabAPI*' => 'kde_KabAPI*', +'KabKey&' => 'kde_KabKey*' , +'KabKey' => 'kde_KabKey*' , +'KabKey*' => 'kde_KabKey*', +'Key&' => 'Key*' , +'KeyBindingMap' => 'kde_KeyBindingMap*' , +'KeyValueMap&' => 'kde_KeyValueMap*' , +'KeyValueMap*&' => 'kde_KeyValueMap*' , +'KeyValueMap*' => 'kde_KeyValueMap*' , +'Keymap*' => 'kde_Keymap*', +'LinkStyle&' => 'kde_LinkStyle*', +'LinkStyle*' => 'kde_LinkStyle*', +'List&' => 'kde_List*', +'List' => 'kde_List', +'List*' => 'kde_List*', +'ListIterator&' => 'kde_ListIterator*', +'ListIterator' => 'kde_ListIterator', +'ListIterator*' => 'kde_ListIterator*', +'ListJob*' => 'kde_ListJob*', +'ListNode*' => 'kde_ListNode*', +'ListProgress*' => 'kde_ListProgress*', +'Lookup*' => 'kde_Lookup*', +'MCOPConfig*' => 'kde_MCOPConfig*', +'MCOPUtils*' => 'kde_MCOPUtils*', +'MSG*' => 'MSG*' , +'MailServer&' => 'MailServer*' , +'MailServer*' => 'kde_MailServer*', +'MainWindow*' => 'kde_MainWindow*', +'Mark*' => 'kde_Mark*', +'MarkInterface*' => 'kde_MarkInterface*', +'MediaAsyncStream*' => 'kde_MediaAsyncStream*', +'MediaDataPacket*' => 'kde_MediaDataPacket*', +'MediaFrame*' => 'kde_MediaFrame*', +'MediaList&' => 'kde_MediaList*', +'MediaList' => 'kde_MediaList', +'MediaList*' => 'kde_MediaList*', +'MediaListImpl*' => 'kde_MediaListImpl*', +'MediaModule&' => 'kde_MediaModule*', +'MediaModule' => 'kde_MediaModule*', +'MediaModule*' => 'kde_MediaModule*', +'MediaModule_base*' => 'kde_MediaModule_base*', +'MediaModule_skel*' => 'kde_MediaModule_skel*', +'MediaModule_stub*' => 'kde_MediaModule_stub*', +'MenuDockData*' => 'kde_MenuDockData*', +'MetaData&' => 'kde_MetaData*', +'MetaData' => 'kde_MetaData*', +'MetaData*' => 'kde_MetaData*', +'MethodDef&' => 'kde_MethodDef*', +'MethodDef*' => 'kde_MethodDef*', +'MidiEvent*' => 'kde_MidiEvent*', +'MidiFileInfo*' => 'kde_MidiFileInfo*', +'MidiMapper*' => 'kde_MidiMapper*', +'MidiOut*' => 'kde_MidiOut*', +'MidiPlayer*' => 'kde_MidiPlayer*', +'MidiStatus*' => 'kde_MidiStatus*', +'MidiTrack*' => 'kde_MidiTrack*', +'MimetypeJob*' => 'kde_MimetypeJob*', +'Mode' => 'int', +'ModuleDef&' => 'kde_ModuleDef*', +'ModuleDef*' => 'kde_ModuleDef*', +'MouseDoubleClickEvent*' => 'kde_MouseDoubleClickEvent*', +'MouseEvent*' => 'kde_MouseEvent*', +'MouseMoveEvent*' => 'kde_MouseMoveEvent*', +'MousePressEvent*' => 'kde_MousePressEvent*', +'MouseReleaseEvent*' => 'kde_MouseReleaseEvent*', +'MultiGetJob*' => 'kde_MultiGetJob*', +'MultiPort*' => 'kde_MultiPort*', +'NET*' => 'kde_NET*', +'NET::WindowType' => 'int' , +'NETIcon' => 'kdeNETIcon*' , +'NETIcon*' => 'kde_NETIcon*', +'NETPoint&' => 'kde_NETPoint*' , +'NETPoint' => 'kde_NETPoint*' , +'NETPoint*' => 'kde_NETPoint*', +'NETRect&' => 'kde_NETRect*' , +'NETRect' => 'kde_NETRect*' , +'NETRect*' => 'kde_NETRect*', +'NETRootInfo&' => 'kde_NETRootInfo*' , +'NETRootInfo*' => 'kde_NETRootInfo*', +'NETRootInfoPrivate*' => 'kde_NETRootInfoPrivate*', +'NETSize&' => 'kde_NETSize*' , +'NETSize' => 'kde_NETSize*' , +'NETSize*' => 'kde_NETSize*', +'NETStrut' => 'kde_NETStrut*' , +'NETStrut*' => 'kde_NETStrut*', +'NETWinInfo&' => 'kde_NETWinInfo*' , +'NETWinInfo*' => 'kde_NETWinInfo*', +'NETWinInfoPrivate*' => 'kde_NETWinInfoPrivate*', +'NamedNodeMap&' => 'kde_NamedNodeMap*', +'NamedNodeMap' => 'kde_NamedNodeMap*', +'NamedNodeMap*' => 'kde_NamedNodeMap*', +'NamedNodeMapImpl*' => 'kde_NamedNodeMapImpl*', +'NetAccess*' => 'kde_NetAccess*', +'NetRC*' => 'kde_NetRC*', +'Node&' => 'kde_DOMNode*', +'Node' => 'kde_DOMNode*', +'Node*' => 'kde_DOMNode*', +'NodeFilter&' => 'kde_NodeFilter*', +'NodeFilter' => 'kde_NodeFilter*', +'NodeFilter*' => 'kde_NodeFilter*', +'NodeFilterImpl*' => 'kde_NodeFilterImpl*', +'NodeImpl*' => 'kde_NodeImpl*', +'NodeIterator&' => 'kde_NodeIterator*', +'NodeIterator' => 'kde_NodeIterator*', +'NodeIterator*' => 'kde_NodeIterator*', +'NodeIteratorImpl*' => 'kde_NodeIteratorImpl*', +'NodeList&' => 'kde_DOMNodeList*', +'NodeList' => 'kde_DOMNodeList*', +'NodeList*' => 'kde_DOMNodeList*', +'NodeListImpl*' => 'kde_NodeListImpl*', +'NodePtr' => 'int' , +'NodeType' => 'int' , +'Notation&' => 'kde_Notation*', +'Notation*' => 'kde_Notation*', +'NoteArray*' => 'kde_NoteArray*', +'Notification&' => 'kde_Notification*', +'Notification' => 'kde_Notification*', +'Notification*' => 'kde_Notification*', +'NotificationClient*' => 'kde_NotificationClient*', +'NotificationManager*' => 'kde_NotificationManager*', +'Null*' => 'null', +'Number&' => 'kde_Number*', +'Number*' => 'kde_Number*', +'Object&' => 'kde_Object*', +'Object' => 'kde_Object*', +'Object*' => 'kde_Object*', +'ObjectImp*' => 'kde_ObjectImp*', +'ObjectManager*' => 'kde_ObjectManager*', +'ObjectReference&' => 'kde_ObjectReference*', +'ObjectReference*' => 'kde_ObjectReference*', +'Object_base*' => 'kde_Object_base*', +'Object_skel*' => 'kde_Object_skel*', +'Object_stub*' => 'kde_Object_stub*', +'Observer*' => 'kde_Observer*', +'OfferList' => 'kde_OfferList*' , +'Offset' => 'int', +'OnewayDispatchFunction' => 'kde_OnewayDispatchFunction*', +'OnewayInvocation&' => 'kde_OnewayInvocation*', +'OnewayInvocation*' => 'kde_OnewayInvocation*', +'OpenURLEvent*' => 'kde_OpenURLEvent*', +'Orientation' => 'int', +'PFlags' => 'int', +'PIAccess' => 'int', +'PID' => 'long', +'PIType' => 'int', +'PTY*' => 'kde_PTY*', +'PageSize' => 'int', +'ParamDef&' => 'kde_ParamDef*', +'ParamDef*' => 'kde_ParamDef*', +'ParsedArgument*' => 'kde_ParsedArgument*', +'ParsedAttribute*' => 'kde_ParsedAttribute*', +'ParsedClass&' => 'kde_ParsedClass&', +'ParsedClass*' => 'kde_ParsedClass*', +'ParsedClassContainer*' => 'kde_ParsedClassContainer*', +'ParsedContainer*' => 'kde_ParsedContainer*', +'ParsedItem*' => 'kde_ParsedItem*', +'ParsedMethod*' => 'kde_ParsedMethod*', +'ParsedParent*' => 'kde_ParsedParent*', +'ParsedScopeContainer*' => 'kde_ParsedScopeContainer*', +'ParsedSignalSlot*' => 'kde_ParsedSignalSlot*', +'ParsedStruct*' => 'kde_ParsedStruct*', +'Part*' => 'kde_Part*', +'PartActivateEvent*' => 'kde_PartActivateEvent*', +'PartBase*' => 'kde_PartBase*', +'PartManager*' => 'kde_PartManager*', +'PartSelectEvent*' => 'kde_PartSelectEvent*', +'PassDlg*' => 'kde_PassDlg*', +'PasswordDialog*' => 'kde_PasswordDialog*', +'PenCapStyle' => 'int' , +'PenJoinStyle' => 'int' , +'PenStyle' => 'int', +'PersistantClassStore*' => 'kde_PersistantClassStore*', +'PhoneNumber&' => 'kde_PhoneNumber*', +'PhoneNumber*' => 'kde_PhoneNumber*', +'PipeBuffer*' => 'kde_PipeBuffer*', +'PipeSegment*' => 'kde_PipeSegment*', +'Pix&' => 'kde_Pix*' , +'Pix' => 'kde_Pix*' , +'PixelMetric' => 'int', +'PlayObject&' => 'kde_PlayObject*', +'PlayObject' => 'kde_PlayObject*', +'PlayObject*' => 'kde_PlayObject*', +'PlayObjectFactory&' => 'kde_PlayObjectFactory*', +'PlayObjectFactory' => 'kde_PlayObjectFactory', +'PlayObjectFactory*' => 'kde_PlayObjectFactory*', +'PlayObjectFactory_base*' => 'kde_PlayObjectFactory_base*', +'PlayObjectFactory_skel*' => 'kde_PlayObjectFactory_skel*', +'PlayObjectFactory_stub*' => 'kde_PlayObjectFactory_stub*', +'PlayObject_base*' => 'kde_PlayObject_base*', +'PlayObject_private&' => 'kde_PlayObject_private*', +'PlayObject_private' => 'kde_PlayObject_private', +'PlayObject_private*' => 'kde_PlayObject_private*', +'PlayObject_private_base*' => 'kde_PlayObject_private_base*', +'PlayObject_private_skel*' => 'kde_PlayObject_private_skel*', +'PlayObject_private_stub*' => 'kde_PlayObject_private_stub*', +'PlayObject_skel*' => 'kde_PlayObject_skel*', +'PlayObject_stub*' => 'kde_PlayObject_stub*', +'PlayerController*' => 'kde_PlayerController*', +'Plugin*' => 'kde_Plugin*', +'PluginInfo*' => 'kde_PluginInfo*', +'Policy' => 'int', +'Pool&' => 'kde_Pool*', +'Pool*' => 'kde_Pool*', +'PopupMenuInterface*' => 'kde_PopupMenuInterface*', +'Port*' => 'kde_Port*', +'PreviewJob*' => 'kde_PreviewJob*', +'PrimitiveElement' => 'int', +'PrintInterface*' => 'kde_PrintInterface*', +'PrinterMode' => 'int', +'ProcessingInstruction&' => 'kde_ProcessingInstruction*', +'ProcessingInstruction' => 'kde_ProcessingInstruction*', +'ProcessingInstruction*' => 'kde_ProcessingInstruction*', +'ProgressBase*' => 'kde_ProgressBase*', +'ProgressItem*' => 'kde_ProgressItem*', +'PropagationMode' => 'int', +'ProtocolInfo*' => 'kde_ProtocolInfo*', +'Ptr' => 'void *', +'PtyProcess*' => 'kde_PtyProcess*', +'QAccel*' => 'qt_QAccel*', +'QAccessible*' => 'qt_QAccessible*', +'QAccessibleFactoryInterface*' => 'qt_QAccessibleFactoryInterface*', +'QAccessibleInterface*' => 'qt_QAccessibleInterface*', +'QAccessibleInterface**' => 'qt_QAccessibleInterface**', +'QAccessibleObject*' => 'qt_QAccessibleObject*', +'QAction*' => 'qt_QAction*' , +'QActionGroup*' => 'qt_QActionGroup*', +'QApplication*' => 'qt_QApplication*' , +'QArabicCodec*' => 'qt_QArabicCodec*', +'QArray*' => 'qt_QArray*', +'QAsciiBucket*' => 'qt_QAsciiBucket*', +'QAsciiCache*' => 'qt_QAsciiCache*', +'QAsciiCacheIterator*' => 'qt_QAsciiCacheIterator*', +'QAsciiDict*' => 'qt_QAsciiDict*', +'QAsciiDictIterator*' => 'qt_QAsciiDictIterator*', +'QAsyncIO*' => 'qt_QAsyncIO*', +'QAuBucket*' => 'qt_QAuBucket*' , +'QAuServer*' => 'qt_QAuServer*', +'QBaseBucket*' => 'qt_QBaseBucket*' , +'QBig5Codec*' => 'qt_QBig5Codec*', +'QBitArray&' => 'qt_QBitArray*' , +'QBitArray' => 'qt_QBitArray*' , +'QBitArray*' => 'qt_QBitArray*' , +'QBitVal&' => 'qt_QBitVal*' , +'QBitVal' => 'qt_QBitVal*' , +'QBitVal*' => 'qt_QBitVal*', +'QBitmap&' => 'qt_QBitmap *', +'QBitmap' => 'qt_QBitmap *', +'QBitmap*' => 'qt_QBitmap *', +'QBoxLayout*' => 'qt_QBoxLayout*', +'QBrush&' => 'qt_QBrush *', +'QBrush' => 'qt_QBrush*' , +'QBrush*' => 'qt_QBrush*' , +'QBrushData*' => 'qt_QBrushData*', +'QBuffer*' => 'qt_QBuffer*', +'QButton*' => 'qt_QButton *', +'QButtonGroup*' => 'qt_QButtonGroup*' , +'QByteArray& arr ()' => 'qt_QByteArray*', +'QByteArray&' => 'qt_QByteArray*' , +'QByteArray' => 'qt_QByteArray*', +'QByteArray*' => 'qt_QByteArray*', +'QCDEStyle*' => 'qt_QCDEStyle*', +'QCOORD&' => 'short', +'QCOORD' => 'short', +'QCOORD*' => 'short *', +'QCString&' => 'qt_QCString*' , +'QCString' => 'qt_QCString*' , +'QCString*' => 'qt_QCString*' , +'QCStringLess*' => 'qt_QCStringLess*' , +'QCStringList' => 'kde_QCStringList*' , +'QCache*' => 'qt_QCache*', +'QCacheIterator*' => 'qt_QCacheIterator*', +'QCanvas*' => 'qt_QCanvas*' , +'QCanvasEllipse*' => 'qt_QCanvasEllipse*', +'QCanvasItem*' => 'qt_QCanvasItem*' , +'QCanvasItemList' => 'qt_QCanvasItemList*' , +'QCanvasItemList*' => 'qt_QCanvasItemList*', +'QCanvasLine*' => 'qt_QCanvasLine*', +'QCanvasPixmap*' => 'qt_QCanvasPixmap*' , +'QCanvasPixmapArray*' => 'qt_QCanvasPixmapArray*' , +'QCanvasPolygon*' => 'qt_QCanvasPolygon*', +'QCanvasPolygonalItem*' => 'qt_QCanvasPolygonalItem*', +'QCanvasRectangle*' => 'qt_QCanvasRectangle*', +'QCanvasSpline*' => 'qt_QCanvasSpline*', +'QCanvasSprite*' => 'qt_QCanvasSprite*', +'QCanvasText*' => 'qt_QCanvasText*', +'QCanvasView*' => 'qt_QCanvasView*' , +'QChain*' => 'qt_QChain*' , +'QChar&' => 'qt_QChar*' , +'QChar' => 'qt_QChar*' , +'QChar*' => 'qt_QChar*' , +'QChar::Category' => 'int' , +'QChar::Decomposition' => 'int' , +'QChar::Direction' => 'int' , +'QChar::Joining' => 'int' , +'QCharRef&' => 'qt_QCharRef*' , +'QCharRef' => 'qt_QCharRef*' , +'QCharRef*' => 'qt_QCharRef*', +'QCheckBox*' => 'qt_QCheckBox*', +'QCheckListItem*' => 'qt_QCheckListItem *', +'QCheckTableItem*' => 'qt_QCheckTableItem*', +'QChildEvent*' => 'qt_QChildEvent*' , +'QClassInfo*' => 'qt_QClassInfo*' , +'QCleanupHandler*' => 'qt_QCleanupHandler*', +'QClipboard*' => 'qt_QClipboard *', +'QCloseEvent*' => 'qt_QCloseEvent*' , +'QCollection&' => 'qt_QCollection*' , +'QCollection*' => 'qt_QCollection*', +'QCollection::Item&' => 'void *' , +'QCollection::Item' => 'void *' , +'QColor &' => 'qt_QColor *', +'QColor&' => 'qt_QColor *', +'QColor&fillColor::white' => 'int' , +'QColor&linkColor::blue' => 'int' , +'QColor' => 'qt_QColor *', +'QColor*' => 'qt_QColor*' , +'QColorDialog*' => 'qt_QColorDialog*', +'QColorDrag*' => 'qt_QColorDrag*', +'QColorGroup&' => 'qt_QColorGroup *', +'QColorGroup' => 'qt_QColorGroup*' , +'QColorGroup*' => 'qt_QColorGroup*' , +'QColorGroup::ColorRole' => 'int' , +'QComboBox*' => 'qt_QComboBox*' , +'QComboBox::Policy' => 'int' , +'QComboBox::Policypolicy::AtBottom' => 'int' , +'QComboTableItem*' => 'qt_QComboTableItem*', +'QCommonStyle*' => 'qt_QCommonStyle*', +'QCompactStyle*' => 'qt_QCompactStyle*', +'QComponentFactory*' => 'qt_QComponentFactory*', +'QComponentFactoryInterface*' => 'qt_QComponentFactoryInterface*', +'QComponentInterface*' => 'qt_QComponentInterface*', +'QComponentRegistration*' => 'qt_QComponentRegistration*', +'QComponentServerInterface*' => 'qt_QComponentServerInterface*', +'QConfigDB*' => 'qt_QConfigDB*' , +'QConfigDB*' => 'qt_QConfigDB*' , +'QConnection*' => 'qt_QConnection*', +'QConnectionList&' => 'qt_QConnectionList*' , +'QConnectionList*' => 'qt_QConnectionList*' , +'QConnectionListIt&' => 'qt_QConnectionListIt*' , +'QConnectionListIt*' => 'qt_QConnectionListIt*', +'QConstString' => 'qt_QConstString*', +'QConstString*' => 'qt_QConstString*', +'QContextMenuEvent*' => 'qt_QContextMenuEvent*', +'QCursor&' => 'qt_QCursor *', +'QCursor' => 'qt_QCursor*' , +'QCursor*' => 'qt_QCursor *', +'QCustomEvent*' => 'qt_QCustomEvent*' , +'QCustomMenuItem*' => 'qt_QCustomMenuItem*' , +'QDOM_NodeListPrivate*' => 'void*' , +'QDOM_NodePrivate*' => 'void*' , +'QDataBrowser*' => 'qt_QDataBrowser*', +'QDataPump*' => 'qt_QDataPump*', +'QDataSink*' => 'qt_QDataSink*' , +'QDataSource*' => 'qt_QDataSource*' , +'QDataStream&' => 'qt_QDataStream *', +'QDataStream*' => 'qt_QDataStream*' , +'QDataTable*' => 'qt_QDataTable*', +'QDataView*' => 'qt_QDataView*', +'QDate &' => 'qt_QDate *', +'QDate date()' => 'qt_QDate*', +'QDate&' => 'qt_QDate *', +'QDate' => 'qt_QDate *', +'QDate*' => 'qt_QDate*', +'QDateEdit*' => 'qt_QDateEdit*', +'QDateTime&' => 'qt_QDateTime *', +'QDateTime' => 'qt_QDateTime *', +'QDateTime*' => 'qt_QDateTime*' , +'QDateTimeEdit*' => 'qt_QDateTimeEdit*', +'QDateTimeEditBase*' => 'qt_QDateTimeEditBase*', +'QDesktopWidget*' => 'qt_QDesktopWidget*', +'QDial*' => 'qt_QDial*', +'QDialog*' => 'qt_QDialog*', +'QDict*' => 'qt_QDict*', +'QDictIterator*' => 'qt_QDictIterator*', +'QDir&' => 'qt_QDir *', +'QDir' => 'qt_QDir *', +'QDir*' => 'qt_QDir *', +'QDir::SortSpec&' => 'int' , +'QDir::SortSpec' => 'int' , +'QDirSortItem*' => 'qt_QDirSortItem*', +'QDiskFont*' => 'qt_QDiskFont*', +'QDispatchInterface*' => 'qt_QDispatchInterface*', +'QDns*' => 'qt_QDns*', +'QDnsSocket*' => 'qt_QDnsSocket*', +'QDockArea*' => 'qt_QDockArea*', +'QDockAreaLayout*' => 'qt_QDockAreaLayout*', +'QDockWindow*' => 'qt_QDockWindow*', +'QDomAttr&' => 'qt_QDomAttr*' , +'QDomAttr' => 'qt_QDomAttr*' , +'QDomAttr*' => 'qt_QDomAttr*', +'QDomCDATASection&' => 'qt_QDomCDATASection*' , +'QDomCDATASection' => 'qt_QDomCDATASection*' , +'QDomCDATASection*' => 'qt_QDomCDATASection*', +'QDomCharacterData&' => 'qt_QDomCharacterData*' , +'QDomCharacterData' => 'qt_QDomCharacterData*' , +'QDomCharacterData*' => 'qt_QDomCharacterData*', +'QDomComment&' => 'qt_QDomComment*' , +'QDomComment' => 'qt_QDomComment*' , +'QDomComment*' => 'qt_QDomComment*', +'QDomDocument&' => 'qt_QDomDocument*' , +'QDomDocument' => 'qt_QDomDocument*' , +'QDomDocument*' => 'qt_QDomDocument*', +'QDomDocumentFragment&' => 'qt_QDomDocumentFragment*' , +'QDomDocumentFragment' => 'qt_QDomDocumentFragment*' , +'QDomDocumentFragment*' => 'qt_QDomDocumentFragment*', +'QDomDocumentType&' => 'qt_QDomDocumentType*' , +'QDomDocumentType' => 'qt_QDomDocumentType*' , +'QDomDocumentType*' => 'qt_QDomDocumentType*', +'QDomElement&' => 'qt_QDomElement*' , +'QDomElement' => 'qt_QDomElement*' , +'QDomElement*' => 'qt_QDomElement*', +'QDomEntity&' => 'qt_QDomEntity*' , +'QDomEntity' => 'qt_QDomEntity*' , +'QDomEntity*' => 'qt_QDomEntity*', +'QDomEntityReference&' => 'qt_QDomEntityReference*' , +'QDomEntityReference' => 'qt_QDomEntityReference*' , +'QDomEntityReference*' => 'qt_QDomEntityReference*', +'QDomImplementation&' => 'qt_QDomImplementation*' , +'QDomImplementation' => 'qt_QDomImplementation*' , +'QDomImplementation*' => 'qt_QDomImplementation*', +'QDomNamedNodeMap&' => 'qt_QDomNamedNodeMap*' , +'QDomNamedNodeMap' => 'qt_QDomNamedNodeMap*' , +'QDomNamedNodeMap*' => 'qt_QDomNamedNodeMap*', +'QDomNode&' => 'qt_QDomNode*' , +'QDomNode' => 'qt_QDomNode*' , +'QDomNode*' => 'qt_QDomNode*', +'QDomNode::NodeType' => 'int', +'QDomNodeList&' => 'qt_QDomNodeList*' , +'QDomNodeList' => 'qt_QDomNodeList*' , +'QDomNodeList*' => 'qt_QDomNodeList*', +'QDomNodePrivate*' => 'qt_QDomNodePrivate*', +'QDomNotation&' => 'qt_QDomNotation*' , +'QDomNotation' => 'qt_QDomNotation*' , +'QDomNotation*' => 'qt_QDomNotation*', +'QDomProcessingInstruction&' => 'qt_QDomProcessingInstruction*' , +'QDomProcessingInstruction' => 'qt_QDomProcessingInstruction*' , +'QDomProcessingInstruction*' => 'qt_QDomProcessingInstruction*', +'QDomText&' => 'qt_QDomText*' , +'QDomText' => 'qt_QDomText*' , +'QDomText*' => 'qt_QDomText*', +'QDoubleValidator*' => 'qt_QDoubleValidator*', +'QDragEnterEvent*' => 'qt_QDragEnterEvent*' , +'QDragLeaveEvent*' => 'qt_QDragLeaveEvent*' , +'QDragManager*' => 'qt_QDragManager*', +'QDragMoveEvent*' => 'qt_QDragMoveEvent*' , +'QDragObject*' => 'qt_QDragObject*' , +'QDragResponseEvent*' => 'qt_QDragResponseEvent*', +'QDropEvent*' => 'qt_QDropEvent*' , +'QDropSite*' => 'qt_QDropSite*', +'QEditorFactory*' => 'qt_QEditorFactory*', +'QErrorMessage*' => 'qt_QErrorMessage*', +'QEucJpCodec*' => 'qt_QEucJpCodec*', +'QEucKrCodec*' => 'qt_QEucKrCodec*', +'QEvent*' => 'qt_QEvent *', +'QEventLoop::ProcessEventsFlags' => 'uint', +'QFeatureListInterface*' => 'qt_QFeatureListInterface*', +'QFile&' => 'qt_QFile *', +'QFile*' => 'qt_QFile*' , +'QFileDialog*' => 'qt_QFileDialog*', +'QFileIconProvider*' => 'qt_QFileIconProvider*' , +'QFileInfo&' => 'qt_QFileInfo *', +'QFileInfo*' => 'qt_QFileInfo*', +'QFileInfoList*' => 'qt_QFileInfoList*' , +'QFilePreview*' => 'qt_QFilePreview*' , +'QFocusData*' => 'qt_QFocusData*' , +'QFocusEvent*' => 'qt_QFocusEvent*' , +'QFont&' => 'qt_QFont *', +'QFont' => 'qt_QFont *', +'QFont*' => 'qt_QFont *', +'QFont::CharSet' => 'int', +'QFont::CharSetcharset::Unicode' => 'int' , +'QFont::StyleHint' => 'int', +'QFontData&' => 'qt_QFontData*' , +'QFontDatabase*' => 'qt_QFontDatabase*', +'QFontDialog*' => 'qt_QFontDialog*', +'QFontInfo&' => 'qt_QFontInfo *', +'QFontInfo' => 'qt_QFontInfo *', +'QFontInfo*' => 'qt_QFontInfo*', +'QFontMetrics&' => 'qt_QFontMetrics *', +'QFontMetrics' => 'qt_QFontMetrics *', +'QFontMetrics*' => 'qt_QFontMetrics*', +'QFrame*' => 'qt_QFrame*' , +'QFtp*' => 'qt_QFtp*', +'QGArray&' => 'qt_QGArray*' , +'QGArray*' => 'qt_QGArray*', +'QGCache&' => 'qt_QGCache*' , +'QGCache*' => 'qt_QGCache*', +'QGCacheIterator&' => 'qt_QGCacheIterator*' , +'QGCacheIterator*' => 'qt_QGCacheIterator*', +'QGDict&' => 'qt_QGDict*' , +'QGDict*' => 'qt_QGDict*', +'QGDictIterator&' => 'qt_QGDictIterator*' , +'QGDictIterator*' => 'qt_QGDictIterator*', +'QGL*' => 'qt_QGL*', +'QGLColormap&' => 'qt_QGLColormap*', +'QGLColormap*' => 'qt_QGLColormap*', +'QGLContext*' => 'qt_QGLContext*' , +'QGLFormat&' => 'qt_QGLFormat*' , +'QGLFormat' => 'qt_QGLFormat*' , +'QGLFormat*' => 'qt_QGLFormat*', +'QGLWidget*' => 'qt_QGLWidget*' , +'QGLayoutIterator*' => 'qt_QGLayoutIterator*' , +'QGList&' => 'qt_QGList*' , +'QGList*' => 'qt_QGList*' , +'QGListIterator&' => 'qt_QGListIterator*' , +'QGListIterator*' => 'qt_QGListIterator*', +'QGPlugin*' => 'qt_QGPlugin*', +'QGPluginManager*' => 'qt_QGPluginManager*', +'QGVector&' => 'qt_QGVector*' , +'QGVector*' => 'qt_QGVector*' , +'QGbkCodec*' => 'qt_QGbkCodec*', +'QGfx*' => 'qt_QGfx*' , +'QGrid*' => 'qt_QGrid*' , +'QGrid::Direction' => 'int' , +'QGridLayout*' => 'qt_QGridLayout*', +'QGridView*' => 'qt_QGridView*', +'QGroupBox*' => 'qt_QGroupBox*', +'QGuardedPtr*' => 'qt_QGuardedPtr*', +'QGuardedPtrPrivate*' => 'qt_QGuardedPtrPrivate*', +'QHBox*' => 'qt_QHBox*' , +'QHBoxLayout*' => 'qt_QHBoxLayout*' , +'QHButtonGroup*' => 'qt_QHButtonGroup*', +'QHGroupBox*' => 'qt_QHGroupBox*', +'QHeader*' => 'qt_QHeader *', +'QHebrewCodec*' => 'qt_QHebrewCodec*', +'QHideEvent*' => 'qt_QHideEvent*' , +'QHostAddress&' => 'qt_QHostAddress*' , +'QHostAddress' => 'qt_QHostAddress*' , +'QHostAddress*' => 'qt_QHostAddress*' , +'QHttp*' => 'qt_QHttp*', +'QIMEvent*' => 'qt_QIMEvent*', +'QIODevice*' => 'qt_QIODevice *', +'QIODevice::Offset' => 'int', +'QIODeviceSource*' => 'qt_QIODeviceSource*', +'QIOManager*' => 'qt_QIOManager*', +'QIOWatch*' => 'qt_QIOWatch*', +'QIconDrag*' => 'qt_QIconDrag*', +'QIconDragItem&' => 'qt_QIconDragItem*' , +'QIconDragItem*' => 'qt_QIconDragItem*', +'QIconSet&' => 'qt_QIconSet*' , +'QIconSet' => 'qt_QIconSet*' , +'QIconSet*' => 'qt_QIconSet*' , +'QIconView*' => 'qt_QIconView*' , +'QIconViewItem*' => 'qt_QIconViewItem*' , +'QImage&' => 'qt_QImage *', +'QImage' => 'qt_QImage *', +'QImage*' => 'qt_QImage*' , +'QImageConsumer*' => 'qt_QImageConsumer*' , +'QImageData*' => 'qt_QImageData*', +'QImageDecoder*' => 'qt_QImageDecoder*', +'QImageDrag*' => 'qt_QImageDrag*', +'QImageFormat*' => 'qt_QImageFormat*' , +'QImageFormatInterface*' => 'qt_QImageFormatInterface*', +'QImageFormatPlugin*' => 'qt_QImageFormatPlugin*', +'QImageFormatType*' => 'qt_QImageFormatType*' , +'QImageIO*' => 'qt_QImageIO*', +'QImageTextKeyLang&' => 'qt_QImageTextKeyLang*' , +'QImageTextKeyLang*' => 'qt_QImageTextKeyLang*', +'QInputDialog*' => 'qt_QInputDialog*', +'QIntBucket*' => 'qt_QIntBucket*', +'QIntCache*' => 'qt_QIntCache*', +'QIntCacheIterator*' => 'qt_QIntCacheIterator*', +'QIntDict*' => 'qt_QIntDict*', +'QIntDictIterator*' => 'qt_QIntDictIterator*', +'QIntValidator*' => 'qt_QIntValidator*', +'QInterfaceListInterface*' => 'qt_QInterfaceListInterface*', +'QInterfacePtr*' => 'qt_QInterfacePtr*', +'QInterlaceStyle*' => 'qt_QInterlaceStyle*', +'QInternal*' => 'qt_QInternal*', +'QJisCodec*' => 'qt_QJisCodec*', +'QJpUnicodeConv*' => 'qt_QJpUnicodeConv*' , +'QKeyEvent*' => 'qt_QKeyEvent*' , +'QKeySequence&' => 'qt_QKeySequence*', +'QKeySequence' => 'qt_QKeySequence*', +'QKeySequence*' => 'qt_QKeySequence*', +'QKoi8Codec*' => 'qt_QKoi8Codec*', +'QLCDNumber*' => 'qt_QLCDNumber*', +'QLNode*' => 'qt_QLNode*' , +'QLabel*' => 'qt_QLabel *', +'QLayout*' => 'qt_QLayout *', +'QLayoutItem*' => 'qt_QLayoutItem*' , +'QLayoutIterator&' => 'qt_QLayoutIterator*' , +'QLayoutIterator' => 'qt_QLayoutIterator*' , +'QLayoutIterator*' => 'qt_QLayoutIterator*', +'QLibrary*' => 'qt_QLibrary*', +'QLibrary::Policy' => 'int', +'QLibraryInterface*' => 'qt_QLibraryInterface*', +'QLineEdit*' => 'qt_QLineEdit*' , +'QLineEdit::EchoMode' => 'int' , +'QList*' => 'qt_QList*', +'QListBox*' => 'qt_QListBox *', +'QListBoxItem*' => 'qt_QListBoxItem *', +'QListBoxPixmap*' => 'qt_QListBoxPixmap*', +'QListBoxText*' => 'qt_QListBoxText*', +'QListIterator*' => 'qt_QListIterator*', +'QListView*' => 'qt_QListView *', +'QListViewItem*&' => 'qt_QListViewItem*', +'QListViewItem*' => 'qt_QListViewItem *', +'QListViewItemIterator&' => 'qt_QListViewItemIterator*' , +'QListViewItemIterator' => 'qt_QListViewItemIterator*' , +'QListViewItemIterator*' => 'qt_QListViewItemIterator*', +'QLocalFs*' => 'qt_QLocalFs*', +'QMCPI*' => 'qt_QMCPI*', +'QMSG*' => 'QMSG*' , +'QMainWindow*' => 'qt_QMainWindow*' , +'QMainWindow::ToolBarDock' => 'int', +'QMainWindow::ToolBarDock::Top' => 'int' , +'QMap&' => 'qt_QMap*' , +'QMap*' => 'qt_QMap*', +'QMapConstIterator*' => 'qt_QMapConstIterator*', +'QMapIterator*' => 'qt_QMapIterator*', +'QMapNode*' => 'qt_QMapNode*', +'QMapNodeBase*&' => 'qt_QMapNodeBase*' , +'QMapNodeBase*' => 'qt_QMapNodeBase*' , +'QMapPrivate*' => 'qt_QMapPrivate*', +'QMapPrivateBase*' => 'qt_QMapPrivateBase*' , +'QMemArray*' => 'qt_QMemArray*', +'QMember' => 'qt_QMember*' , +'QMember*' => 'qt_QMember*' , +'QMenuBar*' => 'qt_QMenuBar *', +'QMenuData*' => 'qt_QMenuData*', +'QMenuData**' => 'qt_QMenuData**' , +'QMenuItem*' => 'qt_QMenuItem *', +'QMessageBox*' => 'qt_QMessageBox*', +'QMetaData*' => 'qt_QMetaData*' , +'QMetaData::Access*' => 'int*' , +'QMetaEnum*' => 'qt_QMetaEnum*' , +'QMetaEnum::Item*' => 'int*' , +'QMetaObject*&' => 'qt_QMetaObject*', +'QMetaObject*' => 'qt_QMetaObject *', +'QMetaObjectCleanUp*' => 'qt_QMetaObjectCleanUp*', +'QMetaObjectInit*' => 'qt_QMetaObjectInit*', +'QMetaProperty*' => 'qt_QMetaProperty*' , +'QMimeSource*' => 'qt_QMimeSource*' , +'QMimeSourceFactory*' => 'qt_QMimeSourceFactory*' , +'QMotifPlusStyle*' => 'qt_QMotifPlusStyle*', +'QMotifStyle*' => 'qt_QMotifStyle*', +'QMouseEvent*' => 'qt_QMouseEvent*' , +'QMoveEvent*' => 'qt_QMoveEvent*' , +'QMovie&' => 'qt_QMovie *', +'QMovie*' => 'qt_QMovie *', +'QMultiLineEdit*' => 'qt_QMultiLineEdit*', +'QMultiLineEditRow*' => 'qt_QMultiLineEditRow*', +'QMutex*' => 'qt_QMutex*', +'QNPInstance*' => 'qt_QNPInstance*', +'QNPStream*' => 'qt_QNPStream*', +'QNPWidget*' => 'qt_QNPWidget*', +'QNPlugin*' => 'qt_QNPlugin*', +'QNetworkOperation*' => 'qt_QNetworkOperation*' , +'QNetworkProtocol*' => 'qt_QNetworkProtocol*' , +'QNetworkProtocol::Operation' => 'int' , +'QNetworkProtocol::State' => 'int' , +'QNetworkProtocolFactory*' => 'qt_QNetworkProtocolFactory*', +'QNetworkProtocolFactoryBase*' => 'qt_QNetworkProtocolFactoryBase*' , +'QObject*' => 'qt_QObject *', +'QObjectCleanupHandler*' => 'qt_QObjectCleanupHandler*', +'QObjectDictionary&' => 'qt_QObjectDictionary*' , +'QObjectDictionary*' => 'qt_QObjectDictionary*', +'QObjectInterface*' => 'qt_QObjectInterface*', +'QObjectList&' => 'qt_QObjectList*' , +'QObjectList*' => 'qt_QObjectList*', +'QObjectListIt&' => 'qt_QObjectListIt*' , +'QObjectListIt*' => 'qt_QObjectListIt*', +'QPNGImagePacker*' => 'qt_QPNGImagePacker*', +'QPNGImageWriter*' => 'qt_QPNGImageWriter*', +'QPaintDevice*' => 'qt_QPaintDevice *', +'QPaintDeviceMetrics*' => 'qt_QPaintDeviceMetrics*', +'QPaintDeviceX11Data*' => 'qt_QPaintDeviceX11Data*' , +'QPaintEvent*' => 'qt_QPaintEvent*' , +'QPainter&' => 'qt_QPainter*' , +'QPainter*' => 'qt_QPainter *', +'QPair*' => 'qt_QPair*', +'QPalData*' => 'qt_QPalData*', +'QPalette&' => 'qt_QPalette *', +'QPalette' => 'qt_QPalette *', +'QPalette*' => 'qt_QPalette *', +'QPen&' => 'qt_QPen *', +'QPen' => 'qt_QPen*' , +'QPen*' => 'qt_QPen*', +'QPenData*' => 'qt_QPenData*', +'QPicture&' => 'qt_QPicture *', +'QPicture' => 'qt_QPicture*', +'QPicture*' => 'qt_QPicture*', +'QPicturePrivate*' => 'qt_QPicturePrivate*', +'QPixmap& pixmap()' => 'kde_QPixmap*', +'QPixmap&' => 'qt_QPixmap *', +'QPixmap' => 'qt_QPixmap *', +'QPixmap*' => 'qt_QPixmap *', +'QPixmap::Optimization' => 'int' , +'QPixmap::Optimization' => 'int', +'QPixmap::Optimization::DefaultOptim' => 'int' , +'QPixmapCache*' => 'qt_QPixmapCache*', +'QPixmapData*' => 'qt_QPixmapData*', +'QPlatinumStyle*' => 'qt_QPlatinumStyle*', +'QPluginManager*' => 'qt_QPluginManager*', +'QPoint&' => 'qt_QPoint*', +'QPoint&pos()' => 'int' , +'QPoint&pos::pos()' => 'int' , +'QPoint' => 'qt_QPoint*', +'QPoint*' => 'qt_QPoint*' , +'QPointArray&' => 'qt_QPointArray*', +'QPointArray' => 'qt_QPointArray*', +'QPointArray*' => 'qt_QPointArray*', +'QPointVal&' => 'qt_QPointVal*' , +'QPointVal' => 'qt_QPointVal*' , +'QPolygonScanner*' => 'qt_QPolygonScanner*', +'QPopupMenu*' => 'qt_QPopupMenu*', +'QPrintDialog*' => 'qt_QPrintDialog*', +'QPrinter*' => 'qt_QPrinter*' , +'QPrinter::PrinterMode' => 'int', +'QProcess*' => 'qt_QProcess*', +'QProgressBar*' => 'qt_QProgressBar*', +'QProgressDialog*' => 'qt_QProgressDialog*', +'QPtrBucket*' => 'qt_QPtrBucket*', +'QPtrCollection&' => 'qt_QPtrCollection*', +'QPtrCollection*' => 'qt_QPtrCollection*', +'QPtrDict*' => 'qt_QPtrDict*', +'QPtrDictIterator*' => 'qt_QPtrDictIterator*', +'QPtrList*' => 'qt_QPtrList*', +'QPtrListIterator*' => 'qt_QPtrListIterator*', +'QPtrQueue*' => 'qt_QPtrQueue*', +'QPtrStack*' => 'qt_QPtrStack*', +'QPtrVector*' => 'qt_QPtrVector*', +'QPushButton*' => 'qt_QPushButton*', +'QQueue*' => 'qt_QQueue*', +'QRESULT' => 'long', +'QRadioButton*' => 'qt_QRadioButton*', +'QRangeControl*' => 'qt_QRangeControl*', +'QRect&' => 'qt_QRect*', +'QRect' => 'qt_QRect*', +'QRect*' => 'qt_QRect*', +'QRegExp&' => 'qt_QRegExp*', +'QRegExp*' => 'qt_QRegExp*', +'QRegExpValidator*' => 'qt_QRegExpValidator*', +'QRegion&' => 'qt_QRegion *', +'QRegion' => 'qt_QRegion *', +'QRegion*' => 'qt_QRegion*', +'QRegionData*' => 'qt_QRegionData*', +'QRemoteFactory*' => 'qt_QRemoteFactory*', +'QRemotePlugin*' => 'qt_QRemotePlugin*', +'QResizeEvent*' => 'qt_QResizeEvent*' , +'QRgb' => 'unsigned int', +'QRgb*' => 'int *', +'QRichText&' => 'qt_QRichText*' , +'QSGIStyle*' => 'qt_QSGIStyle*', +'QScrollBar&' => 'qt_QScrollBar*' , +'QScrollBar*' => 'qt_QScrollBar*' , +'QScrollView*' => 'qt_QScrollView*', +'QSemaphore*' => 'qt_QSemaphore*', +'QSemiModal*' => 'qt_QSemiModal*', +'QSenderObject*' => 'qt_QSenderObject*', +'QServerSocket*' => 'qt_QServerSocket*', +'QSessionManager&' => 'qt_QSessionManager*' , +'QSessionManager*' => 'qt_QSessionManager*', +'QSettings*' => 'qt_QSettings*', +'QShared*' => 'qt_QShared*', +'QShowEvent*' => 'qt_QShowEvent*' , +'QSignal*' => 'qt_QSignal *', +'QSignalDict&' => 'qt_QSignalDict*' , +'QSignalDict*' => 'qt_QSignalDict*', +'QSignalDictIt&' => 'qt_QSignalDictIt*' , +'QSignalDictIt*' => 'qt_QSignalDictIt*', +'QSignalMapper*' => 'qt_QSignalMapper*', +'QSignalVec&' => 'qt_QSignalVec*', +'QSignalVec*' => 'qt_QSignalVec*', +'QSimpleRichText*' => 'qt_QSimpleRichText*', +'QSize&' => 'qt_QSize *', +'QSize' => 'qt_QSize *', +'QSize*' => 'qt_QSize*' , +'QSizeGrip*' => 'qt_QSizeGrip*', +'QSizePolicy&' => 'qt_QSizePolicy*' , +'QSizePolicy' => 'qt_QSizePolicy*' , +'QSizePolicy*' => 'qt_QSizePolicy*', +'QSizePolicy::ExpandData' => 'int' , +'QSizePolicy::SizeTypehData::Minimum' => 'int' , +'QSizePolicy::SizeTypevData::Minimum' => 'int' , +'QSjisCodec*' => 'qt_QSjisCodec*', +'QSlider*' => 'qt_QSlider*', +'QSmartPtr&' => 'qt_QSmartPtr*' , +'QSmartPtr*' => 'qt_QSmartPtr*', +'QSmartPtrPrivate*' => 'qt_QSmartPtrPrivate*', +'QSocket*' => 'qt_QSocket*', +'QSocketDevice*' => 'qt_QSocketDevice*' , +'QSocketNotifier*' => 'qt_QSocketNotifier*', +'QSocketNotifier::Type' => 'int', +'QSortedList*' => 'qt_QSortedList*', +'QSound*' => 'qt_QSound*', +'QSpacerItem*' => 'qt_QSpacerItem*' , +'QSpinBox*' => 'qt_QSpinBox*', +'QSpinWidget*' => 'qt_QSpinWidget*', +'QSplitter*' => 'qt_QSplitter*', +'QSql*' => 'qt_QSql*', +'QSql::Confirm' => 'int', +'QSql::Op' => 'int', +'QSqlCursor&' => 'qt_QSqlCursor*', +'QSqlCursor' => 'qt_QSqlCursor*', +'QSqlCursor*' => 'qt_QSqlCursor*', +'QSqlDatabase*' => 'qt_QSqlDatabase*', +'QSqlDriver*' => 'qt_QSqlDriver*', +'QSqlDriverCreator*' => 'qt_QSqlDriverCreator*', +'QSqlDriverCreatorBase*' => 'qt_QSqlDriverCreatorBase*', +'QSqlDriverFactoryInterface*' => 'qt_QSqlDriverFactoryInterface*', +'QSqlDriverPlugin*' => 'qt_QSqlDriverPlugin*', +'QSqlEditorFactory*' => 'qt_QSqlEditorFactory*', +'QSqlError&' => 'qt_QSqlError*', +'QSqlError' => 'qt_QSqlError*', +'QSqlError*' => 'qt_QSqlError*', +'QSqlField&' => 'qt_QSqlField*', +'QSqlField' => 'qt_QSqlField*', +'QSqlField*' => 'qt_QSqlField*', +'QSqlFieldInfo&' => 'qt_QSqlFieldInfo*', +'QSqlFieldInfo*' => 'qt_QSqlFieldInfo*', +'QSqlForm' => 'qt_QSqlForm*', +'QSqlForm*' => 'qt_QSqlForm*', +'QSqlIndex&' => 'qt_QSqlIndex*', +'QSqlIndex' => 'qt_QSqlIndex*', +'QSqlIndex*' => 'qt_QSqlIndex*', +'QSqlPropertyMap*' => 'qt_QSqlPropertyMap*', +'QSqlQuery&' => 'qt_QSqlQuery*', +'QSqlQuery' => 'qt_QSqlQuery*', +'QSqlQuery*' => 'qt_QSqlQuery*', +'QSqlRecord&' => 'qt_QSqlRecord*', +'QSqlRecord' => 'qt_QSqlRecord*', +'QSqlRecord*' => 'qt_QSqlRecord*', +'QSqlRecordInfo&' => 'qt_QSqlRecordInfo*', +'QSqlRecordInfo' => 'qt_QSqlRecordInfo*', +'QSqlRecordInfo*' => 'qt_QSqlRecordInfo*', +'QSqlRecordPrivate*' => 'qt_QSqlRecordPrivate*', +'QSqlRecordShared*' => 'qt_QSqlRecordShared*', +'QSqlResult' => 'qt_QSqlResult*', +'QSqlResult*' => 'qt_QSqlResult*', +'QSqlResultShared*' => 'qt_QSqlResultShared*', +'QStack*' => 'qt_QStack*', +'QStatusBar*' => 'qt_QStatusBar*' , +'QStoredDrag*' => 'qt_QStoredDrag*', +'QStrIList' => 'kde_QStrIList', +'QStrIList*' => 'qt_QStrIList*', +'QStrIVec*' => 'qt_QStrIVec*', +'QStrList&' => 'qt_QStrList *', +'QStrList' => 'qt_QStrList *', +'QStrList*' => 'qt_QStrList *', +'QStrListIterator*' => 'qt_QStrListIterator*', +'QStrVec*' => 'qt_QStrVec*', +'QString&' => 'qt_QString *', +'QString&::null' => 'qt_QString*' , +'QString&button0Text::null' => 'qt_QString*' , +'QString&button1Text::null' => 'qt_QString*' , +'QString&button2Text::null' => 'qt_QString*' , +'QString&buttonText::null' => 'qt_QString*' , +'QString&caption::null' => 'qt_QString*' , +'QString&charSet::null' => 'qt_QString*' , +'QString&context::null' => 'qt_QString*' , +'QString&defValue::null' => 'qt_QString*' , +'QString&dir::null' => 'qt_QString*' , +'QString&directory::null' => 'qt_QString*' , +'QString&filter::null' => 'qt_QString*' , +'QString&initially::null' => 'qt_QString*' , +'QString&location::null' => 'qt_QString*' , +'QString&n::null' => 'qt_QString*' , +'QString&nameFilter::null' => 'qt_QString*' , +'QString&noButtonText::null' => 'qt_QString*' , +'QString&search_delimiters::null' => 'qt_QString*' , +'QString&style::null' => 'qt_QString*' , +'QString&suffix::null' => 'qt_QString*' , +'QString&text::null' => 'qt_QString*' , +'QString&text_::null' => 'qt_QString*' , +'QString&translation::null' => 'qt_QString*' , +'QString&yesButtonText::null' => 'qt_QString*' , +'QString' => 'qt_QString *', +'QString*' => 'qt_QString*' , +'QString::null' => 'qt_QString_null()' , +'QStringBucket*' => 'qt_QStringBucket*', +'QStringData*' => 'qt_QStringData*', +'QStringList&' => 'qt_QStringList*' , +'QStringList' => 'qt_QStringList*' , +'QStringList*' => 'qt_QStringList*' , +'QStringcharSetName::null' => 'qt_QStringcharSetName*' , +'QStyle&' => 'qt_QStyle*' , +'QStyle*' => 'qt_QStyle*' , +'QStyle::ScrollControl' => 'int' , +'QStyle::StylePixmap' => 'int', +'QStyle::SubControl' => 'int', +'QStyle::SubRect' => 'int', +'QStyleFactory*' => 'qt_QStyleFactory*', +'QStyleFactoryInterface*' => 'qt_QStyleFactoryInterface*', +'QStyleHintReturn*' => 'qt_QStyleHintReturn*', +'QStyleOption&' => 'int', +'QStyleOption' => 'int', +'QStyleOption*' => 'int*', +'QStylePlugin*' => 'qt_QStylePlugin*', +'QStyleSheet*' => 'qt_QStyleSheet*' , +'QStyleSheetItem&' => 'qt_QStyleSheetItem*' , +'QStyleSheetItem*' => 'qt_QStyleSheetItem*' , +'QStyleSheetItem::DisplayMode*' => 'int', +'QStyleSheetItem::ListStyle*' => 'int', +'QStyleSheetItem::WhiteSpaceMode' => 'int', +'QTSCIICodec*' => 'qt_QTSCIICodec*', +'QTSMFI' => 'int' , +'QTab*' => 'qt_QTab*', +'QTabBar*' => 'qt_QTabBar*' , +'QTabBar::Shape' => 'int' , +'QTabDialog*' => 'qt_QTabDialog*', +'QTabWidget*' => 'qt_QTabWidget*', +'QTable*' => 'qt_QTable*' , +'QTableHeader*' => 'qt_QTableHeader*', +'QTableItem*' => 'qt_QTableItem*' , +'QTableSelection&' => 'qt_QTableSelection*' , +'QTableSelection' => 'qt_QTableSelection*' , +'QTableSelection*' => 'qt_QTableSelection*', +'QTableView*' => 'qt_QTableView*', +'QTabletEvent*' => 'qt_QTabletEvent*', +'QTextBrowser*' => 'qt_QTextBrowser*', +'QTextCodec*' => 'qt_QTextCodec*' , +'QTextCodecFactory*' => 'qt_QTextCodecFactory*', +'QTextCodecFactoryInterface*' => 'qt_QTextCodecFactoryInterface*', +'QTextCodecPlugin*' => 'qt_QTextCodecPlugin*', +'QTextCursor*' => 'qt_QTextCursor*', +'QTextDecoder*' => 'qt_QTextDecoder*' , +'QTextDocument*' => 'qt_QTextDocument*', +'QTextDrag*' => 'qt_QTextDrag*', +'QTextEdit*' => 'qt_QTextEdit*', +'QTextEncoder*' => 'qt_QTextEncoder*' , +'QTextFormat*' => 'qt_QTextFormat*', +'QTextIStream*' => 'qt_QTextIStream*', +'QTextOStream&' => 'qt_QTextOStream*' , +'QTextOStream*' => 'qt_QTextOStream*', +'QTextOStreamIterator*' => 'qt_QTextOStreamIterator*', +'QTextParag**' => 'qt_QTextParag**', +'QTextStream&' => 'qt_QTextStream*' , +'QTextStream*' => 'qt_QTextStream*' , +'QTextView*' => 'qt_QTextView*', +'QThread*' => 'qt_QThread*', +'QThreadData*' => 'qt_QThreadData*', +'QThreadEvent*' => 'qt_QThreadEvent*', +'QTime&' => 'qt_QTime *', +'QTime' => 'qt_QTime *', +'QTime*' => 'qt_QTime*', +'QTimeEdit*' => 'qt_QTimeEdit*', +'QTimeWatch*' => 'qt_QTimeWatch*', +'QTimer*' => 'qt_QTimer*', +'QTimerEvent*' => 'qt_QTimerEvent*' , +'QToolBar*' => 'qt_QToolBar*' , +'QToolButton*' => 'qt_QToolButton*' , +'QToolTip*' => 'qt_QToolTip*', +'QToolTipGroup*' => 'qt_QToolTipGroup *', +'QTranslator*' => 'qt_QTranslator*' , +'QTranslatorMessage&' => 'qt_QTranslatorMessage*' , +'QTranslatorMessage' => 'qt_QTranslatorMessage*' , +'QTranslatorMessage*' => 'qt_QTranslatorMessage*', +'QTsciiCodec*' => 'qt_QTsciiCodec*', +'QUObject*' => 'qt_QUObject*', +'QUnknownInterface*' => 'qt_QUnknownInterface*', +'QUnknownInterface**' => 'qt_QUnknownInterface**', +'QUriDrag*' => 'qt_QUriDrag*', +'QUrl&' => 'qt_QUrl*' , +'QUrl' => 'qt_QUrl*' , +'QUrl*' => 'qt_QUrl*', +'QUrlInfo&' => 'qt_QUrlInfo*' , +'QUrlInfo' => 'qt_QUrlInfo*' , +'QUrlInfo*' => 'qt_QUrlInfo*', +'QUrlOperator&' => 'qt_QUrlOperator*' , +'QUrlOperator*' => 'qt_QUrlOperator*' , +'QUtf16Codec*' => 'qt_QUtf16Codec*', +'QUtf8Codec*' => 'qt_QUtf8Codec*', +'QUuid&' => 'qt_QUuid*', +'QUuid*' => 'qt_QUuid*', +'QVBox*' => 'qt_QVBox*' , +'QVBoxLayout*' => 'qt_QVBoxLayout*', +'QVButtonGroup*' => 'qt_QVButtonGroup*', +'QVFbHeader*' => 'qt_QVFbHeader*', +'QVFbKeyData*' => 'qt_QVFbKeyData*', +'QVGroupBox*' => 'qt_QVGroupBox*', +'QValidator*' => 'qt_QValidator *', +'QValidator::State' => 'int', +'QValueList*' => 'qt_QValueList*', +'QValueListConstIterator*' => 'qt_QValueListConstIterator*', +'QValueListIterator*' => 'qt_QValueListIterator*', +'QValueListNode*' => 'qt_QValueListNode*', +'QValueListPrivate*' => 'qt_QValueListPrivate*', +'QValueStack*' => 'qt_QValueStack*', +'QValueVector*' => 'qt_QValueVector*', +'QValueVectorPrivate*' => 'qt_QValueVectorPrivate*', +'QVariant&' => 'qt_QVariant *', +'QVariant' => 'qt_QVariant *', +'QVariant*' => 'qt_QVariant*', +'QVariant::Type' => 'int' , +'QVariantPrivate*' => 'qt_QVariantPrivate*' , +'QVector*' => 'qt_QVector*', +'QWMatrix&' => 'qt_QWMatrix *', +'QWMatrix' => 'qt_QWMatrix *', +'QWMatrix*' => 'qt_QWMatrix*', +'QWSDecoration&' => 'qt_QWSDecoration*' , +'QWSDecoration*' => 'qt_QWSDecoration*' , +'QWSDisplay*' => 'qt_QWSDisplay*' , +'QWSEvent*' => 'qt_QWSEvent*' , +'QWaitCondition*' => 'qt_QWaitCondition*', +'QWhatsThis*' => 'qt_QWhatsThis*', +'QWheelEvent*' => 'qt_QWheelEvent*' , +'QWidget *' => 'qt_QWidget *', +'QWidget' => 'qt_QWidget *', +'QWidget*' => 'qt_QWidget *', +'QWidgetFactory*' => 'qt_QWidgetFactory*', +'QWidgetIntDict&' => 'qt_QWidgetIntDict*' , +'QWidgetIntDict*' => 'qt_QWidgetIntDict*', +'QWidgetIntDictIt&' => 'qt_QWidgetIntDictIt*' , +'QWidgetIntDictIt*' => 'qt_QWidgetIntDictIt*', +'QWidgetItem*' => 'qt_QWidgetItem*', +'QWidgetList&' => 'qt_QWidgetList *' , +'QWidgetList&' => 'qt_QWidgetList*' , +'QWidgetList' => 'qt_QWidgetList *' , +'QWidgetList' => 'qt_QWidgetList*' , +'QWidgetList*' => 'qt_QWidgetList *', +'QWidgetList*' => 'qt_QWidgetList*', +'QWidgetListIt&' => 'qt_QWidgetListIt*' , +'QWidgetListIt*' => 'qt_QWidgetListIt*', +'QWidgetMapper*' => 'qt_QWidgetMapper*', +'QWidgetPlugin*' => 'qt_QWidgetPlugin*', +'QWidgetStack*' => 'qt_QWidgetStack*', +'QWindowsMime*' => 'qt_QWindowsMime*' , +'QWindowsStyle*' => 'qt_QWindowsStyle*', +'QWizard*' => 'qt_QWizard*', +'QWorkspace*' => 'qt_QWorkspace*', +'QXEmbed*' => 'qt_QXEmbed*' , +'QXmlAttributes&' => 'qt_QXmlAttributes*' , +'QXmlAttributes*' => 'qt_QXmlAttributes*', +'QXmlContentHandler*' => 'qt_QXmlContentHandler*' , +'QXmlDTDHandler*' => 'qt_QXmlDTDHandler*' , +'QXmlDeclHandler*' => 'qt_QXmlDeclHandler*' , +'QXmlDefaultHandler*' => 'qt_QXmlDefaultHandler*', +'QXmlEntityResolver*' => 'qt_QXmlEntityResolver*' , +'QXmlErrorHandler*' => 'qt_QXmlErrorHandler*' , +'QXmlInputSource&' => 'qt_QXmlInputSource*' , +'QXmlInputSource*&' => 'qt_QXmlInputSource*', +'QXmlInputSource*' => 'qt_QXmlInputSource*' , +'QXmlLexicalHandler*' => 'qt_QXmlLexicalHandler*' , +'QXmlLocator*' => 'qt_QXmlLocator*' , +'QXmlNamespaceSupport*' => 'qt_QXmlNamespaceSupport*', +'QXmlParseException&' => 'qt_QXmlParseException*' , +'QXmlParseException*' => 'qt_QXmlParseException*', +'QXmlReader*' => 'qt_QXmlReader*', +'QXmlSimpleReader*' => 'qt_QXmlSimpleReader*' , +'QXtApplication*' => 'qt_QXtApplication*', +'QXtWidget*' => 'qt_QXtWidget*', +'Q_INT16&' => 'short', +'Q_INT16' => 'short', +'Q_INT32&' => 'int', +'Q_INT32' => 'int', +'Q_INT8&' => 'char', +'Q_INT8' => 'char', +'Q_LONG&' => 'long', +'Q_LONG' => 'long', +'Q_PACKED*' => 'void*', +'Q_UINT16&' => 'unsigned short', +'Q_UINT16' => 'unsigned short', +'Q_UINT32&' => 'unsigned int', +'Q_UINT32' => 'unsigned int', +'Q_UINT8&' => 'unsigned char', +'Q_UINT8' => 'unsigned char', +'Q_UINT8*' => 'unsigned char*' , +'Q_ULONG&' => 'long', +'Q_ULONG' => 'long', +'Qt*' => 'qt_Qt*' , +'Qt::ArrowType' => 'int' , +'Qt::BackgroundMode' => 'int', +'Qt::DateFormat' => 'int', +'Qt::GUIStyle' => 'int' , +'Qt::GUIStylecolorStyle::WindowsStyle' => 'int' , +'Qt::GUIStylestyle::WindowsStyle' => 'int' , +'Qt::Orientation' => 'int' , +'Qt::RasterOp' => 'int' , +'Qt::UIEffect' => 'int' , +'Qt::WFlags' => 'int' , +'QtMultiLineEdit*' => 'qt_QtMultiLineEdit*', +'QtMultiLineEditRow*' => 'qt_QtMultiLineEditRow*', +'QtTableView*' => 'qt_QtTableView*', +'QwAbsSpriteFieldView*' => 'qt_QwAbsSpriteFieldView*' , +'QwClusterizer*' => 'qt_QwClusterizer*' , +'QwEllipse*' => 'qt_QwEllipse*', +'QwImageSpriteField*' => 'qt_QwImageSpriteField*', +'QwMobilePositionedSprite*' => 'qt_QwMobilePositionedSprite*', +'QwMobileSprite*' => 'qt_QwMobileSprite*', +'QwPolygon*' => 'qt_QwPolygon*', +'QwPolygonalGraphic*' => 'qt_QwPolygonalGraphic*', +'QwPositionedSprite*' => 'qt_QwPositionedSprite*', +'QwPublicList*' => 'qt_QwPublicList*' , +'QwRealMobileSprite*' => 'qt_QwRealMobileSprite*', +'QwRealSprite*' => 'qt_QwRealSprite*', +'QwRectangle*' => 'qt_QwRectangle*', +'QwScrollingSpriteFieldView*' => 'qt_QwScrollingSpriteFieldView*', +'QwSprite*' => 'qt_QwSprite*', +'QwSpriteField*' => 'qt_QwSpriteField*' , +'QwSpriteField*' => 'qt_QwSpriteField*' , +'QwSpriteFieldGraphic&' => 'qt_QwSpriteFieldGraphic*' , +'QwSpriteFieldGraphic*' => 'qt_QwSpriteFieldGraphic*' , +'QwSpriteFieldView*' => 'qt_QwSpriteFieldView*', +'QwSpritePixmap*' => 'qt_QwSpritePixmap*' , +'QwSpritePixmapSequence*' => 'qt_QwSpritePixmapSequence*' , +'QwTextSprite*' => 'qt_QwTextSprite*', +'QwTiledSpriteField*' => 'qt_QwTiledSpriteField*', +'QwVirtualSprite*' => 'qt_QwVirtualSprite*', +'RArray*' => 'kde_RArray*', +'RGBColor&' => 'kde_RGBColor*', +'RGBColor' => 'kde_RGBColor*', +'RGBColor*' => 'kde_RGBColor*', +'Range&' => 'kde_Range*', +'Range' => 'kde_Range*', +'Range*' => 'kde_Range*', +'RangeException&' => 'kde_RangeException*', +'RangeException*' => 'kde_RangeException*', +'RangeImpl*' => 'kde_RangeImpl*', +'RasterOp' => 'int', +'RawDataPacket*' => 'kde_RawDataPacket*', +'ReadOnlyPart*' => 'kde_ReadOnlyPart*', +'ReadWritePart*' => 'kde_ReadWritePart*', +'Rect&' => 'kde_Rect*', +'Rect' => 'kde_Rect*', +'Rect*' => 'kde_Rect*', +'Reference&' => 'kde_Reference*', +'Reference*' => 'kde_Reference*', +'ReferenceClean*' => 'kde_ReferenceClean*', +'ReferenceHelper*' => 'kde_ReferenceHelper*', +'Region' => 'int', +'RegionType' => 'int', +'RemoteScheduleNode*' => 'kde_RemoteScheduleNode*', +'RenameDlg*' => 'kde_RenameDlg*', +'RenderStyle*' => 'kde_RenderStyle*' , +'Rep*' => 'kde_Rep*', +'RunMode' => 'int' , +'SButton*' => 'kde_SButton*', +'SCFlags' => 'int', +'SFlags' => 'int', +'ScheduleNode*' => 'kde_ScheduleNode*', +'Scheduler*' => 'kde_Scheduler*', +'ScrollBarMode' => 'int', +'ScrollControl' => 'int' , +'SearchInterface*' => 'kde_SearchInterface*', +'Section&' => 'kde_Section*' , +'Section*&' => 'kde_Section*' , +'Section*' => 'kde_Section*' , +'SegmentStyle' => 'int', +'SelectionInterface*' => 'kde_SelectionInterface*', +'Separator' => 'int', +'Server&' => 'Server*' , +'Server*' => 'kde_Server*', +'ServerHello&' => 'kde_ServerHello*', +'ServerHello*' => 'kde_ServerHello*', +'Service*' => 'kde_Service*', +'SessionData*' => 'kde_SessionData*', +'SimpleFormat*' => 'kde_SimpleFormat*', +'SimpleJob*' => 'kde_SimpleJob*', +'SimpleSoundServer&' => 'kde_SimpleSoundServer*', +'SimpleSoundServer' => 'kde_SimpleSoundServer*', +'SimpleSoundServer*' => 'kde_SimpleSoundServer*', +'SimpleSoundServer_base*' => 'kde_SimpleSoundServer_base*', +'SimpleSoundServer_skel*' => 'kde_SimpleSoundServer_skel*', +'SimpleSoundServer_stub*' => 'kde_SimpleSoundServer_stub*', +'SkipDlg*' => 'kde_SkipDlg*', +'Slave*' => 'kde_Slave*', +'SlaveBase*' => 'kde_SlaveBase*', +'SlaveBasePrivate*' => 'kde_SlaveBasePrivate*', +'SlaveConfig*' => 'kde_SlaveConfig*', +'SlaveInterface*' => 'kde_SlaveInterface*', +'SocketConnection*' => 'kde_SocketConnection*', +'Spec' => 'int', +'SpecialEvent*' => 'kde_SpecialEvent*', +'SshProcess*' => 'kde_SshProcess*', +'SshProcessPrivate*' => 'kde_SshProcessPrivate*', +'StartupClass*' => 'kde_StartupClass*', +'StartupManager*' => 'kde_StartupManager*', +'StatJob*' => 'kde_StatJob*', +'State' => 'int', +'QSocket::State' => 'int', +'StatusbarProgress*' => 'kde_StatusbarProgress*', +'StdAddressBook*' => 'kde_StdAddressBook*', +'StdFlowSystem*' => 'kde_StdFlowSystem*', +'StdIOManager*' => 'kde_StdIOManager*', +'StdScheduleNode*' => 'kde_StdScheduleNode*', +'StdSynthModule*' => 'kde_StdSynthModule*', +'StereoEffect&' => 'kde_StereoEffect*', +'StereoEffect' => 'kde_StereoEffect*', +'StereoEffect*' => 'kde_StereoEffect*', +'StereoEffectStack&' => 'kde_StereoEffectStack*', +'StereoEffectStack' => 'kde_StereoEffectStack*', +'StereoEffectStack*' => 'kde_StereoEffectStack*', +'StereoEffectStack_base*' => 'kde_StereoEffectStack_base*', +'StereoEffectStack_skel*' => 'kde_StereoEffectStack_skel*', +'StereoEffectStack_stub*' => 'kde_StereoEffectStack_stub*', +'StereoEffect_base*' => 'kde_StereoEffect_base*', +'StereoEffect_skel*' => 'kde_StereoEffect_skel*', +'StereoEffect_stub*' => 'kde_StereoEffect_stub*', +'StereoFFTScope&' => 'kde_StereoFFTScope*', +'StereoFFTScope' => 'kde_StereoFFTScope*', +'StereoFFTScope*' => 'kde_StereoFFTScope*', +'StereoFFTScope_base*' => 'kde_StereoFFTScope_base*', +'StereoFFTScope_skel*' => 'kde_StereoFFTScope_skel*', +'StereoFFTScope_stub*' => 'kde_StereoFFTScope_stub*', +'StereoVolumeControl&' => 'kde_StereoVolumeControl*', +'StereoVolumeControl' => 'kde_StereoVolumeControl*', +'StereoVolumeControl*' => 'kde_StereoVolumeControl*', +'StereoVolumeControl_base*' => 'kde_StereoVolumeControl_base*', +'StereoVolumeControl_skel*' => 'kde_StereoVolumeControl_skel*', +'StereoVolumeControl_stub*' => 'kde_StereoVolumeControl_stub*', +'StreamMode&' => 'int', +'String*' => 'kde_String*', +'StringSectionMap::iterator&' => 'kde_StringSectionMap*' , +'StringSectionMap::iterator' => 'kde_StringSectionMap*r' , +'StubProcess*' => 'kde_StubProcess*', +'StyleHint' => 'int', +'StyleListImpl*' => 'kde_StyleListImpl*', +'StylePixmap' => 'int', +'StyleSheet&' => 'kde_StyleSheet*', +'StyleSheet' => 'kde_StyleSheet*', +'StyleSheet*' => 'kde_StyleSheet*', +'StyleSheetImpl*' => 'kde_StyleSheetImpl*', +'StyleSheetList&' => 'kde_StyleSheetList*', +'StyleSheetList' => 'kde_StyleSheetList', +'StyleSheetList*' => 'kde_StyleSheetList*', +'StyleSheetListImpl*' => 'kde_StyleSheetListImpl*', +'StyleStrategy' => 'int', +'SuProcess*' => 'kde_SuProcess*', +'SubClass&' => 'kde_SubClass*', +'SubClass*' => 'kde_SubClass*', +'SubControl' => 'int', +'SubRect' => 'int', +'SynthBuffer*' => 'kde_SynthBuffer*', +'SynthModule&' => 'kde_SynthModule*', +'SynthModule' => 'kde_SynthModule*', +'SynthModule*' => 'kde_SynthModule*', +'SynthModule_base*' => 'kde_SynthModule_base*', +'SynthModule_skel*' => 'kde_SynthModule_skel*', +'SynthModule_stub*' => 'kde_SynthModule_stub*', +'SynthOut*' => 'kde_SynthOut*', +'Synth_ADD&' => 'kde_Synth_ADD*', +'Synth_ADD' => 'kde_Synth_ADD*', +'Synth_ADD*' => 'kde_Synth_ADD*', +'Synth_ADD_base*' => 'kde_Synth_ADD_base*', +'Synth_ADD_skel*' => 'kde_Synth_ADD_skel*', +'Synth_ADD_stub*' => 'kde_Synth_ADD_stub*', +'Synth_AMAN_PLAY&' => 'kde_Synth_AMAN_PLAY*', +'Synth_AMAN_PLAY' => 'kde_Synth_AMAN_PLAY*', +'Synth_AMAN_PLAY*' => 'kde_Synth_AMAN_PLAY*', +'Synth_AMAN_PLAY_base*' => 'kde_Synth_AMAN_PLAY_base*', +'Synth_AMAN_PLAY_skel*' => 'kde_Synth_AMAN_PLAY_skel*', +'Synth_AMAN_PLAY_stub*' => 'kde_Synth_AMAN_PLAY_stub*', +'Synth_AMAN_RECORD&' => 'kde_Synth_AMAN_RECORD*', +'Synth_AMAN_RECORD' => 'kde_Synth_AMAN_RECORD*', +'Synth_AMAN_RECORD*' => 'kde_Synth_AMAN_RECORD*', +'Synth_AMAN_RECORD_base*' => 'kde_Synth_AMAN_RECORD_base*', +'Synth_AMAN_RECORD_skel*' => 'kde_Synth_AMAN_RECORD_skel*', +'Synth_AMAN_RECORD_stub*' => 'kde_Synth_AMAN_RECORD_stub*', +'Synth_BUS_DOWNLINK&' => 'kde_Synth_BUS_DOWNLINK*', +'Synth_BUS_DOWNLINK' => 'kde_Synth_BUS_DOWNLINK*', +'Synth_BUS_DOWNLINK*' => 'kde_Synth_BUS_DOWNLINK*', +'Synth_BUS_DOWNLINK_base*' => 'kde_Synth_BUS_DOWNLINK_base*', +'Synth_BUS_DOWNLINK_skel*' => 'kde_Synth_BUS_DOWNLINK_skel*', +'Synth_BUS_DOWNLINK_stub*' => 'kde_Synth_BUS_DOWNLINK_stub*', +'Synth_BUS_UPLINK&' => 'kde_Synth_BUS_UPLINK*', +'Synth_BUS_UPLINK' => 'kde_Synth_BUS_UPLINK*', +'Synth_BUS_UPLINK*' => 'kde_Synth_BUS_UPLINK*', +'Synth_BUS_UPLINK_base*' => 'kde_Synth_BUS_UPLINK_base*', +'Synth_BUS_UPLINK_skel*' => 'kde_Synth_BUS_UPLINK_skel*', +'Synth_BUS_UPLINK_stub*' => 'kde_Synth_BUS_UPLINK_stub*', +'Synth_FREQUENCY&' => 'kde_Synth_FREQUENCY*', +'Synth_FREQUENCY' => 'kde_Synth_FREQUENCY*', +'Synth_FREQUENCY*' => 'kde_Synth_FREQUENCY*', +'Synth_FREQUENCY_base*' => 'kde_Synth_FREQUENCY_base*', +'Synth_FREQUENCY_skel*' => 'kde_Synth_FREQUENCY_skel*', +'Synth_FREQUENCY_stub*' => 'kde_Synth_FREQUENCY_stub*', +'Synth_MUL&' => 'kde_Synth_MUL*', +'Synth_MUL' => 'kde_Synth_MUL*', +'Synth_MUL*' => 'kde_Synth_MUL*', +'Synth_MULTI_ADD&' => 'kde_Synth_MULTI_ADD*', +'Synth_MULTI_ADD' => 'kde_Synth_MULTI_ADD*', +'Synth_MULTI_ADD*' => 'kde_Synth_MULTI_ADD*', +'Synth_MULTI_ADD_base*' => 'kde_Synth_MULTI_ADD_base*', +'Synth_MULTI_ADD_skel*' => 'kde_Synth_MULTI_ADD_skel*', +'Synth_MULTI_ADD_stub*' => 'kde_Synth_MULTI_ADD_stub*', +'Synth_MUL_base*' => 'kde_Synth_MUL_base*', +'Synth_MUL_skel*' => 'kde_Synth_MUL_skel*', +'Synth_MUL_stub*' => 'kde_Synth_MUL_stub*', +'Synth_PLAY&' => 'kde_Synth_PLAY*', +'Synth_PLAY' => 'kde_Synth_PLAY*', +'Synth_PLAY*' => 'kde_Synth_PLAY*', +'Synth_PLAY_WAV&' => 'kde_Synth_PLAY_WAV*', +'Synth_PLAY_WAV' => 'kde_Synth_PLAY_WAV*', +'Synth_PLAY_WAV*' => 'kde_Synth_PLAY_WAV*', +'Synth_PLAY_WAV_base*' => 'kde_Synth_PLAY_WAV_base*', +'Synth_PLAY_WAV_skel*' => 'kde_Synth_PLAY_WAV_skel*', +'Synth_PLAY_WAV_stub*' => 'kde_Synth_PLAY_WAV_stub*', +'Synth_PLAY_base*' => 'kde_Synth_PLAY_base*', +'Synth_PLAY_skel*' => 'kde_Synth_PLAY_skel*', +'Synth_PLAY_stub*' => 'kde_Synth_PLAY_stub*', +'Synth_RECORD&' => 'kde_Synth_RECORD*', +'Synth_RECORD' => 'kde_Synth_RECORD*', +'Synth_RECORD*' => 'kde_Synth_RECORD*', +'Synth_RECORD_base*' => 'kde_Synth_RECORD_base*', +'Synth_RECORD_skel*' => 'kde_Synth_RECORD_skel*', +'Synth_RECORD_stub*' => 'kde_Synth_RECORD_stub*', +'Synth_WAVE_SIN&' => 'kde_Synth_WAVE_SIN*', +'Synth_WAVE_SIN' => 'kde_Synth_WAVE_SIN*', +'Synth_WAVE_SIN*' => 'kde_Synth_WAVE_SIN*', +'Synth_WAVE_SIN_base*' => 'kde_Synth_WAVE_SIN_base*', +'Synth_WAVE_SIN_skel*' => 'kde_Synth_WAVE_SIN_skel*', +'Synth_WAVE_SIN_stub*' => 'kde_Synth_WAVE_SIN_stub*', +'T&' => 'T*' , +'T' => 'T*' , +'T*' => 'T*' , +'TCPConnection*' => 'kde_TCPConnection*', +'TCPServer*' => 'kde_TCPServer*', +'TCPSlaveBase*' => 'kde_TCPSlaveBase*', +'TRUE' => '1', +'Task*' => 'kde_Task*', +'Text&' => 'kde_Text*', +'Text' => 'kde_Text*', +'Text*' => 'kde_Text*', +'TextFormat' => 'int' , +'TextImpl*' => 'kde_TextImpl*', +'ThumbCreator*' => 'kde_ThumbCreator*', +'TickSetting' => 'int', +'Ticket*' => 'kde_Ticket*', +'TimeNotify*' => 'kde_TimeNotify*', +'TimeWatcher*' => 'kde_TimeWatcher*', +'TimeZone&' => 'kde_TimeZone*', +'TimeZone*' => 'kde_TimeZone*', +'TmpGlobalComm&' => 'kde_TmpGlobalComm*', +'TmpGlobalComm' => 'kde_TmpGlobalComm*', +'TmpGlobalComm*' => 'kde_TmpGlobalComm*', +'TmpGlobalComm_base*' => 'kde_TmpGlobalComm_base*', +'TmpGlobalComm_skel*' => 'kde_TmpGlobalComm_skel*', +'TmpGlobalComm_stub*' => 'kde_TmpGlobalComm_stub*', +'ToolBarDock&' => 'int' , +'ToolBarDock' => 'int', +'TraderOffer&' => 'kde_TraderOffer*', +'TraderOffer' => 'kde_TraderOffer*', +'TraderOffer*' => 'kde_TraderOffer*', +'TraderOffer_base*' => 'kde_TraderOffer_base*', +'TraderOffer_skel*' => 'kde_TraderOffer_skel*', +'TraderOffer_stub*' => 'kde_TraderOffer_stub*', +'TraderQuery&' => 'kde_TraderQuery*', +'TraderQuery' => 'kde_TraderQuery*', +'TraderQuery*' => 'kde_TraderQuery*', +'TraderQuery_base*' => 'kde_TraderQuery_base*', +'TraderQuery_skel*' => 'kde_TraderQuery_skel*', +'TraderQuery_stub*' => 'kde_TraderQuery_stub*', +'TransferJob*' => 'kde_TransferJob*', +'TreeWalker&' => 'kde_TreeWalker*', +'TreeWalker' => 'kde_TreeWalker*', +'TreeWalker*' => 'kde_TreeWalker*', +'TreeWalkerImpl*' => 'kde_TreeWalkerImpl*', +'True' => '1', +'Type&' => 'kde_Type*', +'Type' => 'int', +'Type*' => 'kde_Type*', +'TypeComponent&' => 'kde_TypeComponent*', +'TypeComponent*' => 'kde_TypeComponent*', +'TypeDef&' => 'kde_TypeDef*', +'TypeDef' => 'kde_TypeDef*', +'TypeDef*' => 'kde_TypeDef*', +'TypeEntry*' => 'kde_TypeEntry*', +'TypeInfo*' => 'kde_TypeInfo*', +'UChar&' => 'kde_UChar*', +'UChar' => 'kde_UChar*', +'UChar*' => 'kde_UChar*', +'UCharReference&' => 'kde_UCharReference*', +'UCharReference' => 'kde_UCharReference*', +'UCharReference*' => 'kde_UCharReference*', +'UDSAtom*' => 'kde_UDSAtom*', +'UDSEntry&' => 'kde_UDSEntry*', +'UDSEntryList&' => 'kde_UDSEntryList*', +'UIServer*' => 'kde_UIServer*', +'UIServer_stub*' => 'kde_UIServer_stub*', +'ULONG_MAX' => 'ULONG_MAX', +'URLArgs&' => 'kde_URLArgs*', +'URLArgs' => 'kde_URLArgs*', +'URLArgs*' => 'kde_URLArgs*', +'UString&' => 'kde_UString*', +'UString' => 'kde_UString*', +'UString*' => 'kde_UString*', +'Undefined*' => 'kde_Undefined*', +'UndoInterface*' => 'kde_UndoInterface*', +'UndoRedoInfo*' => 'int*', +'UnixConnection*' => 'kde_UnixConnection*', +'UnixServer*' => 'kde_UnixServer*', +'VCardFormat*' => 'kde_VCardFormat*', +'VPort*' => 'kde_VPort*', +'Value&' => 'kde_Value*', +'Value' => 'kde_Value*', +'Value*' => 'kde_Value*', +'VerticalAlignment*' => 'int*', +'View*' => 'kde_View*' , +'ViewCursorInterface*' => 'kde_ViewCursorInterface*', +'VoiceManager*' => 'kde_VoiceManager*', +'WFlags' => 'int', +'WId' => 'unsigned int', +'WState' => 'int', +'WavPlayObject&' => 'kde_WavPlayObject*', +'WavPlayObject' => 'kde_WavPlayObject*', +'WavPlayObject*' => 'kde_WavPlayObject*', +'WavPlayObject_base*' => 'kde_WavPlayObject_base*', +'WavPlayObject_skel*' => 'kde_WavPlayObject_skel*', +'WavPlayObject_stub*' => 'kde_WavPlayObject_stub*', +'WeakReference*' => 'kde_WeakReference*', +'WeakReferenceBase*' => 'kde_WeakReferenceBase*', +'Widget' => 'int' , +'WidgetClass' => 'int' , +'WidthMode' => 'int', +'Window' => 'kde_Window*', +'Window*' => 'kde_Window*', +'WindowArgs&' => 'kde_WindowArgs*', +'WindowArgs*' => 'kde_WindowArgs*', +'WindowsVersion' => 'int' , +'XrmOptionDescRec*' => 'XrmOptionDescRec*' , +'array_data*' => 'void*' , +'bitarr_data*' => 'void*', +'bool&' => 'int' , +'bool' => 'int', +'bool*' => 'int*', +'char *' => 'char *', +'char&' => 'char' , +'char' => 'char', +'char* bugsEmailAddress @bugs.kde.org"' => 'String', +'char*&' => 'char*', +'char*' => 'char*', +'char**' => 'char**', +'char*xpm[]' => 'char**' , +'classConnection*' => 'kde_classConnection*', +'classDeviceManager*' => 'kde_classDeviceManager*', +'classExtensionLoader*' => 'kde_classExtensionLoader*', +'classMidiStatus*' => 'kde_classMidiStatus*', +'classObjectReference' => 'kde_classObjectReference*', +'classQPainter*' => 'kde_classQPainter*', +'classStartupClass*' => 'kde_classStartupClass*', +'double d .0' => 'double', +'double nDefault .0' => 'double', +'double pri .0' => 'double', +'double&' => 'double' , +'double' => 'double', +'double*' => 'double*' , +'false' => '0', +'float desat .3' => 'float', +'float&' => 'float' , +'float' => 'float', +'float*' => 'float*', +'image_io_handler' => 'int' , +'int a |' => 'int', +'int buttonMask|Apply|Cancel' => 'int', +'int buttonMask|No|Cancel' => 'int', +'int desktop' => 'int', +'int&' => 'int', +'int' => 'int', +'int*' => 'int*', +'kdbgstream&' => 'kde_Kdbgstream*' , +'kdbgstream*' => 'kde_kdbgstream*', +'khtml*' => 'kde_khtml*', +'khtml::ChildFrame*' => 'kde_khtml_ChildFrame*' , +'khtml::DrawContentsEvent*' => 'kde_khtml_DrawContentsEvent*' , +'khtml::MouseDoubleClickEvent*' => 'kde_khtml_MouseDoubleClickEvent*' , +'khtml::MouseMoveEvent*' => 'kde_khtml_MouseMoveEvent*' , +'khtml::MousePressEvent*' => 'kde_khtml_MousePressEvent*' , +'khtml::MouseReleaseEvent*' => 'kde_khtml_MouseReleaseEvent*' , +'khtml::RenderObject*' => 'kde_khtml_RenderObject*' , +'khtml::RenderStyle*' => 'kde_khtml_RenderStyle*' , +'khtml__DrawContentsEvent*' => 'kde_khtml__DrawContentsEvent*', +'khtml__MouseDoubleClickEvent*' => 'kde_khtml__MouseDoubleClickEvent*', +'khtml__MouseEvent*' => 'kde_khtml__MouseEvent*', +'khtml__MouseMoveEvent*' => 'kde_khtml__MouseMoveEvent*', +'khtml__MousePressEvent*' => 'kde_khtml__MousePressEvent*', +'khtml__MouseReleaseEvent*' => 'kde_khtml__MouseReleaseEvent*', +'kndbgstream&' => 'void**' , +'kndbgstream*' => 'kde_kndbgstream*', +'ksockaddr_in*' => 'void*' , +'long _blockSize *' => 'long *', +'long int' => 'long', +'long unsigned int' => 'long', +'long&' => 'long' , +'long' => 'long', +'long_blockSize*' => 'long_blockSize*' , +'longint' => 'long', +'longunsigned int' => 'unsigned long', +'lt_dlhandle' => 'void *' , +'lt_user_dlloader*' => 'kde_lt_user_dlloader*', +'mcopbyte&' => 'void *', +'mcopbyte' => 'unsigned char', +'mode_t _mode (mode_t) -1' => 'int', +'mode_t' => 'long' , +'noteCmd' => 'kde_noteCmd*', +'noteCmd*' => 'kde_noteCmd*', +'ostream&' => 'int', +'ostream*' => 'int', +'pid_t' => 'long' , +'poTime&' => 'kde_poTime*', +'poTime*' => 'kde_poTime*', +'short unsigned' => 'short', +'short' => 'short', +'short*' => 'short*', +'shortunsigned' => 'unsigned short', +'signed int&' => 'signed int' , +'signed long&' => 'signed long' , +'signed short&' => 'signed short' , +'signed' => 'signed' , +'size_t' => 'int' , +'size_t*' => 'int*', +'size_type' => 'int' , +'snd_seq_event_t*' => 'int*', +'ssize_t' => 'int', +'std*' => 'kde_std*', +'std::string&' => 'char *' , +'std::string' => 'char *' , +'time_t' => 'long' , +'timeval&' => 'int', +'true' => '1', +'type&' => 'int' , +'type*' => 'int*' , +'type**' => 'int**' , +'uchar&' => 'unsigned char' , +'uchar' => 'unsigned char' , +'uchar*' => 'unsigned char*', +'uchar**' => 'unsigned char**', +'uint&' => 'unsigned int', +'uint' => 'unsigned int', +'uint*' => 'unsigned int*' , +'uintf~0' => 'unsigned int' , +'ulong' => 'unsigned long', +'unsigned char&' => 'unsigned char', +'unsigned char' => 'unsigned char' , +'unsigned char*' => 'unsigned char*' , +'unsigned int&' => 'unsigned int' , +'unsigned int' => 'unsigned int' , +'unsigned int*' => 'int*' , +'unsigned long int' => 'long', +'unsigned long&' => 'unsigned long' , +'unsigned long' => 'unsigned long' , +'unsigned short int' => 'unsigned short' , +'unsigned short&' => 'unsigned short' , +'unsigned short' => 'unsigned short' , +'unsigned short*' => 'short*' , +'unsigned shortint' => 'unsigned short' , +'unsigned' => 'unsigned int' , +'ushort' => 'unsigned short', +'ushort*' => 'short*' , +'voice*' => 'int', +'void' => 'void', +'void(*)()' => 'void(*)()' , +'void*' => 'void*', +'~' => '~', +'QValueList<int>' => 'qt_QIntValueList*', +'QValueList<int>&' => 'qt_QIntValueList*', +'QValueList<QIconDragItem>' => 'qt_QIconDragItemValueList*', +'QValueList<QIconDragItem>&' => 'qt_QIconDragItemValueList*', +'QValueList<QPixmap>' => 'qt_QPixmapValueList*', +'QValueList<QString>&' => 'qt_QStringValueList*', +'QValueList<QVariant>&' => 'qt_QVariantValueList*', +'QValueList<QUrlInfo>*' => 'qt_QUrlInfoValueList*', +'QValueList<KDataToolInfo>&' => 'kde_KDataToolInfoValueList*', +'QPtrList<KAction>&' => 'kde_KActionPtrList*', +'QPtrList<KSSLCertificate>&' => 'kde_KSSLCertificatePtrList*', +'QPtrList<KXMLGUIClient>*' => 'kde_KXMLGUIClientPtrList*', +'QPtrList<QDockWindow>*' => 'qt_QDockWindowPtrList*', +'QPtrList<QPixmap>' => 'qt_QPixmapPtrList*', +'QPtrList<QPoint>' => 'qt_QPointPtrList*', +'KService::Ptr&' => 'kde_KServicePtr*', +'ClassContext*' => 'kde_ClassContext*', +'ClassStoreIface*' => 'kde_ClassStoreIface*', +'ClipboardDocumentIface*' => 'kde_ClipboardDocumentIface*', +'CodeCompletionDocumentIface*' => 'kde_CodeCompletionDocumentIface*', +'CursorDocumentIface*' => 'kde_CursorDocumentIface*', +'DebugDocumentIface*' => 'kde_DebugDocumentIface*', +'DocumentInterface*' => 'kde_DocumentInterface*', +'EditDocumentIface*' => 'kde_EditDocumentIface*', +'EditorInterface*' => 'kde_EditorInterface*', +'FileContext*' => 'kde_FileContext*', +'KDevAppFrontendIface*' => 'kde_KDevAppFrontendIface*', +'KDevCoreIface*' => 'kde_KDevCoreIface*', +'KDevMakeFrontendIface*' => 'kde_KDevMakeFrontendIface*', +'KEditor*' => 'kde_KEditor*', +'KEditor::Document*' => 'kde_Document*', +'ParsedClassContainer&' => 'kde_ParsedClassContainer*', +'ParsedContainer&' => 'kde_ParsedContainer*', +'ParsedScopeContainer&' => 'kde_ParsedScopeContainer*', +'QValueList<ParsedMethod>*' => 'kde_ParsedMethodList*', +'QValueList<CompletionEntry>' => 'kde_CompletionEntryValueList*', +'StatusDocumentIface*' => 'kde_StatusDocumentIface*', +'UndoDocumentIface*' => 'kde_UndoDocumentIface*', +'KShortcut&' => 'kde_KShortcut*', +'KShortcut' => 'kde_KShortcut*', +'KShortcut*' => 'kde_KShortcut*', +'KKey&' => 'kde_KKey*', +'KKey*' => 'kde_KKey*', +'KKeyNative&' => 'kde_KKeyNative*', +'KKeyNative*' => 'kde_KKeyNative*', +'KKeyVariations&' => 'kde_KKeyVariations*', +'KKeyVariations*' => 'kde_KKeyVariations*', +'KKeyX11&' => 'kde_KKeyX11*', +'KKeyX11' => 'kde_KKeyX11*', +'KKeyX11*' => 'kde_KKeyX11*', +'KAccelActions' => 'kde_KAccelActions*', +'KRandomSequence&' => 'kde_KRandomSequence*', +'KIcon::Context' => 'int', +'KIcon::Group' => 'int', +); + + + # Initialize %builtins, used by resolveType + my @noreflist = qw( const int char long double template + unsigned signed float void bool true false uint + uint32 uint64 extern static inline virtual operator ); + foreach my $r ( @noreflist ) { + $builtins{ $r } = $r; + } + +} + +sub interfacemap +{ + my ( $interfaceType ) = @_; + return $interfacemap{$interfaceType}; +} + +sub ctypemap +{ + my ( $cType ) = @_; + return $ctypemap{$cType}; +} + +sub setctypemap +{ + my ( $cType, $cValue ) = @_; + + $ctypemap{$cType} = $cValue; + return; +} + +sub addNamespace +{ + my ( $className ) = @_; + + if ( $className =~ /Bridge$/ ) { + return $className; + } + + if ( $className =~ /^(AbstractView|Attr|CDATASection|CSSCharsetRule|CSSException|CSSFontFaceRule|CSSImportRule|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration|CSSStyleRule|CSSStyleSheet|CSSUnknownRule|CSSValue|CSSValueList|CharacterData|Comment|Counter|CustomNodeFilter|DOMException|DOMImplementation|DOMString|Document|DocumentFragment|DocumentStyle|DocumentType|DomShared|Element|Entity|EntityReference|EventException|EventListener|LinkStyle|MediaList|MutationEvent|NamedNodeMap|Node|NodeFilter|NodeIterator|NodeList|Notation|ProcessingInstruction|RGBColor|Range|RangeException|Rect|StyleSheet|StyleSheetList|Text|TreeWalker|UIEvent|HTML.*)/ ) + { + return "DOM::".$className; + } + + if ( $className =~ /^(BrowserExtension|BrowserHostExtensionBrowserInterface|ComponentFactory|DockMainWindow|Event|Factory|GUIActivateEvent|HistoryProvider|MainWindow|OpenURLEvent|Part|PartActivateEvent|PartBase|PartManager|PartSelectEvent|Plugin|PluginInfo|ReadOnlyPart|ReadWritePart|URLArgs|WindowArgs)/ ) + { + return "KParts::".$className; + } + + if ( $className =~ /^(AuthInfo|AutoLogin|CacheInfo|ChmodJob|Connection|CopyInfo|CopyJob|DefaultProgress|DeleteJob|FileCopyJob|Job|ListJob|MetaData|MimetypeJob|MultiGetJob|NetAccess|NetRC|PasswordDialog|PreviewJob|ProgressBase|RenameDlg|Scheduler|SessionData|SimpleJob|SkipDlg|Slave|SlaveBase|SlaveConfig|SlaveInterface|StatJob|StatusbarProgress|TCPSlaveBase|Task|TransferJob|UDSAtom)/ ) + { + return "KIO::".$className; + } + + if ( $className =~ /^(DrawContentsEvent|MouseDoubleClickEvent|MouseEvent|MouseMoveEvent|MousePressEvent|MouseReleaseEvent)/ ) + { + return "khtml::".$className; + } + + if ( $className =~ /^(OfferList)/ ) + { + return "KTrader::".$className; + } + + if ( $className =~ /^(BlockSelectionInterface|ClipboardInterface|CodeCompletionInterface|CompletionEntry|ConfigInterface|Cursor|CursorInterface|Document|EditInterface|Editor|HighlightingInterface|Mark|MarkInterface|PopupMenuInterface|PrintInterface|SearchInterface|SelectionInterface|UndoInterface|View|ViewCursorInterface)/ ) + { + return "KTextEditor::".$className; + } + + + return $className; +} + + +# Helper for resolveType. This one is recursive and returns undef if not found. +sub resolveTypeInternal($$$) +{ + my ( $argType, $contextClass, $rootnode ) = @_; + + #print "resolveTypeInternal type:'$argType' context:'$contextClass->{astNodeName}' ($contextClass)\n"; + + my $contextClassName = join( "::", kdocAstUtil::heritage($contextClass) ); + + # 'A' resolves to 'A' in context 'A' ;) (i.e. classname itself) + return $contextClassName if ( $argType eq $contextClass->{astNodeName} ); + + # Try as an identifier of contextClass + #print "Trying as ".$contextClassName."::".$argType."\n"; + + my $node = kdocAstUtil::findRef( $rootnode, $contextClassName."::".$argType ); + + #print "Found as $node->{NodeType}\n" if $node; + + return $contextClassName."::".$argType if ( $node + && $node->{NodeType} ne 'method' + && $node->{NodeType} ne 'deleted' + && $node->{NodeType} ne 'var' ); + + my $found; + + # Then look at ancestors, and try for each one + Iter::Ancestors( $contextClass, $rootnode, undef, undef, + sub { + my ( $ances, $name, $type, $template ) = @_; + unless ($found) { + $found = resolveTypeInternal( $argType, $ances, $rootnode ); + } + }, + undef + ); + + return $found; +} + +=head2 + + Look up a type, following the class hierarchy. + e.g. "Mode", if ContextClassName is A, will be looked as A::Mode, + then as B::Mode (if B is a parent class of A), then as Qt::Mode, + then as just Mode. + +=cut + +sub resolveType($$$) +{ + my ( $argType, $contextClass, $rootnode ) = @_; + $argType =~ s/\s*(\*)\s*$/$1/g; # remove space before * + #print "resolveType: '$argType'\n"; + + # Look for builtin words (int etc.) + return $builtins{ $argType } if exists $builtins{ $argType }; + + # Parse 'const' in front of it, and '*' or '&' after it + my $prefix = $argType =~ s/^const\s+// ? 'const ' : ''; + my $suffix = $argType =~ s/\s*([\&\*]+)$// ? $1 : ''; + #print "resolveType: prefix:$prefix, '$argType', suffix:$suffix\n"; + + # Launch the (possibly recursive) resolveTypeInternal + my $result = resolveTypeInternal( $argType, $contextClass, $rootnode ); + return $prefix.$result.$suffix if $result; + + # Not found, so look as a toplevel class + #print "Checking that ".$argType." exists.\n"; + return $prefix.$argType.$suffix if ( kdocAstUtil::findRef( $rootnode, $argType ) ); + + #print "resolveType: $argType not found (context $contextClass->{astNodeName})\n\n"; + + return $prefix.$argType.$suffix; +} + +1; diff --git a/kalyptus/kdocAstUtil.pm b/kalyptus/kdocAstUtil.pm new file mode 100644 index 0000000..9c8c0dd --- /dev/null +++ b/kalyptus/kdocAstUtil.pm @@ -0,0 +1,762 @@ +=head1 kdocAstUtil + + Utilities for syntax trees. + +=cut + + +package kdocAstUtil; + +use Ast; +use Carp; +use File::Basename; +use kdocUtil; +use Iter; +use strict; + +use vars qw/ $depth $refcalls $refiters @noreflist %noref /; + +sub BEGIN { +# statistics for findRef + + $depth = 0; + $refcalls = 0; + $refiters = 0; + +# findRef will ignore these words + + @noreflist = qw( const int char long double template + unsigned signed float void bool true false uint + uint32 uint64 extern static inline virtual operator ); + + foreach my $r ( @noreflist ) { + $noref{ $r } = 1; + } +} + + +=head2 findNodes + + Parameters: outlist ref, full list ref, key, value + + Find all nodes in full list that have property "key=value". + All resulting nodes are stored in outlist. + +=cut + +sub findNodes +{ + my( $rOutList, $rInList, $key, $value ) = @_; + + my $node; + + foreach $node ( @{$rInList} ) { + next if !exists $node->{ $key }; + if ( $node->{ $key } eq $value ) { + push @$rOutList, $node; + } + } +} + +=head2 allTypes + + Parameters: node list ref + returns: list + + Returns a sorted list of all distinct "NodeType"s in the nodes + in the list. + +=cut + +sub allTypes +{ + my ( $lref ) = @_; + + my %types = (); + foreach my $node ( @{$lref} ) { + $types{ $node->{NodeType} } = 1; + } + + return sort keys %types; +} + + + + +=head2 findRef + + Parameters: root, ident, report-on-fail + Returns: node, or undef + + Given a root node and a fully qualified identifier (:: separated), + this function will try to find a child of the root node that matches + the identifier. + +=cut + +sub findRef +{ + my( $root, $name, $r ) = @_; + + confess "findRef: no name" if !defined $name || $name eq ""; + + $name =~ s/\s+//g; + return undef if exists $noref{ $name }; + + $name =~ s/^#//g; + + my ($iter, @tree) = split /(?:\:\:|#)/, $name; + my $kid; + + $refcalls++; + + # Upward search for the first token + return undef if !defined $iter; + + while ( !defined findIn( $root, $iter ) ) { + return undef if !defined $root->{Parent}; + $root = $root->{Parent}; + } + $root = $root->{KidHash}->{$iter}; + carp if !defined $root; + + # first token found, resolve the rest of the tree downwards + foreach $iter ( @tree ) { + confess "iter in $name is undefined\n" if !defined $iter; + next if $iter =~ /^\s*$/; + + unless ( defined findIn( $root, $iter ) ) { + confess "findRef: failed on '$name' at '$iter'\n" + if defined $r; + return undef; + } + + $root = $root->{KidHash}->{ $iter }; + carp if !defined $root; + } + + return $root; +} + +=head2 findIn + + node, name: search for a child + +=cut + +sub findIn +{ + return undef unless defined $_[0]->{KidHash}; + + my $ret = $_[0]->{KidHash}->{ $_[1] }; + + return $ret; +} + +=head2 linkReferences + + Parameters: root, node + + Recursively links references in the documentation for each node + to real nodes if they can be found. This should be called once + the entire parse tree is filled. + +=cut + +sub linkReferences +{ + my( $root, $node ) = @_; + + if ( exists $node->{DocNode} ) { + linkDocRefs( $root, $node, $node->{DocNode} ); + + if( exists $node->{Compound} ) { + linkSee( $root, $node, $node->{DocNode} ); + } + } + + my $kids = $node->{Kids}; + return unless defined $kids; + + foreach my $kid ( @$kids ) { + # only continue in a leaf node if it has documentation. + next if !exists $kid->{Kids} && !exists $kid->{DocNode}; + if( !exists $kid->{Compound} ) { + linkSee( $root, $node, $kid->{DocNode} ); + } + linkReferences( $root, $kid ); + } +} + +sub linkNamespaces +{ + my ( $node ) = @_; + + if ( defined $node->{ImpNames} ) { + foreach my $space ( @{$node->{ImpNames}} ) { + my $spnode = findRef( $node, $space ); + + if( defined $spnode ) { + $node->AddPropList( "ExtNames", $spnode ); + } + else { + warn "namespace not found: $space\n"; + } + } + } + + return unless defined $node->{Compound} || !defined $node->{Kids}; + + + foreach my $kid ( @{$node->{Kids}} ) { + next unless localComp( $kid ); + + linkNamespaces( $kid ); + } +} + +sub calcStats +{ + my ( $stats, $root, $node ) = @_; +# stats: +# num types +# num nested +# num global funcs +# num methods + + + my $type = $node->{NodeType}; + + if ( $node eq $root ) { + # global methods + if ( defined $node->{Kids} ) { + foreach my $kid ( @{$node->{Kids}} ) { + $stats->{Global}++ if $kid->{NodeType} eq "method"; + } + } + + $node->AddProp( "Stats", $stats ); + } + elsif ( kdocAstUtil::localComp( $node ) + || $type eq "enum" || $type eq "typedef" ) { + $stats->{Types}++; + $stats->{Nested}++ if $node->{Parent} ne $root; + } + elsif( $type eq "method" ) { + $stats->{Methods}++; + } + + return unless defined $node->{Compound} || !defined $node->{Kids}; + + foreach my $kid ( @{$node->{Kids}} ) { + next if defined $kid->{ExtSource}; + calcStats( $stats, $root, $kid ); + } +} + +=head2 linkDocRefs + + Parameters: root, node, docnode + + Link references in the docs if they can be found. This should + be called once the entire parse tree is filled. + +=cut + +sub linkDocRefs +{ + my ( $root, $node, $docNode ) = @_; + return unless exists $docNode->{Text}; + + my ($text, $ref, $item, $tosearch); + + foreach $item ( @{$docNode->{Text}} ) { + next if $item->{NodeType} ne 'Ref'; + + $text = $item->{astNodeName}; + + if ( $text =~ /^(?:#|::)/ ) { + $text = $'; + $tosearch = $node; + } + else { + $tosearch = $root; + } + + $ref = findRef( $tosearch, $text ); + $item->AddProp( 'Ref', $ref ) if defined $ref; + + confess "Ref failed for ", $item->{astNodeName}, + "\n" unless defined $ref; + } +} + +sub linkSee +{ + my ( $root, $node, $docNode ) = @_; + return unless exists $docNode->{See}; + + my ( $text, $tosearch, $ref ); + + foreach $text ( @{$docNode->{See}} ) { + if ( $text =~ /^\s*(?:#|::)/ ) { + $text = $'; + $tosearch = $node; + } + else { + $tosearch = $root; + } + + $ref = findRef( $tosearch, $text ); + $docNode->AddPropList( 'SeeRef', $ref ) + if defined $ref; + } +} + + + +# +# Inheritance utilities +# + +=head2 makeInherit + + Parameter: $rootnode, $parentnode + + Make an inheritance graph from the parse tree that begins + at rootnode. parentnode is the node that is the parent of + all base class nodes. + +=cut + +sub makeInherit +{ + my( $rnode, $parent ) = @_; + + foreach my $node ( @{ $rnode->{Kids} } ) { + next if !defined $node->{Compound}; + + # set parent to root if no inheritance + + if ( !exists $node->{InList} ) { + newInherit( $node, "Global", $parent ); + $parent->AddPropList( 'InBy', $node ); + + makeInherit( $node, $parent ); + next; + } + + # link each ancestor + my $acount = 0; +ANITER: + foreach my $in ( @{ $node->{InList} } ) { + unless ( defined $in ) { + Carp::cluck "warning: $node->{astNodeName} " + ." has undef in InList."; + next ANITER; + } + + my $ref = kdocAstUtil::findRef( $rnode, + $in->{astNodeName} ); + + if( !defined $ref ) { + # ancestor undefined + warn "warning: ", $node->{astNodeName}, + " inherits unknown class '", + $in->{astNodeName},"'\n"; + + $parent->AddPropList( 'InBy', $node ); + } + else { + # found ancestor + $in->AddProp( "Node", $ref ); + $ref->AddPropList( 'InBy', $node ); + $acount++; + } + } + + if ( $acount == 0 ) { + # inherits no known class: just parent it to global + newInherit( $node, "Global", $parent ); + $parent->AddPropList( 'InBy', $node ); + } + makeInherit( $node, $parent ); + } +} + +=head2 newInherit + + p: $node, $name, $lnode? + + Add a new ancestor to $node with raw name = $name and + node = lnode. +=cut + +sub newInherit +{ + my ( $node, $name, $link ) = @_; + + my $n = Ast::New( $name ); + $n->AddProp( "Node", $link ) unless !defined $link; + + $node->AddPropList( "InList", $n ); + return $n; +} + +=head2 inheritName + + pr: $inheritance node. + + Returns the name of the inherited node. This checks for existence + of a linked node and will use the "raw" name if it is not found. + +=cut + +sub inheritName +{ + my ( $innode ) = @_; + + return defined $innode->{Node} ? + $innode->{Node}->{astNodeName} + : $innode->{astNodeName}; +} + +=head2 inheritedBy + + Parameters: out listref, node + + Recursively searches for nodes that inherit from this one, returning + a list of inheriting nodes in the list ref. + +=cut + +sub inheritedBy +{ + my ( $list, $node ) = @_; + + return unless exists $node->{InBy}; + + foreach my $kid ( @{ $node->{InBy} } ) { + push @$list, $kid; + inheritedBy( $list, $kid ); + } +} + +=head2 hasLocalInheritor + + Parameter: node + Returns: 0 on fail + + Checks if the node has an inheritor that is defined within the + current library. This is useful for drawing the class hierarchy, + since you don't want to display classes that have no relationship + with classes within this library. + + NOTE: perhaps we should cache the value to reduce recursion on + subsequent calls. + +=cut + +sub hasLocalInheritor +{ + my $node = shift; + + return 0 if !exists $node->{InBy}; + + my $in; + foreach $in ( @{$node->{InBy}} ) { + return 1 if !exists $in->{ExtSource} + || hasLocalInheritor( $in ); + } + + return 0; +} + + + +=head2 allMembers + + Parameters: hashref outlist, node, $type + + Fills the outlist hashref with all the methods of outlist, + recursively traversing the inheritance tree. + + If type is not specified, it is assumed to be "method" + +=cut + +sub allMembers +{ + my ( $outlist, $n, $type ) = @_; + my $in; + $type = "method" if !defined $type; + + if ( exists $n->{InList} ) { + + foreach $in ( @{$n->{InList}} ) { + next if !defined $in->{Node}; + my $i = $in->{Node}; + + allMembers( $outlist, $i ) + unless $i == $main::rootNode; + } + } + + return unless exists $n->{Kids}; + + foreach $in ( @{$n->{Kids}} ) { + next if $in->{NodeType} ne $type; + + $outlist->{ $in->{astNodeName} } = $in; + } +} + +=head2 findOverride + + Parameters: root, node, name + + Looks for nodes of the same name as the parameter, in its parent + and the parent's ancestors. It returns a node if it finds one. + +=cut + +sub findOverride +{ + my ( $root, $node, $name ) = @_; + return undef if !exists $node->{InList}; + + foreach my $in ( @{$node->{InList}} ) { + my $n = $in->{Node}; + next unless defined $n && $n != $root && exists $n->{KidHash}; + + my $ref = $n->{KidHash}->{ $name }; + + return $n if defined $ref && $ref->{NodeType} eq "method"; + + if ( exists $n->{InList} ) { + $ref = findOverride( $root, $n, $name ); + return $ref if defined $ref; + } + } + + return undef; +} + +=head2 attachChild + + Parameters: parent, child + + Attaches child to the parent, setting Access, Kids + and KidHash of respective nodes. + +=cut + +sub attachChild +{ + my ( $parent, $child ) = @_; + confess "Attempt to attach ".$child->{astNodeName}." to an ". + "undefined parent\n" if !defined $parent; + + $child->AddProp( "Access", $parent->{KidAccess} ); + $child->AddProp( "Parent", $parent ); + + $parent->AddPropList( "Kids", $child ); + + if( !exists $parent->{KidHash} ) { + my $kh = Ast::New( "LookupTable" ); + $parent->AddProp( "KidHash", $kh ); + } + + $parent->{KidHash}->AddProp( $child->{astNodeName}, + $child ); +} + +=head2 makeClassList + + Parameters: node, outlist ref + + fills outlist with a sorted list of all direct, non-external + compound children of node. + +=cut + +sub makeClassList +{ + my ( $rootnode, $list ) = @_; + + @$list = (); + + Iter::LocalCompounds( $rootnode, + sub { + my $node = shift; + + my $her = join ( "::", heritage( $node ) ); + $node->AddProp( "FullName", $her ); + + if ( !exists $node->{DocNode}->{Internal} || + !$main::skipInternal ) { + push @$list, $node; + } + } ); + + @$list = sort { $a->{FullName} cmp $b->{FullName} } @$list; +} + +# +# Debugging utilities +# + +=head2 dumpAst + + Parameters: node, deep + Returns: none + + Does a recursive dump of the node and its children. + If deep is set, it is used as the recursion property, otherwise + "Kids" is used. + +=cut + +sub dumpAst +{ + my ( $node, $deep ) = @_; + + $deep = "Kids" if !defined $deep; + + print "\t" x $depth, $node->{astNodeName}, + " (", $node->{NodeType}, ")\n"; + + my $kid; + + foreach $kid ( $node->GetProps() ) { + print "\t" x $depth, " -\t", $kid, " -> ", $node->{$kid},"\n" + unless $kid =~ /^(astNodeName|NodeType|$deep)$/; + } + if ( exists $node->{InList} ) { + print "\t" x $depth, " -\tAncestors -> "; + foreach my $innode ( @{$node->{InList}} ) { + print $innode->{astNodeName} . ","; + } + print "\n"; + } + + print "\t" x $depth, " -\n" if (defined $node->{ $deep } && scalar(@{$node->{ $deep }}) != 0); + + $depth++; + foreach $kid ( @{$node->{ $deep }} ) { + dumpAst( $kid ); + } + + print "\t" x $depth, "Documentation nodes:\n" if defined + @{ $node->{Doc}->{ "Text" }}; + + foreach $kid ( @{ $node->{Doc}->{ "Text" }} ) { + dumpAst( $kid ); + } + + $depth--; +} + +=head2 testRef + + Parameters: rootnode + + Interactive testing of referencing system. Calling this + will use the readline library to allow interactive entering of + identifiers. If a matching node is found, its node name will be + printed. + +=cut + +sub testRef { + require Term::ReadLine; + + my $rootNode = $_[ 0 ]; + + my $term = new Term::ReadLine 'Testing findRef'; + + my $OUT = $term->OUT || *STDOUT{IO}; + my $prompt = "Identifier: "; + + while( defined ($_ = $term->readline($prompt)) ) { + + my $node = kdocAstUtil::findRef( $rootNode, $_ ); + + if( defined $node ) { + print $OUT "Reference: '", $node->{astNodeName}, + "', Type: '", $node->{NodeType},"'\n"; + } + else { + print $OUT "No reference found.\n"; + } + + $term->addhistory( $_ ) if /\S/; + } +} + +sub printDebugStats +{ + print "findRef: ", $refcalls, " calls, ", + $refiters, " iterations.\n"; +} + +sub External +{ + return defined $_[0]->{ExtSource}; +} + +sub Compound +{ + return defined $_[0]->{Compound}; +} + +sub localComp +{ + my ( $node ) = $_[0]; + return defined $node->{Compound} + && !defined $node->{ExtSource} + && $node->{NodeType} ne "Forward"; +} + +sub hasDoc +{ + return defined $_[0]->{DocNode}; +} + +### Warning: this returns the list of parents, e.g. the 3 words in KParts::ReadOnlyPart::SomeEnum +### It has nothing do to with inheritance. +sub heritage +{ + my $node = shift; + my @heritage; + + while( 1 ) { + push @heritage, $node->{astNodeName}; + + last unless defined $node->{Parent}; + $node = $node->{Parent}; + last unless defined $node->{Parent}; + } + + return reverse @heritage; +} + +sub refHeritage +{ + my $node = shift; + my @heritage; + + while( 1 ) { + push @heritage, $node; + + last unless defined $node->{Parent}; + $node = $node->{Parent}; + last unless defined $node->{Parent}; + } + + return reverse @heritage; + +} + + +1; diff --git a/kalyptus/kdocLib.pm b/kalyptus/kdocLib.pm new file mode 100644 index 0000000..6eac4df --- /dev/null +++ b/kalyptus/kdocLib.pm @@ -0,0 +1,245 @@ + +=head1 kdocLib + +Writes out a library file. + +NOTES ON THE NEW FORMAT + + Stores: class name, members, hierarchy + node types are not stored + + + File Format Spec + ---------------- + + header + zero or more members, each of + method + member + class, each of + inheritance + zero or more members + + + + Unrecognized lines ignored. + + Sample + ------ + + <! KDOC Library HTML Reference File> + <VERSION="2.0"> + <BASE URL="http://www.kde.org/API/kdecore/"> + + <C NAME="KApplication" REF="KApplication.html"> + <IN NAME="QObject"> + <ME NAME="getConfig" REF="KApplication.html#getConfig"> + <M NAME="" REF=""> + </C> + +=cut + +package kdocLib; +use strict; + +use Carp; +use File::Path; +use File::Basename; + +use Ast; +use kdocAstUtil; +use kdocUtil; + + +use vars qw/ $exe $lib $root $plang $outputdir $docpath $url $compress /; + +BEGIN { + $exe = basename $0; +} + +sub writeDoc +{ + ( $lib, $root, $plang, $outputdir, $docpath, $url, + $compress ) = @_; + my $outfile = "$outputdir/$lib.kalyptus"; + $url = $docpath unless defined $url; + + mkpath( $outputdir ) unless -f $outputdir; + + if( $compress ) { + open( LIB, "| gzip -9 > \"$outfile.gz\"" ) + || die "$exe: couldn't write to $outfile.gz\n"; + + } + else { + open( LIB, ">$outfile" ) + || die "$exe: couldn't write to $outfile\n"; + } + + my $libdesc = ""; + if ( defined $root->{LibDoc} ) { + $libdesc="<LIBDESC>".$root->{LibDoc}->{astNodeName}."</LIBDESC>"; + } + + print LIB<<LTEXT; +<! KDOC Library HTML Reference File> +<VERSION="$main::Version"> +<BASE URL="$url"> +<PLANG="$plang"> +<LIBNAME>$lib</LIBNAME> +$libdesc + +LTEXT + + writeNode( $root, "" ); + close LIB; +} + +sub writeNode +{ + my ( $n, $prefix ) = @_; + return if !exists $n->{Compound}; + return if exists $n->{Forward} && !exists $n->{KidAccess}; + + if( $n != $root ) { + $prefix .= $n->{astNodeName}; + print LIB "<C NAME=\"", $n->{astNodeName}, + "\" REF=\"$prefix.html\">\n"; + } + else { + print LIB "<STATS>\n"; + my $stats = $root->{Stats}; + foreach my $stat ( keys %$stats ) { + print LIB "<STAT NAME=\"$stat\">", + $stats->{$stat},"</STAT>\n"; + } + print LIB "</STATS>\n"; + } + + if( exists $n->{Ancestors} ) { + my $in; + foreach $in ( @{$n->{Ancestors}} ) { + $in =~ s/\s+//g; + print LIB "<IN NAME=\"",$in,"\">\n"; + } + } + + return if !exists $n->{Kids}; + my $kid; + my $type; + + foreach $kid ( @{$n->{Kids}} ) { + next if exists $kid->{ExtSource} + || $kid->{Access} eq "private"; + + if ( exists $kid->{Compound} ) { + if( $n != $root ) { + writeNode( $kid, $prefix."::" ); + } + else { + writeNode( $kid, "" ); + } + next; + } + + $type = $kid->{NodeType} eq "method" ? + "ME" : "M"; + + print LIB "<$type NAME=\"", $kid->{astNodeName}, + "\" REF=\"$prefix.html#", $kid->{astNodeName}, "\">\n"; + } + + if( $n != $root ) { + print LIB "</C>\n"; + } +} + +sub readLibrary +{ + my( $rootsub, $name, $path, $relurl ) = @_; + $path = "." unless defined $path; + my $real = $path."/".$name.".kalyptus"; + my $url = "."; + my @stack = (); + my $version = "2.0"; + my $new; + my $root = undef; + my $n = undef; + my $havecomp = -r "$real.gz"; + my $haveuncomp = -r "$real"; + + if ( $haveuncomp ) { + open( LIB, "$real" ) || die "Can't read lib $real\n"; + } + + if( $havecomp ) { + if ( $haveuncomp ) { + warn "$exe: two libs exist: $real and $real.gz. " + ."Using $real\n"; + } + else { + open( LIB, "gunzip < \"$real.gz\"|" ) + || die "Can't read pipe gunzip < \"$real.gz\": $?\n"; + } + } + + while( <LIB> ) { + next if /^\s*$/; + if ( !/^\s*</ ) { + close LIB; + #readOldLibrary( $root, $name, $path ); + return; + } + + if( /<VER\w+\s+([\d\.]+)>/ ) { + # TODO: what do we do with the version number? + $version = $1; + } + elsif ( /<BASE\s*URL\s*=\s*"(.*?)"/ ) { + $url = $1; + $url .= "/" unless $url =~ m:/$:; + + my $test = kdocUtil::makeRelativePath( $relurl, $url ); + $url = $test; + } + elsif( /<PLANG\s*=\s*"(.*?)">/ ) { + $root = $rootsub->( $1 ); + $n = $root; + } + elsif ( /<C\s*NAME="(.*?)"\s*REF="(.*?)"\s*>/ ) { + # class + $new = Ast::New( $1 ); + $new->AddProp( "NodeType", "class" ); + $new->AddProp( "Compound", 1 ); + $new->AddProp( "ExtSource", $name ); + + # already escaped at this point! + $new->AddProp( "Ref", $url.$2 ); + + $root = $n = $rootsub->( "CXX" ) unless defined $root; + kdocAstUtil::attachChild( $n, $new ); + push @stack, $n; + $n = $new; + } + elsif ( m#<IN\s*NAME\s*=\s*"(.*?)"\s*># ) { + # ancestor + kdocAstUtil::newInherit( $n, $1 ); + } + elsif ( m#</C># ) { + # end class + $n = pop @stack; + } + elsif ( m#<(M\w*)\s+NAME="(.*?)"\s+REF="(.*?)"\s*># ) { + # member + $new = Ast::New( $2 ); + $new->AddProp( "NodeType", $1 eq "ME" ? "method" : "var" ); + $new->AddProp( "ExtSource", $name ); + $new->AddProp( "Flags", "" ); + $new->AddProp( "Ref", $url.$3 ); + + kdocAstUtil::attachChild( $n, $new ); + } + } +} + +1; diff --git a/kalyptus/kdocParseDoc.pm b/kalyptus/kdocParseDoc.pm new file mode 100644 index 0000000..e5f19d5 --- /dev/null +++ b/kalyptus/kdocParseDoc.pm @@ -0,0 +1,419 @@ +package kdocParseDoc; + +use Ast; +use strict; + +use vars qw/ $buffer $docNode %extraprops $currentProp $propType /; + +=head1 kdocParseDoc + + Routines for parsing of javadoc comments. + +=head2 newDocComment + + Parameters: begin (starting line of declaration) + + Reads a doc comment to the end and creates a new doc node. + + Read a line + check if it changes the current context + yes + flush old context + check if it is a non-text tag + (ie internal/deprecated etc) + yes + reset context to text + set associated property + no + set the new context + assign text to new buffer + no add to text buffer + continue + at end + flush anything pending. + +=cut + +sub newDocComment +{ + my( $text ) = @_; + return undef unless $text =~ m#/\*\*+#; + + setType( "DocText", 2 ); + $text =~ m#/\*#; # need to do the match again, otherwise /***/ doesn't parse + ### TODO update this method from kdoc + $buffer = $'; # everything after the first \* + $docNode = undef; + %extraprops = (); # used for textprops when flushing. + my $finished = 0; + my $inbounded = 0; + + if ( $buffer =~ m#\*/# ) { + $buffer = $`; + $finished = 1; + } + +PARSELOOP: + while ( defined $text && !$finished ) { + # read text and remove leading junk + $text = main::readSourceLine(); + next if !defined $text; + $text =~ s#^\s*\*(?!\/)##; + +# if ( $text =~ /^\s*<\/pre>/i ) { +# flushProp(); +# $inbounded = 0; +# } + if( $inbounded ) { + if ( $text =~ m#\*/# ) { + $finished = 1; + $text = $`; + } + $buffer .= $text; + next PARSELOOP; + } +# elsif ( $text =~ /^\s*<pre>/i ) { +# textProp( "Pre" ); +# $inbounded = 1; +# } + elsif ( $text =~ /^\s*$/ ) { + textProp( "ParaBreak", "\n" ); + } + elsif ( $text =~ /^\s*\@internal\s*/ ) { + codeProp( "Internal", 1 ); + } + elsif ( $text =~ /^\s*\@deprecated\s*/ ) { + codeProp( "Deprecated", 1 ); + } + elsif ( $text =~ /^\s*\@reimplemented\s*/ ) { + codeProp( "Reimplemented", 1 ); + } + elsif ( $text =~ /^\s*\@group\s*/ ) { + # logical group tag in which this node belongs + # multiples allowed + + my $groups = $'; + $groups =~ s/^\s*(.*?)\s*$/$1/; + + if ( $groups ne "" ) { + foreach my $g ( split( /[^_\w]+/, $groups) ) { + + codeProp( "InGroup", $g ); + } + } + } + elsif ( $text =~ /^\s*\@defgroup\s+(\w+)\s*/ ) { + # parse group tag and description + my $grptag = $1; + my $grpdesc = $' eq "" ? $grptag : $'; + + # create group node + my $grpnode = Ast::New( $grptag ); + $grpnode->AddProp( "Desc", $grpdesc ); + $grpnode->AddProp( "NodeType", "GroupDef" ); + + # attach + codeProp( "Groups", $grpnode ); + } + elsif ( $text =~ /^\s*\@see\s*/ ) { + docListProp( "See" ); + } + elsif( $text =~ /^\s*\@short\s*/ ) { + docProp( "ClassShort" ); + } + elsif( $text =~ /^\s*\@author\s*/ ) { + docProp( "Author" ); + + } + elsif( $text =~ /^\s*\@version\s*/ ) { + docProp( "Version" ); + } + elsif( $text =~ /^\s*\@id\s*/ ) { + + docProp( "Id" ); + } + elsif( $text =~ /^\s*\@since\s*/ ) { + docProp( "Since" ); + } + elsif( $text =~ /^\s*\@returns?\s*/ ) { + docProp( "Returns" ); + } + elsif( $text =~ /^\s*\@(?:throws|exception|raises)\s*/ ) { + docListProp( "Throws" ); + } + elsif( $text =~ /^\s*\@image\s+([^\s]+)\s*/ ) { + textProp( "Image" ); + $extraprops{ "Path" } = $1; + } + elsif( $text =~ /^\s*\@param\s+(\w+)\s*/ ) { + textProp( "Param" ); + $extraprops{ "Name" } = $1; + } + elsif( $text =~ /^\s*\@sect\s+/ ) { + + textProp( "DocSection" ); + } + elsif( $text =~ /^\s*\@li\s+/ ) { + + textProp( "ListItem" ); + } + elsif ( $text =~ /^\s*\@libdoc\s+/ ) { + # Defines the text for the entire library + docProp( "LibDoc" ); + } + else { + if ( $text =~ m#\*/# ) { + $finished = 1; + $text = $`; + } + $buffer .= $text; + } + } + + flushProp(); + + + return undef if !defined $docNode; + +# postprocess docnode + + # add a . to the end of the short if required. + my $short = $docNode->{ClassShort}; + + if ( defined $short ) { + if ( !($short =~ /\.\s*$/) ) { + $docNode->{ClassShort} =~ s/\s*$/./; + } + } + else { + # use first line of normal text as short name. + if ( defined $docNode->{Text} ) { + my $node; + foreach $node ( @{$docNode->{Text}} ) { + next if $node->{NodeType} ne "DocText"; + $short = $node->{astNodeName}; + $short = $`."." if $short =~ /\./; + $docNode->{ClassShort} = $short; + goto shortdone; + } + } + } +shortdone: + +# Join and break all word list props so that they are one string per list +# node, ie remove all commas and spaces. + + recombineOnWords( $docNode, "See" ); + recombineOnWords( $docNode, "Throws" ); + + return $docNode; +} + +=head3 setType + + Parameters: propname, proptype ( 0 = single, 1 = list, 2 = text ) + + Set the name and type of the pending property. + +=cut + +sub setType +{ + ( $currentProp, $propType ) = @_; +} + +=head3 flushProp + + Flush any pending item and reset the buffer. type is set to DocText. + +=cut + +sub flushProp +{ + return if $buffer eq ""; + initDocNode() unless defined $docNode; + + if( $propType == 1 ) { + # list prop + $docNode->AddPropList( $currentProp, $buffer ); + } + elsif ( $propType == 2 ) { + # text prop + my $textnode = Ast::New( $buffer ); + $textnode->AddProp( 'NodeType', $currentProp ); + $docNode->AddPropList( 'Text', $textnode ); + + foreach my $prop ( keys %extraprops ) { + $textnode->AddProp( $prop, + $extraprops{ $prop } ); + } + + %extraprops = (); + } + else { + # one-off prop + $docNode->AddProp( $currentProp, $buffer ); + } + + # reset buffer + $buffer = ""; + setType( "DocText", 2 ); +} + +=head3 codeProp + + Flush the last node, add a new property and reset type to DocText. + +=cut + +sub codeProp +{ + my( $prop, $val ) = @_; + + flushProp(); + + initDocNode() unless defined $docNode; + $docNode->AddPropList( $prop, $val ); + + setType( "DocText", 2 ); + +} + +=head3 docListProp + + The next item is a list property of docNode. + +=cut + +sub docListProp +{ + my( $prop ) = @_; + + flushProp(); + + $buffer = $'; + setType( $prop, 1 ); +} + +=head3 docProp + + The next item is a simple property of docNode. + +=cut + +sub docProp +{ + my( $prop ) = @_; + + flushProp(); + + $buffer = $'; + setType( $prop, 0 ); +} + +=head3 textProp + + Parameters: prop, val + + Set next item to be a 'Text' list node. if val is assigned, the + new node is assigned that text and flushed immediately. If this + is the case, the next item is given the 'DocText' text property. + +=cut + +sub textProp +{ + my( $prop, $val ) = @_; + + flushProp(); + + if ( defined $val ) { + $buffer = $val; + setType( $prop, 2 ); + flushProp(); + $prop = "DocText"; + } + + setType( $prop, 2 ); + $buffer = $'; +} + + +=head3 initDocNode + + Creates docNode if it is not defined. + +=cut + +sub initDocNode +{ + $docNode = Ast::New( "Doc" ); + $docNode->AddProp( "NodeType", "DocNode" ); +} + +sub recombineOnWords +{ + my ( $docNode, $prop ) = @_; + + if ( exists $docNode->{$prop} ) { + my @oldsee = @{$docNode->{$prop}}; + @{$docNode->{$prop}} = split (/[\s,]+/, join( " ", @oldsee )); + } +} + +############### + +=head2 attachDoc + +Connects a docnode to a code node, setting any other properties +if required, such as groups, internal/deprecated flags etc. + +=cut + +sub attachDoc +{ + my ( $node, $doc, $rootnode ) = @_; + + $node->AddProp( "DocNode", $doc ); + $node->AddProp( "Internal", 1 ) if defined $doc->{Internal}; + $node->AddProp( "Deprecated", 1 ) if defined $doc->{Deprecated}; + + # attach group definitions if they exist + if ( defined $doc->{Groups} ) { + my $groupdef = $rootnode->{Groups}; + if( !defined $groupdef ) { + $groupdef = Ast::New( "Groups" ); + $rootnode->AddProp( "Groups", $groupdef ); + } + + foreach my $grp ( @{$doc->{Groups}} ) { + if ( defined $groupdef->{ $grp->{astNodeName} } ) { + $groupdef->{ $grp->{ astNodeName} + }->AddProp( "Desc", $grp->{Desc} ); + } + else { + $groupdef->AddProp( $grp->{astNodeName}, $grp ); + } + } + } + + # attach node to group index(es) + # create groups if not found, they may be parsed later. + + if ( defined $doc->{InGroup} ) { + my $groupdef = $rootnode->{Groups}; + + foreach my $grp ( @{$doc->{InGroup}} ) { + if ( !exists $groupdef->{$grp} ) { + my $newgrp = Ast::New( $grp ); + $newgrp->AddProp( "Desc", $grp ); + $newgrp->AddProp( "NodeType", "GroupDef" ); + $groupdef->AddProp( $grp, $newgrp ); + } + + $groupdef->{$grp}->AddPropList( "Kids", $node ); + } + } +} + +1; diff --git a/kalyptus/kdocUtil.pm b/kalyptus/kdocUtil.pm new file mode 100644 index 0000000..629147a --- /dev/null +++ b/kalyptus/kdocUtil.pm @@ -0,0 +1,189 @@ + +package kdocUtil; + +use strict; + + +=head1 kdocUtil + + General utilities. + +=head2 countReg + + Parameters: string, regexp + + Returns the number of times of regexp occurs in string. + +=cut + +sub countReg +{ + my( $str, $regexp ) = @_; + my( $count ) = 0; + + while( $str =~ /$regexp/s ) { + $count++; + + $str =~ s/$regexp//s; + } + + return $count; +} + +=head2 findCommonPrefix + + Parameters: string, string + + Returns the prefix common to both strings. An empty string + is returned if the strings have no common prefix. + +=cut + +sub findCommonPrefix +{ + my @s1 = split( "/", $_[0] ); + my @s2 = split( "/", $_[1] ); + my $accum = ""; + my $len = ($#s2 > $#s1 ) ? $#s1 : $#s2; + + for my $i ( 0..$len ) { +# print "Compare: $i '$s1[$i]', '$s2[$i]'\n"; + last if $s1[ $i ] ne $s2[ $i ]; + $accum .= $s1[ $i ]."/"; + } + + return $accum; +} + +=head2 makeRelativePath + + Parameters: localpath, destpath + + Returns a relative path to the destination from the local path, + after removal of any common prefix. + +=cut + +sub makeRelativePath +{ + my ( $from, $to ) = @_; + + # remove prefix + $from .= '/' unless $from =~ m#/$#; + $to .= '/' unless $to =~ m#/$#; + + my $pfx = findCommonPrefix( $from, $to ); + + if ( $pfx ne "" ) { + $from =~ s/^$pfx//g; + $to =~ s/^$pfx//g; + } +# print "Prefix is '$pfx'\n"; + + $from =~ s#/+#/#g; + $to =~ s#/+#/#g; + $pfx = countReg( $from, '\/' ); + + my $rel = "../" x $pfx; + $rel .= $to; + + return $rel; +} + +sub hostName +{ + my $host = ""; + my @hostenvs = qw( HOST HOSTNAME COMPUTERNAME ); + + # Host name + foreach my $evar ( @hostenvs ) { + next unless defined $ENV{ $evar }; + + $host = $ENV{ $evar }; + last; + } + + if( $host eq "" ) { + $host = `uname -n`; + chop $host; + } + + return $host; +} + +sub userName +{ + my $who = ""; + my @userenvs = qw( USERNAME USER LOGNAME ); + + # User name + foreach my $evar ( @userenvs ) { + next unless defined $ENV{ $evar }; + + $who = $ENV{ $evar }; + last; + } + + if( $who eq "" ) { + if ( $who = `whoami` ) { + chop $who; + } + elsif ( $who - `who am i` ) { + $who = ( split (/ /, $who ) )[0]; + } + } + + return $who; +} + +=head2 splitUnnested + Helper to split a list using a delimiter, but looking for + nesting with (), {}, [] and <>. + Example: splitting int a, QPair<c,b> d, e="," + on ',' will give 3 items in the list. + + Parameter: delimiter, string + Returns: array, after splitting the string + + Thanks to Ashley Winters +=cut +sub splitUnnested($$) { + my $delim = shift; + my $string = shift; + my(%open) = ( + '[' => ']', + '(' => ')', + '<' => '>', + '{' => '}', + ); + my(%close) = reverse %open; + my @ret; + my $depth = 0; + my $start = 0; + my $indoublequotes = 0; + while($string =~ /($delim|<<|>>|[][}{)(><\"])/g) { + my $c = $1; + if(!$depth and !$indoublequotes and $c eq $delim) { + my $len = pos($string) - $start - 1; + push @ret, substr($string, $start, $len); + $start = pos($string); + } elsif($open{$c}) { + $depth++; + } elsif($close{$c}) { + $depth--; + } elsif($c eq '"') { + if ($indoublequotes) { + $indoublequotes = 0; + } else { + $indoublequotes = 1; + } + } + } + + my $subs = substr($string, $start); + push @ret, $subs if ($subs); + return @ret; +} + +1; + diff --git a/puic/LICENSE.GPL b/puic/LICENSE.GPL new file mode 100644 index 0000000..c7aea18 --- /dev/null +++ b/puic/LICENSE.GPL @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/puic/Makefile.am b/puic/Makefile.am new file mode 100644 index 0000000..d429dc7 --- /dev/null +++ b/puic/Makefile.am @@ -0,0 +1,33 @@ +AM_CPPFLAGS = -DUIC -DQT_INTERNAL_XML +AM_CXXFLAGS= $(KDE_CXXFLAGS) + +bin_PROGRAMS = puic + +puic_SOURCES = widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp +puic_LDADD = $(LIB_QT) $(LIBZ) + +man_MANS = puic.1 + +EXTRA_DIST = domtool.cpp domtool.h embed.cpp form.cpp globaldefs.h main.cpp object.cpp parser.cpp parser.h subclassing.cpp uic.cpp uic.h widgetdatabase.cpp widgetdatabase.h widgetinterface.h puic.1 + +# These paths are KDE specific : +# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS. +# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES. +# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES. +# kde_styledir Where Qt/KDE widget styles should go to (new in KDE 3). +# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3). + +# set the include path for X, qt and KDE +INCLUDES= $(all_includes) + +METASOURCES = AUTO + +# the library search path. +puic_LDFLAGS = $(all_libraries) $(KDE_RPATH) + +messages: + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) $$LIST -o $(podir)/puic.pot; \ + fi + diff --git a/puic/Makefile.in b/puic/Makefile.in new file mode 100644 index 0000000..5caff94 --- /dev/null +++ b/puic/Makefile.in @@ -0,0 +1,699 @@ +# Makefile.in generated by automake 1.7.2 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 1.3 $ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_HAVE_GL = @KDE_HAVE_GL@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ +KDE_MT_LIBS = @KDE_MT_LIBS@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBRESOLV = @LIBRESOLV@ +LIBS = @LIBS@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBZ = @LIBZ@ +LIB_POLL = @LIB_POLL@ +LIB_QPE = @LIB_QPE@ +LIB_QT = @LIB_QT@ +LIB_X11 = @LIB_X11@ +LIB_XEXT = @LIB_XEXT@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MOC = @MOC@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +QTE_NORTTI = @QTE_NORTTI@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RPATH = @USE_RPATH@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +kde_includes = @kde_includes@ +kde_libraries = @kde_libraries@ +kde_qtver = @kde_qtver@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +qt_test_threshold = @qt_test_threshold@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ +AM_CPPFLAGS = -DUIC -DQT_INTERNAL_XML +AM_CXXFLAGS = $(KDE_CXXFLAGS) + +bin_PROGRAMS = puic + +puic_SOURCES = widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp +puic_LDADD = $(LIB_QT) $(LIBZ) + +man_MANS = puic.1 + +EXTRA_DIST = domtool.cpp domtool.h embed.cpp form.cpp globaldefs.h main.cpp object.cpp parser.cpp parser.h subclassing.cpp uic.cpp uic.h widgetdatabase.cpp widgetdatabase.h widgetinterface.h puic.1 + +# These paths are KDE specific : +# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS. +# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES. +# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES. +# kde_styledir Where Qt/KDE widget styles should go to (new in KDE 3). +# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3). + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +#>- METASOURCES = AUTO + +# the library search path. +puic_LDFLAGS = $(all_libraries) $(KDE_RPATH) +subdir = puic +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = puic$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_puic_OBJECTS = widgetdatabase.$(OBJEXT) uic.$(OBJEXT) \ + subclassing.$(OBJEXT) parser.$(OBJEXT) object.$(OBJEXT) \ + main.$(OBJEXT) form.$(OBJEXT) embed.$(OBJEXT) domtool.$(OBJEXT) +#>- puic_OBJECTS = $(am_puic_OBJECTS) +#>+ 6 +puic_final_OBJECTS = puic.all_cpp.o +puic_nofinal_OBJECTS = widgetdatabase.$(OBJEXT) uic.$(OBJEXT) \ + subclassing.$(OBJEXT) parser.$(OBJEXT) object.$(OBJEXT) \ + main.$(OBJEXT) form.$(OBJEXT) embed.$(OBJEXT) domtool.$(OBJEXT) +@KDE_USE_FINAL_FALSE@puic_OBJECTS = $(puic_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@puic_OBJECTS = $(puic_final_OBJECTS) +puic_DEPENDENCIES = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po +#>+ 11 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/puic.all_cpp.P ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(puic_SOURCES) + +NROFF = nroff +MANS = $(man_MANS) +DIST_COMMON = Makefile.am Makefile.in TODO +SOURCES = $(puic_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu puic/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu puic/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/puic/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +puic$(EXEEXT): $(puic_OBJECTS) $(puic_DEPENDENCIES) + @rm -f puic$(EXEEXT) + $(CXXLINK) $(puic_LDFLAGS) $(puic_OBJECTS) $(puic_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/domtool.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subclassing.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widgetdatabase.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +man1dir = $(mandir)/man1 +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=stamp-h.in puic.pro LICENSE.GPL + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am +#>+ 1 +clean-am: clean-final clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-man1 install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-man uninstall-man1 + + +messages: + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) $$LIST -o $(podir)/puic.pot; \ + fi +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu puic/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/puic/Makefile.in + + +#>+ 9 +bcheck: bcheck-am + +bcheck-am: + test ! -r bchecktest.cc.class || mv -f bchecktest.cc.class bchecktest.cc.oldclass + @echo "int main() {return 0;}" > bchecktest.cc + for i in $(include_HEADERS); do echo "#include \"$$i\"" >> bchecktest.cc; done + test ! -s bchecktest.cc || $(CXXCOMPILE) --dump-class-hierarchy bchecktest.cc + test ! -s bchecktest.cc.oldclass || test ! -s bchecktest.cc.class || cmp -s bchecktest.cc.oldclass bchecktest.cc.class + +#>+ 11 +puic.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/widgetdatabase.cpp $(srcdir)/uic.cpp $(srcdir)/subclassing.cpp $(srcdir)/parser.cpp $(srcdir)/object.cpp $(srcdir)/main.cpp $(srcdir)/form.cpp $(srcdir)/embed.cpp $(srcdir)/domtool.cpp + @echo 'creating puic.all_cpp.cpp ...'; \ + rm -f puic.all_cpp.files puic.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> puic.all_cpp.final; \ + for file in widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp ; do \ + echo "#include \"$$file\"" >> puic.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> puic.all_cpp.final; \ + done; \ + cat puic.all_cpp.final puic.all_cpp.files > puic.all_cpp.cpp; \ + rm -f puic.all_cpp.final puic.all_cpp.files + +#>+ 3 +clean-final: + -rm -f puic.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) puic_OBJECTS="$(puic_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) puic_OBJECTS="$(puic_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) puic_OBJECTS="$(puic_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) puic_OBJECTS="$(puic_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/puic/TODO b/puic/TODO new file mode 100644 index 0000000..77702c9 --- /dev/null +++ b/puic/TODO @@ -0,0 +1,7 @@ + +- PNGs embedded in ui files and B&W pictures in external MimeSourceFactory remain untested + (and thus probably wrong) +- PerlQt does not handle subclassing yet, so don't use the -subimpl option +- database code needs more testing +- ... + diff --git a/puic/domtool.cpp b/puic/domtool.cpp new file mode 100644 index 0000000..492ce88 --- /dev/null +++ b/puic/domtool.cpp @@ -0,0 +1,453 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "domtool.h" + +#include <qsizepolicy.h> +#include <qcolor.h> +#include <qcursor.h> +#include <qdatetime.h> +#include <qrect.h> +#include <qsize.h> +#include <qfont.h> +#include <qdom.h> + +/*! + \class DomTool domtool.h + \brief Tools for the dom + + A collection of static functions used by Resource (part of the + designer) and Uic. + +*/ + +/*! + Returns the contents of property \a name of object \a e as + variant or the variant passed as \a defValue if the property does + not exist. + + \sa hasProperty() +*/ +QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + if ( n.attribute( "name" ) != name ) + continue; + return elementToVariant( n.firstChild().toElement(), defValue, comment ); + } + } + return defValue; +} + + +/*! + \overload + */ +QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ) +{ + QString comment; + return readProperty( e, name, defValue, comment ); +} + +/*! + Returns wheter object \a e defines property \a name or not. + + \sa readProperty() + */ +bool DomTool::hasProperty( const QDomElement& e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + if ( n.attribute( "name" ) != name ) + continue; + return TRUE; + } + } + return FALSE; +} + +QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type ) +{ + QStringList result; + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + QDomElement n2 = n.firstChild().toElement(); + if ( n2.tagName() == type ) + result += n.attribute( "name" ); + } + } + return result; +} + + +QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue ) +{ + QString dummy; + return elementToVariant( e, defValue, dummy ); +} + +/*! + Interprets element \a e as variant and returns the result of the interpretation. + */ +QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ) +{ + QVariant v; + if ( e.tagName() == "rect" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0, w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QRect( x, y, w, h ) ); + } else if ( e.tagName() == "point" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QPoint( x, y ) ); + } else if ( e.tagName() == "size" ) { + QDomElement n3 = e.firstChild().toElement(); + int w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QSize( w, h ) ); + } else if ( e.tagName() == "color" ) { + v = QVariant( readColor( e ) ); + } else if ( e.tagName() == "font" ) { + QDomElement n3 = e.firstChild().toElement(); + QFont f( defValue.toFont() ); + while ( !n3.isNull() ) { + if ( n3.tagName() == "family" ) + f.setFamily( n3.firstChild().toText().data() ); + else if ( n3.tagName() == "pointsize" ) + f.setPointSize( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "bold" ) + f.setBold( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "italic" ) + f.setItalic( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "underline" ) + f.setUnderline( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "strikeout" ) + f.setStrikeOut( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( f ); + } else if ( e.tagName() == "string" ) { + v = QVariant( e.firstChild().toText().data() ); + QDomElement n = e; + n = n.nextSibling().toElement(); + if ( n.tagName() == "comment" ) + comment = n.firstChild().toText().data(); + } else if ( e.tagName() == "cstring" ) { + v = QVariant( QCString( e.firstChild().toText().data() ) ); + } else if ( e.tagName() == "number" ) { + bool ok = TRUE; + v = QVariant( e.firstChild().toText().data().toInt( &ok ) ); + if ( !ok ) + v = QVariant( e.firstChild().toText().data().toDouble() ); + } else if ( e.tagName() == "bool" ) { + QString t = e.firstChild().toText().data(); + v = QVariant( t == "true" || t == "1", 0 ); + } else if ( e.tagName() == "pixmap" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "iconset" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "image" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "enum" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "set" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "sizepolicy" ) { + QDomElement n3 = e.firstChild().toElement(); + QSizePolicy sp; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hsizetype" ) + sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "vsizetype" ) + sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "horstretch" ) + sp.setHorStretch( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "verstretch" ) + sp.setVerStretch( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( sp ); + } else if ( e.tagName() == "cursor" ) { + v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) ); + } else if ( e.tagName() == "stringlist" ) { + QStringList lst; + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + lst << n.firstChild().toText().data(); + v = QVariant( lst ); + } else if ( e.tagName() == "date" ) { + QDomElement n3 = e.firstChild().toElement(); + int y, m, d; + y = m = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QDate( y, m, d ) ); + } else if ( e.tagName() == "time" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, m, s; + h = m = s = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QTime( h, m, s ) ); + } else if ( e.tagName() == "datetime" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, mi, s, y, mo, d ; + h = mi = s = y = mo = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + mi = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + mo = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QDateTime( QDate( y, mo, d ), QTime( h, mi, s ) ) ); + } + return v; +} + + +/*! Returns the color which is returned in the dom element \a e. + */ + +QColor DomTool::readColor( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + int r= 0, g = 0, b = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "red" ) + r = n.firstChild().toText().data().toInt(); + else if ( n.tagName() == "green" ) + g = n.firstChild().toText().data().toInt(); + else if ( n.tagName() == "blue" ) + b = n.firstChild().toText().data().toInt(); + n = n.nextSibling().toElement(); + } + + return QColor( r, g, b ); +} + +/*! + Returns the contents of attribute \a name of object \a e as + variant or the variant passed as \a defValue if the attribute does + not exist. + + \sa hasAttribute() + */ +QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "attribute" ) { + if ( n.attribute( "name" ) != name ) + continue; + return elementToVariant( n.firstChild().toElement(), defValue, comment ); + } + } + return defValue; +} + +/*! + \overload +*/ +QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ) +{ + QString comment; + return readAttribute( e, name, defValue, comment ); +} + +/*! + Returns wheter object \a e defines attribute \a name or not. + + \sa readAttribute() + */ +bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "attribute" ) { + if ( n.attribute( "name" ) != name ) + continue; + return TRUE; + } + } + return FALSE; +} + +static bool toBool( const QString& s ) +{ + return s == "true" || s.toInt() != 0; +} + +/*! + Convert Qt 2.x format to Qt 3.0 format if necessary +*/ +void DomTool::fixDocument( QDomDocument& doc ) +{ + QDomElement e; + QDomNode n; + QDomNodeList nl; + int i = 0; + + e = doc.firstChild().toElement(); + if ( e.tagName() != "UI" ) + return; + + // latest version, don't do anything + if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.0 ) + return; + + nl = doc.elementsByTagName( "property" ); + + // in 3.0, we need to fix a spelling error + if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) { + for ( i = 0; i < (int) nl.length(); i++ ) { + QDomElement el = nl.item(i).toElement(); + QString s = el.attribute( "name" ); + if ( s == "resizeable" ) { + el.removeAttribute( "name" ); + el.setAttribute( "name", "resizable" ); + } + } + return; + } + + + // in versions smaller than 3.0 we need to change more + e.setAttribute( "version", 3.0 ); + + e.setAttribute("stdsetdef", 1 ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + if ( name == "resizeable" ) + e.setAttribute( "name", "resizable" ); + else + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + bool stdset = toBool( e.attribute( "stdset" ) ); + if ( stdset || name == "toolTip" || name == "whatsThis" || + name == "buddy" || + e.parentNode().toElement().tagName() == "item" || + e.parentNode().toElement().tagName() == "spacer" || + e.parentNode().toElement().tagName() == "column" + ) + e.removeAttribute( "stdset" ); + else + e.setAttribute( "stdset", 0 ); + } + + nl = doc.elementsByTagName( "attribute" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + } + + nl = doc.elementsByTagName( "image" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + } + + nl = doc.elementsByTagName( "widget" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "class" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "class", name ); + e.removeChild( n2 ); + } + } + +} + diff --git a/puic/domtool.h b/puic/domtool.h new file mode 100644 index 0000000..61b4269 --- /dev/null +++ b/puic/domtool.h @@ -0,0 +1,53 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DOMTOOL_H +#define DOMTOOL_H + +#include <qvariant.h> +#include <qnamespace.h> + +class QDomElement; +class QDomDocument; + +class DomTool : public Qt +{ +public: + static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ); + static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); + static bool hasProperty( const QDomElement& e, const QString& name ); + static QStringList propertiesOfType( const QDomElement& e, const QString& type ); + static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue ); + static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ); + static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ); + static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); + static bool hasAttribute( const QDomElement& e, const QString& name ); + static QColor readColor( const QDomElement &e ); + static void fixDocument( QDomDocument& ); +}; + + +#endif // DOMTOOL_H diff --git a/puic/embed.cpp b/puic/embed.cpp new file mode 100644 index 0000000..aac9633 --- /dev/null +++ b/puic/embed.cpp @@ -0,0 +1,264 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk> +** Copyright (c) 2002 Riverbank Computing Limited <info@riverbankcomputing.co.uk> +** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com> +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +/* +** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler, +** a work derivated from uic (the Qt User Interface Compiler) +** and pyuic (the PyQt User Interface Compiler). +** +** G.Garand +** +**********************************************************************/ + +#include "uic.h" +#include <qfile.h> +#include <qimage.h> +#include <qstringlist.h> +#include <qdatetime.h> +#include <qfileinfo.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#include <qregexp.h> +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +struct EmbedImage +{ + int width, height, depth; + int numColors; + QRgb* colorTable; + QString name; + QString cname; + bool alpha; +}; + +static QString convertToCIdentifier( const char *s ) +{ + QString r = s; + int len = r.length(); + if ( len > 0 && !isalpha( (char)r[0].latin1() ) ) + r[0] = '_'; + for ( int i=1; i<len; i++ ) { + if ( !isalnum( (char)r[i].latin1() ) ) + r[i] = '_'; + } + return r; +} + + +static void embedData( QTextStream& out, const uchar* input, int nbytes ) +{ + static const char hexdigits[] = "0123456789abcdef"; + QString s; + for ( int i=0; i<nbytes; i++ ) + { + if ( (i%14) == 0 ) + { + s += "\n "; + out << (const char*)s; + s.truncate( 0 ); + } + uint v = input[i]; + s += "0x"; + s += hexdigits[(v >> 4) & 15]; + s += hexdigits[v & 15]; + if ( i < nbytes-1 ) + s += ", "; + else + s += "\n"; + } + if ( s.length() ) + out << (const char*)s; +} + +static void embedData( QTextStream& out, const QRgb* input, int n ) +{ + out << hex; + const QRgb *v = input; + for ( int i=0; i<n; i++ ) { + if ( (i%6) == 0 ) + out << endl << " "; + out << "0x"; + out << hex << *v++; + if ( i < n-1 ) + out << ", "; + else + out << ";" << endl; + } + out << dec; // back to decimal mode +} + +void Uic::embed( QTextStream& out, const char* project, const QStringList& images ) +{ + + QString cProject = convertToCIdentifier( project ); + + QStringList::ConstIterator it; + out << "# Image collection for project '" << project << "'." << endl; + out << "#" << endl; + out << "# Generated from reading image files: " << endl; + for ( it = images.begin(); it != images.end(); ++it ) + out << "# " << *it << endl; + out << "#" << endl; + out << "# Created: " << QDateTime::currentDateTime().toString() << endl; + out << "# by: The PerlQt User Interface Compiler (puic)" << endl; + out << "#" << endl; + out << "# WARNING! All changes made in this file will be lost!" << endl; + out << endl; + out << "use strict;" << endl; + out << "use utf8;" << endl; + out << endl; + + out << indent << "package DesignerMimeSourceFactory_" << cProject << ";" << endl; + out << indent << "use Qt;" << endl; + out << indent << "use Qt::isa qw(Qt::MimeSourceFactory);" << endl; + out << endl; + + QPtrList<EmbedImage> list_image; + int image_count = 0; + for ( it = images.begin(); it != images.end(); ++it ) { + QImage img; + if ( !img.load( *it ) ) { + fprintf( stderr, "puic: cannot load image file %s\n", (*it).latin1() ); + continue; + } + EmbedImage *e = new EmbedImage; + e->width = img.width(); + e->height = img.height(); + e->depth = img.depth(); + e->numColors = img.numColors(); + e->colorTable = new QRgb[e->numColors]; + e->alpha = img.hasAlphaBuffer(); + memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb)); + QFileInfo fi( *it ); + e->name = fi.fileName(); + e->cname = QString("$image_%1").arg( image_count++); + list_image.append( e ); + out << "# " << *it << endl; + QString s; + QString imgname = (const char *)e->cname; + + +//my $i0 = Qt::Image($image_0_data, 22, 22, 32, undef, &Qt::Image::BigEndian); +//$i0->setAlphaBuffer(1); +//my $image0 = Qt::Pixmap($i0); + + if ( e->depth == 32 ) { + out << indent << "my " << imgname << "_data = pack 'L*'," << endl; + embedData( out, (QRgb*)img.bits(), e->width*e->height ); + } else { + if ( e->depth == 1 ) + img = img.convertBitOrder(QImage::BigEndian); + out << indent << "my " << imgname << "_data = pack 'C*'," << endl; + embedData( out, img.bits(), img.numBytes() ); + } + out << endl; + if ( e->numColors ) { + out << indent << "my " << imgname << "_ctable = " << endl; + out << indent << "[" << endl; + embedData( out, e->colorTable, e->numColors ); + out << endl; + out << indent << "];" << endl; + } + } + + if ( !list_image.isEmpty() ) { + out << indent << "my %embed_images = (\n"; + ++indent; + EmbedImage *e = list_image.first(); + while ( e ) + { + out << indent << "\"" << e->name << "\"" << " => [" << e->cname << "_data, " + << e->width << ", " << e->height << ", " << e->depth << ", " + << (e->numColors ? e->cname + "_ctable" : QString::fromLatin1("undef") ) << ", " + << (e->alpha ? "1" : "0") << "]," << endl; + e = list_image.next(); + } + --indent; + out << indent << ");" << endl; + + out << endl; + out << indent << "my %images = ();" << endl; + out << endl; + out << endl; + out << indent << "sub uic_findImage" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "my $name = shift;" << endl; + out << indent << "return $images{$name} if exists $images{$name};" << endl; + out << indent << "return Qt::Image() unless exists $embed_images{$name};" << endl; + out << indent << endl; + out << indent << "my $img = Qt::Image(@{$embed_images{$name}}[0..4], &Qt::Image::BigEndian);" << endl; + out << indent << "${$embed_images{$name}}[5] && $img->setAlphaBuffer(1);" << endl; + out << indent << "$images{$name} = $img;" << endl; + out << indent << "return $img;" << endl; + --indent; + out << indent << "}" << endl; + out << endl; + out << indent << "sub data" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "my $abs_name = shift;" << endl; + out << indent << "my $img = uic_findImage($abs_name);" << endl; + out << indent << "if($img->isNull())" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "Qt::MimeSourceFactory::removeFactory(this);" << endl; + out << indent << "my $s = Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl; + out << indent << "Qt::MimeSourceFactory::addFactory(this);" << endl; + out << indent << "return $s;" << endl; + --indent; + out << indent << "}" << endl; + out << indent << "Qt::MimeSourceFactory::defaultFactory()->setImage($abs_name, $img);" << endl; + out << indent << "return Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl; + --indent; + out << indent << "}" << endl; + + out << endl; + out << endl; + + out << indent << "package staticImages;" << endl; + out << indent << "use Qt;" << endl; + out << indent << "use DesignerMimeSourceFactory_" << cProject << ";" << endl; + out << indent << "our %factories;" << endl; + out << indent << endl; + out << indent << "my $factory = DesignerMimeSourceFactory_" << cProject << ";" << endl; + out << indent << "Qt::MimeSourceFactory::defaultFactory()->addFactory($factory);" << endl; + out << indent << "$factories{'DesignerMimeSourceFactory_" << cProject << "'} = $factory;" << endl; + out << endl; + out << indent << "END" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "for( values %factories )" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "Qt::MimeSourceFactory::defaultFactory()->removeFactory($_);" << endl; + --indent; + out << indent << "}" << endl; + out << indent << "%factories = ();" << endl; + --indent; + out << indent << "}" << endl; + out << indent << "1;" << endl;; + out << endl; + } +} diff --git a/puic/form.cpp b/puic/form.cpp new file mode 100644 index 0000000..56f44c2 --- /dev/null +++ b/puic/form.cpp @@ -0,0 +1,1224 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com> +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +/* +** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler, +** a work derivated from uic (the Qt User Interface Compiler) +** and pyuic (the PyQt User Interface Compiler). +** +** G.Garand +** +**********************************************************************/ + +#include <iostream> +#include "uic.h" +#include "parser.h" +#include "widgetdatabase.h" +#include "domtool.h" +#include <qstringlist.h> +#include <qvaluelist.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdir.h> +#include <qregexp.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#if( QT_VERSION < 0x030101 ) +# include <zlib.h> + +static QByteArray qUncompress( const uchar* data, int nbytes ) +{ + if ( !data ) { +#if defined(QT_CHECK_RANGE) + qWarning( "qUncompress: data is NULL." ); +#endif + return QByteArray(); + } + if ( nbytes <= 4 ) { +#if defined(QT_CHECK_RANGE) + if ( nbytes < 4 || ( data[0]!=0 || data[1]!=0 || data[2]!=0 || data[3]!=0 ) ) + qWarning( "qUncompress: Input data is corrupted." ); +#endif + return QByteArray(); + } + ulong expectedSize = ( data[0] << 24 ) | ( data[1] << 16 ) | ( data[2] << 8 ) | data[3]; + ulong len = QMAX( expectedSize, 1 ); + QByteArray baunzip; + int res; + do { + baunzip.resize( len ); + res = ::uncompress( (uchar*)baunzip.data(), &len, + (uchar*)data+4, nbytes-4 ); + + switch ( res ) { + case Z_OK: + if ( len != baunzip.size() ) + baunzip.resize( len ); + break; + case Z_MEM_ERROR: +#if defined(QT_CHECK_RANGE) + qWarning( "qUncompress: Z_MEM_ERROR: Not enough memory." ); +#endif + break; + case Z_BUF_ERROR: + len *= 2; + break; + case Z_DATA_ERROR: +#if defined(QT_CHECK_RANGE) + qWarning( "qUncompress: Z_DATA_ERROR: Input data is corrupted." ); +#endif + break; + } + } while ( res == Z_BUF_ERROR ); + + if ( res != Z_OK ) + baunzip = QByteArray(); + + return baunzip; +} +#endif // QT_VERSION < 0x030101 + +using namespace std; + +static QByteArray unzipXPM( QString data, ulong& length ) +{ + const int lengthOffset = 4; + int baSize = data.length() / 2 + lengthOffset; + uchar *ba = new uchar[ baSize ]; + for ( int i = lengthOffset; i < baSize; ++i ) { + char h = data[ 2 * (i-lengthOffset) ].latin1(); + char l = data[ 2 * (i-lengthOffset) + 1 ].latin1(); + uchar r = 0; + if ( h <= '9' ) + r += h - '0'; + else + r += h - 'a' + 10; + r = r << 4; + if ( l <= '9' ) + r += l - '0'; + else + r += l - 'a' + 10; + ba[ i ] = r; + } + // qUncompress() expects the first 4 bytes to be the expected length of the + // uncompressed data + ba[0] = ( length & 0xff000000 ) >> 24; + ba[1] = ( length & 0x00ff0000 ) >> 16; + ba[2] = ( length & 0x0000ff00 ) >> 8; + ba[3] = ( length & 0x000000ff ); + QByteArray baunzip = qUncompress( ba, baSize ); + delete[] ba; + return baunzip; +} +#if 0 +//- kept for diffs +#if QT_VERSION >= 0x030900 +#error Add this functionality to QDir (relativePathTo() maybe?) and \ +remove it from here and from moc +#endif + +QCString combinePath( const char *infile, const char *outfile ) +{ + QFileInfo inFileInfo( QDir::current(), QFile::decodeName(infile) ); + QFileInfo outFileInfo( QDir::current(), QFile::decodeName(outfile) ); + int numCommonComponents = 0; + + QStringList inSplitted = + QStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE ); + QStringList outSplitted = + QStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE ); + + while ( !inSplitted.isEmpty() && !outSplitted.isEmpty() && + inSplitted.first() == outSplitted.first() ) { + inSplitted.remove( inSplitted.begin() ); + outSplitted.remove( outSplitted.begin() ); + numCommonComponents++; + } + + if ( numCommonComponents < 2 ) { + /* + The paths don't have the same drive, or they don't have the + same root directory. Use an absolute path. + */ + return QFile::encodeName( inFileInfo.absFilePath() ); + } else { + /* + The paths have something in common. Use a path relative to + the output file. + */ + while ( !outSplitted.isEmpty() ) { + outSplitted.remove( outSplitted.begin() ); + inSplitted.prepend( ".." ); + } + inSplitted.append( inFileInfo.fileName() ); + return QFile::encodeName( inSplitted.join("/") ); + } +} +#endif + +/*! + Creates an implementation ( cpp-file ) for the form given in \a e + + \sa createFormDecl(), createObjectImpl() + */ +void Uic::createFormImpl( const QDomElement &e ) +{ + QDomElement n; + QDomNodeList nl; + int i; + QString objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return; + QString objName = getObjectName( e ); + out << indent << "package " << nameOfClass << ";" << endl; + out << indent << "use Qt;" << endl; + + // generate local and local includes required + QStringList globalIncludes, localIncludes, useIncludes; + QStringList::Iterator it; + QStringList sqlClasses; + + QMap<QString, CustomInclude> customWidgetIncludes; + QMap<QString, QString> functionImpls; + QString uiPmInclude; + + // find additional slots + QStringList extraSlots; + QStringList extraSlotTyp; + + nl = e.parentNode().toElement().elementsByTagName( "slot" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + if ( n.parentNode().toElement().tagName() != "slots" + && n.parentNode().toElement().tagName() != "connections" ) + continue; + QString l = n.attribute( "language", "C++" ); + if ( l != "C++" && l != "Perl" ) //- mmh + continue; + QString slotName = n.firstChild().toText().data().stripWhiteSpace(); + if ( slotName.endsWith( ";" ) ) + slotName = slotName.left( slotName.length() - 1 ); + + extraSlots += Parser::cleanArgs(slotName); + extraSlotTyp += n.attribute( "returnType", "void" ); + } + + // find additional functions + QStringList extraFuncts; + QStringList extraFunctTyp; + + nl = e.parentNode().toElement().elementsByTagName( "function" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + if ( n.parentNode().toElement().tagName() != "functions" ) + continue; + QString l = n.attribute( "language", "C++" ); + if ( l != "C++" && l != "Perl" ) //- mmh + continue; + QString functionName = n.firstChild().toText().data().stripWhiteSpace(); + if ( functionName.endsWith( ";" ) ) + functionName = functionName.left( functionName.length() - 1 ); + extraFuncts += Parser::cleanArgs(functionName); + extraFunctTyp += n.attribute( "returnType", "void" ); + } + + // find signals + QStringList extraSignals; + nl = e.parentNode().toElement().elementsByTagName( "signal" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + if ( n.parentNode().toElement().tagName() != "signals" + && n.parentNode().toElement().tagName() != "connections" ) + continue; + QString l = n.attribute( "language", "C++" ); + if ( l != "C++" && l != "Perl" ) //- mmh + continue; + QString sigName = n.firstChild().toText().data().stripWhiteSpace(); + if ( sigName.endsWith( ";" ) ) + sigName = sigName.left( sigName.length() - 1 ); + extraSignals += sigName; + } + +#if 0 + //- kept for diffs + QStringList customImages; + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "customwidgets" ) { + nl = n.elementsByTagName( "pixmap" ); + for ( i = 0; i < (int) nl.length(); i++ ) + customImages += nl.item( i ).firstChild().toText().data(); + } + } +#endif + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "customwidgets" ) { + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "customwidget" ) { + QDomElement n3 = n2.firstChild().toElement(); + QString cl, header; + WidgetDatabaseRecord *r = new WidgetDatabaseRecord; + while ( !n3.isNull() ) { + if ( n3.tagName() == "class" ) { + cl = n3.firstChild().toText().data(); + r->name = cl; + } else if ( n3.tagName() == "header" ) { + CustomInclude ci; + ci.header = n3.firstChild().toText().data(); + ci.location = n3.attribute( "location", "global" ); + r->includeFile = ci.header; + header = ci.header; + customWidgetIncludes.insert( cl, ci ); + } + WidgetDatabase::append( r ); + n3 = n3.nextSibling().toElement(); + } + + if (cl.isEmpty()) + cl = "UnnamedCustomClass"; + + int ext = header.findRev('.'); + + if (ext >= 0) + header.truncate(ext); + + if (header.isEmpty()) + header = cl.lower(); + + if (!nofwd) + out << "use " << cl << ";" << endl; // FIXME: what about header ? + } + n2 = n2.nextSibling().toElement(); + } + } + } + + out << indent << "use Qt::isa qw(" << objClass << ");" << endl; + + // PerlQt sig/slot declaration + if ( !extraSlots.isEmpty() ) { + out << indent << "use Qt::slots" << endl; + ++indent; + for ( it = extraSlots.begin(); it != extraSlots.end(); ++it ) + { + perlSlot( it ); + out << ( ((*it) == extraSlots.last()) ? ";":",") << endl; + } + --indent; + } + + // create signals + if ( !extraSignals.isEmpty() ) { + out << indent << "use Qt::signals" << endl; + ++indent; + for ( it = extraSignals.begin(); it != extraSignals.end(); ++it ) + { + perlSlot( it ); + out << ( ((*it) == extraSignals.last()) ? ";":",") << endl; + } + --indent; + } + + // PerlQt attributes + out << indent << "use Qt::attributes qw("<< endl; + ++indent; + + // children + if( !objectNames.isEmpty() ) + cerr << "WARNING : objectNames should be empty at form.cpp line" << __LINE__ << endl; + nl = e.parentNode().toElement().elementsByTagName( "widget" ); + for ( i = 1; i < (int) nl.length(); i++ ) + { // start at 1, 0 is the toplevel widget + n = nl.item(i).toElement(); + createAttrDecl( n ); + } + objectNames.clear(); + + // additional attributes (from Designer) + QStringList publicVars, protectedVars, privateVars; + nl = e.parentNode().toElement().elementsByTagName( "variable" ); + for ( i = 0; i < (int)nl.length(); i++ ) { + n = nl.item( i ).toElement(); + // Because of compatibility the next lines have to be commented out. + // Someday it should be uncommented. + //if ( n.parentNode().toElement().tagName() != "variables" ) + // continue; + QString access = n.attribute( "access", "protected" ); + QString var = n.firstChild().toText().data().stripWhiteSpace(); + if ( var.endsWith( ";" ) ) + var.truncate(var.length() - 1); + if ( access == "public" ) + publicVars += var; + else if ( access == "private" ) + privateVars += var; + else + protectedVars += var; + } + + // for now, all member variables are public. + + if ( !publicVars.isEmpty() ) { + for ( it = publicVars.begin(); it != publicVars.end(); ++it ) + out << indent << *it << endl; + } + if ( !protectedVars.isEmpty() ) { + for ( it = protectedVars.begin(); it != protectedVars.end(); ++it ) + out << indent << *it << endl; + } + if ( !privateVars.isEmpty() ) { + for ( it = privateVars.begin(); it != privateVars.end(); ++it ) + out << indent << *it << endl; + } + + + // actions, toolbars, menus + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) + { + if ( n.tagName() == "actions" ) + { + for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() ) + createActionDecl( a ); + } + else if ( n.tagName() == "toolbars" ) + { + for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() ) + { + if ( a.tagName() == "toolbar" ) + out << indent << getObjectName( a ) << endl; + } + + } + else if ( n.tagName() == "menubar" ) + { + out << indent << getObjectName( n ) << endl; + for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() ) + { + if ( a.tagName() == "item" ) + out << indent << a.attribute( "name" ) << endl; + } + } + } + + // Databases Connection holders + + registerDatabases( e ); + dbConnections = unique( dbConnections ); + for ( it = dbConnections.begin(); it != dbConnections.end(); ++it ) { + if ( !(*it).isEmpty() && (*it) != "(default)") { + out << indent << (*it) << "Connection" << endl; + } + } + + --indent; + out << indent << ");" << endl; + out << endl; + + + // additional includes (local or global ) and forward declaractions + nl = e.parentNode().toElement().elementsByTagName( "include" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + QDomElement n2 = nl.item(i).toElement(); + QString s = n2.firstChild().toText().data(); + if ( n2.attribute( "location" ) != "local" ) { + if ( (s.right( 5 ) == ".ui.h" || s.right( 6 ) == ".ui.pm") && !QFile::exists( s ) ) + continue; + if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" ) + continue; + globalIncludes += s; + } + } + + // do the local includes afterwards, since global includes have priority on clashes + for ( i = 0; i < (int) nl.length(); i++ ) { + QDomElement n2 = nl.item(i).toElement(); + QString s = n2.firstChild().toText().data(); + if ( n2.attribute( "location" ) == "local" &&!globalIncludes.contains( s ) ) { + if ( (s.right( 5 ) == ".ui.h" || s.right( 6 ) == ".ui.pm") && !QFile::exists( s ) ) + continue; + if ( n2.attribute( "impldecl", "in declaration" ) == "in declaration" ) + { + useIncludes += s; + } + else if ( n2.attribute( "impldecl", "in implementation" ) == "in implementation" ) + { + localIncludes += s; + } + } + } + + // additional custom widget headers + nl = e.parentNode().toElement().elementsByTagName( "header" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + QDomElement n2 = nl.item(i).toElement(); + QString s = n2.firstChild().toText().data(); + if ( n2.attribute( "location" ) != "local" ) + globalIncludes += s; + else + localIncludes += s; + } + + // Output the "use" clauses for extra stuff in "Includes (In Declaration)" + // => in the perleditor plugin, this is content of the "Use clauses" list + for(QStringList::Iterator it = useIncludes.begin(); it != useIncludes.end(); ++it) + out << indent << (*it) << endl; + + // grab slots/funcs defined in ui.h files / ui.pm files + for(QStringList::Iterator it = localIncludes.begin(); it != localIncludes.end(); ++it) + { + if((*it).right( 5 ) == ".ui.h") + { + QFile f((*it)); + if( f.open( IO_ReadOnly ) ) + { + QRegExp re("^.*([a-zA-Z0-9_]+\\s*\\(.*\\))\\s*$"); + QRegExp re2("^\\}.*"); + QTextStream t( &f ); + QString s, s2, s3; + while ( !t.eof() ) + { + s = t.readLine(); + int pos = re.search(s); + if(pos == -1) + continue; + s2 = re.cap(1); + s2 = Parser::cleanArgs(s2); + s3 = QString::null; + while( !t.eof() ) + { + s = t.readLine(); + s3 += s + "\n"; + if(re2.search(s) != -1) + break; + } + functionImpls.insert( s2, s3 ); + if( t.eof() ) break; + } + f.close(); + } + } + else if((*it).right( 6 ) == ".ui.pm") + { + //QFileInfo fname( fileName ); //- FIXME: .ui files seem to require being in CWD? + //QString path = fname.absFilePath(); + //path = path.left( path.length() - fname.fileName().length() ); + QFile f(*it); + if( f.open( IO_ReadOnly ) ) + { + QTextStream t( &f ); + QString s; + bool skip = true; + int count = 0; + while ( !t.eof() ) + { + s = t.readLine(); + if( skip ) + { + if( s[0] == '#' ) + { + count++; + continue; + } + else + { + skip = false; + uiPmInclude += "# line " + QString::number( count+1 ) + " \"" + *it + "\"\n"; + } + } + uiPmInclude += s + "\n"; + } + f.close(); + } + } + + } + + // includes for child widgets + for ( it = tags.begin(); it != tags.end(); ++it ) { + nl = e.parentNode().toElement().elementsByTagName( *it ); + for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget + QString name = getClassName( nl.item(i).toElement() ); + if ( name == "Spacer" ) { + globalIncludes += "qlayout.h"; + globalIncludes += "qapplication.h"; + continue; + } + if ( name.mid( 4 ) == "ListView" ) + globalIncludes += "qheader.h"; + if ( name != objClass ) { + int wid = WidgetDatabase::idFromClassName( name.replace( QRegExp("^Qt::"), "Q" ) ); + QMap<QString, CustomInclude>::Iterator it = customWidgetIncludes.find( name ); + if ( it == customWidgetIncludes.end() ) + globalIncludes += WidgetDatabase::includeFile( wid ); + } + } + } + + dbConnections = unique( dbConnections ); + if ( dbConnections.count() ) + sqlClasses += "Qt::SqlDatabase"; + if ( dbCursors.count() ) + sqlClasses += "Qt::SqlCursor"; + bool dbForm = FALSE; + if ( dbForms[ "(default)" ].count() ) + dbForm = TRUE; + bool subDbForms = FALSE; + for ( it = dbConnections.begin(); it != dbConnections.end(); ++it ) { + if ( !(*it).isEmpty() && (*it) != "(default)" ) { + if ( dbForms[ (*it) ].count() ) { + subDbForms = TRUE; + break; + } + } + } + if ( dbForm || subDbForms ) { + sqlClasses += "Qt::SqlForm"; + sqlClasses += "Qt::SqlRecord"; + } + + if (globalIncludes.findIndex("qdatatable.h") >= 0) + sqlClasses += "Qt::DataTable"; + + if (globalIncludes.findIndex("qtableview.h") >= 0) + sqlClasses += "Qt::TableView"; + + if (globalIncludes.findIndex("qdatabrowser.h") >= 0) + sqlClasses += "Qt::DataBrowser"; + + out << endl; + + // find out what images are required + QStringList requiredImages; + static const char *imgTags[] = { "pixmap", "iconset", 0 }; + for ( i = 0; imgTags[i] != 0; i++ ) { + nl = e.parentNode().toElement().elementsByTagName( imgTags[i] ); + for ( int j = 0; j < (int) nl.length(); j++ ) { + QDomNode nn = nl.item(j); + while ( nn.parentNode() != e.parentNode() ) + nn = nn.parentNode(); + if ( nn.nodeName() != "customwidgets" ) + requiredImages += nl.item(j).firstChild().toText().data(); + } + } + + // register the object and unify its name + objName = registerObject( objName ); + + QStringList images; + QStringList xpmImages; + if ( pixmapLoaderFunction.isEmpty() && !externPixmaps ) + { + // create images + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) + { + if ( n.tagName() == "images" ) + { + nl = n.elementsByTagName( "image" ); + for ( i = 0; i < (int) nl.length(); i++ ) + { + QString img = registerObject( nl.item(i).toElement().attribute( "name" ) ); + if ( !requiredImages.contains( img ) ) + continue; + QDomElement tmp = nl.item(i).firstChild().toElement(); + if ( tmp.tagName() != "data" ) + continue; + QString format = tmp.attribute("format", "PNG" ); + QString data = tmp.firstChild().toText().data(); + out << indent << "our $" << img << ";" << endl; + if ( format == "XPM.GZ" ) + { + xpmImages += img; + ulong length = tmp.attribute("length").toULong(); + QByteArray baunzip = unzipXPM( data, length ); + length = baunzip.size(); + // shouldn't we test the initial `length' against the + // resulting `length' to catch corrupt UIC files? + int a = 0; + out << indent << "our $" << img << "_data =\n["; + + while ( baunzip[a] != '\"' ) + a++; + for ( ; a < (int) length; a++ ) + { + char ch; + if ((ch = baunzip[a]) == '}') + { + out << "];\n" << endl; + + break; + } + out << ch; + } + } + else + { + images += img; + out << indent << "our $" << img << "_data = pack 'C*'," << endl; + ++indent; + int a ; + for ( a = 0; a < (int) (data.length()/2)-1; a++ ) { + out << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ","; + if ( a % 12 == 11 ) + out << endl << " "; + else + out << " "; + } + out << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ";" << endl; + --indent; + out << endl; + } + } + } + } + out << endl; + } + else if ( externPixmaps ) + { + pixmapLoaderFunction = "Qt::Pixmap::fromMimeSource"; + } + + + // constructor(s) + out << indent << "sub NEW" << endl; + out << indent << "{" << endl; + ++indent; + if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) { + out << indent << "shift->SUPER::NEW(@_[0..3]);" << endl; + } else if ( objClass == "Qt::Widget") { + out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl; + } else if ( objClass == "Qt::MainWindow" ) { + out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl; + out << indent << "statusBar();" << endl; + isMainWindow = TRUE; + } else { + out << indent << "shift->SUPER::NEW(@_[0,1]);" << endl; + } + + out << endl; + + // create pixmaps for all images + if ( !images.isEmpty() ) { + QStringList::Iterator it; + for ( it = images.begin(); it != images.end(); ++it ) { + out << indent << "$" << (*it) << " = Qt::Pixmap();" << endl; + out << indent << "$" << (*it) << "->loadFromData($" << (*it) << "_data, length ($" << (*it) << "_data), \"PNG\");" << endl; + } + out << endl; + } + // create pixmaps for all images + if ( !xpmImages.isEmpty() ) { + for ( it = xpmImages.begin(); it != xpmImages.end(); ++it ) { + out << indent << "$" << (*it) << " = Qt::Pixmap($" << (*it) << "_data);" << endl; + } + out << endl; + } + + + // set the properties + QSize geometry( 0, 0 ); + + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + bool stdset = stdsetdef; + if ( n.hasAttribute( "stdset" ) ) + stdset = toBool( n.attribute( "stdset" ) ); + QString prop = n.attribute("name"); + QDomElement n2 = n.firstChild().toElement(); + QString value = setObjectProperty( objClass, QString::null, prop, n2, stdset ); + if ( value.isEmpty() ) + continue; + + if ( prop == "geometry" && n2.tagName() == "rect" ) { + QDomElement n3 = n2.firstChild().toElement(); + while ( !n3.isNull() ) { + if ( n3.tagName() == "width" ) + geometry.setWidth( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "height" ) + geometry.setHeight( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + } else { + QString call; + if ( stdset ) + call = mkStdSet( prop ) + "(" + value; + else + call = "setProperty(\"" + prop + "\", Qt::Variant(" + value + ")"; + call += " );"; + if ( n2.tagName() == "string" ) { + trout << indent << call << endl; + } else if ( prop == "name" ) { + out << indent << "if ( name() eq \"unnamed\" )" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << call << endl; + --indent; + out << indent << "}" << endl; + } else { + out << indent << call << endl; + } + } + } + } + + out << endl; + + // create all children, some forms have special requirements + + if ( objClass == "Qt::Wizard" ) + { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + { + if ( tags.contains( n.tagName() ) ) + { + QString page = createObjectImpl( n, objClass, "this" ); + QString comment; + QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + out << indent << "addPage( " << page << ", \"\" );" << endl; + trout << indent << "setTitle( " << page << ", " << trcall( label, comment ) << " );" << endl; + QVariant def( FALSE, 0 ); + if ( DomTool::hasAttribute( n, "backEnabled" ) ) + out << indent << "setBackEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << ");" << endl; + if ( DomTool::hasAttribute( n, "nextEnabled" ) ) + out << indent << "setNextEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "nextEnabled", def).toBool() ) << ");" << endl; + if ( DomTool::hasAttribute( n, "finishEnabled" ) ) + out << indent << "setFinishEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "finishEnabled", def).toBool() ) << ");" << endl; + if ( DomTool::hasAttribute( n, "helpEnabled" ) ) + out << indent << "setHelpEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "helpEnabled", def).toBool() ) << ");" << endl; + if ( DomTool::hasAttribute( n, "finish" ) ) + out << indent << "setFinish( " << page << "," << mkBool( DomTool::readAttribute( n, "finish", def).toBool() ) << ");" << endl; + } + } + } + else + { // standard widgets + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + { + if ( tags.contains( n.tagName() ) ) + createObjectImpl( n, objName, "this" ); + } + } + + // database support + dbConnections = unique( dbConnections ); + if ( dbConnections.count() ) + out << endl; + for ( it = dbConnections.begin(); it != dbConnections.end(); ++it ) { + if ( !(*it).isEmpty() && (*it) != "(default)") { + out << indent << (*it) << "Connection = Qt::SqlDatabase::database(\"" <<(*it) << "\");" << endl; + } + } + + nl = e.parentNode().toElement().elementsByTagName( "widget" ); + for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget + n = nl.item(i).toElement(); + QString s = getClassName( n ); + if ( (dbForm || subDbForms) && ( s == "Qt::DataBrowser" || s == "Qt::DataView" ) ) { + QString objName = getObjectName( n ); + QString tab = getDatabaseInfo( n, "table" ); + QString con = getDatabaseInfo( n, "connection" ); + out << indent << "my $" << objName << "Form = Qt::SqlForm(this, \"" << objName << "Form\");" << endl; + QDomElement n2; + for ( n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) + createFormImpl( n2, objName, con, tab ); + out << indent << objName << "->setForm($" << objName << "Form);" << endl; + } + } + + // actions, toolbars, menubar + bool needEndl = FALSE; + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "actions" ) { + if ( !needEndl ) + out << endl; + createActionImpl( n.firstChild().toElement(), "this" ); + needEndl = TRUE; + } + } + if ( needEndl ) + out << endl; + needEndl = FALSE; + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "toolbars" ) { + if ( !needEndl ) + out << endl; + createToolbarImpl( n, objClass, objName ); + needEndl = TRUE; + } + } + if ( needEndl ) + out << endl; + needEndl = FALSE; + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "menubar" ) { + if ( !needEndl ) + out << endl; + createMenuBarImpl( n, objClass, objName ); + needEndl = TRUE; + } + } + if ( needEndl ) + out << endl; + + out << indent << "languageChange();" << endl; + + // take minimumSizeHint() into account, for height-for-width widgets + if ( !geometry.isNull() ) { + out << indent << "my $resize = Qt::Size(" << geometry.width() << ", " + << geometry.height() << ");" << endl; + out << indent << "$resize = $resize->expandedTo(minimumSizeHint());" << endl; + out << indent << "resize( $resize );" << endl; + out << indent << "clearWState( &Qt::WState_Polished );" << endl; + } + + for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "connections" ) { + // setup signals and slots connections + out << endl; + nl = n.elementsByTagName( "connection" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + QString sender, receiver, signal, slot; + for ( QDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + if ( n2.tagName() == "sender" ) + sender = n2.firstChild().toText().data(); + else if ( n2.tagName() == "receiver" ) + receiver = n2.firstChild().toText().data(); + else if ( n2.tagName() == "signal" ) + signal = n2.firstChild().toText().data(); + else if ( n2.tagName() == "slot" ) + slot = n2.firstChild().toText().data(); + } + if ( sender.isEmpty() || + receiver.isEmpty() || + signal.isEmpty() || + slot.isEmpty() ) + continue; + else if ( sender[0] == '<' || + receiver[0] == '<' || + signal[0] == '<' || + slot[0] == '<' ) + continue; + sender = registeredName( sender ); + receiver = registeredName( receiver ); + + if ( sender == objName ) + sender = "this"; + if ( receiver == objName ) + receiver = "this"; + + out << indent << "Qt::Object::connect(" << sender + << ", SIGNAL \"" << signal << "\", "<< receiver << ", SLOT \"" << slot << "\");" << endl; + } + } else if ( n.tagName() == "tabstops" ) { + // setup tab order + out << endl; + QString lastName; + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "tabstop" ) { + QString name = n2.firstChild().toText().data(); + name = registeredName( name ); + if ( !lastName.isEmpty() ) + out << indent << "setTabOrder(" << lastName << ", " << name << ");" << endl; + lastName = name; + } + n2 = n2.nextSibling().toElement(); + } + } + } + + // buddies + bool firstBuddy = TRUE; + for ( QValueList<Buddy>::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { + if ( isObjectRegistered( (*buddy).buddy ) ) { + if ( firstBuddy ) { + out << endl; + } + out << indent << (*buddy).key << "->setBuddy(this->" << registeredName( (*buddy).buddy ) << ");" << endl; + firstBuddy = FALSE; + } + + } + if ( extraFuncts.find( "init()" ) != extraFuncts.end() || + extraSlots.find( "init()" ) != extraSlots.end() ) + out << endl << indent << "init();" << endl; + + // end of constructor + --indent; + out << indent << "}" << endl; + out << endl; + + if ( extraFuncts.find( "destroy()" ) != extraFuncts.end() || + extraSlots.find( "destroy()" ) != extraSlots.end() ) { + out << endl; + out << indent << "sub DESTROY" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "destroy();" << endl; + out << indent << "SUPER->DESTROY()" << endl; + --indent; + out << indent << "}" << endl; + } + + + // handle application events if required + bool needFontEventHandler = FALSE; + bool needSqlTableEventHandler = FALSE; + bool needSqlDataBrowserEventHandler = FALSE; + nl = e.elementsByTagName( "widget" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + if ( !DomTool::propertiesOfType( nl.item(i).toElement() , "font" ).isEmpty() ) + needFontEventHandler = TRUE; + QString s = getClassName( nl.item(i).toElement() ); + if ( s == "Qt::DataTable" || s == "Qt::DataBrowser" ) { + if ( !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) + continue; + if ( s == "Qt::DataTable" ) + needSqlTableEventHandler = TRUE; + if ( s == "Qt::DataBrowser" ) + needSqlDataBrowserEventHandler = TRUE; + } + if ( needFontEventHandler && needSqlTableEventHandler && needSqlDataBrowserEventHandler ) + break; + } + +// PerlQt - TODO: is this needed ? +// Seems not.. let's ifzero for now... + + if ( 0 && needFontEventHandler ) { + // indent = "\t"; // increase indentation for if-clause below + out << endl; + out << "# Main event handler. Reimplemented to handle" << endl; + out << "# application font changes" << endl; + out << endl; + out << "sub event" << endl; + out << "{" << endl; + out << " my $ev = shift;" << endl; + out << " my $ret = SUPER->event( $ev ); " << endl; + if ( needFontEventHandler ) { + ++indent; + out << " if ( $ev->type() == &Qt::Event::ApplicationFontChange ) {" << endl; + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + QStringList list = DomTool::propertiesOfType( n, "font" ); + for ( it = list.begin(); it != list.end(); ++it ) + createExclusiveProperty( n, *it ); + } + out << " }" << endl; + --indent; + } + out << "}" << endl; + out << endl; + } + + if ( needSqlTableEventHandler || needSqlDataBrowserEventHandler ) { + out << endl; + out << indent << "# Widget polish. Reimplemented to handle default data" << endl; + if ( needSqlTableEventHandler ) + out << indent << "# table initialization." << endl; + if ( needSqlDataBrowserEventHandler ) + out << indent << "# browser initialization." << endl; + out << indent << "sub polish" << endl; + out << indent << "{" << endl; + ++indent; + if ( needSqlTableEventHandler ) { + for ( i = 0; i < (int) nl.length(); i++ ) { + QString s = getClassName( nl.item(i).toElement() ); + if ( s == "Qt::DataTable" ) { + n = nl.item(i).toElement(); + QString c = getObjectName( n ); + QString conn = getDatabaseInfo( n, "connection" ); + QString tab = getDatabaseInfo( n, "table" ); + if ( !( conn.isEmpty() || tab.isEmpty() || !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) ) { + out << indent << "if(" << c << ")" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "my $cursor = " << c << "->sqlCursor();" << endl; + out << endl; + out << indent << "if(!$cursor)" << endl; + out << indent << "{" << endl; + ++indent; + if ( conn == "(default)" ) + out << indent << "$cursor = Qt::SqlCursor(\"" << tab << "\");" << endl; + else + out << indent << "$cursor = Qt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl; + out << indent << "if ( " << c << "->isReadOnly() ) " << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "$cursor->setMode( &Qt::SqlCursor::ReadOnly )" << endl; + --indent; + out << indent << "}" << endl; + out << indent << c << "->setSqlCursor($cursor, 0, 1);" << endl; + --indent; + out << endl; + out << indent << "}" << endl; + out << indent << "if(!$cursor->isActive())" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << c << "->refresh( &Qt::DataTable::RefreshAll );" << endl; + --indent; + out << indent << "}" << endl; + --indent; + out << indent << "}" << endl; + } + } + } + } + if ( needSqlDataBrowserEventHandler ) { + nl = e.elementsByTagName( "widget" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + QString s = getClassName( nl.item(i).toElement() ); + if ( s == "Qt::DataBrowser" ) { + QString obj = getObjectName( nl.item(i).toElement() ); + QString tab = getDatabaseInfo( nl.item(i).toElement(), + "table" ); + QString conn = getDatabaseInfo( nl.item(i).toElement(), + "connection" ); + if ( !(tab).isEmpty() || !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) { + out << indent << "if(" << obj << ")" << endl; + out << indent << "{" << endl; + ++indent; + out << indent << "if(!" << obj << "->sqlCursor())" << endl; + out << indent << "{" << endl; + ++indent; + if ( conn == "(default)" ) + out << indent << "my $cursor = Qt::SqlCursor(\"" << tab << "\");" << endl; + else + out << indent << "my $cursor = Qt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl; + out << indent << obj << "->setSqlCursor($cursor, 1);" << endl; + out << indent << obj << "->refresh();" << endl; + out << indent << obj << "->first();" << endl; + --indent; + out << indent << "}" << endl; + --indent; + out << indent << "}" << endl; + } + } + } + } + out << indent << "SUPER->polish();" << endl; + --indent; + out << indent << "}" << endl; + } + + out << endl; + out << indent << "# Sets the strings of the subwidgets using the current" << endl; + out << indent << "# language." << endl; + out << endl; + out << indent << "sub languageChange" << endl; + out << indent << "{" << endl; + ++indent; + out << languageChangeBody; + --indent; + out << indent << "}" << endl; + out << endl; + + // create stubs for additional functs/slots if necessary + + for ( it = extraSlots.begin(); it != extraSlots.end(); ++it ) + extraFuncts << *it; + + if ( !extraFuncts.isEmpty() && writeFunctImpl && uiPmInclude.isNull() ) { + for ( it = extraFuncts.begin(); it != extraFuncts.end(); ++it ) { + out << endl; + int astart = (*it).find('('); + out << indent << "sub " << (*it).left(astart)<< endl; + out << indent << "{" << endl; + bool createWarning = TRUE; + QString fname = Parser::cleanArgs( *it ); + QMap<QString, QString>::Iterator fit = functionImpls.find( fname ); + if ( fit != functionImpls.end() ) { + int begin = (*fit).find( "{" ); + QString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + createWarning = body.simplifyWhiteSpace().isEmpty(); + if ( !createWarning ) + out << body << endl; + } + if ( createWarning ) { + ++indent; + if ( *it != "init()" && *it != "destroy()" ) + out << indent << "print \"" << nameOfClass << "->" << (*it) << ": Not implemented yet.\\n\";" << endl; + --indent; + } + out << indent << "}" << endl; + + } + } + else if( !extraFuncts.isEmpty() && writeFunctImpl ) + { + ++indent; + for ( it = extraFuncts.begin(); it != extraFuncts.end(); ++it ) { + if ( *it == "init()" || *it == "destroy()" ) + continue; + int astart = (*it).find('('); + QRegExp r( "(\\nsub\\s+" + (*it).left(astart) + "(?:\\s*#\\s*SLOT:[^\\n]+|[ \t]+)?\\n\\{)(\\s*)(\\}\\n)" ); + r.setMinimal( true ); + uiPmInclude.replace( r, "\\1\n" + + indent + "print \"" + nameOfClass + "->" + (*it) + + ": Not implemented yet.\\n\";" + "\n\\3" ); + } + --indent; + + } + + if( !uiPmInclude.isNull() ) + out << uiPmInclude; + + out << endl; + out << "1;" << endl; // Perl modules must return true +} + + +/*! Creates form support implementation code for the widgets given + in \a e. + + Traverses recursively over all children. + */ + +void Uic::createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table ) +{ + if ( e.tagName() == "widget" && + e.attribute( "class" ) != "Qt::DataTable" ) { + QString field = getDatabaseInfo( e, "field" ); + if ( !field.isEmpty() ) { + if ( isWidgetInTable( e, connection, table ) ) + out << indent << "$" << form << "Form->insert(" << getObjectName( e ) << ", " << fixString( field ) << ");" << endl; + } + } + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + createFormImpl( n, form, connection, table ); + } +} + + +// Generate a PerlQt signal/slot definition. + +void Uic::perlSlot(QStringList::Iterator &it) +{ + int astart = (*it).find('('); + out << indent << (*it).left(astart) << " => "; + QString args = (*it).mid(astart + 1,(*it).find(')') - astart - 1).stripWhiteSpace(); + out << "["; + if (!args.isEmpty()) + { + QStringList arglist = QStringList::split( QRegExp(","), args ); + out << "'" << arglist.join( "', '") << "'"; + } + out << "]"; +} diff --git a/puic/globaldefs.h b/puic/globaldefs.h new file mode 100644 index 0000000..cc6ed40 --- /dev/null +++ b/puic/globaldefs.h @@ -0,0 +1,45 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef GLOBALDEFS_H +#define GLOBALDEFS_H + +#include <qcolor.h> + +#define BOXLAYOUT_DEFAULT_MARGIN 11 +#define BOXLAYOUT_DEFAULT_SPACING 6 + +#ifndef NO_STATIC_COLORS +static QColor *backColor1 = 0; +static QColor *backColor2 = 0; +static QColor *selectedBack = 0; + +static void init_colors() +{ + if ( backColor1 ) + return; + backColor1 = new QColor( 236, 245, 255 ); + backColor2 = new QColor( 250, 250, 250 ); + selectedBack = new QColor( 221, 221, 221 ); +} + +#endif + +#endif diff --git a/puic/main.cpp b/puic/main.cpp new file mode 100644 index 0000000..869702c --- /dev/null +++ b/puic/main.cpp @@ -0,0 +1,325 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk> +** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com> +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +/* +** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler, +** a work derivated from uic (the Qt User Interface Compiler) +** and pyuic (the PyQt User Interface Compiler). +** +** G.Garand +** +**********************************************************************/ +#include "uic.h" +#include "parser.h" +#include "widgetdatabase.h" +#include "domtool.h" +#include <qapplication.h> +#include <qfile.h> +#include <qstringlist.h> +#include <qdatetime.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#include <stdio.h> +#include <stdlib.h> +#define PUIC_VERSION "0.70" + +void getDBConnections( Uic& uic, QString& s); + +int main( int argc, char * argv[] ) +{ + PyIndent indent; + bool execCode = FALSE; + bool subcl = FALSE; + bool imagecollection = FALSE; + bool imagecollection_tmpfile = FALSE; + QStringList images; + const char *error = 0; + const char* fileName = 0; + const char* className = 0; + QCString outputFile; + QCString image_tmpfile; + const char* projectName = 0; + const char* trmacro = 0; + bool nofwd = FALSE; + bool fix = FALSE; + QApplication app(argc, argv, FALSE); + QString uicClass; + + + for ( int n = 1; n < argc && error == 0; n++ ) { + QCString arg = argv[n]; + if ( arg[0] == '-' ) { // option + QCString opt = &arg[1]; + if ( opt[0] == 'o' ) { // output redirection + if ( opt[1] == '\0' ) { + if ( !(n < argc-2) ) { + error = "Missing output-file name"; + break; + } + outputFile = argv[++n]; + } else + outputFile = &opt[1]; + } else if ( opt[0] == 'e' || opt == "embed" ) { + imagecollection = TRUE; + if ( opt == "embed" || opt[1] == '\0' ) { + if ( !(n < argc-2) ) { + error = "Missing arguments."; + break; + } + projectName = argv[++n]; + } else { + projectName = &opt[1]; + } + if ( argc > n+1 && qstrcmp( argv[n+1], "-f" ) == 0 ) { + imagecollection_tmpfile = TRUE; + image_tmpfile = argv[n+2]; + n += 2; + } + } else if ( opt == "nofwd" ) { + nofwd = TRUE; + } else if ( opt == "subimpl" ) { + subcl = TRUE; + if ( !(n < argc-2) ) { + error = "Missing arguments."; + break; + } + className = argv[++n]; + } else if ( opt == "tr" ) { + if ( opt == "tr" || opt[1] == '\0' ) { + if ( !(n < argc-1) ) { + error = "Missing tr function."; + break; + } + trmacro = argv[++n]; + } else { + trmacro = &opt[1]; + } + } else if ( opt == "version" ) { + fprintf( stderr, + "PerlQt User Interface Compiler v%s for Qt version %s\n", PUIC_VERSION, + QT_VERSION_STR ); + exit( 1 ); + } else if ( opt == "help" ) { + break; + } else if ( opt == "fix" ) { + fix = TRUE; + } else if ( opt[0] == 'p' ) { + uint tabstop; + bool ok; + + if ( opt[1] == '\0' ) { + if ( !(n < argc-1) ) { + error = "Missing indent"; + break; + } + tabstop = QCString(argv[++n]).toUInt(&ok); + } else + tabstop = opt.mid(1).toUInt(&ok); + + if (ok) + indent.setTabStop(tabstop); + else + error = "Invalid indent"; + } else if ( opt == "x" ) { + execCode = TRUE; + } else { + error = QString( "Unrecognized option " + opt ).latin1(); + } + } else { + if ( imagecollection && !imagecollection_tmpfile ) + images << argv[n]; + else if ( fileName ) // can handle only one file + error = "Too many input files specified"; + else + fileName = argv[n]; + } + } + + if ( argc < 2 || error || (!fileName && !imagecollection ) ) { + fprintf( stderr, "PerlQt user interface compiler.\n" ); + if ( error ) + fprintf( stderr, "puic: %s\n", error ); + + fprintf( stderr, "Usage: %s [options] [mode] <uifile>\n" + "\nGenerate implementation:\n" + " %s [options] <uifile>\n" + "Generate image collection:\n" + " %s [options] -embed <project> <image1> <image2> <image3> ...\n" + "\t<project>\tproject name\n" + "\t<image[0..n]>\timage files\n" + "or\n" + " %s [options] -embed <project> -f <file>\n" + "\t<project>\tproject name\n" + "\t<file>\t\ttemporary file containing image names\n" + "Generate subclass implementation:\n" + " %s [options] -subimpl <classname> <uifile>\n" + "\t<classname>\tname of the subclass to generate\n" + "Options:\n" + "\t-o file\t\tWrite output to file rather than stdout\n" + "\t-p indent\tSet the indent in spaces (0 to use a tab)\n" + "\t-nofwd\t\tOmit imports of custom widgets\n" + "\t-tr func\tUse func(...) rather than trUtf8(...) for i18n\n" + "\t-x\t\tGenerate extra code to test the class\n" + "\t-version\tDisplay version of puic\n" + "\t-help\t\tDisplay this information\n" + , argv[0], argv[0], argv[0], argv[0], argv[0] ); + return 1; + } + + if ( imagecollection_tmpfile ) { + QFile ifile( image_tmpfile ); + if ( ifile.open( IO_ReadOnly ) ) { + QTextStream ts( &ifile ); + QString s = ts.read(); + s = s.simplifyWhiteSpace(); + images = QStringList::split( ' ', s ); + for ( QStringList::Iterator it = images.begin(); it != images.end(); ++it ) + *it = (*it).simplifyWhiteSpace(); + } + } + + Uic::setIndent(indent); + + QFile fileOut; + if ( !outputFile.isEmpty() ) { + fileOut.setName( outputFile ); + if (!fileOut.open( IO_WriteOnly ) ) { + qWarning( "puic: Could not open output file '%s'", outputFile.data() ); + return 1; + } + } else { + fileOut.open( IO_WriteOnly, stdout ); + } + QTextStream out( &fileOut ); + + if ( imagecollection ) { + out.setEncoding( QTextStream::Latin1 ); + Uic::embed( out, projectName, images ); + return 0; + } + + + out.setEncoding( QTextStream::UnicodeUTF8 ); + + QFile file( fileName ); + if ( !file.open( IO_ReadOnly ) ) { + qWarning( "puic: Could not open file '%s' ", fileName ); + return 1; + } + + QDomDocument doc; + QString errMsg; + int errLine; + if ( !doc.setContent( &file, &errMsg, &errLine ) ) { + qWarning( QString("puic: Failed to parse %s: ") + errMsg + QString (" in line %d\n"), fileName, errLine ); + return 1; + } + + QDomElement e = doc.firstChild().toElement(); + if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.2 ) { + qWarning( QString("puic: File generated with too recent version of Qt Designer (%s). Recent extensions won't be handled."), + e.attribute("version").latin1() ); + return 1; + } + + DomTool::fixDocument( doc ); + + if ( fix ) { + out << doc.toString(); + return 0; + } + + if ( !subcl ) { + out << "# Form implementation generated from reading ui file '" << fileName << "'" << endl; + out << "#" << endl; + out << "# Created: " << QDateTime::currentDateTime().toString() << endl; + out << "# by: The PerlQt User Interface Compiler (puic)" << endl; + out << "#" << endl; + out << "# WARNING! All changes made in this file will be lost!" << endl; + out << endl; + out << endl; + } + out << "use strict;" << endl; + out << "use utf8;" << endl; + out << endl; + out << endl; + + Uic uic( fileName, outputFile, out, doc, subcl, trmacro ? trmacro : "trUtf8", className, nofwd, uicClass ); + + if (execCode) { + out << endl; + out << endl; + out << indent << "package main;" << endl; + out << endl; + out << "use Qt;" << endl; + out << "use " << (subcl ? QString::fromLatin1(className) : uicClass) << ";" << endl; + out << endl; + out << indent << "my $a = Qt::Application(\\@ARGV);" << endl; + QString s; + getDBConnections( uic, s); + out << s; + out << indent << "my $w = " << (subcl? QString::fromLatin1(className) : uicClass) << ";" << endl; + out << indent << "$a->setMainWidget($w);" << endl; + out << indent << "$w->show;" << endl; + out << indent << "exit $a->exec;" << endl; + } + if ( fileOut.status() != IO_Ok ) { + qWarning( "uic: Error writing to file" ); + if ( !outputFile.isEmpty() ) + remove( outputFile ); + } + return 0; +} + +void getDBConnections( Uic& uic, QString& s) +{ + int num = 0; + for ( QStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) { + if ( !(*it).isEmpty()) { + QString inc = (num ? QString::number(num+1) : QString::null); + s += "\n# Connection to database " + (*it) + "\n\n"; + s += "my $DRIVER" + inc + " =\t\t'QMYSQL3';" + (inc?"":" # appropriate driver") + "\n"; + s += "my $DATABASE" + inc + " =\t\t'foo';" + (inc?"":" # name of your database") + "\n"; + s += "my $USER" + inc + "=\t\t'john';" + (inc?"":" # username") + "\n"; + s += "my $PASSWORD" + inc + "=\t\t'ZxjGG34s';" + (inc?"":" # password for USER") + "\n"; + s += "my $HOST" + inc + "=\t\t'localhost';" + (inc?"":" # host on which the database is running") + "\n"; + s += "\n"; + s += "my $db" + inc + " = Qt::SqlDatabase::addDatabase( $DRIVER" + inc; + if (inc) + s+= ", '" + (*it) + "'"; + s += " );\n"; + s += " $db" + inc + "->setDatabaseName( $DATABASE" + inc + " );\n"; + s += " $db" + inc + "->setUserName( $USER" + inc + " );\n"; + s += " $db" + inc + "->setPassword( $PASSWORD" + inc + " );\n"; + s += " $db" + inc + "->setHostName( $HOST" + inc + " );\n"; + s += "\n"; + s += "if( !$db" + inc + "->open() )\n"; + s += "{\n"; + s += " Qt::MessageBox::information( undef, 'Unable to open database',\n"; + s += " $db" + inc + "->lastError()->databaseText() . \"\\n\");\n"; + s += " exit 1;\n"; + s += "}\n"; + s += "\n"; + num++; + } + } +} + diff --git a/puic/object.cpp b/puic/object.cpp new file mode 100644 index 0000000..a7eb0c4 --- /dev/null +++ b/puic/object.cpp @@ -0,0 +1,768 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "uic.h" +#include "parser.h" +#include "widgetinterface.h" +#include "widgetdatabase.h" +#include "domtool.h" +#include <qregexp.h> +#include <qsizepolicy.h> +#include <qstringlist.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> + +/*! + Creates a declaration for the object given in \a e. + + Children are not traversed recursively. + + \sa createObjectImpl() + */ +void Uic::createObjectDecl( const QDomElement& e ) +{ + if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { + out << indent << registerObject(getLayoutName(e) ) << endl; + } else { + QString objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return; + QString objName = getObjectName( e ); + if ( objName.isEmpty() ) + return; + // ignore QLayoutWidgets + if ( objClass == "Qt::LayoutWidget" ) + return; + + // register the object and unify its name + objName = registerObject( objName ); + out << indent << objName << endl; + } +} + +/*! + Creates a PerlQt attribute declaration for the object given in \a e. + + Children are not traversed recursively. + + */ +void Uic::createAttrDecl( const QDomElement& e ) +{ + if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { + out << indent << registerObject(getLayoutName(e) ) << endl; + } else { + QString objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return; + QString objName = getObjectName( e ); + if ( objName.isEmpty() ) + return; + // ignore QLayoutWidgets + if ( objClass == "Qt::LayoutWidget" ) + return; + // register the object and unify its name + objName = registerObject( objName ); + out << indent << objName << endl; + QDomElement n = getObjectProperty( e, "font"); + if ( !n.isNull() ) + out << indent << objName + "_font" << endl; + } +} + + +/*! + Creates an implementation for the object given in \a e. + + Traverses recursively over all children. + + Returns the name of the generated child object. + + \sa createObjectDecl() + */ + +static bool createdCentralWidget = FALSE; + +QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& par, const QString& layout ) +{ + QString parent( par ); + if ( parent == "this" && isMainWindow ) { + if ( !createdCentralWidget ) + out << indent << "setCentralWidget(Qt::Widget(this, \"qt_central_widget\"));" << endl; + createdCentralWidget = TRUE; + parent = "centralWidget()"; + } + QDomElement n; + QString objClass, objName; + int numItems = 0; + int numColumns = 0; + int numRows = 0; + + if ( layouts.contains( e.tagName() ) ) + return createLayoutImpl( e, parentClass, parent, layout ); + + objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return objName; + objName = getObjectName( e ); + + QString definedName = objName; + bool isTmpObject = objName.isEmpty() || objClass == "Qt::LayoutWidget"; + if ( isTmpObject ) { + if ( objClass[0] == 'Q' ) + objName = "$" + objClass.mid( 4 ); + else + objName = "$" + objClass.lower(); + } + + bool isLine = objClass == "Line"; + if ( isLine ) + objClass = "Qt::Frame"; + + out << endl; + if ( objClass == "Qt::LayoutWidget" ) { + if ( layout.isEmpty() ) { + // register the object and unify its name + objName = registerObject( objName ); + out << indent << (isTmpObject ? QString::fromLatin1("my ") : QString::null) << objName << " = Qt::Widget(" << parent << ", '" << objName << "');" << endl; + } else { + // the layout widget is not necessary, hide it by creating its child in the parent + QString result; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if (tags.contains( n.tagName() ) ) + result = createObjectImpl( n, parentClass, parent, layout ); + } + return result; + } + + } else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) { + // register the object and unify its name + objName = registerObject( objName ); + + // Temporary objects don't go into the class instance dictionary. + + out << indent << (isTmpObject ? QString("my ") : QString::null) << objName << " = " << createObjectInstance( objClass, parent, objName ) << ";" << endl; + } + + if ( objClass == "Qt::AxWidget" ) { + QString controlId; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) { + controlId = n.firstChild().toElement().text(); + } + } + out << indent << objName << "->setControl(\"" << controlId << "\");" << endl; + } + + lastItem = "undef"; + // set the properties and insert items + bool hadFrameShadow = FALSE; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + bool stdset = stdsetdef; + if ( n.hasAttribute( "stdset" ) ) + stdset = toBool( n.attribute( "stdset" ) ); + QString prop = n.attribute( "name" ); + if ( prop == "database" ) + continue; + QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + if ( value.isEmpty() ) + continue; + if ( prop == "name" ) + continue; + if ( isLine && prop == "frameShadow" ) + hadFrameShadow = TRUE; + if ( prop == "buddy" && value.startsWith("\"") && value.endsWith("\"") ) { + buddies << Buddy( objName, value.mid(1, value.length() - 2 ) ); + continue; + } + if ( isLine && prop == "orientation" ) { + prop = "frameShape"; + if ( value.right(10) == "Horizontal" ) + value = "&Qt::Frame::HLine"; + else + value = "&Qt::Frame::VLine"; + if ( !hadFrameShadow ) { + prop = "frameStyle"; + value += " | &Qt::Frame::Sunken"; + } + } + if ( prop == "buttonGroupId" ) { + if ( parentClass == "Qt::ButtonGroup" ) + out << indent << parent << "->insert( " << objName << "," << value << ");" << endl; + continue; + } + if ( prop == "frameworkCode" ) + continue; + if ( objClass == "Qt::MultiLineEdit" && + QRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) + continue; + + QString call = objName + "->"; + bool needClose = false; + if ( stdset ) { + call += mkStdSet( prop ) + "( "; + } else { + call += "setProperty( \"" + prop + "\", Qt::Variant(" ; + needClose = true; + } + if ( prop == "accel" ) + call += "Qt::KeySequence( " + value + " )"+ (needClose ? " )": "") + " );"; + else + call += value + (needClose ? " )": "") + " );"; + + if ( n.firstChild().toElement().tagName() == "string" || + prop == "currentItem" ) { + trout << indent << call << endl; + } else { + out << indent << call << endl; + } + } else if ( n.tagName() == "item" ) { + QString call; + QString value; + + if ( objClass.mid( 4 ) == "ListBox" ) { + call = createListBoxItemImpl( n, objName ); + if ( !call.isEmpty() ) { + if ( numItems == 0 ) + trout << indent << objName << "->clear();" << endl; + trout << indent << call << endl; + } + } else if ( objClass.mid( 4 ) == "ComboBox" ) { + call = createListBoxItemImpl( n, objName, &value ); + if ( !call.isEmpty() ) { + if ( numItems == 0 ) + trout << indent << objName << "->clear();" << endl; + trout << indent << call << endl; + } + } else if ( objClass.mid( 4 ) == "IconView" ) { + call = createIconViewItemImpl( n, objName ); + if ( !call.isEmpty() ) { + if ( numItems == 0 ) + trout << indent << objName << "->clear();" << endl; + trout << indent << call << endl; + } + } else if ( objClass.mid( 4 ) == "ListView" ) { + call = createListViewItemImpl( n, objName, QString::null ); + if ( !call.isEmpty() ) { + if ( numItems == 0 ) + trout << indent << objName << "->clear();" << endl; + trout << call << endl; + } + } + if ( !call.isEmpty() ) + numItems++; + } else if ( n.tagName() == "column" || n.tagName() == "row" ) { + QString call; + QString value; + + if ( objClass.mid( 4 ) == "ListView" ) { + call = createListViewColumnImpl( n, objName, &value ); + if ( !call.isEmpty() ) { + out << call; + trout << indent << objName << "->header()->setLabel( " + << numColumns++ << ", " << value << " );\n"; + } + } else if ( objClass == "Qt::Table" || objClass == "Qt::DataTable" ) { + bool isCols = ( n.tagName() == "column" ); + call = createTableRowColumnImpl( n, objName, &value ); + if ( !call.isEmpty() ) { + out << call; + trout << indent << objName << "->" + << ( isCols ? "horizontalHeader" : "verticalHeader" ) + << "()->setLabel( " + << ( isCols ? numColumns++ : numRows++ ) + << ", " << value << " );\n"; + } + } + } + } + + // create all children, some widgets have special requirements + + if ( objClass == "Qt::TabWidget" ) { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( tags.contains( n.tagName() ) ) { + QString page = createObjectImpl( n, objClass, objName ); + QString comment; + QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + out << indent << objName << "->insertTab( " << page << ", \"\" );" << endl; + trout << indent << objName << "->changeTab( " << page << ", " + << trcall( label, comment ) << " );" << endl; + } + } + } else if ( objClass == "Qt::WidgetStack" ) { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( tags.contains( n.tagName() ) ) { + QString page = createObjectImpl( n, objClass, objName ); + int id = DomTool::readAttribute( n, "id", "" ).toInt(); + out << indent << objName << "->addWidget( " << page << ", " << id << " );" << endl; + } + } + } else if ( objClass == "Qt::ToolBox" ) { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( tags.contains( n.tagName() ) ) { + QString page = createObjectImpl( n, objClass, objName ); + QString label = DomTool::readAttribute( n, "label", "" ).toString(); + out << indent << objName << "->addItem( " << page << ", \"" << label << "\" );" << endl; + } + } + } else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) { // standard widgets + WidgetInterface *iface = 0; + QString QtObjClass = objClass; + QtObjClass.replace( QRegExp("^Qt::"), "Q" ); + QtObjClass.replace( QRegExp("^KDE::"), "K" ); + widgetManager()->queryInterface( QtObjClass, &iface ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + int id = WidgetDatabase::idFromClassName( QtObjClass ); + if ( WidgetDatabase::isContainer( id ) && WidgetDatabase::isCustomPluginWidget( id ) && iface ) { + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( iface2 ) { + bool supportsPages = iface2->supportsPages( QtObjClass ); + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( tags.contains( n.tagName() ) ) { + if ( supportsPages ) { + QString page = createObjectImpl( n, objClass, objName ); + QString comment; + QString label = DomTool::readAttribute( n, "label", "", comment ).toString(); + out << indent << iface2->createCode( objClass, objName, page, label ) << endl; + } else { + createObjectImpl( n, objClass, objName ); + } + } + } + iface2->release(); + } + iface->release(); + } else { +#endif + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( tags.contains( n.tagName() ) ) + createObjectImpl( n, objClass, objName ); + } +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + } +#endif + } + + return objName; +} + + + +/*! + Creates a set-call for property \a exclusiveProp of the object + given in \a e. + + If the object does not have this property, the function does nothing. + + Exclusive properties are used to generate the implementation of + application font or palette change handlers in createFormImpl(). + + */ +void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ) +{ + QDomElement n; + QString objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return; + QString objName = getObjectName( e ); +#if 0 // it's not clear whether this check should be here or not + if ( objName.isEmpty() ) + return; +#endif + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + bool stdset = stdsetdef; + if ( n.hasAttribute( "stdset" ) ) + stdset = toBool( n.attribute( "stdset" ) ); + QString prop = n.attribute( "name" ); + if ( prop != exclusiveProp ) + continue; + QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + if ( value.isEmpty() ) + continue; + // we assume the property isn't of type 'string' + ++indent; + out << indent << objName << "->setProperty(\"" << prop << "\", Qt::Variant(" << value << "));" << endl; + --indent; + } + } +} + + +/*! Attention: this function has to be in sync with + Resource::saveProperty() and DomTool::elementToVariant. If you + change one, change all. + */ +QString Uic::setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ) +{ + QString v; + if ( e.tagName() == "rect" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0, w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Rect(%1, %2, %3, %4)"; + v = v.arg(x).arg(y).arg(w).arg(h); + + } else if ( e.tagName() == "point" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Point(%1, %2)"; + v = v.arg(x).arg(y); + } else if ( e.tagName() == "size" ) { + QDomElement n3 = e.firstChild().toElement(); + int w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Size(%1, %2)"; + v = v.arg(w).arg(h); + } else if ( e.tagName() == "color" ) { + QDomElement n3 = e.firstChild().toElement(); + int r = 0, g = 0, b = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "red" ) + r = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "green" ) + g = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "blue" ) + b = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Color(%1, %2, %3)"; + v = v.arg(r).arg(g).arg(b); + } else if ( e.tagName() == "font" ) { + QDomElement n3 = e.firstChild().toElement(); + QString attrname = e.parentNode().toElement().attribute( "name", "font" ); + QString fontname; + if ( !obj.isEmpty() ) { + fontname = registerObject( "$" + obj + "_" + attrname ); + out << indent << "my " << fontname << " = Qt::Font(" << obj << "->font);" << endl; + } else { + fontname = "$" + registerObject( "font" ); + out << indent << "my " << fontname << " = Qt::Font(this->font);" << endl; + } + while ( !n3.isNull() ) { + if ( n3.tagName() == "family" ) + out << indent << fontname << "->setFamily(\"" << n3.firstChild().toText().data() << "\");" << endl; + else if ( n3.tagName() == "pointsize" ) + out << indent << fontname << "->setPointSize(" << n3.firstChild().toText().data() << ");" << endl; + else if ( n3.tagName() == "bold" ) + out << indent << fontname << "->setBold(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl; + else if ( n3.tagName() == "italic" ) + out << indent << fontname << "->setItalic(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl; + else if ( n3.tagName() == "underline" ) + out << indent << fontname << "->setUnderline(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl; + else if ( n3.tagName() == "strikeout" ) + out << indent << fontname << "->setStrikeOut(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl; + n3 = n3.nextSibling().toElement(); + } + + if ( prop == "font" ) { + if ( !obj.isEmpty() ) + out << indent << obj << "->setFont(" << fontname << ");" << endl; + else + out << indent << "setFont(" << fontname << ");" << endl; + } else { + v = fontname; + } + } else if ( e.tagName() == "string" ) { + QString txt = e.firstChild().toText().data(); + QString com = getComment( e.parentNode() ); + + if ( prop == "toolTip" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { + if ( !obj.isEmpty() ) + trout << indent << "Qt::ToolTip::add(" << obj << ", " + << trcall( txt, com ) << ");" << endl; + else + out << indent << "Qt::ToolTip::add( this, " + << trcall( txt, com ) << ");" << endl; + } else if ( prop == "whatsThis" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { + if ( !obj.isEmpty() ) + trout << indent << "Qt::WhatsThis::add(" << obj << ", " + << trcall( txt, com ) << ");" << endl; + else + trout << indent << "Qt::WhatsThis::add( this," + << trcall( txt, com ) << ");" << endl; + } else { + v = trcall( txt, com ); + } + } else if ( e.tagName() == "cstring" ) { + v = "\"%1\""; + v = v.arg( e.firstChild().toText().data() ); + } else if ( e.tagName() == "number" ) { + v = "int(%1)"; + v = v.arg( e.firstChild().toText().data() ); + } else if ( e.tagName() == "bool" ) { + if ( stdset ) + v = "%1"; + else + v = "Qt::Variant(%1, 0)"; + v = v.arg( mkBool( e.firstChild().toText().data() ) ); + } else if ( e.tagName() == "pixmap" ) { + v = e.firstChild().toText().data(); + if( !externPixmaps ) + v.prepend( '$' ); + if ( !pixmapLoaderFunction.isEmpty() ) { + v.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + v.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + } else if ( e.tagName() == "iconset" ) { + v = "Qt::IconSet(%1)"; + QString s = e.firstChild().toText().data(); + if( !externPixmaps ) + s.prepend( '$' ); + if ( !pixmapLoaderFunction.isEmpty() ) { + s.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + s.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + v = v.arg( s ); + } else if ( e.tagName() == "image" ) { + v = e.firstChild().toText().data() + "->convertToImage()"; + } else if ( e.tagName() == "enum" ) { + if ( stdset ) + v = "&%1::%2()"; + else + v = "\"%1\""; + QString oc = objClass; + QString ev = e.firstChild().toText().data(); + if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual in 4.0 + oc = "Qt::ScrollView"; + if ( stdset ) + v = v.arg( oc ).arg( ev ); + else + v = v.arg( ev ); + } else if ( e.tagName() == "set" ) { + QString keys( e.firstChild().toText().data() ); + QStringList lst = QStringList::split( '|', keys ); + v = "int(&"; + QStringList::Iterator it = lst.begin(); + while ( it != lst.end() ) { + v += objClass + "::" + *it; + if ( it != lst.fromLast() ) + v += " | &"; + ++it; + } + v += ")"; + } else if ( e.tagName() == "sizepolicy" ) { + QDomElement n3 = e.firstChild().toElement(); + QSizePolicy sp; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hsizetype" ) + sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "vsizetype" ) + sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "horstretch" ) + sp.setHorStretch( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "verstretch" ) + sp.setVerStretch( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + QString tmp = (obj.isEmpty() ? QString::fromLatin1("this") : obj) + "->"; + v = "Qt::SizePolicy(%1, %2, %3, %4, " + tmp + "sizePolicy()->hasHeightForWidth())"; + v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() ); + } else if ( e.tagName() == "palette" ) { + QPalette pal; + bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; + QDomElement n; + if ( no_pixmaps ) { + n = e.firstChild().toElement(); + while ( !n.isNull() ) { + QColorGroup cg; + if ( n.tagName() == "active" ) { + cg = loadColorGroup( n ); + pal.setActive( cg ); + } else if ( n.tagName() == "inactive" ) { + cg = loadColorGroup( n ); + pal.setInactive( cg ); + } else if ( n.tagName() == "disabled" ) { + cg = loadColorGroup( n ); + pal.setDisabled( cg ); + } + n = n.nextSibling().toElement(); + } + } + if ( no_pixmaps && pal == QPalette( pal.active().button(), pal.active().background() ) ) { + v = "Qt::Palette(Qt::Color(%1,%2,%3), Qt::Color(%1,%2,%3))"; + v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); + v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); + } else { + QString palette = "pal"; + if ( !pal_used ) { + out << indent << palette << " = Qt::Palette();" << endl; + pal_used = TRUE; + } + QString cg = "cg"; + if ( !cg_used ) { + out << indent << cg << " = Qt::ColorGroup();" << endl; + cg_used = TRUE; + } + n = e.firstChild().toElement(); + while ( !n.isNull() && n.tagName() != "active" ) + n = n.nextSibling().toElement(); + createColorGroupImpl( cg, n ); + out << indent << palette << "->setActive(" << cg << ");" << endl; + + n = e.firstChild().toElement(); + while ( !n.isNull() && n.tagName() != "inactive" ) + n = n.nextSibling().toElement(); + createColorGroupImpl( cg, n ); + out << indent << palette << "->setInactive(" << cg << ");" << endl; + + n = e.firstChild().toElement(); + while ( !n.isNull() && n.tagName() != "disabled" ) + n = n.nextSibling().toElement(); + createColorGroupImpl( cg, n ); + out << indent << palette << "->setDisabled(" << cg << ");" << endl; + v = palette; + } + } else if ( e.tagName() == "cursor" ) { + v = "Qt::Cursor(%1)"; + v = v.arg( e.firstChild().toText().data() ); + } else if ( e.tagName() == "date" ) { + QDomElement n3 = e.firstChild().toElement(); + int y, m, d; + y = m = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Date(%1,%2,%3)"; + v = v.arg(y).arg(m).arg(d); + } else if ( e.tagName() == "time" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, m, s; + h = m = s = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::Time(%1, %2, %3)"; + v = v.arg(h).arg(m).arg(s); + } else if ( e.tagName() == "datetime" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, mi, s, y, mo, d; + h = mi = s = y = mo = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + mi = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + mo = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = "Qt::DateTime(Qt::Date(%1, %2, %3), Qt::Time(%4, %5, %6))"; + v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s); + } else if ( e.tagName() == "stringlist" ) { + QStringList l; + QDomElement n3 = e.firstChild().toElement(); + QString listname; + if ( !obj.isEmpty() ) { + listname = obj + "->{_strlist"; + listname = registerObject( listname ); + listname += "}"; + out << indent << listname << " = ["; + } else { + listname = registerObject( "$" + listname ); + out << indent << "my " << listname << " = ["; + } + int i = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "string" ) + { + out << "'" << n3.firstChild().toText().data().simplifyWhiteSpace() << "'"; + n3 = n3.nextSibling().toElement(); + if( n3.isNull() ) + break; + i++; + if( (i%3) == 0 ) + { + ++indent; + out << "," << endl << indent; + --indent; + } + else + out << ", "; + } + else + n3 = n3.nextSibling().toElement(); + } + out << "];" << endl; + v = listname; + } + return v; +} + + + + +/*! Extracts a named object property from \a e. + */ +QDomElement Uic::getObjectProperty( const QDomElement& e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); + !n.isNull(); + n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" && n.toElement().attribute("name") == name ) + return n; + } + return n; +} + diff --git a/puic/parser.cpp b/puic/parser.cpp new file mode 100644 index 0000000..4fc13c5 --- /dev/null +++ b/puic/parser.cpp @@ -0,0 +1,66 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "parser.h" +#include <qobject.h> +#include <qstringlist.h> + +class NormalizeObject : public QObject +{ +public: + NormalizeObject() : QObject() {} + static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); } +}; + +QString Parser::cleanArgs( const QString &func ) +{ + QString slot( func ); + int begin = slot.find( "(" ) + 1; + QString args = slot.mid( begin ); + args = args.left( args.find( ")" ) ); + QStringList lst = QStringList::split( ',', args ); + QString res = slot.left( begin ); + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + if ( it != lst.begin() ) + res += ","; + QString arg = *it; + int pos = 0; + if ( ( pos = arg.find( "&" ) ) != -1 ) { + arg = arg.left( pos + 1 ); + } else if ( ( pos = arg.find( "*" ) ) != -1 ) { + arg = arg.left( pos + 1 ); + } else { + arg = arg.simplifyWhiteSpace(); + if ( ( pos = arg.find( ':' ) ) != -1 ) + arg = arg.left( pos ).simplifyWhiteSpace() + ":" + arg.mid( pos + 1 ).simplifyWhiteSpace(); + QStringList l = QStringList::split( ' ', arg ); + if ( l.count() == 2 ) { + if ( l[ 0 ] != "const" && l[ 0 ] != "unsigned" && l[ 0 ] != "var" ) + arg = l[ 0 ]; + } else if ( l.count() == 3 ) { + arg = l[ 0 ] + " " + l[ 1 ]; + } + } + res += arg; + } + res += ")"; + + return QString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); +} diff --git a/puic/parser.h b/puic/parser.h new file mode 100644 index 0000000..5a5671a --- /dev/null +++ b/puic/parser.h @@ -0,0 +1,33 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PARSER_H +#define PARSER_H + +#include <qstring.h> + +class Parser +{ +public: + static QString cleanArgs( const QString &func ); + +}; + +#endif diff --git a/puic/puic.1 b/puic/puic.1 new file mode 100644 index 0000000..a125a8d --- /dev/null +++ b/puic/puic.1 @@ -0,0 +1,78 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.TH "PUIC" "1" "August 21, 2003" "Lutz Badenheuer <lutz.badenheuer@t-online.de>" "" +.SH "NAME" +puic \- perl user interface compiler +.SH "SYNOPSIS" +.B puic [options] [mode] <uifile> + +.SH "DESCRIPTION" +This manual page documents briefly the +.B puic +command. +.PP +\fBpuic\fP is a program you can use to compile .ui and .ui.h +files (from Qt Designer) into perl (actually, PerlQt) code. This +enables you to draw your application using Qt Designer, compile +and then run it. + +PerlQt is an API for Perl to the Qt toolkit from Trolltech. With +PerlQt, you can use Qt widgets in perl code, thus giving a GUI to +your perl programs. +.SH "OPTIONS" +\fBGenerate implementation:\fR + puic [options] <uifile> + +\fBGenerate image collection:\fR + puic [options] \-embed <project> <image1> <image2> <image3> ... + <project> project name + <image[0..n]> image files + + +\fBGenerate subclass implementation:\fR + puic [options] \-subimpl <classname> <uifile> + <classname> name of the subclass to generate + + +.TP +.B Options: +.TP +.B \-o file +Write output to file rather than stdout +.TP +.B \-p indent +Set the indent in spaces (0 to use a tab) +.TP +.B \-nofwd +Omit imports of custom widgets +.TP +.B \-tr func +Use func(...) rather than trUtf8(...) for i18n +.TP +.B \-x +Generate extra code to test the class +.TP +.B \-version +Display version of puic +.TP +.B \-help +Show summary of options +.SH "SEE ALSO" +http://perlqt.sourceforge.net/ +.SH "AUTHOR" +This manual page was written by Lutz Badenheuer <Lutz.Badenheuer@t\-online.de>, +for the Debian project (but may be used by others). diff --git a/puic/puic.pro b/puic/puic.pro new file mode 100644 index 0000000..157ae59 --- /dev/null +++ b/puic/puic.pro @@ -0,0 +1,28 @@ + +TEMPLATE = app +INCLUDEPATH += . + +CONFIG += qt warn_on + +exists( $(QTDIR)/lib/libqt-mt* ) { + CONFIG += thread +} + +DEFINES += UIC QT_INTERNAL_XML + +# Input +HEADERS += domtool.h \ + globaldefs.h \ + parser.h \ + uic.h \ + widgetdatabase.h \ + widgetinterface.h +SOURCES += domtool.cpp \ + embed.cpp \ + form.cpp \ + main.cpp \ + object.cpp \ + parser.cpp \ + subclassing.cpp \ + uic.cpp \ + widgetdatabase.cpp diff --git a/puic/stamp-h.in b/puic/stamp-h.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/puic/stamp-h.in diff --git a/puic/subclassing.cpp b/puic/subclassing.cpp new file mode 100644 index 0000000..51a5e55 --- /dev/null +++ b/puic/subclassing.cpp @@ -0,0 +1,191 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "uic.h" +#include "parser.h" +#include "widgetdatabase.h" +#include "domtool.h" +#include <qfile.h> +#include <qstringlist.h> +#include <qdatetime.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#include <qregexp.h> +#include <stdio.h> +#include <stdlib.h> + + +/*! + Creates an implementation for a subclass \a subClass of the form + given in \a e + + \sa createSubDecl() + */ +void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) +{ + QDomElement n; + QDomNodeList nl; + int i; + + QString objClass = getClassName( e ); + if ( objClass.isEmpty() ) + return; + out << indent << "package " << subClass << ";" << endl; + out << indent << "use Qt;" << endl; + out << indent << "use " << nameOfClass << ";" << endl; + out << indent << "use Qt::isa qw("<< nameOfClass << ");" << endl; + + out << endl; + + // constructor + out << indent << "sub NEW" << endl; + out << indent << "{" << endl; + ++indent; + if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) { + out << indent << "shift->SUPER::NEW(@_[0..3]);" << endl; + } else if ( objClass == "Qt::Widget") { + out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl; + } else if ( objClass == "Qt::MainWindow" ) { + out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl; + out << indent << "statusBar();" << endl; + isMainWindow = TRUE; + } else { + out << indent << "shift->SUPER::NEW(@_[0,1]);" << endl; + } + --indent; + out << indent << "}" << endl; + out << endl; + + // find additional functions + QStringList publicSlots, protectedSlots, privateSlots; + QStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes; + QStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier; + QStringList publicFuncts, protectedFuncts, privateFuncts; + QStringList publicFunctRetTyp, protectedFunctRetTyp, privateFunctRetTyp; + QStringList publicFunctSpec, protectedFunctSpec, privateFunctSpec; + + + nl = e.parentNode().toElement().elementsByTagName( "slot" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + if ( n.parentNode().toElement().tagName() != "slots" + && n.parentNode().toElement().tagName() != "connections" ) + continue; + QString l = n.attribute( "language", "C++" ); + if ( l != "C++" && l != "Perl" ) //- mmh + continue; + QString returnType = n.attribute( "returnType", "void" ); + QString functionName = n.firstChild().toText().data().stripWhiteSpace(); + if ( functionName.endsWith( ";" ) ) + functionName = functionName.left( functionName.length() - 1 ); + QString specifier = n.attribute( "specifier" ); + QString access = n.attribute( "access" ); + if ( access == "protected" ) { + protectedSlots += functionName; + protectedSlotTypes += returnType; + protectedSlotSpecifier += specifier; + } else if ( access == "private" ) { + privateSlots += functionName; + privateSlotTypes += returnType; + privateSlotSpecifier += specifier; + } else { + publicSlots += functionName; + publicSlotTypes += returnType; + publicSlotSpecifier += specifier; + } + } + + nl = e.parentNode().toElement().elementsByTagName( "function" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + n = nl.item(i).toElement(); + QString fname = n.attribute( "name" ); + fname = Parser::cleanArgs( fname ); + if ( n.parentNode().toElement().tagName() != "functions" ) + continue; + QString l = n.attribute( "language", "C++" ); + if ( l != "C++" && l != "Perl" ) //- mmh + continue; + QString returnType = n.attribute( "returnType", "void" ); + QString functionName = n.firstChild().toText().data().stripWhiteSpace(); + if ( functionName.endsWith( ";" ) ) + functionName = functionName.left( functionName.length() - 1 ); + QString specifier = n.attribute( "specifier" ); + QString access = n.attribute( "access" ); + if ( access == "protected" ) { + protectedFuncts += functionName; + protectedFunctRetTyp += returnType; + protectedFunctSpec += specifier; + } else if ( access == "private" ) { + privateFuncts += functionName; + privateFunctRetTyp += returnType; + privateFunctSpec += specifier; + } else { + publicFuncts += functionName; + publicFunctRetTyp += returnType; + publicFunctSpec += specifier; + } + } + + // FIXME PerlQt: distinguishing public/protected/private slots does not make any sense in the forseable future + // but nevermind, never forget somewhere far beyond the sky, Ashley Winters is furbishing *Plan 42* ! :) + + if ( !publicFuncts.isEmpty() ) + writeFunctionsSubImpl( publicFuncts, publicFunctRetTyp, publicFunctSpec, subClass, "public function" ); + + if ( !publicSlots.isEmpty() ) + writeFunctionsSubImpl( publicSlots, publicSlotTypes, publicSlotSpecifier, subClass, "public slot" ); + + if ( !protectedFuncts.isEmpty() ) + writeFunctionsSubImpl( protectedFuncts, protectedFunctRetTyp, protectedFunctSpec, subClass, "protected function" ); + + if ( !protectedSlots.isEmpty() ) + writeFunctionsSubImpl( protectedSlots, protectedSlotTypes, protectedSlotSpecifier, subClass, "protected slot" ); + + if ( !privateFuncts.isEmpty() ) + writeFunctionsSubImpl( privateFuncts, privateFunctRetTyp, privateFunctSpec, subClass, "private function" ); + + if ( !privateSlots.isEmpty() ) + writeFunctionsSubImpl( privateSlots, privateSlotTypes, privateSlotSpecifier, subClass, "private slot" ); + + out << "1;" << endl; +} + +void Uic::writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst, + const QString &subClass, const QString &descr ) +{ + QValueListConstIterator<QString> it, it2, it3; + for ( it = fuLst.begin(), it2 = typLst.begin(), it3 = specLst.begin(); + it != fuLst.end(); ++it, ++it2, ++it3 ) { + QString type = *it2; + if ( type.isEmpty() ) + type = "void"; + if ( *it3 == "non virtual" ) + continue; + out << endl; + int astart = (*it).find('('); + out << indent << "sub " << (*it).left(astart)<< endl; + out << indent << "{" << endl; + ++indent; + out << indent << "print \"" << subClass << "->" << (*it) << ": (Private) Not implemented yet.\\n\";" << endl; + --indent; + out << indent << "}" << endl; + } + out << endl; +} diff --git a/puic/uic.cpp b/puic/uic.cpp new file mode 100644 index 0000000..5d87918 --- /dev/null +++ b/puic/uic.cpp @@ -0,0 +1,1101 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk> +** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com> +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +/* +** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler, +** a work derivated from uic (the Qt User Interface Compiler) +** and pyuic (the PyQt User Interface Compiler). +** +** G.Garand +** +**********************************************************************/ + +#include "uic.h" +#include "parser.h" +#include "widgetdatabase.h" +#include "domtool.h" +#include <qfile.h> +#include <qstringlist.h> +#include <qdatetime.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#include <qregexp.h> +#include <stdio.h> +#include <stdlib.h> + +bool Uic::isMainWindow = FALSE; +PyIndent Uic::indent; + + +// Re-calculate the indent string based on the current number and nature of the +// indent. +void PyIndent::calc() +{ + indstr.truncate(0); + + for (uint i = current; i > 0; --i) + if (tabStop == 0) + indstr += '\t'; + else + for (uint t = 0; t < tabStop; ++t) + indstr += ' '; +} + + +QString Uic::getComment( const QDomNode& n ) +{ + QDomNode child = n.firstChild(); + while ( !child.isNull() ) { + if ( child.toElement().tagName() == "comment" ) + return child.toElement().firstChild().toText().data(); + child = child.nextSibling(); + } + return QString::null; +} + +QString Uic::mkBool( bool b ) +{ + return b? "1" : "0"; +} + +QString Uic::mkBool( const QString& s ) +{ + return mkBool( s == "true" || s == "1" ); +} + +bool Uic::toBool( const QString& s ) +{ + return s == "true" || s.toInt() != 0; +} + +QString Uic::fixString( const QString &str, bool encode ) +{ + QString s; + if ( !encode ) { + s = str; + // PerlQt: we don't want to use replace( QString, QString ) because we support Qt 3.0 + s.replace( QRegExp("\\\\"), "\\\\" ); + s.replace( QRegExp("\""), "\\\"" ); + s.replace( QRegExp("\\r?\\n"), "\\n\" .\n" + indent + "\"" ); + } else { + QCString utf8 = str.utf8(); + const int l = utf8.length(); + for ( int i = 0; i < l; ++i ) + s += "\\x" + QString::number( (uchar)utf8[i], 16 ); + } + return "\"" + s + "\""; +} + +QString Uic::trcall( const QString& sourceText, const QString& comment ) +{ + if ( sourceText.isEmpty() && comment.isEmpty() ) + return "\"\""; + QString t = trmacro; + bool encode = FALSE; + if ( t.isNull() ) { + t = "tr"; + for ( int i = 0; i < (int) sourceText.length(); i++ ) { + if ( sourceText[i].unicode() >= 0x80 ) { + t = "trUtf8"; + encode = TRUE; + break; + } + } + } + + if ( comment.isEmpty() ) + return trmacro + "(" + fixString( sourceText, encode ) + ")"; + return trmacro + "(" + fixString( sourceText, encode ) + "," + fixString( comment, encode ) + ")"; +} + +QString Uic::mkStdSet( const QString& prop ) +{ + return QString( "set" ) + prop[0].upper() + prop.mid(1); +} + +/*! + \class Uic uic.h + \brief User Interface Compiler + + The class Uic encapsulates the user interface compiler (uic). + */ +Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, + QDomDocument doc, bool subcl, const QString &trm, + const QString& subClass, bool omitForwardDecls, QString &uicClass ) + : out( outStream ), trout( &languageChangeBody ), + outputFileName( outputFn ), trmacro( trm ), nofwd( omitForwardDecls ) +{ + fileName = fn; + writeFunctImpl = TRUE; + defMargin = BOXLAYOUT_DEFAULT_MARGIN; + defSpacing = BOXLAYOUT_DEFAULT_SPACING; + externPixmaps = FALSE; + + item_used = cg_used = pal_used = 0; + + layouts << "hbox" << "vbox" << "grid"; + tags = layouts; + tags << "widget"; + + pixmapLoaderFunction = getPixmapLoaderFunction( doc.firstChild().toElement() ); + nameOfClass = getFormClassName( doc.firstChild().toElement() ); + + stdsetdef = toBool( doc.firstChild().toElement().attribute("stdsetdef") ); + + if ( doc.firstChild().isNull() || doc.firstChild().firstChild().isNull() ) + return; + QDomElement e = doc.firstChild().firstChild().toElement(); + QDomElement widget; + while ( !e.isNull() ) { + if ( e.tagName() == "widget" ) { + widget = e; + } else if ( e.tagName() == "pixmapinproject" ) { + externPixmaps = TRUE; + } else if ( e.tagName() == "layoutdefaults" ) { + defSpacing = e.attribute( "spacing", defSpacing.toString() ); + defMargin = e.attribute( "margin", defMargin.toString() ); + } else if ( e.tagName() == "layoutfunctions" ) { + defSpacing = e.attribute( "spacing", defSpacing.toString() ); + bool ok; + defSpacing.toInt( &ok ); + if ( !ok ) { + QString buf = defSpacing.toString(); + defSpacing = buf.append( "()" ); + } + defMargin = e.attribute( "margin", defMargin.toString() ); + defMargin.toInt( &ok ); + if ( !ok ) { + QString buf = defMargin.toString(); + defMargin = buf.append( "()" ); + } + } + e = e.nextSibling().toElement(); + } + e = widget; + + if ( nameOfClass.isEmpty() ) + nameOfClass = getObjectName( e ); + namespaces = QStringList::split( "::", nameOfClass ); + bareNameOfClass = namespaces.last(); + namespaces.remove( namespaces.fromLast() ); + + uicClass = nameOfClass; + + if ( subcl ) { + createSubImpl( e, subClass ); + } else { + createFormImpl( e ); + } +} + +/*! Extracts a pixmap loader function from \a e + */ +QString Uic::getPixmapLoaderFunction( const QDomElement& e ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "pixmapfunction" ) + return n.firstChild().toText().data(); + } + return QString::null; +} + + +/*! Extracts the forms class name from \a e + */ +QString Uic::getFormClassName( const QDomElement& e ) +{ + QDomElement n; + QString cn; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "class" ) { + QString s = n.firstChild().toText().data(); + int i; + while ( ( i = s.find(' ' )) != -1 ) + s[i] = '_'; + cn = s; + } + } + return cn; +} + +/*! Extracts a Perl class name from \a e. + */ +QString Uic::getClassName( const QDomElement& e ) +{ + QString s = e.attribute( "class" ); + if ( s.isEmpty() && e.tagName() == "toolbar" ) + s = "Qt::ToolBar"; + else if ( s.isEmpty() && e.tagName() == "menubar" ) + s = "Qt::MenuBar"; + else if( WidgetDatabase::idFromClassName( s ) == -1) + return s; + else + { + QRegExp r("^([QK])(\\S+)"); + if( r.search( s ) != -1 ) + s = (r.cap(1) == 'K'?"KDE::":"Qt::") + r.cap(2); + } + return s; +} + + + +/*! Returns TRUE if database framework code is generated, else FALSE. +*/ + +bool Uic::isFrameworkCodeGenerated( const QDomElement& e ) +{ + QDomElement n = getObjectProperty( e, "frameworkCode" ); + if ( n.attribute("name") == "frameworkCode" && + !DomTool::elementToVariant( n.firstChild().toElement(), QVariant( TRUE, 0 ) ).toBool() ) + return FALSE; + return TRUE; +} + +/*! Extracts an object name from \a e. It's stored in the 'name' + property. + */ +QString Uic::getObjectName( const QDomElement& e ) +{ + QDomElement n = getObjectProperty( e, "name" ); + if ( n.firstChild().toElement().tagName() == "cstring" ) + return n.firstChild().toElement().firstChild().toText().data(); + return QString::null; +} + +/*! Extracts an layout name from \a e. It's stored in the 'name' + property of the preceeding sibling (the first child of a QLayoutWidget). + */ +QString Uic::getLayoutName( const QDomElement& e ) +{ + QDomElement p = e.parentNode().toElement(); + QString name; + + if ( getClassName(p) != "Qt::LayoutWidget" ) + name = "Layout"; + + QDomElement n = getObjectProperty( p, "name" ); + if ( n.firstChild().toElement().tagName() == "cstring" ) { + name.prepend( n.firstChild().toElement().firstChild().toText().data() ); + return QStringList::split( "::", name ).last(); + } + return e.tagName(); +} + + +QString Uic::getDatabaseInfo( const QDomElement& e, const QString& tag ) +{ + QDomElement n; + QDomElement n1; + int child = 0; + // database info is a stringlist stored in this order + if ( tag == "connection" ) + child = 0; + else if ( tag == "table" ) + child = 1; + else if ( tag == "field" ) + child = 2; + else + return QString::null; + n = getObjectProperty( e, "database" ); + if ( n.firstChild().toElement().tagName() == "stringlist" ) { + // find correct stringlist entry + QDomElement n1 = n.firstChild().firstChild().toElement(); + for ( int i = 0; i < child && !n1.isNull(); ++i ) + n1 = n1.nextSibling().toElement(); + if ( n1.isNull() ) + return QString::null; + return n1.firstChild().toText().data(); + } + return QString::null; +} + + +void Uic::registerLayouts( const QDomElement &e ) +{ + if ( layouts.contains(e.tagName()) ) + createObjectDecl(e); + + QDomNodeList nl = e.childNodes(); + for ( int i = 0; i < (int) nl.length(); ++i ) + registerLayouts( nl.item(i).toElement() ); +} + + +/*! + Returns include file for class \a className or a null string. + */ +QString Uic::getInclude( const QString& className ) +{ + int wid = WidgetDatabase::idFromClassName( className ); + if ( wid != -1 ) + return WidgetDatabase::includeFile( wid ); + return QString::null; +} + +void Uic::createActionDecl( const QDomElement& e ) +{ + QString objName = getObjectName( e ); + if ( objName.isEmpty() ) + return; + out << indent << objName << endl; + if ( e.tagName() == "actiongroup" ) { + for ( QDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) + createActionDecl( n ); + } + } +} + +void Uic::createActionImpl( const QDomElement &n, const QString &parent ) +{ + for ( QDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { + QString objName = registerObject( getObjectName( ae ) ); + if ( ae.tagName() == "action" ) + out << indent << objName << "= Qt::Action(" << parent << ", \"" << objName << "\");" << endl; + else if ( ae.tagName() == "actiongroup" ) + out << indent << objName << "= Qt::ActionGroup(" << parent << ", \"" << objName << "\");" << endl; + else + continue; + bool subActionsDone = FALSE; + for ( QDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + if ( n2.tagName() == "property" ) { + bool stdset = stdsetdef; + if ( n2.hasAttribute( "stdset" ) ) + stdset = toBool( n2.attribute( "stdset" ) ); + QString prop = n2.attribute("name"); + if ( prop == "name" ) + continue; + QString value = setObjectProperty( "Qt::Action", objName, prop, n2.firstChild().toElement(), stdset ); + if ( value.isEmpty() ) + continue; + QString call = objName + "->"; + bool needClose = false; + if ( stdset ) { + call += mkStdSet( prop ) + "( "; + } else { + call += "setProperty( \"" + prop + "\", Qt::Variant(" ; + needClose = true; + } + if ( prop == "accel" ) + call += "Qt::KeySequence( " + value + " )"+ (needClose ? " )": "") + " );"; + else + call += value + (needClose ? " )": "") + " );"; + + if ( n2.firstChild().toElement().tagName() == "string" ) { + trout << indent << call << endl; + } else { + out << indent << call << endl; + } + } else if ( !subActionsDone && ( n2.tagName() == "actiongroup" || n2.tagName() == "action" ) ) { + createActionImpl( n2, objName ); + subActionsDone = TRUE; + } + } + } +} + +QString get_dock( const QString &d ) +{ + if ( d == "0" ) + return "&DockUnmanaged"; + if ( d == "1" ) + return "&DockTornOff"; + if ( d == "2" ) + return "&DockTop"; + if ( d == "3" ) + return "&DockBottom"; + if ( d == "4" ) + return "&DockRight"; + if ( d == "5" ) + return "&DockLeft"; + if ( d == "6" ) + return "&DockMinimized"; + return ""; +} + +void Uic::createToolbarImpl( const QDomElement &n, const QString &parentClass, const QString &parent ) +{ + QDomNodeList nl = n.elementsByTagName( "toolbar" ); + for ( int i = 0; i < (int) nl.length(); i++ ) { + QDomElement ae = nl.item( i ).toElement(); + QString dock = get_dock( ae.attribute( "dock" ) ); + QString objName = getObjectName( ae ); + out << indent << objName << " = Qt::ToolBar(\"\", this, " << dock << ");" << endl; + createObjectImpl( ae, parentClass, parent ); + for ( QDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + if ( n2.tagName() == "action" ) { + out << indent << n2.attribute( "name" ) << "->addTo(" << objName << ");" << endl; + } else if ( n2.tagName() == "separator" ) { + out << indent << objName << "->addSeparator;" << endl; + } else if ( n2.tagName() == "widget" ) { + if ( n2.attribute( "class" ) != "Spacer" ) { + createObjectImpl( n2, "Qt::ToolBar", objName ); + } else { + QString child = createSpacerImpl( n, parentClass, parent, objName ); + out << indent << "Qt::Application->sendPostedEvents( $" << objName + << ", &Qt::Event::ChildInserted);" << endl; + out << indent << "$" << objName << "->boxLayout()->addItem(" << child << ");" << endl; + } + } + } + } +} + +void Uic::createMenuBarImpl( const QDomElement &n, const QString &parentClass, const QString &parent ) +{ + QString objName = getObjectName( n ); + out << indent << objName << "= Qt::MenuBar( this, \"" << objName << "\");" << endl; + createObjectImpl( n, parentClass, parent ); + + QDomNodeList nl = n.elementsByTagName( "item" ); + int i = 0; + QDomElement c = n.firstChild().toElement(); + while ( !c.isNull() ) { + if ( c.tagName() == "item" ) { + QString itemName = c.attribute( "name" ); + out << endl; + out << indent << itemName << " = Qt::PopupMenu( this );" << endl; + createPopupMenuImpl( c, parentClass, itemName ); + out << indent << objName << "->insertItem( \"\", " << itemName << ", " << i << " );" << endl; + trout << indent << objName << "->findItem( " << i << " )->setText( " << trcall( c.attribute( "text" ) ) << " );" << endl; + } else if ( c.tagName() == "separator" ) { + out << endl; + out << indent << objName << "->insertSeparator( " << i << " );" << endl; + } + c = c.nextSibling().toElement(); + i++; + } +} + +void Uic::createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent ) +{ + for ( QDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "action" ) { + QDomElement n2 = n.nextSibling().toElement(); + if ( n2.tagName() == "item" ) { // the action has a sub menu + QString itemName = n2.attribute( "name" ); + QString itemText = n2.attribute( "text" ); + out << indent << itemName << " = Qt::PopupMenu( this );" << endl; + out << indent << parent << "->setAccel( tr( \"" << n2.attribute( "accel" ) << "\" ), " << endl; + ++indent; + out << indent << parent << "->insertItem( " << n.attribute( "name" ) << "->iconSet(),"; + out << trcall( itemText ) << ", " << itemName << " ) );" << endl; + --indent; + createPopupMenuImpl( n2, parentClass, itemName ); + n = n2; + } else { + out << indent << n.attribute( "name" ) << "->addTo( " << parent << " );" << endl; + } + } else if ( n.tagName() == "separator" ) { + out << indent << parent << "->insertSeparator();" << endl; + } + } + } + +/*! + Creates implementation of an listbox item tag. +*/ + +QString Uic::createListBoxItemImpl( const QDomElement &e, const QString &parent, + QString *value ) + +{ + QDomElement n = e.firstChild().toElement(); + QString txt; + QString com; + QString pix; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) { + txt = v.toString(); + com = getComment( n ); + } else if ( attrib == "pixmap" ) { + pix = v.toString(); + if( !pix.isEmpty() && !externPixmaps ) + pix.prepend( '$' ); + if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { + pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + } + } + n = n.nextSibling().toElement(); + } + + if ( value ) + *value = trcall( txt, com ); + + if ( pix.isEmpty() ) { + return parent + "->insertItem( " + trcall( txt, com ) + " );"; + } else { + return parent + "->insertItem( " + pix + ", " + trcall( txt, com ) + " );"; + } + +} + +/*! + Creates implementation of an iconview item tag. +*/ + +QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent ) +{ + QDomElement n = e.firstChild().toElement(); + QString txt; + QString com; + QString pix; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) { + txt = v.toString(); + com = getComment( n ); + } else if ( attrib == "pixmap" ) { + pix = v.toString(); + if( !pix.isEmpty() && !externPixmaps ) + pix.prepend( '$' ); + if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { + pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + } + } + n = n.nextSibling().toElement(); + } + + if ( pix.isEmpty() ) + return "Qt::IconViewItem(" + parent + ", " + trcall( txt, com ) + ");"; + else + return "Qt::IconViewItem(" + parent + ", " + trcall( txt, com ) + ", " + pix + ");"; +} + +/*! + Creates implementation of an listview item tag. +*/ + +QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent, + const QString &parentItem ) +{ + QString s; + + QDomElement n = e.firstChild().toElement(); + + bool hasChildren = e.elementsByTagName( "item" ).count() > 0; + QString item; + + if ( hasChildren ) { + item = "$" + registerObject( "item" ); + s = indent + "my " + item + " = "; + } else { + item = "$item"; + if ( item_used ) + s = indent + item + " = "; + else + s = indent + "my " + item + " = "; + item_used = TRUE; + } + + if ( !parentItem.isEmpty() ) + s += "Qt::ListViewItem(" + parentItem + ", " + lastItem + ");\n"; + else + s += "Qt::ListViewItem(" + parent + ", " + lastItem + ");\n"; + + QStringList texts; + QStringList pixmaps; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute("name"); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + texts << v.toString(); + else if ( attrib == "pixmap" ) { + QString pix = v.toString(); + if( !pix.isEmpty() && !externPixmaps ) + pix.prepend( '$' ); + if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { + pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + pixmaps << pix; + } + } else if ( n.tagName() == "item" ) { + s += indent + item + "->setOpen(1);\n"; + s += createListViewItemImpl( n, parent, item ); + } + n = n.nextSibling().toElement(); + } + + for ( int i = 0; i < (int)texts.count(); ++i ) { + if ( !texts[ i ].isEmpty() ) + s += indent + item + "->setText(" + QString::number( i ) + ", " + trcall( texts[ i ] ) + ");\n"; + if ( !pixmaps[ i ].isEmpty() ) + s += indent + item + "->setPixmap(" + QString::number( i ) + ", " + pixmaps[ i ] + ");\n"; + } + + lastItem = item; + return s; +} + +/*! + Creates implementation of an listview column tag. +*/ + +QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &parent, + QString *value ) +{ + QDomElement n = e.firstChild().toElement(); + QString txt; + QString com; + QString pix; + bool clickable = FALSE, resizable = FALSE; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute("name"); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) { + txt = v.toString(); + com = getComment( n ); + } else if ( attrib == "pixmap" ) { + pix = v.toString(); + if( !pix.isEmpty() && !externPixmaps ) + pix.prepend( '$' ); + if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { + pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + } else if ( attrib == "clickable" ) + clickable = v.toBool(); + else if ( attrib == "resizable" || attrib == "resizeable" ) + resizable = v.toBool(); + } + n = n.nextSibling().toElement(); + } + + if ( value ) + *value = trcall( txt, com ); + + QString s; + s = indent + parent + "->addColumn(" + trcall( txt, com ) + ");\n"; + if ( !pix.isEmpty() ) + s += indent + parent + "->header()->setLabel(" + parent + "->header()->count() - 1," + pix + ", " + trcall( txt, com ) + ");\n"; + if ( !clickable ) + s += indent + parent + "->header()->setClickEnabled( 0, " + parent + "->header()->count() - 1 );\n"; + if ( !resizable ) + s += indent + parent + "->header()->setResizeEnabled( 0, " + parent + "->header()->count() - 1 );\n"; + + return s; +} + +QString Uic::createTableRowColumnImpl( const QDomElement &e, const QString &parent, + QString *value ) +{ + QString objClass = getClassName( e.parentNode().toElement() ); + QDomElement n = e.firstChild().toElement(); + QString txt; + QString com; + QString pix; + QString field; + bool isRow = e.tagName() == "row"; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute("name"); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) { + txt = v.toString(); + com = getComment( n ); + } else if ( attrib == "pixmap" ) { + pix = v.toString(); + if( !pix.isEmpty() && !externPixmaps ) + pix.prepend( '$' ); + if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { + pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + } else if ( attrib == "field" ) + field = v.toString(); + } + n = n.nextSibling().toElement(); + } + + if ( value ) + *value = trcall( txt, com ); + + // ### This generated code sucks! We have to set the number of + // rows/cols before and then only do setLabel/() + // ### careful, though, since QDataTable has an API which makes this code pretty good + + QString s; + if ( isRow ) { + s = indent + parent + "->setNumRows(" + parent + "->numRows() + 1 );\n"; + if ( pix.isEmpty() ) + s += indent + parent + "->verticalHeader()->setLabel(" + parent + "->numRows() - 1, " + + trcall( txt, com ) + ");\n"; + else + s += indent + parent + "->verticalHeader()->setLabel(" + parent + "->numRows() - 1, Qt::IconSet(" + + pix + " ), " + trcall( txt, com ) + ");\n"; + } else { + if ( objClass == "Qt::Table" ) { + s = indent + parent + "->setNumCols(" + parent + "->numCols() + 1);\n"; + if ( pix.isEmpty() ) + s += indent + parent + "->horizontalHeader()->setLabel(" + parent + "->numCols() - 1, " + + trcall( txt, com ) + ");\n"; + else + s += indent + parent + "->horizontalHeader()->setLabel(" + parent + "->numCols() - 1, Qt::IconSet(" + + pix + " ), " + trcall( txt, com ) + ");\n"; + } else if ( objClass == "Qt::DataTable" ) { + if ( !txt.isEmpty() && !field.isEmpty() ) { + if ( pix.isEmpty() ) + out << indent << parent << "->addColumn(" << fixString( field ) << ", " << trcall( txt, com ) << ");" << endl; + else + out << indent << parent << "->addColumn(" << fixString( field ) << ", " << trcall( txt, com ) << ", Qt::IconSet(" << pix << "));" << endl; + } + } + } + return s; +} + +/*! + Creates the implementation of a layout tag. Called from createObjectImpl(). + */ +QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout ) +{ + QDomElement n; + QString objClass, objName; + objClass = e.tagName(); + + QString qlayout = "Qt::VBoxLayout"; + if ( objClass == "hbox" ) + qlayout = "Qt::HBoxLayout"; + else if ( objClass == "grid" ) + qlayout = "Qt::GridLayout"; + + bool isGrid = e.tagName() == "grid" ; + objName = registerObject( "$" + getLayoutName( e ) ); + layoutObjects += objName; + QString margin = DomTool::readProperty( e, "margin", defMargin ).toString(); + QString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString(); + QString resizeMode = DomTool::readProperty( e, "resizeMode", QString::null ).toString(); + + QString optcells; + if ( isGrid ) + optcells = "1, 1, "; + if ( (parentClass == "Qt::GroupBox" || parentClass == "Qt::ButtonGroup") && layout.isEmpty() ) { + // special case for group box + out << indent << parent << "->setColumnLayout( 0, &Vertical );" << endl; + out << indent << parent << "->layout()->setSpacing(" << spacing << ");" << endl; + out << indent << parent << "->layout()->setMargin(" << margin << ");" << endl; + out << indent << "my " << objName << " = " << qlayout << "(" << parent << "->layout() );" << endl; + out << indent << objName << "->setAlignment( &AlignTop );" << endl; + } else { + out << indent << "my " << objName << " = " << qlayout << "("; + if ( layout.isEmpty() ) + out << parent; + else { + out << "undef"; + if ( !DomTool::hasProperty( e, "margin" ) ) + margin = "0"; + } + out << ", " << optcells << margin << ", " << spacing << ", '" << objName << "');" << endl; + } + if ( !resizeMode.isEmpty() ) + out << indent << objName << "->setResizeMode( &Qt::Layout::" << resizeMode << " );" << endl; + + if ( !isGrid ) { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "spacer" ) { + QString child = createSpacerImpl( n, parentClass, parent, objName ); + out << indent << objName << "->addItem(" << child << ");" << endl; + } else if ( tags.contains( n.tagName() ) ) { + QString child = createObjectImpl( n, parentClass, parent, objName ); + if ( isLayout( child ) ) + out << indent << objName << "->addLayout(" << child << ");" << endl; + else + out << indent << objName << "->addWidget(" << child << ");" << endl; + } + } + } else { + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + QDomElement ae = n; + int row = ae.attribute( "row" ).toInt(); + int col = ae.attribute( "column" ).toInt(); + int rowspan = ae.attribute( "rowspan" ).toInt(); + int colspan = ae.attribute( "colspan" ).toInt(); + if ( rowspan < 1 ) + rowspan = 1; + if ( colspan < 1 ) + colspan = 1; + if ( n.tagName() == "spacer" ) { + QString child = createSpacerImpl( n, parentClass, parent, objName ); + if ( rowspan * colspan != 1 ) + out << indent << objName << "->addMultiCell(" << child << ", " + << row << ", " << ( row + rowspan - 1 ) << ", " << col << ", " << col + colspan - 1 << ");" << endl; + else + out << indent << objName << "->addItem(" << child << ", " + << row << ", " << col << ");" << endl; + } else if ( tags.contains( n.tagName() ) ) { + QString child = createObjectImpl( n, parentClass, parent, objName ); + out << endl; + QString o = "Widget"; + if ( isLayout( child ) ) + o = "Layout"; + if ( rowspan * colspan != 1 ) + out << indent << objName << "->addMultiCell" << o << "(" << child << ", " + << row << ", " << ( row + rowspan - 1 ) << ", " << col << ", " << col + colspan - 1 << ");" << endl; + else + out << indent << objName << "->add" << o << "(" << child << ", " + << row << ", " << col << ");" << endl; + } + } + } + + return objName; +} + + + +QString Uic::createSpacerImpl( const QDomElement &e, const QString& /*parentClass*/, const QString& /*parent*/, const QString& /*layout*/) +{ + QDomElement n; + QString objClass, objName; + objClass = e.tagName(); + objName = registerObject( "$spacer" ); + + QSize size = DomTool::readProperty( e, "sizeHint", QSize( 0, 0 ) ).toSize(); + QString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); + bool isVspacer = DomTool::readProperty( e, "orientation", "Horizontal" ) == "Vertical"; + + if ( sizeType != "Expanding" && sizeType != "MinimumExpanding" && + DomTool::hasProperty( e, "geometry" ) ) { // compatibility Qt 2.2 + QRect geom = DomTool::readProperty( e, "geometry", QRect(0,0,0,0) ).toRect(); + size = geom.size(); + } + + if ( isVspacer ) + out << indent << "my " << objName << " = Qt::SpacerItem(" + << size.width() << ", " << size.height() + << ", &Qt::SizePolicy::Minimum, &Qt::SizePolicy::" << sizeType << ");" << endl; + else + out << indent << "my " << objName << " = Qt::SpacerItem(" + << size.width() << ", " << size.height() + << ", &Qt::SizePolicy::" << sizeType << ", &Qt::SizePolicy::Minimum);" << endl; + + return objName; +} + +static const char* const ColorRole[] = { + "Foreground", "Button", "Light", "Midlight", "Dark", "Mid", + "Text", "BrightText", "ButtonText", "Base", "Background", "Shadow", + "Highlight", "HighlightedText", "Link", "LinkVisited", 0 +}; + + +/*! + Creates a colorgroup with name \a name from the color group \a cg + */ +void Uic::createColorGroupImpl( const QString& name, const QDomElement& e ) +{ + QColorGroup cg; + int r = -1; + QDomElement n = e.firstChild().toElement(); + QString color; + while ( !n.isNull() ) { + if ( n.tagName() == "color" ) { + r++; + QColor col = DomTool::readColor( n ); + color = "Qt::Color(%1,%2,%3)"; + color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() ); + if ( col == white ) + color = "&white"; + else if ( col == black ) + color = "&black"; + if ( n.nextSibling().toElement().tagName() != "pixmap" ) { + out << indent << name << "->setColor(&Qt::ColorGroup::" << ColorRole[r] << ", " << color << ");" << endl; + } + } else if ( n.tagName() == "pixmap" ) { + QString pixmap = n.firstChild().toText().data(); + if( !pixmap.isEmpty() && !externPixmaps ) + pixmap.prepend( '$' ); + if ( !pixmapLoaderFunction.isEmpty() ) { + pixmap.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); + pixmap.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + } + out << indent << name << "->setBrush(&Qt::ColorGroup::" + << ColorRole[r] << ", Qt::Brush(" << color << ", " << pixmap << "));" << endl; + } + n = n.nextSibling().toElement(); + } +} + +/*! + Auxiliary function to load a color group. The colorgroup must not + contain pixmaps. + */ +QColorGroup Uic::loadColorGroup( const QDomElement &e ) +{ + QColorGroup cg; + int r = -1; + QDomElement n = e.firstChild().toElement(); + QColor col; + while ( !n.isNull() ) { + if ( n.tagName() == "color" ) { + r++; + cg.setColor( (QColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); + } + n = n.nextSibling().toElement(); + } + return cg; +} + +/*! Returns TRUE if the widget properties specify that it belongs to + the database \a connection and \a table. +*/ + +bool Uic::isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table ) +{ + QString conn = getDatabaseInfo( e, "connection" ); + QString tab = getDatabaseInfo( e, "table" ); + if ( conn == connection && tab == table ) + return TRUE; + return FALSE; +} + +/*! + Registers all database connections, cursors and forms. +*/ + +void Uic::registerDatabases( const QDomElement& e ) +{ + QDomElement n; + QDomNodeList nl; + int i; + nl = e.parentNode().toElement().elementsByTagName( "widget" ); + for ( i = 0; i < (int) nl.length(); ++i ) { + n = nl.item(i).toElement(); + QString conn = getDatabaseInfo( n, "connection" ); + QString tab = getDatabaseInfo( n, "table" ); + QString fld = getDatabaseInfo( n, "field" ); + if ( !conn.isNull() ) { + dbConnections += conn; + if ( !tab.isNull() ) { + dbCursors[conn] += tab; + if ( !fld.isNull() ) + dbForms[conn] += tab; + } + } + } +} + +/*! + Registers an object with name \a name. + + The returned name is a valid variable identifier, as similar to \a + name as possible and guaranteed to be unique within the form. + + \sa registeredName(), isObjectRegistered() + */ +QString Uic::registerObject( const QString& name ) +{ + if ( objectNames.isEmpty() ) { + // some temporary variables we need + objectNames += "img"; + objectNames += "item"; + objectNames += "cg"; + objectNames += "pal"; + } + + QString result = name; + int i; + while ( ( i = result.find(' ' )) != -1 ) { + result[i] = '_'; + } + + if ( objectNames.contains( result ) ) { + int i = 2; + while ( objectNames.contains( result + "_" + QString::number(i) ) ) + i++; + result += "_"; + result += QString::number(i); + } + objectNames += result; + objectMapper.insert( name, result ); + return result; +} + +/*! + Returns the registered name for the original name \a name + or \a name if \a name wasn't registered. + + \sa registerObject(), isObjectRegistered() + */ +QString Uic::registeredName( const QString& name ) +{ + if ( !objectMapper.contains( name ) ) + return name; + return objectMapper[name]; +} + +/*! + Returns whether the object \a name was registered yet or not. + */ +bool Uic::isObjectRegistered( const QString& name ) +{ + return objectMapper.contains( name ); +} + + +/*! + Unifies the entries in stringlist \a list. Should really be a QStringList feature. + */ +QStringList Uic::unique( const QStringList& list ) +{ + if ( list.isEmpty() ) + return list; + + QStringList result; + for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { + if ( !result.contains(*it) ) + result += *it; + } + return result; +} + + + +/*! + Creates an instance of class \a objClass, with parent \a parent and name \a objName + */ +QString Uic::createObjectInstance( const QString& objClass, const QString& parent, const QString& objName ) +{ + + if ( objClass.mid( 4 ) == "ComboBox" ) { + return objClass + "(0, " + parent + ", \"" + objName + "\")"; + } + return objClass + "(" + parent + ", \"" + objName + "\")"; +} + +bool Uic::isLayout( const QString& name ) const +{ + return layoutObjects.contains( name ); +} diff --git a/puic/uic.h b/puic/uic.h new file mode 100644 index 0000000..20d07e2 --- /dev/null +++ b/puic/uic.h @@ -0,0 +1,195 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk> +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef UIC_H +#define UIC_H +#include <qdom.h> +#include <qstring.h> +#include <qstringlist.h> +#include <qmap.h> +#include <qtextstream.h> +#include <qpalette.h> +#include <qvariant.h> + +#ifndef Q_DUMMY_COMPARISON_OPERATOR +# warning "Defining Q_DUMMY_COMPARISON_OPERATOR" +# ifdef Q_FULL_TEMPLATE_INSTANTIATION +# define Q_DUMMY_COMPARISON_OPERATOR(C) \ + bool operator==( const C& ) const { \ + qWarning( #C"::operator==( const "#C"& ) got called." ); \ + return FALSE; \ + } +# else +# define Q_DUMMY_COMPARISON_OPERATOR(C) +# endif +#endif + +class PyIndent +{ +public: + PyIndent() : tabStop(4), current(0) {calc();} + + void setTabStop(uint n) {tabStop = n; calc();} + void operator++() {++current; calc();} + void operator--() {--current; calc();} + operator QString() {return indstr;} + +private: + uint tabStop; + uint current; + QString indstr; + + void calc(); +}; + + +class Uic : public Qt +{ +public: + Uic( const QString &fn, const char *outputFn, QTextStream& outStream, + QDomDocument doc, bool subcl, const QString &trm, + const QString& subClass, bool omitForwardDecls, QString &uicClass ); + + static void setIndent(const PyIndent &pyind) {indent = pyind;} + + void createFormImpl( const QDomElement &e ); + + void createSubImpl( const QDomElement &e, const QString& subclname ); + + void createObjectDecl( const QDomElement& e ); + void createAttrDecl( const QDomElement& e ); + void createActionDecl( const QDomElement& e ); + void createActionImpl( const QDomElement& e, const QString &parent ); + void createToolbarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); + void createMenuBarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); + void createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); + QString createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); + QString createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); + QString createObjectInstance( const QString& objClass, const QString& parent, const QString& objName ); + QString createSpacerImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); + void createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ); + QString createListBoxItemImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); + QString createIconViewItemImpl( const QDomElement &e, const QString &parent ); + QString createListViewColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); + QString createTableRowColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); + QString createListViewItemImpl( const QDomElement &e, const QString &parent, + const QString &parentItem ); + void createColorGroupImpl( const QString& cg, const QDomElement& e ); + QColorGroup loadColorGroup( const QDomElement &e ); + + QDomElement getObjectProperty( const QDomElement& e, const QString& name ); + QString getPixmapLoaderFunction( const QDomElement& e ); + QString getFormClassName( const QDomElement& e ); + QString getClassName( const QDomElement& e ); + QString getObjectName( const QDomElement& e ); + QString getLayoutName( const QDomElement& e ); + QString getInclude( const QString& className ); + + QString setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ); + + QString registerObject( const QString& name ); + QString registeredName( const QString& name ); + bool isObjectRegistered( const QString& name ); + QStringList unique( const QStringList& ); + + QString trcall( const QString& sourceText, const QString& comment = "" ); + + static void embed( QTextStream& out, const char* project, const QStringList& images ); + + friend void getDBConnections(Uic& uic, QString& s); + +private: + void registerLayouts ( const QDomElement& e ); + + QTextStream& out; + QTextOStream trout; + QString languageChangeBody; + QCString outputFileName; + QStringList objectNames; + QMap<QString,QString> objectMapper; + QStringList tags; + QStringList layouts; + QString formName; + QString lastItem; + QString trmacro; + + bool nofwd; + static PyIndent indent; + + struct Buddy + { + Buddy( const QString& k, const QString& b ) + : key( k ), buddy( b ) {} + Buddy(){} // for valuelist + QString key; + QString buddy; + bool operator==( const Buddy& other ) const + { return (key == other.key); } + }; + struct CustomInclude + { + QString header; + QString location; + Q_DUMMY_COMPARISON_OPERATOR(CustomInclude) + }; + QValueList<Buddy> buddies; + + QStringList layoutObjects; + bool isLayout( const QString& name ) const; + + uint item_used : 1; + uint cg_used : 1; + uint pal_used : 1; + uint stdsetdef : 1; + uint externPixmaps : 1; + + QString nameOfClass; + QStringList namespaces; + QString bareNameOfClass; + QString pixmapLoaderFunction; + + void registerDatabases( const QDomElement& e ); + bool isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table ); + bool isFrameworkCodeGenerated( const QDomElement& e ); + QString getDatabaseInfo( const QDomElement& e, const QString& tag ); + void createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table ); + void writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst, + const QString &subClass, const QString &descr ); + QStringList dbConnections; + QMap< QString, QStringList > dbCursors; + QMap< QString, QStringList > dbForms; + + static bool isMainWindow; + static QString mkBool( bool b ); + static QString mkBool( const QString& s ); + bool toBool( const QString& s ); + static QString fixString( const QString &str, bool encode = FALSE ); + static bool onlyAscii; + static QString mkStdSet( const QString& prop ); + static QString getComment( const QDomNode& n ); + QVariant defSpacing, defMargin; + QString fileName; + bool writeFunctImpl; + + void perlSlot(QStringList::Iterator &it); +}; + +#endif diff --git a/puic/widgetdatabase.cpp b/puic/widgetdatabase.cpp new file mode 100644 index 0000000..6c447d5 --- /dev/null +++ b/puic/widgetdatabase.cpp @@ -0,0 +1,953 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "widgetdatabase.h" +#include "widgetinterface.h" + +#include <qapplication.h> +#define NO_STATIC_COLORS +#include <globaldefs.h> +#include <qstrlist.h> +#include <qdict.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qcleanuphandler.h> +#include <qfeatures.h> + +#include <stdlib.h> + +const int dbsize = 300; +const int dbcustom = 200; +const int dbdictsize = 211; +static WidgetDatabaseRecord* db[ dbsize ]; +static QDict<int> *className2Id = 0; +static int dbcount = 0; +static int dbcustomcount = 200; +static QStrList *wGroups; +static QStrList *invisibleGroups; +static bool whatsThisLoaded = FALSE; +static QPluginManager<WidgetInterface> *widgetPluginManager = 0; +static bool plugins_set_up = FALSE; +static bool was_in_setup = FALSE; + +QCleanupHandler<QPluginManager<WidgetInterface> > cleanup_manager; + +WidgetDatabaseRecord::WidgetDatabaseRecord() +{ + isForm = FALSE; + isContainer = FALSE; + icon = 0; + nameCounter = 0; + isCommon = FALSE; + isPlugin = FALSE; +} + +WidgetDatabaseRecord::~WidgetDatabaseRecord() +{ + delete icon; +} + + +/*! + \class WidgetDatabase widgetdatabase.h + \brief The WidgetDatabase class holds information about widgets + + The WidgetDatabase holds information about widgets like toolTip(), + iconSet(), ... It works Id-based, so all access functions take the + widget id as parameter. To get the id for a widget (classname), use + idFromClassName(). + + All access functions are static. Having multiple widgetdatabases in + one application doesn't make sense anyway and so you don't need more + than an instance of the widgetdatabase. + + For creating widgets, layouts, etc. see WidgetFactory. +*/ + +/*! + Creates widget database. Does nothing. +*/ + +WidgetDatabase::WidgetDatabase() +{ +} + +/*! Sets up the widget database. If the static widgetdatabase already + exists, the functions returns immediately. +*/ + +void WidgetDatabase::setupDataBase( int id ) +{ + was_in_setup = TRUE; +#ifndef UIC + Q_UNUSED( id ) + if ( dbcount ) + return; +#else + if ( dbcount && id != -2 ) + return; + if ( dbcount && !plugins_set_up ) { + setupPlugins(); + return; + } + if ( dbcount && plugins_set_up) + return; +#endif + + wGroups = new QStrList; + invisibleGroups = new QStrList; + invisibleGroups->append( "Forms" ); + invisibleGroups->append( "Temp" ); + className2Id = new QDict<int>( dbdictsize ); + className2Id->setAutoDelete( TRUE ); + + WidgetDatabaseRecord *r = 0; + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_pushbutton.png"; + r->name = "QPushButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Push Button"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_toolbutton.png"; + r->name = "QToolButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Tool Button"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_radiobutton.png"; + r->name = "QRadioButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Radio Button"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_checkbox.png"; + r->name = "QCheckBox"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Check Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_groupbox.png"; + r->name = "QGroupBox"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Group Box"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_buttongroup.png"; + r->name = "QButtonGroup"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Button Group"; + r->isContainer = TRUE; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_frame.png"; + r->name = "QFrame"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Frame"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QTabWidget"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Tabwidget"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_widgetstack.png"; + r->name = "QWidgetStack"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Widget Stack"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_toolbox.png"; + r->name = "QToolBox"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Tool Box"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_listbox.png"; + r->name = "QListBox"; + r->group = widgetGroup( "Views" ); + r->toolTip = "List Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_listview.png"; + r->name = "QListView"; + r->group = widgetGroup( "Views" ); + r->toolTip = "List View"; + + append( r ); + +#if !defined(QT_NO_ICONVIEW) || defined(UIC) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_iconview.png"; + r->name = "QIconView"; + r->group = widgetGroup( "Views" ); + r->toolTip = "Icon View"; + + append( r ); +#endif + +#if !defined(QT_NO_TABLE) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_table.png"; + r->name = "QTable"; + r->group = widgetGroup( "Views" ); + r->toolTip = "Table"; + + append( r ); +#endif + +#if !defined(QT_NO_SQL) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_datatable.png"; + r->includeFile = "qdatatable.h"; + r->name = "QDataTable"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data Table"; + + append( r ); +#endif + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_lineedit.png"; + r->name = "QLineEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Line Edit"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_spinbox.png"; + r->name = "QSpinBox"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Spin Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_dateedit.png"; + r->name = "QDateEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Date Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_timeedit.png"; + r->name = "QTimeEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Time Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_datetimeedit.png"; + r->name = "QDateTimeEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Date-Time Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_multilineedit.png"; + r->name = "QMultiLineEdit"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Multi Line Edit"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_richtextedit.png"; + r->name = "QTextEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Rich Text Edit"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_combobox.png"; + r->name = "QComboBox"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Combo Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_slider.png"; + r->name = "QSlider"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Slider"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_scrollbar.png"; + r->name = "QScrollBar"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Scrollbar"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_dial.png"; + r->name = "QDial"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Dial"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_label.png"; + r->name = "QLabel"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Label"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_label.png"; + r->name = "TextLabel"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Text Label"; + r->whatsThis = "The Text Label provides a widget to display static text."; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_pixlabel.png"; + r->name = "PixmapLabel"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Pixmap Label"; + r->whatsThis = "The Pixmap Label provides a widget to display pixmaps."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_lcdnumber.png"; + r->name = "QLCDNumber"; + r->group = widgetGroup( "Display" ); + r->toolTip = "LCD Number"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_line.png"; + r->name = "Line"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Line"; + r->includeFile = "qframe.h"; + r->whatsThis = "The Line widget provides horizontal and vertical lines."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_progress.png"; + r->name = "QProgressBar"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Progress Bar"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_textview.png"; + r->name = "QTextView"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Text View"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_textbrowser.png"; + r->name = "QTextBrowser"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Text Browser"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_spacer.png"; + r->name = "Spacer"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Spacer"; + r->whatsThis = "The Spacer provides horizontal and vertical spacing to be able to manipulate the behaviour of layouts."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QWidget"; + r->isForm = TRUE; + r->group = widgetGroup( "Forms" ); + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QDialog"; + r->group = widgetGroup( "Forms" ); + r->isForm = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QWizard"; + r->group = widgetGroup( "Forms" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QDesignerWizard"; + r->group = widgetGroup( "Forms" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QLayoutWidget"; + r->group = widgetGroup( "Temp" ); + r->includeFile = ""; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QSplitter"; + r->group = widgetGroup( "Temp" ); + r->includeFile = "qsplitter.h"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerTabWidget"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerWidget"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerDialog"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QMainWindow"; + r->includeFile = "qmainwindow.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDesignerAction"; + r->includeFile = "qaction.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = FALSE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDesignerActionGroup"; + r->includeFile = "qaction.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = FALSE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QScrollView"; + r->includeFile = "qscrollview.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + +#ifndef QT_NO_SQL + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDataBrowser"; + r->includeFile = "qdatabrowser.h"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data Browser"; + r->iconSet = "designer_databrowser.png"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDataView"; + r->includeFile = "qdataview.h"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data View"; + r->iconSet = "designer_dataview.png"; + r->isContainer = TRUE; + + append( r ); +#endif + +#ifndef UIC + setupPlugins(); +#endif +} + +void WidgetDatabase::setupPlugins() +{ + if ( plugins_set_up ) + return; + plugins_set_up = TRUE; + QStringList widgets = widgetManager()->featureList(); + for ( QStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { + if ( hasWidget( *it ) ) + continue; + WidgetDatabaseRecord *r = new WidgetDatabaseRecord; + WidgetInterface *iface = 0; + widgetManager()->queryInterface( *it, &iface ); + if ( !iface ) + continue; + +#ifndef UIC + QIconSet icon = iface->iconSet( *it ); + if ( !icon.pixmap().isNull() ) + r->icon = new QIconSet( icon ); +#endif + QString grp = iface->group( *it ); + if ( grp.isEmpty() ) + grp = "3rd party widgets"; + r->group = widgetGroup( grp ); + r->toolTip = iface->toolTip( *it ); + r->whatsThis = iface->whatsThis( *it ); + r->includeFile = iface->includeFile( *it ); + r->isContainer = iface->isContainer( *it ); + r->name = *it; + r->isPlugin = TRUE; + append( r ); + iface->release(); + } +} + +/*! + Returns the number of elements in the widget database. +*/ + +int WidgetDatabase::count() +{ + setupDataBase( -1 ); + return dbcount; +} + +/*! + Returns the id at which the ids of custom widgets start. +*/ + +int WidgetDatabase::startCustom() +{ + setupDataBase( -1 ); + return dbcustom; +} + +/*! + Returns the iconset which represents the class registered as \a id. +*/ + +QIconSet WidgetDatabase::iconSet( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QIconSet(); +#if !defined(UIC) && !defined(RESOURCE) + if ( !r->icon ) { + if ( r->iconSet.isEmpty() ) + return QIconSet(); + QPixmap pix = QPixmap::fromMimeSource( r->iconSet ); + if ( pix.isNull() ) + pix = QPixmap( r->iconSet ); + r->icon = new QIconSet( pix ); + } + return *r->icon; +#else + return QIconSet(); +#endif +} + +/*! + Returns the classname of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::className( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->name; +} + +/*! + Returns the group the widget registered as \a id belongs to. +*/ + +QString WidgetDatabase::group( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->group; +} + +/*! + Returns the tooltip text of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::toolTip( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->toolTip; +} + +/*! + Returns the what's this? text of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::whatsThis( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->whatsThis; +} + +/*! + Returns the include file if the widget which is registered as \a id. +*/ + +QString WidgetDatabase::includeFile( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + if ( r->includeFile.isNull() ) + return r->name.lower() + ".h"; + return r->includeFile; +} + +/*! Returns whether the widget registered as \a id is a form. +*/ +bool WidgetDatabase::isForm( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isForm; +} + +/*! Returns whether the widget registered as \a id can have children. +*/ + +bool WidgetDatabase::isContainer( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isContainer || r->isForm; +} + +bool WidgetDatabase::isCommon( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isCommon; +} + +QString WidgetDatabase::createWidgetName( int id ) +{ + setupDataBase( id ); + QString n = className( id ); + if ( n == "QLayoutWidget" ) + n = "Layout"; + if ( n[ 0 ] == 'Q' && n[ 1 ].lower() != n[ 1 ] ) + n = n.mid( 1 ); + int colonColon = n.findRev( "::" ); + if ( colonColon != -1 ) + n = n.mid( colonColon + 2 ); + + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return n; + n += QString::number( ++r->nameCounter ); + n[0] = n[0].lower(); + return n; +} + +/*! Returns the id for \a name or -1 if \a name is unknown. + */ +int WidgetDatabase::idFromClassName( const QString &name ) +{ + setupDataBase( -1 ); + if ( name.isEmpty() ) + return 0; + int *i = className2Id->find( name ); + if ( i ) + return *i; + if ( name == "FormWindow" ) + return idFromClassName( "QLayoutWidget" ); +#ifdef UIC + setupDataBase( -2 ); + i = className2Id->find( name ); + if ( i ) + return *i; +#endif + return -1; +} + +bool WidgetDatabase::hasWidget( const QString &name ) +{ + return className2Id->find( name ) != 0; +} + +WidgetDatabaseRecord *WidgetDatabase::at( int index ) +{ + if ( index < 0 ) + return 0; + if ( index >= dbcustom && index < dbcustomcount ) + return db[ index ]; + if ( index < dbcount ) + return db[ index ]; + return 0; +} + +void WidgetDatabase::insert( int index, WidgetDatabaseRecord *r ) +{ + if ( index < 0 || index >= dbsize ) + return; + db[ index ] = r; + className2Id->insert( r->name, new int( index ) ); + if ( index < dbcustom ) + dbcount = QMAX( dbcount, index ); +} + +void WidgetDatabase::append( WidgetDatabaseRecord *r ) +{ + if ( !was_in_setup ) + setupDataBase( -1 ); + insert( dbcount++, r ); +} + +QString WidgetDatabase::widgetGroup( const QString &g ) +{ + if ( wGroups->find( g ) == -1 ) + wGroups->append( g ); + return g; +} + +bool WidgetDatabase::isGroupEmpty( const QString &grp ) +{ + WidgetDatabaseRecord *r = 0; + for ( int i = 0; i < dbcount; ++i ) { + if ( !( r = db[ i ] ) ) + continue; + if ( r->group == grp ) + return FALSE; + } + return TRUE; +} + +QString WidgetDatabase::widgetGroup( int i ) +{ + setupDataBase( -1 ); + if ( i >= 0 && i < (int)wGroups->count() ) + return wGroups->at( i ); + return QString::null; +} + +int WidgetDatabase::numWidgetGroups() +{ + setupDataBase( -1 ); + return wGroups->count(); +} + +bool WidgetDatabase::isGroupVisible( const QString &g ) +{ + setupDataBase( -1 ); + return invisibleGroups->find( g ) == -1; +} + +int WidgetDatabase::addCustomWidget( WidgetDatabaseRecord *r ) +{ + insert( dbcustomcount++, r ); + return dbcustomcount - 1; +} + +void WidgetDatabase::customWidgetClassNameChanged( const QString &oldName, + const QString &newName ) +{ + int id = idFromClassName( oldName ); + if ( id == -1 ) + return; + WidgetDatabaseRecord *r = db[ id ]; + r->name = newName; + className2Id->remove( oldName ); + className2Id->insert( newName, new int( id ) ); +} + +bool WidgetDatabase::isCustomWidget( int id ) +{ + if ( id >= dbcustom && id < dbcustomcount ) + return TRUE; + return FALSE; +} + +bool WidgetDatabase::isCustomPluginWidget( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isPlugin; +} + +bool WidgetDatabase::isWhatsThisLoaded() +{ + return whatsThisLoaded; +} + +void WidgetDatabase::loadWhatsThis( const QString &docPath ) +{ + QString whatsthisFile = docPath + "/whatsthis"; + QFile f( whatsthisFile ); + if ( !f.open( IO_ReadOnly ) ) + return; + QTextStream ts( &f ); + while ( !ts.atEnd() ) { + QString s = ts.readLine(); + QStringList l = QStringList::split( " | ", s ); + int id = idFromClassName( l[ 1 ] ); + WidgetDatabaseRecord *r = at( id ); + if ( r ) + r->whatsThis = l[ 0 ]; + } + whatsThisLoaded = TRUE; +} + + +// ### Qt 3.1: make these publically accessible via QWidgetDatabase API +#if defined(UIC) +bool dbnounload = FALSE; +QStringList *dbpaths = 0; +#else +extern QString *qwf_plugin_dir; +#endif + + +QPluginManager<WidgetInterface> *widgetManager() +{ + if ( !widgetPluginManager ) { + QString pluginDir = "/designer"; +#if !defined(UIC) + if ( qwf_plugin_dir ) + pluginDir = *qwf_plugin_dir; +#endif + widgetPluginManager = new QPluginManager<WidgetInterface>( IID_Widget, QApplication::libraryPaths(), pluginDir ); + cleanup_manager.add( &widgetPluginManager ); +#if defined(UIC) + if ( dbnounload ) + widgetPluginManager->setAutoUnload( FALSE ); + if ( dbpaths ) { + QStringList::ConstIterator it = dbpaths->begin(); + for ( ; it != dbpaths->end(); ++it ) + widgetPluginManager->addLibraryPath( *it ); + } +#endif + } + return widgetPluginManager; +} diff --git a/puic/widgetdatabase.h b/puic/widgetdatabase.h new file mode 100644 index 0000000..dee809d --- /dev/null +++ b/puic/widgetdatabase.h @@ -0,0 +1,90 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETDATABASE_H +#define WIDGETDATABASE_H + +#include <qiconset.h> +#include <qstring.h> +#include "widgetinterface.h" // up here for GCC 2.7.* compatibility +#include <private/qpluginmanager_p.h> + + +extern QPluginManager<WidgetInterface> *widgetManager(); + +struct WidgetDatabaseRecord +{ + WidgetDatabaseRecord(); + ~WidgetDatabaseRecord(); + QString iconSet, name, group, toolTip, whatsThis, includeFile; + uint isContainer : 1; + uint isForm : 1; + uint isCommon : 1; + uint isPlugin : 1; + QIconSet *icon; + int nameCounter; +}; + +class WidgetDatabase : public Qt +{ +public: + WidgetDatabase(); + static void setupDataBase( int id ); + static void setupPlugins(); + + static int count(); + static int startCustom(); + + static QIconSet iconSet( int id ); + static QString className( int id ); + static QString group( int id ); + static QString toolTip( int id ); + static QString whatsThis( int id ); + static QString includeFile( int id ); + static bool isForm( int id ); + static bool isContainer( int id ); + static bool isCommon( int id ); + + static int idFromClassName( const QString &name ); + static QString createWidgetName( int id ); + + static WidgetDatabaseRecord *at( int index ); + static void insert( int index, WidgetDatabaseRecord *r ); + static void append( WidgetDatabaseRecord *r ); + + static QString widgetGroup( const QString &g ); + static QString widgetGroup( int i ); + static int numWidgetGroups(); + static bool isGroupVisible( const QString &g ); + static bool isGroupEmpty( const QString &grp ); + + static int addCustomWidget( WidgetDatabaseRecord *r ); + static bool isCustomWidget( int id ); + static bool isCustomPluginWidget( int id ); + + static bool isWhatsThisLoaded(); + static void loadWhatsThis( const QString &docPath ); + + static bool hasWidget( const QString &name ); + static void customWidgetClassNameChanged( const QString &oldName, const QString &newName ); + +}; + +#endif diff --git a/puic/widgetinterface.h b/puic/widgetinterface.h new file mode 100644 index 0000000..bf6bcd5 --- /dev/null +++ b/puic/widgetinterface.h @@ -0,0 +1,29 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETINTERFACE_H +#define WIDGETINTERFACE_H + +#include <private/qwidgetinterface_p.h> + +#define WidgetInterface QWidgetFactoryInterface +#define IID_Widget IID_QWidgetFactory + +#endif diff --git a/smoke/Makefile.am b/smoke/Makefile.am new file mode 100644 index 0000000..49bd9d5 --- /dev/null +++ b/smoke/Makefile.am @@ -0,0 +1,6 @@ +SUBDIRS = qt + +include_HEADERS = smoke.h + +EXTRA_DIST=smoke.h Makefile.am + diff --git a/smoke/Makefile.in b/smoke/Makefile.in new file mode 100644 index 0000000..957c292 --- /dev/null +++ b/smoke/Makefile.in @@ -0,0 +1,573 @@ +# Makefile.in generated by automake 1.7.2 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 1.3 $ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_HAVE_GL = @KDE_HAVE_GL@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ +KDE_MT_LIBS = @KDE_MT_LIBS@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBRESOLV = @LIBRESOLV@ +LIBS = @LIBS@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBZ = @LIBZ@ +LIB_POLL = @LIB_POLL@ +LIB_QPE = @LIB_QPE@ +LIB_QT = @LIB_QT@ +LIB_X11 = @LIB_X11@ +LIB_XEXT = @LIB_XEXT@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MOC = @MOC@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +QTE_NORTTI = @QTE_NORTTI@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RPATH = @USE_RPATH@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +kde_includes = @kde_includes@ +kde_libraries = @kde_libraries@ +kde_qtver = @kde_qtver@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +qt_test_threshold = @qt_test_threshold@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ +SUBDIRS = qt + +include_HEADERS = smoke.h + +EXTRA_DIST = smoke.h Makefile.am +subdir = smoke +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(include_HEADERS) + + +#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ +#>- ps-recursive install-info-recursive uninstall-info-recursive \ +#>- all-recursive install-data-recursive install-exec-recursive \ +#>- installdirs-recursive install-recursive uninstall-recursive \ +#>- check-recursive installcheck-recursive +#>+ 5 +#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ +#>- ps-recursive install-info-recursive uninstall-info-recursive \ +#>- all-recursive install-data-recursive install-exec-recursive \ +#>- installdirs-recursive install-recursive uninstall-recursive \ +#>- check-recursive installcheck-recursive nmcheck-recursive +#>+ 5 +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive nmcheck-recursive bcheck-recursive +DIST_COMMON = README $(include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +#>- all: all-recursive +#>+ 1 +all: docs-am all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu smoke/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu smoke/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ + $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ + rm -f $(DESTDIR)$(includedir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(includedir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-includeHEADERS install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-info-am uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu smoke/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/Makefile.in + + +#>+ 5 +bcheck: bcheck-recursive + +bcheck-am: + + +#>+ 2 +final: + $(MAKE) all-am +#>+ 2 +final-install: + $(MAKE) install-am +#>+ 2 +no-final: + $(MAKE) all-am +#>+ 2 +no-final-install: + $(MAKE) install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/smoke/qt/Makefile.am b/smoke/qt/Makefile.am new file mode 100644 index 0000000..63e4ec8 --- /dev/null +++ b/smoke/qt/Makefile.am @@ -0,0 +1,17 @@ +lib_LTLIBRARIES = libsmokeqt.la + +# set the include path for X, qt and KDE +INCLUDES = -I$(srcdir)/.. $(all_includes) + +EXTRA_DIST=generate.pl.in qtguess.pl.in qt_smoke.h Makefile.am Makefile.in + +# the library search path. +libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH) + +# the libraries to link against. +libsmokeqt_la_LIBADD = $(LIB_QT) $(GL_LIBS) + +# which sources should be compiled for perlqtkde +libsmokeqt_la_SOURCES = smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp \ + x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp \ + x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp diff --git a/smoke/qt/Makefile.in b/smoke/qt/Makefile.in new file mode 100644 index 0000000..8fdbc30 --- /dev/null +++ b/smoke/qt/Makefile.in @@ -0,0 +1,684 @@ +# Makefile.in generated by automake 1.7.2 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 1.3 $ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_HAVE_GL = @KDE_HAVE_GL@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ +KDE_MT_LIBS = @KDE_MT_LIBS@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBRESOLV = @LIBRESOLV@ +LIBS = @LIBS@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBZ = @LIBZ@ +LIB_POLL = @LIB_POLL@ +LIB_QPE = @LIB_QPE@ +LIB_QT = @LIB_QT@ +LIB_X11 = @LIB_X11@ +LIB_XEXT = @LIB_XEXT@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MOC = @MOC@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +QTE_NORTTI = @QTE_NORTTI@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RPATH = @USE_RPATH@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +kde_includes = @kde_includes@ +kde_libraries = @kde_libraries@ +kde_qtver = @kde_qtver@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +qt_test_threshold = @qt_test_threshold@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ +lib_LTLIBRARIES = libsmokeqt.la + +# set the include path for X, qt and KDE +INCLUDES = -I$(srcdir)/.. $(all_includes) + +EXTRA_DIST = generate.pl.in qtguess.pl.in qt_smoke.h Makefile.am Makefile.in + +# the library search path. +#>- libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH) +#>+ 1 +libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(KDE_NO_UNDEFINED) $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH) + +# the libraries to link against. +libsmokeqt_la_LIBADD = $(LIB_QT) $(GL_LIBS) + +# which sources should be compiled for perlqtkde +libsmokeqt_la_SOURCES = smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp \ + x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp \ + x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp + +subdir = smoke/qt +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = qtguess.pl generate.pl +LTLIBRARIES = $(lib_LTLIBRARIES) + +libsmokeqt_la_DEPENDENCIES = +am_libsmokeqt_la_OBJECTS = smokedata.lo x_1.lo x_2.lo x_3.lo x_4.lo \ + x_5.lo x_6.lo x_7.lo x_8.lo x_9.lo x_10.lo x_11.lo x_12.lo \ + x_13.lo x_14.lo x_15.lo x_16.lo x_17.lo x_18.lo x_19.lo x_20.lo +#>- libsmokeqt_la_OBJECTS = $(am_libsmokeqt_la_OBJECTS) +#>+ 6 +libsmokeqt_la_final_OBJECTS = libsmokeqt_la.all_cpp.lo +libsmokeqt_la_nofinal_OBJECTS = smokedata.lo x_1.lo x_2.lo x_3.lo x_4.lo \ + x_5.lo x_6.lo x_7.lo x_8.lo x_9.lo x_10.lo x_11.lo x_12.lo \ + x_13.lo x_14.lo x_15.lo x_16.lo x_17.lo x_18.lo x_19.lo x_20.lo +@KDE_USE_FINAL_FALSE@libsmokeqt_la_OBJECTS = $(libsmokeqt_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libsmokeqt_la_OBJECTS = $(libsmokeqt_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo +#>+ 23 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libsmokeqt_la.all_cpp.P ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libsmokeqt_la_SOURCES) +DIST_COMMON = Makefile.am Makefile.in generate.pl.in qtguess.pl.in +SOURCES = $(libsmokeqt_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu smoke/qt/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu smoke/qt/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/qt/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +qtguess.pl: $(top_builddir)/config.status qtguess.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +generate.pl: $(top_builddir)/config.status generate.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +#>- libsmokeqt.la: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES) +#>+ 2 +@KDE_USE_CLOSURE_TRUE@libsmokeqt.la: libsmokeqt.la.closure $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES) +@KDE_USE_CLOSURE_FALSE@libsmokeqt.la: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libsmokeqt_la_LDFLAGS) $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smokedata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_10.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_11.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_12.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_13.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_14.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_15.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_16.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_17.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_18.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_19.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_20.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_6.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_7.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_9.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=header_list generate_makefile_am.pl + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-closures clean-final clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + + +#>+ 8 +libsmokeqt.la.closure: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES) + @echo "int main() {return 0;}" > libsmokeqt_la_closure.cpp + @$(LTCXXCOMPILE) -c libsmokeqt_la_closure.cpp + $(CXXLINK) libsmokeqt_la_closure.lo $(libsmokeqt_la_LDFLAGS) $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_LIBADD) $(LIBS) + @rm -f libsmokeqt_la_closure.* libsmokeqt.la.closure + @echo "timestamp" > libsmokeqt.la.closure + + +#>+ 3 +clean-closures: + -rm -f libsmokeqt.la.closure + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu smoke/qt/Makefile + cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/qt/Makefile.in + + +#>+ 9 +bcheck: bcheck-am + +bcheck-am: + test ! -r bchecktest.cc.class || mv -f bchecktest.cc.class bchecktest.cc.oldclass + @echo "int main() {return 0;}" > bchecktest.cc + for i in $(include_HEADERS); do echo "#include \"$$i\"" >> bchecktest.cc; done + test ! -s bchecktest.cc || $(CXXCOMPILE) --dump-class-hierarchy bchecktest.cc + test ! -s bchecktest.cc.oldclass || test ! -s bchecktest.cc.class || cmp -s bchecktest.cc.oldclass bchecktest.cc.class + +#>+ 11 +libsmokeqt_la.all_cpp.cpp: $(srcdir)/Makefile.in smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp + @echo 'creating libsmokeqt_la.all_cpp.cpp ...'; \ + rm -f libsmokeqt_la.all_cpp.files libsmokeqt_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libsmokeqt_la.all_cpp.final; \ + for file in smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp ; do \ + echo "#include \"$$file\"" >> libsmokeqt_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libsmokeqt_la.all_cpp.final; \ + done; \ + cat libsmokeqt_la.all_cpp.final libsmokeqt_la.all_cpp.files > libsmokeqt_la.all_cpp.cpp; \ + rm -f libsmokeqt_la.all_cpp.final libsmokeqt_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libsmokeqt_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/smoke/qt/generate.pl.in b/smoke/qt/generate.pl.in new file mode 100644 index 0000000..5f4a669 --- /dev/null +++ b/smoke/qt/generate.pl.in @@ -0,0 +1,153 @@ +#!/usr/bin/perl -w + +## Run this first, to generate the x_*.cpp files from the Qt headers +## using kalyptus + +my $kalyptusdir = "../../kalyptus"; + +use File::Basename; +use File::Copy qw|cp|; +use File::Compare; +use Cwd; + +my $here = getcwd; +my $outdir = $here . "/generate.pl.tmpdir"; +my $finaloutdir = $here; +my $defines = "qtdefines"; +my $headerlist = "header_list"; +my $definespath = "$here/$defines"; +my $headerlistpath = "$here/$headerlist"; + +## Note: outdir and finaloutdir should NOT be the same dir! + +# Delete all x_*.cpp files under outdir (or create outdir if nonexistent) +if (-d $outdir) { system "rm -f $outdir/x_*.cpp"; } else { mkdir $outdir; } + +mkdir $finaloutdir unless (-d $finaloutdir); + +# Load the QT_NO_* macros found in "qtdefines". They'll be passed to kalyptus +my $macros=""; +if ( -e $definespath ){ + print "Found '$defines'. Reading preprocessor symbols from there...\n"; + $macros = " --defines=$definespath "; +} + +# Need to cd to kalyptus's directory so that perl finds Ast.pm etc. +chdir "$kalyptusdir" or die "Couldn't go to $kalyptusdir (edit script to change dir)\n"; + +# Find out which header files we need to parse +# We don't want all of them - e.g. not template-based stuff +my %excludes = ( + 'qaccessible.h' => 1, # Accessibility support is not compiled by defaut + 'qassistantclient.h' => 1, # Not part of Qt (introduced in Qt-3.1) + 'qmotif.h' => 1, # + 'qmotifwidget.h' => 1, # Motif extension (introduced in Qt-3.1) + 'qmotifdialog.h' => 1, # + 'qxt.h' => 1, # Xt + 'qxtwidget.h' => 1, # Xt + 'qdns.h' => 1, # internal + 'qgl.h' => 1, # OpenGL + 'qglcolormap.h' => 1, # OpenGL + 'qnp.h' => 1, # NSPlugin + 'qttableview.h' => 1, # Not in Qt anymore... + 'qtmultilineedit.h' => 1, # Not in Qt anymore... + 'qwidgetfactory.h' => 1, # Just an interface + 'qsharedmemory.h' => 1, # "not part of the Qt API" they say + 'qwindowsstyle.h' => 1, # Qt windowsstyle, plugin + 'qmotifstyle.h' => 1, + 'qcompactstyle.h' => 1, + 'qinterlacestyle.h' => 1, + 'qmotifplusstyle.h' => 1, + 'qsgistyle.h' => 1, + 'qplatinumstyle.h' => 1, + 'qcdestyle.h' => 1, + 'qwindowsxpstyle.h' => 1 # play on the safe side +); + +# Some systems have a QTDIR = KDEDIR = PREFIX +# We need a complete list + +my %includes; +open(HEADERS, $headerlistpath) or die "Couldn't open $headerlistpath: $!\n"; +map { chomp ; $includes{$_} = 1 } <HEADERS>; +close HEADERS; + +# Can we compile the OpenGl module ? +if("@KDE_HAVE_GL@" eq "yes") +{ + open(DEFS, $definespath); + my @defs = <DEFS>; + close DEFS; + if(!grep(/QT_NO_OPENGL/, @defs)) + { + $excludes{'qgl.h'} = undef; + $excludes{'qglcolormap.h'} = undef; + } + else + { + print STDERR "Qt was not compiled with OpenGL support...\n Skipping QGL Classes.\n"; + } +} + +# List Qt headers, and exclude the ones listed above +my @headers = (); + +$qtinc= '@qt_includes@'; +opendir (QT, $qtinc) or die "Couldn't find $qtinc"; +foreach $filename (readdir(QT)) { + $entry = $qtinc."/".$filename; + if ( ( -e $entry or -l $entry ) # A real file or a symlink + && ( ! -d _ ) ) # Not a symlink to a dir though + { + push(@headers, $entry) + if ( !defined $excludes{$filename} # Not excluded + && $includes{$filename} # Known header + && $filename =~ /\.h$/ ); # Not a backup file etc. Only headers. + undef $includes{$filename} + } +} +closedir QT; + +# Launch kalyptus +system "perl kalyptus @ARGV --globspace -fsmoke --name=qt $macros --no-cache --outputdir=$outdir @headers"; +my $exit = $? >> 8; +exit $exit if ($exit); + +# Generate diff for smokedata.cpp +unless ( -e "$finaloutdir/smokedata.cpp" ) { + open( TOUCH, ">$finaloutdir/smokedata.cpp"); + close TOUCH; +} +system "diff -u $finaloutdir/smokedata.cpp $outdir/smokedata.cpp > $outdir/smokedata.cpp.diff"; + +# Copy changed or new files to finaloutdir +opendir (OUT, $outdir) or die "Couldn't opendir $outdir"; +foreach $filename (readdir(OUT)) { + next if ( -d "$outdir/$filename" ); # only files, not dirs + my $docopy = 1; + if ( -f "$finaloutdir/$filename" ) { + $docopy = compare("$outdir/$filename", "$finaloutdir/$filename"); # 1 if files are differents + } + if ($docopy) { + #print STDERR "Updating $filename...\n"; + cp("$outdir/$filename", "$finaloutdir/$filename"); + } +} +closedir OUT; + +# Check for deleted files and warn +my $deleted = 0; +opendir(FINALOUT, $finaloutdir) or die "Couldn't opendir $finaloutdir"; +foreach $filename (readdir(FINALOUT)) { + next if ( -d "$finaloutdir/$filename" ); # only files, not dirs + if ( $filename =~ /.cpp$/ && ! ($filename =~ /_la_closure.cpp/) && ! -f "$outdir/$filename" ) { + print STDERR "Removing obsolete file $filename\n"; + unlink "$finaloutdir/$filename"; + $deleted = 1; + } +} +closedir FINALOUT; + +# Delete outdir +system "rm -rf $outdir"; + diff --git a/smoke/qt/generate_makefile_am.pl b/smoke/qt/generate_makefile_am.pl new file mode 100755 index 0000000..49cdd49 --- /dev/null +++ b/smoke/qt/generate_makefile_am.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +use File::Basename; +use File::Copy qw|cp|; +use File::Compare; +use Cwd; + +my $here = getcwd; +my $outdir = $here; +my $tempfile = "$outdir/.Makefile.am.tmpfile"; + +# Update list of source files in $outdir/Makefile.am +open( MAKEFILE, "<$outdir/Makefile.am" ) or die; +my $makeFileData = ''; +my $found = 0; +while (<MAKEFILE>) { + if (/^libsmokeqt_la_SOURCES/) + { + $found = 1; + $makeFileData .= "libsmokeqt_la_SOURCES = smokedata.cpp"; + } + $makeFileData .= $_ if (!$found); +} +close MAKEFILE; + +die "libsmokeqt_la_SOURCES not found" if (!$found); + +open( MAKEFILE, ">$tempfile" ) or die; +print MAKEFILE $makeFileData; + +my $count = 0; +opendir (FILES, $outdir) or die; +foreach $filename (readdir(FILES)) { + if ( $filename =~ /^x_.*\.cpp$/ ) { + if ( $count++ == 7 ) { + $count = 0; + print MAKEFILE " \\\n"; + } + print MAKEFILE " $filename"; + } +} + +print MAKEFILE "\n"; +close MAKEFILE; +closedir FILES; + +if (compare("$tempfile", "$outdir/Makefile.am")) { + cp("$tempfile", "$outdir/Makefile.am"); + print STDERR "Makefile.am updated.\n"; +} +else { + print STDERR "Makefile.am unchanged.\n"; +} +unlink $tempfile; + +exit 0; diff --git a/smoke/qt/header_list b/smoke/qt/header_list new file mode 100644 index 0000000..9594c7d --- /dev/null +++ b/smoke/qt/header_list @@ -0,0 +1,350 @@ +q1xcompatibility.h +qabstractlayout.h +qaccel.h +qaccessible.h +qaction.h +qapp.h +qapplication.h +qarray.h +qasciicache.h +qasciidict.h +qassistantclient.h +qasyncimageio.h +qasyncio.h +qbig5codec.h +qbitarray.h +qbitarry.h +qbitmap.h +qbrush.h +qbttngrp.h +qbuffer.h +qbuttongroup.h +qbutton.h +qcache.h +qcanvas.h +qcdestyle.h +qcheckbox.h +qchkbox.h +qcleanuphandler.h +qclipboard.h +qclipbrd.h +qcollect.h +qcollection.h +qcolordialog.h +qcolor.h +qcombobox.h +qcombo.h +qcommonstyle.h +qcompactstyle.h +qconfig-dist.h +qconfig.h +qconnect.h +qconnection.h +qcstring.h +qcursor.h +qdatabrowser.h +qdatastream.h +qdatatable.h +qdataview.h +qdatetimeedit.h +qdatetime.h +qdatetm.h +qdeepcopy.h +qdesktopwidget.h +qdial.h +qdialog.h +qdict.h +qdir.h +qdns.h +qdockarea.h +qdockwindow.h +qdom.h +qdragobject.h +qdrawutil.h +qdrawutl.h +qdropsite.h +qdstream.h +qeditorfactory.h +qerrormessage.h +qeucjpcodec.h +qeuckrcodec.h +qevent.h +qeventloop.h +qfeatures.h +qfiledef.h +qfiledialog.h +qfiledlg.h +qfile.h +qfileinf.h +qfileinfo.h +qfocusdata.h +qfontdatabase.h +qfontdialog.h +qfontdta.h +qfont.h +qfontinf.h +qfontinfo.h +qfontmet.h +qfontmetrics.h +qframe.h +qftp.h +qgarray.h +qgb18030codec.h +qgbkcodec.h +qgcache.h +qgdict.h +qgeneric.h +qgif.h +qglcolormap.h +qgl.h +qglist.h +qglobal.h +qgplugin.h +qgrid.h +qgridview.h +qgroupbox.h +qgrpbox.h +qguardedptr.h +qgvector.h +qhbox.h +qhbuttongroup.h +qheader.h +qhgroupbox.h +qhostaddress.h +qhttp.h +qiconset.h +qiconview.h +qimageformatplugin.h +qimage.h +qinputdialog.h +qintcache.h +qintcach.h +qintdict.h +qinterlacestyle.h +qiodev.h +qiodevice.h +qjiscodec.h +qjpunicode.h +qkeycode.h +qkeysequence.h +qlabel.h +qlayout.h +qlcdnumber.h +qlcdnum.h +qlibrary.h +qlined.h +qlineedit.h +qlistbox.h +qlist.h +qlistview.h +qlocalfs.h +qmainwindow.h +qmap.h +qmemarray.h +qmenubar.h +qmenudata.h +qmenudta.h +qmessagebox.h +qmetaobject.h +qmetaobj.h +qmime.h +qmlined.h +qmodules.h +qmotifdialog.h +qmotif.h +qmotifplusstyle.h +qmotifstyle.h +qmotifwidget.h +qmovie.h +qmsgbox.h +qmultilinedit.h +qmultilineedit.h +qmutex.h +qnamespace.h +qnetwork.h +qnetworkprotocol.h +qobjcoll.h +qobjdefs.h +qobjectcleanuphandler.h +qobjectdefs.h +qobjectdict.h +qobject.h +qobjectlist.h +qpaintdc.h +qpaintdevicedefs.h +qpaintdevice.h +qpaintdevicemetrics.h +qpaintd.h +qpainter.h +qpair.h +qpalette.h +qpdevmet.h +qpen.h +qpicture.h +qpixmapcache.h +qpixmap.h +qplatinumstyle.h +qpmcache.h +qpntarry.h +qpointarray.h +qpoint.h +qpolygonscanner.h +qpopmenu.h +qpopupmenu.h +qprintdialog.h +qprinter.h +qprndlg.h +qprocess.h +qprogbar.h +qprogdlg.h +qprogressbar.h +qprogressdialog.h +qpsprn.h +qptrcollection.h +qptrdict.h +qptrlist.h +qptrqueue.h +qptrstack.h +qptrvector.h +qpushbt.h +qpushbutton.h +qqueue.h +qradiobt.h +qradiobutton.h +qrangecontrol.h +qrangect.h +qrect.h +qregexp.h +qregion.h +qremotefactory.h +qremoteplugin.h +qrtlcodec.h +qscopedptr.h +qscrbar.h +qscrollbar.h +qscrollview.h +qsemaphore.h +qsemimodal.h +qserversocket.h +qsession.h +qsessionmanager.h +qsettings.h +qsgistyle.h +qshared.h +qsignal.h +qsignalmapper.h +qsignalslotimp.h +qsimplerichtext.h +qsizegrip.h +qsize.h +qsizepolicy.h +qsjiscodec.h +qslider.h +qsocketdevice.h +qsocket.h +qsocketnotifier.h +qsocknot.h +qsortedlist.h +qsound.h +qspinbox.h +qsplashscreen.h +qsplitter.h +qsqlcursor.h +qsqldatabase.h +qsqldriver.h +qsqldriverplugin.h +qsqleditorfactory.h +qsqlerror.h +qsqlfield.h +qsqlform.h +qsql.h +qsqlindex.h +qsqlpropertymap.h +qsqlquery.h +qsqlrecord.h +qsqlresult.h +qsqlselectcursor.h +qstack.h +qstatusbar.h +qstring.h +qstringlist.h +qstrlist.h +qstrvec.h +qstylefactory.h +qstyle.h +qstyleplugin.h +qstylesheet.h +qsyntaxhighlighter.h +qtabbar.h +qtabdialog.h +qtabdlg.h +qtable.h +qtabwidget.h +qtextbrowser.h +qtextcodecfactory.h +qtextcodec.h +qtextcodecplugin.h +qtextedit.h +qtextstream.h +qtextview.h +qt.h +qthread.h +qtimer.h +qtl.h +qtmultilineedit.h +qtoolbar.h +qtoolbutton.h +qtoolbox.h +qtooltip.h +qtranslator.h +qtsciicodec.h +qtstream.h +qttableview.h +qurl.h +qurlinfo.h +qurloperator.h +qutfcodec.h +quuid.h +qvalidator.h +qvaluelist.h +qvaluestack.h +qvaluevector.h +qvariant.h +qvbox.h +qvbuttongroup.h +qvector.h +qvgroupbox.h +qwaitcondition.h +qwhatsthis.h +qwidcoll.h +qwidgetfactory.h +qwidget.h +qwidgetintdict.h +qwidgetlist.h +qwidgetplugin.h +qwidgetstack.h +qwindefs.h +qwindowdefs.h +qwindow.h +qwindowsstyle.h +qwizard.h +qwmatrix.h +qworkspace.h +qwsbeosdecoration_qws.h +qwscommand_qws.h +qwscursor_qws.h +qwsdecoration_qws.h +qwsdefaultdecoration_qws.h +qwsdisplay_qws.h +qwsevent_qws.h +qwshydrodecoration_qws.h +qwskde2decoration_qws.h +qwskdedecoration_qws.h +qwsmanager_qws.h +qwsmouse_qws.h +qwsproperty_qws.h +qwsregionmanager_qws.h +qwssocket_qws.h +qwsutils_qws.h +qwswindowsdecoration_qws.h +qxml.h diff --git a/smoke/qt/qt_smoke.h b/smoke/qt/qt_smoke.h new file mode 100644 index 0000000..22d8d23 --- /dev/null +++ b/smoke/qt/qt_smoke.h @@ -0,0 +1,9 @@ +#ifndef QT_SMOKE_H +#define QT_SMOKE_H + +// Defined in smokedata.cpp, initialized by init_qt_Smoke(), used by all .cpp files +extern Smoke* qt_Smoke; + +class QGlobalSpace { }; + +#endif diff --git a/smoke/qt/qtguess.pl.in b/smoke/qt/qtguess.pl.in new file mode 100644 index 0000000..a5fc6b2 --- /dev/null +++ b/smoke/qt/qtguess.pl.in @@ -0,0 +1,501 @@ +#!/usr/bin/perl + +# qtguess.pl : check how Qt was compiled. Issue a list of all defined QT_NO_* macros, one per line. +# +# author: germain Garand <germain@ebooksfrance.com> +# licence: GPL v.2 + +# options: -q: be quieter +# -o file: redirect output to "file". (default: ./qtdefines) +# -t [0..15]: set the testing threshold (see below) +# -f "flags": additional compiler flags/parameters + +use Getopt::Std; + +use vars qw/$opt_f $opt_o $opt_p/; + +getopts('qo:f:t:'); + +# Threshold : +# 0 - test basic Qt types/classes +# 5 - test higher level, non-gui classes +# 8 - test options of the above (ex: QT_NO_IMAGE_SMOOTHSCALE) +# 10 - test basic widgets +# 12 - test composite widgets +# 13 - test widgets inheriting composite widgets +# 15 - test goodies (default) + +my $default_threshold = @qt_test_threshold@; +my $cc = "@CXX@"; +my $ccflags = $opt_f || "@CXXFLAGS@"; + +my $nspaces = 50; + +my %qtdefs=(); +my %qtundefs=(); + +my $tmp = gettmpfile(); +my $qtinc = '@qt_includes@'; +my $allinc = '@all_includes@'; +my $alllib = '@all_libraries@'; +my $qtflags ='@LIB_QT@'; +my %x; +$x{'LIBPNG'} = '@LIBPNG@'; +$x{'LIBJPEG'} = '@LIBJPEG@'; +$x{'LIBSM'} = '@LIBSM@'; +$x{'LIBSOCKET'} = '@LIBSOCKET@'; +$x{'LIBDL'} = '@LIBDL@'; +$x{'LIBRESOLV'} = '@LIBRESOLV@'; +$x{'LIB_X11'} = '@LIB_X11@'; +$x{'X_PRE_LIBS'} = '@X_PRE_LIBS@'; +$x{'LIB_X11'} =~ s/\$\((.*?)\)/$x{$1}/g; + +$qtflags =~ s/\$\((.*?)\)/$x{$1}/g; + + -e "$qtinc/qglobal.h" or die "Invalid Qt directory.\n"; + +my $ccmd = "$cc $ccflags $allinc $alllib -o $tmp $tmp.cpp $qtflags"; + +my $threshold = defined($opt_t)?$opt_t : $default_threshold; +$threshold >= 0 or die "invalid testing threshold: $threshold\n"; + +print "Checking how Qt was built... \n"; +print "Threshold is set to $threshold\n" unless $opt_q; + +my($count, $used, $total); +map{ $tests{$_}->[2]>=$threshold ? ($used++, $total++):$total++ } keys %tests; + +print "Number of defines to be tested : $used/$total\n\n" unless $opt_q; +open( QTDEFS, ">".($opt_o || "qtdefines") ) or die "Can't open output file: $!\n"; + +grab_qglobal_symbols(); +preliminary_test(); +perform_all_tests(); + +print +scalar(keys %qtdefs) . " defines found.\n"; + +print QTDEFS join("\n", keys %qtdefs), "\n"; +close; + +#--------------------------------------------------------------# + +sub gettmpfile +{ + my $tmpdir = $ENV{'TMP'} || "."; + my $tmpname = $$."-qtguess"; + while( -e "$tmpdir/$tmpname" || -e "$tmpdir/${tmpname}.cpp" ) + { + $tmpname .= int (rand * 9); + } + return "$tmpdir/$tmpname"; +} + +#--------------------------------------------------------------# + +sub grab_qglobal_symbols +{ + my $cmd = "$cc -E -D__cplusplus -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null"; + my $symbols = `$cmd`; + for(0..1) + { + if( check_exit_status($?) ) + { + while( $symbols =~/^#\s*define\s*(QT_\S+)/gm ) + { + $qtdefs{$1} = 1; + } + print "Found ". scalar( keys %qtdefs )." predefined symbol".((scalar( keys %qtdefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtdefs)); + while( $symbols =~/^#\s*define\s*QT_MODULE_(\S+)/gm ) + { + $qtundefs{"QT_NO_$1"} = 1; + } + print "Found ". scalar( keys %qtundefs )." undefined symbol".((scalar( keys %qtundefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtundefs)); + last; + } + elsif(! $_) # first try + { + print "Failed to run $cmd.\nTrying without __cplusplus (might be already defined)\n"; + $cmd = "$cc -E -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null"; + $symbols = `$cmd`; + next; + } + } +} + +#--------------------------------------------------------------# + +sub preliminary_test +{ + my $msg = "Trying to compile and link a small program..."; + print $msg, " " x ($nspaces - length($msg) + 8); + open( OUT, ">${tmp}.cpp" ) or die "Failed to open temp file ${tmp}.cpp: $!\n"; + my $simple=q£ + #include <qapplication.h> + int main( int argc, char **argv ) + { + QApplication foo( argc, argv ); + return 0; + } + £; + print OUT $simple; + close OUT; + my $out = `$ccmd 2>&1`; + if( !check_exit_status($?) ) + { + die <<"EOF"; + +FAILED : check your configuration. +Failed program was: +$simple +Compiled with: +$ccmd +Compiler output: +$out +EOF + } + else + { + print "OK\n"; + } +} + +#--------------------------------------------------------------# + +sub perform_all_tests +{ + foreach ( sort { $tests{$a}->[2] <=> $tests{$b}->[2]} keys %tests) + { + $tests{$_}->[2] < $threshold and next; + ($qtdefs{$_} || $qtundefs{$_}) and do + { + print "\rSkipping $_ (in qglobal.h)".( " " x (($nspaces-16) - length($_)) ).($qtundefs{$_}?"*Undefined*":" [Defined]").($opt_q?"":"\n"); + next + }; + print "\rTesting $_".( " " x ($nspaces - length($_)) ); + open( OUT, ">${tmp}.cpp" ) or die "Failed to open temp file ${tmp}.cpp: $!\n"; + foreach $def(keys %qtdefs) + { + print OUT "#define $def\n"; + } + foreach $inc(split /,\s*/, $tests{$_}->[0]) + { + print OUT "#include <$inc>\n"; + } + print OUT "#include <qfeatures.h>\n"; + print OUT $tests{$_}->[3] if $tests{$_}->[3]; # need to define some classes ? + print OUT qq£ + + int main( int argc, char **argv ) + { + $tests{$_}->[1] + return 0; + } + £; + close OUT; + + my $out = `$ccmd 2>&1`; + + my $ok = check_exit_status($?); + if( !$ok ) + { + $qtdefs{$_} = 1; + } + print +$opt_q ? ++$count."/$used" : ( $ok ? "*Undefined*\n" : " [Defined]\n" ); + } + $opt_q && print "\n"; +} + +#--------------------------------------------------------------# + +sub check_exit_status +{ + my $a = 0xFFFF & shift; + if( !$a ) + { + return 1; + } + elsif( $a == 0xFF00 ) + { + die "\nSystem call failed: $!\n"; + } + elsif( $a > 0x80 ) + { + # non-zero status. + } + else + { + if( $a & 0x80 ) + { + die "\n$cc coredumped with signal ". ($a & ~0x80); + } + die "\n$cc interrupted by signal $a\n"; + } + return 0; +} + +#--------------------------------------------------------------# + +END +{ + unlink $tmp if -e $tmp; + unlink "${tmp}.cpp" if -e "${tmp}.cpp"; +} + +#--------------------------------------------------------------# + +BEGIN { + +# "DEFINE" => ["header-1.h,... header-n.h", "main() code", priority, "Definitions (if needed)"] + +our %tests = ( + "QT_NO_ACCEL" => ["qaccel.h", "QAccel foo( (QWidget*)NULL );", 5], + "QT_NO_ACTION" => ["qaction.h", "QAction foo( (QObject*)NULL );", 5], + "QT_NO_ASYNC_IO" => ["qasyncio.h", "QAsyncIO foo();", 5], + "QT_NO_ASYNC_IMAGE_IO"=> ["qasyncimageio.h", "QImageDecoder foo( (QImageConsumer*) NULL );", 5], + "QT_NO_BIG_CODECS" => ["qbig5codec.h", "QBig5Codec foo();", 5], + "QT_NO_BUTTON" => ["qbutton.h", "QButton foo( (QWidget*)NULL );", 10], + "QT_NO_BUTTONGROUP" => ["qbuttongroup.h", "QButtonGroup foo( (QWidget*)NULL );", 12], + "QT_NO_CANVAS" => ["qcanvas.h", "QCanvas foo( (QObject*)NULL );", 10], + "QT_NO_CHECKBOX" => ["qcheckbox.h", "QCheckBox( (QWidget*)NULL );", 10], + "QT_NO_CLIPBOARD" => ["qapplication.h, qclipboard.h", q£ + QApplication foo( argc, argv ); + QClipboard *baz= foo.clipboard(); + £, 5], + "QT_NO_COLORDIALOG" => ["qcolordialog.h", "QColorDialog::customCount();", 12], + "QT_NO_COMBOBOX" => ["qcombobox.h", "QComboBox( (QWidget*)NULL );", 10], + "QT_NO_COMPAT" => ["qfontmetrics.h", q£ + QFontMetrics *foo= new QFontMetrics( QFont() ); + int bar = foo->width( 'c' ); + £, 0], + "QT_NO_COMPONENT" => ["qapplication.h", q£ + QApplication foo( argc, argv ); + foo.addLibraryPath( QString::null ); + £, 5], + "QT_NO_CURSOR" => ["qcursor.h", "QCursor foo;", 5], + "QT_NO_DATASTREAM" => ["qdatastream.h", "QDataStream foo;", 5], + "QT_NO_DATETIMEEDIT" => ["qdatetimeedit.h", "QTimeEdit foo;", 12], + "QT_NO_DIAL" => ["qdial.h", "QDial foo;", 10], + "QT_NO_DIALOG" => ["qdialog.h", "QDialog foo;", 12], + "QT_NO_DIR" => ["qdir.h", "QDir foo;", 5], + "QT_NO_DNS" => ["qdns.h", "QDns foo;", 5], + "QT_NO_DOM" => ["qdom.h", "QDomDocumentType foo;", 5], + "QT_NO_DRAGANDDROP" => ["qevent.h", "QDropEvent foo( QPoint(1,1) );", 5], + "QT_NO_DRAWUTIL" => ["qdrawutil.h, qcolor.h", "qDrawPlainRect( (QPainter *) NULL, 0, 0, 0, 0, QColor() );", 10], + "QT_NO_ERRORMESSAGE" => ["qerrormessage.h", "QErrorMessage foo( (QWidget*) NULL );", 13], + "QT_NO_FILEDIALOG" => ["qfiledialog.h", "QFileIconProvider foo;", 13], + + "QT_NO_FONTDATABASE" => ["qfontdatabase.h", "QFontDatabase foo;", 5], + "QT_NO_FONTDIALOG" => ["qfontdialog.h", "QFontDialog::getFont( (bool *)NULL );", 12], + "QT_NO_FRAME" => ["qframe.h", "QFrame foo;", 10], + "QT_NO_GRID" => ["qgrid.h", "QGrid foo(5);", 12], + "QT_NO_GRIDVIEW" => ["qgridview.h", "QFoo foo;", 13, q£ + class QFoo: public QGridView + { + public: + QFoo(){}; + ~QFoo(){}; + void paintCell(QPainter *, int, int){}; + }; + £], + "QT_NO_GROUPBOX" => ["qgroupbox.h", "QGroupBox foo;", 12], + "QT_NO_HBOX" => ["qhbox.h", "QHBox foo;", 12], + "QT_NO_HBUTTONGROUP" => ["qhbuttongroup.h", "QHButtonGroup foo;", 13], + "QT_NO_HEADER" => ["qheader.h", "QHeader foo;", 10], + "QT_NO_HGROUPBOX" => ["qhgroupbox.h", "QHGroupBox foo;", 13], + "QT_NO_ICONSET" => ["qiconset.h", "QIconSet foo;", 8], + + "QT_NO_ICONVIEW" => ["qiconview.h", "QIconView foo;", 13], + "QT_NO_IMAGEFORMATPLUGIN" => ["qimageformatplugin.h, qstringlist.h", "QFoo foo;", 5, q£ + + class QFoo: public QImageFormatPlugin + { + public: + QFoo() {}; + ~QFoo() {}; + QStringList keys() const { return QStringList(); }; + bool installIOHandler( const QString &format ) { return true; }; + }; + Q_EXPORT_PLUGIN( QFoo ) + £], + "QT_NO_IMAGE_DITHER_TO_1" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->createAlphaMask(); + £, 8], + "QT_NO_IMAGE_HEURISTIC_MASK" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->createHeuristicMask(); + £, 8], + "QT_NO_IMAGE_MIRROR" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->mirror(); + £, 8], + "QT_NO_IMAGE_SMOOTHSCALE" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->smoothScale( 10, 10); + £, 8], + "QT_NO_IMAGE_TEXT" => ["qimage.h", "QImageTextKeyLang foo;", 8], + "QT_NO_IMAGE_TRANSFORMATION" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->scale( 10, 10); + £, 8], + "QT_NO_IMAGE_TRUECOLOR" => ["qimage.h", q£ + QImage *foo = new QImage; + foo->convertDepthWithPalette( 1, (QRgb*) NULL, 1 ); + £, 8], + "QT_NO_INPUTDIALOG" => ["qinputdialog.h, qstring.h", q£QInputDialog::getText( QString::null, QString::null);£, 13], + "QT_NO_IMAGEIO" => ["qbitmap.h, qstring.h", q£ + QBitmap foo( QString::fromLatin1("foobar") ); + £, 5], + "QT_NO_IMAGEIO_JPEG" => ["qjpegio.h", "qInitJpegIO();", 8], + "QT_NO_IMAGEIO_MNG" => ["qmngio.h", "qInitMngIO();", 8], + "QT_NO_IMAGEIO_PNG" => ["qpngio.h", "qInitPngIO();", 8], + "QT_NO_LABEL" => ["qlabel.h", "QLabel foo( (QWidget*) NULL );", 10], + "QT_NO_LAYOUT" => ["qlayout.h", "QFoo foo;", 10, q£ + + class QFoo: public QLayout + { + public: + QFoo() {}; + ~QFoo() {}; + void addItem( QLayoutItem * ) { }; + QSize sizeHint() const { return QSize(); } + QLayoutIterator iterator() { return QLayoutIterator( (QGLayoutIterator *) NULL ); }; + void setGeometry( const QRect & ) { }; + }; + £], + "QT_NO_LCDNUMBER" => ["qlcdnumber.h", "QLCDNumber foo;", 12], + "QT_NO_LINEEDIT" => ["qlineedit.h", "QLineEdit foo( (QWidget *) NULL );", 12], + "QT_NO_LISTBOX" => ["qlistbox.h", "QListBox foo;", 13], + "QT_NO_LISTVIEW" => ["qlistview.h", "QListView foo;", 13], + "QT_NO_MAINWINDOW" => ["qmainwindow.h", "QMainWindow foo;", 13], + "QT_NO_MENUBAR" => ["qmenubar.h", "QMenuBar foo;", 13], + "QT_NO_MOVIE" => ["qmovie.h", "QMovie foo;", 5], + "QT_NO_MENUDATA" => ["qmenudata.h", "QMenuData foo;", 9], + "QT_NO_MESSAGEBOX" => ["qmessagebox.h", "QMessageBox foo;", 13], + "QT_NO_MIME" => ["qmime.h", "QMimeSourceFactory foo;", 5], + "QT_NO_MIMECLIPBOARD" => ["qapplication.h, qclipboard.h", q£ + QApplication foo( argc, argv ); + QClipboard *baz= foo.clipboard(); + baz->data(); + £, 8], + + "QT_NO_MULTILINEEDIT" => ["qmultilineedit.h", "QMultiLineEdit foo;", 14], + "QT_NO_NETWORK" => ["qnetwork.h", "qInitNetworkProtocols();", 5], + "QT_NO_NETWORKPROTOCOL" => ["qnetworkprotocol.h", "QNetworkProtocol foo;", 8], + "QT_NO_NETWORKPROTOCOL_FTP" => ["qftp.h", "QFtp foo;", 9], + "QT_NO_PALETTE" => ["qpalette.h", "QColorGroup foo;", 5], + "QT_NO_PICTURE" => ["qpicture.h", "QPicture foo;", 5], + "QT_NO_PIXMAP_TRANSFORMATION" =>["qbitmap.h, qwmatrix.h", q£ + QBitmap *foo= new QBitmap(); + QWMatrix bar; + foo->xForm( bar ); + £, 5], + "QT_NO_POPUPMENU" => ["qpopupmenu.h", "QPopupMenu foo;", 12], + "QT_NO_PRINTER" => ["qprinter.h", "QPrinter foo;", 5], + "QT_NO_PRINTDIALOG" => ["qprintdialog.h", "QPrintDialog foo( (QPrinter*) NULL );", 13], + "QT_NO_PROCESS" => ["qprocess.h", "QProcess foo;", 5], + "QT_NO_PROGRESSBAR" => ["qprogressbar.h", "QProgressBar foo;", 12], + "QT_NO_PROGRESSDIALOG" => ["qprogressdialog.h", "QProgressDialog foo;", 13], + "QT_NO_PUSHBUTTON" => ["qpushbutton.h", "QPushButton foo( (QWidget *) NULL );", 12], + "QT_NO_PROPERTIES" => ["qmetaobject.h", "QMetaProperty foo;", 0], +# "QT_NO_QTMULTILINEEDIT" => ["qtmultilineedit.h", "QtMultiLineEdit foo;", 15], +# "QT_NO_QTTABLEVIEW" => ["qttableview.h", "QFoo foo;", 16, q£ +# class QFoo: public QtTableView +# { +# public: +# QFoo() {}; +# ~QFoo() {}; +# void paintCell( QPainter *, int, int) {}; +# }; +# £], + "QT_NO_QUUID_STRING" => ["quuid.h", "QUuid foo( QString::null );", 8], + "QT_NO_RANGECONTROL" => ["qrangecontrol.h", "QRangeControl foo;", 10], + "QT_NO_REGEXP" => ["qregexp.h", "QRegExp foo;", 5], + "QT_NO_REGEXP_WILDCARD" => ["qregexp.h", q£ + QRegExp foo; + foo.wildcard(); + £, 8], + "QT_NO_REMOTE" => ["qapplication.h", q£ + QApplication foo( argc, argv ); + foo.remoteControlEnabled(); + £, 15], + "QT_NO_RADIOBUTTON" => ["qradiobutton.h", "QRadioButton foo( (QWidget *) NULL );", 12], + "QT_NO_RICHTEXT" => ["qsimplerichtext.h, qstring.h, qfont.h", "QSimpleRichText foo( QString::null, QFont() );", 10], + "QT_NO_SCROLLBAR" => ["qscrollbar.h", "QScrollBar foo( (QWidget *) NULL );", 12], + "QT_NO_SCROLLVIEW" => ["qscrollview.h", "QScrollView foo;", 12], + "QT_NO_SEMIMODAL" => ["qsemimodal.h", "QSemiModal foo;", 10], + "QT_NO_SESSIONMANAGER" => ["qapplication.h", q£ + QApplication foo( argc, argv ); + foo.sessionId(); + £, 15], + "QT_NO_SETTINGS" => ["qsettings.h", "QSettings foo;", 5], + "QT_NO_SIGNALMAPPER" => ["qsignalmapper.h", "QSignalMapper foo( (QObject *) NULL );", 0], + "QT_NO_SIZEGRIP" => ["qsizegrip.h", "QSizeGrip foo( (QWidget *) NULL );", 10], + "QT_NO_SLIDER" => ["qslider.h", "QSlider foo( (QWidget *) NULL );", 12], + "QT_NO_SOUND" => ["qsound.h", "QSound foo( QString::null );", 5], + + + "QT_NO_SPINWIDGET" => ["qrangecontrol.h", "QSpinWidget foo;", 10], + "QT_NO_SPRINTF" => ["qcolor.h", q£ + QColor foo; + foo.name(); + £, 0], + + + + "QT_NO_SQL" => ["qsqlcursor.h", "QSqlCursor foo;", 5], + "QT_NO_STRINGLIST" => ["qstringlist.h", "QStringList foo;", 0], + "QT_NO_STYLE" => ["qapplication.h", q£ + QApplication foo( argc, argv ); + foo.style(); + £, 15], + +# "QT_NO_STYLE_CDE" => ["qcdestyle.h", "QCDEStyle foo;", 16], +# "QT_NO_STYLE_COMPACT" => ["qcompactstyle.h", "QCompactStyle foo;", 16], +# "QT_NO_STYLE_INTERLACE" => ["qinterlacestyle.h", "QInterlaceStyle foo;", 16], +# "QT_NO_STYLE_PLATINUM" => ["qplatinumstyle.h", "QPlatinumStyle foo;", 16], +# "QT_NO_STYLE_MOTIF" => ["qmotifstyle.h", "QMotifStyle foo;", 16], +# "QT_NO_STYLE_MOTIFPLUS" => ["qmotifplusstyle.h", "QMotifPlusStyle foo;", 16], +# "QT_NO_STYLE_SGI" => ["qsgistyle.h", "QSGIStyle foo;", 16], +# "QT_NO_STYLE_WINDOWS" => ["qwindowsstyle.h", "QWindowsStyle foo;", 16], + "QT_NO_TABBAR" => ["qtabbar.h", "QTabBar foo;", 10], + "QT_NO_TABDIALOG" => ["qtabdialog.h", "QTabDialog foo;", 12], + "QT_NO_TABLE" => ["qtable.h", "QTable foo;", 10], + "QT_NO_TABWIDGET" => ["qtabwidget.h", "QTabWidget foo;", 10], + "QT_NO_TEXTBROWSER" => ["qtextbrowser.h", "QTextBrowser foo;", 14], + "QT_NO_TEXTCODEC" => ["qtextcodec.h", "QTextCodec::codecForIndex(1);", 5], + "QT_NO_TEXTCODECPLUGIN" => ["qtextcodecplugin.h, qstringlist.h, qvaluelist.h, qtextcodec.h", "QFoo foo;", 6, q£ + + class QFoo: public QTextCodecPlugin + { + public: + QFoo() {}; + ~QFoo() {}; + QStringList names() const {return QStringList();} + QValueList<int>mibEnums() const {return QValueList<int>();} + QTextCodec *createForName( const QString & name ) {return (QTextCodec *)NULL;} + QTextCodec *createForMib( int mib ) {return (QTextCodec *)NULL;} + }; + Q_EXPORT_PLUGIN( QFoo ) + £], + "QT_NO_TEXTEDIT" => ["qtextedit.h", "QTextEdit foo;", 13], + "QT_NO_TEXTSTREAM" => ["qtextstream.h", "QTextStream foo;", 5], + "QT_NO_TEXTVIEW" => ["qtextview.h", "QTextView foo;", 14], #Obsolete + "QT_NO_TOOLBAR" => ["qtoolbar.h", "QToolBar foo;", 10], + "QT_NO_TOOLBUTTON" => ["qtoolbutton.h", "QToolButton foo((QWidget *) NULL );", 12], + "QT_NO_TOOLTIP" => ["qtooltip.h", "QToolTip::hide();", 10], + + "QT_NO_TRANSFORMATIONS" => ["qpainter.h", q£ + QPainter *foo= new QPainter(); + foo->setViewXForm( true );£, 5], + "QT_NO_VARIANT" => ["qvariant.h", "QVariant foo;", 0], + "QT_NO_WHATSTHIS" => ["qwhatsthis.h", "QWhatsThis::inWhatsThisMode();", 10], + "QT_NO_WHEELEVENT" => ["qevent.h", "QWheelEvent foo( QPoint(1,1), 1, 1 );", 5], + "QT_NO_WIDGET_TOPEXTRA" => ["qwidget.h", "QWidget foo; foo.caption();", 9], + "QT_NO_WIDGETSTACK" => ["qwidgetstack.h", "QWidgetStack foo;", 13], + "QT_NO_WIZARD" => ["qwizard.h", "QWizard foo;", 13], + "QT_NO_WMATRIX" => ["qwmatrix.h", "QWMatrix foo;", 0], + "QT_NO_XML" => ["qxml.h", "QXmlNamespaceSupport foo;", 5], + ); + +} diff --git a/smoke/smoke.h b/smoke/smoke.h new file mode 100644 index 0000000..91acea8 --- /dev/null +++ b/smoke/smoke.h @@ -0,0 +1,353 @@ +#ifndef SMOKE_H +#define SMOKE_H + +#include <string.h> + +/* + * Copyright (C) 2002, Ashley Winters <qaqortog@nwlink.com> + */ + +class SmokeBinding; + +class Smoke { +public: + union StackItem; // defined below + /** + * A stack is an array of arguments, passed to a method when calling it. + */ + typedef StackItem* Stack; + + enum EnumOperation { + EnumNew, + EnumDelete, + EnumFromLong, + EnumToLong + }; + + typedef short Index; + typedef void (*ClassFn)(Index method, void* obj, Stack args); + typedef void* (*CastFn)(void* obj, Index from, Index to); + typedef void (*EnumFn)(EnumOperation, Index, void*&, long&); + + enum ClassFlags { + cf_constructor = 0x01, // has a constructor + cf_deepcopy = 0x02, // has copy constructor + cf_virtual = 0x04, // has virtual destructor + cf_undefined = 0x10 // defined elsewhere + }; + /** + * Describe one class. + */ + struct Class { + const char *className; // Name of the class + Index parents; // Index into inheritanceList + ClassFn classFn; // Calls any method in the class + EnumFn enumFn; // Handles enum pointers + unsigned short flags; // ClassFlags + }; + + enum MethodFlags { + mf_static = 0x01, + mf_const = 0x02 + }; + /** + * Describe one method of one class. + */ + struct Method { + Index classId; // Index into classes + Index name; // Index into methodNames; real name + Index args; // Index into argumentList + unsigned char numArgs; // Number of arguments + unsigned char flags; // MethodFlags (const/static/etc...) + Index ret; // Index into types for the return type + Index method; // Passed to Class.classFn, to call method + }; + + /** + * One MethodMap entry maps the munged method prototype + * to the Method entry. + * + * The munging works this way: + * $ is a plain scalar + * # is an object + * ? is a non-scalar (reference to array or hash, undef) + * + * e.g. QApplication(int &, char **) becomes QApplication$? + */ + struct MethodMap { + Index classId; // Index into classes + Index name; // Index into methodNames; munged name + Index method; // Index into methods + }; + + enum TypeFlags { + // The first 4 bits indicate the TypeId value, i.e. which field + // of the StackItem union is used. + tf_elem = 0x0F, + + // Always only one of the next three flags should be set + tf_stack = 0x10, // Stored on the stack, 'type' + tf_ptr = 0x20, // Pointer, 'type*' + tf_ref = 0x30, // Reference, 'type&' + // Can | whatever ones of these apply + tf_const = 0x40 // const argument + }; + /** + * One Type entry is one argument type needed by a method. + * Type entries are shared, there is only one entry for "int" etc. + */ + struct Type { + const char *name; // Stringified type name + Index classId; // Index into classes. -1 for none + unsigned short flags; // TypeFlags + }; + + // We could just pass everything around using void* (pass-by-reference) + // I don't want to, though. -aw + union StackItem { + void* s_voidp; + bool s_bool; + char s_char; + unsigned char s_uchar; + short s_short; + unsigned short s_ushort; + int s_int; + unsigned int s_uint; + long s_long; + unsigned long s_ulong; + float s_float; + double s_double; + long s_enum; + void* s_class; + }; + enum TypeId { + t_voidp, + t_bool, + t_char, + t_uchar, + t_short, + t_ushort, + t_int, + t_uint, + t_long, + t_ulong, + t_float, + t_double, + t_enum, + t_class, + t_last // number of pre-defined types + }; + + // Passed to constructor + /** + * The classes array defines every class for this module + */ + Class *classes; + Index numClasses; + + /** + * The methods array defines every method in every class for this module + */ + Method *methods; + Index numMethods; + + /** + * methodMaps maps the munged method prototypes + * to the methods entries. + */ + MethodMap *methodMaps; + Index numMethodMaps; + + /** + * Array of method names, for Method.name and MethodMap.name + */ + const char **methodNames; + Index numMethodNames; + + /** + * List of all types needed by the methods (arguments and return values) + */ + Type *types; + Index numTypes; + + /** + * Groups of class IDs (-1 separated) used as super class lists. + * For classes with super classes: Class.parents = index into this array. + */ + Index *inheritanceList; + /** + * Groups of type IDs (-1 separated), describing the types of argument for a method. + * Method.args = index into this array. + */ + Index *argumentList; + /** + * Groups of method prototypes with the same number of arguments, but different types. + * Used to resolve overloading. + */ + Index *ambiguousMethodList; + /** + * Function used for casting from/to the classes defined by this module. + */ + CastFn castFn; + + // Not passed to constructor + SmokeBinding *binding; + + /** + * Constructor + */ + Smoke(Class *_classes, Index _numClasses, + Method *_methods, Index _numMethods, + MethodMap *_methodMaps, Index _numMethodMaps, + const char **_methodNames, Index _numMethodNames, + Type *_types, Index _numTypes, + Index *_inheritanceList, + Index *_argumentList, + Index *_ambiguousMethodList, + CastFn _castFn) : + classes(_classes), numClasses(_numClasses), + methods(_methods), numMethods(_numMethods), + methodMaps(_methodMaps), numMethodMaps(_numMethodMaps), + methodNames(_methodNames), numMethodNames(_numMethodNames), + types(_types), numTypes(_numTypes), + inheritanceList(_inheritanceList), + argumentList(_argumentList), + ambiguousMethodList(_ambiguousMethodList), + castFn(_castFn), + + binding(0) + {} + + inline void *cast(void *ptr, Index from, Index to) { + if(!castFn) return ptr; + return (*castFn)(ptr, from, to); + } + + // return classname directly + inline const char *className(Index classId) { + return classes[classId].className; + } + + inline int leg(Index a, Index b) { // ala Perl's <=> + if(a == b) return 0; + return (a > b) ? 1 : -1; + } + + inline Index idType(const char *t) { + if(!t) return 0; + Index imax = numTypes; + Index imin = 0; + Index icur = -1; + int icmp = -1; + + while(imax >= imin) { + icur = (imin + imax) / 2; + if(icur > 0) + icmp = strcmp(types[icur].name, t); + else + icmp = -1; + if(!icmp) break; + if(icmp > 0) + imax = icur - 1; + else + imin = icur + 1; + } + + return (!icmp) ? icur : 0; + } + + inline Index idClass(const char *c) { + if(!c) return 0; + Index imax = numClasses; + Index imin = 0; + Index icur = -1; + int icmp = -1; + + while(imax >= imin) { + icur = (imin + imax) / 2; + if(icur > 0) + icmp = strcmp(classes[icur].className, c); + else + icmp = -1; + if(!icmp) break; + if(icmp > 0) + imax = icur - 1; + else + imin = icur + 1; + } + + return (!icmp) ? icur : 0; + } + + inline Index idMethodName(const char *m) { + if(!m) return 0; + Index imax = numMethodNames; + Index imin = 0; + Index icur = -1; + int icmp = -1; + while(imax >= imin) { + icur = (imin + imax) / 2; + icmp = strcmp(methodNames[icur], m); + if(!icmp) break; + if(icmp > 0) + imax = icur - 1; + else + imin = icur + 1; + } + + return (!icmp) ? icur : 0; + } + + inline Index idMethod(Index c, Index name) { + Index imax = numMethodMaps; + Index imin = 0; + Index icur = -1; + int icmp = -1; + while(imax >= imin) { + icur = (imin + imax) / 2; + icmp = leg(methodMaps[icur].classId, c); + if(!icmp) { + icmp = leg(methodMaps[icur].name, name); + if(!icmp) break; + } + if(icmp > 0) + imax = icur - 1; + else + imin = icur + 1; + } + + return (!icmp) ? icur : 0; + } + + inline Index findMethod(Index c, Index name) { + // TODO: If method is in a parent module, forward the call from here + if(!c || !name) return 0; + Index mid = idMethod(c, name); + if(mid) return mid; + if(!classes[c].parents) return 0; + for(int p = classes[c].parents; inheritanceList[p] ; p++) { + mid = findMethod(inheritanceList[p], name); + if(mid) return mid; + } + return 0; + } + + inline Index findMethod(const char *c, const char *name) { + Index idc = idClass(c); + Index idname = idMethodName(name); + return findMethod(idc, idname); + } +}; + +class SmokeBinding { +protected: + Smoke *smoke; +public: + SmokeBinding(Smoke *s) : smoke(s) {} + virtual void deleted(Smoke::Index classId, void *obj) = 0; + virtual bool callMethod(Smoke::Index method, void *obj, Smoke::Stack args, bool isAbstract = false) = 0; + virtual char* className(Smoke::Index classId) = 0; + virtual ~SmokeBinding() {} +}; + +#endif diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp @@ -0,0 +1,4 @@ +smoke +PerlQt +puic + @@ -0,0 +1,11 @@ +BEGIN{ chdir("PerlQt/t") or die "couldn't chdir to PerlQt: $!\n" } +END{ chdir("../..") or die "couldn't chdir to ../..\n" } + +use blib; +use Test::Harness; + +$Test::Harness::switches = "-w -Mblib=../blib"; + +@t = glob("*.t"); + +runtests(@t);
\ No newline at end of file |