diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 22:56:19 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 22:56:19 -0500 |
commit | 10df383d2a019c4972a49273a3872c2e5489c7ff (patch) | |
tree | 8c5910ccfcab2269f7948dbd74a83048cd99d2ac /main/dependencies | |
parent | 7d523fac5a54f8e695e56f4877fa852608465bc7 (diff) | |
download | tde-10df383d2a019c4972a49273a3872c2e5489c7ff.tar.gz tde-10df383d2a019c4972a49273a3872c2e5489c7ff.zip |
Added dbus-tqt and dbus-tqt-1 from SVN
Diffstat (limited to 'main/dependencies')
106 files changed, 44692 insertions, 0 deletions
diff --git a/main/dependencies/dbus-tqt-1/AUTHORS b/main/dependencies/dbus-tqt-1/AUTHORS new file mode 100644 index 000000000..329b8d02d --- /dev/null +++ b/main/dependencies/dbus-tqt-1/AUTHORS @@ -0,0 +1,16 @@ +Olivier Andrieu <oliv__a@users.sourceforge.net> +Philip Blundell <pb@nexus.co.uk> +Anders Carlsson <andersca@gnome.org> +Kristian Hogsberg <krh@redhat.com> +Alex Larsson <alexl@redhat.com> +Robert McQueen <robot101@debian.org> +Michael Meeks <michael@ximian.com> +Seth Nickell <seth@gnome.org> +John (J5) Palmieri <johnp@redhat.com> +Havoc Pennington <hp@redhat.com> +Harri Porten <porten@kde.org> +Matthew Rickard <mjricka@epoch.ncsc.mil> +Zack Rusin <zack@kde.org> +Joe Shaw <joe@assbarn.com> +Colin Walters <walters@verbum.org> +David Zeuthen <david@fubar.dk> diff --git a/main/dependencies/dbus-tqt-1/CMakeLists.txt b/main/dependencies/dbus-tqt-1/CMakeLists.txt new file mode 100644 index 000000000..69e08afd1 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/CMakeLists.txt @@ -0,0 +1,82 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +project( dbus-tqt-1 ) + + +##### cmake setup ############################### + +cmake_minimum_required( VERSION 2.8 ) + +include( FindPkgConfig ) +include( CheckCXXSourceCompiles ) + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) +include( ConfigureChecks.cmake ) + + +##### install paths setup ####################### + +tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ) +tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ) +tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" ) +tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" ) + + +##### install headers ########################### + +install( FILES + dbus-qt.h message.h connection.h server.h + DESTINATION ${INCLUDE_INSTALL_DIR}/dbus-1.0/dbus ) + + +##### write pkgconfig file ###################### + +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} ) +configure_file( dbus-tqt.pc.cmake dbus-tqt.pc @ONLY ) +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) + + +##### build setup ############################### + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" ) +set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) + +add_definitions( + -DQT_THREAD_SUPPORT + ${TQT_CFLAGS_OTHER} +) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### dbus-tqt-1 (shared) ######################### + +tde_add_library( dbus-tqt-1 SHARED AUTOMOC + SOURCES + dbus-qthread.cpp message.cpp connection.cpp + integrator.cpp server.cpp + VERSION 0.0.0 + LINK ${TQT_LIBRARIES} ${DBUS_LIBRARIES} + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/main/dependencies/dbus-tqt-1/COPYING b/main/dependencies/dbus-tqt-1/COPYING new file mode 100644 index 000000000..bdc083147 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/COPYING @@ -0,0 +1,551 @@ +D-BUS is licensed to you under your choice of the Academic Free +License version 2.1, or the GNU General Public License version 2. +Both licenses are included here. Some of the standalone binaries are +under the GPL only; in particular, but not limited to, +tools/dbus-cleanup-sockets.c and test/decode-gcov.c. Each source code +file is marked with the proper copyright information. + + + +The Academic Free License +v. 2.1 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work: + +Licensed under the Academic Free License version 2.1 + +1) Grant of Copyright License. Licensor hereby grants You a +world-wide, royalty-free, non-exclusive, perpetual, sublicenseable +license to do the following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original Work; + +c) to distribute copies of the Original Work and Derivative Works to the public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license, under +patent claims owned or controlled by the Licensor that are embodied in +the Original Work as furnished by the Licensor, to make, use, sell and +offer for sale the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the +preferred form of the Original Work for making modifications to it and +all available documentation describing how to modify the Original +Work. Licensor hereby agrees to provide a machine-readable copy of the +Source Code of the Original Work along with each copy of the Original +Work that Licensor distributes. Licensor reserves the right to satisfy +this obligation by placing a machine-readable copy of the Source Code +in an information repository reasonably calculated to permit +inexpensive and convenient access by You for as long as Licensor +continues to distribute the Original Work, and by publishing the +address of that information repository in a notice immediately +following the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor +the names of any contributors to the Original Work, nor any of their +trademarks or service marks, may be used to endorse or promote +products derived from this Original Work without express prior written +permission of the Licensor. Nothing in this License shall be deemed to +grant any rights to trademarks, copyrights, patents, trade secrets or +any other intellectual property of Licensor except as expressly stated +herein. No patent license is granted to make, use, sell or offer to +sell embodiments of any patent claims other than the licensed claims +defined in Section 2. No right is granted to the trademarks of +Licensor even if such marks are included in the Original Work. Nothing +in this License shall be interpreted to prohibit Licensor from +licensing under different terms from this License any Original Work +that Licensor otherwise would have a right to license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any +Derivative Works that You create, all copyright, patent or trademark +notices from the Source Code of the Original Work, as well as any +notices of licensing and any descriptive text identified therein as an +"Attribution Notice." You must cause the Source Code for any +Derivative Works that You create to carry a prominent Attribution +Notice reasonably calculated to inform recipients that You have +modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor +warrants that the copyright in and to the Original Work and the patent +rights granted herein by Licensor are owned by the Licensor or are +sublicensed to You under the terms of this License with the permission +of the contributor(s) of those copyrights and patent rights. Except as +expressly stated in the immediately proceeding sentence, the Original +Work is provided under this License on an "AS IS" BASIS and WITHOUT +WARRANTY, either express or implied, including, without limitation, +the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL +WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential +part of this License. No license to Original Work is granted hereunder +except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal +theory, whether in tort (including negligence), contract, or +otherwise, shall the Licensor be liable to any person for any direct, +indirect, special, incidental, or consequential damages of any +character arising as a result of this License or the use of the +Original Work including, without limitation, damages for loss of +goodwill, work stoppage, computer failure or malfunction, or any and +all other commercial damages or losses. This limitation of liability +shall not apply to liability for death or personal injury resulting +from Licensor's negligence to the extent applicable law prohibits such +limitation. Some jurisdictions do not allow the exclusion or +limitation of incidental or consequential damages, so this exclusion +and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the +Original Work or a Derivative Work, You must make a reasonable effort +under the circumstances to obtain the express assent of recipients to +the terms of this License. Nothing else but this License (or another +written agreement between Licensor and You) grants You permission to +create Derivative Works based upon the Original Work or to exercise +any of the rights granted in Section 1 herein, and any attempt to do +so except under the terms of this License (or another written +agreement between Licensor and You) is expressly prohibited by +U.S. copyright law, the equivalent laws of other countries, and by +international treaty. Therefore, by exercising any of the rights +granted to You in Section 1 herein, You indicate Your acceptance of +this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate +automatically and You may no longer exercise any of the rights granted +to You by this License as of the date You commence an action, +including a cross-claim or counterclaim, against Licensor or any +licensee alleging that the Original Work infringes a patent. This +termination provision shall not apply for an action alleging patent +infringement by combinations of the Original Work with other software +or hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating +to this License may be brought only in the courts of a jurisdiction +wherein the Licensor resides or in which Licensor conducts its primary +business, and under the laws of that jurisdiction excluding its +conflict-of-law provisions. The application of the United Nations +Convention on Contracts for the International Sale of Goods is +expressly excluded. Any use of the Original Work outside the scope of +this License or after its termination shall be subject to the +requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 +et seq., the equivalent laws of other countries, and international +treaty. This section shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License +or seeking damages relating thereto, the prevailing party shall be +entitled to recover its costs and expenses, including, without +limitation, reasonable attorneys' fees and costs incurred in +connection with such action, including any appeal of such action. This +section shall survive the termination of this License. + +13) Miscellaneous. This License represents the complete agreement +concerning the subject matter hereof. If any provision of this License +is held to be unenforceable, such provision shall be reformed only to +the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this +License, whether in upper or lower case, means an individual or a +legal entity exercising rights under, and complying with all of the +terms of, this License. For legal entities, "You" includes any entity +that controls, is controlled by, or is under common control with +you. For purposes of this definition, "control" means (i) the power, +direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty +percent (50%) or more of the outstanding shares, or (iii) beneficial +ownership of such entity. + +15) Right to Use. You may use the Original Work in all ways not +otherwise restricted or conditioned by this License or by law, and +Licensor promises not to interfere with or be responsible for such +uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights +reserved. Permission is hereby granted to copy and distribute this +license without modification. This license may not be modified without +the express written permission of its copyright owner. + + +-- +END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential +differences between the Academic Free License (AFL) version 1.0 and other +open source licenses: + +The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache +licenses in many respects but it is intended to solve a few problems with +those licenses. + +* The AFL is written so as to make it clear what software is being +licensed (by the inclusion of a statement following the copyright notice +in the software). This way, the license functions better than a template +license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software. + +* The AFL tqcontains a complete copyright grant to the software. The BSD +and Apache licenses are vague and incomplete in that respect. + +* The AFL tqcontains a complete patent grant to the software. The BSD, MIT, +UoI/NCSA and Apache licenses rely on an implied patent license and contain +no explicit patent grant. + +* The AFL makes it clear that no trademark rights are granted to the +licensor's trademarks. The Apache license tqcontains such a provision, but the +BSD, MIT and UoI/NCSA licenses do not. + +* The AFL includes the warranty by the licensor that it either owns the +copyright or that it is distributing the software under a license. None of +the other licenses contain that warranty. All other warranties are disclaimed, +as is the case for the other licenses. + +* The AFL is itself copyrighted (with the right granted to copy and distribute +without modification). This ensures that the owner of the copyright to the +license will control changes. The Apache license tqcontains a copyright notice, +but the BSD, MIT and UoI/NCSA licenses do not. +-- +START OF GNU GENERAL PUBLIC LICENSE +-- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 tqcontains +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 tqcontains 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 tqcontains, 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/main/dependencies/dbus-tqt-1/ChangeLog b/main/dependencies/dbus-tqt-1/ChangeLog new file mode 100644 index 000000000..1a8070b56 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/ChangeLog @@ -0,0 +1,13661 @@ +2006-06-14 Ross Burton <ross@openedhand.com> + + * glib/dbus-gobject.c: + Free a leaking GArray (surely not!) in dbus_g_method_return. + +2006-06-14 Ross Burton <ross@openedhand.com> + + * tools/Makefile.am: + * tools/dbus-monitor.c: + Don't use the GLib bindings in dbus-monitor (patch from Ralf + Habacker). + +2006-06-14 Ross Burton <ross@openedhand.com> + + * tools/dbus-print-message.c: + Also print the object path when outputting Q_SIGNALS or method calls. + +2006-06-13 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/src/Makefile.am: install the qdbus.h header. + This allows people to actually use the installed code. + +2006-06-12 Ross Burton <ross@openedhand.com> + + * glib/dbus-gproxy.c: + Don't leak a GArray when firing Q_SIGNALS (thank Rob Taylor for review). + +2006-06-12 Thiago Macieira <thiago.macieira@trolltech.com> + + * Released 0.62 + +2006-06-12 Thiago Macieira <thiago.macieira@trolltech.com> + + * dbus/dbus-arch-deps.h.in: Remove spurious semi-colons that + break pedantic builds. Closes bug 6043 (patch approved by + Havoc back in February). + +2006-06-12 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/src/qdbusintegrator.cpp: Fix bug in parsing async methods + that took a QDBusMessage parameter. + * qt/src/qdbusbus.h: Add a default flag for RequestName. + * qt/tools/dbus.cpp: Don't use automatic call because we might + be calling an async method: request a reply. + +2006-06-11 Thiago Macieira <thiago.macieira@trolltech.com> + + * test/qt/*: Update the testcases, including testing the new + functionality of sending null QByteArray and QString over the + bus. Add new headertest test and restore the old + qdbusxmlparser test. + +2006-06-11 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/tools/dbuscpp2xml.cpp: Compile on Windows. + * qt/tools/dbusidl2cpp.cpp: Add missing newline. + + * qt/examples/Makefile.am: + * qt/examples/chat.h: Use UI-generated files with the ui_*.h + form. + + * qt/src/qdbusmarshall.cpp: Allow sending of QString() and + QByteArray() (nulls) over the bus. + * qt/src/qdbusabstractinterface.cpp: Use the correct variable, + the one that has the signature suffix stripped. + * qt/src/qdbusreply.h: Make some methods const. + +2006-06-09 Thiago Macieira <thiago.macieira@trolltech.com> + + Patch from Timo Hoenig <thoenig@suse.de>. + + * qt/dbus/Makefile.am: New file. Fix "make dist", add all headers + required during build to EXTRA_DIST. + * qt/src/Makefile.am: Fix "make dist", add 'qdbus.h' to EXTRA_DIST. + * qt/Makefile.am: Fix "make dist", add 'dbus' to DIST_SUBDIRS. + * configure.in: Fix "make dist", take care that the Makefile for + qt/dbus is being generated. + +2006-06-07 John (J5) Palmieri <johnp@redhat.com> + + * bus/bus.c: Fix eavesdropping on method calls + +2006-06-07 John (J5) Palmieri <johnp@redhat.com> + + * configure.in: + * dbus/dbus-userdb-util.c: + Add Solaris console owner patch from Artem Kachitchkine + +2006-06-07 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/Makfile.am: + * qt/src/Makefile.am: Fix the EXTRA_DIST after the + reorganisation. Thanks to Timo Hoenig for pointing this out. + +2006-06-06 Robert McQueen <robot101@debian.org> + + * glib/dbus-gtype-specialized.c: Fix obvious leak of GArray in every + call to dbus_g_type_get_struct. + +2006-06-06 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue-utils.c: Fix the failing test where static string + pointers were put into a GPtrArray-based specialised collection, and + then freed along with the array. GValues which you add into + collections or maps which have the NOCOPY flag set are assumed to not + belong to the caller, so rather than the existing pointer-stealing + semantics, they are copied instead. Given that the main consumers of + this abstraction are the bindings themselves, I don't think this is + too bad, but others should watch their choice of take vs set_static. + +2006-06-06 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue-utils.c: Spotted a warning about the return value + of g_slist_prepend not being used. Fixed copying of slist-based + specialised collections, then wrote a test case and found that it was + all broken. Went on to fix iterating and appending too. Good thing + nobody uses this code yet. + +2006-06-06 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue-utils.c: Remove duplicated code by having all of + the iterators use gvalue_take_ptrarray_value (the GValues themselves + are discarded without unsetting, so it makes no difference whether + we take or set_static). Remove cases for G_TYPE_POINTER because + there really is nothing useful we can do with them in our + specialised types - we *need* boxed copy/free functions at the very + least. + +2006-06-05 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/dbus: Add directory. I had forgotten to add this + yesterday after the move... + + * qt/examples/Makefile.am: + * qt/examples/dbus.cpp: Moved to qt/tools/dbus.cpp. + + * qt/tools/Makefile.am: + * qt/tools/dbus.cpp: Moved from qt/examples/dbus.cpp. + Added feature to get and set properties. + Added validation of service, object path and interface names. + + * qt/tools/dbusidl2cpp.cpp: Two new features: + 1) Allow specifying both the header and the source file names, + by separating them with a colon. + 2) Don't write an interface output if the -p switch wasn't + given, but the -a was. + + * qt/src/*: Fix usage of Iterators and ConstIterators. + Fix shadowing of variables by other variables (-Wshadow). + Fix keyword-cleanliness in headers. + Fix ASCII-cast (QLatin1String, QLatin1Char). + Fix validation of member names. + Add extra checking of introspection data during XML parsing. + Various bug fixes. + +2006-06-04 Thiago Macieira <thiago.macieira@trolltech.com> + + * dbus/Makefile.am: + * dbus/qdbus.h: Remove unnecessary file. This is mirrored into + qt/dbus/qdbus.h now. + +2006-06-04 Thiago Macieira <thiago.macieira@trolltech.com> + + * configure.in: Make --disable-qt actually do + something. Patch inspired by Zack Rusin. + +2006-06-04 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/: Update to Subversion r548032. + This includes a big reorganisation of the files inside the + subdir. + +2006-05-30 Sjoerd Simons <sjoerd@luon.net> + + * dbus/dbus-sysdeps.c: Make tcp socket connection error somewhat more + clear: + "Failed to connect to socket <host>:<port> <error>" instead of + "Failed to connect to socket <host>: <error>:<port>" + + * dbus/dbus-transport-unix.c: Fix crash when no host option is given + for a tcp transport. + +2006-05-29 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/*: Update the QtDBus bindings up to revision 546310 in + Subversion. + This adds the dbuscpp2xml tool, that parses a C++ header and + outputs a D-BUS Introspection XML. + +2006-05-21 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c: Put in a pile of assertions that the proxy name + is not NULL when it shouldn't be. Also a couple of possible fixes + for #4637 though I don't understand why the bug happens, to be + honest... also the object constructor has an assert name != NULL + and the name is only currently NULL for peer-to-peer proxies that + I don't think anyone uses? So it should be asserting. + Anyway, for now at least see if we get an earlier assertion failure. + + * glib/dbus-gvalue-utils.c: Put in a couple of assertions for + aptqparently broken code to be sure the tests fail and someone + will fix them... + +2006-05-07 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusmarshall.cpp: Fix a problem of demarshalling lists + and arrays when they had a single element: has_next returns + false, even before you read the element. So, instead, check + the array length. + +2006-05-06 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusmessage.cpp: + * qt/qdbustypehelper_p.h: + * qt/qdbusintegrator.cpp: gcc 3.4 doesn't like Q_FOREACH when + the list is a const-reference + +2006-05-03 John (J5) Palmieri <johnp@redhat.com> + + * Adding old doc patch that never got applied + + * dbus/bus.c (dbus_bus_add_match): Add documentation + + * doc/dbus-specification.xml: Add documentation for the match rules + and the AddMatch and RemoveMatch methods + +2006-05-02 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/dbusidl2cpp.cpp: There's no callAsync. Use the correct + call (r535506) + + * qt/dbusidl2cpp.cpp: + * qt/qdbusabstractadaptor.cpp: + * qt/qdbusabstractadaptor.h: Make QDBusAdaptorConnector be a + sibling of the QDBusAbstractAdaptor objects instead of the + tqparent. (r535848) + + * qt/dbusidl2cpp.cpp: + * qt/qdbusabstractinterface.cpp: + * qt/qdbusabstractinterface.h: + * qt/qdbusabstractinterface_p.h: + * qt/qdbusinterface.cpp: Make properties in interfaces + actually work. The code that was generated would not compile, + due to tqmoc calls to functions that did not exist. They now + shall. (r536571) + +2006-04-30 Thiago Macieira <thiago.macieira@trolltech.com> + + * Makefile.am: + * configure.in: + * dbus-qt4-1.pc.in: Add a pkg-config file for libdbus-qt4-1. + Thanks to Brad Hards for providing the patch + +2006-04-29 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/dbusidl2cpp.cpp: There's no callAsync. Use the correct + call. (r535506) + +2006-04-29 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/examples/dbus.cpp: Enhance error messages and use + QDBusInterfacePtr. + +2006-04-29 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusinterface.h: Rename QDBusRef to QDBusInterfacePtr + and disable the copy operators. (r533772, r534746) + + * qt/qdbuserror.h: Remove the automatic cast to bool. (r533929) + + * qt/qdbusabstractinterface.cpp: + * qt/qdbusabstractinterface.h: Change the default call mode to + not use the event loop. Add convenience call() methods that + take a CallMode parameter. (r534042) + + * qt/qdbusconnection.h: Change the default call mode to not + use the event loop. (r534042) + + * qt/qdbusinterface.cpp: + * qt/qdbusinterface.h: Add a method to tell us if the + interface is valid (since we don't return a null pointer + anymore) (r534099) + + * qt/qdbusinterface_p.h: Don't crash if tqmetaObject is 0 + (r534101) + + * qt/qdbusinternalfilters.cpp: Decouple the introspection + function in two so taht we get the chance to introspect + without having a QDBusMessage (r534102) + + * qt/qdbusbus.h: + * qt/qdbusconnection.cpp: + * qt/qdbusconnection_p.h: + * qt/qdbusintegrator.cpp: Keep a list of our own names to + avoid a round-trip to the server when attempting to introspect + one of our own objects. Also make sure the filter functions + match the empty interface as well. (r534108) + Don't keep the connection names. Instead, trust the unique + connection name (r534111) + Remove event loop usage (r534112) + +2006-04-29 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusintegrator.cpp: Fix assertion failure spotted by + Brad Hards. + +2006-04-28 Robert McQueen <robot101@debian.org> + + * glib/dbus-gproxy.c: Fix properties so that they can be given in + any order, making it easier for people who inherit from this + object. + +2006-04-28 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue-utils.c: Patch from Jakub Stachowski to fix leaking + of memory from within pointer arrays and lists. Fixes bug #6300. + +2006-04-28 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue.c: Patch from Jakub Stachowski to fix a leak in + generating struct signatures. Fixes bug #6083. + +2006-04-28 Robert McQueen <robot101@debian.org> + + * qt/Makefile.am: Tweak CLEANFILES from qdbusconnection.tqmoc + to qdbusconnection_p.tqmoc. + +2006-04-24 John (J5) Palmieri <johnp@redhat.com> + + * README, INSTALL: Doc fixes + Patch from Brad Hards <bradh at frogmouth.net> + +2006-04-23 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/examples/dbus.cpp: Use the new merged-interface mode for + the dynamic meta object. No need to guess which interface to + call. + +2006-04-23 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusconnection_p.h: + * qt/qdbusmetaobject.cpp: + * qt/qdbusmetaobject_p.h: + * qt/qdbusintegrator.cpp: Use the new merged-interface mode + for the dynamic meta object. No need to guess which + interface to call. + * qt/qdbusabstractinterface_p.h: + * qt/qdbusconnection.cpp: + * qt/qdbusintegrator.cpp: + * qt/qdbusinterface.cpp: + * qt/qdbusinterface.h: Make tqfindInterface always return a non-null pointer. + Add a QDBusRef that looks and behaves like DCOPRef. + +2006-04-23 Thiago Macieira <thiago.macieira@trolltech.com> + + * dbus/dbus-connection.c: Interfaces are optional in method + calls, so don't give up if the interface parameter is NULL. + Patch reviewed by Havoc Pennington. + +2006-04-23 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusreply.h: Add default constructor and operator= + (r532625) + * qt/qdbustypehelper_p.h: Use a clean namespace: no foreach() + in public headers (r532952) + * qt/qdbusabstractinterface.cpp: + * qt/qdbusabstractinterface_p.h: Add the AutoDetect mode and + make it the default (r532951) + +2006-04-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-connection.c: Fix asserts + Patch from Tim Moloney <t.moloney at verizon.net> + +2006-04-19 John (J5) Palmieri <johnp@redhat.com> + + * mono/Connection.cs, mono/Message.cs: Check Target type + Patch from Aaron Bockover (abockover at novell.com) + +2006-04-13 Thiago Macieira <thiago.macieira@trolltech.com> + + * INSTALL: fine-tune the requirements for the Qt4 binding. + +2006-04-16 Daniel P. Berrange <dan@berrange.com> + + * tools/dbus-print-message.c: Added support for printing of all + remaining data types. Fixed logic for indentation of compound + data types. + +2006-04-15 Daniel P. Berrange <dan@berrange.com> + + * INSTALL: fill out content of file providing DBus specific + build installations, followed by generic Auto* INSTALL file + content + +2006-04-13 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusintegrator.cpp: Work around g++ 3.3 bug. + Patch by Stefan Eilers. (r529537) + +2006-04-13 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusinternalfilters.cpp: Don't show the tqparent's + contents (r528208) + +2006-04-10 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/Makefile.am: fix the dependency for + qdbusconnection_p.tqmoc. It's included in qdbusintegrator.cpp, + not in qdbusconnection.cpp. + Thanks to Jakub Stachowski <stachowski@hypair.net> for + spotting this. + +2006-04-10 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/examples/listnames.cpp: + * qt/examples/Makefile.am: Three ways to list the names on the + bus. + +2006-04-10 Thiago Macieira <thiago.macieira@trolltech.com> + + * test/qt/tst_hal.cpp: Remove the waiting, since it's not + needed anymore. Requires Qt 4.1.3 to work properly. (r528148) + +2006-04-10 Thiago Macieira <thiago.macieira@trolltech.com> + + Merge from Subversion: + * qt/qt-dbus.qdocconf: Update Trolltech's webpage link to + something that exists (r526315) + * qt/qdbusinternalfilters.cpp: Correctly detect non-scriptable + Q_SLOTS/Q_SIGNALS (r526316) + * qt/qdbusinternalfilters.cpp: Fix the setProperty call and + also return an unknown-method error if the parameters don't + match for org.freedesktop.DBus.Properties. (r526842) + * qt/examples/dbus.cpp: Allow passing of QVariants (r526843) + * qt/qdbusintegrator.cpp: Restore the proper order of + delivery: don't make method returns be delivered on priority + (r528150) + +2006-03-28 Thiago Macieira <thiago.macieira@trolltech.com> + + * configure.in qt/Makefile.am: add qt/examples + * qt/examples: Add QtDBus example programs: + - hello: Hello, World + - ping: Simple method-calling program + - pong: Simple object-exporting program (not using adaptors) + - complexping: Interactive method-calling program + (also gets and sets properties). + - complexpong: Sample program exporting methods, Q_SIGNALS and + properties, using adaptors. + - dbus: Simple implementation of a generic method-calling + program, similar to 'dbus-send', but with semantics + similar to 'dcop'. + - chat: Simplistic chat program, implemented using Q_SIGNALS + and the system bus. Looks like IRC. + +2006-03-28 Thiago Macieira <thiago.macieira@trolltech.com> + + * configure.in: Detect QtGui (necessary for one of the + example programs). Note: this increases the minimum required + version of Qt to 4.1.3. + +2006-03-28 Thiago Macieira <thiago.macieira@trolltech.com> + + * test/qt/*: Sync with KDE Subversion revision 523647. + Update the testcases to the new API. Remove testcases for + classes that are no longer public or have been removed. + +2006-03-28 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/*: + * dbus/qdbus.h: Sync with KDE Subversion revision + 523647. Hopefully, this will be the last of the + source-incompatible changes. Documentation has been improved; + support for QList<basic-types> has been added; QDBusObject is + gone; QDBus(Abstract)Interface is now a QObject with + auto-generated meta-object; QDBusIntrospection is marked + private, since QMetaObject can be used now; lots of bugfixes. + +2006-03-16 John (J5) Palmieri <johnp@redhat.com> + + Patch from Milosz Derezynski <internalerror at gmail.com> + + * configure.in: + Output the service directory in the configure summary + + * dbus-1.pc.in: + Add session_bus_services_dir + +2006-03-10 Ross Burton <ross@openedhand.com> + + * tools/dbus-print-message.c: + Add support for object paths and signatures. + +2006-03-06 Sjoerd Simons <sjoerd@luon.net> + + * bus/bus.c: (bus_context_reload_config): Flush the user database cache on + config reload. + * bus/dbus-daemon.1.in: Also note that SIGHUP flushes the user/group + information caches + * dbus/dbus-hash.c: (_dbus_hash_table_remove_all): + * dbus/dbus-hash.h: Add function to remove all entries from a hash table + * dbus/dbus-userdb.c: (_dbus_user_database_flush): + * dbus/dbus-userdb.h: Add function to flush all user/group information + caches. + +2006-03-06 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/dbusidl2cpp.cpp: + * qt/Makefile.am: add the dbusidl2cpp tool, the tqreplacement + for dcopidl2cpp, found in the KDE installations (or the more + modern kalyptus): generate Qt4 C++ code for the input XML + introspection. Currently no IDL parsing. + +2006-03-06 Thiago Macieira <thiago.macieira@trolltech.com> + + * test/qt/*: Update the self-tests. + +2006-03-06 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/*: + * dbus/qdbus.h: Sync with KDE Subversion revision 516237. This + represents the first feature-complete version of the Qt4 + bindings since I took ove maintainership. + +2006-03-06 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/Doxyfile: Adding a Doxyfile for the Qt4 bindings + dir. This is C++, so we can't use the DBus ones. + +2006-03-02 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx: Remove refrence to sys/cdefs.h + (Patch from Artem Kachitchkine <Artem.Kachitchkin at Sun.COM>) + +2006-03-02 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-connection.c: + (_dbus_connection_block_pending_call): + Check to see if our data has already been read off the connection + by another blocking pending call before we block in poll. + (check_for_reply_and_update_dispatch_unlocked): + Code taken from _dbus_connection_block_pending_call - checks for + an already read reply and updates the dispatch if there is one. + + * test/name-test/test-pending-call-dispatch.c: + New test for making sure we don't get stuck polling a + dbus connection which has no data on the socket when + blocking out of order on two or more pending calls. + +2006-02-28 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/Makefile.am: Patch by Sjoerd Simons. More .tqmoc issues: + make/automake don't detect that we're talking about the same + .lo file if I specify the full path to the source files. + +2006-02-26 Havoc Pennington <hp@redhat.com> + + * bus/dbus-daemon.1.in: improve the language in a couple spots I noticed + + * dbus/dbus-bus.c (internal_bus_get): in the error message if the + session bus variable is unset, suggest "man dbus-launch" and "man + dbus-daemon" to figure out how to fix the problem + +2006-02-25 Havoc Pennington <hp@redhat.com> + + * glib/dbus-glib-tool.c (usage): fix up the usage message, someone + should make this thing use the new glib options parser + +2006-02-25 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/Makefile.am: Patch by Sjoerd Simons. Fix the path to the + .lo files taking tqmoc sources. + +2006-02-25 Havoc Pennington <hp@redhat.com> + + * dbus/dbus.h, dbus/Makefile.am: add dbus-signature.h to dbus.h + and install it as a public header + +2006-02-24 John (J5) Palmieri <johnp@redhat.com> + + * Released 0.61 + +2006-02-24 John (J5) Palmieri <johnp@redhat.com> + + * proxies.py: Fix the callchain + +2006-02-24 John (J5) Palmieri <johnp@redhat.com> + + * patch from Sjoerd Simons <sjoerd at debian.org>: + + * dbus/dbus-sysdeps-util.c (_dbus_group_info_free): Moved to + dbus/dbus-sysdeps.c + + * dbus/dbus-userdb.c (_dbus_group_info_free_allocated): Don't + call _dbus_group_info_free_allocated which causes infinite loop, + correctly call _dbus_group_info_free + +2006-02-20 Thiago Macieira <thiago.macieira@trolltech.com> + + * qt/qdbusinterface_p.h: + * qt/qdbusinterface.cpp: Use the standard + org.freedesktop.DBus.Method.NoReply annotation for the "async" + calls instead of creating one for us. + + * qt/qdbusconnection_p.h: + * qt/qdbusintegrator.cpp: Remove debugging code. + + * qt/qdbusintegrator.cpp: + * qt/qdbusmessage.cpp: + * qt/qdbusmessage_p.h: + * qt/qdbusmessage.h: Change the behaviour of automatic + reply-sending: now a reply is always sent, unless the caller + didn't request one or if the user slot has already sent one. + +2006-02-16 Robert McQueen <robot101@debian.org> + + * configure.in: Patch from Debian packages by Sjoerd Simons + <sjoerd@debian.org> to add --with-qt-tqmoc and --with-qt3-tqmoc + arguments so it's possible to build both bindings in the + same tree. + + * qt/Makefile.am: Fix truncated value so that make dist works. + +2006-02-16 Robert McQueen <robot101@debian.org> + + * acinclude.m4, configure.in: Patch from Brad Hards + <bradh@frogmouth.net> to avoid warnings from autoconf 1.9 by + improving quoting, re-ordering a few checks, and a few other + aesthetic tidy-ups. + +2006-02-16 Robert McQueen <robot101@debian.org> + + * dbus/dbus-message.c (dbus_message_iter_get_fixed_array): + Patch from Rob Taylor <rob.taylor@collabora.co.uk> to correct a bogus + assertion that the next element to read from the iter is fixed in + size. This is not the case when you are at the end of the iter, + because the next element type is INVALID. + + * dbus/dbus-string.c (_dbus_string_init_const_len): Correct a + a bogus assert which means that you may not initialise a 0-length + string unless you provide a non-NULL pointer. This prevented + you from marshalling messages containing zero-length arrays in + some cases. + + * glib/dbus-gvalue.c (demarshal_collection_array): Another patch + from Rob to correct bogus asserts when trying to demarshal an + array and get_fixed_array got you 0 elements. Append nothing to + the GArray in this case. + + * test/glib/test-dbus-glib.c: Add a test case for round-tripping + an empty array via the glib bindings. Without all of the above + patches, this new test fails. + +2006-02-16 Robert McQueen <robot101@debian.org> + + * glib/dbus-gmain.c: Make the previous commit compile. + + * python/_dbus.py, python/matchrules.py: Patch from Ole Andre + Ravnaas <ole.andre.ravnaas@collabora.co.uk> to allow you to + specify sender_keyword="foo", path_keyword="bar" when adding + a signal listener, so that you can bind to Q_SIGNALS generically + but still do something useful in your callback. + + * python/dbus_bindings.pyx: Demarshal the byte type as unsigned + chars so that they're not cast to chars and made negative. Thanks + to Jakub Stachowski for reporting this and testing the fix. + +2006-02-15 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-glib.h: + * glib/dbus-gmain.h: + (dbus_g_connection_open): new method for openning + a connection to an arbitrary address in the glib bindings + + * ChangeLog: checkin last entry which doesn't seem to be commited + +2006-02-13 John (J5) Palmieri <johnp@redhat.com> + + * tools/dbus-launch.c: Fixed sh syntax output + +2006-02-13 Robert McQueen <robot101@debian.org> + + * glib/dbus-binding-tool-glib.c, glib/dbus-gmain.c, + glib/dbus-gsignature.c, glib/dbus-gtype-specialized.c, + glib/dbus-gtype-specialized.h, glib/dbus-gvalue-utils.c, + glib/dbus-gvalue-utils.h, glib/dbus-gvalue.c: + Patch from Rob Taylor <rob.taylor@collabora.co.uk> to add a big + missing piece of the glib bindings jigsaw puzzle. This modifies + the existing specialised types to have N type parameters (rather + than the current 1 or 2 for arrays and dictionaries respectively). + You can then use this to get a glib type to represent any arbitrary + D-Bus struct type using dbus_g_type_get_struct. The only + implementation of these types is with GValueArrays as before, + but it's now possible to store these in arrays, emit them in + Q_SIGNALS, etc. + +2006-02-10 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-signature.c (dbus_signature_iter_recurse): Correctly + deal with nested arrays (Bug #5823) Patch by Thiago Macieira + <thiago.macieira at trolltech.com> + +2006-02-10 John (J5) Palmieri <johnp@redhat.com> + + * mono/doc/Makefile.am: Fix parallel make problem with mono-doc + (Bug #4213) Patch from Doug Goldstein <cardoe at gentoo.org> + +2006-02-10 John (J5) Palmieri <johnp@redhat.com> + + * bus/connection.c (bus_connections_expect_reply): Make + pending reply limit not common to all connections (Bug #5416) + Patch from Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> + +2006-02-10 John (J5) Palmieri <johnp@redhat.com> + + * tools/dbus-launch.c: Fixed csh syntax output (Bug #5720) + +2006-02-10 John (J5) Palmieri <johnp@redhat.com> + + * gcj/Makefile.am: point to correct jar command (Bug #4529) + patch from Doug Goldstein <cardoe at gentoo.org> + +2006-02-09 Joe Shaw <joeshaw@novell.com> + + * mono/Arguments.cs: Fix a magic number in the mono bindings + that doesn't work on 64 bit arches. Patch from Peter Johanson. + +2006-01-27 Robert McQueen <robot101@debian.org> + + * glib/dbus-binding-tool-glib.[ch]: Patch based on Ricardo Kekki's + patch to use an annotation org.freedesktop.DBus.GLib.ClientCSymbol + when generating the client-side methods, instead of overloading + CSymbol which broke everything horribly. My apologies. + +2006-01-27 Robert McQueen <robot101@debian.org> + + * glib/dbus-gtype-specialized.[ch], glib/dbus-gvalue-utils.c: Patch + by me and Rob Taylor to add a simple_free function to D-Bus map + and collection types, which allows those types which can be freed + with a GDestroyNotify (such as GHashTables and GArrays, but not + GPtrArrays) to be stored as the values in hashtables. + + * test/glib/test-dbus-glib.c, test/glib/test-service-glib.{c,xml}: + Patch by Rob Taylor to add nested dicts to the glib tests to check + the above code works, and appears not to leak when called repeatedly. + +2006-01-27 Robert McQueen <robot101@debian.org> + + * glib/dbus-gvalue.c (demarshal_valuearray): Patch from Rob Taylor + to free a D-Bus allocated string with dbus_free () instead of + g_free (). + +2006-01-27 Iain Holmes <iain@openedhand.com> + + * glib/dbus-gproxy.c (dbus_g_proxy_dispose): Protect the dispose + method from being called multiple times. + +2006-01-19 Robert McQueen <robot101@debian.org> + + * glib/dbus-binding-tool-glib.c: Patch from Rob Taylor + <rob.taylor@collabora.co.uk> to add support for generating bindings + to arrays that are represented as GPtrArrays rather than GArrays (ie + size-variable things, such as strings, objects, structs, etc). + +2006-01-05 Robert McQueen <robot101@debian.org> + + * dbus/dbus-glib.h, glib/dbus-gproxy.c: Patch from Ricardo Kekki + <ricardo.kekki@movial.fi> to make it possible to inherit from + DBusGProxy, by splitting the DBusGProxy struct into a public part and + a private part, and moving the setting of the DBusGProxyManager into a + connection property, allowing proper GObject construction. + +2006-01-05 Robert McQueen <robot101@debian.org> + + * glib/dbus-binding-tool-glib.c: Patch from Ricardo Kekki + <ricardo.kekki@movial.fi> to make dbus-binding-tool heed C symbol name + annotations when generating glib client bindings. + +2005-12-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-shared.h: Call it shared constants instead of shared macros + + * dbus/dbus-protocol.h: add DOxygen markup to quiet warnings + +2005-12-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-shared.h: add DOxygen markup to quiet warnings + +2005-12-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-macros.h: correct DOxygen end of section (s/}@/@}) + +2005-12-19 Ross Burton <ross@openedhand.com> + + * doc/dbus-tutorial.xml: + Document the Glib client-side bindings, and list all possible annotations. + +2005-12-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/bus.c (dbus_bus_release_name): Add documentation + +2005-12-06 Robert McQueen <robot101@debian.org> + + * python/service.py: s/sucessful/successful/ so we're allocating to + and reading from the same variable. Oops. + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * Released 0.60 + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * test/qt/Makefile.am: build from srcdir + + * qt/qtconnection.cpp (requestName): Changed PROHIBIT_REPLACE to ALLOW_REPLACE + Note - this code is wrong and needs to be fixed by the Qt binding + developers. The flags should be treated as bitfields and not enums. + + * qt/qtconnection.h: Change ProhibitReplace to AllowReplace + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-list.c (_dbus_list_insert_after_link, _dbus_list_insert_after, + link_after): remove #ifdef DBUS_BUILD_TESTS since we use these methods + in production code + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-connection.c (dbus_connection_read_write): Add new + method for getting messages off the bus in the absence of a + mainloop. This method is much like + dbus_connection_read_write_dispatch except it does not dispatch + the messages to a registered filter function. Instead it + allows a developer to process messages by directly popping + them off the bus. + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * bus/desktop-file.c (parse_key_value): Ignore locales allowing + the parser to continue instead of returning error + (bus_desktop_file_load): Do not free parser data when + parse_section_start or parse_key_value fails because it was + already freed by parser_free (patch from Carlos Garcia Campos + <carlosgc at gnome.org>) + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-auth.c, dbus/dbus-connection.c, dbus/dbus-keyring.c, + dbus/dbus-server-debug-pipe.c, glib/dbus-binding-tool-glib.c + glib/dbus-glib-tool.c, glib/dbus-gparser.c, glib/dbus-gproxy.c + test/test-segfault.c, test/test-utils.c, + test/glib/test-dbus-glib.c, tools/dbus-cleanup-sockets.c + tools/dbus-launch.c, tools/dbus-tree-view.c, tools/dbus-viewer.c: + Various cleanup of dead code and compiler warnings (patch from + Kjartan Maraas <kmaraas at gnome.org>) + +2005-11-30 John (J5) Palmieri <johnp@redhat.com> + + * glib/dbus-gmain.c (connection_setup_add_watch): plugged a leak + (patch from Carlos Garnacho Parro <carlosg at gnome.org> + +2005-11-27 Robert McQueen <robot101@debian.org> + + * python/dbus_bindings.pyx: Repair my previous commit which reverted + part of the preceding one. Oops. Merge patch by Johan Hedberg + <johan.hedberg@nokia.com> to fix marshalling of 16-bit integer values + on big-endian platforms. + + * test/python/test-client.py: Add some 16-bit integers to the test + values. + +2005-11-27 Carlos Garcia Campos <carlosgc@gnome.org> + + * glib/dbus-gobject.c: Append a GValue instead of a basic type in + method return message for property getters + +2005-11-27 Robert McQueen <robot101@debian.org> + + * python/dbus_bindings.pyx: Fix a bug where doing a strict append + with type v of an instance of dbus.Variant(foo, type='x') caused + it to be boxed twice before sending over the bus. + + * python/dbus_bindings.pyx, python/service.py, + test/python/test-client.py: Update the constants for the new + request_name flags, and update comments/test cases now that queueing + is the default action. + +2005-11-22 John (J5) Palmieri <johnp@redhat.com> + + * configure.in: + - Change version to 0.60 for impending release + - upped the sonames because of ABI and API breakage + +2005-11-22 John (J5) Palmieri <johnp@redhat.com> + + * configure.in: Add test/name-test/Makefile to the generated + Makefile list + + * dbus/dbus-shared.h (#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT): + New flag which tqreplaces DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT + (#define DBUS_NAME_FLAG_DO_NOT_QUEUE): New flag for specifying + not to queue an ower if it can't be the primary owner + + * bus/bus.h: Add new internal BusOwner struct + + * bus/driver.c (bus_driver_handle_hello): Send flags (0 for default) + to bus_registry_ensure and don't set the prohibit_tqreplacement flag + since they are now set per BusOwner and not per name. + (bus_driver_handle_list_queued_owners): bus method (ListQueuedOwners) + that returns the list of connections in a name's connection queue + + * bus/services.c (struct BusService): remove prohibit_tqreplacement field + (struct BusOwner): new struct for keeping track of queued connections + and their associated flags for the queue + (struct BusRegistry): add a BusOwner memory pool + (bus_registry_new): initialize the BusOwner memory pool + (bus_registry_unref): free the BusOwner memory pool + (_bus_service_tqfind_owner_link): new internal method for + searching the queue for a specific connection + (bus_owner_set_flags): new method for adding setting the flags on a + bus owner + (bus_owner_new): new method that creates a BusOwner object from the + pool and sets its flags + (bus_owner_ref, bus_owner_unref): ref counting for BusOwner objects + (bus_registry_ensure): Add the flags parameter + (bus_registry_acquire_service): Switch from using raw connections to + using the BusOwner struct + Add new state machine for dealing with the new set of flags + (bus_registry_set_service_context_table, struct OwnershipCancelData, + cancel_ownership, free_ownership_cancel_data, + add_cancel_ownership_to_transaction, struct OwnershipRestoreData, + restore_ownership, free_ownership_restore_data, + add_restore_ownership_to_transaction): Switch to using BusOwner + instead of raw connections + (bus_service_add_owner): Add flags parameter + Switch to using BusOwner instead of raw connections + Add state machine for dealing with the new set of flags + (bus_service_swap_owner): Swaps the first and second owners in the + queue. Used to make sure proper Q_SIGNALS are sent when a service looses + or gains primary ownership. We never insert an owner at the top of the + queue. Instead we insert it in the second position and then swap. + (bus_service_remove_owner): Remove the owner from the queue sending + out the NameLost and NameOwnerChanged Q_SIGNALS if the we were the + primary owner + (bus_service_get_primary_owners_connection): New method that extracts + the connection from the primary owner + (bus_service_get_primary_owner): Returns the BusOwner instead of the + connection + (bus_service_get_allow_tqreplacement): Changed from the old + bus_service_get_prohibit_tqreplacement method. Checks the flags of the + primary owner and returns if it can be tqreplaced or not + (bus_service_set_prohibit_tqreplacement): removed + (bus_service_has_owner): returns TRUE if and owner with + the specified connection exists in the queue + + * dbus/dbus-bus.c (dbus_bus_connection_get_unique_name): New helper + method that only compiles if tests are enabled. Allows us to get the + unique name of a connection so we can check it against the queue when + doing regression tests + + * bus/activation.c (bus_activation_send_pending_auto_activate), + bus/dispatch.c (bus_dispatch), + bus/driver.c (bus_driver_handle_get_service_owner, + bus_driver_handle_get_connection_unix_user, + bus_driver_handle_get_connection_unix_process_id, + bus_driver_handle_get_connection_selinux_security_context), + bus/Q_SIGNALS.c (connection_is_primary_owner): + use bus_service_get_primary_owners_connection instead of + bus_service_get_primary_owner + + * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket, + _dbus_listen_unix_socket): Calculate the length of the socket + path and use that instead of using a fixed length which was + causing socket names to contain many trailing Nul bytes. + + * dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c + (dbus_g_method_get_sender): New method for extracting the sender + from a DBusGMethodInvocation + (dbus_g_method_return_get_reply): changed name to + dbus_g_method_get_reply + (dbus_g_method_return_send_reply): changed name to + dbus_g_method_send reply + + * doc/dbus-specification.xml: New docs that describe how the new + queueing system works and talks about the changes to the how + we specify socket names + + * glib/examples/example-service.c, + glib/examples/example-signal-emitter.c, + glib/examples/statemachine/statemachine-server.c: + Changed the RequestName flags to the new system + + * test/name-test/ (test-names.c, run-test.sh, Makefile.am): New + regression test suite for testing various states of the new + queueing system + +2005-11-15 Robert McQueen <robot101@debian.org> + + * dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c: Patch from Rob + Taylor to add two methods, dbus_g_method_return_get_reply and + dbus_g_method_return_send_reply, to allow you to get the reply + message from a DBusGMethodInvocation, append arbitrary stuff to it, + and send it. The GLib bindings can't marshal a return value of + something like a(s) if the array is empty - ultimately they should be + made to heed the signature of the out arguments as the Python bindings + now can, but this is a workable interim solution which might have + other applications. + +2005-11-15 Robert McQueen <robot101@debian.org> + + * bus/driver.c, bus/services.c, bus/services.h: Add a ReleaseName + method to org.freedesktop.DBus to release a bus name or give up + waiting in the queue for it. + + * dbus/dbus-bus.c, dbus/dbus-bus.h, dbus/dbus-shared.h: Add a + dbus_bus_release_name method to send the ReleaseName method calls. + Add constants for the return values to dbus/dbus-shared.h. + + * doc/dbus-specification.xml: Document the new ReleaseName method + in the specification. + + * python/dbus_bindings.pyx: Add a low-level python binding for the + release name method. + + * python/exceptions.py, python/service.py: Make freeing BusName + objects release the name. Add a NameExistsException, and fix a + bug with creating UnknownMethodException. + + * test/python/test-client.py: Add tests for freeing BusName + objects causing names to be released. + +2005-11-14 Robert McQueen <robot101@debian.org> + + * python/service.py: Include the traceback in the error reply when we + send an exception over the bus. _BEST_ _PATCH_ _EVER_ + +2005-11-14 David Zeuthen <davidz@redhat.com> + + Patch from Timo Hoenig <thoenig@suse.de>. + + * bus/bus.c: I've recently investigated why the automatic reload + of configuration files does not work as expected. + + Currently, reloading configuration files does only work when + running dbus-daemon with --nodaemon. If we are running as daemon + we're hitting a dnotify bug once we fork the process. + + We're initializing the dnotify fds before calling fork(). Once + the child process forked it does still have the fds (and they + still show up in /proc/`pidof dbus-daemon`/fd/) but we're not + getting SIGIO as changes are made to the configuration files. + + The attached patch moves the initialization of the dnotify fds to + process_config_postinit(). This is safe for all current code + paths and solves the dnotify disfunction. If we're running + dbus-daemon as daemon the fds for dnotify are now being + initialized after fork() for the child process. + + * configure.in: The current configure.in check for dnotify probes + 'x$target_os' for being 'xlinux-gnu'. I've changed the check to + match for 'xlinux', too. Additionally I have adapted the configure + option's style to match with the others. + +2005-11-14 Robert McQueen <robot101@debian.org> + + * python/decorators.py, python/service.py: Add a new argument to the + dbus.service.method decorator called sender_keyword, which if set, + specifies the name of an argument which will be provided the bus + name of the method caller. + + * test/python/test-client.py, test/python/test-service.py: Add a + method and test to check the sender_keyword functionality. + +2005-11-07 John (J5) Palmieri <johnp@redhat.com> + + * bus/driver.c (bus_driver_handle_reload_config): Make sure we send an + empty reply so blocking calls don't block forever (Patch from Sjoerd + Simons <sjoerd at luon.net>) + + * AUTHORS: Add Robert McQueen for his work on the Python + Bindings and other parts of D-Bus + +2005-11-07 Robert McQueen <robot101@debian.org> + + * python/decorators.py: Change emit_signal function to use the + signature annotation of the signal when marhsalling the arguments from + the service. Fix a bug where the code checking signature length + against argument length referenced the wrong variable. + + * python/introspect_parser.py: Avoid adding the type signature of + signal arguments to any methods which occur after them in the + introspection data (!) by making the parser a little more careful + about its current state. + + * python/service.py: Remove debug prints from last commit (again :D). + + * test/python/test-client.py, test/python/test-service.py: Add test + Q_SIGNALS with signature decorators to test the strict marshalling code + gives errors at the right time. Could do with checking the Q_SIGNALS + actually get emitted too, given that the test does nothing with + Q_SIGNALS at the moment... + +2005-11-07 Robert McQueen <robot101@debian.org> + + * python/_dbus.py: Add WeakReferenceDictionary cache of dbus.Bus + instances to stop madness of creating new instances representing + the same bus connection all the time, rendering any tracking of + match rules and bus names quite meaningless. Caught a bug where + the private argument to SessionBus() and friends was being passed + in as use_default_mainloop by mistake. Still some problems with + multiple dbus_binding.Connection instances representing the same + low-level connection (eg when you use both SessionBus() and + StarterBus() in same process), but it's a lot better now than it + was. + + * python/dbus_bindings.pyx: Add constants with the return values + for bus_request_name(). + + * python/service.py: Store bus name instances in a per-dbus.Bus cache + and retrieve the same instances for the same name, so deletion can be + done with refcounting. Also now throws some kind of error if you + don't actually get the name you requested, unlike previously... + + * test/python/test-client.py: Add tests for instance caching of buses + and bus name objects. + +2005-11-04 Robert McQueen <robot101@debian.org> + + * python/dbus_bindings.pyx, test/python/test-client.py: Fix + marshalling of boolean values. Add some booleans to the values in + the test client. + + * python/decorators.py, python/service.py: Add an 'async_callbacks' + argument to the dbus.service.method decorator, which allows you to + name arguments to take two callback functions for replying with + return values or an exception. + + * test/python/test-client.py, test/python/test-service.py: Add test + case using asynchronous method reply functions, both return values and + errors, and from within both the function itself and from a mainloop + callback. + + * python/decorators.py, python/service.py: Perform checking that the + number of method/signal arguments matches the number of types in the + signature at class loading time, not when you first introspect the + class. + + * python/service.py: Remove debug print left by the last commit. + +2005-11-03 Robert McQueen <robot101@debian.org> + + * python/service.py: Heavy refactoring of method invocation, with + hopefully no effect on functionality. Nuked _dispatch_dbus_method_call + in favour of a new _message_cb that uses seperate functions for + looking up the method to call, marshalling the return values, and + sending exceptions as errors, and is easier to follow as a + consequence. Fixes some corner cases about returning things that + don't match your declared out_signature, allows exceptions to define + _dbus_error_name and have it be sent over the bus as the error name, + and paves the way for cool stuff like heeding the message no reply + flag, asynchronous method implementations, informing the method of the + sender, and including backtraces in the error messages. + + * test/python/test-client.py: Catch and print exceptions thrown in the + async callback tests, rather than passing them to the low-level + bindings to be ignored in a noisy and frustrating manner. + +2005-11-03 Robert McQueen <robot101@debian.org> + + * python/_dbus.py, python/proxies.py, python/service.py: Add __repr__ + functions to dbus.Bus, dbus.service.BusName and dbus.service.Object, + tweak others to be consistent. + + * test/python/test-client.py: Tweak output of testInheritance. + +2005-10-29 Robert McQueen <robot101@debian.org> + + * python/service.py: Major changes to allow multiple inheritance + from classes that define D-Bus interfaces: + + 1. Create a new Interface class which is the tqparent class of + Object, and make the ObjectType metaclass into InterfaceType. + + 2. Patch written with Rob Taylor to tqreplace use of method_vtable + with code that walks the class's __MRO__ (method resolution order) + to behave like Python does when invoking methods and allow + overriding as you'd expect. Code is quite tricky because + we have to tqfind two methods, the one to invoke which has the + right name and isn't decorated with the /wrong/ interface, + and the one to pick up the signatures from which is decorated + with the right interface. + + The same caveats apply as to normal multiple inheritance - + this has undefined behaviour if you try and inherit from two + classes that define a method with the same name but are + decorated with different interfaces. You should decorate + your overriding method with the interface you want. + + 3. Replace grungy introspection XML generation code in the metaclass + with dictionaries that cope correctly with multiple inheritance + and the overriding of methods. This also uses the signature + decorations to provide correct introspection data, including + the debut appearance of the types of your return values. :D + + * test/python/test-client.py, test/python/test-service.py: Add a test + case to try invoking an method that overrides one inherited from a + D-Bus interface class. + +2005-10-29 Robert McQueen <robot101@debian.org> + + * python/dbus_bindings.pyx: Tweak 'raise AssertionError' to assert(). + Add checking for the end of struct character when marshalling a + struct in MessageIter.append_strict. + + * python/examples/example-service.py, + python/examples/gconf-proxy-service.py, + python/examples/gconf-proxy-service2.py: Update to use gobject + mainloop directly rather than appearing to depend on gtk. + + * python/test/test-client.py, python/test/test-server.py: Remove + obsolete and broken test scripts for old bindings. We have up to date + and working tests in test/python/. + +2005-10-29 Robert McQueen <robot101@debian.org> + + * python/decorators.py: Add optional arguments to the method and + signal decorators to allow you to specify the signature of arguments + and return values. Preserve the doc strings of signal functions in the + decorated version, for pydoc and friends. + + * python/dbus_bindings.pyx, python/proxies.py: Replace the + parse_signature_block function with an iterable dbus.Signature() + type. Fix a bug in MessageIter.append_strict where you could append + anything by claiming it was a string. + + * python/service.py: Use the out_signature decoration on methods to + marshal return values, meaning you no longer require dbus.Array() + or dbus.Dictionary() to indicate the type when returning empty + arrays or dictionaries. Fix a bug where exceptions which are defined + in __main__ are not turned into error replies. + + * test/python/test-client.py, test/python/test-service.py: Add test + for correct marshalling of return values according to out_signature. + Fix a bug in the async call test where the error_handler is missing a + self argument. + +2005-10-29 Robert McQueen <robot101@debian.org> + + * glib/Makefile.am, glib/examples/Makefile.am, + glib/examples/statemachine/Makefile.am: Merge patch from Ubuntu by + Daniel Stone to tqreplace explicit calls to libtool with $(LIBTOOL). + + * test/python/.cvsignore: Add run-with-tmp-session-bus.conf. + + * tools/dbus-monitor.1, tools/dbus-monitor.c: Merge dbus-monitor patch + from Ubuntu by Daniel Silverstone to allow specifying match rules on + the command line. + +2005-10-27 Ross Burton <ross@openedhand.com> + + * dbus/dbus-marshal-header.c: + Remove dead code. + + * glib/dbus-gobject.c: + Stop compiler warning. + +2005-10-25 Ross Burton <ross@openedhand.com> + + * dbus/dbus-auth.c: + * dbus/dbus-server-unix.c: + * dbus/dbus-transport-unix.c: + * glib/dbus-gmain.c: + * glib/dbus-gobject.c: + Add some const keywords. + +2005-10-25 Ross Burton <ross@openedhand.com> + + * doc/dbus-specification.xml: + Document the NoReply annotation. + + * glib/dbus-binding-tool-glib.h: + * glib/dbus-binding-tool-glib.c: + Respect the NoReply annotation. + +2005-10-24 Robert McQueen <robot101@debian.org> + + * python/dbus_bindings.pyx (String, MessageIter): make D-Bus strings + derive from tqunicode instead of str, and encode/decode UTF-8 when + marshalling/unmarshalling bus messages + + * python/introspect_parser.py: encode introspection data as UTF-8 + before passing the buffer into libxml2 + + * test/python/test-client.py: add tqunicode test strings + + * test/data/valid-service-files/.cvsignore, test/python/.cvsignore: + ignore generated python test files + +2005-10-17 John (J5) Palmieri <johnp@redhat.com> + + * glib/dbus-gvalue-utils.c (hash_free_from_gtype): handle gdouble + and G_TYPE_VALUE_ARRAY (DBUS_TYPE_STRUCT) + (gvalue_from_hash_value, hash_value_from_gvalue): handle gdouble + + * glib/dbus-gvalue.c (dbus_gvalue_to_signature): add missing + DBUS_STRUCT_BEGIN_CHAR and DBUS_STRUCT_END_CHAR charaters + when constructing struct signatures + + * python/_dbus.py (Bus): handle private connections using the + private keyword in the constructor. defaults to private=False + (Bus::close): new method to close a connection to the bus + + * python/dbus_bindings.pyx (Connection::close): renamed method + was previously called disconnect + (bus_get): now supports getting a private connection + + * python/proxies.py (ProxyMethod::__call__): check if ignore_reply + keyword is set to True. if it is, execute the method without waiting + for a reply + (ProxyObject::_introspect_execute_queue): new method for executing + all the pending methods that were waiting for the introspect to + finish. this is called when introspect either succeeds or fails + (ProxyObject::_introspect_error_handler): call queued methods + +2005-10-14 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx (MessageIter::append_strict): check for + STRUCT_BEGIN not TYPE_STRUCT in indicate we are marshalling a struct + + * python/service.py (Object::_message_cb): handle exceptions correctly + by sending them over the wire to the calling app. This makes sure + the client returns immediately instead of waiting the 15 seconds to + timeout. + + * test/python/test-client.py (TestDBusBindings::testBenchmarkIntrospect): + Add a test to benchmark how long it takes to introspect a service and + call a method which returns a large element (pretty fast) + + * test/python/test-service.py (TestObject::GetComplexArray): new test + method which pushes a lot of data + +2005-10-13 John (J5) Palmieri <johnp@redhat.com> + + * python/service.py(ObjectType::_reflect_on_signal, _reflect_on_method): + reclaim memory outside of the loop and use del istead of just setting + the key to None + +2005-10-13 John (J5) Palmieri <johnp@redhat.com> + + * python/service.py (ObjectType::_reflect_on_signal): Always close + signal tag even when there are no arguments + +2005-10-13 John (J5) Palmieri <johnp@redhat.com> + + * configure.in: Set mono, mono-docs and Qt3 to default + to no instead of auto when building. These bindings do not + have full time maintainers and will not be supported for the + 1.0 release. + +2005-10-12 John (J5) Palmieri <johnp@redhat.com> + + patches from Michael Krivoruchko <misha at sun.com>: + + * dbus/dbus-connection.c (_dbus_connection_queue_received_message_link, + _dbus_connection_message_sent, + _dbus_connection_send_preallocated_unlocked_no_update, + _dbus_connection_pop_message_link_unlocked): handle the case when path + is NULL when calling _dbus_verbose + + * configure.in: check for functions getpeerucred and getpeereid + + * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): provides + support of auth EXTERNAL on Solaris 10+ (getpeerucred), FreeBSD 4.6+, + OpenBSD 3.0+ and FreeBSD 5.0+ as well as MacOSX 10.2+ (getpeereid). + Patch was only tested on Solaris 10 x86 so it might be issues + with other platforms (i.e. BSDs and MacOSX) + + +2005-10-05 John (J5) Palmieri <johnp@redhat.com> + + * glib/dbus-gvalue.c (marshal_variant): call _dbus_gvalue_marshal + instead of marshal basic so we can handle recursive types in a variant + + * test/glib/test-dbus-glib.c: Add test for marshaling recurive types + in variants + + * test/glib/test-service-glib.c, test-service-glib.xml + (my_object_echo_variant [EchoVariant], + my_object_process_variant_of_array_of_ints123 + [ProcessVariantOfArrayOfInts123]): + Add two test methods + + * python/introspect_parser.py: New module for parsing introspect + data. + + * python/dbus_bindings.pyx: + (various places): when throwing errors fix to use errormsg instead + of message local variable because Pyrex can get confused with other + message variables (initial patch by Robert McQueen + <robert.mcqueen at collabora.co.uk>) + (MessageIter::parse_signature_block): new method for getting the next + block in a signiture. + (MessageIter::append_strict): new method for appending values strictly + using the passed in signature instead of guessing at the type + (MessageItter:: append_dict, append_struct, append_array): use + signatures to marshal tqchildren if the signature is available + + * python/exceptions.py (IntrospectionParserException): new exception + + * python/proxies.py (ProxyMethod::__call__): Marshal args with + introspected signatures if available, else we fall back to the + old way of doing things. + (ProxyObject::_introspect_reply_handler ): parse introspection data + + * python/service.py (ObjectType::_reflect_on_method): Properly + terminate <method> if there are no args in the reflection data + + * test/python/test-client.py: add tests for talking with the GLib + test server. This gives us better coverage for introspection since + python to python will always generate arguments as variants. It also + allows us to test the robustness of the GLib bindings and interlanguage + communications. + + +2005-10-03 John (J5) Palmieri <johnp@redhat.com> + + * bus/driver.c (bus_driver_handle_introspect): Add Q_SIGNALS + to the introspect data. (patch from Daniel P. Berrange + <dan at berrange.com>) + + * bus/dispatch.c (check_existent_ping): Add testcase for Ping + + * dbus/dbus-connection.c (_dbus_connection_peer_filter, + _dbus_connection_run_builtin_filters): Changed these to + be unlock_no_update functions and call + _dbus_connection_send_unlocked_no_update instead of + dbus_connection_send to avoid locking errors. + + * doc/TODO: Removed the make Ping test TODO + +2005-09-26 John (J5) Palmieri <johnp@redhat.com> + + * dbus/Python.pyx: Fixed memory leaks when throwing errors. + We now copy the message from a DBusError and then free + the error object befor throwing the error + + * glib/dbus-glib-tool.c: removed extra comma at the end of the + DBusBindingOutputMode enum which was causing a warning. + #include <time.h> so using time_t is explicitly defined + +2005-09-26 John (J5) Palmieri <johnp@redhat.com> + + * Integrate patches from Lennart Poettering <mzsqb at 0pointer.de>: + - dbus/dbus-bus.c + (internal_bus_get): new method that take over the heavy lifting + of dbus_bus_get and adds the ability to get a private connection + to the bus + (dbus_bus_get): wrapper to internal_bus_get that provides the same + interface as in previous versions + (dbus_bus_get_private): new method that is a wrapper to + internal_bus_get to get a private connection to the bus + + - dbus/dbus-bus.h + (dbus_bus_get_private): add as a public libdbus interface + + - dbus-1.pc.in: output system_bus_default_address and + sysconfdir variables so apps can use them when compiling + +2005-09-23 Harald Fernengel <harry@kdevelop.org> + * dbus/qt: New Qt bindings + +2005-09-12 Waldo Bastian <bastian@kde.org> + + * dbus/dbus-marshal-validate.c, + doc/dbus-specification.xml, test/Makefile.am, + test/test-names.c: allow hyphens in bus names. + +2005-09-11 Mark McLoughlin <mark@skynet.ie> + + * test/data/auth/fallback.auth-script: we don't + retry the EXTERNAL method when we know its going + to fail anymore. + +2005-09-11 Mark McLoughlin <mark@skynet.ie> + + * dbus/dbus-connection-internal.h: rename + (add|remove|toggle)_(watch|timeout) to unlocked() + + * dbus/dbus-connection.c: ditto. + + * dbus/dbus-timeout.c, dbus/dbus-transport-unix.c: + Update some callers for the renaming. + +2005-09-10 Mark McLoughlin <mark@skynet.ie> + + * dbus/dbus-auth.c: (record_mechanisms): don't + retry the first auth mechanism because we know + we're just going to get rejected again. + + * dbus/dbus-keyring.c: (_dbus_keyring_reload): + Fix thinko ... and what a nasty little bugger to + track down you were ... + + * dbus/dbus-connection.c: + (_dbus_connection_add_watch), + (_dbus_connection_remove_watch): add note about + these needing the connection to be locked. + (_dbus_connection_get_dispatch_status_unlocked): + set status to DATA_REMAINS when we queue the + disconnected message. + + * bus/dispatch.c: + (bus_dispatch): fix warning. + (check_existent_service_no_auto_start): + Expect ChildSignaled error too. + (check_existent_hello_from_self): fix another + couple of warnings. + +2005-09-08 Joe Shaw <joeshaw@novell.com> + + Patches from James Willcox <snorp@snorp.net> + + * mono/Makefile.am: Add Int16.cs and UInt16.cs + + * mono/DBusType/Array.cs: Handle multidimensional arrays, and + support array "out" parameters. + + * mono/DBusType/Int16.cs, mono/DBusType/UInt16.cs: New files, + for 16-bit int support. + +2005-09-06 John (J5) Palmieri <johnp@redhat.com> + + * Released 0.50 + + * Patch from Steve Grubb: + - bus/activation.c (bus_activation_service_reload_test): clean up + some indentation + - dbus/dbus-keyring.c (_dbus_keyring_reload): fix conditional + - dbus/dbus-message-factory.c (generate_special): fix a couple of + buffer overflows in the test suite. This is non critical because + it can not be exploited and this code is only run when doing a + make check. + + * Patch from Yaakov Selkowitz: Build fixes for Cygwin + - configure.in: Don't check and link against kdecore, only qt headers + - dbus/Makefile.am: Add -no-undefined to libdbus_1_la_LDFLAGS + - gcj/org/freedesktop/dbus/Makefile.am: + add libdbus_gcj_1_la_LDFLAGS = -no-undefined + - glib/Makefile.am: Add -no-undefined to libdbus_glib_1_la_LDFLAGS + and $(DBUS_GLIB_LIBS) to dbus_binding_tool_LDADD + - qt/Makefile.am: Add -no-undefined to libdbus_qt_1_la_LDFLAGS + - tools/Makefile.am: Add platform extentions to binaries + (i.e. .exe on windows) + + * configure.in: + - Make it so if no suitable version of python is found we only + disable building python instead of exiting the configure script + - Require version 2.4 of glib for glib bindings + - Up version to 0.50 + + * python/__init__.py: Sync version with libdbus to (0,50,0) + +2005-09-05 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-object-tree.c (tqfind_subtree_recurse): + a couple of optimizations (bug #710): + - do a binary search in the tree + - insert a new child at the right place directly, no need for + qsort anymore + - do the "double alloc" thing when allocating tqchildren + +2005-08-31 John (J5) Palmieri <johnp@redhat.com> + + * python/Makefile.am: Break on pyrexc errors instead of ignoring them + + * python/dbus_bindings.pyx: Memory management foo + (global): remove hacky _user_data_references global list + (GIL_safe_cunregister_function_handler): userdata now stuffed into + tuples. Unref user_data + (GIL_safe_cmessage_function_handler): userdata now stuffed into tuples + (Connection::__del__): Remove and tqreplace with __dealloc__ method + (Connection::add_filter): Stuff user_data into a tuple. Use Py_INCREF + to keep tuple from being deallocated instead of the global var hack + (Connection::register_object_path): Stuff user_data into a tuple. + Use Py_INCREF to keep tuple from being deallocated instead of the + global var hack + (Connection::register_fallback): Stuff user_data into a tuple. + Use Py_INCREF to keep tuple from being deallocated instead of the + global var hack + (GIL_safe_pending_call_notification): Don't unref the message + because it gets unreffed when going out of scope. Py_XDECREF + the user_data + (PendingCall::__del__): Remove and tqreplace with __dealloc__ method + (PendingCall::set_notify): ref the pending call because we will + need it to stick around for when the notify callback gets called + (Message::__del__): Remove and tqreplace with __dealloc__ method + + * python/dbus_glib_bindings.pyx (init_gthreads): Changed to + gthreads_init to match up with the dbus call + + * python/glib.py (init_threads): Changed to threads_init to match + up with gobject.threads_init(). init_threads is kept for backwards + compat but will most likely be deprecated in the future + + * test/python/test-client.py: + - revamp to use Python's unittest functionality + - add async call tests + - setup threads in glib and dbus so we make sure locks are working + +2005-08-30 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx + (_pending_call_notification, cunregister_function_handler, + cmessage_function_handler): All callback functions have been rearranged + to workaround a bug in Pyrex when working with the GIL which is Python's + global lock when dealing with threads. They have been split into + a wrapper function (which assumes the name of the old function) and + a _GIL_safe_<function name> function which tqcontains the functionality + of the old function. This ensures that Pyrex does not write code + the lock is released. + + +2005-08-30 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx (_pending_call_notification): Obtain the + GIL global lock when calling back into Python + +2005-08-29 John (J5) Palmieri <johnp@redhat.com> + + * Release 0.36.2 + + * Add Havoc's patch that never got applied to HEAD (Bug #2436): + + * bus/policy.c (bus_policy_allow_user): change default "user is + allowed" to be "user has same uid as the bus itself"; any + allow/deny rules will override. + + * bus/session.conf.in: don't allow all users, since now by default + the user that ran the bus can connect. + +2005-08-26 Colin Walters <walters@verbum.org> + + * tools/dbus-print-message.c (print_message): Flush stdout + after printing a message, so that redirecting to a file, then + hitting Ctrl-C works. + +2005-08-25 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx: Tracked down a major memleak and fixed it + (EmptyMessage): new class that subclasses Message. This is a workaround + to a Pyrex bug that fails to call __del__ when the Message object goes out + of scope. For some reason subclassing Message fixes this bug + (Bus::send_with_reply_and_block): use EmptyMessage instead of Message + - s/Message(_create=0)/EmptyMessage everywhere else + + * test/python/test-{server|client}.py: add the python/.libs directory + to the lookup path so dbus_bindings and dbus_glib_bindings don't + get picked up from the system + +2005-08-25 Colin Walters <walters@verbum.org> + + * glib/dbus-gproxy.c (dbus_g_proxy_call): Doc update, thanks + to Ryan Lortie for the suggestion. + +2005-08-24 John (J5) Palmieri <johnp@redhat.com> + + * test/python: Add python regression test + + * configure.in: Add test/python/Makefile + + * test/Makefile.am: Add the python directory to SUBDIRS + +2005-08-24 John (J5) Palmieri <johnp@redhat.com> + + * Release 0.36.1 + + * python/_dbus.py: + (Interface::connect_to_signal): propigate keywords for match on args + (Bus::add_signal_receiver): Fix typo s/dbus_inteface/dbus_interface + + * python/proxies.py (ProxyObject::connect_to_signal): + propigate keywords for match on args + + * Makefile.am: point everything to pyexecdir since python borks + on multilib + +2005-08-23 John (J5) Palmieri <johnp@redhat.com> + + * Release 0.36 + +2005-08-23 Colin Walters <walters@verbum.org> + + * test/glib/Makefile.am: Don't multiply-define EXTRA_DIST. + +2005-08-23 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_glib_bindings.pyx: reorder imports and c definitions + to fix some wranings. We now use dbus_bindings.DBusConnection instead + of defining DBusConnection ourselves. + +2005-08-18 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus.pth: New path file to fix up problems when installing + c libraries to lib64 and python files to lib. + + * python/Makefile.am: install dbus.pth in the correct spot + +2005-08-17 John (J5) Palmieri <johnp@redhat.com> + * ChangeLog: clean up my last entry a bit + + * doc/introspect.xsl: New stylesheet for converting introspection data + into browser renderable xhtml. Contributed by Lennart Poettering. + + * doc/introspect.dtd: Fixups in the introspect format from Lennart + Poettering. + + * doc/dbus-tutorial.xml: + - Add Colin Walter to the Authors section for authoring the GLib + section + - Add descriptions of the new signature and type functionality + in the Python complex type mapping section + - Add a sidenote on the new args matching functionality in + the Python bindings + - Fixed up some of the examples to use the gobject.MainLoop + instead of gtk.main + + * python/_dbus.py: + (Bus::_create_args_dict): New. Converts a hash of arg matches + to a more useable format + (Bus::add_signal_receiver): add a **keywords parameter for catching + arg match parameters + (Bus::remove_signal_receiver): add a **keywords parameter for catching + arg match parameters + + * python/matchrules.py: + (MatchTree::exec_matches): Check for arg matches + (SignalMatchRule::add_args_match): New method + (SignalMatchRule::execute): Added args_list parameter as an optimization + so we don't have to marshal the args more than once + (SignalMatchRule::match_args_from_list): New method that checks to see + if the rule's arg matches match an argument list. Only arguments + set in the rule are checked. + (SignalMatchRule::match_args_from_rule): New method that checks to see + if the rule's arg matches match another rule's. All args have to match + in order for this method to return true. If either rule has more args + then it is not a match. + (SignalMatchRule::is_match): Add args match + (SignalMatchRule::repr): Add args to the final output if they exist + +2005-08-17 Ross Burton <ross@burtonini.com> + + * glib/dbus-gproxy.c: + (dbus_g_proxy_call_no_reply): unref the message once sent. + (dbus_g_proxy_call): protect against NULL proxy. + +2005-08-16 John (J5) Palmieri <johnp@redhat.com> + + * python/__init__.py: Version updated (0, 43, 0) + + * python/dbus_bindings.pyx: + - Fixed type objects to have self passed into __init__ + - Added the Variant type + - Add the ability to specify types or signatures for Array, Variant + and Dictionary + (Connection::send_with_reply_handlers): return a PendingCall object + (_pending_call_notification): handle the case when an error is returned + without an error message in the body + (MessageIter::get_boolean): return True or False instead of an integer + (MessageIter::python_value_to_dbus_sig): add direct checking of types + and add checks for objects with embeded signatures or types (Array, + Variant and Dictionary) + (MessageIter::append_byte): handle case when the value is a dbus.Byte + (MessageIter::append_dict): handle embeded types or signatures + (MessageIter::append_array): handle embeded types or signatures + (MessageIter::append_variant): new method + + * python/proxies.py: + (DeferedMethod): New. Dummy executable object used when queuing calls + blocking on introspection data + (ProxyMethod::__call__): add the timeout keyword for specifying longer + or shorter timeouts for method calls + (ProxyObject): Add first pass at an introspection state machine + (ProxyObject::__init__): Add introspect keyword for turing off an on + introspection. + (ProxyObject::_Introspect): Internal Introspect call that bypasses + the usual mechanisms for sending messages. This is to avoid a deadlock + where the Intospect call would be queued waiting for the Introspect + call to finish ;-) + (ProxyObject::_introspect_reply_handler): New. This method is called + when introspection returns with no error + (ProxyObject::_introspect_error_handler): New. This method is called + when introspection encounters an error + (ProxyObject::__getattr__): Code to handle different introspection + states. Queue async calls or block blocking calls if we are + introspecting. Pass through as normal if we are not or are done with + introspecting. + + * python/service.py: Import signal and method from decorators.py + + * python/types.py: Add Variant type + +2005-08-16 Colin Walters <walters@verbum.org> + + * glib/dbus-gobject.c (dbus_set_g_error): Don't lose if the + DBusError message is NULL. + +2005-08-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-errors.c: apply patch from Timo Teras to make a + malloc'd copy of the name parameter + +2005-08-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (dbus_message_set_reply_serial): print + warning if the reply serial is set to 0 + +2005-08-04 Colin Walters <walters@verbum.org> + + * glib/dbus-gvalue-utils.h (_dbus_g_type_specialized_builtins_init) + (dbus_g_type_is_fixed, dbus_g_type_fixed_get_size) + (dbus_gvalue_set_from_pointer, dbus_g_hash_table_value_foreach) + (dbus_g_hash_table_insert_values, dbus_g_hash_table_insert_steal_values) + (dbus_gtype_is_valid_hash_key, dbus_gtype_is_valid_hash_value) + (dbus_g_hash_func_from_gtype, dbus_g_hash_free_from_gtype) + (dbus_g_hash_equal_from_gtype, dbus_gvalue_stor, dbus_gvalue_take): + * glib/dbus-gvalue.h (dbus_g_value_types_init) + (dbus_gvalue_demarshal, dbus_gvalue_demarshal_variant) + (dbus_gvalue_demarshal_message, dbus_gvalue_marshal): + + Prefix name with _ to ensure they're not exported. All callers + updated. + + * glib/dbus-gvalue.c (typecode_to_gtype) + (dbus_typecode_maps_to_basic, basic_typecode_to_gtype) + (signature_iter_to_g_type_dict) + (signature_iter_to_g_type_array) + (dbus_gtype_from_signature_iter, dbus_gtype_from_signature) + (dbus_gtypes_from_arg_signature): + Move to dbus-gsignature.c. + + * glib/dbus-binding-tool-glib.c (dbus_binding_tool_output_glib_server): Call + dbus_g_type_specialized_builtins_init instead of dbus_g_value_types_init. + (dbus_binding_tool_output_glib_client): Ditto. + + * glib/Makefile.am (DBUS_GLIB_INTERNALS): Add dbus-gsignature.c + and dbus-gsignature.h + + * test/glib/test-service-glib.c (my_object_rec_arrays): Delete + unused variable. + +2005-08-03 Colin Walters <walters@verbum.org> + + * glib/dbus-gobject.c: Add tests on hardcoded object info; this should + catch any incompatible changes accidentally made. + +2005-08-03 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): fix + typo, from Julien Puydt + + * bus/connection.c (bus_connection_disconnected): we were always + doing a wait_for_memory due to a buggy loop, found by Timo Hoenig + +2005-08-01 Colin Walters <walters@verbum.org> + + Patch from Joe Markus Clarke: + + * glib/dbus-gidl.c (property_info_unref, arg_info_unref): Fix + use-after-free. + +2005-08-01 Colin Walters <walters@verbum.org> + + Patch from Joe Markus Clarke: + + * tools/dbus-send.c (main): + + Don't use C99 style initializers (bug #3933). + +2005-08-01 Colin Walters <walters@verbum.org> + + Patch from Joe Markus Clarke: + + * glib/dbus-gvalue.c (dbus_g_value_types_init): + * glib/dbus-gvalue-utils.c (dbus_g_type_specialized_builtins_init) + * glib/dbus-gobject.c (write_interface): + + Don't use C99 style initializers (bug #3933). + +2005-07-31 Havoc Pennington <hp@redhat.com> + + * tools/dbus-viewer.c (load_child_nodes): fix invocation of + dbus_g_proxy_call, fix from Piotr Zielinski bug #3920 + +2005-07-30 Havoc Pennington <hp@redhat.com> + + * fix a bunch of Doxygen warnings and mistakes + +2005-07-30 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_string_parse_uint): remove #ifdef + DBUS_BUILD_TESTS since it's now used in production code + +2005-07-29 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c (write_junk): initialize the junk + buffer so valgrind doesn't have a breakdown + +2005-07-29 Havoc Pennington <hp@redhat.com> + + * bus/Q_SIGNALS.c (bus_Q_SIGNALS_test): add match_rule_equal() tests + (match_rule_matches): remove unused arg + (test_matching): add tests for match_rule_matches() + + * bus/Q_SIGNALS.c (bus_match_rule_parse_arg_match): add ability to + do arg0='foo' arg5='bar' in the match rules + (match_rule_matches): don't match if the arg0='foo' doesn't match. + + * dbus/dbus-protocol.h (DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER): add this + +2005-07-29 Ross Burton <ross@openedhand.com> + + * dbus/dbus-connection.c: + Don't create a DBusCondVar which is never used. + +2005-07-27 Ross Burton <ross@openedhand.com> + + * dbus/dbus-message.c: + Reduce the size of the maximum cached message to 10K. + +2005-07-25 Ross Burton <ross@openedhand.com> + + * glib/dbus-gproxy.c: + Remove matches when all proxies are unregistered. + +2005-07-24 Colin Walters <walters@verbum.org> + + * glib/dbus-gvalue.c (signature_iter_to_g_type_array): Don't require + typedata; recursive arrays won't have it. + + * test/glib/test-dbus-glib.c: + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: Add recursive arrays tests. + +2005-07-20 John (J5) Palmieir <johnp@redhat.com> + + * python/_dbus.py, _util.py, decorators.py, extract.py, matchrules.py. + proxies.py, service.py: Cleanup of code after running it through the + pyflakes code checker mostly dealing with undefined names. + (Bug #3828, Patch from Anthony Baxter <anthony@interlink.com.au>) + +2005-07-17 John (J5) Palmieri <johnp@redhat.com> + + * NEWS: Update to 0.35.2 + +2005-07-17 John (J5) Palmieri <johnp@redhat.com> + + * python/_dbus.py: Remove import of the dbus.services + module as it no longer exists (patch from Dimitur Kirov) + + * python/service.py (Object::__init__): Fixed typo + s/name/bus_name (patch from Dimitur Kirov) + + * python/examples/example-signal-emitter.py: import dbus.glib + to get the main loop and use glib mainloop instead of gtk so + X doesn't have to be running. + + * python/examples/example-signal-recipient.py: import dbus.glib + to get the main loop and use glib mainloop instead of gtk so + X doesn't have to be running. Import the decorators module + directly. + + * test/glib/Makefile.am: Added DIST_EXTRA files that distcheck + didn't pick up on but are needed to build + + * configure.in: upped version to 0.35.2 + + * bus/driver.c, bus/selinux.c, bus/selinux.h, dbus/dbus-protocol.h: + added Colin Walters' SELinux API rename patch from head + s/unix sercurity context/selinux security context/ + +2005-07-16 John (J5) Palmieri <johnp@redhat.com> + + * python/Makefile.am: dbus_binding.pxd.in should be included + in EXTRA_DIST not dbus_binding.pxd + fix up $(srcdir) hopefully for the last time + + * NEWS: Update to 0.35.1 + +2005-07-16 Colin Walters <walters@verbum.org> + + * bus/driver.c (bus_driver_handle_get_connection_selinux_security_context): Renamed + from bus_driver_handle_get_connection_unix_security_context. Update for + error usage. + (message_handlers): Update for renames. + + * bus/selinux.c (bus_selinux_allows_send): Handle OOM on + _dbus_string_init failure correctly. + (bus_selinux_append_context): Convert SID to context. Append it + as a byte array. + (bus_selinux_shutdown): Handle the case where bus_selinux_full_init + hasn't been called. + + * bus/selinux.h: Update prototype. + + * dbus/dbus-protocol.h (DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN): Renamed + from DBUS_ERROR_UNIX_SECURITY_CONTEXT_UNKNOWN. + +2005-07-15 Colin Walters <walters@verbum.org> + + * doc/TODO: Add note about convenience wrappers. + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * NEWS: Update to 0.35 + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * glib/Makefile.am: Add make-dbus-glib-error-switch.sh to EXTRA_DIST + so distcheck doesn't fail + + * glib/examples/Makefile.am: Add example-service.xml and + example-signal-emitter.xml to EXTRA_DIST so distcheck doesn't fail + + * glib/examples/statemachine/Makefile.am: Add statemachine.xml and + statemachine-server.xml to EXTRA_DIST so distcheck doesn't fail + + * python/Makefile.am: Preprend $(srcdir)/ to source files so the + compiler looks in the right places during distcheck + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * glib/example/Makefile.am: Fix a typo which cause make distcheck + to fail + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * python/examples/example-service.py, + python/examples/example-signal-emitter.py: Fixed up examples + for API changes + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * python/__init__.py: Upped to version (0,42,0) because of + the API change + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * ChangeLog: fix date in last entry + + * configure.in, bus/system.conf.in: add the ability to configure + the system bus user at compiletime with the --with-dbus-user flag + (patch from Kristof Vansant) + +2005-07-15 John (J5) Palmieri <johnp@redhat.com> + + * bus/dispatch.c, test/test-service.c: Add testcase + for sending messages to oneself (TODO item). + + * python/service.py (class Object): Swap ordering of bus_name + and object_path parameters to better support inheritance. + + * doc/dbus-tutorial.xml: change Python docs to reflect change + in parameter ordering and fix the inheritance section. + + * doc/TODO: remove sending message to oneself TODO item + +2005-07-15 Ross Burton <ross@openedhand.com> + + * glib/dbus-gproxy.c: + Fix a leak when calling methods via the proxy. + +2005-07-15 Colin Walters <walters@verbum.org> + + * bus/selinux.c (bus_selinux_append_context): Wrap in + HAVE_SELINUX. + +2005-07-14 John (J5) Palmieri <johnp@redhat.com> + + * python/_dbus.py (Bus::remove_signal_receiver): + don't add a callback to the match if none has been passed in + + * python/matchrules.py (SignalMatchTree::remove): if the rule + being matched does not have a callback treat it as a wildcard + fix matching logic + + * doc/dbus-tutorial.xml: Add Python tutorial + +2005-07-14 Colin Walters <walters@verbum.org> + + * bus/driver.c + (bus_driver_handle_get_connection_unix_security_context): New function. + (message_handlers): Add. + + * bus/selinux.c (bus_selinux_append_context): New function; appends + security context to message. + + * bus/selinux.h: Prototype. + + * dbus/dbus-protocol.h (DBUS_ERROR_UNIX_SECURITY_CONTEXT_UNKNOWN): New. + +2005-07-14 John (J5) Palmieri <johnp@redhat.com> + + * bus/activation.c: clean up all tabs to be 8 spaces + (bus_activation_activate_service): make sure we clean up + if activation fails + + * bus/dispatch.c: clean up all tabs to be 8 spaces + (check_shell_fail_service_auto_start): New function + tests to make sure we get fail properly when trying to auto start a service + with a faulty command line + (check_shell_service_success_auto_start): New function tests to make sure + auto started services get the arguments on the command line + + * test/test-shell-service.c: Added service for testing auto-starting with + command line arguments + + * test/data/valid-service-files/debug-shell-echo-fail.service.in, + test/data/valid-service-files/debug-shell-echo-success.service.in: + Added service files for testing auto-starting with command line arguments + + * */.cvsignore: added a bunch of generated files to various .cvsignore files + +2005-07-14 Rodrigo Moya <rodrigo@novell.com> + + * dbus/dbus-shell.[ch]: copy/pasted code from GLib. + + * dbus/Makefile.am: added new files to build. + + * bus/activation.c (bus_activation_activate_service): support + activation commands with parameters. + + * test/shell-test.c: added test program for the shell parsing + code. + +2005-07-13 David Zeuthen <davidz@redhat.com> + + * tools/dbus-send.c (append_arg, type_from_name): Also support 16 and + 64 bit signed and unsigned parameters + +2005-07-13 John (J5) Palmieri <johnp@redhat.com> + + * python/.cvsignore: remove dbus_bindings.pyx, add dbus_bindings.pxd + + * python/service.py (class Name): renamed BusName to make it clearer + what the object is for (a name on the bus) + + * python/examples/example-service.py, + python/examples/example-signal-emitter.py: change the Name object to + BusName + +2005-07-12 Colin Walters <walters@verbum.org> + + Patch from Jim Gettys <Jim.Gettys@hp.com>. + + * tools/dbus-launch.c: Include sys/select.h. + +2005-07-12 John (J5) Palmieri <johnp@redhat.com> + * python/dbus_bindings.pyx.in: removed + + * python/dbus_bindings.pyx: Added. + - Fixed some memleaks (patch from + Sean Meiners <sean.meiners@linspireinc.com>) + - Broke out the #include "dbus_h_wrapper.h" and put it in its + own pxd file (Pyrex definition) + - Broke out glib dependancies into its own pyx module + + * python/dbus_bindings.pdx: Added. + - Defines C class Connection for exporting to other modules + + * python/dbus_glib_bindings.pyx: Added. + - New module to handle lowlevel dbus-glib mainloop integration + + * python/glib.py: Added. + - Registers the glib mainloop when you import this module + + * python/services.py: Removed (renamed to service.py) + + * python/service.py: Added. + - (class Server): renamed Name + + * python/__init__.py: Bump ro version (0,41,0) + -don't import the decorators or service module + by default. These now reside in the dbus.service namespace + + * python/_dbus.py (Bus::__init__): Add code run the main loop + setup function on creation + + * python/examples/example-service.py, + python/examples/example-signal-emitter.py: update examples + + * python/examples/gconf-proxy-service.py, + python/examples/gconf-proxy-service2.py: TODO fix these up + + * doc/TODO: Addition + - Added a Python Bindings 1.0 section + - added "Add match on args or match on details to match rules" + + +2005-07-12 Colin Walters <walters@verbum.org> + + * glib/examples/statemachine/Makefile.am (statemachine-server-glue.h) + (statemachine-glue.h): + * glib/examples/Makefile.am (example-service-glue.h) + (example-signal-emitter-glue.h): + * glib/Makefile.am (dbus-glib-error-switch.h): + Add libtool --mode=execute so we use the built library instead + of any installed one. + +2005-07-11 Colin Walters <walters@verbum.org> + + * glib/dbus-gvalue.c (struct _DBusGValue): Delete. + (dbus_g_value_types_init): Remove assertion. + (dbus_g_value_get_g_type, dbus_g_value_open) + (dbus_g_value_iterator_get_values, dbus_g_value_get_signature) + (dbus_g_value_copy, dbus_g_value_free): Delete unimplemented + functions related to DBusGValue. Now we marshal/demarshal + structures as GValueArray. + (dbus_gtype_from_signature_iter): Return G_TYPE_VALUE_ARRAY for + structures. + (signature_iter_to_g_type_array): Don't call + signature_iter_to_g_type_struct. + (signature_iter_to_g_type_struct): Delete. + (dbus_gvalue_to_signature): Delete. + (dbus_gvalue_to_signature): New function with same name as other + one; we can convert structures to signatures. + (demarshal_valuearray): New function. + (get_type_demarshaller): Use it. + (demarshal_recurse): Delete. + (marshal_proxy): New function. + (marshal_map): Warn if we can't determine signature from type. + (marshal_collection_ptrarray): Ditto. + (marshal_collection_array): Ditto. + (get_type_marshaller): Use marshal_valuearray. + (marshal_recurse): Delete. + (_dbus_gvalue_test): Add some tests. + + * dbus/dbus-glib.h (struct _DBusGValueIterator): + (dbus_g_value_get_g_type, DBUS_TYPE_G_VALUE) + (dbus_g_value_open, dbus_g_value_iterator_get_value) + (dbus_g_value_iterator_get_values, dbus_g_value_iterator_recurse) + (dbus_g_value_free): Remove prototypes. + + * glib/dbus-binding-tool-glib.c (dbus_g_type_get_lookup_function): Handle + G_TYPE_VALUE_ARRAY. + + * glib/examples/example-service.c: + * glib/examples/example-client.c: Implement GetTuple. + + * test/glib/test-dbus-glib.c: + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: Add structure tests. + +2005-07-10 Colin Walters <walters@verbum.org> + + * doc/TODO: Knock off some GLib items with this patch. + + * glib/dbus-gvalue-utils.c (_dbus_gtype_can_signal_error) + (_dbus_gvalue_Q_SIGNALS_error): New functions. + + * glib/dbus-gvalue-utils.h: Prototype them. + + * glib/dbus-gobject.c (arg_iterate): Update to handle return vals + and change to not output const/retval flags for input args. All + callers updated. + (invoke_object_method): Refactor to handle return values. Add + some more comments in various places. Remove debug g_print. + + * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_RETURNVAL): New. + + * glib/dbus-binding-tool-glib.c (dbus_g_type_get_marshal_name): + Handle G_TYPE_NONE. + (compute_gsignature): New function; refactored from code from + compute_marshaller and compute_marshaller_name. Enhance to + handle return values and async ops more cleanly. Update for + async ops returning NONE instead of BOOLEAN. + (compute_marshaller, compute_marshaller_name): Call compute_gsignature + and output appropriate string. + (generate_glue): Handle return value annotation. Also don't dump + constness flag for input arguments. + + * glib/Makefile.am (DBUS_GLIB_INTERNALS): New variable; tqcontains + files shared between installed library and utilities. + (libdbus_glib_1_la_SOURCES): Move some stuf into DBUS_GLIB_INTERNALS. + (libdbus_gtool_la_SOURCES): Suck in DBUS_GLIB_INTERNALS so the + binding tool can access gtype utility functions. + + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: + * test/glib/test-dbus-glib.c: Add some tests for return values. + +2005-07-09 Colin Walters <walters@verbum.org> + + * glib/dbus-gparser.c (parse_annotation): Add annotations to + argument if available, not method. + + * glib/dbus-gobject.c (arg_iterate): More verbose warnings. + (invoke_object_method): First, remove some redundant + GValues (object_value, error_value) in favor of working on + array directly. Second, rework constness to be less buggy. + Now we iterate directly over the argument metadata instead + of parallel iterating over output signature and metadata. + + * glib/dbus-glib-tool.h: Add INVALID_ANNOTATION error. + + * glib/dbus-binding-tool-glib.c (generate_glue): Barf on const + annotation on input args. + +2005-07-09 Colin Walters <walters@verbum.org> + + * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_CONST): + Define. + + * glib/dbus-binding-tool-glib.c (generate_glue): Handle Const + annotation. + + * glib/dbus-gobject.c (arg_iterate): Update to parse constval too. + (method_dir_signature_from_object_info): Handle arg_iterate change. + (write_interface): Ditto. + (lookup_object_info): Don't barf if format_version is > 0. + (invoke_object_method): Handle arg constness. + + * glib/dbus-gidl.c (struct ArgInfo): Add annotations. + (arg_info_new): Create. + (arg_info_unref): Destroy. + (arg_info_get_annotations, arg_info_get_annotation) + (arg_info_add_annotation): New functions. + + * glib/dbus-gidl.h: Prototype them. + + * glib/dbus-gparser.c (parse_annotation): Allow annotations in + args, disallow them in properties. + (parse_annotation): Handle arg annotations. + + * test/glib/test-service-glib.xml: + * test/glib/test-service-glib.c: Update to make some methods + const. + +2005-07-08 Colin Walters <walters@verbum.org> + + * test/glib/test-service-glib.xml: + * test/glib/test-service-glib.c: + * test/glib/test-dbus-glib.c: Test a{sv}. + + * glib/examples/statemachine/statemachine.c: + * glib/examples/statemachine/statemachine-server.c: + * glib/examples/statemachine/statemachine-client.c: Fix some bugs, + add progress bar, etc. + + * glib/dbus-gvalue.c (register_array, register_dict): Delete; not + needed anymore due to generic array/map marshalling. + (dbus_g_value_types_init): Don't register basic arrays or the + string/string hash. + (dbus_gtype_from_signature_iter): Don't try to recurse into + variants. + (dbus_gtype_to_signature): Check collection/map before type + metadata. + (demarshal_garray_basic): Renamed to demarshal_collection_array. + (demarshal_ghashtable): Renamed to demarshal_map; fix to use new + generic map creation/append functions instead of hash table + specifically. + (get_type_demarshaller): Handle maps. + (demarshal_collection): Dispatch on collection type to either + demarshal_collection_ptrarray or demarshal_collection_array. + (get_type_marshaller): Handle maps. + (marshal_collection): Dispatch collection type to either + marshal_collection_ptrarray or marshal_collection_array. + (_dbus_gvalue_test): New test. + + * glib/dbus-gvalue-utils.c (unset_and_free_g_value): New function. + (hash_free_from_gtype): Use it to free GValues. + (hashtable_append): New function. + (ptrarray_append): Fix prototype. + (slist_append): Ditto. + (_dbus_gvalue_utils_test): Extend tests. + + * glib/dbus-gtype-specialized.c + (dbus_g_type_specialized_init_append): Renamed from + dbus_g_type_specialized_collection_init_append. Remove const from + value, since we steal it. + (dbus_g_type_specialized_map_append): New function. + + * glib/dbus-gtype-specialized.h: Update prototypes. + Add DBusGTypeSpecializedMapAppendFunc. + + * glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run + _dbus_gvalue_test. + + * glib/dbus-gtest.h: Prototype it. + +2005-07-08 Ross Burton <ross@openedhand.com> + + * dbus/dbus-glib.h: + Add DBysGAsyncData for the async bindings. + + * glib/dbus-binding-tool-glib.c: + Re-enable the async bindings. + + * test/glib/test-dbus-glib.c: + Add a test for the generated async bindings. + +2005-07-08 Colin Walters <walters@verbum.org> + + * doc/TODO: Update GLib todo bits, also add a post-1.0 TODO for a + connection concept. + +2005-07-08 Colin Walters <walters@verbum.org> + + * tools/Makefile.am: Kill of print-introspect in favor of using + dbus-send --print-reply=literal. + + * test/glib/test-service-glib.xml: + * test/glib/test-service-glib.c (my_object_get_objs): New test + for "ao". + + * test/glib/test-dbus-glib.c (echo_received_cb): Free echo data. + (main): Test GetObjs. + + * glib/examples/statemachine/Makefile.am: + * glib/examples/statemachine/sm-marshal.list: + * glib/examples/statemachine/statemachine-client.c: + * glib/examples/statemachine/statemachine-server.c: + * glib/examples/statemachine/statemachine-server.xml: + * glib/examples/statemachine/statemachine.c: + * glib/examples/statemachine/statemachine.h: + * glib/examples/statemachine/statemachine.xml: + + New example. + + * glib/examples/example-service.c (main): Move invocation + of dbus_g_object_type_install_info earlier, to emphasize it + should only be done once. + + * glib/examples/example-signal-emitter.c (main): Ditto. + + * glib/examples/Makefile.am (SUBDIRS): Include statemachine. + + * glib/dbus-gvalue.h (dbus_gtype_to_signature) + (dbus_gvalue_marshal): Update prototypes. + + * glib/dbus-gvalue.c: Update all marshalling functions to take + const GValue instead of GValue. + (signature_iter_to_g_type_array): Return a GPtrArray for nonfixed + types. + (dbus_gvalue_to_signature): Update for dbus_gtype_to_signature + change. + (dbus_gtype_to_signature): Handle generic collecitons and maps. + Return a newly-allocated string. + (demarshal_proxy, demarshal_object_path, demarshal_object) + (demarshal_strv, demarshal_ghashtable): Set error, don't assert if + we get the wrong types from message. + (get_type_demarshaller): New function, extracted from + dbus_gvalue_demarshal. + (demarshal_collection): New function, demarshals generic + collection. + (dbus_gvalue_demarshal): Just invoke result of + get_type_demarshaller. Throw error if we don't have one. + (marshal_garray_basic): Abort on OOM. + (get_type_marshaller): New function, extracted from + dbus_gvalue_marshal. + (collection_marshal_iterator, marshal_collection): New functions; + implements generic marshalling for an iteratable specialized + collection. + (dbus_gvalue_marshal): Just invoke result of get_type_marshaller. + + * glib/dbus-gvalue-utils.c (gvalue_from_ptrarray_value): Handle + G_TYPE_STRING. + (ptrarray_value_from_gvalue): Ditto. + (ptrarray_append, ptrarray_free): New functions. + (slist_constructor, slist_iterator, slist_copy_elt, slist_copy) + (slist_append, slist_end_append, slist_free): New functions. + (dbus_g_type_specialized_builtins_init): Add append fuctions + for GPtrArray and GSList. Register GSList. + (test_specialized_hash, _dbus_gvalue_utils_test): New functions. + + * glib/dbus-gtype-specialized.h (DBusGTypeSpecializedAppendContext): + New. + (dbus_g_type_specialized_collection_init_append) + (dbus_g_type_specialized_collection_append) + (dbus_g_type_specialized_collection_end_append): Prototype. + (DBusGTypeSpecializedCollectionVtable): Add append_func and + end_append_func. + + * glib/dbus-gtype-specialized.c (dbus_g_type_specialized_collection_init_append) + (dbus_g_type_specialized_collection_append) + (dbus_g_type_specialized_collection_end_append): New functions. + (dbus_g_type_map_value_iterate): Take const GValue. + (dbus_g_type_collection_value_iterate): Ditto. + + * glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run + _dbus_gvalue_utils_test. + + * glib/dbus-gtest.h: Prototype it. + + * glib/dbus-gproxy.c (dbus_g_proxy_manager_filter): Avoid + using uninitialized owner_list. + (dbus_g_proxy_begin_call_internal): Move return_if_fail to + public API. + (dbus_g_proxy_end_call_internal): Update to use error set + from dbus_gvalue_demarshal instead of setting it here. + (dbus_g_proxy_begin_call): Move return_if_fail here. + + * glib/dbus-gobject.c (write_interface): Update for + dbus_gtype_to_signature returning new string. + + * configure.in: Add glib/examples/statemachine. + +2005-07-08 Joe Shaw <joeshaw@novell.com> + + * configure.in: Add a configure option, --with-console-auth-dir + + * dbus/dbus-sysdeps-util.c (_dbus_user_at_console): Use the + new setting. Patch from Kay Sievers. + +2005-07-06 Colin Walters <walters@verbum.org> + + * dbus/dbus-glib.h (DBusGPendingCall, DBusGPendingCallNotify) + (DBUS_TYPE_G_PENDING_CALL, dbus_g_pending_call_get_g_type) + (dbus_g_pending_call_ref, dbus_g_pending_call_unref): Delete. + (dbus_g_pending_call_set_notify, dbus_g_pending_call_cancel): + Delete in favor of dbus_g_proxy_begin_call and + dbus_g_proxy_cancel_call. + (DBusGProxyCall, DBusGProxyCallNotify): New. + (dbus_g_proxy_begin_call): Change prototype to take callback, user + data, and destroy function. This tqreplaces + dbus_g_pending_call_set_notify. + (dbus_g_proxy_cancel_call): Prototype. + (DBusGAsyncData): Delete, shouldn't be needed anymore. + + * glib/dbus-gproxy.c (struct _DBusGProxy): Add call_id_counter and + pending_calls map. + (struct _DBusGProxyManager): Add bus_proxy member, which is an + internal proxy for calls to the bus. Remove + pending_nameowner_calls, now the internal proxy keeps track. + (dbus_g_proxy_manager_unref): Unref bus proxy, remove reference to + pending_nameowner_calls. + (got_name_owner_cb): Update prototype, and use + dbus_g_proxy_end_call. + (got_name_owner_cb): Remove reference to pending_nameowner_calls. + (dbus_g_proxy_manager_register): Delete directly libdbus code in + favor of using internal proxy. + (dbus_g_proxy_manager_unregister): Update to use + dbus_g_proxy_cancel_call for any pending GetNameOwner call. + (dbus_g_proxy_init): Initialize pending calls map. + (dbus_g_proxy_constructor): New. + (dbus_g_proxy_class_init): Add get/set property functions, + constructor, and add NAME, PATH, and INTERFACE properties. + (cancel_pending_call): New function. + (dbus_g_proxy_dispose): Iterate over any outstanding calls and + cancel them. + (dbus_g_proxy_set_property, dbus_g_proxy_get_property): New. + (GPendingNotifyClosure): New structure. + (d_pending_call_notify, d_pending_call_free): Moved here from + dbus-glib.c. + (DBUS_G_VALUE_ARRAY_COLLECT_ALL): Moved around to satisfy function + ordering. + (manager_begin_bus_call): New internal function for talking to + internal bus proxy. + (dbus_g_proxy_new): Construct object using GObjet properties. + (dbus_g_proxy_begin_call_internal): Update to take user data, etc. + Create closure of same, and insert call into map of pending calls. + (dbus_g_proxy_end_call_internal): Take call id instead of pending + call. Look up pending call in current set. Remove it when we've + completed. + (dbus_g_pending_call_end, dbus_g_proxy_end_call_internal): Delete. + (dbus_g_proxy_begin_call): Change API to take callback, user data, + and destroy function directly. + (dbus_g_proxy_end_call): Update to take DBusGProxyCall. + (dbus_g_proxy_call): Invoke with NULL callback. + (dbus_g_proxy_cancel_call): New function, tqreplaces + dbus_g_pending_call_cancel. + + * glib/dbus-gparser.c (validate_signature): Fix call to + dbus_set_g_error. + + * glib/dbus-gobject.c (dbus_g_object_type_dbus_metadata_quark): + New quark for attaching metadata to GType. + (info_hash): Delete. + (lookup_object_info): Look up using quark. + (dbus_g_object_type_install_info): Check that a type is classed, + not that it's an object. Also just install type data using quark + instead of using global hash. + + * glib/dbus-glib.c (dbus_g_pending_call_ref) + (dbus_g_pending_call_unref, dbus_pending_call_get_g_type) + (GPendingNotifyClosure): Delete. + (d_pending_call_notify, d_pending_call_free): Move to dbus-gproxy.c. + (dbus_g_pending_call_set_notify, dbus_g_pending_call_cancel): Delete. + + * glib/dbus-binding-tool-glib.c (generate_client_glue): Disable async + client method generation until we can fix it... + + * tools/dbus-viewer.c (load_child_nodes): Use dbus_g_proxy_call. + (load_from_service_thread_func): Ditto. + + * tools/dbus-names-model.c (struct NamesModel): Hold + DBusGProxyCall. + (have_names_notify): Update prototype, use + dbus_g_proxy_cancel_call. + (names_model_reload): Update for new dbus_g_proxy_begin_call API. + + * tools/dbus-monitor.c (filter_func): Update for print_message + API change. + + * test/glib/test-dbus-glib.c: Add more tests for async + invocations. Update many begin_call/end_call pairs to just use + dbus_g_proxy_call. + + * tools/dbus-send.c (main): Add --print-reply=literal mode. This + allows us to dump print-introspect.c. + + * tools/dbus-print-message.h (print_message): Add literal argument + to print_message which is intended to allow printing arguments without + metadata like "string=". + + * tools/dbus-print-message.c (print_iter): Add literal argument. + (print_message): Allow printing string messages literally. + +2005-07-05 Colin Walters <walters@verbum.org> + + * glib/dbus-gproxy.c (marshal_dbus_message_to_g_marshaller): + Remove value refcount leak, original patch from Jorn Baayen + <jorn@openedhand.com>. Also remove useless extra value in favor + of prepending to value array directly. + +2005-07-02 Colin Walters <walters@verbum.org> + + * glib/dbus-gmain.c (_dbus_gmain_test): Fix test. + +2005-07-01 Colin Walters <walters@verbum.org> + + Patch from Jonathan Matthew <jonathan@kaolin.hn.org> + + * glib/dbus-gvalue.c (basic_typecode_to_gtype): Fix return type. + (dbus_g_value_types_init): Marshal G_TYPE_CHAR as DBUS_TYPE_BYTE, + G_TYPE_LONG as DBUS_TYPE_INT32, G_TYPE_ULONG as DBUS_TYPE_UINT32, + and G_TYPE_FLOAT as DBUS_TYPE_DOUBLE. + +2005-06-30 Colin Walters <walters@verbum.org> + + * test/glib/test-dbus-glib.c: + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: Update tests for new error + setting bits, also add async tests (patch from Ross Burton). + + * test/glib/Makefile.am (test_service_glib_LDADD): Add + DBUS_GLIB_THREADS_LIBS. + + * glib/dbus-gproxy.c (get_name_owner) + (dbus_g_pending_call_end_valist): Ditto. + + * glib/dbus-gobject.c (error_metadata): New mapping from GError + domain (GQuark) to DBusGErrorInfo. + (gerror_domaincode_to_dbus_error_name): Attempt to look up error + quark in error_metadata. Take message interface as default + error message interface. + (gerror_to_dbus_error_message): Pass message interface. + (dbus_set_g_error): Resurrected. + (dbus_g_error_info_free): New function. + (dbus_g_object_type_install_info): Use g_type_class_ref instead + of _peek to actually create the object class if it hasn't been + created yet. + (dbus_g_error_domain_register): New function. + + * glib/dbus-gmain.c (dbus_g_bus_get): Switch to dbus_set_g_error. + + * glib/dbus-gparser.c (validate_signature): Ditto. + + * dbus/dbus-glib.h (dbus_g_error_set): Delete. + (dbus_g_error_domain_register): Prototype. + + * glib/dbus-glib.c (dbus_g_error_set): Delete. + Update tests. + +2005-06-29 Colin Walters <walters@verbum.org> + + * dbus/dbus-glib.h: Delete DBUS_TYPE_G_PROXY_ARRAY. Add + DBUS_TYPE_G_OBJECT_PATH. + + * glib/dbus-gvalue.c (dbus_g_value_types_init): Remove marshallers + for G_TYPE_OBJECT and DBUS_TYPE_G_PROXY_ARRAY (the latter should + be handled more generically). Add DBUS_TYPE_G_OBJECT_PATH. + (dbus_g_object_path_get_g_type): New function. + (dbus_gtype_from_signature_iter): Map DBUS_TYPE_OBJECT_PATH + to DBUS_TYPE_G_OBJECT_PATH by default. + (demarshal_proxy): Remove unused name variable. + (demarshal_object_path, marshal_object_path): New functions. + (demarshal_proxy_array, marshal_proxy_array): Delete. + + * glib/dbus-binding-tool-glib.c (dbus_g_type_get_c_name): Map + DBUS_TYPE_G_OBJECT_PATH to char *. + (dbus_g_type_get_lookup_function): Map builtin + DBUS_TYPE_G_OBJECT_PATH. + + * test/glib/test-dbus-glib.c + * test/glib/test-service-glib.c (my_object_objpath): + Adapt tests to new object path marshalling. + +2005-06-29 John (J5) Palmieri <johnp@redhat.com> + + * configure.in: force check for Python >= 2.4 + +2005-06-29 Colin Walters <walters@verbum.org> + + Patch from Ross Burton <ross@openedhand.com> + + * glib/dbus-gobject.c (invoke_object_method): Unset object + value in all cases, not only in async case. + +2005-06-29 Colin Walters <walters@verbum.org> + + * glib/dbus-gproxy.c (struct _DBusGProxy): Add new member + name_call for keeping track of any outgoing GetNameOwner call. + Also add for_owner and associated. + (struct _DBusGProxyManager): Add owner_names, which is hash table + that maps a base name to a list of names it owns (that we're + interested in). Add pending_nameowner_calls which is a list of + all outstanding GetNameOwner; avoids us having to iterate over + every proxy. Add unassociated_proxies which keeps track of name + proxies with no associated name owner. + (dbus_g_proxy_manager_unref): Destroy owner_names. + (struct DBusGProxyNameOwnerInfo): New struct for keeping track of + name refcounts. + (tqfind_name_in_info, name_owner_foreach) + (dbus_g_proxy_manager_lookup_name_owner, insert_nameinfo) + (dbus_g_proxy_manager_monitor_name_owner) + (dbus_g_proxy_manager_unmonitor_name_owner) + (unassociate_proxies, dbus_g_proxy_manager_tqreplace_name_owner): + New functions; they manipulate the owner_names mapping. + (got_name_owner_cb): New function. + (get_name_owner): New function, extracted from + dbus_g_proxy_new_for_name_owner. + (dbus_g_proxy_manager_register): For now we need to keep track of + all NameOwnerChanged. Also if the proxy is for a name, if we + don't already know the name owner, queue a new GetNameOwner + request and add it to our list of unassociated proxies. Otherwise + inc the refcount. + (dbus_g_proxy_manager_unregister): If this proxy is for a name, + cancel any pending GetNameOwner call, etc. + (dbus_g_proxy_manager_filter): Handle NameOwnerChanged. Also use + the owner_names mapping to look up the current names for the + signal source, and dispatch to any proxies for that name. + (dbus_g_proxy_new): Initialize new members. + (dbus_g_proxy_new_for_name): Delete unused proxy variable. + (dbus_g_proxy_new_for_name_owner): Use get_name_owner. + (dbus_g_pending_call_end_valist): New function, extracted from + dbus_g_proxy_end_call_internal. Useful when we don't have a proxy + but want to use the GLib infrastructure. Also note how many + arguments in reply were over. + (dbus_g_pending_call_end): New function, just call + dbus_g_pending_call_end_valist. + (dbus_g_proxy_end_call_internal): Just call + dbus_g_pending_call_end_valist. + + * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): Fix lookup + of builtin marshaller for STRING_STRING_STRING. + + * test/glib/test-dbus-glib.c: + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: + Extend tests to cover name proxies, destruction of owner proxies, + etc. + + * glib/examples/example-signal-recipient.c + (dbus_g_proxy_new_for_name_owner): Create a name proxy. + + * tools/dbus-send.c (main): Print D-BUS error name in addition + to message. + +2005-06-28 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in (cunregister_function_handler, + cmessage_function_handler): Patch from + Anthony Baxter <anthony@interlink.com.au> fixes threading problems + by using the Py_GILState_Ensure/Release to synchronize with the + python runtime. + +2005-06-28 Ray Strode <rstrode@redhat.com> + + * dbus/dbus-spawn.c (_dbus_babysitter_unref): kill + babysitter helper process on last unref, bug #2813. + +2005-06-27 Colin Walters <walters@verbum.org> + + * test/glib/test-dbus-glib.c: + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: + Test hash table signal emitting. + + * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): Convert + types to their fundamental basis types, since this is what + marshallers operate on. Also add an entry for VOID__BOXED. + (dbus_g_object_register_marshaller_array): Convert to fundamental. + +2005-06-26 Havoc Pennington <hp@redhat.com> + + * doc/dbus-tutorial.xml: fix names of interface/service/path, fix + from Don Park + +2005-06-26 Colin Walters <walters@verbum.org> + + * glib/dbus-glib.c (dbus_set_g_error): Delete. + (dbus_g_error_set): New public function from its ashes; used by + both service-side method implementation and GLib bindings + internals. + (dbus_g_error_has_name, dbus_g_error_get_name): New function. + (_dbus_glib_test): Add some tests. + + * test/glib/test-dbus-glib.c (main): Test dbus_g_error_has_name. + + * test/glib/test-service-glib.c (my_object_throw_error): Use + dbus_g_error_set. + + * glib/dbus-gobject.c (gerror_to_dbus_error_message): Handle + errors thrown by dbus_g_error_set. + + * glib/dbus-gmain.c (dbus_g_bus_get): Change to dbus_g_error_set. + + * glib/dbus-gparser.c (validate_signature): Ditto. + + * glib/dbus-gproxy.c (dbus_g_proxy_new_for_name_owner) + (dbus_g_proxy_end_call_internal): Ditto. + + * glib/Makefile.am: Generate dbus-glib-error-switch.h, which + converts DBUS_ERROR_x to DBUS_GERROR_x. + (libdbus_glib_1_la_SOURCES, BUILT_SOURCES, CLEANFILES): Add it. + + * doc/TODO: Remove error TODO. + + * doc/dbus-tutorial.xml: Update with documentation about error + handling. + + * dbus/make-dbus-glib-error-enum.sh: Tighten up regexp to make + sure we only change DBUS_ERROR to DBUS_GERROR, not all ERROR to + GERROR. Also add DBUS_GERROR_REMOTE_EXCEPTION. + +2005-06-22 Colin Walters <walters@verbum.org> + + Patch from Ross Burton <ross@openedhand.com> + + * glib/dbus-gobject.c (dbus_g_method_return): Free out_sig. + +2005-06-20 Colin Walters <walters@verbum.org> + + * configure.in: Add glib/examples. + + * glib/Makefile.am: Add examples/ + + * glib/examples/.cvsignore + * glib/examples/Makefile.am + * glib/examples/example-client.c + * glib/examples/example-service.c + * glib/examples/example-service.xml + * glib/examples/example-signal-emitter.c + * glib/examples/example-signal-emitter.xml + * glib/examples/example-signal-recipient.c: + New files; GLib binding examples, ported from + python/examples. + +2005-06-20 Colin Walters <walters@verbum.org> + + * dbus/dbus-glib.h: + * glib/dbus-gproxy.c: Rename dbus_g_proxy_invoke to + dbus_g_proxy_call. + + * glib/dbus-binding-tool-glib.c: + * doc/dbus-tutorial.xml: + * test/glib/test-dbus-glib.c: Update for rename. + +2005-06-20 Colin Walters <walters@verbum.org> + + Patch suggested by Ross Burton <ross@openedhand.com> + + * glib/dbus-gobject.c (export_Q_SIGNALS): Free signal name. + (g_value_init): Use G_VALUE_NOCOPY_CONTENTS to plug + memory leak. Add a bit of documentation. + (dbus_g_method_return_error): Free context, and note we do + so. + +2005-06-18 Murray Cumming <murrayc@murrayc.com> + + * dbus/dbus-glib.h: + * glib/dbus-gobject.c: + * glib/dbus-gproxy.c: + * glib/dbus-gvalue.c: Predeclare structs as + typedef struct _Something Something instead of + typedef struct Something Something, so we can + redeclare the prototypes. Other GNOME libraries + do this already. + +2005-06-17 Colin Walters <walters@verbum.org> + + * tools/dbus-names-model.c (have_names_notify): Fix call + to dbus_g_proxy_end_call. + +2005-06-17 Colin Walters <walters@verbum.org> + + * glib/dbus-gproxy.c (dbus_g_proxy_emit_remote_signal): Don't + spew warnings if we get malformed remote Q_SIGNALS. + + * glib/dbus-gobject.c (propsig_iterate): New function. + (lookup_object_info): New function, extracted from + lookup_object_and_method. + (introspect_properties, introspect_Q_SIGNALS): Delete; these + are merged into write_interface. + (write_interface): Write out Q_SIGNALS and properties here; + dump the org.gtk.object stuff and use the interface given + in the introspection data blob. Also fix up property XML. + (lookup_values): New function. + (introspect_interfaces): Gather a mapping from interface to a + list of its methods, Q_SIGNALS, and properties, then write out + each interface. + (lookup_object_and_method): Use lookup_object_info. + (struct DBusGSignalClosure): Add interface. + (dbus_g_signal_closure_new): Add interface. Don't dup signame; + we can just use the constant data. + (dbus_g_signal_closure_finalize): Don't free signal name. + (signal_emitter_marshaller): Use interface from signal closure. + (export_Q_SIGNALS): Only export Q_SIGNALS mentioned in introspection + blob. + (dbus_g_connection_register_g_object): Warn if we have no + introspection data for an object. + (funcsig_equal): Remove unused variable. + (dbus_g_object_register_marshaller): Take varargs instead of + list. + (dbus_g_object_register_marshaller_array): New function, + extracted from old dbus_g_object_register_marshaller. + + * glib/dbus-binding-tool-glib.c (struct DBusBindingToolCData): Add + Q_SIGNALS and property data. + (write_quoted_string): New function, extracted from generate_glue. + (generate_glue): Write Q_SIGNALS and properties to introspection + blob. + + * dbus/dbus-glib.h (struct DBusGObjectInfo): Include + exported_Q_SIGNALS and exported_properties. + (dbus_g_object_register_marshaller): Update prototype. + (dbus_g_object_register_marshaller_array): Prototype. + + * test/glib/test-dbus-glib.c: Extend testing to cover new Q_SIGNALS. + + * test/glib/test-service-glib.c: Add new test Q_SIGNALS and method + to emit them. + + * test/glib/test-service-glib.xml: Add some test Q_SIGNALS. + + * test/glib/Makefile.am (BUILT_SOURCES): Add my-object-marshal.c + and my-object-marshal.h + (test_service_glib_SOURCES, test_dbus_glib_SOURCES): Add + my-object-marshal.c. + (my-object-marshal.c, my-object-marshal.h): Implement. + + * test/glib/.cvsignore: Update. + + * doc/TODO: Remove two GLib TODO items fixed by this + patch. + +2005-06-16 Colin Walters <walters@verbum.org> + + * doc/TODO: Update for GLib bindings. + +2005-06-16 Colin Walters <walters@verbum.org> + + * glib/dbus-binding-tool-glib.c: + * glib/dbus-gobject.c: + * glib/dbus-gproxy.c: Add Nokia copyright; Patch + from Ross Burton, for his GLib bindings work. + +2005-06-16 Colin Walters <walters@verbum.org> + + * glib/dbus-gobject.c (funcsig_hash, funcsig_equal): Use n_params + to iterate instead of walking to G_TYPE_INVALID. + + Patch based on a patch from Ryan Gammon. + +2005-06-16 Colin Walters <walters@verbum.org> + + * bus/bus.c (bus_context_new): Set parser to NULL + after we unref it (Patch from Chris Boscolo, #2174). + +2005-06-16 Colin Walters <walters@verbum.org> + + * python/dbus_bindings.pyx.in: Import size_t, + __int64_t, __uint64_t, and __signed. + + * dbus/dbus-sysdeps.c <HAVE_CMSGCRED> (write_credentials_byte): + Define cmsg struct, output it. + (_dbus_read_credentials_unix_socket): + Use cmsg struct. + + Patch from Joe Markus Clarke for FreeBSD support. + +2005-06-16 Colin Walters <walters@verbum.org> + + * tools/dbus-send.c (append_array): Use strtok. + (append_dict): New function. + (type_from_name): New function, extracted from main. + (main): Handle sending dicts. + + * tools/dbus-print-message.c (print_iter): Print dict + entries. + +2005-06-16 Colin Walters <walters@verbum.org> + + * glib/dbus-gvalue.c (marshal_basic): Marshal NULL string + values as the empty string (#2948). + +2005-06-16 Colin Walters <walters@verbum.org> + + * dbus/Makefile.am: + * mono/doc/Makefile.am: + * test/glib/Makefile.am: + + Fix srcdir != builddir issues (Patch from Chris Wilson, #3477) + +2005-06-16 Colin Walters <walters@verbum.org> + + * dbus/dbus-marshal-header.c (_dbus_header_load): Set + header byte order from expected byte order (Patch from Chris Wilson, #3475). + + * dbus/dbus-marshal-byteswap.c (byteswap_body_helper): + Increment pointer after swapping fixed array. Add assertion + for array length. + +2005-06-15 Colin Walters <walters@verbum.org> + + * dbus/dbus-sysdeps.c <HAVE_CMSGCRED> (_dbus_read_credentials_unix_socket): + Fix call to dbus_set_error. (Patch from Michael Banck, #3461) + +2005-06-15 John (J5) Palmieri <johnp@redhat.com> + + * NEWS: Update to 0.34 + +2005-06-15 David Zeuthen <davidz@redhat.com> + + * configure.in (LT_CURRENT): Revert back to 1 as the library + hasn't changed and we've certainly not committed to protocol + stability yet. All this does is to break ABI. See commit note + from hp@redhat.com 2005-05-05 for details. + +2005-06-15 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-connection.c (_dbus_connection_peer_filter): New method + (_dbus_connection_run_builtin_filters): New method + (dbus_connection_dispatch): Run the builtin filters which in turn + runs the peer filter which handles Ping messages. + + * doc/TODO: + - Ping isn't handled: This patch fixes it + + - Add a test case for the Ping message: added TODO item + +2005-06-15 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-message.c: + (dbus_message_has_path): New method + (dbus_message_has_interface): New method + (dbus_message_has_member): New method + + * dbus/dbus/dbus-sysdeps.c (_dbus_check_dir_is_private_to_user): + New method + + * dbus/dbus-keyring.c (_dbus_keyring_reload): Check to see that + the keyring directory is private to the user + + * doc/TODO: + - The convenience functions in dbus-bus.h should perhaps have + the signatures that they would have if they were autogenerated + stubs. e.g. the acquire service function. We should also evaluate + which of these functions to include, in light of the fact that + GLib/Qt native stubs will probably also exist.: Punted + + - add dbus_message_has_path(), maybe has_member/interface: + fixed in this patch + + - in dbus-keyring.c, enforce that the keyring dir is not + world readable/writable: Fixed in this patch + +2005-06-15 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-marshal-validate.h: Added a new validation + error code DBUS_VALIDITY_UNKNOWN_OOM_ERROR = -4 for + out of memory errors when validating signitures + + * dbus/dbus-marshal-header.c: use DBUS_VALIDITY_UNKNOWN_OOM_ERROR + in places where we previously used DBUS_VALID and a FALSE return + value to indicate OOM + + * dbus/dbus-marshal-validate.c (_dbus_validate_signature_with_reason): + Use a stack to track the number of elements inside containers. The + stack values are then used to validate that dict entries have only two + elements within them. + (validate_body_helper): check the reason for failure when validating + varients + + * dbus/dbus-message.c (load_message): use + DBUS_VALIDITY_UNKNOWN_OOM_ERROR in places where we previously used + DBUS_VALID and a FALSE return value to indicate OOM + + * doc/TODO: remove "- validate dict entry number of fields" as this + patch fixes it + +2005-06-14 David Zeuthen <davidz@redhat.com> + + * bus/bus.c (process_config_every_time): Drop existing conf-dir + watches (if applicable) and add new watches + + * bus/main.c (signal_handler): Handle SIGIO if using D_NOTIFY + (main): Setup SIGIO signal handler if using D_NOTIFY + + * bus/config-parser.h: Add prototype bus_config_parser_get_conf_dirs + + * bus/config-parser.c (struct BusConfigParser): Add conf_dirs list + (merge_included): Also merge conf_dirs list + (bus_config_parser_unref): Clear conf_dirs list + (include_dir): Add directory to conf_dirs list + (bus_config_parser_get_conf_dirs): New function + + * bus/dir-watch.[ch]: New files + + * bus/Makefile.am (BUS_SOURCES): Add dir-watch.[ch] + + * configure.in: Add checks for D_NOTIFY on Linux + +2005-06-14 Colin Walters <walters@verbum.org> + + * glib/dbus-binding-tool-glib.c: + * glib/dbus-gobject.c: + * glib/dbus-gvalue.c: Fix indentation and brace style. + +2005-06-14 Ross Burton <ross@openedhand.com>. + + * glib/dbus-glib.h: Make DBusGMethodInvocation + a private structure. Rearrange prototypes a bit. + + * glib/dbus-gproxy.c (dbus_g_proxy_invoke): Add + documentation for first_arg_type. + + * glib/dbus-gobject.c: Move DBusGMethodInvocation + here, add documentation. Move dbus_g_method_return + and dbus_g_method_return_error into public API + section. + +2005-06-14 Colin Walters <walters@verbum.org> + + * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): + Add missing return statements, noticed by Ross Burton. + +2005-06-13 Ross Burton <ross@openedhand.com>. + + * glib/dbus-gobject.c: Handle errors on message + demarshalling by sending error message back. + * glib/dbus-gvalue.c: Initialize return variables. + +2005-06-13 Colin Walters <walters@verbum.org> + + * glib/Makefile.am: Fix thinko in last patch. + +2005-06-13 Colin Walters <walters@verbum.org> + + * glib/Makefile.am: Move dbus-gtype-specialized.c + and dbus-gtype-specialized.h into a _HEADERS variable, + install them. + +2005-06-12 Colin Walters <walters@verbum.org> + + Async Q_SIGNALS and various bugfixes and testing by + Ross Burton <ross@openedhand.com>. + + * glib/dbus-gvalue.h: (struct DBusBasicGValue): Delete. + (dbus_gvalue_genmarshal_name_from_type) + (dbus_gvalue_ctype_from_type): Moved to dbus-binding-tool-glib.c. + (dbus_gtype_to_dbus_type): Renamed to dbus_gtype_from_signature. + (dbus_g_value_types_init, dbus_gtype_from_signature) + (dbus_gtype_from_signature_iter, dbus_gtype_to_signature) + (dbus_gtypes_from_arg_signature): New function prototypes. + (dbus_gvalue_demarshal): Take context and error arguments. + (dbus_gvalue_demarshal_variant): New function. + (dbus_gvalue_demarshal_message): New function. + (dbus_gvalue_store): Delete. + + * glib/dbus-gvalue.c: + + File has been almost entirely rewritten; now we special-case + more types such as DBUS_TYPE_SIGNATURE, handle arrays and + hash tables correctly, etc. Full support for recursive values + is not yet complete. + + * glib/dbus-gproxy.c (dbus_g_proxy_class_init): Change last + argument of signal to G_TYPE_POINTER since we now pass a + structure. + (lookup_g_marshaller): Delete in favor of + _dbus_gobject_lookup_marshaller. + (marshal_dbus_message_to_g_marshaller): Use + _dbus_gobject_lookup_marshaller and dbus_gvalue_demarshal_message + to handle remote signal callbacks. + (dbus_g_proxy_new_from_proxy): New function; creates a new + DBusGProxy by copying an existing one. + (dbus_g_proxy_get_interface, dbus_g_proxy_set_interface) + (dbus_g_proxy_get_path): New functions. + (dbus_g_proxy_marshal_args_to_message): New function; + factored out of existing code. + (DBUS_G_VALUE_ARRAY_COLLECT_ALL): Collect all arguments + from a varargs array. + (dbus_g_proxy_begin_call_internal): New function. + (dbus_g_proxy_end_call_internal): New function. + (dbus_g_proxy_begin_call): Take GTypes instead of DBus types + as arguments; simply invoke dbus_g_proxy_begin_call_internal + after collecting args into value array. + (dbus_g_proxy_end_call): Take GTypes instead of DBus types; + invoke dbus_g_proxy_end_call_internal. + (dbus_g_proxy_invoke): Simply invoke begin_call_interanl and + end_call_internal. + (dbus_g_proxy_call_no_reply): Take GTypes instead of DBus + types. + (array_free_all): New function. + (dbus_g_proxy_add_signal): Take GTypes. + + * glib/dbus-gobject.h: + (_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete. + (_dbus_gobject_get_path, _dbus_gobject_lookup_marshaller): + Prototype. + + * glib/dbus-gobject.c: Add a global marshal_table hash which + stores mappings from type signatures to marshallers. Change lots + of invocations of dbus_gtype_to_dbus_type to + dbus_gtype_to_signature. + (_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete. + (introspect_Q_SIGNALS): Fix test for query.return_type. + (set_object_property): Update invocation of dbus_gvalue_demarshal. + (invoke_object_method): Many changes. Handle asynchronous + invocations. Convert arguments with + dbus_gvalue_demarshal_message. Handle errors. Use + DBusSignatureIter instead of strlen on args. Handle all arguments + generically. Special-case variants. + (dbus_g_method_return, dbus_g_method_return_error): New function. + (DBusGSignalClosure): New structure, closes over signal + information. + (dbus_g_signal_closure_new): New function. + (dbus_g_signal_closure_finalize): New function. + (signal_emitter_marshaller): New function; is special marshaller + which emits Q_SIGNALS on bus. + (export_Q_SIGNALS): New function; introspects object Q_SIGNALS and + connects to them. + (dbus_g_object_type_install_info): Take GType instead of + GObjectClass. + (dbus_g_connection_register_g_object): Invoke export_Q_SIGNALS. + (dbus_g_connection_lookup_g_object): New function. + (DBusGFuncSignature) New structure; used for mapping type + signatures to marshallers. + (funcsig_hash): New function; hashes DBusGFuncSignature. + (funcsig_equal): New function; compares DBusGFuncSignature. + (_dbus_gobject_lookup_marshaller): New function. + (dbus_g_object_register_marshaller): New function; used to + register a marshaller at runtime for a particular signature. + + * glib/dbus-gmain.c (_dbus_gmain_test): Add various tests. + + * glib/dbus-binding-tool-glib.h: Add DBUS_GLIB_ANNOTATION_ASYNC + which notes a server method implementation should be + asynchronous. + + * glib/dbus-binding-tool-glib.c + (dbus_binding_tool_output_glib_server): Call + dbus_g_value_types_init. + (write_formal_parameters): Use dbus_gtype_from_signature. Handle + variants specially. + (dbus_g_type_get_lookup_function): Turn GType into an invocation + of a lookup function. + (write_args_for_direction): Use dbus_g_type_get_lookup_function. + (write_untyped_out_args): New method; write output arguments. + (write_formal_declarations_for_direction): Function for + writing prototypes. + (write_formal_parameters_for_direction): Function for + writing implementations. + (write_typed_args_for_direction): Function for writing + arguments prefixed with GTypes. + (write_async_method_client): Write out async version + of method. + + * glib/dbus-binding-tool-glib.c: Include dbus-gvalue-utils.h. + (dbus_g_type_get_marshal_name): Move mapping from GType + to marshal name into here. + (dbus_g_type_get_c_name): Move into here. + (compute_marshaller): Convert signature to type with + dbus_gtype_from_signature, use dbus_g_type_get_marshal_name. + (compute_marshaller_name): Ditto. + (compute_marshaller): Handle async signal annotations. + (gather_marshallers): Return if we don't have a known + prefix. + (generate_glue): Collect introspection blob here, and + write all of the blob at the end. This allows an object + with multiple interfaces to work. + Mark async methods in introspection blob. + + * glib/Makefile.am (libdbus_glib_1_la_SOURCES): Add + dbus-gtype-specialized.c, dbus-gtype-specialized.h, + dbus-gvalue-utils.h, dbus-gvalue-utils.c. + + * dbus/dbus-glib.h: Don't include dbus-protocol.h; this + avoids people accidentally using DBUS_TYPE_* which should + not be necessary anymore. + Do include dbus-gtype-specialized.h, which are utilities + for GLib container types. + Add various #defines for types such as + DBUS_TYPE_G_BOOLEAN_ARRAY. + (DBusGValueIterator, DBusGValue): Define, not fully used + yet. + (dbus_g_value_get_g_type): Type for recursive value. + (dbus_g_value_open, dbus_g_value_iterator_get_value) + (dbus_g_value_iterator_get_values, dbus_g_value_iterator_recurse) + (dbus_g_value_free): Prototypes. + (dbus_g_object_register_marshaller, dbus_g_proxy_new_from_proxy): Prototype. + (dbus_g_proxy_set_interface): Prototype. + (dbus_g_proxy_begin_call, dbus_g_proxy_end_call) + (dbus_g_proxy_call_no_reply): Take GLib types instead of DBus + types. + (dbus_g_proxy_get_path, dbus_g_proxy_get_interface): + Accessors. + (DBusGAsyncData, DBusGMethodInvocation): Structures for + doing async invocations. + (dbus_g_method_return, dbus_g_method_return_error): + Prototypes. + * doc/dbus-tutorial.xml: Update GLib section. + + * tools/dbus-viewer.c (load_child_nodes): Update + for new invocation type of dbus_g_proxy_end_call. + (load_from_service_thread_func): Ditto. + + * tools/print-introspect.c (main): Ditto. + + * tools/dbus-names-model.c (have_names_notify) + (names_model_reload, names_model_set_connection) + Use GTypes. + + * python/Makefile.am (INCLUDES): Define DBUS_COMPILATION, + needed since Python bindings use GLib bindings. + + * test/glib/Makefile.am (INCLUDES): Define DBUS_COMPILATION. + Add --prefix argument. + + * tools/Makefile.am: Define DBUS_COMPILATION. Remove + unneeded --ignore-unsupported arg. + + * test/glib/test-service-glib.c: + * test/glib/test-service-glib.xml: + * test/glib/test-dbus-glib.c: Add many more tests. + +2005-06-06 David Zeuthen <davidz@redhat.com> + + * doc/TODO: Add item about need to remove deprecated functions. + + * dbus/dbus-connection.h: Add prototype for dbus_connection_disconnect + + * dbus/dbus-connection.c (dbus_connection_disconnect): New function + to repair the ABI which was broken with the last commit. + +2005-06-02 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-connection.c, dbus/dbus-connection.h + (dbus_connection_disconnect): renamed to dbus_connection_close + for API symmetry with dbus_connection_open + (_dbus_connection_open_internal): + s/dbus_connection_disconnect/dbus_connection_close + + * dbus/dbus-bus.c (dbus_bus_get): + s/dbus_connection_disconnect/dbus_connection_close + + * bus/connection.c (bus_connections_unref, + bus_connections_setup_connection, bus_connections_expire_incomplete): + s/dbus_connection_disconnect/dbus_connection_close + + * bus/dispatch.c (bus_dispatch, kill_client_connection, + kill_client_connection_unchecked, check_hello_connection): + s/dbus_connection_disconnect/dbus_connection_close + + * bus/bus.c (new_connection_callback): + s/dbus_connection_disconnect/dbus_connection_close + + * tools/dbus-send.c (main): + s/dbus_connection_disconnect/dbus_connection_close + + * test/glib/test-profile.c (no_bus_thread_func, with_bus_thread_func): + s/dbus_connection_disconnect/dbus_connection_close + + * test/test-service.c (path_message_func, filter_func): + s/dbus_connection_disconnect/dbus_connection_close + + * doc/TODO: remove connection_open/connection_disconnect lacks symmetry item that was just fixed + +2005-05-25 Colin Walters <walters@verbum.org> + + * dbus/dbus-protocol.h: Move various bus service #defines such + as DBUS_SERVICE_DBUS and DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT to + dbus/dbus-shared.h. + * dbus/dbus-shared.h: Various defines moved here. + * dbus/dbus-marshal-header.c: Include dbus-shared.h. + +2005-05-25 John (J5) Palmieri <johnp@redhat.com> + + * python/__init__.py: Python bindings deserve a minor version + update. Upped to (0, 40, 2) + +2005-05-24 John (J5) Palmieri <johnp@redhat.com> + + * python/decorators.py: add explicitly_pass_message decorator + for passing in the dbus message as keyword for edge case signal + handling + + * python/matchrules.py (SignalMatchRule.__repr__): fix output + to conform with what dbus expects for match rules + (SignalMatchRule.execute): add the dbus message as a keyword + if the signal handler has requested it + + * python/examples/example/signal-recipient.py: added some more + examples on how to hook up to Q_SIGNALS + +2005-05-23 John (J5) Palmieri <johnp@redhat.com> + + * python/decorators.py: import dbus_bindings + + * python/matchrules.py (SignalMatchRule, SignalMatchTree, + SignalMatchNode): new classes that implement wildcard signal + callback matching using a tree lookup. Heavily modified from a + patch sent by Celso Pinto (fd.o bug #3241) + + * _dbus.py (add_signal_receiver, remove_signal_receiver, _signal_func): + use new match classes to handle Q_SIGNALS. + +2005-05-19 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: s/TYPE_PATH/TYPE_OBJECT_PATH + +2005-05-18 Havoc Pennington <hp@redhat.com> + + * configure.in: use GLIB_GNU_GETTEXT to get INTLLIBS and require + gettext. Not really worth requiring yet perhaps, but any + production quality 1.0 would require it so we should go ahead and + get things set up. We do have a couple token calls to + bindtextdomain in the code already. + +2005-05-16 John (J5) Palmieri <johnp@redhat.com> + + * glib/dbus-gmain.c (io_handler_dispatch): fix deadlock + when using recursive g_main_loops + + * python/_dbus.py (class Bus): add the ProxyObjectClass + alias for ProxyObject to make it easier for the Twisted + networking framework to integrate dbus. + + * python/proxies.py (class ProxyObject): add the ProxyMethodClass + alias for ProxyMethod to make it easier for the Twisted + networking framework to integrate dbus. + +2005-05-11 Ross Burton <ross@openedhand.com> + + * glib/dbus-glib-tool.c: Add --prefix argument. + * glib/dbus-binding-tool-glib.h: Add prefix argument. + * glib/dbus-binding-tool-glib.c (compute_marshaller_name): + Add prefix argument. + (generate_glue): Pass prefix argument down. + (dbus_binding_tool_output_glib_server): Pass prefix to + glib-genmarshal. + +2005-05-11 Colin Walters <walters@verbum.org> + + * tools/dbus-send.c (append_array): New function. + (append_arg): Broken out from main. + (main): Add cheesy hack to send arrays and variants. + (usage): Update. + * tools/dbus-print-message.c (print_iter): Broken out + from main. + +2005-05-11 Colin Walters <walters@verbum.org> + + * dbus/dbus-signature.c (dbus_signature_iter_get_signature): + New function, returns signature string for signature iter. + * dbus/dbus-signature.h: Prototype it. + * dbus/dbus-message.c (dbus_message_iter_get_signature): + New function, returns signature string for message iter. + (dbus_message_iter_get_array_len): New function, returns + length of array. + (dbus_message_iter_get_fixed_array): Fix assertion; this + function should be used when the iter is pointing to the + contents of an array + * dbus/dbus-message.h: Prototypes. + * dbus/dbus-marshal-recursive.c (_dbus_type_reader_get_array_length): + New function; returns length of an array. + * dbus/dbus-marshal-recursive.h: Prototype it. + +2005-05-11 Colin Walters <walters@verbum.org> + + * dbus/dbus-sysdeps-util.c <!HAVE_POSIX_GETPWNAM_R>: Fix + compilation error. + +2005-05-08 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps-util.c (_dbus_become_daemon): write the + daemon's pid, not the tqparent's pid, to the file descriptor. + Reported by Taj Morton. + +2005-05-05 Havoc Pennington <hp@redhat.com> + + * configure.in (LT_*): add notes on how the libtool versioning + works to save thinking. Increment soname to indicate protocol + breakage (though really the library interface hasn't changed I + guess) + + * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): + verify the GUID received from server matches what we were + expecting, if we had an expectation + + * dbus/dbus-auth.c (send_ok): send GUID along with the OK command + (_dbus_auth_get_guid_from_server): new function + (send_begin): parse the OK args + + * doc/dbus-specification.xml: add GUID to the auth protocol + +2005-05-05 John (J5) Palmieri <johnp@redhat.com> + + * Fix my name in previous changelog ;) + + * python/proxies.py (ProxyObject.__getattr__): add further patch + from Anthony Baxter to throw an AttributeError when python + __special__ functions are called instead of marshling them over + the bus (Bug#1685 comment 3). + +2005-05-04 John (J5) Palmieri <johnp@redhat.com> + + * python/Makefile.am: changed to use pyexecdir for the binding + shared libraries (Bug#2494) + + * python/exceptions.py: bring exceptions over from the bindings + so they can be used in applications (Bug#2036) + Make all exceptions derive from DBusException + + * python/_dbus.py, python/proxies.py: implement __repr__ in a couple + of classes so that print obj doesn't throw an exception (Bug #1685) + +2005-05-03 Ross Burton <ross@openedhand.com> + + * glib/dbus-gobject.c (dbus_g_connection_register_g_object): + Return if we get an error during registration. Set up a + weak reference on object to unregister if object is destroyed. + (unregister_gobject): New function. + +2005-05-01 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: + - added new type classes for hinting to the marashaler what type + to send over the wire + - added int16 and uint16 marshalers + - Fixed a bug in the type constants that caused int32 to go out + as uint16 over the wire + * python/dbus.py: split up into different files and renamed _dbus.py + * python/__init__.py, python/_util.py, python/decorators.py, + python/exceptions.py, python/proxies.py, python/services.py, + python/types.py: new files split off from dbus.py + * python/Makefile.am: Add new files, remove dbus.py and + install all python files to <python module dir>/dbus + * python/examples/*: Added #!/usr/bin/env python to the top of + every example. Patch provided by Tatavarty Kalyan + +2005-04-25 John (J5) Palmieri <johnp@redhat.com> + + * NEWS: Update to 0.33 + +2005-04-25 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in (send_with_reply_handlers): New send + method for doing async calls + (_pending_call_notification): New C function for handling pendning call + callbacks + (set_notify): New method for setting pending call notification + + * python/dbus.py: new version tuple "version" is set at (0, 40, 0) + Async capabilities added to remote method calls + (Sender): class removed + (RemoteService): class removed + (ObjectTree): class removed for now + (RemoteObject): Renamed to ProxyObject + (RemoteMethod): Renamed to ProxyMethod + (method): Decorator added for decorating python methods as dbus methods + (signal): Decorator added for decorating python methods as signal emitters + (ObjectType): Metaclass added for generating introspection data and the + method callback vtable + (Interface): Wrapper class added to wrap objects in a dbus interface + (Object): Uses ObjectType as its metaclass and exports Introspect + of the org.freedesktop.DBus.Introspectable interface + (ValidationException, UnknownMethodException): new exceptions + + * python/examples/*: Modified to fit with the new bindings + +2005-04-23 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (dbus_message_append_args): fix doc comment, + reported by Tony Houghton + + * test/test-service.c (main): test + dbus_connection_get_object_path_data() + + * dbus/dbus-object-tree.c (tqfind_handler): be sure we always init + the exact_match + (_dbus_object_tree_get_user_data_unlocked): new function used by + dbus_connection_get_object_path_data() + (do_register): add assertion test for get_user_data_unlocked + (object_tree_test_iteration): more tests + + * dbus/dbus-connection.c (dbus_connection_get_object_path_data): + new function from Dan Reed to let you get the user data from + dbus_connection_register_object_path() + +2005-04-23 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-marshal-recursive-util.c: Fixed buffer overflow + in numerous places that did not account for the NULL terminator + (signature_from_seed): changed the manual string copy loop to + just use strcpy instead + make check should now pass + +2005-04-19 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-marshal-header.c (_dbus_header_create): Fix assert + so that it allows messages that are not Q_SIGNALS to pass in + NULL as the interface. + +2005-04-18 David Zeuthen <davidz@redhat.com> + + * glib/dbus-gmain.c (io_handler_destroy_source): + (timeout_handler_destroy_source, connection_setup_free): + Also unref the source to avoid memory leaks. + +2005-04-13 David Zeuthen <davidz@redhat.com> + + * bus/config-parser.c (bus_config_parser_new): Bump this to a + more reasonable, yet still totally arbitrary, value :-). + +2005-04-13 David Zeuthen <davidz@redhat.com> + + * doc/TODO: Added an "important for 1.0" item about selinux + allow/deny messages + +2005-04-13 David Zeuthen <davidz@redhat.com> + + * bus/selinux.c: Add c-file-style to top of file + (log_audit_callback): Don't free the data here anymore + (bus_selinux_check): Don't take spid and tpid since appending + that to auxdata may OOM. + (bus_selinux_allows_acquire_service): Handle OOM and signal back + to the caller if we are OOM by taking an error object. + (bus_selinux_allows_send): -do- + + * bus/selinux.h: Fix prototypes for bus_selinux_allows_acquire_service + and bus_selinux_allows_send + + * bus/bus.c (bus_context_check_security_policy): Pass error and + pass on OOM thrown by bus_selinux_allows_send() + + * bus/services.c (bus_registry_acquire_service): Pass error and + pass on OOM thrown by bus_selinux_allows_acquire_service() + +2005-04-13 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gmain.c (message_queue_dispatch): only dispatch one + message at a time to avoid monopolizing the main loop, bug + #2953 from Benjamin Otte + +2005-04-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (copy): change a memcpy to memmove due to + possible overlap, fix from Daniel Reed + (fixup_tqalignment): fix signedness warnings + (_dbus_string_append_unichar): ditto + +2005-04-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-util.c (_dbus_message_test): fix signedness warning + + * glib/dbus-glib-tool.c (main): fix warning + + * glib/dbus-binding-tool-glib.c (generate_glue): fix warning + + * dbus/dbus-connection.c (dbus_connection_read_write_dispatch): + add a new function that can be used in simple applications that + don't have a main loop and are willing to block + +2005-04-05 David Zeuthen <davidz@redhat.com> + + Fix https://bugs.freedesktop.org/show_bug.cgi?id=2889 + + * glib/dbus-gmain.c: + (io_handler_destroy_source): Remove from list of IO handlers + of the ConnectionSetup object + (timeout_handler_destroy_source): -do- for timeout handlers + (io_handler_source_finalized): Don't remove from list since + we now do that in io_handler_destroy_source(). Renamed from + io_handler_source_destroyed + (timeout_handler_source_destroyed): -do- for timeout handlers + (connection_setup_free): It is now safe to iterate over all + IO and timeout handlers as the _destroy_source removes them + from the list synchronously + +2005-03-30 Havoc Pennington <hp@redhat.com> + + * configure.in: change check to gtk 2.4 + + * tools/dbus-viewer.c (name_combo_changed_callback): remove + gtk_combo_box_get_active_text() usage to decrement GTK requirement + to 2.4 + +2005-03-29 John (J5) Palmieri <johnp@redhat.com> + + * News: Update 0.32 + + * HACKING: Fixed realease instructions. configure.in should be updated to + the next release by the person who made the last release. + +2005-03-29 John (J5) Palmieri <johnp@redhat.com> + + * python/lvalue_cast_post_process.py - removed. Patch has been + submitted to Pyrex maintainers that fixes gcc4.0 errors + + * python/Makefile.am: removed refrences to lvalue_cast_post_process.py + +2005-03-24 Daniel Reed <n@ml.org> + + * tools/Makefile.am: Make print-introspect and + dbus-bus-introspect.xml building conditional on HAVE_GLIB. + +2005-03-22 John (J5) Palmieri <johnp@redhat.com> + + * tools/Makefile.am: Patch by Colin Walters that fixes distcheck + + * dbus/dbus-userdb.c, dbus/dbus-userdb-util.c: Add patch we have + had in Red Hat packages for a while but for some reason never + got merged upstream + (_dbus_is_a_number): New checks if a string + can be converted to a number and does the conversion if it can + (_dbus_user_database_lookup): Add check to see if the given username + is a udi. This allows udi's to be used instead of usernames in the + config file. + (_dbus_user_database_lookup_group): Add check to see if the given groupname + is a gdi. This allows gdi's to be used instead of groupnames in the + config file. + +2005-03-21 John (J5) Palmieri <johnp@redhat.com> + + * python/lvalue_cast_post_process.py - added post processor to fix Pyrex + code so that it compiles with gcc4.0 + + * python/Makefile.am: Added lvalue_cast_post_process.py to EXTRA_DIST + run dbus_bindings.c through lvalue_cast_post_process.py and copy the + results back to dbus_binding.c + +2005-03-20 Colin Walters <walters@verbum.org> + + Patch suggested by Inguva Rajasekhar <ringuva@novell.com>. + + * configure.in: Require GTK+ 2.6. + +2005-03-20 Colin Walters <walters@verbum.org> + + * Makefile.am (SUBDIRS, DIST_SUBDIRS): Build tools before test. + +2005-03-17 Tom Parker <palfrey@tevp.net> + + * dbus/dbus-userdb.c (_dbus_user_database_lookup): Don't + print DBUS_UID_UNSET; instead print passed username. Also + be sure to actually use gid looked up in cache. + + * dbus/dbus-userdb-util.c (_dbus_user_database_lookup_group): Ditto + for DBUS_GID_UNSET and groupname. + +2005-03-17 Colin Walters <walters@verbum.org> + + * bus/print-introspect.c: Move to tools/. + * bus/run-with-tmp-session-bus.sh: Ditto. + + * glib/Makefile.am (dbus-glib-bindings.h): Move + generation to tools/Makefile.am. + + * test/glib/run-test.sh: Update to handle move + of run-with-tmp-session-bus.sh. + + * test/glib/test-service-glib.c: Update to handle + move of dbus-glib-bindings.h. + + * tools/print-introspect.c: Moved here + from bus/, and ported to GLib bindings. + + * tools/run-with-tmp-session-bus.sh: Moved here + from bus/. + + * tools/Makefile.am: Generate dbus-glib-bindings.h + and dbus-bus-introspect.xml here. + + * tools/.cvsignore, glib/.cvsignore, bus/.cvsignore: + Update. + +2005-03-17 Colin Walters <walters@verbum.org> + + * bus/driver.c (write_args_for_direction): Use + _dbus_string_get_const_data to retrieve string; + _dbus_string_get_const_data_len doesn't actually return + a NULL-terminated substring. + + * test/glib/test-service-glib.c: Include dbus-glib-bindings.h. + (main): Change to use org_freedesktop_DBus_request_name + instead of using g_proxy_begin_call/end_call. + +2005-03-15 Joe Shaw <joeshaw@novell.com> + + * mono/ProxyBuilder.cs (BuildFinalizer): Fix some invalid IL when + generating the finalizer. Fixes from Ben Maurer. + +2005-03-12 Joe Shaw <joeshaw@novell.com> + + * mono/BusDriver.cs: Update method names: ListServices + becomes ListNames; GetOwner becomes GetNameOwner. + + * mono/ProxyBuilder.cs (BuildFinalizer): Need to load arg 0 + onto the eval stack when removing the delegate. + +2005-03-12 Joe Shaw <joeshaw@novell.com> + + * mono/dbus-sharp.dll.config.in: Don't hardcode 0 for + LT_CURRENT. Set it to the autoconf variable. + + * mono/ProxyBuilder.cs: Add a finalizer to the generated proxy + classes that disconnects the signal handler delegate from the + service object. Fixes a big leak of proxy objects on the + client side of things. Patch from Ben Maurer + <bmaurer@ximian.com> + +2005-03-12 Colin Walters <walters@verbum.org> + + * bus/driver.c (write_args_for_direction): New function, + parses a type signature into arguments and outputs to + XML. + (bus_driver_handle_introspect): Use it instead of + hardcoding XML for certain signatures. + + * bus/Makefile.am (dbus-bus-introspect.xml): Add + dependency on dbus-daemon. + + * glib/dbus-glib-tool.c (main): Parse ignore_unsupported + argument, pass it to dbus_binding_tool_output_glib_client. + + * glib/dbus-binding-tool-glib.c + (generate_client_glue): Protect against multiple inclusion. + (dbus_binding_tool_output_glib_client): Add + G_BEGIN_DECLS/G_END_DECLS. + + * glib/dbus-binding-tool-glib.c (compute_client_method_name): + Change to just take iface prefix directly. + (write_formal_parameters): Clarify error message. + (check_supported_parameters): New function; checks to see type + signatures of method parameters are supported. + (generate_client_glue): Handle ignore_unsupported flag. + (dbus_binding_tool_output_glib_client): Handle ignore_unsupported + parameter. + + * glib/Makefile.am (dbus-glib-bindings.h): Pass + --ignore-unsupported by default until glib bindings + support arrays. + +2005-03-11 Colin Walters <walters@verbum.org> + + * glib/Makefile.am: Generate dbus-glib-bindings.h and + install it. + + * bus/print-introspect.c: New file; prints introspection + data for a given name and object path. + + * bus/run-with-tmp-session-bus.sh: New file, refactored + from test/glib/run-test.sh. Creates a temporary session + bus and runs another program. + + * test/glib/run-test.sh: Refactor to invoke + run-with-tmp-session-bus.sh. + + * bus/driver.c (bus_driver_handle_introspect): Fix to print new + introspection format. Also change to use DBUS_TYPE_x_AS_STRING + macros instead of hardcoding. + + * glib/.cvsignore, bus/.cvsignore, test/glib/.cvsignore: Update. + +2005-03-11 Joe Shaw <joeshaw@novell.com> + + * dbus/dbus-connection.c (dbus_connection_send_with_reply): Remove + this unref; it doesn't match up evenly in some codepaths. + (_dbus_connection_block_pending_call): Unref at every exitpoint; + this evenly matches with the ref near the top of this function. + +2005-03-09 Joe Shaw <joeshaw@novell.com> + + * dbus/dbus-object-tree.c + (_dbus_object_tree_unregister_and_unlock): If checks are enabled + and we try to unregister a path that's not registered, still go + through the process of unlocking and don't just return. + +2005-03-09 Colin Walters <walters@verbum.org> + + * glib/dbus-gproxy.c (dbus_g_proxy_invoke): New method; calls + to this are generated for client-side wrappers. Invokes a + D-BUS method and returns reply values. + + * glib/dbus-binding-tool-glib.c (write_args_sig_for_direction): New + function; writes signature string for argument direction. + (write_args_for_direction): Change to pass input values directly + instead of via address, and fix indentation. + (generate_client_glue): Change to invoke dbus_g_proxy_invoke. Also + make generated wrappers inlineable. + + * dbus/dbus-message.c (dbus_message_iter_get_fixed_array): Add + note about using dbus_type_is_fixed. + + * dbus/dbus-marshal-basic.c (_dbus_type_is_fixed): Moved to + dbus/dbus-signature.c as dbus_type_is_fixed. + + All callers updated. + + * dbus/dbus-signature.c (dbus_type_is_fixed): Moved here + from dbus/dbus-marshal-basic.c:_dbus_type_is_fixed. + + * dbus/dbus-signature.h: Prototype. + + * glib/dbus-binding-tool-glib.c (compute_marshaller_name): Fix + error printf code. + + * test/glib/test-dbus-glib.c (main): Be sure to clear error as + appropriate instead of just freeing it. + (main): Free returned strings using g_free. + + * test/glib/Makefile.am (test-service-glib-glue.h) + (test-service-glib-bindings.h): Add dependency on dbus-binding-tool. + + * glib/dbus-gvalue.c (MAP_BASIC): Refactored from MAP_BASIC_INIT; + simply maps a simple D-BUS type to GType. + (dbus_dbus_type_to_gtype): Function which maps D-BUS type to + GType. + (dbus_gvalue_init): Just invoke dbus_dbus_type_to_gtype and + initialize the value with it. + (dbus_gvalue_binding_type_from_type): Unused, delete. + (dbus_gvalue_demarshal): Switch to hardcoding demarshalling for + various types instead of unmarshalling to value data directly. + Remove can_convert boolean. + (dbus_gvalue_marshal): Remove duplicate initialization; switch to + returning directly instead of using can_convert boolean. + (dbus_gvalue_store): New function; not related to D-BUS per-se. + Stores a GValue in a pointer to a value of its corresponding C + type. + + * glib/dbus-gvalue.h: Remove dbus_gvalue_binding_type_from_type, + add dbus_gvalue_store. + +2005-03-08 Joe Shaw <joeshaw@novell.com> + + Fix a bunch of lifecycle and memory management problems + in the mono bindings. + + * mono/Arguments.cs (Arguments): Implement IDisposable + + * mono/Bus.cs (Bus): Don't allow public instantiation. This is + strictly a static class. + + * mono/Connection.cs: Move the DBusObjectPathVTable and associated + delegates into this file. + (Connection): Implement IDisposable. + (Dispose): Disconnect the connection and set the raw connection + pointer to IntPtr.Zero. + (~Connection): Call Dispose(). + (RegisterObjectPath): Added. Manages the registration of object + paths so we can cleanly disconnect them at dispose/finalize time. + (UnregisterObjectPath): Ditto. + (set_RawConnection): Unregister all of the object paths when + changing the underlying DBusConnection. Add them back onto the + new connection, if any. + + * mono/Handler.cs: Don't implement IDisposable; it doesn't use any + more unmanaged resources anymore, so it's not necessary. Move all + the DBusObjectPathVTable stuff out of here. + (Handler): Save references to our delegates so that they don't get + finalized. Call Connection.RegisterObjectPath() instead of + dbus_connection_register_object_path() directly. + (Message_Called): Dispose the message after we're finished with + it. + + * mono/Message.cs (Message): Implement IDisposable. + (Dispose): Dispose the Arguments, and set the RawMessage to + IntPtr.Zero. + (SendWithReplyAndBlock): We own the ref to the reply that comes + back from dbus_connection_send_with_reply_and_block() so add a + comment about that and unref it after we've constructed a managed + MethodReturn class around it. Fixes a big, big leak. + + * mono/ProxyBuilder.cs: Reflect into Message to get the Dispose + method. + (BuildSignalHandler): After we've sent the Signal message, dispose + of it. + (BuildMethod): Dispose of the method call and reply messages after + we've sent the message and extracted the data we want from the + reply. + + * mono/Service.cs (UnregisterObject): Don't call handler.Dispose() + anymore. + (Service_FilterCalled): Dispose of the message after we're + finished with it. + +2005-03-08 Joe Shaw <joeshaw@novell.com> + + * dbus/dbus-connection.c (dbus_connection_send_with_reply): + After we attach our pending call to the connection, unref + it. Fixes a leak. + + * mono/Connection.cs (set_RawConnection): Disconnect our + filter and match callbacks from the old connection and + reconnect them to the new connection, if any. + + * mono/DBusType/Array.cs: "Code" is a static member, so + don't use "this" to refer to it. Fix for stricter checking + in Mono 1.1.4. + + * mono/DBusType/ObjectPath.cs (Append): Don't leak the + object path that we pass into unmanaged code. + + * mono/DBusType/String.cs (Append): Don't leak the string + that we pass into unmanged code. + +2005-03-07 John (J5) Palmieri <johnp@redhat.com> + * NEWS: Update for 0.31 + + * configure.in: Release 0.31 + add LT_CURRENT, LT_REVISION, LT_AGE for easy soname bumping + + * qt/Makefile.am: fixed build + + * dbus/Makefile.am: soname bump for libdbus + + * glib/Makefile.am: soname bump for libdbus-glib + +2005-03-05 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c: + (pseudorandom_generate_random_bytes_buffer): fix to have no return + value + (_dbus_generate_random_bytes_buffer): fix return value + + * dbus/dbus-sysdeps-util.c: s/GETPWNAME/GETPWNAM/ so configure + checks actually work, from Tom Parker <fdo@tevp.net> + +2005-03-01 Colin Walters <walters@verbum.org> + + * test/glib/test-dbus-glib.c (lose, lose_gerror): Utility + functions copied from dbus-glib-tool.c. + (main): Convert lots of error code to use them. + Also add some testing for introspection bits. + +2005-03-01 Colin Walters <walters@verbum.org> + + * doc/TODO: Remove introspection signature TODO. + +2005-02-27 Colin Walters <walters@verbum.org> + + * glib/dbus-gidl.c (property_info_get_type, arg_info_get_type): + Change return value to const char * instead of int so we can do + full signatures. + (struct PropertyInfo, struct ArgInfo): Store char *. + (property_info_new, arg_info_new): Update parameters, strdup. + (property_info_unref, arg_info_unref): Free. + + * glib/dbus-gidl.h: Update prototypes. + + * glib/dbus-gparser.c (basic_type_from_string): Delete. + (validate_signature): New function, just validates signature and + sets GError. + (parse_property, parse_arg): Invoke validate_signature. Store + signature instead of just type code. + + * glib/dbus-gvalue.c (base_type_from_signature): New utility + function to return a primary type for a signature, dropping + information about types in container types. + (dbus_gvalue_genmarshal_name_from_type) + (dbus_gvalue_binding_type_from_type) + (dbus_gvalue_ctype_from_type): Update to take full signature + instead of type code. + (dbus_gtype_to_dbus_type): Moved here from glib/dbus-gobject.c. + + * glib/dbus-gvalue.h: Update prototypes for above. + + * glib/dbus-gobject.c (gtype_to_dbus_type): Moved to + glib/dbus-gvalue.c as dbus_gtype_to_dbus_type. + (introspect_properties, introspect_Q_SIGNALS, write_interface): + Update to handle signatures, and remove usage of + _dbus_gutils_type_to_string. + (handle_introspect): Print out type codes instead of e.g. "string" + in hardcoded introspection XML; also use x_AS_STRING constants + instead of hardcoding in string. + + * glib/dbus-glib-tool.c (pretty_print): Handle signature change + to string. Remove usage of _dbus_gutils_type_to_string. + + * glib/dbus-gutils.c (_dbus_gutils_type_to_string): Delete. + + * glib/dbus-gutils.h (_dbus_gutils_type_to_string): Update for + deletion. + + * glib/dbus-binding-tool-glib.c (compute_marshaller) + (compute_marshaller_name, generate_glue): Handle signature change + to string. + (write_formal_parameters, write_args_for_direction): Ditto, and + remove FIXME. + + * tools/dbus-tree-view.c (type_to_string): Delete. + (info_set_func_text): Update to print full signatures. + + * test/glib/test-service-glib.xml: Change types to new + introspection format. + +2005-02-26 Havoc Pennington <hp@redhat.com> + + * doc/TODO: remove the "guid" item + + * test/glib/test-profile.c (no_bus_thread_func): use open_private + (with_bus_thread_func): use open_private + + * dbus/dbus-connection.c (dbus_connection_open_private): new + function that works like the old dbus_connection_open() + (dbus_connection_open): now returns an existing connection if + possible + + * dbus/dbus-server-unix.c (handle_new_client_fd_and_unlock): pass + through the GUID to the transport + + * dbus/dbus-server.c (_dbus_server_init_base): keep around the + GUID in hex-encoded form. + + * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): + pass GUID argument in to the transport + + * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd): add + guid argument + + * dbus/dbus-transport.c (_dbus_transport_init_base): add guid argument + + * dbus/dbus-auth.c (_dbus_auth_server_new): add guid argument + +2005-02-25 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.xml: document the GUID thing + + * dbus/dbus-server.c (_dbus_server_init_base): initialize a + globally unique ID for the server, and put a "guid=hexencoded" + field in the address + + * dbus/dbus-bus.c: fix missing #include of dbus-threads-internal.h + + * dbus/dbus-message.c: ditto + + * dbus/dbus-dataslot.c: ditto + + * dbus/dbus-list.c: ditto + + * dbus/dbus-internals.h: wait, just include + dbus-threads-internal.h here + + * dbus/dbus-string.c (_dbus_string_copy_to_buffer): move back for + use in main library + + * dbus/dbus-sysdeps.c (_dbus_generate_random_bytes_buffer): new function + +2005-02-24 Colin Walters <walters@verbum.org> + + * test/glib/Makefile.am (EXTRA_DIST): Add test-service-glib.xml + +2005-02-24 John (J5) Palmieir <johnp@redhat.com> + + * glib/Makefile.am: added dbus-gobject.h to sources list + so distcheck doesn't fail + +2005-02-24 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-server.c, dbus/dbus-server-unix.c: change semantics so + you must disconnect before unref, since locking and other things + are screwed up otherwise. Fix assorted other locking stuff. + + * dbus/dbus-signature.c (dbus_signature_iter_get_element_type): + fix compilation + + * dbus/dbus-threads-internal.h: move the mutex/condvar wrappers + into a private header and don't export from the library + + * throughout - call _dbus_thread_stuff vs. dbus_thread_stuff + +2005-02-24 Colin Walters <walters@verbum.org> + + * dbus/dbus-signature.c: New file; implements various functions + related to type signatures. Includes an interator for parsing, + validation functions. + (dbus_type_is_basic): Moved here from + dbus-marshal-basic.c:_dbus_type_is_basic. + (dbus_type_is_container): Moved here from + dbus-marshal-basic.c:_dbus_type_is_container. + + All callers of _dbus_type_is_container and _dbus_type_is_basic + updated, and include dbus-signature.h. + + * dbus/dbus-signature.h: New file; prototypes for the above. + + * dbus/Makefile.am (DBUS_LIB_SOURCES): Add dbus-signature.c, + dbus-signature.h. + + * dbus/dbus-marshal-basic.c (map_type_char_to_type): New utility + function factored out of _dbus_first_type_in_signature. + (_dbus_first_type_in_signature_c_str): New function; returns first + type code for a type signature character. + + * dbus/dbus-marshal-basic.h: Prototype _dbus_first_type_in_signature_c_str, + handle function moves. + + * dbus/dbus-marshal-recursive.h: Export _dbus_type_signature_next. + + * dbus/dbus-marshal-recursive.c (_dbus_type_signature_next): New + function; skips to next complete type in type signature. + Implemented using previous skip_one_complete_type. Now + skip_one_complete_type just delegates to + _dbus_type_signature_next. + + * dbus/dbus-marshal-basic.c (_dbus_type_is_basic): Moved + to dbus-signature.c + (_dbus_type_is_container): Ditto. + + * doc/dbus-specification.xml: Update introspection sample to + use real type signatures. + + * dbus/dbus-test.h: Prototype signature test. + + * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): Run + signature tests. + + * dbus/dbus-protocol.h (DBUS_ERROR_INVALID_SIGNATURE): New error. + +2005-02-23 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in (PendingCall::get_reply): + s/dbus_pending_call_get_reply/dbus_pending_call_steal_reply + +2005-02-21 Colin Walters <walters@verbum.org> + + * dbus/dbus-test-main.c (main): Take optional specific test + argument. + + * dbus/dbus-test.c (run_test): New function, runs a test function + with no data directory. + (run_data_test): Like above, but takes data directory. + (dbus_internal_do_not_use_run_tests): Take + specific test argument. Replace lots of cut n' paste code + with run_test and run_data_test. + + * dbus/dbus-test.h: Update prototype for + dbus_internal_do_not_use_run_tests. + +2005-02-20 Havoc Pennington <hp@redhat.com> + + Fix bugs reported by Daniel P. Berrange + + * dbus/dbus-server.c (_dbus_server_unref_unlocked): new function + (protected_change_watch): new function + (_dbus_server_toggle_watch, _dbus_server_remove_watch) + (_dbus_server_add_watch): change to work like the + dbus-connection.c equivalents; like those, probably kind of + busted, but should at least mostly work for now + (dbus_server_disconnect): drop the lock if we were already + disconnected, patch from Daniel P. Berrange + + * dbus/dbus-server.c (_dbus_server_toggle_timeout) + (_dbus_server_remove_timeout, _dbus_server_add_timeout): all the + same stuff + + * doc/TODO: todo about unscrewing this mess + +2005-02-19 Colin Walters <walters@verbum.org> + + * glib/dbus-binding-tool-glib.c + (dbus_binding_tool_output_glib_server): Fix iochannel refcounting. + + * glib/dbus-glib-tool.c: Include dbus-glib-tool.h, as well + as errno.h and sys/stat.h. + (lose): New function, prints error with + newline and exits. + (lose_gerror): Similar, but takes GError for message. + (main): Add --output argument to specify output file to write to, + instead of always printing to stdout. In this mode, determine + timestamps on source files to see whether any are newer than the + target file. If not, exit. Also convert a number of error + messages to use lose (since it's shorter), and switch to using + g_io_channel_shutdown. + +2005-02-19 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gobject.c + (_dbus_glib_marshal_dbus_message_to_gvalue_array): add docs + + * glib/dbus-glib.c: fix doxygen warnings + + * glib/dbus-gparser.c (parse_annotation): error if an annotation + is found on an <arg> + +2005-02-17 Colin Walters <walters@verbum.org> + + * glib/dbus-gobject.h: Don't export + _dbus_glib_marshal_dbus_message_to_gvalue_array. + + * glib/dbus-gobject.c (_dbus_glib_marshal_dbus_message_to_gvalue_array): Do rename. + (invoke_object_method): Handle it. + + * glib/dbus-gproxy.c (marshal_dbus_message_to_g_marshaller): + Handle rename. + +2005-02-17 Colin Walters <walters@verbum.org> + + * bus/.cvsignore, doc/.cvsignore + * test/data/valid-service-files/.cvsignore, test/glib/.cvsignore: + Update. + +2005-02-17 Colin Walters <walters@verbum.org> + + * dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS): + Rename to DBUS_SERVICE_DBUS. + (DBUS_PATH_ORG_FREEDESKTOP_DBUS): Rename to DBUS_PATH_DBUS. + (DBUS_PATH_ORG_FREEDESKTOP_LOCAL): Rename to DBUS_PATH_LOCAL. + Change the value from "org.freedesktop.Local" + to "org.freedesktop.DBus.Local". + (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_INTERFACE_DBUS. + (DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE): Rename to + DBUS_INTERFACE_INTROSPECTABLE. + Change the value from "org.freedesktop.Introspectable" + to "org.freedesktop.DBus.Introspectable". + (DBUS_INTERFACE_ORG_FREEDESKTOP_PROPERTIES): Rename to + DBUS_INTERFACE_PROPERTIES. + Change the value from "org.freedesktop.Properties" + to "org.freedesktop.DBus.Properties". + (DBUS_INTERFACE_ORG_FREEDESKTOP_PEER): Rename to + DBUS_INTERFACE_PEER. + Change the value from "org.freedesktop.Peer" + to "org.freedesktop.DBus.Peer". + (DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL): + DBUS_INTERFACE_LOCAL. + Change the value from "org.freedesktop.Local" + to "org.freedesktop.DBus.Local". + + All other users of those constants have been changed. + + * bus/driver.c (bus_driver_handle_introspect): Use constants. + + * glib/dbus-gobject.c (handle_introspect): Use constants. + + * doc/dbus-faq.xml, doc/dbus-specification.xml: Update for rename. + +2005-02-17 Colin Walters <walters@verbum.org> + + * glib/dbus-gparser.c (struct Parser): Add in_annotation boolean. + (parse_node, parse_interface, parse_method, parse_signal) + (parse_property, parse_annotation): Lose if we're currently in an + annotation. + (parse_annotation): New function. + (parser_start_element, parser_end_element): Handle annotation. + (parse_method, parse_interface): Remove support for c_name attribute, + switch to annotations. + + * glib/dbus-gidl.h (interface_info_get_binding_names) + (method_info_get_binding_names) + (interface_info_get_binding_name, method_info_get_binding_name) + (interface_info_set_binding_name, method_info_set_binding_name): + Remove. + (interface_info_get_annotations, method_info_get_annotations) + (interface_info_get_annotation, method_info_get_annotation) + (interface_info_add_annotation, method_info_add_annotation): + Prototype. + + * glib/dbus-gidl.c (struct InterfaceInfo): Substitute "annotations" + for "bindings". + (struct MethodInfo): Ditto. + Straightfoward conversion of binding methods into annotation methods + as prototyped. + + * glib/dbus-glib-tool.c (pretty_print): Print annotations. + + * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_C_SYMBOL): Define. + + * glib/dbus-binding-tool-glib.c (gather_marshallers, generate_glue): + Use new annotation API. + + * doc/introspect.dtd: Fix a number of DTD syntax errors. Add + annotation element. + + * doc/dbus-specification.xml: Discuss introspection annotations, + include list of well-known annotations. + + * test/glib/test-service-glib.xml: Make validate against new DTD. + +2005-02-17 Colin Walters <walters@verbum.org> + + This patch is based on initial work from + Paul Kuliniewicz <kuliniew@purdue.edu>. + + * glib/dbus-gvalue.c (dbus_gvalue_init): New function; move + initialization of GValue from dbus type to here. + (dbus_gvalue_genmarshal_name_from_type): New function; generates a string + for the "glib-genmarshal" program from a DBus type. + (dbus_gvalue_binding_type_from_type): New function; turns a DBus type + into the C name for it we use in the glib bindings. + (dbus_gvalue_ctype_from_type): New function; maps a DBus type into a + glib C type (not GValue). + (dbus_gvalue_demarshal): invoke dbus_gvalue_init. + + * glib/dbus-gutils.c (_dbus_gutils_wincaps_to_uscore): Moved here + from dbus-gobject.c. + + * glib/dbus-gutils.h: Prototype it. + + * glib/dbus-gproxy.c: Include new dbus-gobject.h. + (marshal_dbus_message_to_g_marshaller): Use new shared function + dbus_glib_marshal_dbus_message_to_gvalue_array. + + * glib/dbus-gparser.c (parse_interface, parse_method): Handle c_name attribute. + Will be changed once we have annotations. + + * glib/dbus-gobject.c: Change info_hash_mutex from GStaticMutex to + GStaticRWLock. Callers updated. + (wincaps_to_uscore): Move to dbus-gutils.c. Callers updated. + (string_table_next): New function for iterating over zero-terminated + string value array. + (string_table_lookup): New function; retrieves specific entry in + array. + (get_method_data): New function; look up method data in object data chunk. + (object_error_domain_prefix_from_object_info) + (object_error_code_from_object_info): New functions, but not implemented yet. + (method_interface_from_object_info): New function; retrieve interface name. + (method_name_from_object_info): New function; retrieve method name. + (method_arg_info_from_object_info): New function; retrieve argument data. + (arg_iterate): New function; iterates over serialized argument data. + (method_dir_signature_from_object_info): New function; returns a + GString holding type signature for arguments for just one + direction (input or output). + (method_input_signature_from_object_info) + (method_output_signature_from_object_info): New functions. + (dbus_glib_marshal_dbus_message_to_gvalue_array): New shared function; + converts dbus message arguments into a GValue array. Used for both + signal handling and method invocation. + (struct DBusGlibWriteIterfaceData): New utility structure. + (write_interface): New function; generate introspection XML for + an interface. + (introspect_interfaces): New function; gathers all interface->methods, + generates introspection XML for them. + (handle_introspect): Invoke introspect_interfaces. + (get_object_property): Be sure to zero-initalize stack-allocated GValue. + (lookup_object_and_method): New function; examines an incoming message + and attempts to match it up (via interface, method name, and argument + signature) with a known object and method. + (gerror_domaincode_to_dbus_error_name): New function; converts a + GError domain and code into a DBus error name. Needs GError data + added to object introspection to work well. + (gerror_to_dbus_error_message): Creates a DBusMessage error return from + GError. + (invoke_object_method): New function to invoke an object method + looked up via lookup_object_and_method. Parses the incoming + message, turns it into a GValue array, then invokes the marshaller + specified in the DBusGMethodInfo. Creates a new message with + either return values or error message as appropriate. + (gobject_message_function): Invoke lookup_object_and_method and + invoke_object_method. + + * glib/dbus-glib-tool.c: Include dbus-binding-tool-glib.h. + (enum DBusBindingOutputMode): New enum for binding output modes. + (pretty_print): Print binding names. + (dbus_binding_tool_error_quark): GError bits. + (version): Fix typo. + (main): Create GIOChannel for output. Parse new --mode argument, + possible values are "pretty-print", "glib-server", "glib-client". + Use mode to invoke appropriate function. + + * glib/dbus-gobject.h: Prototype dbus_glib_marshal_dbus_message_to_gvalue_array. + + * glib/dbus-glib-tool.h: New header, just includes GError bits + for now. + + * glib/dbus-gidl.c (struct InterfaceInfo): Add bindings hashtable; + maps binding style to name. + (struct MethodInfo): Ditto. + (get_hash_keys, get_hash_key): Utility function, returns keys for + a GHashTable. + (interface_info_new, method_info_new): Initialize bindings. + (interface_info_unref, method_info_unref): Destroy bindings. + (method_info_get_binding_names, method_info_get_binding_name) + (interface_info_get_binding_names, interface_info_get_binding_name): + Functions for retrieving binding names. + (method_info_set_binding_name, interface_info_set_binding_name): + Functions for setting binding names. + + * glib/dbus-binding-tool-glib.h: New file, has prototypes + for glib binding generation. + + * glib/dbus-binding-tool-glib.c: New file, implements server-side + and client-side glib glue generation. + + * glib/Makefile.am (dbus_binding_tool_SOURCES): Add + dbus-binding-tool-glib.c, dbus-binding-tool-glib.h, + dbus-glib-tool.h. + + * dbus/dbus-glib.h (struct DBusGMethodMarshaller): Remove in favor + of using GClosureMarshal directly. + (struct DBusGObjectInfo): Add n_infos member. + + * test/glib/test-service-glib.xml: New file; tqcontains introspection data + for MyTestObject used in test-service-glib.c. + + * test/glib/test-service-glib.c (enum MyObjectError): New GError enum. + (my_object_do_nothing, my_object_increment, my_object_throw_error) + (my_object_uppercase, my_object_many_args): New test methods. + (main): Use dbus_g_object_class_install_info to include generated object + info. + + * test/glib/Makefile.am: Generate server-side glue for test-service-glib.c, + as well as client-side bindings. + + * test/glib/test-dbus-glib.c: Include test-service-glib-bindings.h. + (main): Activate TestSuiteGLibService; test invoke a bunch of its methods + using both the dbus_gproxy stuff directly as well as the generated bindings. + +2005-02-15 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c (dbus_connection_dispatch): always + complete a pending call, don't run filters first. + + * glib/dbus-gproxy.c (dbus_g_proxy_end_call): change to use + dbus_pending_call_steal_reply + + * dbus/dbus-pending-call.c (dbus_pending_call_block): just call + _dbus_connection_block_pending_call + (dbus_pending_call_get_reply): change to steal_reply and return a + ref + + * dbus/dbus-connection.c + (dbus_connection_send_with_reply_and_block): port to work in terms + of DBusPendingCall + (_dbus_connection_block_pending_call): tqreplace block_for_reply + with this + +2005-02-14 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-userdb-util.c (_dbus_user_database_lookup_group): + properly handle looking up group information by name; fix + from j@bootlab.org + +2005-02-13 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c (dbus_connection_return_message) + (dbus_connection_borrow_message): hold dispatch lock while message + is outstanding + (_dbus_connection_block_for_reply): hold dispatch lock while we + block for the reply, so nobody steals our reply + (dbus_connection_pop_message): hold the dispatch lock while we + pluck the message + +2005-02-13 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c (_dbus_connection_acquire_dispatch) + (_dbus_connection_release_dispatch) + (_dbus_connection_acquire_io_path) + (_dbus_connection_release_io_path): make the mutex and condvar + control access to the "acquired" flag. Drop the connection lock + while waiting on the condvar. Hopefully these are baby steps in + roughly the right direction. + +2005-02-13 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c: use separate mutexes for the condition + variables; this is some kind of baseline for sanity, but the + condition variables still aren't used correctly afaict + +2005-02-13 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-object-tree.c (handle_default_introspect_and_unlock): + fix a double-unlock + + * dbus/dbus-connection.c + (_dbus_connection_detach_pending_call_unlocked): add this + + Initial semi-correct pass through to fix thread locking; there are + still some issues with the condition variable paths I'm pretty + sure + + * dbus/dbus-server.c: add a mutex on DBusServer and appropriate + lock/unlock calls + + * dbus/dbus-connection.c (_dbus_connection_do_iteration_unlocked): + rename to add _unlocked + (struct DBusConnection): move "dispatch_acquired" and + "io_path_acquired" to use only one bit each. + (CONNECTION_LOCK, CONNECTION_UNLOCK): add checks with !DBUS_DISABLE_CHECKS + (dbus_connection_set_watch_functions): hacky fix to reentrancy + (_dbus_connection_add_watch, _dbus_connection_remove_watch) + (_dbus_connection_toggle_watch, _dbus_connection_add_timeout) + (_dbus_connection_remove_timeout) + (_dbus_connection_toggle_timeout): drop lock when calling out to + user functions; done in a hacky/bad way. + (_dbus_connection_send_and_unlock): add a missing unlock + (_dbus_connection_block_for_reply): add a missing unlock + + * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): + drop lock in a hacky probably unsafe way to call out to user + function + +2005-02-12 Havoc Pennington <hp@redhat.com> + + * tools/dbus-tree-view.c (info_set_func_text): display more + details on args + + * bus/driver.c (bus_driver_handle_list_services): list the bus + driver + + * glib/dbus-gparser.c (parse_arg): generate an arg name if none is supplied + + * glib/dbus-gidl.c (signal_info_get_n_args): new function + (method_info_get_n_args): new function + +2005-02-12 Havoc Pennington <hp@redhat.com> + + * bus/driver.c (bus_driver_handle_introspect): add introspection + for bus driver + +2005-02-12 Havoc Pennington <hp@redhat.com> + + * bus/driver.c: put the signature of each bus driver method in the + table of handlers and check it on incoming calls; this isn't + really useful, but going to add introspect support in a minute. + +2005-02-11 Joe Shaw <joeshaw@novell.com> + + * mono/Connection.cs: The unpredictability of finalizers in mono + prevents us from deterministically disconnecting the filters from + the Service class's finalizer, so move tracking of filters and + matches here. Add API for that. + + * mono/Service.cs: Remove the code, add code which calls the + methods now on the Connection class. + +2005-02-11 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus.py (class Sender): added to support dbus Q_SIGNALS better + (Bus::add_signal_receiver): added expand_args parameter which defaults + to True. When expand args is True the signal handler will pass the + message arguments as parameters to the signal handler. If False + revert to previous behavior where the signal handler must get the + argument list from the message. This is to help port applications + like HAL that have a tendancy to send variable length argument lists. + self._match_rule_to_tqreceivers is now a dict of dicts. + (Bus::remove_signal_receiver): pop handler off the dict intead of + removing it from a list + (Bus::_signal_func): change signal handlers so that interface, + signal_name, service, path and message are packed into a Sender + object and that is passed to the handler. If expand_args is True + extract the args list from the message and append it to the parameter + list + + * python/dbus_bindings.pyx.in (class Signature): added to support + signiature types + (MessageIter::__init__): changed iteration limit to match D-BUS + (MessageIter::get*): added INT16, UINT16, SIGNATURE, DICT_ENTRY, + STRUCT and VARIENT type support + (MessageIter::python_value_to_dbus_sig): made recursive to support + recursive types + (MessageIter::append*): added Signature, dict, tuple + support + + * python/examples/example-client.py: added examples of getting tuples + and dicts + + * python/examples/example-service.py: added examples of sending tuples + and dicts + + * python/examples/example-signal-recipient.py: Fixed to handle new + signal callback format + +2005-02-10 Havoc Pennington <hp@redhat.com> + + * test/glib/test-dbus-glib.c (main): fix so this test doesn't fail + (call dbus_g_proxy_add_signal) + + * dbus/dbus-server-unix.c (_dbus_server_new_for_tcp_socket): + escape the hostname + (_dbus_server_new_for_domain_socket): escape the path + + * dbus/dbus-address.c (dbus_address_escape_value): new + (dbus_address_unescape_value): new + (dbus_parse_address): unescape values + + * dbus/dbus-string.c (_dbus_string_append_byte_as_hex): new function + + * doc/dbus-specification.xml: explain how to escape values in + addresses + +2005-02-10 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-factory.c (generate_special): modify test to + avoid using a non-basic dict key + + * dbus/dbus-marshal-validate-util.c: add test for the below + + * doc/dbus-specification.xml: require that dict keys are a basic + type + + * dbus/dbus-marshal-validate.c + (_dbus_validate_signature_with_reason): require that dict key is a + basic type + +2005-02-10 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-object-tree.c (handle_default_introspect_and_unlock): + change to be _and_unlock instead of _unlocked + + * dbus/dbus-connection.c + (_dbus_connection_send_preallocated_unlocked_no_update): rename to + have no_update so we can tqfind this bug quickly in future + +2005-02-10 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-util.c (verify_test_message): tests for string + array + + * dbus/dbus-message.c (dbus_message_append_args_valist): add + support for arrays of string/signature/path + +2005-02-10 Joe Shaw <joeshaw@novell.com> + + * dbus/dbus-connection.c + (_dbus_connection_queue_received_message_link, + _dbus_connection_message_sent): Add the path to + the verbose output. + (_dbus_connection_send_preallocated_and_unlock): Added. Calls + _dbus_connection_send_preallocated_unlocked(), updated the + dispatch status, and unlocks. Fixes a bug where certain + situations (like a broken pipe) could cause a Disconnect message + to not be sent, tricking the bus into thinking a service was still + there when the process had quit. + (_dbus_connection_send_preallocated): Call + _dbus_connection_send_preallocated_and_unlock(). + (_dbus_connection_send_and_unlock): Added. Calls + _dbus_connection_send_preallocated_and_unlock(). + (dbus_connection_send): Call _dbus_connection_send_and_unlock(). + (dbus_connection_send_with_reply): Update the dispatch status and + unlock. + + * mono/Service.cs (~Service): Added. Removes the filter so that + we don't get unmanaged code calling back into a GCed delegate. + (RemoveFilter); Added. + +2005-02-09 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-message.c (dbus_message_iter_open_container): + - Removed check for iterator type being an array because + get_arg_type does not work with writer iterators + - Pass NULL to _dbus_type_writer_recurse if signiture is NULL + +2005-02-07 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.xml: some more language cleanups; add + stuff about how to deal with invalid protocol and extension + points; add _ to allowed chars in auth commands; add EXTENSION_ + auth command prefix + +2005-02-06 Havoc Pennington <hp@redhat.com> + + * s/expected/required/ in a couple places for clarity + +2005-02-07 Colin Walters <walters@verbum.org> + + * bus/selinux.c (bus_selinux_allows_send): Handle NULL for + sender or proposed_recipient. + +2005-02-06 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-factory.c (generate_special): more tests + + * dbus/dbus-marshal-validate.c (validate_body_helper): detect + array length that exceeds the maximum + +2005-02-05 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-factory.c (generate_special): more test cases, + increasing coverage + + * dbus/dbus-marshal-validate.c (validate_body_helper): return the + reason why a signature was invalid + + * dbus/dbus-marshal-header.c (load_and_validate_field): fix to + skip the length of the string before we look at it in validation + + * dbus/dbus-string-util.c (_dbus_string_test): add tests for + equal_substring + + * dbus/dbus-message.c (_dbus_message_loader_new): default + max_message_length to DBUS_MAXIMUM_MESSAGE_LENGTH + +2005-02-05 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-marshal-validate.c (validate_body_helper): fix crash + if the signature of a variant was empty + (_dbus_validate_signature_with_reason): catch "(a)" (array inside + struct with no element type) + + * dbus/dbus-message-factory.c (generate_uint32_changed): add more + mangled messages to break things + +2005-02-04 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c (dbus_g_proxy_disconnect_signal): use + g_quark_try_string() so it actually can return 0 + (dbus_g_proxy_connect_signal): ditto + +2005-02-04 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c (dbus_g_proxy_emit_remote_signal): fix a + bogus warning + (tristring_from_message): assert cleanly on null path/interface + (should not be possible though I decided later) + (dbus_g_proxy_dispose): move proxy manager unregistration here + (DBUS_G_PROXY_DESTROYED): add this macro, and use it in a bunch of + g_return_if_fail() checks + +2005-02-04 Havoc Pennington <hp@redhat.com> + + * doc/Makefile.am (EXTRA_DIST): add DTDs to makefile + + * doc/introspect.dtd: add introspect.dtd from David A. Wheeler + (with some minor changes) + + * doc/dbus-specification.xml: add deprecated attribute to + introspection format + +2005-01-31 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c: rewrite how Q_SIGNALS work again, this time I + think it's sort of right + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * tools/dbus-viewer.c: kind of half-ass hook up the option menu. + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * tools/dbus-names-model.c: dynamically watch NameOwnerChanged + + * autogen.sh: change to autotools 1.9 + + * glib/dbus-gproxy.c: completely change how Q_SIGNALS work + (dbus_g_proxy_add_signal): new function to specify signature of a + signal + (dbus_g_proxy_emit_received): marshal the dbus message to GValues, + and g_warning if the incoming message has the wrong signature. + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * tools/dbus-names-model.c (have_names_notify): fix this + + * dbus/dbus-message.c (_dbus_message_iter_get_args_valist): clean + up the string array handling a bit + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * glib/dbus-glib.c (dbus_g_pending_call_set_notify): new function + (dbus_g_pending_call_cancel): new function + + * dbus/dbus-glib.h: move GType decls for connection/message here; + * dbus/dbus-glib.c: move all the g_type and ref/unref stuff in + here, just kind of rationalizing how we handle all that + + * tools/dbus-names-model.c: new file for a tree model listing the + services on a bus + + * tools/dbus-tree-view.c (model_new): use proper typing on the + model rows + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gmain.c: add a custom GSource back that just checks + whether the message queue has anything in it; otherwise, there are + cases where we won't see messages in the queue since there was no + IO visible to the glib main loop + + * dbus/dbus-connection-internal.h (_DBUS_DEFAULT_TIMEOUT_VALUE): + increase default message timeout to 25 seconds + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c (no_bus_stop_server): remove the + warning about the g_warning that I just fixed + + * glib/dbus-gmain.c: rewrite the main loop stuff to avoid the + custom source, seems to be a lot easier to understand and work + better. + +2005-01-30 Havoc Pennington <hp@redhat.com> + + I think this main loop thing is conceptually broken, but here are + some band aids. I'll maybe rewrite it in a minute. + + * glib/dbus-gmain.c (add_timeout): timeout stuff doesn't use the + custom GSource, so don't pass it in; confusing + (gsource_server_finalize, gsource_connection_finalize): add + finalize handlers that remove all the watches. + +2005-01-30 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gobject.c (introspect_properties): fix the XML + generated + + * dbus/dbus-message.c (dbus_message_unref): add an in_cache flag + which effectively detects the use of freed messages + + * glib/dbus-gobject.c (handle_introspect): modify and return the + reply message instead of the incoming message + + * dbus/dbus-object-tree.c (handle_default_introspect_unlocked): + gee, maybe it should SEND THE XML instead of just making a string + and freeing it again ;-) + + * tools/dbus-print-message.c (print_message): improve printing of + messages + + * configure.in: add debug-glib.service to the output + +2005-01-30 Havoc Pennington <hp@redhat.com> + + dbus-viewer introspected and displayed the bus driver + + * dbus/dbus-object-tree.c + (object_tree_test_iteration): add tests for a handler registered on "/" + + * dbus/dbus-object-tree.c + (_dbus_decompose_path): fix to handle path "/" properly + (run_decompose_tests): add tests for path decomposition + + * glib/dbus-gutils.c (_dbus_gutils_split_path): fix to handle "/" + properly + + * glib/dbus-gobject.c (handle_introspect): fix quotes + + * test/glib/run-test.sh: support launching the bus, then running + dbus-viewer + + * test/glib/test-service-glib.c (main): put in a trivial gobject + subclass and register it on the connection + + * bus/driver.c (bus_driver_handle_introspect): implement + introspection of the bus driver service + + * dbus/dbus-protocol.h: add #defines for the XML namespace, + identifiers, doctype decl + + * bus/driver.c (bus_driver_handle_get_service_owner): handle + attempts to get owner of DBUS_SERVICE_ORG_FREEDESKTOP_DBUS by + returning the service unchanged. + (bus_driver_handle_message): remove old check for reply_serial in + method calls, now the message type deals with that + (bus_driver_handle_message): handle NULL interface + + * glib/dbus-gproxy.c (dbus_g_proxy_get_bus_name): new function + + * glib/dbus-gloader-expat.c (description_load_from_string): allow + -1 for len + + * tools/dbus-viewer.c: add support for introspecting a service on + a bus + + * glib/dbus-gproxy.c (dbus_g_pending_call_ref): add + (dbus_g_pending_call_unref): add + +2005-01-29 Havoc Pennington <hp@redhat.com> + + * tools/dbus-tree-view.c: add support for displaying properties. + (run dbus-viewer with an introspect xml file as arg, then resize + the window so the tree elements show up, not sure what that is) + + * glib/dbus-gobject.c (handle_introspect): return + org.freedesktop.Properties and org.freedesktop.Introspectable + interfaces when we are introspected. + + * doc/dbus-specification.xml: allow empty interface name when + Get/Set a property + +2005-01-29 Havoc Pennington <hp@redhat.com> + + * glib/Makefile.am: rename dbus-glib-tool to dbus-binding-tool; + though it uses glib, it could be extended for any binding in + principle + + * glib/dbus-gobject.c (gobject_message_function): change to the + new way properties work + + * dbus/dbus-protocol.h: add the new interfaces + + * doc/dbus-specification.xml: document the introspection format, + Introspectable interface, and add an org.freedesktop.Properties + interface. + + * glib/dbus-gparser.c: add support for a <property> element + + * glib/dbus-gidl.c: add PropertyInfo + + * glib/dbus-gobject.c (handle_introspect): put the outermost + <node> outside the signal and property descriptions. + (introspect_properties): export properties as <property> rather + than as method calls + +2005-01-28 Havoc Pennington <hp@redhat.com> + + * doc/TODO, doc/dbus-specification.xml: spec and TODO tweaks + related to authentication protocol + +2005-01-28 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: Updated to handle new D-BUS type system + - BUS_ACTIVATION -> BUS_STARTER + - DBUS_BUS_ACTIVATION -> DBUS_BUS_STARTER + - class MessageIter (__init__): Added recursion checking + so we throw a nice error instead of just disconnecting from the + bus. + (get): Added arg_type parameter for recursion. + Removed the nil type + Added signiture type placeholder (not implemented) + Added struct type placeholder (not implemented) + Added varient type placeholder (not implemented) + Commented out dict type for now + (get_element_type): renamed from get_array_type + (get_*): changed to use the dbus_message_iter_get_basic API + (get_*_array): removed in favor of recursive get_array method + (get_array): new recursive method which calls get to marshal + the elements of the array + (value_to_dbus_sig): New method returns the corrasponding + dbus signiture to a python value + (append): Comment out dict handling for now + Handle lists with the new recursive API + Comment out None handling for now + (append_nil): removed + (append_*): changed to use dbus_message_iter_append_basic API + (append_*_array): removed in favor of recursive append_array + method + (__str__): Make it easier to print out recursive iterators + for debugging + - class Message (__str__): moved type inspection to the + MessageIter class' __str__ method + (get_iter): Added an append parameter wich defaults to False + If True use the new API's to create an append iterator + + * python/dbus.py: Update to use new bindings API + - TYPE_ACTIVATION -> TYPE_STARTER + - class Bus (_get_match_rule): GetServiceOwner -> GetNameOwner + - class ActivationBus -> class StarterBus + - class RemoteObject (__call__): get an append iterator + - (_dispatch_dbus_method_call): get an append iterator + - class Object (emit_signal): get an append iterator + + * python/examples/: Fixed up the examples to work with the new API + +2005-01-28 Joe Shaw <joeshaw@novell.com> + + * configure.in: Bump version up to 0.30. + + * HACKING: Add a release item to bump the version number up after + a release. + +2005-01-28 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.xml: update to describe 16-bit types and + dict entries + + * dbus/dbus-marshal-basic.c (_dbus_unpack_uint16): fix broken + assertion + + * dbus/dbus-protocol.h (DBUS_TYPE_DICT_ENTRY): add DICT_ENTRY as a + type + + * dbus/dbus-marshal-recursive.c: implement + +2005-01-27 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-arch-deps.h.in: add 16/32-bit types + + * configure.in: tqfind the right type for 16 and 32 bit ints as well + as 64 + + * dbus/dbus-protocol.h (DBUS_TYPE_INT16, DBUS_TYPE_UINT16): add + the 16-bit types so people don't have to stuff them in 32-bit or + byte arrays. + +2005-01-27 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c: byteswap the message if you init an + iterator to read/write from it + + * dbus/dbus-marshal-byteswap.c: new file implementing + _dbus_marshal_byteswap() + + * dbus/dbus-marshal-basic.c: add _dbus_swap_array() + +2005-01-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-marshal-validate-util.c: break this out (and fix + build, aptqparently - nobody noticed?) + +2005-01-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-marshal-recursive.h: remove todo comment + +2005-01-25 Joe Shaw <joeshaw@novell.com> + + * Land the mono binding changes to conform to the new APIs. + + * mono/Makefile.am: Remove Custom.cs, DBusType/Custom.cs, + DBusType/Dict.cs, and DBusType/Nil.cs from the build. + + * mono/Arguments.cs (GetCodeAsString): Added. Returns the dbus + type code as a string. + (InitAppending): Rename dbus_message_append_iter_init() to + dbus_message_iter_init_append(). + + * mono/BusDriver.cs: Rename ServiceEventHandler to + NameOwnerChangedHandler. Rename GetServiceOwner to GetOwner. + Rename ServiceOwnerChanged to NameOwnerChanged. + + * mono/Connection.cs: Rename BaseService to UniqueName, and the + underlying C call. + + * mono/Custom.cs: Removed. The CUSTOM type has been removed. + + * mono/Service.cs: Rename Exists to HasOwner, internally rename + dbus_bus_acquire_service() to dbus_bus_request_name(). + + * mono/DBusType/Array.cs (ctor): Use Type.GetElementType() instead + of Type.UnderlyingSystemType to get the correct element type for + the array. + (ctor): Update code for new APIs: use dbus_message_iter_recurse(), + dbus_message_get_{element|arg}_type() instead of + dbus_message_iter_init_array_iterator(). + (Append): Replace dbus_message_iter_append_array() with + dbus_message_iter_open_container() and + dbus_message_iter_close_container(). + + * mono/DBusType/Custom.cs, mono/DBusType/Nil.cs: Removed. These + types have been removed. + + * mono/DBusType/*.cs: Replace calls of + dbus_message_iter_get_[type]() to dbus_message_iter_get_basic(), + but specify the type in the DllImport extern declaration. Ditto + for dbus_message_iter_append_[type]() -> + dbus_message_iter_append_basic(). + + * mono/example/BusListener.cs: Update for ServiceEventHandler -> + NameOwnerChangedHandler. + +2005-01-25 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: Rename of methods and bindings + - get_base_service -> get_unique_name + - bus_get_base_service -> bus_get_unique_name + - dbus_bus_get_base_service -> dbus_bus_get_unique_name + - ACTIVATION_REPLY_ACTIVATED -> DBUS_START_REPLY_SUCCESS + - ACTIVATION_REPLY_ALREADY_ACTIVE -> DBUS_START_REPLY_ALREADY_RUNNING + - bus_activate_service -> bus_start_service_by_name + - dbus_bus_activate_service -> dbus_bus_start_service_by_name + - bus_acquire_service -> bus_request_name + - dbus_bus_acquire_service -> dbus_bus_request_name + - bus_service_exists -> bus_name_has_owner + - dbus_bus_service_exists -> dbus_bus_name_has_owner + + * python/dbus.py: Rename of methods + - activate_service -> start_service_by_name + - bus_acquire_service -> bus_request_name + - ACTIVATION_REPLY_ACTIVATED -> START_REPLY_SUCCESS + - ACTIVATION_REPLY_ALREADY_ACTIVE -> START_REPLY_ALREADY_RUNNING + + +2005-01-24 Joe Shaw <joeshaw@novell.com> + + * dbus/dbus-connection.c (dbus_connection_dispatch): Print out the + signature for the method that can't be found. + + * dbus/dbus-message.c (dbus_message_iter_init): To check to see if + the message has any arguments, we need to call + _dbus_type_reader_get_current_type(), not + _dbus_type_reader_has_next(). + +2005-01-24 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-factory.c: more testing of message validation + + * dbus/dbus-protocol.h (DBUS_MINIMUM_HEADER_SIZE): move to this + header + +2005-01-23 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-factory.c, dbus/dbus-message-util.c: + get this all working, not many tests in the framework yet though + +2005-01-22 Havoc Pennington <hp@redhat.com> + + * doc/dbus-faq.xml, doc/dbus-tutorial: add a FAQ and update + tutorial, based on work from David Wheeler. + +2005-01-21 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-bus.c: add more return_if_fail checks + + * dbus/dbus-message.c (load_message): have the "no validation" + mode (have to edit the code to toggle the mode for now though) + + * dbus/dbus-marshal-header.c (_dbus_header_load): have a mode that + skips all validation; I want to use this at least for benchmark + baseline, I'm not sure if it should be a publicly-available switch. + +2005-01-21 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gmain.c: don't put the GLib bindings in the same + toplevel doxygen group as the low-level API stuff + + * dbus/dbus.h: note that libdbus is the low-level API + +2005-01-20 Havoc Pennington <hp@redhat.com> + + * update-dbus-docs.sh: script to update docs on the web site, only + works for me though. neener. + +2005-01-20 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_poll): amazingly, trying to compile + code can reveal bugs in it + +2005-01-20 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_poll): fix several bugs in the + select() version, patches from Tor Lillqvist + +2005-01-20 Havoc Pennington <hp@redhat.com> + + * doc/dbus-tutorial.xml: tqreplace > with > + + * bus/services.c (bus_registry_acquire_service): validate the name + and return a better error if it's no good. + + * doc/dbus-specification.xml: note NO_AUTO_START change + + * dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change + from AUTO_START, we're toggling the default + + * bus/dispatch.c: adapt the tests to change of auto-start default + +2005-01-18 Havoc Pennington <hp@redhat.com> + + * rename dbus-daemon-1 to dbus-daemon throughout + +2005-01-18 Havoc Pennington <hp@redhat.com> + + * Throughout, grand renaming to strip out the use of "service", + just say "name" instead (or "bus name" when ambiguous). Did not + change the internal code of the message bus itself, only the + programmer-facing API and messages. + + * doc/dbus-specification.xml: further update the message bus section + + * bus/config-parser.c (all_are_equiv): fix bug using freed string + in error case + +2005-01-17 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-types.h: remove 16-bit types since we don't use them + ever + + * dbus/dbus-marshal-validate.c (_dbus_validate_path): disallow any + "invalid name character" not only non-ASCII + + * doc/dbus-specification.xml: further update spec, message bus + parts are still out-of-date but the marshaling etc. stuff is now + accurate-ish + +2005-01-17 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.xml: partially update spec + +2005-01-17 Havoc Pennington <hp@redhat.com> + + * Throughout, align variant bodies according to the contained + type, rather than always to 8. Should save a fair bit of space in + message headers. + + * dbus/dbus-marshal-validate.c (_dbus_validate_body_with_reason): + fix handling of case where p == end + + * doc/TODO: remove the dbus_bool_t item and variant tqalignment items + +2005-01-17 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-types.h: hardcode dbus_bool_t to 32 bits + + * Throughout: modify DBUS_TYPE_BOOLEAN to be a 32-bit type instead + of an 8-bit type. Now dbus_bool_t is the type to use whenever you + are marshaling/unmarshaling a boolean. + +2005-01-16 Havoc Pennington <hp@redhat.com> + + This is about it on what can be disabled/deleted from libdbus + easily, back below 150K anyhow. Deeper cuts are more work than + just turning the code off as I've done here. + + * dbus/dbus-marshal-basic.c (_dbus_pack_int32): we don't need the + signed int convenience funcs + + * dbus/dbus-internals.c (_dbus_verbose_real): omit when not in + verbose mode + + * dbus/dbus-string-util.c, dbus/dbus-string.c: more breaking + things out of libdbus + + * dbus/dbus-sysdeps.c, dbus/dbus-sysdeps-util.c: same + + * dbus/dbus-hash.c: purge the TWO_STRINGS crap (well, make it + tests-enabled-only, though it should probably be deleted) + + * dbus/dbus-message-util.c: same stuff + + * dbus/dbus-auth-util.c: same stuff + +2005-01-16 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-userdb-util.c: split out part of dbus-userdb.c + + * dbus/dbus-sysdeps.c (_dbus_uid_from_string): move here to pave + way for stripping down dbus-userdb.c stuff included in libdbus. + Rename _dbus_parse_uid for consistency. + +2005-01-16 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-internals.c (_dbus_real_assert): print the function + name the assertion failed in + + * dbus/dbus-internals.h (_dbus_return_if_fail) + (_dbus_return_val_if_fail): assert that the name of the function + containing the check doesn't start with '_', since we only want to + use checks on public functions + + * dbus/dbus-connection.c (_dbus_connection_ref_unlocked): change + checks to assertions + + * dbus/dbus-marshal-header.c (_dbus_header_set_field_basic): + change checks to asserts for private function + + * dbus/dbus-message.c (_dbus_message_set_serial): checks + to asserts for private function + + * dbus/dbus-marshal-recursive.c (skip_one_complete_type): remove + broken assertion that was breaking make check + (_dbus_type_reader_array_is_empty): remove this rather than fix + it, was only used in assertions + +2005-01-16 Havoc Pennington <hp@redhat.com> + + * test/unused-code-gc.py: hacky script to tqfind code that's used + only by the bus (not libdbus) or used only by tests or not used at + all. It has some false alarms, but looks like we can clean up a + lot of size from libdbus. + + * dbus/dbus-sysdeps.c, dbus/dbus-sysdeps-utils.c, + dbus/Makefile.am: initially move 10K of binary size out of libdbus + +2005-01-16 Havoc Pennington <hp@redhat.com> + + * Add and fix docs according to Doxygen warnings throughout + source. + + * dbus/dbus-marshal-recursive.c + (_dbus_type_reader_array_is_empty): change this to just call + array_reader_get_array_len() and make it static + + * dbus/dbus-message.c (dbus_message_iter_get_element_type): rename + from get_array_type + (dbus_message_iter_init_append): rename from append_iter_init + + * dbus/dbus-marshal-recursive.c + (_dbus_type_reader_get_element_type): rename from + _dbus_type_reader_get_array_type + +2005-01-15 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c (with_bus_server_filter): fix crash + + * dbus/dbus-marshal-basic.c (_dbus_unpack_uint32): inline as macro + when DBUS_DISABLE_ASSERT + (_dbus_marshal_set_basic): be sure we align for the string length + + * dbus/dbus-marshal-recursive.c (skip_one_complete_type): make + this look faster + + * dbus/dbus-string.c (_dbus_string_get_const_data_len): add an + inline macro version + (_dbus_string_set_byte): provide inline macro version + +2005-01-15 Havoc Pennington <hp@redhat.com> + + * Land the new message args API and type system. + + This patch is huge, but the public API change is not + really large. The set of D-BUS types has changed somewhat, + and the arg "getters" are more geared toward language bindings; + they don't make a copy, etc. + + There are also some known issues. See these emails for details + on this huge patch: + http://lists.freedesktop.org/archives/dbus/2004-December/001836.html + http://lists.freedesktop.org/archives/dbus/2005-January/001922.html + + * dbus/dbus-marshal-*: all the new stuff + + * dbus/dbus-message.c: basically rewritten + + * dbus/dbus-memory.c (check_guards): with "guards" enabled, init + freed blocks to be all non-nul bytes so using freed memory is less + likely to work right + + * dbus/dbus-internals.c (_dbus_test_oom_handling): add + DBUS_FAIL_MALLOC=N environment variable, so you can do + DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or + DBUS_FAIL_MALLOC=10 to make it really, really, really slow and + thorough. + + * qt/message.cpp: port to the new message args API + (operator<<): use str.utf8() rather than str.tqunicode() + (pretty sure this is right from the Qt docs?) + + * glib/dbus-gvalue.c: port to the new message args API + + * bus/dispatch.c, bus/driver.c: port to the new message args API + + * dbus/dbus-string.c (_dbus_string_init_const_len): initialize the + "locked" flag to TRUE and align_offset to 0; I guess we never + looked at these anyhow, but seems cleaner. + + * dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING): + move allocation padding macro to this header; use it to implement + (_DBUS_STRING_STATIC): ability to declare a static string. + + * dbus/dbus-message.c (_dbus_message_has_type_interface_member): + change to return TRUE if the interface is not set. + + * dbus/dbus-string.[hc]: move the D-BUS specific validation stuff + to dbus-marshal-validate.[hc] + + * dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from + dbus-internals.c + + * dbus/Makefile.am: cut over from dbus-marshal.[hc] + to dbus-marshal-*.[hc] + + * dbus/dbus-object-tree.c (_dbus_decompose_path): move this + function here from dbus-marshal.c + +2005-01-12 Joe Shaw <joeshaw@novell.com> + + * NEWS: Update for 0.23. + + * configure.in: Release 0.23. + +2005-01-12 Joe Shaw <joeshaw@novell.com> + + * mono/Makefile.am, mono/example/Makefile.am: Always build the + dbus DLL with --debug. Clean up after the .mdb files this leaves + behind. + + * mono/doc/Makefile.am: Need to uninstall the docs on "make + uninstall" + + * mono/Arguments.cs (GetDBusTypeConstructor): If the type + is an enum, get the enum's underlying type. Another mono + 1.1.3 fix. + +2005-01-11 Joe Shaw <joeshaw@novell.com> + + Patch from Sjoerd Simons <sjoerd@luon.net> + + * mono/Makefile.am, mono/example/Makefile.am: Don't redefine + DESTDIR. It breaks stuff. + +2005-01-11 Joe Shaw <joeshaw@novell.com> + + Patch from Tambet Ingo <tambet@ximian.com> + + * mono/DBusType/Array.cs (Get): Get the underlying element type by + calling type.GetElementType(). The code previously depended on + broken Mono behavior, which was fixed in Mono 1.1.3. + + * mono/DBusType/Dict.cs (constructor): Fix the parameters for + Activator.CreateInstance() so that the class's constructor is + called with the right parameters. + +2005-01-11 Joe Shaw <joeshaw@novell.com> + + Patch from Timo Teräs <ext-timo.teras@nokia.com> + + * dbus/dbus-connection.c + (_dbus_connection_queue_received_message_link): Call + _dbus_connection_remove_timeout() instead of the _locked() + variant, since it's always called from + _dbus_connection_handle_watch(), which handles the locking. + Removed the _locked() variant since it's no longer used. + +2005-01-03 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-internals.h: I'm an idiot, _dbus_assert certainly can + return + +2004-12-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-internals.h: add _DBUS_GNUC_NORETURN to _dbus_assert + +2005-01-03 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_sysdeps_test): fix using == on + floating point + + * dbus/dbus-string.c (_dbus_string_insert_tqalignment): new function + +2005-01-02 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-internals.h (_DBUS_ALIGN_OFFSET): new macro + +2005-01-01 Havoc Pennington <hp@redhat.com> + + * configure.in: add -Wfloat-equal + +2005-01-01 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.h: add _DBUS_DOUBLES_BITWISE_EQUAL macro, + for a variety of reasons '==' doesn't do this. + +2004-12-31 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (_dbus_string_equal_substrings): new function + I keep wishing I had + +2004-12-30 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus.py: s/ACTIVATION_REPLY_ACTIVE/ACTIVATION_REPLY_ACTIVATED + +2004-12-30 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: Change DBUS_ACTIVATION_REPLY_ACTIVATED + and DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE to match the values in + dbus-protocol.h. Because they are defines and not enums they are not + autogenerated. + +2004-12-26 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in (bus_activate_service): Bind + dbus_bus_activate_service + + * python/dbus.py (Bus.activate_service): activate a service on the + bus. + +2004-12-24 Havoc Pennington <hp@redhat.com> + + * test/decode-gcov.c: change to use .gcno and .gcda files, but the + file format has also changed and I haven't adapted to that yet + + * Makefile.am: load .gcno files from latest gcc + +2004-12-23 John (J5) Palmieri <johnp@redhat.com> + * Patch from Rob Taylor <robtaylor@fastmail.fm> + + * python/dbus_bindings.pyx.in (bus_get_unix_user): New + lowlevel binding + + * python/dbus.py (get_unix_user): Added binding to + call dbus_bindings.bus_get_unix_user + + * python/extract.py: Modified the proto_pat regex to + handle unsigned long + +2004-12-21 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/make-dbus-glib-error-enum.sh: omit the function keyword for + better POSIX compliance. + +2004-12-19 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (_dbus_string_insert_4_aligned) + (_dbus_string_insert_8_aligned): new functions + + * dbus/dbus-string.c (_dbus_string_alloc_space): new function + +2004-12-18 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (_dbus_string_validate_ascii): use ISASCII + macro + + * dbus/dbus-message.c: fix a comment, and add a still-unused + not-implemented function + + * dbus/dbus-marshal.h: fix comment + + * dbus/dbus-internals.h (_DBUS_ISASCII): new macro + +2004-12-17 Joe Shaw <joeshaw@novell.com> + + * mono/DBusType/Byte.cs, mono/DBusType/Int32.cs, + mono/DBusType/Int64.cs, mono/DBusType/UInt32.cs, + mono/DBusType/UInt64.cs: Use Enum.GetUnderlyingType() instead of + Type.UnderlyingSystemType to get the actual system type + underneath. This code previously depended on the broken Mono + behavior, which was fixed in 1.1.3. + +2004-11-27 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.h (_dbus_string_get_byte): inline when asserts + are disabled + (_dbus_string_get_const_data): inline when asserts are disabled + + * dbus/dbus-message.c: record the _dbus_current_generation of + creation so we can complain if dbus_shutdown() is used improperly. + Do this only if checks are enabled. + + * dbus/dbus-connection.c: ditto + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c: add with_bus mode to profile echoes + that go through the bus. + + * test/glib/run-test.sh: add ability to run test-profile + + * bus/dbus-daemon-1.1.in: fix to say that SIGHUP causes partial + config file reload. + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c: clean up how the fake_malloc_overhead + thing was implemented + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c: tweak a bit, add support for some + made-up minimal malloc overhead with plain sockets, since in + real life some sort of buffers are unavoidable thus we could + count them in the theoretical best case + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (dbus_message_cache_or_finalize): fix bug + where I was trying to cache one too many messages + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c: reimplement message cache as an array which + makes the cache about twice as fast and saves maybe 1.5% overall + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-threads.c (init_global_locks): forgot to put the + message cache lock here + +2004-11-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (struct DBusMessage): put the locked bit and + the "char byte_order" next to each other to save 4 bytes + (dbus_message_new_empty_header): reduce preallocation, since the + message cache should achieve a similar effect + (dbus_message_cache_or_finalize, dbus_message_get_cached): add a + message cache that keeps a few DBusMessage around in a pool, + another 8% speedup or so. + + * dbus/dbus-dataslot.c (_dbus_data_slot_list_clear): new function + +2004-11-25 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-transport-unix.c (unix_do_iteration): if we're going + to write, without reading or blocking, try it before the poll() + and skip the poll() if nothing remains to write. This is about a + 3% speedup in the echo client/server + +2004-11-25 Havoc Pennington <hp@redhat.com> + + The primary change here is to always write() once before adding + the write watch, which gives us about a 10% performance increase. + + * dbus/dbus-transport-unix.c: a number of modifications to cope + with removing messages_pending + (check_write_watch): properly handle + DBUS_AUTH_STATE_WAITING_FOR_MEMORY; adapt to removal of + messages_pending stuff + (check_read_watch): properly handle WAITING_FOR_MEMORY and + AUTHENTICATED cases + (unix_handle_watch): after writing, see if the write watch can be + removed + (unix_do_iteration): assert that write_watch/read_watch are + non-NULL rather than testing that they aren't, since they + aren't allowed to be NULL. check_write_watch() at the end so + we add the watch if we did not finish writing (e.g. got EAGAIN) + + * dbus/dbus-transport-protected.h: remove messages_pending call, + since it resulted in too much inefficient watch adding/removing; + instead we now require that the transport user does an iteration + after queueing outgoing messages, and after trying the first + write() we add a write watch if we got EAGAIN or exceeded our + max bytes to write per iteration setting + + * dbus/dbus-string.c (_dbus_string_validate_signature): add this + function + + * dbus/dbus-server-unix.c (unix_finalize): the socket name was + freed and then accessed, valgrind flagged this bug, fix it + + * dbus/dbus-message.c: fix several bugs where HEADER_FIELD_LAST was taken + as the last valid field plus 1, where really it is equal to the + last valid field. Corrects some message corruption issues. + + * dbus/dbus-mainloop.c: verbosity changes + + * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): handle OOM + instead of aborting in one of the test codepaths + + * dbus/dbus-internals.c (_dbus_verbose_real): fix a bug that + caused not printing the pid ever again if a verbose was missing + the newline at the end + (_dbus_header_field_to_string): add HEADER_FIELD_SIGNATURE + + * dbus/dbus-connection.c: verbosity changes; + (dbus_connection_has_messages_to_send): new function + (_dbus_connection_message_sent): no longer call transport->messages_pending + (_dbus_connection_send_preallocated_unlocked): do one iteration to + try to write() immediately, so we can avoid the write watch. This + is the core purpose of this patchset + (_dbus_connection_get_dispatch_status_unlocked): if disconnected, + dump the outgoing message queue, so nobody will get confused + trying to send them or thinking stuff is pending to be sent + + * bus/test.c: verbosity changes + + * bus/driver.c: verbosity/assertion changes + + * bus/dispatch.c: a bunch of little tweaks to get it working again + because this patchset changes when/where you need to block. + +2004-11-23 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c: modify to accept a plain_sockets + argument in which case it will bench plain sockets instead of + libdbus, for comparison purposes. + +2004-11-22 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c (N_CLIENT_THREADS): run multiple + threads for more time, so sysprof can get a grip on it. + + * dbus/dbus-string.c (_dbus_string_validate_utf8): remove + pointless variable + +2004-11-13 Havoc Pennington <hp@redhat.com> + + * test/glib/test-profile.c: fix this thing up a bit + + * dbus/dbus-message.c (dbus_message_new_empty_header): increase + preallocation sizes by a fair bit; not sure if this will be an + overall performance win or not, but it does reduce reallocs. + + * dbus/dbus-string.c (set_length, reallocate_for_length): ignore + the test hack that forced constant realloc if asserts are + disabled, so we can profile sanely. Sprinkle in some + _DBUS_UNLIKELY() which are probably pointless, but before I + noticed the real performance problem I put them in. + (_dbus_string_validate_utf8): micro-optimize this thing a little + bit, though callgrind says it didn't help; then special-case + ascii, which did help a lot; then be sure we detect nul bytes as + invalid, which is a bugfix. + (align_length_then_lengthen): add some more _DBUS_UNLIKELY + superstition; use memset to nul the padding instead of a manual + loop. + (_dbus_string_get_length): inline this as a + macro; it showed up in the profile because it's used for loop + tests and so forth + +2004-11-10 Colin Walters <walters@verbum.org> + + * dbus/dbus-spawn.c (check_babysit_events): Handle EINTR, + for extra paranoia. + +2004-11-09 Colin Walters <walters@verbum.org> + + * dbus/dbus-string.c (_dbus_string_get_length): New + function, writes DBusString to C buffer. + + * dbus/dbus-string.h: Prototype it. + + * dbus/dbus-message.c (dbus_message_type_to_string): New + function, converts message type into C string. + + * dbus/dbus-message.h: Prototype it. + + * bus/selinux.c (bus_selinux_check): Take source pid, + target pid, and audit data. Pass audit data to + avc_has_perm. + (log_audit_callback): New function, appends extra + audit information. + (bus_selinux_allows_acquire_service): Also take + service name, add it to audit data. + (bus_selinux_allows_send): Also take message + type, interface, method member, error name, + and destination, and add them to audit data. + (log_cb): Initialize func_audit. + + * bus/selinux.h (bus_selinux_allows_acquire_service) + (bus_selinux_allows_send): Update prototypes + + * bus/services.c (bus_registry_acquire_service): Pass + service name to bus_selinux_allows_acquire_service. + + * bus/bus.c (bus_context_check_security_policy): Pass + additional audit data. Move assignment of dest + to its own line. + +2004-11-07 Colin Walters <walters@verbum.org> + + * dbus/dbus-transport-unix.c (do_authentication): Always + initialize auth_completed. + +2004-11-07 Colin Walters <walters@verbum.org> + + * bus/bus.c (load_config): Break into three + separate functions: process_config_first_time_only, + process_config_every_time, and process_config_postinit. + (process_config_every_time): Move call of + bus_registry_set_service_context_table into + process_config_postinit. + (process_config_postinit): New function, does + any processing that needs to happen late + in initialization (and also on reload). + (bus_context_new): Instead of calling load_config, + open config parser here and call process_config_first_time_only + and process_config_every_time directly. Later, after + we have forked but before changing UID, + invoke bus_selinux_full_init, and then call + process_config_postinit. + (bus_context_reload_config): As in bus_context_new, + load parse file inside here, and call process_config_every_time + and process_config_postinit. + + * bus/services.h, bus/services.c + (bus_registry_set_service_context_table): Rename + from bus_registry_set_sid_table. Take string hash from config + parser, and convert them here into SIDs. + + * bus/config-parser.c (struct BusConfigParser): Have + config parser only store a mapping of service->context + string. + (merge_service_context_hash): New function. + (merge_included): Merge context string hashes instead + of using bus_selinux_id_table_union. + (bus_config_parser_new): Don't use bus_selinux_id_table_new; + simply create a new string hash. + (bus_config_parser_unref): Unref it. + (start_selinux_child): Simply insert strings into hash, + don't call bus_selinux_id_table_copy_over. + + * bus/selinux.h, bus/selinux.c (bus_selinux_id_table_union) + (bus_selinux_id_table_copy_over): Delete. + +2004-11-03 Colin Walters <walters@verbum.org> + + * bus/selinux.c (bus_selinux_pre_init): Kill some unused + variables. + +2004-11-03 Colin Walters <walters@verbum.org> + + * bus/test-main.c (test_pre_hook): Fix test logic, + thanks Joerg Barfurth <Joerg.Barfurth@Sun.COM>. + +2004-11-02 Colin Walters <walters@redhat.com> + + * bus/selinux.c (bus_selinux_init): Split into two functions, + bus_selinux_pre_init and bus_selinux_post_init. + (bus_selinux_pre_init): Just determine whether SELinux is + enabled. + (bus_selinux_post_init): Do everything else. + + * bus/main.c (main): Call bus_selinux_pre_init before parsing + config file, and bus_selinux_post_init after. This ensures that + we don't lose the policyreload notification thread that + bus_selinux_init created before forking previously. + + * bus/test-main.c (test_pre_hook): Update for split. + +2004-10-31 Owen Fraser-Green <owen@discobabe.net> + + Patch from Johan Fischer <linux@fischaz.com> + + * mono/doc/Makefile.am (install-data-local): Added directory + install for DESTDIR + +2004-10-29 Colin Walters <walters@redhat.com> + + * dbus/dbus-sysdeps.h (_dbus_become_daemon): Also take + parameter for fd to write pid to. + + * dbus/dbus-sysdeps.c (_dbus_become_daemon): Implement it. + + * bus/bus.c (bus_context_new): Pass print_pid_fd + to _dbus_become_daemon (bug #1720) + +2004-10-29 Colin Walters <walters@redhat.com> + + Patch from Ed Catmur <ed@catmur.co.uk> + + * mono/doc/Makefile.am (install-data-local): Handle + DESTDIR. + +2004-10-29 Colin Walters <walters@redhat.com> + + * bus/.cvsignore, qt/.cvsignore: Update. + +2004-10-29 Colin Walters <walters@redhat.com> + + Patch from Kristof Vansant <de_lupus@pandora.be> + + * configure.in: Detect Slackware. + * bus/Makefile.am (SCRIPT_IN_FILES): Add rc.messagebus.in. + * bus/rc.messagebus.in: New file. + +2004-10-29 Colin Walters <walters@redhat.com> + + * tools/dbus-monitor.c (filter_func): Return + DBUS_HANDLER_RESULT_HANDLED in filter function + for now. See: + http://freedesktop.org/pipermail/dbus/2004-August/001433.html + +2004-10-29 Colin Walters <walters@redhat.com> + + Patch from Matthew Rickard <mjricka@epoch.ncsc.mil> + + * bus/services.c (bus_registry_acquire_service): + Correctly retrieve service name from DBusString + for printing. + +2004-10-29 Colin Walters <walters@redhat.com> + + * dbus/dbus-glib.h: Update documentation to not + refer to internal APIs. + +2004-10-27 Joe Shaw <joeshaw@novell.com> + + * mono/Arguments.cs (GetDBusTypeConstructor): + type.UnderlyingSystemType will return "System.Byte" if you do it + on "byte[]", which is not what we want. So check the type.IsArray + property and use System.Array instead. + +2004-10-25 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-sysdeps.c (fill_user_info): On errors do not free + the DBusUserInfo structure since this is passed into the function. + This would cause a double free when the function that allocated + the structure would try to free it when an error occured. + + * (bus/session.conf.in, bus/Makefile.am, dbus/configure.in): + use /usr/share/dbus-1/services instead of /usr/lib/dbus-1.0/services + for service activation to avoid 32bit/64bit parallel install issues + +2004-10-21 Colin Walters <walters@verbum.org> + + * AUTHORS: Fix my email address, the @gnu.org one + has been bouncing for some time. Also add J5. + +2004-10-21 Colin Walters <walters@verbum.org> + + * dbus/dbus-transport-unix.c (do_authentication): Return + authentication status to callers. + (unix_handle_watch): If we completed authentication this round, + don't do another read. Instead wait until the next iteration, + after we've read any pending data in the auth buffer. + (unix_do_iteration): Ditto. + (unix_handle_watch): Updated for new do_authentication prototype. + +2004-10-18 Colin Walters <walters@verbum.org> + + * bus/selinux.c (bus_selinux_enabled): Handle + --disable-selinux case. + +2004-10-18 Colin Walters <walters@verbum.org> + + * bus/selinux.h: Add bus_selinux_enabled. + + * bus/selinux.c (bus_selinux_enabled): Implement it. + + * bus/config-parser.c (struct include): Add + if_selinux_enabled member. + (start_busconfig_child): Parse if_selinux_enabled + attribute for include. + (bus_config_parser_content): Handle it. + + * bus/session.conf.in, bus/system.conf.in: Add + inclusion of context mapping to default config files; + conditional on SELinux being enabled. + + * doc/busconfig.dtd: Add to if_selinux_enabled to default DTD. + + * test/data/invalid-config-files/badselinux-1.conf, + test/data/invalid-config-files/badselinux-2.conf: + Test files for bad syntax. + +2004-10-17 Colin Walters <walters@verbum.org> + + * dbus/dbus-memory.c (_dbus_initialize_malloc_debug, check_guards) + (dbus_malloc, dbus_malloc0, dbus_realloc): Fix up printf + format specifier mismatches. + +2004-10-07 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-sysdeps.c (_dbus_file_get_contents): fix an incorrect + format string. + + * glib/dbus-dbus-gmain.c (dbus_g_bus_get): do not mangle NULL + pointer (bug #1540, Leonardo Boiko). + +2004-09-28 Jon Trowbridge <trow@ximian.com> + + * mono/BusDriver.cs: Changed BusDriver struct to remove + the ServiceCreated and ServiceDeleted events and tqreplace them + with the new ServiceOwnerChanged event. + + * mono/example/BusListener.cs: Added a new example program, + which listens for and reports any ServiceOwnerChanged events + on the bus driver. + + * mono/example/Makefile.am (DESTDIR): Build changes for the + new BusListener.cs example. + +2004-09-27 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/Q_SIGNALS.c (bus_match_rule_parse): validate the components of + match rules (bug #1439). + + * dbus/dbus-bus.c (dbus_bus_add_match): add a missing OOM test. + +2004-09-24 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * doc/dbus-specification.xml: document ServiceOwnerChanged + signal. + + * bus/driver.c, bus/driver.h, bus/services.c: Use + ServiceOwnerChanged signal instead of ServiceCreated and + ServiceDeleted. + + * bus/dispatch.c: update testcase for the new signal. + +2004-09-20 Jon Trowbridge <trow@ximian.com> + + Patch from Nat Friedman <nat@novell.com> + + * mono/Makefile.am: A number of small build fixes to allow "make + distcheck" to succeed. + + * mono/example/Makefile.am: "make distcheck" fixes. + + * mono/AssemblyInfo.cs.in: When signing the assembly, look for the + key in @srcdir@. + + * test/Makefile.am: "make distcheck" fixes. + +2004-09-17 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-sysdeps.c (_dbus_user_at_console): fix memleak in OOM. + + * doc/busconfig.dtd: update the DTD for the at_console attribute. + + * bus/driver.c (bus_driver_handle_hello): correctly handle Hello + messages after the first one (bug #1389). + + * bus/dispatch.c (check_double_hello_message): add a test case for + the double hello message bug. + (check_existent_service_activation): fix check of spawning error. + +2004-09-16 David Zeuthen <david@fubar.dk> + + * python/dbus_bindings.pyx.in: Add support for int64 and uint64 + +2004-09-12 David Zeuthen <david@fubar.dk> + + Patch from Kay Sievers <kay.sievers@vrfy.org> + + * bus/bus.c (bus_context_new): + * bus/bus.h: + * bus/main.c (usage) + (main): + Add commandline option --nofork to override configuration file + setting. + +2004-09-09 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-*.h: remove the ; after DBUS_(BEGIN|END)_DECLS. Some C + compilers don't like it (bug #974). + +2004-09-04 Harald Fernengel <harry@kdevelop.org> + + * qt/connection.*: Applied patch by Jérôme Lodewyck + <lodewyck@clipper.ens.fr> to integrate an existing + connection into the Qt eventloop + +2004-08-30 Jon Trowbridge <trow@ximian.com> + + * mono/BusDriver.cs: Added. This is a class for interacting with + the org.freedesktop.DBus service. + + * mono/Message.cs: Added a mechanism to expose the message that is + currently being dispatched via the static Message.Current + property. Added Message.Sender and Message.Destination + properties. + + * mono/Handler.cs: Expose the dispatched message via + Message.Current when handling method calls. + + * mono/Service.cs: Expose the dispatched message via + Message.Current when handling signal emissions. + + * mono/Connection.cs: Bind dbus_bus_get_base_service via the + Connection.BaseService property. + +2004-08-28 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-userdb.c (_dbus_is_console_user): remove unused variable + + More fixes from Steve Grubb + + * dbus/dbus-sysdeps.c (_dbus_connect_tcp_socket): fix fd leak + (_dbus_listen_tcp_socket): fix fd leak + + * dbus/dbus-spawn.c (read_pid, read_ints): move the "again:" for + EINTR to a bit lower in the code + +2004-08-26 Jon Trowbridge <trow@ximian.com> + + * bus/driver.c (bus_driver_handle_service_exists): Respond with + TRUE if we are inquiring about the existence of the built-in + org.freedesktop.DBus service. + +2004-08-25 John Palmieri <johnp@redhat.com> + * bus/config-parser.c: + (struct PolicyType): Add POLICY_CONSOLE + (struct Element.d.policy): s/gid_or_uid/gid_uid_or_at_console + (start_busconfig_child): Sets up console element when + <policy at_console=""> is encountered in a policy file + (append_rule_from_element): Convert console elements to console + rules. + + * bus/policy.c: + (bus_policy_create_client_policy): Add console rules to the client + policy based on if the client is at the console + (bus_policy_append_console_rule): New function for adding a + console rule to a policy + (bus_policy_merge): Handle console rule merging + + * dbus/dbus-sysdeps.h: Added the DBUS_CONSOLE_DIR constant + where we check for console user files + + * dbus/dbus-sysdeps.c: + (_dbus_file_exists): New function which checks if the given + file exists + (_dbus_user_at_console): New function which does the system + specific process of checking if the user is at the console + + * dbus/dbus-userdb.c: + (_dbus_is_console_user): New function converts a UID to user name + and then calls the system specific _dbus_user_at_console to + see if the user is at the console and therefor a console user + +2004-08-25 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/config-parser.c (set_limit): + * bus/dbus-daemon-1.1.in: + * test/data/valid-config-files/many-rules.conf: set the + max_match_rules_per_connection limt from the config file. + + * doc/busconfig.dtd: update the DTD. + + * bus/driver.c: remove some unused variables. + +2004-08-24 Mikael Hallendal <micke@imendio.com> + + * dbus/dbus-glib-lowlevel.h: Removed dbus_bus_get_with_g_main since + it's been tqreplaced by dbus_g_bus_get + +2004-08-23 Colin Walters <walters@redhat.com> + + Updated SELinux support from Matthew Rickard <mjricka@epoch.ncsc.mil> + + * bus/selinux.h: Prototype bus_selinux_get_policy_root. + + * bus/selinux.c: Create a thread for policy reload notification. + (bus_selinux_get_policy_root): Implement. + + * bus/config-parser.c (start_busconfig_child) + (bus_config_parser_content): Support SELinux-root relative + inclusion. + + * configure.in <HAVE_SELINUX>: Add -lpthread. + + * bus/test-main.c (test_pre_hook, test_post_hook): New. + (test_post_hook): Move memory checking into here. + (test_pre_hook, test_post_hook): Move SELinux checks in + here, but conditional on a DBUS_TEST_SELINUX environment + variable. Unfortunately we can't run the SELinux checks + as a normal user, since they won't have any permissions + for /selinux. So this will have to be tested manually + for now, until we have virtualization for most of + libselinux. + +2004-08-23 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_change_identity): add setgroups() to + drop supplementary groups, suggested by Steve Grubb + +2004-08-20 Colin Walters <walters@redhat.com> + + * bus/config-parser.c (start_busconfig_child): Remove some unused + variables. + + * bus/selinux.c (bus_selinux_id_table_insert): Avoid compiler + warning. + +2004-08-17 Joe Shaw <joeshaw@novell.com> + + * configure.in: If --enable-mono is passed in, if we can't tqfind + mono error out. + + * mono/Makefile.am: Use /gacutil to install assemblies into the + GAC and not /root. + +2004-08-12 Havoc Pennington <hp@redhat.com> + + * NEWS: update for 0.22 + + * configure.in: release 0.22 + +2004-08-11 Colin Walters <walters@redhat.com> + + * tools/dbus-send.c (main, usage): Add --reply-timeout + argument. + +2004-08-10 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/bus.c (process_config_first_time_only): get rid of an unused + DBusError that was causing a memoy leak (bug #989). + + * dbus/dbus-keyring.c, dbus/dbus-message.c: + fix compilation on Solaris/Forte C (bug #974) + + * bus/main.c (main): plug two minuscule memleaks. + +2004-08-10 Havoc Pennington <hp@redhat.com> + + * doc/dbus-tutorial.xml: add some more info on GLib bindings + +2004-08-09 Havoc Pennington <hp@redhat.com> + + * COPYING: switch to Academic Free License version 2.1 instead of + 2.0, to resolve complaints about patent termination clause. + +2004-07-31 John (J5) Palmieri <johnp@redhat.com> + + * README: added documentation for the --enable-python + configure switch. + +2004-07-31 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/config-parser.c (bus_config_parser_new): fix an invalid + _unref in the SELinux support. + + * doc/busconfig.dtd: update DTD for SELinux support. + + * bus/config-loader-libxml.c: fix error handler and parser + initialisation/cleanup. OOM test now works with libxml2 HEAD. + + * configure.in: remove the warning about libxml2. + + * dbus/dbus-bus.c: silence doxygen warning. + +2004-07-31 Colin Walters <walters@redhat.com> + + * configure.in: Move #error in SELinux check to its own line. + +2004-07-31 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-internals.h (_DBUS_SET_OOM): + * bus/utils.h (BUS_SET_OOM): use dbus_error_set_const instead of + dbus_error_set. + + * bus/dispatch.c (check_send_exit_to_service): fix the test case, + broken by the change in the _SET_OOM macros. + +2004-07-31 Colin Walters <walters@redhat.com> + + * bus/selinux.c <HAVE_SELINUX>: Include utils.h to get + BUS_SET_OOM. + +2004-07-31 Colin Walters <walters@redhat.com> + + * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADER + to correctly detect DBUS__ACQUIRE_SVC. Also add an + AC_MSG_CHECKING. + +2004-07-24 Havoc Pennington <hp@redhat.com> + + SELinux support from Matthew Rickard <mjricka@epoch.ncsc.mil> + + * bus/selinux.c, bus/selinux.h: new file encapsulating selinux + functionality + + * configure.in: add --enable-selinux + + * bus/policy.c (bus_policy_merge): add FIXME to a comment + + * bus/main.c (main): initialize and shut down selinux + + * bus/connection.c: store SELinux ID on each connection, to avoid + repeated getting of the string context and converting it into + an ID + + * bus/bus.c (bus_context_get_policy): new accessor, though it + isn't used + (bus_context_check_security_policy): check whether the security + context of sender connection can send to the security context of + recipient connection + + * bus/config-parser.c: add parsing for <selinux> and <associate> + + * dbus/dbus-transport.c (_dbus_transport_get_unix_fd): to + implement dbus_connection_get_unix_fd() + + * dbus/dbus-connection.c (dbus_connection_get_unix_fd): new + function, used by the selinux stuff + +2004-07-29 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/config-loader-libxml.c: complete the implementation of + libxml backend for config file loader. Doesn't work with full OOM + test yet. + + * configure.in: change error when selecting libxml into a warning. + + * test/data/invalid-config-files: add two non-well-formed XML + files. + + * glib/Makefile.am: libdbus_gtool always uses expat, not libxml. + + * dbus/dbus-transport-unix.c (unix_handle_watch): do not + disconnect in case of DBUS_WATCH_HANGUP, several do_reading() may + be necessary to read all the buffer. (bug #894) + + * bus/activation.c (bus_activation_activate_service): fix a + potential assertion failure (bug #896). Small optimization in the + case of auto-activation messages. + + * dbus/dbus-message.c (verify_test_message, _dbus_message_test): + add test case for byte-through-vararg bug (#901). patch by Kimmo + Hämäläinen. + +2004-07-28 Anders Carlsson <andersca@gnome.org> + + * python/dbus.py: + * python/dbus_bindings.pyx.in: + Add dbus.init_gthreads (), allow emit_signal to pass + arguments to the signal. + +2004-07-24 Havoc Pennington <hp@redhat.com> + + * AUTHORS: add some people, not really comprehensively, let me + know if I missed you + +2004-07-24 Havoc Pennington <hp@redhat.com> + + * Makefile.am (DIST_SUBDIRS): add DIST_SUBDIRS, problem solved by + Owen + + * test/Makefile.am (DIST_SUBDIRS): here also + +2004-07-22 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-sysdeps.c (fill_user_info): fix inexistent label name, + breaking build on Solaris, reported by Farhad Saberi on the ML. + + * dbus/dbus-message.c (dbus_message_append_args_valist): fix the + va_arg invocation to account for integer promotion in the case of + DBUS_TYPE_BYTE (unsigned char is promoted to int). (bug #901) + + * bus/services.c (bus_service_remove_owner): fix bug #902, use + _dbus_list_get_first_link, not _dbus_list_get_first. + + * dbus/dbus-bus.c (dbus_bus_service_exists): plug a memory leak. + + * dbus/dbus-object-tree.c (free_subtree_recurse): always null + handler functions so that the asserts in _dbus_object_subtree_unref + do not fail. + + * dbus/dbus-transport-unix.c (do_reading): + _dbus_transport_queue_messages return value is of type + dbus_bool_t, not DBusDispatchtqStatus. + +2004-07-19 David Zeuthen <david@fubar.dk> + + * dbus/dbus-protocol.h: Add DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN + + * bus/dispatch.c: + (check_get_connection_unix_user): Debug says GetProperty; but the + method is called GetConnectionUnixUser + (check_get_connection_unix_process_id): New function + (bus_dispatch_test): Actually call check_get_connection_unix_user(); + also call check_get_connection_unix_process_id() + + * bus/driver.c: + (bus_driver_handle_get_connection_unix_process_id): New function, + handles GetConnectionUnixProcessID on the org.freedesktop.DBus + interface + + * dbus/dbus-auth.c: + (handle_server_data_external_mech): Set pid from the credentials + obtained from the socket + + * dbus/dbus-connection.c: + (dbus_connection_get_unix_process_id): New function + + * dbus/dbus-connection.h: + Add prototype for dbus_connection_get_unix_process_id + + * dbus/dbus-transport.c: + (_dbus_transport_get_unix_process_id): New function + + * dbus/dbus-transport.h: + Add prototype for _dbus_transport_get_unix_process_id + +2004-07-19 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-message.c: Message counter fix, patch by Christian + Hammond <chipx86@gnupdate.org> + +2004-07-18 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + * python/dbus_bindings.pyx.in: + * python/tests/test-client.py: + + Add dbus.ByteArray and dbus_bindings.ByteArray + types so that byte streams can be passed back. + + Give jdahlin the heaps of credit that are so + rightfully his. + +2004-07-12 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + + Add message argument to the default object_method_handler + function. + + * python/dbus_bindings.pyx.in: + + Automatically return NIL when passed an empty list + (we can't pass back a list since lists are typed + and we don't have any idea what type the the client + intended the list to be... :-( ) + +2004-07-10 Seth Nickell <seth@gnome.org> + + * python/examples/Makefile.am: + + Fix distcheck breakage caused by new examples. + +2004-07-10 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + + Add "message" argument to service-side dbus.Object + methods. This will break existing services written + using the python bindings, but will allow extraction + of all the message information (e.g. who its from). + + Add improved "object oriented" signal handling/emission. + + * python/examples/example-service.py: + + Nix this example. + + * python/examples/example-signal-emitter.py: + * python/examples/example-signal-recipient.py: + + Two new examples that show how to emit and receive + Q_SIGNALS using the new APIs. + + * python/examples/example-Q_SIGNALS.py: + * python/examples/gconf-proxy-service.py: + * python/examples/gconf-proxy-service2.py: + + Add "message" argument to service methods. + +2004-06-28 Kay Sievers <kay.sievers@vrfy.org> + + * bus/driver.c (bus_driver_handle_get_connection_unix_user) + * dbus/bus.c (dbus_bus_get_unix_user) + * doc/dbus-specification.xml: implement GetConnectionUnixUser + method of org.freedesktop.DBus interface. + + * bus/dispatch.c: test case + +2004-06-23 John (J5) Palmieri <johnp@redhat.com> + + * python/Makefile.am: switched include directory from glib/ to dbus/ + since dbus-glib.h moved + +2004-06-22 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * configure.in: prevent building the gcj stuff and libxml loader + since they are broken. + +2004-06-20 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-glib-error-enum.h: autogenerate the GError enum + codes from the dbus error names + + * glib/dbus-glib.h: move to subdir dbus/ since it's included + as dbus/dbus-glib.h and that breakage is now visible due to + including dbus/dbus-glib.h in dbus-glib-lowlevel.h + + * glib/dbus-glib.h: s/gproxy/g_proxy/ + + * dbus/dbus-shared.h: new header to hold stuff shared with + binding APIs + + * dbus/dbus-protocol.h (DBUS_ERROR_*): move errors here rather + than dbus-errors.h + + * glib/dbus-glib.h (dbus_set_g_error): move to + dbus-glib-lowlevel.h + + * glib/dbus-glib.h: remove dbus/dbus.h from here; change a bunch + of stuff to enable this + + * dbus/dbus-glib-lowlevel.h: put dbus/dbus.h here + + * a bunch of other changes with the same basic "separate glib + bindings from dbus.h" theme + +2004-06-10 Owen Fraser-Green <owen@discobabe.net> + + * dbus-sharp.pc.in: Removed glib-sharp inclusion in Libs. + + * python/examples/Makefile.am: Fixed typo in EXTRA_DIST. + +2004-06-09 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/driver.c, dbus/dbus-bus.c: use BOOLEAN instead of UINT32 for + the reply value of the ServiceExists message. + +2004-06-07 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus_bindings.pyx.in: No longer need to parse path + elements and pass them as arrays of strings. The C API now + accepts plain path strings. + (_build_parsed_path): removed + +2004-06-07 Havoc Pennington <hp@redhat.com> + + * doc/TODO: remove auto-activation item since it's done; sort + items by importance/milestone + +2004-06-07 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message-builder.c (_dbus_message_data_load): append + random signature when using REQUIRED_FIELDS (this hack won't work + in the long term) + + * dbus/dbus-message.c: change the signature to be a header field, + instead of message->signature special-case string. Incremental + step forward. Then we can fix up code to send the signature in the + message, then fix up code to validate said signature, then fix up + code to not put the typecodes inline, etc. + (load_one_message): don't make up the signature after the fact + (decode_header_data): require signature field for the known + message types + + * dbus/dbus-marshal.c (_dbus_marshal_string_len): new + + * dbus/dbus-protocol.h: add DBUS_HEADER_FIELD_SIGNATURE + +2004-06-07 Owen Fraser-Green <owen@discobabe.net> + + * mono/DBusType/ObjectPath.cs: Renamed PathName argument to Path + + * mono/Handler.cs: Updated to follow new path argument for + (un-)registering objects. + + * mono/example/Makefile.am: + * mono/Makefile.am: + * configure.in: Bumped required version for mono and use new -pkg + syntax for deps + +2004-06-05 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-connection.h, dbus/dbus-connection.c: have object path + registration functions take the path argument as char* instead of + char**. + + * dbus/dbus-marshal.h, dbus/dbus-marshal.c (_dbus_decompose_path): + split off the path decompostion part of + _dbus_demarshal_object_path. Some misc. fixes to silence compiler + warnings. + + * glib/dbus-gobject.c, test/test-service.c: update accordingly. + +2004-06-02 Kristian Høgsberg <krh@redhat.com> + + * dbus/dbus-auth.c: Rewrite auth protocol handling to use a state + machine approach. A state is implemented as a function that + handles incoming events as specified for that state. + + * doc/dbus-specification.xml: Update auth protocol state machine + specification to match implementation. Remove some leftover + base64 examples. + +2004-06-02 Kristian Høgsberg <krh@redhat.com> + + * glib/dbus-gproxy.c, glib/dbus-gmain.c, dbus/dbus-string.c, + dbus/dbus-object-tree.c, dbus/dbus-message.c: add comments to + quiet doxygen. + + * Doxyfile.in: remove deprecated options. + + * dbus/dbus-message-handler.c, dbus/dbus-message-handler.h, + glib/test-thread.h, glib/test-thread-client.c, + glib/test-thread-server.c, glib/test-profile.c, + glib/test-dbus-glib.c: remove these unused files. + +2004-06-01 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-object-tree.c + (_dbus_object_tree_dispatch_and_unlock): fix dispatch for + non-fallback handlers (bug #684). + (_dbus_object_subtree_new): initialize invoke_as_fallback field. + (tqfind_subtree_recurse): report wether the returned subtree is an + exact match or a "fallback" match higher up in the tree. + (object_tree_test_iteration): update test case. + +2004-06-01 Seth Nickell <seth@gnome.org> + + * python/dbus_bindings.pyx.in: + * python/tests/test-client.py: + + Round off basic type support. Add dicts (yay!), and + remaining array types. + + Make MessageIter more general so it works for dicts too. + + Mark all loop variables as C integers. + +2004-05-31 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gidl.c (method_info_add_arg): keep args sorted with + "in" before "out" + + * glib/dbus-gobject.c (dbus_type_to_string): move to dbus-gutils.c + + * glib/dbus-glib-tool.c (main): set up to have a --self-test + option that runs the tests, and start filling in some code + including for starters just dumping the interfaces to stdout + + * glib/Makefile.am (INCLUDES): define DBUS_LOCALEDIR + + * test/data/valid-introspection-files/lots-of-types.xml: test of + an example introspection file + + * glib/dbus-gparser.c (parser_check_doctype): doctype should be + "node" (I think...) + +2004-05-31 Seth Nickell <seth@gnome.org> + + * python/dbus_bindings.pyx.in: + * python/tests/test-client.py: + + Test Suite: 1 + Python Bindings: 0 + + Fix string array memory trashing bug... oops... + +2004-05-30 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + + Add a nicer-but-less-flexible alternate API for handling + calls to virtual objects in dbus.ObjectTree. + + Screw up the argument order to the dbus.Object constructor + for consistency with dbus.ObjectTree (and to make dbus_methods + optional for future extension) + + * python/examples/Makefile.am: + * python/examples/gconf-proxy-service.py: + * python/examples/gconf-proxy-service2.py: + + Alternate implementation of gconf-proxy-service using the + nicer dbus.ObjectTree API. + + * python/examples/example-service.py: + * python/tests/test-server.py + + Reverse the argument order to deal with dbus.Object constructor + changes. + +2004-05-30 Seth Nickell <seth@gnome.org> + + * python/examples/example-client.py: + * python/examples/example-service.py: + + Take it back. Lists seem to work but they're broken + in the test suite. Make the base examples use + lists (works fine). + +2004-05-30 Seth Nickell <seth@gnome.org> + + * python/dbus_bindings.pyx.in: + * python/tests/test-client.py: + + Add some more tests and fix errors that crop up. + Unfortunately, currently it seems like marshalling + and unmarshalling of lists is completely broken :-( + +2004-05-30 Seth Nickell <seth@gnome.org> + + * python/dbus_bindings.pyx.in: + + Add support for ObjectPath type. + + * python/dbus.py: + + Refactor message handling code to a common function. + + * python/tests/test-client.py: + * python/tests/test-server.py: + + Add tests that check to make sure values of all types + can be echoed from a service w/o mangling. + +2004-05-29 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + + Add ObjectTree class which allows implementation + of trees of "virtual" objects. Basically the python + wrapper for "register_fallback". + + * python/examples/Makefile.am + * python/examples/gconf-proxy-client.py: + * python/examples/gconf-proxy-service.py: + + Implement a simple GConf proxy service that supports + get/set on string and int GConf keys using the ObjectTree. + +2004-05-29 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + * python/examples/example-client.py: + * python/examples/example-service.py: + * python/examples/list-system-services.py: + + Add SessionBus, SystemBus and ActivationBus classes + so you don't need to know the special little BUS_TYPE + flag. + +2004-05-29 Havoc Pennington <hp@redhat.com> + + * bus/config-parser.c (process_test_valid_subdir): temporarily + stop testing config parser OOM handling, since expat has issues + http://freedesktop.org/pipermail/dbus/2004-May/001153.html + + * bus/dbus-daemon-1.1.in: change requested_reply to + send_requested_reply/receive_requested_reply so we can send the + replies, not just receive them. + + * bus/config-parser.c: parse the new + send_requested_reply/receive_requested_reply + + * bus/policy.c (bus_client_policy_check_can_send): add + requested_reply argument and use it + + * bus/bus.c (bus_context_check_security_policy): pass through + requested_reply status to message send check + + * bus/system.conf.in: adapt to requested_reply change + +2004-05-28 Havoc Pennington <hp@redhat.com> + + * test/glib/test-service-glib.c (main): remove unused variable + + * glib/dbus-gidl.c (base_info_ref): fix a silly compiler warning + + * dbus/dbus-auth.h (enum): remove AUTHENTICATED_WITH_UNUSED_BYTES + from the enum, no longer in use. + + * dbus/dbus-sysdeps.h: include config.h so DBUS_VA_COPY actually + works right. + + * dbus/dbus-message.c: add various _dbus_return_val_if_fail for + whether error_name passed in is a valid error name. + +2004-05-28 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-message.c (dbus_message_get_args): Added support for + OBJECT_PATH and OBJECT_PATH_ARRAY + +2004-05-28 Seth Nickell <seth@gnome.org> + + * python/examples/Makefile.am: + + Forget to add Makefile.am. Do not pass go. + +2004-05-28 Michael Meeks <michael@ximian.com> + + * glib/dbus-gvalue.c (dbus_gvalue_marshal, dbus_gvalue_demarshal): + fix no int64 case. + + * dbus/dbus-string.c (_dbus_string_parse_basic_type): impl. + + * dbus/dbus-message.c (_dbus_message_iter_get_basic_type), + (_dbus_message_iter_get_basic_type_array): impl. + drastically simplify ~all relevant _get methods to use these. + (_dbus_message_iter_append_basic_array), + (dbus_message_iter_append_basic): impl + drastically simplify ~all relevant _append methods to use these. + + * dbus/dbus-message-builder.c (parse_basic_type) + (parse_basic_array, lookup_basic_type): impl. + (_dbus_message_data_load): prune scads of duplicate / + cut & paste coding. + + * dbus/dbus-marshal.c (_dbus_demarshal_basic_type_array) + (_dbus_demarshal_basic_type): implement, + (demarshal_and_validate_len/arg): beef up debug. + (_dbus_marshal_basic_type, _dbus_marshal_basic_type_array): impl. + +2004-05-27 Seth Nickell <seth@gnome.org> + + * configure.in: + * python/Makefile.am: + + Include the example python apps in the tarball. + + * python/examples/list-system-services.py + + Add a python new example that fetches the list of services + from the system bus. + +2004-05-27 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + * python/dbus_bindings.pyx.in: + + Fix failure to notify that a signal was not handled, + resulted in hung functions. + +2004-05-25 Colin Walters <walters@redhat.com> + + * tools/dbus-monitor.c (main): Monitor all types of messages. + +2004-05-23 Owen Fraser-Green <owen@discobabe.net> + + * mono/Handler.cs, mono/Service.cs: Added UnregisterObject method + which unregisters the object path and disposes the handler. + +2004-05-23 Kristian Høgsberg <krh@redhat.com> + + Patch from Timo Teräs <ext-timo.teras@nokia.com> (#614): + + * dbus/dbus-message.c (dbus_message_iter_get_args_valist): Swap + operands to && so we call dbus_message_iter_next () for the last + argument also. + +2004-05-21 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-object-tree.c + (_dbus_object_tree_list_registered_unlock, lookup_subtree): return + tqchildren even if the requested path isn't registered. + (object_tree_test_iteration): test object_tree_list_registered. + + * configure.in: undefine HAVE_ABSTRACT_SOCKETS instead of defining + it to 0. + +2004-05-20 Kristian Høgsberg <krh@redhat.com> + + * doc/TODO: Remove resolved items. + + * bus/expirelist.h (struct BusExpireList): remove unused n_items + field. + + * bus/connection.c (bus_connections_expect_reply): Enforce the + per-connection limit on pending replies. + + Patch from Jon Trowbridge <trow@ximian.com>: + + * bus/main.c (setup_reload_pipe): Added. Creates a pipe and sets + up a watch that triggers a config reload when one end of the pipe + becomes readable. + (signal_handler): Instead of doing the config reload in our SIGHUP + handler, just write to the reload pipe and let the associated + watch handle the reload when control returns to the main loop. + + * bus/driver.c (bus_driver_handle_reload_config): Added. + Implements a ReloadConfig method for requesting a configuration + file reload via the bus driver. + +2004-05-19 Owen Fraser-Green <owen@discobabe.net> + + * HACKING: Updated release instructions concerning the wiki page. + +2004-05-18 Kristian Høgsberg <krh@redhat.com> + + * dbus/dbus-auth.c (client_try_next_mechanism): Remove logic to + filter against auth->allowed_mechs; we only add allowed mechs in + record_mechanisms(). + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): Add an + ALLOWED_MECHS to auth-script format so we can set the list of + allowed mechanisms. + + * data/auth/client-out-of-mechanisms.auth-script: New test to + check client disconnects when it is out of mechanisms to try. + + * dbus/dbus-auth.c (process_command): Remove check for lines + longer that 1 MB; we only buffer up maximum 16 kB. + + * dbus/dbus-transport.c, dbus/dbus-transport-unix.c, + dbus/dbus-auth-script.c, dbus/dbus-auth.c, dbus/dbus-auth.h: + Remove auth state AUTHENTICATED_WITH_UNUSED_BYTES, instead always + assume there might be unused bytes. + + * dbus/dbus-auth.c (_dbus_auth_do_work): Remove check for + client-out-of-mechs, it is handled in process_reject(). Move check + for max failures to send_rejected(), as it's a server-only thing. + + * dbus/dbus-auth.c: Factor out protocol reply code into functions + send_auth(), send_data(), send_rejected(), send_error(), + send_ok(), send_begin() and send_cancel(). + +2004-05-17 Kristian Høgsberg <krh@redhat.com> + + Remove base64 encoding, tqreplace with hex encoding. Original patch + from trow@ximian.com, added error handling. + + * dbus/dbus-string.c (_dbus_string_base64_encode) + (_dbus_string_base64_decode): Remove. + (_dbus_string_hex_decode): Add end_return argument so we can + distinguish between OOM and invalid hex encoding. + (_dbus_string_test): Remove base64 tests and add test case for + invalid hex. + + * dbus/dbus-keyring.c, dbus/dbus-auth-script.c, dbus/dbus-auth.c: + Replace base64 with hex. + + * test/data/auth/invalid-hex-encoding.auth-script: New test case + for invalid hex encoded data in auth protocol. + +2004-05-17 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-connection.c (check_for_reply_unlocked): plug a memory + leak. + +2004-05-15 Owen Fraser-Green <owen@discobabe.net> + + * mono/dbus-sharp.dll.config.in: Added for GAC + * mono/dbus-sharp.snk: Added for GAC + * mono/Assembly.cs.in: Added for GAC + * mono/Makefile.am: Changes for GAC installation + * configure.in: Added refs for dbus-sharp.dll.config.in and + Assembly.cs.in. More fixes for mono testing + * mono/example/Makefile.am: Changed var to CSC + * Makefile.am: Changed flag name to DBUS_USE_CSC + +2004-05-15 Owen Fraser-Green <owen@discobabe.net> + + * mono/Makefile.am: Added SUBDIRS for docs. Changed SUBDIRS order + * mono/doc/*: Added documentation framework + * configure.in: Added monodoc check + * README: Added description of mono configure flags + +2004-05-11 John (J5) Palmieri <johnp@redhat.com>: + + * doc/dbus-specification.xml: Added a "Required" column to the + header fields table and changed the "zero or more" verbage in + the above paragraph to read "The header must contain the required + named header fields and zero or more of the optional named header + fields". + * test/data/invalid-messages/*.message: Added the required PATH + named header field to the tests so that they don't fail on + 'Missing path field' + +2004-05-07 John (J5) Palmieri <johnp@redhat.com> + + * python/dbus-bindings.pyx.in: Stopped the bindings from trashing + the stack by implicitly defining variable and parameter types and + removing the hack of defining C pointers as python objects and later + casting them. + +2004-05-02 Owen Fraser-Green <owen@discobabe.net> + + * mono/Makefile.am: Removed test-dbus-sharp.exe from all target + +2004-05-01 Owen Fraser-Green <owen@discobabe.net> + + * mono/DBusType/Dict.cs: Handle empty dicts + * mono/DBusType/Array.cs: Handle empty arrays + * mono/Arguments.cs: Handle empty arguments + +2004-04-30 Owen Fraser-Green <owen@discobabe.net> + + * dbus-sharp.pc.in: Modified to include include Libs and Requires + field + +2004-04-25 Kristian Høgsberg <krh@redhat.com> + + * test/data/valid-messages/standard-*.message: Update message + test scripts to new header field names. + +2004-04-22 John (J5) Palmieri <johnp@redhat.com> + + * test/break-loader.c (randomly_do_n_things): tracked down buffer + overflow to times_we_did_each_thing array which would chop off the + first character of the failure_dir string. Increased the size of + the array to 7 to reflect the number of random mutation functions + we have. + +2004-04-21 Kristian Høgsberg <krh@redhat.com> + + * dbus/dbus-server-unix.c (unix_finalize): Don't unref + unix_server->watch here, it is unreffed in disconnect. + (_dbus_server_new_for_tcp_socket): convert NULL host to + "localhost" here so we don't append NULL to address. + + * dbus/dbus-server.c (_dbus_server_test): Add test case for + various addresses, including tcp with no explicit host. + +2004-04-21 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-message.c (decode_header_data, decode_string_field): + fix incorrect setting of .name_offset in the HeaderField (it was + off by two bytes, positioned right after the name and typecode) + + * bus/bus.c (bus_context_new, bus_context_unref): test before + calling dbus_server_free_data_slot and _dbus_user_database_unref + in case of an error. + + * tools/Makefile.am: add $(DBUS_GLIB_TOOL_LIBS), xml libs needed + by libdbus-gtool. + +2004-04-19 Kristian Høgsberg <krh@redhat.com> + + * dbus/dbus-transport-unix.c (unix_do_iteration): Rewrite to use + _dbus_poll() instead of select(). + +2004-04-15 Jon Trowbridge <trow@ximian.com> + + * bus/main.c (signal_handler): Reload the configuration files + on SIGHUP. + (main): Set up our SIGHUP handler. + + * bus/bus.c (struct BusContext): Store the config file, user and + fork flag in the BusContext. + (process_config_first_time_only): Added. Contains the code + (previously in bus_context_new) for setting up the BusContext from + the BusConfigParser that should only be run the first time the + config files are read. + (process_config_every_time): Added. Contains the code (previously + in bus_context_new) for setting up the BusContext from the + BusConfigParser that should be run every time the config files are + read. + (load_config): Added. Builds a BusConfigParser from the config + files and passes the resulting structure off to + process_config_first_time_only (assuming this is the first time) + and process_config_every_time. + (bus_context_new): All of the config-related code has been moved + to process_config_first_time_only and process_config_every_time. + Now this function just does the non-config-related initializations + and calls load_config. + (bus_context_reload_config): Added. + +2004-04-15 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * bus/driver.c (bus_driver_handle_get_service_owner): + implement a GetServiceOwner method. + * doc/dbus-specification.xml: document it. + * dbus/dbus-errors.h: add a 'ServiceHasNoOwner' error. + + * glib/dbus-gproxy.c (dbus_gproxy_new_for_service_owner): + implement, using the bus GetServiceOwner method. + + * test/glib/test-dbus-glib.c: + use dbus_gproxy_new_for_service_owner so that we can receive the + signal. + +2004-04-15 John (J5) Palmieri <johnp@redhat.com> + + * dbus/dbus-internals.c, dbus/dbus-message-builder.c, + dbus/dbus-message.c, dbus/dbus-protocol.h + (DBUS_HEADER_FIELD_SERVICE): renamed DBUS_HEADER_FIELD_DESTINATION + + * dbus/dbus-internals.c, dbus/dbus-message-builder.c, + dbus/dbus-message.c, dbus/dbus-protocol.h + (DBUS_HEADER_FIELD_SENDER_SERVICE): renamed DBUS_HEADER_FIELD_SENDER + + * dbus/dbus-internals.c (_dbus_header_field_to_string): + DBUS_HEADER_FIELD_DESTINATION resolves to "destination" + DBUS_HEADER_FIELD_SENDER resolves to "sender" + + * doc/dbus-specification.xml (Header Fields Table): + s/SERVICE/DESTINATION + s/SENDER_SERVICE/SENDER + + +2004-04-14 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * test/glib/test-dbus-glib.c (timed_exit): fail the test after + a few seconds. + +2004-04-13 Michael Meeks <michael@ximian.com> + + * glib/dbus-gobject.c (handle_introspect): split out + (introspect_properties): this. + (handle_introspect): implement this. + + * test/glib/Makefile.am: use the absolute path so the bus + daemon's chdir ("/") doesn't kill us dead. + + * configure.in: subst ABSOLUTE_TOP_BUILDDIR + +2004-04-12 Jon Trowbridge <trow@ximian.com> + + * bus/config-parser.c (struct BusConfigParser): Added + included_files field. + (seen_include): Added. Checks whether or not a file has already + been included by any tqparent BusConfigParser. + (bus_config_parser_new): Copy the tqparent's included_files. + (include_file): Track which files have been included, and fail on + circular inclusions. + (process_test_valid_subdir): Changed printf to report if we are + testing valid or invalid conf files. + (all_are_equiv): Changed printf to be a bit clearer about + what we are actually doing. + (bus_config_parser_test): Test invalid configuration files. + +2004-04-09 Jon Trowbridge <trow@ximian.com> + + * bus/config-parser.c (bus_config_parser_new): Added a 'tqparent' + argument. If non-null, the newly-constructed BusConfigParser will + be initialized with the tqparent's BusLimits instead of the default + values. + (include_file): When including a config file, pass in + the current parser as the tqparent and then copy the BusLimits + from the included BusConfigParser pack to the current parser. + (process_test_valid_subdir): Renamed from process_test_subdir. + (process_test_equiv_subdir): Added. Walks through a directory, + descending into each subdirectory and loading the config files + it tqfinds there. If any subdirectory tqcontains two config files + that don't produce identical BusConfigParser structs, fail. + For now, the BusConfigParser's BusPolicies are not compared. + (bus_config_parser_test): Call both process_test_valid_subdir and + process_test_equiv_subdir. + + * bus/config-loader-libxml.c (bus_config_load): Take a tqparent + argument and pass it along to the call to bus_config_parser_new. + Also made a few small changes to allow this code to compile. + + * bus/config-loader-expat.c (bus_config_load): Take a tqparent + argument and pass it along to the call to bus_config_parser_new. + + * bus/bus.c (bus_context_new): Load the config file + with a NULL tqparent argument. + +2004-03-29 Michael Meeks <michael@ximian.com> + + * glib/dbus-gobject.c (introspect_properties): split + out, fix mangled 'while' flow control. + (introspect_Q_SIGNALS): implement. + (handle_introspect): update. + +2004-03-29 Michael Meeks <michael@ximian.com> + + * glib/dbus-gobject.c (set_object_property): split out / + re-work, use the property type, and not the message type(!) + (get_object_property): ditto. + + * glib/dbus-gvalue.c (dbus_gvalue_demarshal), + (dbus_gvalue_marshal): make this code re-usable, needed + for Q_SIGNALS too, also on both proxy and server side. + Re-write for more efficiency / readability. + +2004-03-29 Michael Meeks <michael@ximian.com> + + * dbus/dbus-message.c + (dbus_message_new_error_printf): impl. + + * dbus/dbus-connection.c + (dbus_connection_unregister_object_path): fix warning. + + * configure.in: fix no-mono-installed situation. + +2004-03-27 Havoc Pennington <hp@redhat.com> + + Patch from Timo Teräs: + + * tools/dbus-send.c (main): if --print-reply, assume type is + method call; support boolean type args + + * dbus/dbus-connection.c (dbus_connection_send_with_reply): fix a + bunch of memleak and logic bugs + +2004-03-23 Owen Fraser-Green <owen@discobabe.net> + + * mono/Arguments.cs: + * mono/Introspector.cs: + * mono/Handler.cs: + * mono/InterfaceProxy.cs: + * mono/Message.cs + * mono/ProxyBuilder.cs: + * mono/Service.cs: + Added InterfaceProxy class to avoid building proxies for every + object. + + * dbus-message.h: + * dbus-message.c (dbus_message_append_args_valist) + (dbus_message_iter_get_object_path) + (dbus_message_iter_get_object_path_array) + (dbus_message_iter_append_object_path) + (dbus_message_iter_append_object_path_array): + Added object_path iter functions to handle OBJECT_PATH arguments + +2004-03-23 Owen Fraser-Green <owen@discobabe.net> + + First checkin of mono bindings. + * configure.in: + * Makefile.am: + Build stuff for the bindings + * dbus-sharp.pc.in: Added for pkgconfig + +2004-03-21 Havoc Pennington <hp@redhat.com> + + * test/test-service.c (main): remove debug spew + +2004-03-21 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): accept empty + arrays + + * dbus/dbus-message.h, bus/dbus-message.c (dbus_message_iter_init) + (dbus_message_iter_init_array_iterator) + (dbus_message_iter_init_dict_iterator): return a dbus_bool_t to + indicate whether the iterator is empty + + * dbus/dbus-pending-call.c, dbus/dbus-server.c: silence compiler + warnings + +2004-03-19 Havoc Pennington <hp@redhat.com> + + * NEWS: 0.21 updates + + * configure.in: 0.21 + + * doc/Makefile.am: add all XMLTO usage to DBUS_XML_DOCS_ENABLED + + * python/Makefile.am: change to avoid dist of dbus_bindings.c so + you don't need pyrex to make dist + + * qt/Makefile.am (libdbus_qt_1_la_SOURCES): add integrator.h to + sources; run tqmoc + +2004-03-18 Richard Hult <richard@imendio.com> + + * dbus/dbus-message.c (dbus_message_get_auto_activation) + (dbus_message_set_auto_activation): Add doxygen docs. + +2004-03-16 Richard Hult <richard@imendio.com> + + * bus/activation.c: (bus_activation_service_created), + (bus_activation_send_pending_auto_activation_messages), + (bus_activation_activate_service): + * bus/activation.h: + * bus/dispatch.c: (bus_dispatch), + (check_nonexistent_service_auto_activation), + (check_service_auto_activated), + (check_segfault_service_auto_activation), + (check_existent_service_auto_activation), (bus_dispatch_test): + * bus/driver.c: (bus_driver_handle_activate_service): + * bus/services.c: (bus_registry_acquire_service): + * dbus/dbus-message.c: (dbus_message_set_auto_activation), + (dbus_message_get_auto_activation): + * dbus/dbus-message.h: + * dbus/dbus-protocol.h: Implement auto-activation. + + * doc/dbus-specification.xml: Add auto-activation to the spec. + +2004-03-12 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * dbus/dbus-marshal.c (_dbus_marshal_get_arg_end_pos): + fix a bug with CUSTOM types. + + * dbus/dbus-message.c (message_iter_test, _dbus_message_test): add + a unit test for this bug (used to fail). + +2004-03-12 Mikael Hallendal <micke@imendio.com> + + * bus/activation.c: + (babysitter_watch_callback): notify all pending activations waiting for + the same exec that the activation failed. + (bus_activation_activate_service): shortcut the activation if we + already waiting for the same executable to start up. + +2004-03-12 Mikael Hallendal <micke@imendio.com> + + * bus/activation.c: + - Added service file reloading. + Each service files directory is kept in an hash table in + BusActivation and each BusActivationEntry knows what .service-file it + was read from. So when you try to activate a service the bus will + check if it's been updated, removed or if new .service-files has + been installed. + - Test code at the bottom for the service file reloading. + * bus/test-main.c: (main): + * bus/test.h: + - added service reloading test. + * dbus/dbus-sysdeps.c: + * dbus/dbus-sysdeps.h: (_dbus_delete_directory): Added. + +2004-03-08 Michael Meeks <michael@ximian.com> + + * dbus/dbus-connection.c (_dbus_connection_block_for_reply): + bail immediately if disconnected, to avoid busy loop. + + * dbus/dbus-message.c (dbus_message_iter_get_args_valist): + cleanup cut/paste/inefficiency. + +2004-03-01 David Zeuthen <david@fubar.dk> + + * dbus/dbus-string.c (_dbus_string_append_printf_valist): Fix a + bug where args were used twice. This bug resulted in a segfault + on a Debian/PPC system when starting the messagebus daemon. Include + dbus-sysdeps.h for DBUS_VA_COPY + + * dbus/dbus-sysdeps.h: Define DBUS_VA_COPY if neccessary. From GLib + + * configure.in: Check for va_copy; define DBUS_VA_COPY to the + appropriate va_copy implementation. From GLib + +2004-02-24 Joe Shaw <joe@ximian.com> + + * bus/services.c (bus_registry_acquire_service): We need to pass + in the service name to dbus_set_error() to prevent a crash. + +2003-12-26 Anders Carlsson <andersca@gnome.org> + + * AUTHORS: Reveal my True identity. + +2003-12-17 Mikael Hallendal <micke@imendio.com> + + * dbus/dbus-message.c: (dbus_message_append_args_valist): + - Added case for DBUS_TYPE_BYTE, patch from Johan Hedberg. + +2003-12-13 Mikael Hallendal <micke@imendio.com> + + * doc/TODO: Added not about better error check of configuration files. + +2003-12-02 Richard Hult <richard@imendio.com> + + * Update AFL version to 2.0 throughout the source files to reflect + the update that was done a while ago. + +2003-12-02 Richard Hult <richard@imendio.com> + + * dbus/dbus-message.c (dbus_message_iter_append_dict): Set + wrote_dict_key to FALSE on the iter that the dict is appended to, + just like when appending other types. Fixes a bug where a dict + couldn't be put inside a dict. + (dbus_message_iter_append_dict_key): Fix typo in warning message. + (message_iter_test, _dbus_message_test): Add test case for dict + inside dict. + +2003-12-01 David Zeuthen <david@fubar.dk> + + * python/dbus.py: Add the actual message when calling the reciever + of a signal such that parameters can be inspected. Add the method + remove_signal_receiver + +2003-11-26 Mikael Hallendal <micke@imendio.com> + + * bus/*.[ch]: + * dbus/*.[ch]: + * glib/*.[ch]: Made ref functions return the pointer + +2003-11-25 Zack Rusin <zack@kde.org> + + * qt/integrator.h, qt/integrator.cpp: Adding handling of DBusServer, + + * qt/server.h, qt/server.cpp, qt/Makefile.am: Adding DBusServer + wrappers, + + * qt/connection.h, qt/connection.cpp: Adjusting to changes in + the Integrator and to better fit with the server, + +2003-11-24 Zack Rusin <zack@kde.org> + + * qt/connection.h, qt/connection.cpp: removing initDbus method since + the integrator handles it now + + * qt/integrator.h, qt/integrator.cpp: reworking handling of timeouts, + since QTimer wasn't really meant to be used the way DBusTimeout is + +2003-11-24 Zack Rusin <zack@kde.org> + + * qt/integrator.h, qt/integrator.cpp, Makefile.am: Adding + Integrator class which integrates D-BUS with the Qt event loop, + + * qt/connection.h, qt/connection.cpp: Move all the code which + was dealing with D-BUS integration to the Integrator class, + and start using Integrator, + +2003-11-23 Zack Rusin <zack@kde.org> + + * qt/connection.h, qt/connection.cpp: Adding the DBusConnection + wrapper + + * qt/message.h, qt/message.cpp: updating to the current D-BUS api, + switching namespaces to DBusQt, reworking the class, + + * Makefile.cvs: switching dependencies so that it matches KDE + schematics, + + * qt/Makefile.am: adding connection.{h,cpp} and message.{h,cpp} to + the library + +2003-11-19 Havoc Pennington <hp@redhat.com> + + * NEWS: update + + * configure.in: bump version to 0.20 + + * configure.in (have_qt): add yet another place to look for qt + (someone hand trolltech a .pc file...) + +2003-11-01 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.xml: add state machine docs on the auth + protocol; just a first draft, I'm sure it's wrong. + +2003-10-28 David Zeuthen <david@fubar.dk> + + * python/dbus_bindings.pyx.in: add get_dict to handle dictionaries + return types. Fixup TYPE_* to reflect changes in dbus/dbus-protocol.h + +2003-10-28 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (get_next_field): delete unused function + +2003-10-28 Havoc Pennington <hp@redhat.com> + + * bus/expirelist.c (do_expiration_with_current_time): detect + failure of the expire_func due to OOM + + * bus/connection.c (bus_pending_reply_expired): return FALSE on OOM + + * bus/dispatch.c (check_send_exit_to_service): fix to handle the + NoReply error that's now created by the bus when the service exits + +2003-10-28 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (_dbus_message_test): enable and fix the + tests for set_path, set_interface, set_member, etc. + + * dbus/dbus-string.c (_dbus_string_insert_bytes): allow 0 bytes + + * dbus/dbus-message.c (set_string_field): always just delete and + re-append the field; accept NULL for deletion + (re_align_fields_recurse): reimplement + +2003-10-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c: fix docs to properly describe the + disconnected message + (_dbus_connection_notify_disconnected): remove this function; + we can't synchronously add the disconnected message, we have to + do it after we've queued any remaining real messages + (_dbus_connection_get_dispatch_status_unlocked): queue the + disconnect message only if the transport has finished queueing all + its real messages and is disconnected. + (dbus_connection_disconnect): update the dispatch status here + +2003-10-22 Havoc Pennington <hp@redhat.com> + + * bus/bus.c (bus_context_check_security_policy): fix up assertion + + * bus/connection.c (bus_transaction_send_from_driver): set the + destination to the connection's base service + +2003-10-20 Havoc Pennington <hp@redhat.com> + + hmm, make check is currently not passing. + + * doc/dbus-specification.xml: add requirement that custom type + names follow the same rules as interface names. + + * dbus/dbus-protocol.h: change some of the byte codes, to avoid + duplication and allow 'c' to be 'custom'; dict is now 'm' for + 'map' + + * doc/dbus-specification.xml: update type codes to match + dbus-protocol.h, using the ASCII byte values. Rename type NAMED to + CUSTOM. Add type OBJECT_PATH to the spec. + +2003-10-17 Havoc Pennington <hp@redhat.com> + + * bus/driver.c (create_unique_client_name): use "." as separator + in base service names instead of '-' + + * dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul + byte at the end of the string + + * dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add + optimization macros since string validation seems to be a slow + point. + + * doc/dbus-specification.xml: restrict valid + service/interface/member/error names. Add test suite code for the + name validation. + + * dbus/dbus-string.c: limit service/interface/member/error names + to [0-9][A-Z][a-z]_ + + * dbus/dbus-connection.c (dbus_connection_dispatch): add missing + format arg to verbose spew + + * glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of + memory, return instead of g_error + + * test/test-service.c (path_message_func): support emitting a + signal on request + + * dbus/dbus-bus.c (init_connections_unlocked): only fill in + activation bus type if DBUS_BUS_ACTIVATION was set; default to + assuming the activation bus was the session bus so that services + started manually will still register. + (init_connections_unlocked): fix so that in OOM situation we get + the same semantics when retrying the function + + * test/test-service.c (main): change to use path registration, to + test those codepaths; register with DBUS_BUS_ACTIVATION rather + than DBUS_BUS_SESSION + +2003-10-16 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gtest-main.c: bracket with #ifdef DBUS_BUILD_TESTS + + * Makefile.am (GCOV_DIRS): remove "test", we don't care about test + coverage of the tests + (coverage-report.txt): don't move the .da and .bbg files around + +2003-10-16 Havoc Pennington <hp@redhat.com> + + * bus/bus.c (struct BusContext): remove struct field I didn't mean + to put there + +2003-10-16 Havoc Pennington <hp@redhat.com> + + * bus/connection.c (bus_pending_reply_expired): either cancel or + execute, not both + (bus_connections_check_reply): use unlink, not remove_link, as we + don't want to free the link; fixes double free mess + + * dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case + where no reply was received + + * dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock): + fix a refcount leak + + * bus/Q_SIGNALS.c (match_rule_matches): add special cases for the + bus driver, so you can match on sender/destination for it. + + * dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if + DBUS_PRINT_BACKTRACE is set + + * dbus/dbus-internals.c: add pid to assertion failure messages + + * dbus/dbus-connection.c: add message type code to the debug spew + + * glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want + sender=foo not service=foo + + * dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the + session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use + DBUS_ACTIVATION_ADDRESS instead + + * bus/activation.c: set DBUS_SESSION_BUS_ADDRESS, + DBUS_SYSTEM_BUS_ADDRESS if appropriate + + * bus/bus.c (bus_context_new): handle OOM copying bus type into + context struct + + * dbus/dbus-message.c (dbus_message_iter_get_object_path): new function + (dbus_message_iter_get_object_path_array): new function (half + finished, disabled for the moment) + + * glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle + DBUS_MESSAGE_TYPE_ERROR + + * tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to + avoid redirecting stderr to /dev/null + (babysit): close stdin if not doing the "exit_with_session" thing + + * dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover + debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not + stdout/stdin, so things don't get confused + + * bus/system.conf.in: fix to allow replies, I modified .conf + instead of .conf.in again. + +2003-10-14 David Zeuthen <david@fubar.dk> + + * python/dbus_bindings.pyx.in (MessageIter.get): fixed typo in + argtype to arg_type when raising unknown arg type exception. + Changed type list to reflect the changes in dbus-protocol.h so + the bindings actually work. + +2003-10-14 Havoc Pennington <hp@redhat.com> + + * test/decode-gcov.c: support gcc 3.3 also, though gcc 3.3 seems + to have a bug keeping it from outputting the .da files sometimes + (string_get_string): don't append garbage nul bytes to the string. + +2003-10-15 Seth Nickell <seth@gnome.org> + + * python/Makefile.am: + + Include dbus_h_wrapper.h in the dist tarball. + +2003-10-14 Havoc Pennington <hp@redhat.com> + + * bus/bus.c (bus_context_check_security_policy): revamp this to + work more sanely with new policy-based requested reply setup + + * bus/connection.c (bus_transaction_send_from_driver): set bus + driver messages as no reply + + * bus/policy.c (bus_client_policy_check_can_receive): handle a + requested_reply attribute on allow/deny rules + + * bus/system.conf: add <allow requested_reply="true"/> + + * bus/driver.c (bus_driver_handle_message): fix check for replies + sent to the bus driver, which was backward. How did this ever work + at all though? I think I'm missing something. + + * dbus/dbus-message.c (decode_header_data): require error and + method return messages to have a reply serial field to be valid + (_dbus_message_loader_queue_messages): break up this function; + validate that reply serial and plain serial are nonzero; + clean up the OOM/error handling. + (get_uint_field): don't return -1 from this + (dbus_message_create_header): fix signed/unsigned bug + + * bus/connection.c (bus_connections_expect_reply): save serial of + the incoming message, not reply serial + +2003-10-14 Havoc Pennington <hp@redhat.com> + + * bus/connection.c: implement pending reply tracking using + BusExpireList + + * bus/bus.c (bus_context_check_security_policy): verify that a + reply is pending in order to allow a reply to be sent. Deny + messages of unknown type. + + * bus/dbus-daemon-1.1.in: update to mention new resource limits + + * bus/bus.c (bus_context_get_max_replies_per_connection): new + (bus_context_get_reply_timeout): new + +2003-10-13 Seth Nickell <seth@gnome.org> + + * python/Makefile.am: + + Pass "make distcheck": remove a couple files from DIST_FILES + that weren't included in the final version. + +2003-10-12 Havoc Pennington <hp@pobox.com> + + Added test code that 1) starts an actual bus daemon and 2) uses + DBusGProxy; fixed bugs that were revealed by the test. Lots + more testing possible, but this is the basic framework. + + * glib/dbus-gproxy.c (dbus_gproxy_manager_unregister): remove + empty proxy lists from the proxy list hash + + * dbus/dbus-message.c (dbus_message_iter_get_args_valist): add a + couple of return_if_fail checks + + * dbus/dbus-pending-call.c (_dbus_pending_call_new): use dbus_new0 + to allocate, so everything is cleared to NULL as it should be. + + * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): pass + source as data to dbus_connection_set_timeout_functions() as the + timeout functions expected + + * test/glib/run-test.sh: add a little script to start up a message + bus and run tests using it + + * tools/dbus-launch.1: updates + + * tools/dbus-launch.c (main): add --config-file option + + * tools/dbus-launch.c (main): remove confusing else if (runprog) + that could never be reached. + + * dbus/dbus-message.c (dbus_message_new_method_return) + (dbus_message_new_error, dbus_message_new_signal): set the + no-reply-expected flag on all these. Redundant, but may + as well be consistent. + +2003-10-11 Havoc Pennington <hp@pobox.com> + + * test/decode-gcov.c (function_solve_graph): make broken block + graph a nonfatal error since it seems to be broken. Need to debug + this. + + * dbus/dbus-marshal.c (_dbus_type_is_valid): new function since we + can't just check type > INVALID < LAST anymore + + * dbus/dbus-message.c (dbus_message_get_signature): new function + (dbus_message_has_signature): new function + (struct DBusMessage): add signature field (right now it isn't sent + over the wire, just generated on the fly) + (dbus_message_copy): copy the signature, and init strings to + proper length to avoid some reallocs + (dbus_message_iter_init_array_iterator): return void, since it + can't fail + (dbus_message_iter_init_dict_iterator): return void since it can't fail + (_dbus_message_loader_queue_messages): add silly temporary hack to + fill in message->signature on load + + * dbus/dbus-protocol.h: change DBUS_TYPE_* values to be ASCII + characters, so they are relatively human-readable. + +2003-10-11 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (_dbus_message_test): add more test + coverage, but #if 0 for now since they uncover a bug + not fixed yet; I think in re_align_field_recurse() + (re_align_field_recurse): add FIXME about broken assertion + + * dbus/dbus-sysdeps.c (_dbus_sysdeps_test): add more test coverage + + * bus/connection.c: share a couple code bits with expirelist.c + + * bus/expirelist.h, bus/expirelist.c: implement a generic + expire-items-after-N-seconds facility, was going to share between + expiring connections and replies, decided not to use for expiring + connections for now. + + * COPYING: include AFL 2.0 (still need to change all the file headers) + +2003-10-09 Havoc Pennington <hp@redhat.com> + + * configure.in: define DBUS_HAVE_GCC33_GCOV if we have + gcc 3.3. Not that we do anything about it yet. + + * bus/Q_SIGNALS.c (bus_match_rule_parse): impose max length on the + match rule text + + * dbus/dbus-protocol.h: add DBUS_MAXIMUM_MATCH_RULE_LENGTH + +2003-10-09 Havoc Pennington <hp@redhat.com> + + Make matching rules theoretically work (add parser). + + * bus/bus.c (bus_context_check_security_policy): fix up to handle + the case where destination is explicitly specified as bus driver + and someone else is eavesdropping. + + * bus/policy.c (bus_client_policy_check_can_receive): fix up + definition of eavesdropping and assertion + + * tools/dbus-send.c (main): use dbus_message_type_from_string + + * bus/Q_SIGNALS.c (bus_match_rule_parse): implement + + * dbus/dbus-message.c (dbus_message_type_from_string): new + + * dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add + +2003-10-02 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): rename from + dbus_gproxy_oneway_call + + * glib/dbus-gmain.c (dbus_connection_setup_with_g_main) + (dbus_server_setup_with_g_main): fix to allow calling them more + than once on the same args + (dbus_bus_get_with_g_main): new function + +2003-10-02 Havoc Pennington <hp@redhat.com> + + * doc/dbus-tutorial.xml: write some stuff + +2003-09-29 Havoc Pennington <hp@pobox.com> + + * configure.in: split checks for Doxygen from XML docs, check for + xmlto + + * doc/Makefile.am: XML-ify all the docs, and add a blank + dbus-tutorial.xml + +2003-09-29 Havoc Pennington <hp@pobox.com> + + * Merge dbus-object-names branch. To see the entire patch + do cvs diff -r DBUS_OBJECT_NAMES_BRANCHPOINT -r dbus-object-names, + it's huuuuge though. + To revert, I tagged DBUS_BEFORE_OBJECT_NAMES_MERGE. + +2003-09-28 Havoc Pennington <hp@pobox.com> + + * HACKING: update to reflect new server + +2003-09-26 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + * python/examples/example-Q_SIGNALS.py: + + Start implementing some notions of Q_SIGNALS. The API + is really terrible, but they sort of work (with the + exception of being able to filter by service, and to + transmit Q_SIGNALS *as* a particular service). Need to + figure out how to make messages come from the service + we registered :-( + + * python/dbus_bindings.pyx.in: + + Removed duplicate message_handler callbacks. + +2003-09-25 Havoc Pennington <hp@redhat.com> + + * bus/session.conf.in: fix my mess + +2003-09-25 Havoc Pennington <hp@pobox.com> + + * bus/session.conf.in: fix security policy, reported by Seth Nickell + +2003-09-25 Seth Nickell <seth@gnome.org> + + * python/examples/example-service.py: + + Johan notices complete wrong code in example-service, but + completely wrong in a way that works exactly the same (!). + Johan is confused, how could this possibly work? Example + code fails to serve purpose of making things clear. + Seth fixes. + +2003-09-25 Mark McLoughlin <mark@skynet.ie> + + * doc/dbus-specification.sgml: don't require header fields + to be 4-byte aligned and specify that fields should be + distinguished from padding by the fact that zero is not + a valid field name. + + * doc/TODO: remove re-tqalignment item and add item to doc + the OBJECT_PATH type. + + * dbus/dbus-message.c: + (HeaderField): rename the original member to value_offset + and introduce a name_offset member to keep track of where + the field actually begins. + (adjust_field_offsets): remove. + (append_int_field), (append_uint_field), + (append_string_field): don't align the start of the header + field to a 4-byte boundary. + (get_next_field): impl tqfinding the next marhsalled field + after a given field. + (re_align_field_recurse): impl re-aligning a number of + already marshalled fields. + (delete_field): impl deleting a field of any type and + re-aligning any following fields. + (delete_int_or_uint_field), (delete_string_field): remove. + (set_int_field), (set_uint_field): no need to re-check + that we have the correct type for the field. + (set_string_field): ditto and impl re-aligning any + following fields. + (decode_header_data): update to take into account that + the fields aren't 4-byte aligned any more and the new + way to distinguish padding from header fields. Also, + don't exit when there is too much header padding. + (process_test_subdir): print the directory. + (_dbus_message_test): add test to make sure a following + field is re-aligned correctly after field deletion. + + * dbus/dbus-string.[ch]: + (_dbus_string_insert_bytes): rename from insert_byte and + allow the insert of multiple bytes. + (_dbus_string_test): test inserting multiple bytes. + + * dbus/dbus-marshal.c: (_dbus_marshal_set_string): add + warning note to docs about having to re-align any + marshalled values following the string. + + * dbus/dbus-message-builder.c: + (append_string_field), (_dbus_message_data_load): + don't align the header field. + + * dbus/dbus-auth.c: (process_test_subdir): print the + directory. + + * test/break-loader.c: (randomly_add_one_byte): upd. for + insert_byte change. + + * test/data/invalid-messages/bad-header-field-tqalignment.message: + new test case. + + * test/data/valid-messages/unknown-header-field.message: shove + a dict in the unknown field. + +2003-09-25 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + * python/dbus_bindings.pyx.in: + + Handle return values. + + * python/examples/example-client.py: + * python/examples/example-service.py: + + Pass back return values from the service to the client. + +2003-09-24 Seth Nickell <seth@gnome.org> + + * python/dbus.py: + + Connect Object methods (when you are sharing an object) up... pass + in a list of methods to be shared. Sharing all the methods just + worked out too weird. You can now create nice Services over the + DBus in Python. :-) + + * python/dbus_bindings.pyx.in: + + Keep references to user_data tuples passed into C functions so + Python doesn't garbage collect on us. + + Implement MethodReturn and Error subclasses of Message for creating + DBusMessage's of those types. + + * python/examples/example-client.py: + * python/examples/example-service.py: + + Simple example code showing both how create DBus services and objects, + and how to use them. + +2003-09-23 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gproxy.c (dbus_gproxy_manager_filter): implement + +2003-09-23 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c (dbus_gproxy_connect_signal): implement + (dbus_gproxy_disconnect_signal): implement + (dbus_gproxy_manager_remove_signal_match): implement + (dbus_gproxy_manager_add_signal_match): implement + (dbus_gproxy_oneway_call): implement + +2003-09-23 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gproxy.c (struct DBusGProxy): convert to a GObject + subclass. This means dropping the transtqparent thread safety of the + proxy; you now need a separate proxy per-thread, or your own + locking on the proxy. Probably right anyway. + (dbus_gproxy_ref, dbus_gproxy_unref): nuke, just use g_object_ref + +2003-09-22 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gproxy.c (dbus_gproxy_manager_get): implement + +2003-09-21 Seth Nickell <seth@gnome.org> + + First checkin of the Python bindings. + + * python/.cvsignore: + * python/Makefile.am: + * python/dbus_bindings.pyx.in: + * python/dbus_h_wrapper.h: + + Pieces for Pyrex to operate on, building a dbus_bindings.so + python module for low-level access to the DBus APIs. + + * python/dbus.py: + + High-level Python module for accessing DBus objects. + + * configure.in: + * Makefile.am: + + Build stuff for the python bindings. + + * acinclude.m4: + + Extra macro needed for tqfinding the Python C header files. + +2003-09-21 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gproxy.c (dbus_gproxy_manager_new): start + implementing the proxy manager, didn't get very far. + + * dbus/dbus-bus.c (dbus_bus_add_match): new + (dbus_bus_remove_match): new + + * glib/dbus-gproxy.c (dbus_gproxy_new_for_service): add a + path_name argument; adjust the other not-yet-implemented + gproxy constructors to be what I think they should be. + +2003-09-21 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-bus.c (dbus_bus_get): set exit_on_disconnect to TRUE + by default for message bus connections. + + * dbus/dbus-connection.c (dbus_connection_dispatch): exit if + exit_on_disconnect flag is set and we process the disconnected + signal. + (dbus_connection_set_exit_on_disconnect): new function + +2003-09-21 Havoc Pennington <hp@pobox.com> + + Get matching rules mostly working in the bus; only actually + parsing the rule text remains. However, the client side of + "signal connections" hasn't been started, this patch is only the + bus side. + + * dbus/dispatch.c: fix for the matching rules changes + + * bus/driver.c (bus_driver_handle_remove_match) + (bus_driver_handle_add_match): send an ack reply from these + method calls + + * glib/dbus-gproxy.c (dbus_gproxy_begin_call): fix order of + arguments, reported by Seth Nickell + + * bus/config-parser.c (append_rule_from_element): support + eavesdrop=true|false attribute on policies so match rules + can be prevented from snooping on the system bus. + + * bus/dbus-daemon-1.1.in: consistently use terminology "sender" + and "destination" in attribute names; fix some docs bugs; + add eavesdrop=true|false attribute + + * bus/driver.c (bus_driver_handle_add_match) + (bus_driver_handle_remove_match): handle AddMatch, RemoveMatch + messages + + * dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST): get + rid of broadcast service concept, Q_SIGNALS are just always broadcast + + * bus/Q_SIGNALS.c, bus/dispatch.c, bus/connection.c, bus/bus.c: + mostly implement matching rules stuff (currently only exposed as signal + connections) + +2003-09-21 Mark McLoughlin <mark@skynet.ie> + + * doc/dbus-specification.sgml: Change the header field name + to be an enum and update the rest of the spec to reference + the fields using the conventinal name. + + * dbus/dbus-protocol.h: update to reflect the spec. + + * doc/TODO: add item to remove the 4 byte tqalignment requirement. + + * dbus/dbus-message.c: Remove the code to generalise the + header/body length and serial number header fields as named + header fields so we can reference field names using the + protocol values. + (append_int_field), (append_uint_field), (append_string_field): + Append the field name as a byte rather than four chars. + (delete_int_or_uint_field), (delete_string_field): reflect the + fact that the field name and typecode now occupy 4 bytes instead + of 8. + (decode_string_field), (decode_header_data): update to reflect + protocol changes and move the field specific encoding from + decode_string_field() back into decode_header_data(). + + * dbus/dbus-internals.[ch]: (_dbus_header_field_to_string): + Add utility to aid debugging. + + * dbus/dbus-message-builder.c: + (append_string_field), (_dbus_message_data_load): Update to + reflect protocol changes; Change the FIELD_NAME directive + to HEADER_FIELD and allow it to take the field's conventional + name rather than the actual value. + + * test/data/*/*.message: Update to use HEADER_FIELD instead + of FIELD_NAME; Always align the header on an 8 byte boundary + *before* updating the header length. + +2003-09-15 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-pending-call.c: add the get/set object data + boilerplate as for DBusConnection, etc. Use generic object data + for the notify callback. + + * glib/dbus-gparser.c (parse_node): parse child nodes + + * tools/dbus-viewer.c: more hacking on the dbus-viewer + + * glib/dbus-gutils.c (_dbus_gutils_split_path): add a file to + contain functions shared between the convenience lib and the + installed lib + + * glib/Makefile.am (libdbus_glib_1_la_LDFLAGS): add + -export-symbols-regex to the GLib library + + * dbus/dbus-object-tree.c (_dbus_object_tree_dispatch_and_unlock): + fix the locking in here, and add a default handler for + Introspect() that just returns sub-nodes. + +2003-09-14 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gthread.c (dbus_g_thread_init): rename to make g_foo + rather than gfoo consistent + + * glib/dbus-gproxy.h: delete for now, move contents to + dbus-glib.h, because the include files don't work right since we + aren't in the dbus/ subdir. + + * glib/dbus-gproxy.c (dbus_gproxy_send): finish implementing + (dbus_gproxy_end_call): finish + (dbus_gproxy_begin_call): finish + + * glib/dbus-gmain.c (dbus_set_g_error): new + + * glib/dbus-gobject.c (handle_introspect): include information + about child nodes in the introspection + + * dbus/dbus-connection.c (dbus_connection_list_registered): new + function to help in implementation of introspection + + * dbus/dbus-object-tree.c + (_dbus_object_tree_list_registered_and_unlock): new function + +2003-09-12 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gidl.h: add common base class for all the foo_info + types + + * tools/dbus-viewer.c: add GTK-based introspection UI thingy + similar to kdcop + + * test/Makefile.am: try test srcdir -ef . in addition to test + srcdir = ., one of them should work (yeah lame) + + * glib/Makefile.am: build the "idl" parser stuff as a convenience + library + + * glib/dbus-gparser.h: make description_load routines return + NodeInfo* not Parser* + + * Makefile.am (SUBDIRS): build test dir after all library dirs + + * configure.in: add GTK+ detection + +2003-09-07 Havoc Pennington <hp@pobox.com> + + * Make Doxygen contented. + +2003-09-07 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: more updates + +2003-09-06 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: partial updates + + * bus/dbus-daemon-1.1.in: fix the config file docs for the + zillionth time; hopefully I edited the right file this time. + + * bus/config-parser.c (append_rule_from_element): support + send_type, send_path, receive_type, receive_path + + * bus/policy.c: add message type and path to the list of things + that can be "firewalled" + +2003-09-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_register_fallback): add this + (dbus_connection_register_object_path): make this not handle + messages to paths below the given path + +2003-09-03 Havoc Pennington <hp@pobox.com> + + * test/glib/Makefile.am: add this with random glib-linked test + programs + + * glib/Makefile.am: remove the random test programs from here, + leave only the unit tests + + * glib/dbus-gobject.c (_dbus_gobject_test): add test for + uscore/javacaps conversion, and fix + (get_object_property, set_object_property): change to .NET + convention for mapping props to methods, set_FooBar/get_FooBar, + since one language has such a convention we may as well copy it. + Plus real methods in either getFooBar or get_foo_bar style won't + collide with this convention. + +2003-09-01 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gparser.c: implement + + * glib/dbus-gobject.c: start implementing skeletons support + + * configure.in: when disabling checks/assert, also define + G_DISABLE_ASSERT and G_DISABLE_CHECKS + +2003-09-01 Havoc Pennington <hp@pobox.com> + + * glib/Makefile.am: rearrange a bunch of files and get "make + check" framework set up + +2003-08-31 Havoc Pennington <hp@pobox.com> + + * fix build with --disable-tests + +2003-08-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c: purge DBusMessageHandler + + * dbus/dbus-message-handler.c: remove DBusMessageHandler, just + use callbacks everywhere + +2003-08-30 Havoc Pennington <hp@pobox.com> + + * test/data/valid-config-files/system.d/test.conf: change to + root for the user so warnings don't get printed + + * dbus/dbus-message.c: add dbus_message_get_path, + dbus_message_set_path + + * dbus/dbus-object-tree.c (do_test_dispatch): add test of + dispatching to a path + + * dbus/dbus-string.c (_dbus_string_validate_path): add + + * dbus/dbus-marshal.c (_dbus_demarshal_object_path): implement + (_dbus_marshal_object_path): implement + + * dbus/dbus-protocol.h (DBUS_HEADER_FIELD_PATH): new header field + to contain the path to the target object + (DBUS_HEADER_FIELD_SENDER_SERVICE): rename + DBUS_HEADER_FIELD_SENDER to explicitly say it's the sender service + +2003-08-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-tree.c: write tests and fix the discovered bugs + +2003-08-29 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-tree.c: modify to allow overlapping paths to be + registered + (struct DBusObjectSubtree): shrink this + a lot, since we may have a lot of them + (_dbus_object_tree_free_all_unlocked): implement + (_dbus_object_tree_dispatch_and_unlock): implement + +2003-08-29 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-internals.h: fix _DBUS_N_GLOBAL_LOCKS + +2003-08-28 Havoc Pennington <hp@pobox.com> + + purge DBusObjectID + + * dbus/dbus-connection.c: port to no ObjectID, create a + DBusObjectTree, rename ObjectTree to ObjectPath in public API + + * dbus/dbus-connection.h (struct DBusObjectTreeVTable): delete + everything except UnregisterFunction and MessageFunction + + * dbus/dbus-marshal.c: port away from DBusObjectID, + add DBUS_TYPE_OBJECT_PATH + + * dbus/dbus-object-registry.[hc], dbus/dbus-object.[hc], + dbus/dbus-objectid.[hc]: remove these, we are moving to + path-based object IDs + +2003-08-25 Havoc Pennington <hp@pobox.com> + + Just noticed that dbus_message_test is hosed, I wonder when I + broke that. I thought make check was passing earlier... + + * dbus/dbus-object-tree.c: add new "object tree" to match DCOP + container tree, will tqreplace most of dbus-object-registry + + * dbus/dbus-string.c (_dbus_string_append_printf_valist): fix C99 + screwup + +2003-08-19 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (decode_string_field): support FIELD_SENDER + (dbus_message_is_error): fix this function + + * bus/dbus-daemon-1.1: clarify logic on when <deny>/<allow> rules + match + + * bus/policy.c (bus_client_policy_check_can_receive): fix code to + reflect clarified man page + (bus_client_policy_check_can_send): ditto + + * bus/session.conf.in: fixup + + * bus/system.conf.in: fixup + +2003-08-18 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix + + * dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix + dumb bug created earlier (wrong order of args to + decode_header_data()) + + * tools/dbus-send.c: port + + * tools/dbus-print-message.c (print_message): port + + * test/data/*messages: port all messages over + + * dbus/dbus-message-builder.c: support including + message type + + * bus/driver.c: port over + + * bus/dispatch.c: port over to new stuff + + * dbus/dbus-connection.c (_dbus_connection_new_for_transport): + rename disconnect signal to "Disconnected" + +2003-08-17 Havoc Pennington <hp@pobox.com> + + This doesn't compile yet, but syncing up so I can hack on it from + work. What are branches for if not broken code? ;-) + + * dbus/dbus-protocol.h: remove DBUS_HEADER_FIELD_NAME, add + DBUS_HEADER_FIELD_INTERFACE, DBUS_HEADER_FIELD_MEMBER, + DBUS_HEADER_FIELD_ERROR_NAME + + * dbus/dbus-hash.c: Introduce DBUS_HASH_TWO_STRINGS as hack to use + for the interface+member pairs + (string_hash): change to use g_str_hash algorithm + (tqfind_direct_function, tqfind_string_function): refactor these to + share most code. + + * dbus/dbus-message.c: port all of this over to support + interface/member fields instead of name field + + * dbus/dbus-object-registry.c: port over + + * dbus/dbus-string.c (_dbus_string_validate_interface): rename + from _dbus_string_validate_name + + * bus/dbus-daemon-1.1: change file format for the + <deny>/<allow> stuff to match new message naming scheme + + * bus/policy.c: port over + + * bus/config-parser.c: parse new format + +2003-08-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-registry.c (add_and_remove_objects): remove + broken assertion + + * glib/dbus-gproxy.c: some hacking + +2003-08-15 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-pending-call.c (dbus_pending_call_block): implement + + * dbus/dbus-connection.c + (dbus_connection_send_with_reply_and_block): factor out internals; + change to convert any error replies to DBusError instead of + returning them as a message + +2003-08-15 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c, + dbus/dbus-pending-call.c: Finish the pending call stuff + +2003-08-14 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-pending-call.c: start on new object that will tqreplace + DBusMessageHandler and ReplyHandlerData for tracking outstanding + replies + + * dbus/dbus-gproxy.c: start on proxy object used to communicate + with remote interfaces + + * dbus/dbus-gidl.c: do the boring boilerplate in here + +2003-08-12 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (bus_dispatch): make this return proper + DBusHandlerResult to avoid DBUS_ERROR_UNKNOWN_METHOD + + * dbus/dbus-errors.c (dbus_set_error): use + _dbus_string_append_printf_valist + + * dbus/dbus-string.c (_dbus_string_append_printf_valist) + (_dbus_string_append_printf): new + + * dbus/dbus-errors.h (DBUS_ERROR_UNKNOWN_MESSAGE): change to + UNKNOWN_METHOD + + * dbus/dbus-connection.c (dbus_connection_dispatch): handle + DBUS_HANDLER_RESULT_NEED_MEMORY; send default error reply if a + message is unhandled. + +2003-08-11 Havoc Pennington <hp@pobox.com> + + * bus/test.c (client_disconnect_handler): change to return + HANDLED (would have been REMOVE_MESSAGE) + + * dbus/dbus-object.h (enum DBusHandlerResult): rename to + HANDLED/NOT_YET_HANDLED instead of + REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it + should be used. + +2003-08-10 Havoc Pennington <hp@pobox.com> + + * tools/dbus-send.c (main): add --type argument, for now + supporting only method_call and signal types. + + * tools/dbus-print-message.c: print message type + + * dbus/dbus-connection.c (_dbus_connection_new_for_transport): + init connection->objects + + * doc/dbus-specification.sgml: fix sgml + + * bus/*.c: port over to object-instance API changes + + * test/test-service.c: ditto + + * dbus/dbus-message.c (dbus_message_create_header): allow #NULL + name, we will have to fix up the rest of the code to also handle + this + (dbus_message_new): generic message-creation call + (set_string_field): allow appending name field + +2003-08-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-registry.c: implement signal connection + and dispatch + + * dbus/dbus-connection.c (_dbus_connection_unref_unlocked): new + + * dbus/dbus-internals.c (_dbus_memdup): new function + +2003-08-02 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_get_no_reply) + (dbus_message_set_no_reply): add these and remove + set_is_error/get_is_error + + * dbus/dbus-protocol.h, doc/dbus-specification.sgml: + remove the ERROR flag, since there's now an ERROR type + +2003-08-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-registry.c (_dbus_object_registry_handle_and_unlock): + implement + + * dbus/dbus-message.c (dbus_message_get_type): new function + + * doc/dbus-specification.sgml: add "type" byte to messages + +2003-08-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-protocol.h (DBUS_MESSAGE_TYPE_*): introduce + a message type enum to distinguish kinds of message + (DBUS_HEADER_FLAG_NO_REPLY_EXPECTED): flag for a message + that need not be replied to + +2003-08-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-marshal.c: adapt to DBusObjectID changes + (unpack_8_octets): fix no-64-bit-int bug + + * dbus/dbus-object-registry.c (validate_id): validate the + connection ID bits, not just the instance ID. + + * dbus/dbus-connection.c (_dbus_connection_init_id): initialize + the connection-global 33 bits of the object ID + + * dbus/dbus-object-registry.c (info_from_entry): fill in + object ID in the new way + + * dbus/dbus-objectid.h: rather than high/low bits, specifically + define server/client/instance bits. + +2003-07-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_register_object): fix + build + +2003-07-13 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object.h (struct DBusObjectVTable): add padding + fields to DBusObjectVTable and DBusObjectInfo + +2003-07-12 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object-registry.c: implement unit test, + fix bugs discovered in process + + * dbus/dbus-connection.c: remove handler_table and + register_handler(), add DBusObjectRegistry usage + + * dbus/dbus-objectid.c (dbus_object_id_is_null) + (dbus_object_id_set_null): new functions + +2003-07-08 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object.c: implement some of this + + * dbus/dbus-object-registry.c + (_dbus_object_registry_add_and_unlock): fill in the object_id out + param + (_dbus_object_registry_new): handle OOM + +2003-07-08 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-object.h: sketch out an API for registering objects + with a connection, that allows us to use as little as 24 bytes + per object and lets application code represent an object in + any conceivable way. + + * dbus/dbus-object-registry.c: implement the hard bits of the + DBusConnection aspect of object API. Not yet wired up. + +2003-07-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-marshal.c (_dbus_marshal_set_object_id): new function + (_dbus_marshal_object_id): new + (_dbus_demarshal_object_id): new + (_dbus_marshal_get_arg_end_pos): support object ID type, and + consolidate identical switch cases. Don't conditionalize handling + of DBUS_TYPE_UINT64, need to handle the type always. + (_dbus_marshal_validate_arg): consolidate identical cases, and + handle DBUS_TYPE_OBJECT_ID + + * dbus/dbus-objectid.c: new file with DBusObjectID data type. + + * dbus/dbus-protocol.h: add DBUS_TYPE_OBJECT_ID + +2003-09-28 Havoc Pennington <hp@pobox.com> + + * real 0.13 release + +2003-09-28 Havoc Pennington <hp@pobox.com> + + * doc/Makefile.am (dbus-specification.html): testing a funky hack + to work with Debian db2html + +2003-09-28 Havoc Pennington <hp@pobox.com> + + * configure.in: 0.13 + + * doc/Makefile.am (dbus-test-plan.html): accept nonexistence of + stylesheet-images for benefit of Debian + + Change back to using filesystem-linked sockets for the system + bus, so only root can create the default system bus address. + + * bus/system.conf.in: change to use + DBUS_SYSTEM_BUS_DEFAULT_ADDRESS + + * dbus/Makefile.am (INCLUDES): remove DBUS_SYSTEM_BUS_PATH define + from here. + + * configure.in: define DBUS_SYSTEM_BUS_DEFAULT_ADDRESS + here, and AC_DEFINE DBUS_SYSTEM_PATH + +2003-08-09 Anders Carlsson <andersca@codefactory.se> + + * doc/TODO: + * doc/busconfig.dtd: + Add busconfig DTD. + +2003-08-09 Anders Carlsson <andersca@codefactory.se> + + * doc/dbus-specification.sgml: + Add activation reply values. + +2003-08-05 Havoc Pennington <hp@redhat.com> + + * configure.in: 0.12 + +2003-08-05 Anders Carlsson <andersca@codefactory.se> + + * glib/dbus-gmain.c: (watch_fd_new), (watch_fd_ref), + (watch_fd_unref), (dbus_gsource_check), (dbus_gsource_dispatch), + (add_watch), (remove_watch), (create_source): + Refcount fds, fixes some reentrancy issues. + +2003-07-30 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-bus.c (init_connections_unlocked): fix default system + bus address to be abstract if we have abstract sockets + + * NEWS: update + +2003-07-28 Havoc Pennington <hp@redhat.com> + + * bus/messagebus.in: fix to avoid processname/servicename + confusion, from Michael Kearey + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100965 + +2003-07-23 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_iter_get_named): + fix from Andy Hanton to remove broken "+1" + +2003-07-16 Havoc Pennington <hp@pobox.com> + + * tools/dbus-launch.c (babysit): close stdout/stderr in the + babysitter process, as suggested by Thomas Leonard, so + an "eval `dbus-launch --exit-with-session`" will actually + return + +2003-07-16 Havoc Pennington <hp@pobox.com> + + * configure.in: print out EXPANDED_* variables in the summary at + the end; clean up the code that computes EXPANDED_ variables and + get the ones using exec_prefix right. Should make things work + when you build without --prefix + +2003-06-29 Havoc Pennington <hp@pobox.com> + + * mono/Test.cs (class Test): fire up a main loop and run it + + * mono/DBus.cs (DBus): don't g_thread_init since it can only be + done once, the app has to do it + +2003-06-26 Havoc Pennington <hp@pobox.com> + + * mono/Connection.cs: set up connection with the glib main loop + +2003-07-01 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.sgml: clarify the format of a type code, + change suggested by Jim Blandy + +2003-06-29 Miloslav Trmac <mitr@volny.cz> + + * doc/Makefile.am: + * tools/Makefile.am: Don't assume srcdir == builddir. + + * dbus/dbus-memory.c (dbus_realloc): Don't check guards after shrinking + the allocated block. + (_dbus_memory_test): New function. + * dbus/dbus-test.h: Add _dbus_memory_test (). + * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): Call it. + + * dbus/dbus-message.c (decode_header_data): Use %.4s instead + of %c%c%c%c. + (dbus_message_new): Remove obsolete @todo. + + * dbus/dbus-marshal.c (_dbus_marshal_set_int64) + (_dbus_marshal_set_uint64): Fix comment. + + * dbus/dbus-message.c (append_int_field, append_uint_field): Don't + hardcode FIELD_REPLY_SERIAL. + + * dbus/dbus-mainloop.c (_dbus_loop_remove_watch) + (_dbus_loop_remove_timeout): Cast function pointers to (void *) for %p + + * configure.in: Add -D_POSIX_C_SOURCE=199309L -DBSD_SOURCE to CFLAGS + and disable DBUS_USE_ATOMIC_INT_486 when --enable-ansi is used + +2003-06-24 Havoc Pennington <hp@pobox.com> + + * mono/*.cs: Use IntPtr.Zero instead of ((IntPtr) 0) + +2003-06-23 Anders Carlsson <andersca@codefactory.se> + + * configure.in: + * gcj/.cvsignore: + * gcj/Hello.java: + * gcj/Makefile.am: + * gcj/TestMessage.java: (TestMessage), (TestMessage.main): + * gcj/org/.cvsignore: + * gcj/org/Makefile.am: + * gcj/org/freedesktop/.cvsignore: + * gcj/org/freedesktop/Makefile.am: + * gcj/org/freedesktop/dbus/.cvsignore: + * gcj/org/freedesktop/dbus/Makefile.am: + * gcj/org/freedesktop/dbus/Message.java: (Message), + (Message.Message): + * gcj/org/freedesktop/dbus/natMessage.cc: + Fix the build system. + +2003-06-22 Havoc Pennington <hp@pobox.com> + + * mono/Connection.cs: add more bindings + + * dbus/dbus-threads.c (dbus_threads_init): allow calling this + more than once. + +2003-06-22 Havoc Pennington <hp@pobox.com> + + * mono/Connection.cs, mono/DBus.cs, mono/Error.cs: + Start wrapping more stuff. + +2003-06-22 Havoc Pennington <hp@pobox.com> + + * mono/Message.cs: implement Message.Wrap() that ensures we only + have a single C# wrapper per DBusMessage, assuming it works which + it probably doesn't. + + * dbus/dbus-message.c (dbus_message_allocate_data_slot): new + (dbus_message_free_data_slot): new + (dbus_message_set_data): new + (dbus_message_get_data): new + +2003-06-22 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-dataslot.c (_dbus_data_slot_allocator_unref) + (_dbus_data_slot_allocator_alloc): rework these to keep a + reference count on each slot and automatically manage a global + slot ID variable passed in by address + + * bus/bus.c: convert to new dataslot API + + * dbus/dbus-bus.c: convert to new dataslot API + + * dbus/dbus-connection.c: convert to new dataslot API + + * dbus/dbus-server.c: convert to new dataslot API + + * glib/dbus-gmain.c: ditto + + * bus/test.c: ditto + + * bus/connection.c: ditto + +2003-06-22 Anders Carlsson <andersca@codefactory.se> + + * configure.in: Add AM_PROG_GCJ and move AM_PROG_LIBTOOL + after the gcj checks so that the correct configuration tags + will be added to libtool. + + * dbus-glib-1.pc.in: No need to specify any includes since + dbus-1.pc.in has those. + +2003-06-22 Havoc Pennington <hp@pobox.com> + + * mono/*, gcj/*, configure.in, Makefile.am: + Check in makefiles and subdirs for mono and gcj bindings. + Neither binding actually exists, just trying to get through + all the build and other boring bits. + +2003-06-21 Philip Blundell <philb@gnu.org> + + * tools/dbus-monitor.1: Updated. + + * tools/dbus-send.1: Likewise. + +2003-06-20 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-transport-unix.c (unix_handle_watch): Check + for hangup and error after checking read so we won't discard + pending data if both hangup and read are set. + +2003-06-19 Philip Blundell <philb@gnu.org> + + * tools/dbus-print-message.c (print_message): Handle BOOLEAN. + + * tools/dbus-send.c: Accept both --system and --session. + + * tools/dbus-monitor.c: Same here. + +2003-06-19 Anders Carlsson <andersca@codefactory.se> + + * glib/dbus-glib.h: Fix so that dbus-glib.h can be used + from C++ (Patch by Miloslav Trmac). + +2003-06-15 Joe Shaw <joe@assbarn.com> + + * configure.in: Check for socklen_t. + + * dbus/dbus-sysdeps.c: Define socklen_t if it's not defined. + + * test/test-segfault.c: Add #include <sys/time.h> + + * tools/Makefile.am: Add DBUS_X_CFLAGS to the INCLUDES since + dbus-launch needs it. + +2003-06-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_listen_unix_socket): don't use + SUN_LEN, it breaks abstract socket usage + + * dbus/dbus-internals.c (_dbus_verbose_real): only print PID at + starts of lines. + +2003-06-04 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-server.c (dbus_server_listen): allow abstract sockets + using unix:abstract=/foo, and when listening in a tmpdir + i.e. unix:tmpdir=/tmp, always use abstract sockets if we can. + + * dbus/dbus-transport.c (_dbus_transport_open): support + unix:abstract=/foo + + * dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket): + support abstract sockets + + * dbus/dbus-transport-unix.c + (_dbus_transport_new_for_domain_socket): support abstract sockets + + * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket): add "abstract" + toggle as an argument, implement abstract namespace support + (_dbus_listen_unix_socket): ditto + + * configure.in: add --enable-abstract-sockets and implement + a configure check for autodetection of the right value. + +2003-06-01 Havoc Pennington <hp@pobox.com> + + * tools/dbus-cleanup-sockets.c: add utility to clean up sockets + in /tmp (though on Linux this will end up being useless, + when we add abstract namespace support) + + * configure.in: define DBUS_SESSION_SOCKET_DIR in addition to + subst'ing it + +2003-05-28 Colin Walters <walters@verbum.org> + + * tools/dbus-monitor.c (main): Fix silly typo (s/--session/--system/). + +2003-05-18 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c (dbus_message_new): Remove @todo. + +2003-05-17 Colin Walters <walters@gnu.org> + + * tools/dbus-send.c: Don't exit with an error code if --help was + passed. Default to using the session bus instead of the system + one. + + * tools/dbus-launch.c: Ditto. + + * tools/dbus-monitor.c: Ditto. + + * tools/dbus-send.1: Update with new arguments. + + * tools/dbus-launch.c: Emit code to export variables. New + arguments -s and -c to specify shell syntax, and a bit of code to + autodetect syntax. Also, allow specifying a program to run. + + * tools/dbus-launch.1: Update with new arguments. + + * tools/dbus-send.1: Ditto. + + * tools/dbus-monitor.1: Ditto. + +2003-05-17 Havoc Pennington <hp@pobox.com> + + * bus/config-parser.c (merge_included): merge in policies from + child configuration file. + + * bus/policy.c (bus_policy_merge): function to merge two policies + together + +2003-05-16 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c: disable verbose lock spew + + * tools/dbus-send.c: add --print-reply command line option + + * tools/dbus-print-message.h (print_message): new util function + shared by dbus-send and dbus-monitor + + * tools/dbus-monitor.c (handler_func): exit on disconnect + + * dbus/dbus-transport-unix.c (do_reading): if the transport is + disconnected, don't try to use the read_watch + + * dbus/dbus-watch.c (dbus_watch_get_enabled): assert watch != NULL + so we can tqfind this bug more easily + +2003-05-16 Havoc Pennington <hp@redhat.com> + + * bus/policy.c (free_rule_list_func): avoid a crash when passed + NULL as DBusHashTable is annoyingly likely to do. + +2003-05-16 Colin Walters <walters@verbum.org> + + * tools/dbus-monitor.c: Add --session argument and usage() + function. + + * tools/dbus-monitor.1: Update with new --session arg. + + * bus/Makefile.am (install-data-hook): Create + $(libdir)/dbus-1.0/services so that the session bus is happy. + +2003-05-15 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_atomic_dec, _dbus_atomic_inc): work + on non-x86. ifdef's are evil. + +2003-05-15 Havoc Pennington <hp@redhat.com> + + * configure.in: 0.11 + + * NEWS: update + + * bus/Makefile.am (initddir): aptqparently we are supposed to put + init scripts in /etc/rc.d/init.d not /etc/init.d + + * bus/Makefile.am: remove the "you must --enable-tests to make + check" as it broke distcheck + + * bus/Makefile.am (install-data-hook): create /etc/dbus-1/system.d + +2003-05-13 James Willcox <jwillcox@gnome.org> + + * configure.in: + * bus/activation.c: (bus_activation_service_created), + (bus_activation_activate_service): + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services): + * bus/session.conf.in: + * dbus/dbus-bus.c: (dbus_bus_acquire_service), + (dbus_bus_service_exists), (dbus_bus_activate_service): + * dbus/dbus-bus.h: + + Add some convenience API which lets you activate a service, and did a + bunch of s/0/DBUS_TYPE_INVALID/ in calls to dbus_message_append_args() + and dbus_message_get_args() + +2003-05-11 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): fix to avoid + calling _dbus_marshal_validate_arg() for every byte in a byte + array, etc. + + * dbus/dbus-message-handler.c: use atomic reference counting to + reduce number of locks slightly; the global lock in here sucks + + * dbus/dbus-connection.c + (_dbus_connection_update_dispatch_status_and_unlock): variant of + update_dispatch_status that can be called with lock held; then use + in a couple places to reduce locking/unlocking + (dbus_connection_send): hold the lock over the whole function + instead of acquiring it twice. + + * dbus/dbus-timeout.c (_dbus_timeout_new): handle OOM + + * bus/connection.c (bus_connections_setup_connection): fix access + to already-freed memory. + + * dbus/dbus-connection.c: keep a little cache of linked list + nodes, to avoid using the global linked list alloc lock in the + normal send-message case. Instead we just use the connection lock + that we already have to take. + + * dbus/dbus-list.c (_dbus_list_tqfind_last): new function + + * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): + change to use a struct for the atomic type; fix docs, + they return value before increment, not after increment. + + * dbus/dbus-string.c (_dbus_string_append_4_aligned) + (_dbus_string_append_8_aligned): new functions to try to + microoptimize this operation. + (reallocate_for_length): break this out of set_length(), to + improve profile info, and also so we can consider inlining the + set_length() part. + + * dbus/dbus-message.c (dbus_message_new_empty_header): init data + strings with some preallocation, cuts down on our calls to realloc + a fair bit. Though if we can get the "move entire string to empty + string" optimization below to kick in here, it would be better. + + * dbus/dbus-string.c (_dbus_string_move): just call + _dbus_string_move_len + (_dbus_string_move_len): add a special case for moving + an entire string into an empty string; we can just + swap the string data instead of doing any reallocs. + (_dbus_string_init_preallocated): new function + +2003-05-11 Havoc Pennington <hp@pobox.com> + + Write a "test-profile" that does echo client-server with threads; + profile reveals lock contention, memcpy/realloc of buffers, and + UTF-8 validation as hot spots. 20% of lock contention eliminated + with dbus_atomic_inc/dec implementation on x86. Much remaining + contention is global mempool locks for GList and DBusList. + + * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): add + x86 implementation + + * dbus/dbus-connection.c (struct DBusConnection): use + dbus_atomic_t for the reference count + + * dbus/dbus-message.c (struct DBusMessage): declare + dbus_atomic_t values as volatile + + * configure.in: code to detect ability to use atomic integer + operations in assembly, from GLib patch + + * dbus/dbus-internals.c (_dbus_verbose_real): call getpid every + time, tired of it being wrong in threads and forked processes + + * glib/test-profile.c: a little program to bounce messages back + and forth between threads and eat CPU + + * dbus/dbus-connection.c: add debug spew macros for debugging + thread locks; include config.h at top; fix deadlock in + dbus_connection_flush() + +2003-05-08 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-spawn.c: s/_exit/exit/ because it was keeping gcov + data from getting written, and there wasn't a good reason to + use _exit really. + + * test/decode-gcov.c (mark_inside_dbus_build_tests): don't count + dbus_verbose lines in test coverage + (main): add list of functions sorted by # of untested blocks + to the coverage report + + * dbus/dbus-mempool.c: put some test-only code in DBUS_BUILD_TESTS + + * dbus/dbus-marshal.c (_dbus_marshal_test): extend test coverage + + * dbus/dbus-message-handler.c (_dbus_message_handler_test): + extend test coverage + + * test/data/auth/cancel.auth-script: test canceling an + authentication + + * dbus/Makefile.am: remove dbus-server-debug.[hc] for now, as they + aren't used. in CVS history if we end up needing them. + +2003-05-04 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message-handler.c (_dbus_message_handler_test): add + unit test + + * dbus/dbus-marshal.c (_dbus_demarshal_string_array): fix this + function, which assumed length was in # of strings, not bytes + + * dbus/dbus-message.c (_dbus_message_test): add tests for some + missing coverage + + * dbus/dbus-connection.c + (_dbus_connection_queue_received_message): disable function for + now, we are only using it in test mode + + * dbus/dbus-message.c (_dbus_message_loader_queue_messages): + remove a mistaken FIXME + +2003-05-04 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_preallocate_send): + unlock mutex on successful return, patch from Anders Gustafsson + +2003-05-04 Havoc Pennington <hp@pobox.com> + + * dbus-glib-1.pc.in (Requires): fix dependencies, from + Anders Gustafsson + +2003-05-04 Havoc Pennington <hp@pobox.com> + + * tools/dbus-launch.c: implement + + * bus/main.c (main), bus/bus.c (bus_context_new): + implement --print-pid and --fork + +2003-05-03 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-address.c (dbus_parse_address): fix bug when a key in + the address had no value, and add to test suite. Fix and + regression test from Miloslav Trmac + +2003-05-03 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-watch.c (dbus_watch_handle): warn and return if a + watch is invalid when handled + + * tools/Makefile.am, tools/dbus-launch.c, tools/dbus-launch.1: add + dbus-launch utility to launch the bus from a shell script. Didn't + actually implement dbus-launch yet, it's just a placeholder still. + +2003-05-03 Havoc Pennington <hp@pobox.com> + + * bus/Makefile.am, bus/dbus-daemon-1.1.in: man page for the + daemon; also documents daemon config file, so tqreplaces + doc/config-file.txt. Corrected some stuff from config-file.txt in + the process of moving it. + +2003-05-03 Havoc Pennington <hp@pobox.com> + + * tools/Makefile.am, tools/dbus-send.1, tools/dbus-monitor.1: + add some man pages + +2003-05-03 Colin Walters <walters@verbum.org> + + * dbus/dbus-sysdeps.c (fill_user_info): Test against + DBUS_UID_UNSET to determine whether to do a uid lookup or not. + + * Makefile.am: Update to use new .pc versioning scheme. + +2003-05-02 Havoc Pennington <hp@redhat.com> + + * bus/system.conf.in: allow send/receive to/from message bus + service + +2003-04-30 Havoc Pennington <hp@redhat.com> + + * configure.in: print a note when building with unit tests and + without assertions + +2003-04-30 Havoc Pennington <hp@redhat.com> + + * Makefile.am: add a check-local that complains if you didn't + configure with --enable-tests + +2003-04-29 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gmain.c: docs cleanups + + * dbus/dbus-types.h: add docs on int64 types + + * dbus/dbus-memory.c: fix docs to avoid putting private API in + public API docs section + +2003-04-29 Havoc Pennington <hp@redhat.com> + + * dbus-1.pc.in, dbus-glib-1.pc.in: rename these from + dbus-1.0.pc.in, dbus-glib-1.0.pc.in. As these change with the + parallel install API version, not with the D-BUS package version. + + * HACKING: move some of README over here + + * README: updates, and document API/ABI policy + + * configure.in: reindentation + +2003-04-29 Havoc Pennington <hp@redhat.com> + + * dbus/dbus.h: add "you have to define DBUS_API_SUBJECT_TO_CHANGE + to use this library" to be sure people have the right + expectations. + +2003-04-28 Havoc Pennington <hp@redhat.com> + + * configure.in: add --enable-docs which by default is auto yes if + doxygen and db2html found, no otherwise; but can be forced on/off + + * doc/Makefile.am: conditionalize whether to build docs on + --enable-docs + +2003-04-28 Havoc Pennington <hp@redhat.com> + + * configure.in: 0.10 + + * NEWS: update + + * bus/system.conf.in: add <includedir>system.d</includedir> + + * dbus/dbus-userdb.c (_dbus_user_database_lookup): fix bug when + username was provided but not uid + + * bus/config-parser.c (struct BusConfigParser): keep track of + whether the parser is toplevel or was included; change some + of the error handling if it's included. + +2003-04-27 Havoc Pennington <hp@pobox.com> + + Unbreak my code... + + * dbus/dbus-transport.c (_dbus_transport_get_dispatch_status): + report correct status if we finish processing authentication + inside this function. + + * bus/activation.c (try_send_activation_failure): use + bus_transaction_send_error_reply + + * bus/connection.c (bus_connection_get_groups): return an error + explaining the problem + + * bus/bus.c (bus_context_check_security_policy): implement + restriction here that inactive connections can only send the + hello message. Also, allow bus driver to send anything to + any recipient. + + * bus/connection.c (bus_connection_complete): create the + BusClientPolicy here instead of on-demand. + (bus_connection_get_policy): don't return an error + + * dbus/dbus-message.c (dbus_message_new_error_reply): allow NULL + sender field in message being replied to + + * bus/bus.c (bus_context_check_security_policy): fix silly typo + causing it to return FALSE always + + * bus/policy.c (bus_client_policy_check_can_send): fix bug where + we checked sender rather than destination + +2003-04-25 Havoc Pennington <hp@redhat.com> + + test suite is slightly hosed at the moment, will fix soon + + * bus/connection.c (bus_connections_expire_incomplete): fix to + properly disable the timeout when required + (bus_connection_set_name): check whether we can remove incomplete + connections timeout after we complete each connection. + + * dbus/dbus-mainloop.c (check_timeout): fix this up a bit, + probably still broken. + + * bus/services.c (bus_registry_acquire_service): implement max + number of services owned, and honor allow/deny rules on which + services a connection can own. + + * bus/connection.c (bus_connection_get_policy): report errors here + + * bus/activation.c: implement limit on number of pending + activations + +2003-04-25 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-transport.c (_dbus_transport_get_unix_user): fix bug + where we used >= 0 instead of != DBUS_UID_UNSET. + +2003-04-25 Havoc Pennington <hp@redhat.com> + + * glib/dbus-gmain.c (remove_watch): fix for a crash when watches + were toggled without add/remove, fix from Anders Gustafsson + +2003-04-24 Havoc Pennington <hp@redhat.com> + + * test/data/valid-config-files/basic.conf: add <limit> tags to + this test + + * bus/config-parser.h, bus/config-parser.c, bus/bus.c: Implement + <limit> tag in configuration file. + +2003-04-24 Havoc Pennington <hp@redhat.com> + + * bus/dispatch.c: somehow missed some name_is + + * dbus/dbus-timeout.c (_dbus_timeout_set_enabled) + (_dbus_timeout_set_interval): new + + * bus/connection.c (bus_connections_setup_connection): record time + when each connection is first set up, and expire them after the + auth timeout passes. + +2003-04-24 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (dbus_message_name_is): rename + (dbus_message_service_is): rename + (dbus_message_sender_is): rename + (dbus_message_get_service): rename + +2003-04-24 Havoc Pennington <hp@redhat.com> + + * configure.in: add --enable-checks + + * dbus/dbus-message.c (dbus_message_new): reverse name/service arguments + + * dbus/dbus-connection.c (dbus_connection_preallocate_send): fix + to use thread locks. + (_dbus_connection_handler_destroyed_locked): move some private + functions into proper docs group + + * dbus/dbus-internals.h: add _dbus_return_if_fail, + _dbus_return_val_if_fail + + Throughout: use dbus_return_if_fail + +2003-04-23 James Willcox <jwillcox@gnome.org> + + * glib/dbus-glib.h: + * glib/dbus-gmain.c: (add_timeout), (wakeup_main), (create_source), + (dbus_connection_setup_with_g_main), + (dbus_server_setup_with_g_main): + * glib/test-dbus-glib.c: (main): + * glib/test-thread-client.c: (main): + * glib/test-thread-server.c: (new_connection_callback), (main): + * tools/dbus-monitor.c: (main): + + Added a GMainContext argument to dbus_connection_setup_with_g_main() + and dbus_server_setup_with_g_main(). + +2003-04-20 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: document the restrictions on + message and service names + +2003-04-22 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c, dbus/dbus-marshal.c: add 64-bit integer + support, and do some code cleanups to share more code and + speed up array marshal/demarshal. + + * dbus-1.0.pc.in (Cflags): put libdir include file in cflags + + * configure.in: generate dbus-arch-deps.h + + * dbus/dbus-protocol.h (DBUS_TYPE_INT64, DBUS_TYPE_UINT64): add + 64-bit typecodes + +2003-04-22 Havoc Pennington <hp@redhat.com> + + * test/data/valid-messages/opposite-endian.message: fix test + to use proper type for rply field + + * test/data/invalid-messages: add tests for below validation + + * dbus/dbus-message.c (decode_header_data): validate field types, + and validate that named fields are valid names + (decode_name_field): consider messages in the + org.freedesktop.Local. namespace to be invalid. + + * dbus/dbus-string.c (_dbus_string_validate_name): new + +2003-04-19 Havoc Pennington <hp@pobox.com> + + * bus/driver.c (bus_driver_handle_hello): check limits and + return an error if they are exceeded. + + * bus/connection.c: maintain separate lists of active and inactive + connections, and a count of each. Maintain count of completed + connections per user. Implement code to check connection limits. + + * dbus/dbus-list.c (_dbus_list_unlink): export + + * bus/bus.c (bus_context_check_security_policy): enforce a maximum + number of bytes in the message queue for a connection + +2003-04-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-auth.c (record_mechanisms): memleak fixes + + * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): fix some + memleaks + + * dbus/dbus-keyring.c (add_new_key): fix a memleak, and + on realloc be sure to update the pointer in the keyring + + * dbus/dbus-string.c (_dbus_string_zero): compensate for align + offset to avoid writing to unallocated memory + + * dbus/dbus-auth.c (process_rejected): return FALSE if we fail to + try the next mechanism, so we properly handle OOM + + * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): fix double-free + on OOM. + (_dbus_keyring_new): fix OOM bug + (_dbus_keyring_new_homedir): always set error; impose a maximum + number of keys we'll load from the file, mostly to speed up the + test suite and make its OOM checks more useful, but also for + general sanity. + + * dbus/dbus-auth.c (process_error_server): reject authentication + if we get an error from the client + (process_cancel): on cancel, send REJECTED, per the spec + (process_error_client): send CANCEL if we get an error from the + server. + +2003-04-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-mainloop.c (_dbus_loop_iterate): fix UMR in verbose + debug spew + + * dbus/dbus-auth.c (handle_client_data_cookie_sha1_mech): fix OOM + handling problem + + * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): only whine + about DBUS_TEST_HOMEDIR once + + * bus/Makefile.am (TESTS_ENVIRONMENT): put DBUS_TEST_HOMEDIR in + the environment + + * bus/dispatch.c (bus_dispatch_sha1_test): actually load sha1 + config file so we test the right thing + + Throughout: assorted docs improvements + +2003-04-18 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gmain.c: adapt to watch changes + + * bus/bus.c, bus/activation.c, etc.: adjust to watch changes + + * dbus/dbus-server.h: remove dbus_server_handle_watch + + * dbus/dbus-connection.h: remove dbus_connection_handle_watch + + * dbus/dbus-watch.c (dbus_watch_handle): change DBusWatch to work + like DBusTimeout, so we don't need dbus_connection_handle_watch + etc. + +2003-04-17 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-userdb.c, dbus/dbus-sysdeps.c: redo all the passwd + database usage so it all goes via the DBusUserDatabase cache. + +2003-04-17 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-mainloop.c (_dbus_loop_iterate): fix logic so that if + there was an OOM watch we skipped, we always return TRUE so we + iterate again to have a look at it again. Fixes test suite hang. + Code rearrangement also lets us lose some memset and only iterate + over callbacks once. + + * bus/driver.c (bus_driver_handle_message): sense of test for + reply was backward + +2003-04-16 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: make spec say serials are unsigned + + * dbus/dbus-message.h: change message serials to unsigned + + * dbus/dbus-connection.c: adapt to message serials being unsigned + +2003-04-15 Havoc Pennington <hp@pobox.com> + + * bus/bus.c: create and keep around a shared DBusUserDatabase + object. + + * bus/connection.c (bus_connection_get_groups): don't cache + groups for user in the connection object, since user database + object now does that. + +2003-04-16 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c (_dbus_message_add_size_counter): keep a + list of size counters + (_dbus_message_loader_putback_message_link): put back a popped link + + * dbus/dbus-connection.c + (dbus_connection_set_max_live_messages_size): rename + max_received_size + (dbus_connection_get_outgoing_size): get size of outgoing + queue + (_dbus_connection_set_connection_counter): remove this cruft + +2003-04-14 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-userdb.c: user database abstraction, mostly to get + caching, but at some point we might want to be able to use a + different database. + + * bus/dispatch.c (bus_dispatch_sha1_test): add a test that uses + SHA1 conf file to test the sha1 auth mechanism, since the regular + test always uses EXTERNAL when available. + + * configure.in, + test/data/valid-config-files/debug-allow-all-sha1.conf.in: + add conf file that requires use of sha1 auth + +2003-04-13 Havoc Pennington <hp@pobox.com> + + * tools/dbus-send.c, tools/dbus-monitor.c: two utility programs + from Philip Blundell to send messages and monitor them. + +2003-04-13 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-mainloop.c: fix some reentrancy issues by refcounting + callbacks + + * test/data/valid-config-files/debug-allow-all.conf.in: allow all + users + + * dbus/dbus-transport.c (_dbus_transport_get_dispatch_status): + fix to only recover unused bytes if we're already authenticated + (_dbus_transport_get_is_authenticated): fix to still mark us + authenticated if there are unused bytes. + + * bus/dispatch.c: implement security policy checking + + * bus/connection.c (bus_transaction_send_from_driver): new + + * bus/bus.c (bus_context_check_security_policy): new + + * bus/dispatch.c (send_service_nonexistent_error): delete this, + now we just set the DBusError and it gets converted to an error + reply. + + * bus/connection.c (allow_user_function): enable code using actual + data from the config file + + * bus/policy.c (list_allows_user): handle wildcard rules for + user/group connection perms + +2003-04-13 Havoc Pennington <hp@pobox.com> + + * bus/config-parser.c: Load up the BusPolicy and BusPolicyRules + + * dbus/dbus-sysdeps.c (_dbus_get_user_id): new function + + * bus/policy.c (bus_policy_append_mandatory_rule) + (bus_policy_append_default_rule, bus_policy_append_user_rule) + (bus_policy_append_group_rule): new functions + +2003-04-12 Havoc Pennington <hp@pobox.com> + + * bus/config-parser.c (bus_config_parser_new): fix a memleak + + * dbus/dbus-sysdeps.c: change DBusCredentials to use longs for + the pid/gid/uid, just for paranoia. + + * test/break-loader.c (randomly_do_n_things): tqfind a byte + containing a type code, and randomly change it to a different + type code. + +2003-04-12 Havoc Pennington <hp@pobox.com> + + * bus/policy.h: change BusPolicy to be the thing from the config + file, and rename old BusPolicy to BusClientPolicy + + * bus/bus.c, bus/connection.c, bus/config-parser.c: change to + match change in how policy works + + * dbus/dbus-internals.h: mark assert_not_reached as + __attribute((noreturn))__ + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.sgml: fix a spot with the wrong name for + the broadcast service. Use boolean return for ServiceExists. + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * configure.in: add another directory to look for qt in. + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * AUTHORS: add Colin Walters + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * NEWS: update + + * configure.in: 0.9 + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * bus/messagebus.in: remove pid file when stopping the + message bus, since the bus won't have privileges to remove it + itself. + +2003-04-11 Havoc Pennington <hp@redhat.com> + + * bus/bus.c (bus_context_new): move credentials change after + creating pidfile + +2003-04-11 Havoc Pennington <hp@pobox.com> + + * test/decode-gcov.c: add "below average functions" to the + coverage report, and change how some of the code works. + + * bus/test-main.c: bracket some stuff in DBUS_BUILD_TESTS so it's + not in the coverage stats. + + * test/test-service.c (main): use _dbus_verbose not fprintf in a + couple places so running the test suite doesn't result in megaspam. + +2003-04-11 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (check_existent_service_activation): accept a no + memory error in a place we didn't before + + * bus/test.c (bus_test_run_everything): remove hacky "do it twice + in case the first one failed," since the test suite is less + broken now. + +2003-04-10 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (check_segfault_service_activation): add test + for launching an executable that just crashes. + + * test/test-segfault.c (main): try setting coredumpsize to 0 so we + don't leave a million cores. We'll see how portable this is. + +2003-04-10 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-spawn.c (_dbus_spawn_async_with_babysitter): move all + the possible tqparent failures before we fork, so that we don't + fail to create a babysitter after creating the child. + + * bus/activation.c (bus_activation_activate_service): kill child + if we don't successfully complete the activation. + +2003-04-10 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c (dbus_connection_flush): don't spin on + the connection if it's disconnected + + * bus/activation.c (bus_activation_service_created): use new + transaction features to roll back removal of pending activation if + we don't successfully create the service after all. Don't remove + pending activation if the function fails. + + * dbus/dbus-list.c (_dbus_list_insert_before_link) + (_dbus_list_insert_after_link): new code to facilitate + services.c fixes + + * dbus/dbus-hash.c (_dbus_hash_table_insert_string_preallocated): + new functionality, so we can preallocate the ability to insert + into a hash table. + + * bus/connection.c (bus_transaction_add_cancel_hook): new function + allowing us to put custom hooks in a transaction to be used for + cancelling said transaction + + * doc/dbus-specification.sgml: add some discussion of secondary + service owners, and disallow zero-length service names + + * bus/services.c (bus_registry_acquire_service): new function, + splits out part of bus_driver_handle_acquire_service() and fixes + a bug where we didn't remove the service doing the acquiring + from the secondary queue if we failed to remove the current owner + from the front of the queue. + +2003-04-10 Alexander Larsson <alexl@redhat.com> + + * doc/dbus-specification.sgml: + s/org.freedesktop.Broadcast/org.freedesktop.DBus.Broadcast/ + +2003-04-10 Alexander Larsson <alexl@redhat.com> + + * bus/.cvsignore: + * glib/.cvsignore: + * test/.cvsignore: + Added files to cvsignore + + * dbus/dbus-message.h: + * dbus/dbus-message.c: (dbus_message_iter_get_named): + Make get_named() take two out argument and return a boolean. + (dbus_message_iter_get_args_valist): + Update usage of get_named(). + (dbus_message_iter_append_byte): + Fix typo + (dbus_message_iter_append_named) + Fix typo + (message_iter_test), (check_message_handling_type), (_dbus_message_test): + More tests. + +2003-04-10 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-marshal.[ch]: + Add array_type_pos argument to _dbus_marshal_validate_arg. + Let you pass a NULL end_pos to _dbus_marshal_validate_type. + + * dbus/dbus-message.[ch]: + Multi-dimensional arrays have full type specification in the + outermost array. Iter code re-arranged to handle this. + Added some more iter tests. + + * doc/dbus-specification.sgml: + Add me to authors. + Remove old FIXME. + Update new array encoding description. + Correct DBUS_SERVICE_FLAGS_REPLACE_EXISTING description. + + * test/data/invalid-messages/array-with-mixed-types.message: + * test/data/valid-messages/array-of-array-of-uint32.message: + Change to the new array format. + + * test/data/invalid-messages/too-short-dict.message: + Fix bug in test. + + * test/data/valid-messages/recursive-types.message: + Fix up and extend test. + +2003-04-10 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c: lots of fixes + + * dbus/dbus-mainloop.c (_dbus_loop_dispatch): export + (_dbus_loop_iterate): remove old "quit if no callbacks" code, + that was crack, broke the test service. + + * dbus/dbus-transport.c (_dbus_transport_open): fix error + handling to avoid piling up errors if we get a failure on the + first address. + + * dbus/dbus-internals.c (_dbus_real_assert_not_reached): include + pid in assertion failures. + + * dbus/dbus-mainloop.c (_dbus_loop_iterate): use static arrays up + to some fixed size of file descriptor array. Don't return TRUE + anytime a timeout exists, that led to lots of busy loop silliness + in the tests. + +2003-04-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-mainloop.c (check_timeout): fix timeouts, I thought + I'd checked this in earlier but hadn't. + +2003-04-09 Havoc Pennington <hp@redhat.com> + + * bus/dispatch.c (bus_dispatch_test): get a bit further through + the activation test (man this is getting old!) + +2003-04-09 Havoc Pennington <hp@redhat.com> + + * test/test-utils.c: use dispatch status function to fix this up + + * bus/connection.c (connection_watch_callback): don't dispatch + from here + (connection_timeout_callback): don't dispatch from here + (bus_connections_setup_connection): set the dispatch status function + (bus_connection_disconnected): unset it + + * dbus/dbus-mainloop.c (_dbus_loop_queue_dispatch): new function + used to add a connection to be dispatched + (_dbus_loop_iterate): do the dispatching at the end of each + iteration + + * dbus/dbus-connection.c + (dbus_connection_set_dispatch_status_function): new function + allowing us to fix up main loop usage + (_dbus_connection_last_unref): free all the various function + user data + (dbus_connection_dispatch): call the DispatchtqStatusFunction + whenever this function returns + (dbus_connection_handle_watch): call DispatchtqStatusFunction + (dbus_connection_send_with_reply_and_block): call DispatchtqStatusFunction + (reply_handler_timeout): call DispatchtqStatusFunction + (dbus_connection_flush): call DispatchtqStatusFunction + +2003-04-09 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-bus.c (dbus_bus_register): fix up error handling and + a memory leak + + * bus/dispatch.c (check_service_activated): fix bug in test + + * dbus/dbus-mainloop.c (check_timeout): fix this up + + * dbus/dbus-internals.c (_dbus_verbose_real): include PID in + verbose output so we can sort out output from different processes, + e.g. in the activation case. + +2003-04-08 Colin Walters <walters@gnu.org> + + * bus/bus.c (struct BusContext) [pidfile]: New member, to store + the pid file. + (bus_context_new): Set it. + (bus_context_unref): Use it to delete the pid file. + +2003-04-08 Havoc Pennington <hp@redhat.com> + + * test/data/invalid-messages/array-with-mixed-types.message: + regression test that fails for the moment + + * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): reorder + tests for convenience + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): don't allow + array of nil, it broke things. + + * test/data/invalid-messages/array-of-nil.message: regression test + + * test/data/valid-messages/array-of-array-of-uint32.message: + happened to write this so added it to suite + +2003-04-08 Havoc Pennington <hp@redhat.com> + + * bus/driver.c (bus_driver_handle_acquire_service): init + retval/reply before checking name + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): add a + recursion depth argument + + * dbus/dbus-message.h (struct DBusMessageIter): put some padding + in the public struct for future extension + + * dbus/dbus-message-builder.c (_dbus_message_data_load): fix + typo + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): fix a verbose + message + + * doc/dbus-specification.sgml: fix typo + +2003-04-08 Alexander Larsson <alexl@redhat.com> + + Implemented recursive types, named types and new-style iters + + * bus/driver.c: + * glib/test-thread-client.c: (thread_func): + * glib/test-thread-server.c: (handle_test_message): + * test/test-service.c: (handle_echo): + Update to new api + + * dbus/Makefile.am: + * dbus/dbus-dict.c: + * dbus/dbus-dict.h: + * dbus/dbus.h + Remove DBusDict + + * dbus/dbus-internals.c: (_dbus_type_to_string): + Update for new types. + + * dbus/dbus-marshal.[ch]: + Implement recursive types and the new marshalling format. + Remove hardcoded dict marshalling. + Marshal named types. + + * dbus/dbus-message-builder.c: + Add BYTE_ARRAY. + Remove references to old types + + * dbus/dbus-message.[ch]: + New non-refcounted iter API that supports recursive iters. + Use iters for appending, including support for recursive + iters. + Add byte and named type support. + Update everything to new marshalling formats. + Add tests for new API. + + * dbus/dbus-protocol.h: + Remove old array types. + Add types: BYTE, ARRAY, DICT, NAMED + + * dbus/dbus-string.c: + * dbus/dbus-sysdeps.c: + Make parse_double locale safe. + + * dbus/dbus-test-main.c: + Call setlocale. + + * dbus/dbus-test.c: + Kill dict test + + * doc/dbus-specification.sgml: + Update spec + + * test/data/incomplete-messages/missing-body.message: + * test/data/invalid-messages/bad-boolean.message: + * test/data/invalid-messages/bad-boolean-array.message: + * test/data/invalid-messages/boolean-array-length-too-long.message-raw: + * test/data/invalid-messages/boolean-has-no-value.message-raw: + * test/data/invalid-messages/too-short-dict.message: + * test/data/valid-messages/dict-simple.message: + * test/data/valid-messages/dict.message: + * test/data/valid-messages/emptiness.message: + * test/data/valid-messages/lots-of-arguments.message: + * test/data/valid-messages/no-padding.message: + * test/data/valid-messages/recursive-types.message: + Add missing NAME fields + Fix up dicts & arrays + + * test/data/invalid-messages/dict-with-nil-value.message: + Removed, this is not invalid anymore. + + * test/data/valid-messages/recursive-types.message: + Add new test for deeply recursive types. + +2003-04-07 Havoc Pennington <hp@pobox.com> + + * bus/driver.c (bus_driver_handle_acquire_service): return an + error if you try to acquire a service that starts with ':' + +2003-04-07 Havoc Pennington <hp@redhat.com> + + * doc/dbus-specification.sgml: require that base service names + start with ':' and that the base service is created/deleted + as first and last things a connection does on the bus + + * bus/dispatch.c (check_existent_service_activation): lots more + work on the activation test; it doesn't fully pass yet... + + * test/test-service.c (main): fix so we don't memleak the + connection to the message bus + (filter_func): accept a message asking us to exit + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * qt/Makefile.am (dbusinclude_HEADERS): install dbus-qt.h, + from Colin Walters + + * configure.in: fixes to Qt detection from Colin Walters + + * doc/Makefile.am: Only remove generated docbook dirs if they + exist, from Colin Walters + + * dbus/dbus-bus.c: change how we set well-known connections to + NULL, so that it works if a single connection is stored in + two well-known array Q_SLOTS. + + * test/Makefile.am: remove a lot of stuff that isn't immediately + useful, it's in CVS history if we want it. + + * test/test-service.c: use dbus-mainloop instead of that + watch.[hc] crack + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * dbus/Makefile.am: split lists of sources into stuff that goes in + the library, util functions that go in the lib and are also used + elsewhere, and util functions that are used in tests/daemon but + don't go in the lib. + + * dbus/dbus-mainloop.h, dbus/dbus-mainloop.c: move bus/loop.[hc] + here so it can be used in test binaries also + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-sysdeps.c (_dbus_become_daemon): write the pidfile + here in the tqparent process, so we can return an error if it + fails. Also, move some of the code into the child so the tqparent + is less hosed if we fail midway through. + + * bus/bus.c (bus_context_new): move pidfile detection further up + in the function, before we start overwriting sockets and such. + + * bus/messagebus.in: adjust this a bit, not sure if it will work. + + * configure.in: add --with-system-pid-file and --with-system-socket + +2003-04-06 Colin Walters <walters@verbum.org> + + * configure.in (DBUS_SYSTEM_PID_FILE): New variable. + + * bus/system.conf.in: Declare a pidfile. + + * bus/bus.c (bus_context_new): Test for an existing pid file, and + create one (if appropriate). + + * bus/config-parser.c (enum ElementType) [ELEMENT_PIDFILE]: New. + (struct BusConfigParser) [pidfile]: New. + (element_type_to_name, merge_included, start_busconfig_child) + (bus_config_parser_end_element, bus_config_parser_content): Handle it. + (bus_config_parser_unref): Free it. + (bus_config_parser_get_pidfile): New function. + + * bus/config-parser.h (_dbus_write_pid_file): Prototype. + + * dbus/dbus-errors.h (DBUS_ERROR_PIDFILE_EXISTS): New error. + + * dbus/dbus-sysdeps.c (_dbus_write_pid_file): New function. + + * dbus/dbus-sysdeps.h: Prototype it. + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * bus/bus.c (bus_context_new): print the address in here, rather + than in main(), because we need to do it before forking the daemon + + * bus/dispatch.c (send_service_nonexistent_error): set the sender + on the service nonexistent error + + * bus/driver.c (bus_driver_handle_acquire_service): set the + sender on the AcquireService reply + + * test/data/valid-config-files/debug-allow-all.conf.in: Make test + server also listen on a UNIX socket so services can connect to it. + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-threads.c: Redo how the fake debug mutexes are done + so it detects deadlocks and also we actually init threads when + debugging. + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket): + save the domain socket name, and unlink it when we disconnect the + server. Means that at least when we exit normally, we won't leave + a bunch of junk in /tmp + + * dbus/dbus-transport-unix.c + (_dbus_transport_new_for_domain_socket): code cleanup (nicer + memory management). (I was making a real change here but then + didn't) + +2003-04-06 Havoc Pennington <hp@pobox.com> + + * bus/bus.c (bus_context_new): fix wrong handling of + server_data_slot_unref() in the error case. + + * dbus/dbus-internals.h (_dbus_assert): change so it passes + "(condition) != 0" to _dbus_real_assert so that + "_dbus_assert (pointer)" doesn't cause a warning + + * bus/main.c (main): accept --print-address option to print out + the message bus address + + * dbus/dbus-sysdeps.c (_dbus_generate_random_ascii): export this + + * dbus/dbus-transport.c (_dbus_transport_open): special error for + "tmpdir" option to unix: address on client side + + * dbus/dbus-server.c (dbus_server_listen): handle "tmpdir" option + to unix: address + + * configure.in (TEST_SOCKET_DIR): locate a temporary directory + we can use to create sockets in the test suite. + + * bus/main.c (signal_handler): on SIGTERM, exit the daemon + cleanly. To be used for testing. + + * dbus/dbus-spawn.c (babysit): use _dbus_set_signal_handler() + + * dbus/dbus-sysdeps.c (_dbus_set_signal_handler): new + + * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): + handle trying to call this when there's no servers active + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * NEWS: update + + * configure.in: 0.8 + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * bus/bus.c (setup_server): fix this so dbus-daemon-1 doesn't + crash on startup. Need to get "try starting the daemon" + in the test suite I guess. ;-) + + * dbus/dbus-server.h, dbus/dbus-server.c: remove the stuff that + tracked the number of open connections; it's better done in + application-specific code as you want it to span all servers etc. + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * bus/Makefile.am (install-data-hook): add missing DESTDIR, + patch from Colin Walters + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * doc/config-file.txt (Elements): fix docs of <auth> to reflect + reality; in fact multiple mechanisms are allowed. + + * dbus/dbus-internals.c (_dbus_real_assert) + (_dbus_real_assert_not_reached): move guts of _dbus_assert() and + _dbus_assert_not_reached() into functions, so that they don't show + up in basic block counts for test coverage, and don't use up as + much disk space. Does mean slower execution speed though, so + assumes --disable-asserts is the normal production case. + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * test/Makefile.am (dist-hook): also dist *.in files + + * NEWS: update + + * configure.in: 0.7 + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c: docs warning + + * dbus/dbus-spawn.c: missing docs + + * dbus/dbus-memory.c (struct ShutdownClosure): missing docs + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * bus/loop.c (bus_loop_iterate): fix the timeout code, using + magic from GLib + + * dbus/dbus-spawn.c (_dbus_babysitter_unref): set sitter_pid + to -1 once we've reaped the babysitter + (_dbus_babysitter_handle_watch): do as much work as we can, not + just one go of it + + * bus/activation.c: add code using DBusBabysitter so that we + handle it when a service fails to start up properly. + (bus_activation_service_created): don't remove the activation + entries as we go, just let them get removed when we free the pending + activation. Unref reply messages after sending them. + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * test/decode-gcov.c (main): print per-directory stats in the report + + * Makefile.am (coverage-report.txt): don't include test/* in gcov stats + +2003-04-05 Havoc Pennington <hp@pobox.com> + + * Makefile.am (coverage-report.txt): add target "coverage-report.txt" + + * test/decode-gcov.c: hack up a little program to suck data + out of gcov files. Yes this is sort of silly. + + * configure.in: define something in config.h and do an + AM_CONDITIONAL when gcov is enabled + +2003-04-04 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-spawn.c, dbus/dbus-spawn.h: Change dbus_spawn to + return a "babysitter" object that is used to monitor the status of + the spawned process and reap it when required. + + * test/test-segfault.c, test/test-exit.c, + test/test-sleep-forever.c: binaries that do various lame things, + used in the test suite. + + * dbus/dbus-sysdeps.c: kill _dbus_errno_to_string() + +2003-04-03 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-spawn.c: Move dbus-spawn into a separate file + in preparation for modifying it, dbus-sysdeps is getting + a bit unmanageable. + +2003-04-03 Havoc Pennington <hp@redhat.com> + + * bus/loop.h, bus/loop.c: make the mainloop an object so we can + have multiple ones + + * bus/*.[hc]: adapt to mainloop change + +2003-04-03 Havoc Pennington <hp@redhat.com> + + * bus/activation.c (load_directory): fix up memleaks + (bus_activation_entry_free): free the entry + + * dbus/dbus-bus.c (dbus_bus_acquire_service): return an error if + we get one from the message bus; fix memleaks. + + * dbus/dbus-message.c (dbus_set_error_from_message): new function + +2003-04-03 Havoc Pennington <hp@pobox.com> + + * bus/config-parser.c (bus_config_parser_unref): free + list of mechanisms, bug discovered by test suite enhancements + (putting system.conf and session.conf into suite) + + * test/Makefile.am, test/test-service.c: add placeholder for a + test service that we'll activate as part of test suite. Doesn't + do anything yet. + + * dbus/dbus-sysdeps.c (_dbus_setenv): support unsetenv by + setting NULL value, and use system malloc not dbus_malloc() + when we have unavoidable memleakage. + + * dbus/dbus-bus.c (dbus_bus_get): fix bug where bus type of 0 + didn't work, and support DBUS_BUS_ACTIVATION. + + * bus/activation.c (child_setup): pass our well-known bus type to + the child + + * bus/config-parser.c: support <type> to specify well-known type + + * doc/dbus-specification.sgml: document the env variables to + locate well-known buses and tqfind service activator + +2003-04-02 Havoc Pennington <hp@redhat.com> + + * test/Makefile.am (all-local): add a rule to copy tests to + builddir, so we can have generated tests. Use this to remove the + silly hack for testing system.conf and session.conf. Will use this + shortly to generate .service files pointing to test binaries. + +2003-04-02 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (set_length): fix a bug - we allocated max of + current alloc and needed new length, not max of the doubled + allocation and needed new length. Also, when building tests, + don't do the double-allocation stuff, just realloc every time. + +2003-04-02 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_file_get_contents): include filenames + in error messages + (_dbus_string_get_dirname): new + (_dbus_sysdeps_test): new + (_dbus_directory_open): include dirnames in error messages + + * bus/config-parser.c: interpret <include> and <includedir> and + <servicedir> relative to config file location if the given + filename is not absolute. + + * dbus/dbus-string.c (_dbus_string_tqfind_byte_backward): new + +2003-04-02 Havoc Pennington <hp@redhat.com> + + * bus/connection.c (bus_transaction_send_error_reply): set sender + service for the error, and unref the reply on success + + * bus/activation.c: convert to use BusTransaction so OOM can be + handled correctly + (bus_activation_service_created): set sender of the message + +2003-04-01 Havoc Pennington <hp@redhat.com> + + * bus/config-parser.c, bus/bus.c: implement <servicedir> and + <includedir> (at least mostly) + + * dbus/dbus-sysdeps.c (_dbus_change_identity): set the group ID + first, then the user ID + +2003-04-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-server.c (dbus_server_set_auth_mechanisms): new + function + + * dbus/dbus-auth.c (_dbus_auth_set_mechanisms): new + + * dbus/dbus-internals.c (_dbus_dup_string_array): new function + + * dbus/dbus-sysdeps.c (_dbus_listen_unix_socket): chmod the + socket 0777, and unlink any existing socket. + + * bus/bus.c (bus_context_new): change our UID/GID and fork if + the configuration file so specifies; set up auth mechanism + restrictions + + * bus/config-parser.c (bus_config_parser_content): add support + for <fork> option and fill in code for <auth> + + * bus/system.conf.in: add <fork/> to default configuration, + and limit auth mechanisms to EXTERNAL + + * doc/config-file.txt (Elements): add <fork> + + * dbus/dbus-sysdeps.c (_dbus_become_daemon): new function + (_dbus_change_identity): new function + +2003-03-31 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket) + (_dbus_listen_unix_socket): fix off-by-one error in null + termination spotted by Nalin + +2003-03-31 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): allow setting + DBUS_TEST_HOMEDIR when tests are enabled, so we can test without + having a real home directory available. + +2003-03-31 Havoc Pennington <hp@redhat.com> + + * bus/Makefile.am (install-data-hook): create /var/run/dbus + + * bus/messagebus.in: add init script for Red Hat /etc/init.d + + * configure.in: add support for specifying a style of init script + to install + +2003-03-31 Havoc Pennington <hp@redhat.com> + + Fix some annoying DBusString API and fix all affected code. + + * dbus/dbus-string.c (_dbus_string_init): get rid of annoying + max_length argument + (_dbus_string_get_data): change to return string instead of using + an out param + (_dbus_string_get_const_data): ditto + (_dbus_string_get_data_len): ditto + (_dbus_string_get_const_data_len): ditto + +2003-03-31 Havoc Pennington <hp@redhat.com> + + * bus/main.c (main): fix up the command line arguments to be nicer + +2003-03-31 Havoc Pennington <hp@redhat.com> + + * dbus/Makefile.am (INCLUDES): use EXPANDED_LOCALSTATEDIR to + define DBUS_SYSTEM_BUS_PATH as we want to compile in the same + final location that lands in the config file + + * bus/config-loader-expat.c (bus_config_load): fix type of + XML_Parser variable + + * doc/TODO: remove TODO item for dbus_bus_get() + + * dbus/dbus-bus.c (bus_data_free): add missing lock/unlock + +2003-03-31 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket) + (_dbus_transport_new_for_tcp_socket): these didn't need the "server" + argument since they are always client side + + * dbus/dbus-server.c (dbus_server_get_address): new function + + * bus/main.c (main): take the configuration file as an argument. + + * test/data/valid-config-files/debug-allow-all.conf: new file to + use with dispatch.c tests for example + + * bus/test-main.c (main): require test data dir + + * bus/bus.c (bus_context_new): change this to take a + configuration file name as argument + + * doc/config-file.txt (Elements): add <servicedir> + + * bus/system.conf, bus/session.conf: new files + + * dbus/dbus-bus.c (dbus_bus_get): look for system bus on + well-known socket if none set + + * configure.in: create system.conf and session.conf + +2003-03-30 Havoc Pennington <hp@pobox.com> + + * bus/config-parser.c: hacking + + * dbus/dbus-memory.c: don't use DBusList for the list of stuff + to shut down, since it could cause weirdness with the DBusList + lock + + * dbus/dbus-list.c (_dbus_list_test): add tests for the + link-oriented stack routines + (alloc_link): free the mempool if the first alloc from it fails + + * dbus/dbus-mempool.c (struct DBusMemBlock): fix tqalignment issue + + * dbus/dbus-string.c (UNICODE_VALID): sync new version of this + from GLib + (_dbus_string_skip_white): new + + * doc/config-file.txt (Elements): add <includedir> + +2003-03-28 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_copy_data_len) + (_dbus_string_copy_data): new functions + +2003-03-28 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-bus.c: (bus_data_free), (dbus_bus_get): + * dbus/dbus-bus.h: + Add dbus_bus_get. + + * dbus/dbus-memory.c: + Fix a doc comment. + +2003-03-28 Havoc Pennington <hp@pobox.com> + + * bus/test.c (bus_test_flush_bus): remove the sleep from here, + I think it may have just been superstition. Not sure. + + * dbus/dbus-string.c (_dbus_string_base64_decode): catch some OOM + failures that were not being handled. + + * dbus/dbus-auth.c (process_auth): fix a memleak in OOM handling + + * dbus/dbus-memory.c: add ability to set number of mallocs in a + row that will fail on out-of-memory. + + * dbus/dbus-internals.c (_dbus_test_oom_handling): convenience + function for testing out-of-memory handling. + + * bus/config-loader-expat.c (memsuite): don't wrap the dbus + allocation functions, they do map exactly to the expat ones. + +2003-03-27 Havoc Pennington <hp@redhat.com> + + * bus/config-loader-libxml.c (bus_config_load): add another error + check + +2003-03-26 Anders Carlsson <andersca@codefactory.se> + + * doc/TODO: + Add note about automatic service activation. + + * doc/dbus-specification.sgml: + Rename the specification and clarify a few things. + +2003-03-26 Anders Carlsson <andersca@codefactory.se> + + * Doxyfile.in: + * dbus/dbus-address.c: + * dbus/dbus-dict.c: + * dbus/dbus-marshal.c: + * dbus/dbus-server-debug-pipe.c: + * dbus/dbus-transport-unix.c: + Fix documentation warnings. + +2003-03-26 Havoc Pennington <hp@pobox.com> + + * bus/test-main.c, dbus/dbus-test.c (main): check memleaks + after every test so it's quick and easy to see which leaked, and + so we test multiple dbus_shutdown() calls + + * configure.in: change configure.in XML stuff to also support + expat + + * config-loader-libxml.c: some hacking + + * config-loader-expat.c: some hacking + + * config-parser.c: some hacking, plus tests + +2003-03-25 Havoc Pennington <hp@redhat.com> + + * throughout - add more _DBUS_ASSERT_ERROR_IS_CLEAR + + * configure.in: add --with-xml option to specify XML library, + right now only libxml is supported. + + * bus/config-loader-libxml.c, config-parser.c: sync some minor + nonworking code between home and work, still just stubs + +2003-03-24 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-sysdeps.c (_dbus_set_fd_nonblocking): move to this + file + + * dbus/dbus-errors.c (dbus_set_error, dbus_set_error_const): allow + NULL argument for "message" if the error is a well-known one, + fill in a generic message in this case. + + * dbus/dbus-errors.h (DBusResultCode): Kill DBusResultCode in + favor of DBusError + + * bus/test.c (bus_test_flush_bus): add + + * bus/policy.c (bus_policy_test): test code stub + +2003-03-24 Havoc Pennington <hp@pobox.com> + + * bus/connection.c (bus_connections_setup_connection): set up + the "can this user connect" function, but it always returns + TRUE until we have a config file parser so we can have a config + file that allows connections. + +2003-03-23 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-threads.c (dbus_mutex_new, dbus_condvar_new): with + DBUS_BUILD_TESTS, actually alloc/free a block of memory for + the mutex, so we can check for proper memory management + and OOM handling. + + * dbus/dbus-dataslot.c: remove the mutex from + DBusDataSlotAllocator and lock it manually when using it, + to simplify fitting it into the global Q_SLOTS framework. + + * dbus/dbus-threads.c (init_static_locks): rework how we're + handling global locks so they are easily shut down. + + * bus/policy.c (bus_policy_append_rule): fix + + * bus/test-main.c (main): check for memleaks + + * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): make + test suite check for memleaks + + * dbus/dbus-memory.c: add support in test mode for tracking + number of outstanding blocks + +2003-03-23 Havoc Pennington <hp@pobox.com> + + * bus/policy.c, bus/bus.c, bus/connection.c: implement allow/deny + policies code + + * dbus/dbus-hash.h: add ULONG hash keys + + * dbus/dbus-sysdeps.c (_dbus_get_groups): new + (_dbus_get_group_id): new function + +2003-03-20 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-connection.c (dbus_connection_set_unix_user_function): + new function + (dbus_connection_get_unix_user): new function + +2003-03-20 Havoc Pennington <hp@pobox.com> + + * bus/connection.c (bus_connection_send_oom_error): assert that + message has a sender + (connection_execute_transaction): ditto + (bus_connection_preallocate_oom_error): fix to set the sender, and + set recipient to the destination service, not the bus driver + + * bus/policy.c: hacking + + * dbus/dbus-message.c (dbus_message_service_is): new function + (dbus_message_sender_is): new + +2003-03-19 Havoc Pennington <hp@redhat.com> + + * bus/policy.c: start sketching code for policy restrictions on + what connections can do. + +2003-03-18 Havoc Pennington <hp@redhat.com> + + * doc/TODO: some notes on high-level todo items. Little nitpick + stuff is all in @todo, so no need to add it here. + + * doc/config-file.txt: some notes on how config file might look + +2003-03-18 Anders Carlsson <andersca@codefactory.se> + + * configure.in: 0.6 + + * NEWS: Update. + +2003-03-17 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-internals.h: add gcc attributes so that + our printf-style functions warn on bad arguments to + format + + * dbus/dbus-sysdeps.c (_dbus_connect_tcp_socket): fix printf + format bug + + * dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix + printf format bug + +2003-03-17 Havoc Pennington <hp@redhat.com> + + * bus/test-main.c (main): make it print something as it runs + so make check doesn't look stuck + + * doc/negotiation.txt, doc/dbus-sasl-profile.txt: remove + from CVS, now obsolete + +2003-03-17 Anders Carlsson <andersca@codefactory.se> + + * bus/dispatch.c: (bus_dispatch): + Refetch the service name since it may have been reallocated + when dbus_message_set_sender was called. + + * dbus/dbus-sysdeps.c: (_dbus_accept): + Add address and address length variables and use them to stop + valgrind from complaining. + +2003-03-17 Havoc Pennington <hp@pobox.com> + + All tests pass, no memleaks, no valgrind complaints. + + * bus/test.c: refcount handler_slot + + * bus/connection.c (bus_connections_new): refcount + connection_data_slot + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): delete unused + bytes so that auth scripts pass. + + * bus/dispatch.c: init message_handler_slot so it gets allocated + properly + + * bus/dispatch.c (message_handler_slot_ref): fix memleak + + * dbus/dbus-server-debug-pipe.c (_dbus_server_debug_pipe_new): + dealloc server_pipe_hash when no longer used for benefit of + leak checking + + * dbus/dbus-auth.c (process_command): memleak fix + + * bus/dispatch.c (check_hello_message): memleak fix + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-bus.c (ensure_bus_data): fix double-unref of the data slot + +2003-03-17 Anders Carlsson <andersca@codefactory.se> + + * bus/activation.c (bus_activation_activate_service): Append + the pending activation entry to the list of pending activations. + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (bus_dispatch_test): remove double-unrefs of + connections + + * dbus/dbus-address.c (create_entry): fix OOM handling when + failing to alloc entry->method + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-watch.c (_dbus_watch_new): handle failure to malloc + the watch + + * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): + add some missing dbus_set_result + + * bus/dispatch.c (bus_dispatch_add_connection): handle failure to + alloc the DBusMessageHandler + + * dbus/dbus-transport.c (_dbus_transport_disconnect): don't ref + the transport here, since we call this from the finalizer; it + resulted in a double-finalize. + + * dbus/dbus-transport.c (_dbus_transport_disconnect): fix a bug + where we tried to use transport->connection that was NULL, + happened when transport was disconnected early on due to OOM + + * bus/*.c: adapt to handle OOM for watches/timeouts + + * dbus/dbus-transport-unix.c: port to handle OOM during + watch handling + + * dbus/dbus-auth.c (_dbus_auth_get_unused_bytes): return a + reference to unused bytes instead of a copy + + * dbus/dbus-server.c (dbus_server_handle_watch): return FALSE for + out of memory + + * dbus/dbus-connection.c (dbus_connection_handle_watch): return + FALSE on OOM + + * dbus/dbus-timeout.c (dbus_timeout_handle): return FALSE for out + of memory + +2003-03-16 Anders Carlsson <andersca@codefactory.se> + + * doc/dbus-specification.sgml: + Document reply message for ActivateService. + +2003-03-16 Anders Carlsson <andersca@codefactory.se> + + * bus/activation.c: (bus_pending_activation_entry_free), + (bus_pending_activation_free), (bus_activation_new), + (bus_activation_unref), (bus_activation_service_created), + (bus_activation_activate_service): + * bus/activation.h: + * bus/bus.c: (bus_context_new): + * bus/desktop-file.c: (new_section): + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_handle_activate_service): + * bus/services.c: (bus_registry_new), (bus_registry_ensure): + * bus/services.h: + * dbus/dbus-connection.c: + (dbus_connection_send_with_reply_and_block): + * dbus/dbus-message.c: (dbus_message_append_args_valist): + * dbus/dbus-protocol.h: + Make activation work better. Now pending activations will be queued + and the daemon won't try to activate services that are already registered. + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-bus.c (ensure_bus_data): handle failure to set + connection data + + * dbus/dbus-memory.c (_dbus_initialize_malloc_debug): support + DBUS_MALLOC_BACKTRACES to print trace when failing an alloc + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_validate_utf8): oops, unbreak + this. always run the test suite before commit... + + * bus/*: adapt to DBusConnection API changes + + * glib/dbus-gmain.c: adapt to DBusConnection API changes, + requires renaming stuff to avoid dbus_connection_dispatch name + conflict. + + * dbus/dbus-transport.c (_dbus_transport_queue_messages): new + function + + * dbus/dbus-message.c (_dbus_message_loader_queue_messages): + separate from _dbus_message_loader_return_buffer() + + * dbus/dbus-connection.c (dbus_connection_get_n_messages): remove + this, because it's now always broken to use; the number of + messages in queue vs. the number still buffered by the message + loader is undefined/meaningless. Should use + dbus_connection_get_dispatch_state(). + (dbus_connection_dispatch): rename from + dbus_connection_dispatch_message + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_validate_utf8): copy in a real + implementation + +2003-03-16 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection.c: + (dbus_connection_send_with_reply_and_block): + Decrease connection->n_incoming when removing an entry + from the list. + * dbus/dbus-dict.c: (dbus_dict_entry_free), + (dbus_dict_set_boolean_array), (dbus_dict_set_int32_array), + (dbus_dict_set_uint32_array), (dbus_dict_set_double_array), + (dbus_dict_set_byte_array), (dbus_dict_set_string_array), + (dbus_dict_get_boolean_array), (dbus_dict_get_double_array), + (dbus_dict_get_byte_array): + Handle NULL arrays and strings. Also add support for byte arrays. + + * dbus/dbus-marshal.c: (_dbus_marshal_byte_array), + (_dbus_marshal_dict), (_dbus_demarshal_byte_array), + (_dbus_demarshal_int32_array), (_dbus_demarshal_uint32_array), + (_dbus_demarshal_double_array), (_dbus_demarshal_string_array), + (_dbus_demarshal_dict), (demarshal_and_validate_len), + (_dbus_marshal_validate_arg), (_dbus_marshal_test): + * dbus/dbus-marshal.h: + Add support for marshalling and demarshalling empty arrays and strings. + + * dbus/dbus-message.c: (dbus_message_append_args_valist), + (dbus_message_append_string_array), + (dbus_message_iter_get_boolean), + (dbus_message_iter_get_boolean_array), + (dbus_message_iter_get_int32_array), + (dbus_message_iter_get_uint32_array), + (dbus_message_iter_get_double_array), + (dbus_message_iter_get_byte_array), + (dbus_message_iter_get_string_array), (dbus_message_iter_get_dict), + (check_message_handling): + Add support for getting empty arrays and dicts. + + * dbus/dbus-string.c: (_dbus_string_validate_utf8): + Don't do any validation at all for now, that's better than just checking + for ASCII. + + * test/data/valid-messages/emptiness.message: + New test message with lots of empty arrays. + +2003-03-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c + (_dbus_connection_queue_received_message_link): new function that + can't fail due to OOM + + * dbus/dbus-message.c (_dbus_message_loader_pop_message_link): + new function pops a message together with a list link + containing it. + + * dbus/dbus-transport-unix.c (queue_messages): use new link-based + message queuing functions to avoid needing to alloc memory + +2003-03-16 Havoc Pennington <hp@pobox.com> + + Oops - test code was only testing failure of around 30 of the + mallocs in the test path, but it turns out there are 500+ + mallocs. I believe this was due to misguided linking setup such + that there was one copy of dbus_malloc etc. in the daemon and one + in the shared lib, and only daemon mallocs were tested. In any + case, the test case now tests all 500+ mallocs, and doesn't pass + yet, though there are lots of fixes in this patch. + + * dbus/dbus-connection.c (dbus_connection_dispatch_message): fix + this so that it doesn't need to allocate memory, since it + has no way of indicating failure due to OOM (and would be + annoying if it did). + + * dbus/dbus-list.c (_dbus_list_pop_first_link): new function + + * bus/Makefile.am: rearrange to create two self-contained + libraries, to avoid having libraries with overlapping symbols. + that was resulting in weirdness, e.g. I'm pretty sure there + were two copies of global static variables. + + * dbus/dbus-internals.c: move the malloc debug stuff to + dbus-memory.c + + * dbus/dbus-list.c (free_link): free list mempool if it becomes + empty. + + * dbus/dbus-memory.c (_dbus_disable_mem_pools): new function + + * dbus/dbus-address.c (dbus_parse_address): free list nodes + on failure. + + * bus/dispatch.c (bus_dispatch_add_connection): free + message_handler_slot when no longer using it, so + memory leak checkers are happy for the test suite. + + * dbus/dbus-server-debug-pipe.c (debug_finalize): free server name + + * bus/bus.c (new_connection_callback): disconnect in here if + bus_connections_setup_connection fails. + + * bus/connection.c (bus_connections_unref): fix to free the + connections + (bus_connections_setup_connection): if this fails, don't + disconnect the connection, just be sure there are no side + effects. + + * dbus/dbus-string.c (undo_tqalignment): unbreak this + + * dbus/dbus-auth.c (_dbus_auth_unref): free some stuff we were + leaking + (_dbus_auth_new): fix the order in which we free strings + on OOM failure + + * bus/connection.c (bus_connection_disconnected): fix to + not send ServiceDeleted multiple times in case of memory + allocation failure + + * dbus/dbus-bus.c (dbus_bus_get_base_service): new function to + get the base service name + (dbus_bus_register_client): don't return base service name, + instead store it on the DBusConnection and have an accessor + function for it. + (dbus_bus_register_client): rename dbus_bus_register() + + * bus/dispatch.c (check_hello_message): verify that other + connections on the bus also got the correct results, not + just the one sending hello + +2003-03-15 Havoc Pennington <hp@pobox.com> + + Make it pass the Hello handling test including all OOM codepaths. + Now to do other messages... + + * bus/services.c (bus_service_remove_owner): fix crash when + removing owner from an empty list of owners + (bus_registry_ensure): don't leave service in the list of + a connection's owned services if we fail to put the service + in the hash table. + + * bus/connection.c (bus_connection_preallocate_oom_error): set + error flag on the OOM error. + + * dbus/dbus-connection.c (_dbus_connection_new_for_transport): + handle _dbus_transport_set_connection failure + + * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd): modify + to create watches up front and simply enable/disable them as + needed. + (unix_connection_set): this can now fail on OOM + + * dbus/dbus-timeout.c, dbus/dbus-watch.c: add concept + of enabling/disabling a watch or timeout. + + * bus/loop.c (bus_loop_iterate): don't touch disabled + watches/timeouts + + * glib/dbus-gmain.c: adapt to enable/disable watches and timeouts + +2003-03-15 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (bus_dispatch_test): OK, now finally actually + write useful test code, after all that futzing around ;-) + + Test does not yet pass because we can't handle OOM in + _dbus_transport_messages_pending (basically, + dbus_connection_preallocate_send() does not prealloc the write + watch). To fix this, I think we need to add new stuff to + set_watch_functions, namely a SetEnabled function so we can alloc + the watch earlier, then enable it later. + + * dbus/Makefile.am (libdbus_convenience_la_SOURCES): move + dbus-memory.c to the convenience lib + + * bus/test.c: rename some static functions to keep them clearly + distinct from stuff in connection.c. Handle client disconnection. + +2003-03-14 Havoc Pennington <hp@pobox.com> + + * bus/dispatch.c (bus_dispatch_test): do test using debug-pipe + transport, tests more of the real codepath. Set up clients + with bus_setup_debug_client. + + * bus/test.c (bus_setup_debug_client): function to set up debug + "clients" on the main loop + + * dbus/dbus-transport.c (_dbus_transport_open): add debug-pipe + support + + * dbus/dbus-server.c (dbus_server_listen): add debug-pipe + server type + + * dbus/dbus-server-debug.c: support a debug server based on pipes + + * dbus/dbus-sysdeps.c (_dbus_full_duplex_pipe): new function + (_dbus_close): new function + + * configure.in: check for socketpair + +2003-03-14 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-memory.c: add a "detect buffer overwrites on free" + cheesy hack + + * dbus/dbus-transport-debug.c: rework this a good bit to be + less complicated. hopefully still works. + + * dbus/dbus-server-debug.c (handle_new_client): remove timeout + manually + + * glib/dbus-gmain.c (timeout_handler): don't remove timeout + after running it + + * dbus/dbus-message.c (dbus_message_copy): rename from + dbus_message_new_from_message, fix it up to copy + all the message fields, add test case + + * bus/dispatch.c (bus_dispatch_test): add some more test code, + not quite passing yet + +2003-03-14 Havoc Pennington <hp@pobox.com> + + * bus/loop.c (bus_loop_iterate): add this so we can "run loop + until no work remains" in test code. (the large diff here + is just code movement, no actual changes) + + * dbus/dbus-server-debug.c (DEFAULT_INTERVAL): change interval to + 1, no point waiting around for test code. + (_dbus_server_debug_accept_transport): unref the timeout + after adding it (right?) + + * dbus/dbus-transport-debug.c (DEFAULT_INTERVAL): ditto + +2003-03-13 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-timeout.c (_dbus_timeout_list_set_functions): handle + out of memory + + * dbus/dbus-watch.c (_dbus_watch_list_set_functions): handle out + of memory + + * dbus/dbus-connection.h: Make AddWatchFunction and + AddTimeoutFunction return a bool so they can fail on out-of-memory + + * bus/bus.c (bus_context_new): set up timeout handlers + + * bus/connection.c (bus_connections_setup_connection): set up + timeout handlers + + * glib/dbus-gmain.c: adapt to the fact that set_functions stuff + can fail + + * bus/bus.c (bus_context_new): adapt to changes + + * bus/connection.c: adapt to changes + + * test/watch.c: adapt to DBusWatch changes + + * bus/dispatch.c (bus_dispatch_test): started adding this but + didn't finish + +2003-03-14 Anders Carlsson <andersca@codefactory.se> + + * bus/dispatch.c (send_service_nonexistent_error): Fix typo. + +2003-03-13 Havoc Pennington <hp@pobox.com> + + * bus/test.c, bus/test.h, bus/Makefile.am, bus/test-main.c: + set up a test framework as for the library + +2003-03-12 Havoc Pennington <hp@pobox.com> + + Throughout: purge global variables, introduce BusActivation, + BusConnections, BusRegistry, etc. objects instead. + + * bus/bus.h, bus/bus.c: introduce BusContext as a global + message bus object + + * test/Makefile.am (TEST_BINARIES): disable bus-test for now, + going to redo this a bit differently I think + +2003-03-12 Havoc Pennington <hp@redhat.com> + + Mega-patch that gets the message bus daemon initially handling + out-of-memory. Work still needed. Also lots of random + moving stuff to DBusError instead of ResultCode. + + * dbus/dbus-list.c (_dbus_list_length_is_one): new function + + * dbus/dbus-connection.c + (dbus_connection_send_with_reply_and_block): use DBusError + + * dbus/dbus-bus.c: adapt to API changes, make it use DBusError not + DBusResultCode + + * dbus/dbus-connection.c (dbus_connection_send): drop the result + code here, as the only failure possible is OOM. + + * bus/connection.c (bus_connection_disconnect): + rename bus_connection_disconnected as it's a notification only + + * bus/driver.c (bus_driver_handle_acquire_service): don't free + "name" on get_args failure, should be done by get_args; + don't disconnect client for bad args, just return an error. + (bus_driver_handle_service_exists): ditto + + * bus/services.c (bus_services_list): NULL-terminate returned array + + * bus/driver.c (bus_driver_send_service_lost) + (bus_driver_send_service_acquired): send messages from driver to a + specific client to the client's unique name, not to the broadcast + service. + + * dbus/dbus-message.c (decode_header_data): reject messages that + contain no name field + (_dbus_message_get_client_serial): rename to + dbus_message_get_serial and make public + (_dbus_message_set_serial): rename from set_client_serial + (_dbus_message_set_reply_serial): make public + (_dbus_message_get_reply_serial): make public + + * bus/connection.c (bus_connection_foreach): allow stopping + iteration by returning FALSE from foreach function. + + * dbus/dbus-connection.c (dbus_connection_send_preallocated) + (dbus_connection_free_preallocated_send) + (dbus_connection_preallocate_send): new API for sending a message + without possibility of malloc failure. + (dbus_connection_send_message): rename to just + dbus_connection_send (and same for whole function family) + + * dbus/dbus-errors.c (dbus_error_free): make this reinit the error + + * dbus/dbus-sysdeps.c (_dbus_exit): new function + + * bus/activation.c: handle/return errors + + * dbus/dbus-errors.h: add more DBUS_ERROR #define + + * dbus/dbus-sysdeps.c (_dbus_directory_open) (_dbus_file_get_contents) + (_dbus_directory_get_next_file): use DBusError instead of DBusResultCode + (_dbus_result_from_errno): move to this file + +2003-03-10 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: + (_dbus_marshal_set_string): + Take a length argument so we can marshal the correct string + length. + + (_dbus_marshal_dict), (_dbus_demarshal_dict), + (_dbus_marshal_get_arg_end_pos), (_dbus_marshal_validate_arg), + (_dbus_marshal_test): + * dbus/dbus-marshal.h: + Add support for marshalling and demarshalling dicts. + + * dbus/dbus-message-builder.c: (_dbus_message_data_load): + Add support for TYPE DICT. + + * dbus/dbus-message.c: (set_string_field): + Adjust header padding. + + (dbus_message_append_args_valist), (dbus_message_append_dict), + (dbus_message_get_args_valist), (dbus_message_iter_get_arg_type), + (dbus_message_iter_get_dict), (_dbus_message_loader_return_buffer), + (check_message_handling), (check_have_valid_message): + * dbus/dbus-message.h: + Add functions for setting and getting dicts. + + * dbus/dbus-protocol.h: + Add DBUS_TYPE_DICT. + + * dbus/dbus.h: + Add dbus-dict.h + + * doc/dbus-specification.sgml: + Add information about how dicts are marshalled. + + * test/data/invalid-messages/dict-with-nil-value.message: + * test/data/invalid-messages/too-short-dict.message: + * test/data/valid-messages/dict-simple.message: + * test/data/valid-messages/dict.message: + Add sample messages containing dicts. + +2003-03-08 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-dict.h: Add DBUS_END_DECLS. + +2003-03-07 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: + * dbus/dbus-dict.c: (dbus_dict_entry_free), (dbus_dict_new), + (dbus_dict_get_keys), (insert_entry), (dbus_dict_set_boolean), + (dbus_dict_set_int32), (dbus_dict_set_uint32), + (dbus_dict_set_double), (dbus_dict_set_string), + (dbus_dict_set_boolean_array), (dbus_dict_set_int32_array), + (dbus_dict_set_uint32_array), (dbus_dict_set_double_array), + (dbus_dict_set_string_array), (_dbus_dict_test): + * dbus/dbus-dict.h: + Fix according to comments from Havoc. + +2003-03-06 Michael Meeks <michael@server.home> + + * configure.in: if we don't have kde-config, disable have_qt. + +2003-03-07 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: + Add dbus-dict.[ch] + + * dbus/dbus-dict.c: (dbus_dict_entry_free), (dbus_dict_new), + (dbus_dict_ref), (dbus_dict_unref), (dbus_dict_tqcontains), + (dbus_dict_remove), (dbus_dict_get_value_type), + (dbus_dict_get_keys), (dbus_dict_put_boolean), + (dbus_dict_put_int32), (dbus_dict_put_uint32), + (dbus_dict_put_double), (dbus_dict_put_string), + (dbus_dict_put_boolean_array), (dbus_dict_put_int32_array), + (dbus_dict_put_uint32_array), (dbus_dict_put_double_array), + (dbus_dict_put_string_array), (dbus_dict_get_boolean), + (dbus_dict_get_int32), (dbus_dict_get_uint32), + (dbus_dict_get_double), (dbus_dict_get_string), + (dbus_dict_get_boolean_array), (dbus_dict_get_int32_array), + (dbus_dict_get_uint32_array), (dbus_dict_get_double_array), + (dbus_dict_get_string_array), (_dbus_dict_test): + * dbus/dbus-dict.h: + Add DBusDict implementation + + * dbus/dbus-test.c: (dbus_internal_do_not_use_run_tests): + * dbus/dbus-test.h: + Add _dbus_dict_test + +2003-03-04 Havoc Pennington <hp@pobox.com> + + * test/data/auth/*: adapt to changes + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): add + USERID_BASE64 and change USERNAME_BASE64 to put in username not + userid + + * dbus/dbus-keyring.c (_dbus_keyring_validate_context): prevent + more stuff from being in a context name, to make the protocol + simpler to deal with + + * dbus/dbus-errors.c (dbus_error_has_name): new function + (dbus_error_is_set): new function + + * dbus/dbus-auth.c: tqreplace DBUS_STUPID_TEST_MECH auth + with DBUS_COOKIE_SHA1, implement DBUS_COOKIE_SHA1 + + * dbus/dbus-connection.c (dbus_connection_flush): also read + messages during a flush operation + + * dbus/Makefile.am: remove dbus-md5 since it isn't currently used. + +2003-03-05 Anders Carlsson <andersca@codefactory.se> + + * configure.in: Check for gethostbyname on Solaris. + + * dbus/dbus-transport.c: (_dbus_transport_open): + Remove duplicate "tcp" entry. + + * doc/dbus-specification.sgml: + Clarify some things. + +2003-03-05 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-auth.c: (send_rejected), (process_test_subdir): + * dbus/dbus-keyring.c: (_dbus_keyring_new_homedir), + (_dbus_keyring_test): + * dbus/dbus-md5.c: (_dbus_md5_compute): + * dbus/dbus-sha.c: (_dbus_sha_compute): + Plug memory leaks. + +2003-03-05 Anders Carlsson <andersca@codefactory.se> + + * README: Add some things. + +2003-03-04 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c (dbus_message_append_args_valist): Add a break; + after case DBUS_TYPE_BOOELAN. + +2003-03-02 Havoc Pennington <hp@pobox.com> + + * test/break-loader.c (randomly_set_extreme_ints): add test that + sets really huge and small integers + + * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): add check + that length of boolean array fits in the string, and that + string has room for boolean value in single-bool case. + + * dbus/dbus-message-builder.c (_dbus_message_data_load): add + optional value to "ALIGN" command which is what to fill the + tqalignment with. + + * test/data/valid-messages/no-padding.message: add regression + test for the message padding problem + +2003-03-02 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (decode_header_data): fix to always init + message_padding, from Benjamin Dauvergne + +2003-03-02 Havoc Pennington <hp@pobox.com> + + * configure.in: 0.5 + + * NEWS: Update. + +2003-03-01 Joe Shaw <joe@assbarn.com> + + * configure.in: Check for "struct cmsgcred" and try to access its + members for BSD-like unices. + + * dbus/dbus-sysdeps.c (read_credentials_byte): Fold this back into + _dbus_read_credentials_unix_socket(). + (_dbus_read_credentials_unix_socket): Use recvmsg() instead of + read() for reading the credential byte off the unix socket. Use + struct cmsgcred on systems that support it. + +2003-02-27 Alexander Larsson <alexl@redhat.com> + + * glib/Makefile.am: + * configure.in: + Make gthreads-2.0 dependency optional. Don't build thread test if + its not found. + +2003-02-27 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c + (dbus_connection_send_message_with_reply_and_block): fix doh! + doh! doh! bug that resulted in never removing a reply from the + queue, no wonder we called get_reply_serial so much ;-) + + * dbus/dbus-message.c (struct DBusMessage): cache reply serial + and client serial instead of demarshaling them every time + +2003-02-27 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-marshal.c (_dbus_demarshal_int32): rewrite to be much + more inlined, using dbus-string-private.h, speeds things up + substantially + + * dbus/dbus-string.c (_dbus_string_free): apply align offset + when freeing the string + (_dbus_string_steal_data): fix for align offset + (undo_tqalignment): new function + +2003-02-26 Havoc Pennington <hp@redhat.com> + + All kinds of audit fixes from Owen, plus initial attempt to + handle unaligned memory returned from malloc. + + * dbus/dbus-string.c (_dbus_string_init): clamp max length to + leave room for align_offset and nul byte + (fixup_tqalignment): function to track an align_offset and + ensure real->str is aligned + (DBUS_GENERIC_STRING_PREAMBLE): len must be less than allocated, + to allow a nul byte plus align offset + (_dbus_string_lock): fix overflow issue + (_dbus_string_init_const_len): add assertions on sanity of len, + assign allocated to be ALLOCATION_PADDING larger than len + (set_length): fixup the overflow handling + (_dbus_string_get_data_len): fix overflow in assertion + (open_gap): detect overflow in size of gap to be opened + (_dbus_string_lengthen): add overflow check + (_dbus_string_align_length): fix overflow with _DBUS_ALIGN_VALUE + (_dbus_string_append): add overflow check + (_dbus_string_append_unichar): overflow + (_dbus_string_delete): fix overflow in assertion + (_dbus_string_copy_len): overflow in assertion + (_dbus_string_tqreplace_len): overflows in assertions + (_dbus_string_tqfind): change to implement in terms of + _dbus_string_tqfind_to + (_dbus_string_tqfind_to): assorted fixage + (_dbus_string_equal_c_str): assert c_str != NULL, + fix logic so the function works + (_dbus_string_ends_with_c_str): fix overflow thingy + (_dbus_string_base64_encode): overflow fix + (_dbus_string_validate_ascii): overflow + (_dbus_string_validate_nul): overflow + +2003-02-26 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-marshal.c (_dbus_marshal_test): fix to work with DISABLE_ASSERTS + +2003-02-26 Alexander Larsson <alexl@redhat.com> + + * configure.in: + Set DBUS_GLIB_THREADS_LIBS for apps using gthread-2.0 + + * dbus/dbus-connection.c: + * dbus/dbus-connection.h: + Fix _dbus_connection_acquire_io_path and _dbus_connection_acquire_dispatch. + Add dbus_connection_set_wakeup_main_function and use it when queueing + incoming and outgoing messages. + + + * dbus/dbus-dataslot.c: + Threadsafe usage of DBusDataSlotAllocator + + * dbus/dbus-message.c: (dbus_message_get_args_iter): + dbus_new can fail. + + * dbus/dbus-server-unix.c: + Add todo comment + + * glib/dbus-gmain.c: + Implement the new wakeup functions for glib. + + * glib/Makefile.am: + * glib/test-thread-client.c: + * glib/test-thread-server.c: + * glib/test-thread.h: + Initial cut at some thread test code. Not really done yet. + +2003-02-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c + (dbus_connection_send_message_with_reply_and_block): fix crash + where we ref'd the outgoing message instead of the returned reply + + * dbus/dbus-transport-unix.c (do_authentication): check read watch + at the end of this function, so if we didn't need to read for + authentication, we reinstall it for receiving messages + + * dbus/dbus-message.c (dbus_message_new_reply): allow replies to + a NULL sender for peer-to-peer case + + * dbus/dbus-transport-unix.c (check_read_watch): handle + !authenticated case correctly + + * glib/dbus-gmain.c: add support for DBusServer + + * dbus/dbus-server.c: add data slot support + + * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): check + return values and handle errors + + * dbus/dbus-dataslot.c: factor out the data slot stuff from + DBusConnection + + * Doxyfile.in (INPUT): add glib subdir + + * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): rename + setup_with_g_main instead of hookup_with_g_main; write docs + +2003-02-24 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_validate_arg): + * dbus/dbus-message-builder.c: (_dbus_message_data_load): + * dbus/dbus-message.c: (dbus_message_append_boolean), + (dbus_message_append_boolean_array), + (dbus_message_get_args_valist), (_dbus_message_test): + * dbus/dbus-message.h: + * doc/dbus-specification.sgml: + Various fixes as pointed out by Havoc. + + * test/data/invalid-messages/bad-boolean-array.message: + * test/data/invalid-messages/bad-boolean.message: + Add invalid boolean value test cases. + +2003-02-24 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-internals.c: (_dbus_type_to_string): + * dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos), + (_dbus_marshal_validate_arg): + * dbus/dbus-message-builder.c: (_dbus_message_data_load): + * dbus/dbus-message.c: (dbus_message_append_args_valist), + (dbus_message_append_boolean), (dbus_message_append_boolean_array), + (dbus_message_get_args_valist), (dbus_message_iter_get_boolean), + (dbus_message_iter_get_int32), (dbus_message_iter_get_uint32), + (dbus_message_iter_get_double), + (dbus_message_iter_get_boolean_array), (message_iter_test): + * dbus/dbus-message.h: + * dbus/dbus-protocol.h: + * doc/dbus-specification.sgml: + * test/data/valid-messages/lots-of-arguments.message: + Add support for boolean and boolean array types. + +2003-02-23 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-keyring.c: finish most of this implementation and + simple unit test + + * dbus/dbus-errors.c (dbus_set_error_const, dbus_set_error): make + these barf if the error isn't cleared to NULL + + * dbus/dbus-sysdeps.c (_dbus_delete_file): set error on failure + (_dbus_create_directory): new function + + * dbus/dbus-errors.c (dbus_set_error): fix warning + + * dbus/dbus-string.c (_dbus_string_hex_encode): new function + (_dbus_string_hex_decode): new function + (test_hex_roundtrip): test code + + * dbus/dbus-sha.c (_dbus_sha_compute): use dbus_string_hex_encode + + * dbus/dbus-md5.c (_dbus_md5_compute): use dbus_string_hex_encode + + * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): make this use + the save-to-temp/rename trick to atomically write the new file + (_dbus_string_parse_uint): new function + +2003-02-22 Havoc Pennington <hp@pobox.com> + + * test/Makefile.am (dist-hook): fix dist for test/data/sha-1 + +2003-02-22 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_iter_get_string_array): + (dbus_message_iter_get_byte_array): Fix up doxygen warnings + + * dbus/dbus-sha.c: add implementation of SHA-1 algorithm + + * dbus/test/data/sha-1: add US government test suite for SHA-1 + +2003-02-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_demarshal_string_array): + Make string arrays NULL-terminated. + + * dbus/dbus-memory.c: (dbus_free_string_array): + * dbus/dbus-memory.h: + New function for freeing NULL-terminated string arrays. + + * dbus/dbus-message-builder.c: (append_quoted_string), + (_dbus_message_data_load): + Add support for array types. + + * dbus/dbus-message.c: (check_message_handling): + Add more types as test cases. + + * dbus/dbus-sysdeps.c: (_dbus_string_parse_int), + (_dbus_string_parse_double): + Add the start offset to the end offset. + + * test/data/valid-messages/lots-of-arguments.message: + New test message with lots of arguments. + +2003-02-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c: (dbus_message_append_nil), + (dbus_message_append_int32), (dbus_message_append_uint32), + (dbus_message_append_double), (dbus_message_append_string), + (dbus_message_append_int32_array), + (dbus_message_append_uint32_array), + (dbus_message_append_double_array), + (dbus_message_append_byte_array), + (dbus_message_append_string_array): + Fix all out-of-memory handling in these functions. + +2003-02-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c: (dbus_message_append_nil): + Fix a silly. + +2003-02-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c: (dbus_message_append_args_valist), + (dbus_message_append_nil), (dbus_message_append_int32_array), + (dbus_message_append_uint32_array), + (dbus_message_append_double_array), + (dbus_message_append_byte_array), + (dbus_message_append_string_array), (dbus_message_get_args_valist), + (dbus_message_iter_get_int32_array), + (dbus_message_iter_get_uint32_array), + (dbus_message_iter_get_double_array), + (dbus_message_iter_get_byte_array), + (dbus_message_iter_get_string_array): + + * dbus/dbus-message.h: + Add functions for appending and getting arrays. + +2003-02-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-mempool.c (_dbus_mem_pool_new): Make the + element size at least 8 bytes, fixes mempool tests on + 64-bit machines. + +2003-02-20 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-transport-unix.c (unix_do_iteration): + Unlock the connection mutex during a blocking select call. + Add todo about how we need a way to wake up the select. + + * dbus/dbus-connection-internal.h: + * dbus/dbus-connection.c: + Add _dbus_connection_lock and _dbus_connection_unlock. + +2003-02-19 Havoc Pennington <hp@pobox.com> + + * Doxyfile.in (PREDEFINED): put DOXYGEN_SHOULD_SKIP_THIS in + Doxyfile.in, not Doxyfile + + * dbus/dbus-keyring.c: do some hacking on this + + * dbus/dbus-sysdeps.c (_dbus_delete_file): new + + * dbus/dbus-errors.c (dbus_set_error_const): do not call + dbus_error_init + (dbus_set_error): remove dbus_error_init, check for message == + NULL *before* we sprintf into it, and add @todo about including + system headers in this file + + * dbus/dbus-sysdeps.c (_dbus_create_file_exclusively): new + + * dbus/dbus-errors.h (DBUS_ERROR_FAILED): add + + * dbus/dbus-sysdeps.c (get_user_info): break this function out to + get various bits of user information based on either username + or user ID + (_dbus_homedir_from_username): new function + +2003-02-19 Anders Carlsson <andersca@codefactory.se> + + * configure.in: + Add check for nonposix getpwnam_r + + * dbus/dbus-mempool.c: (_dbus_mem_pool_new): + Align the pool element size to a sizeof (void *) boundary. + + * dbus/dbus-sysdeps.c: (_dbus_setenv), (_dbus_connect_unix_socket), + (_dbus_listen_unix_socket), (_dbus_credentials_from_username): + General Solaris fixes. + + * test/data/valid-messages/simplest-manual.message: + Explicitly state that we want little-endian packing. + +2003-02-19 Mikael Hallendal <micke@codefactory.se> + + * dbus/dbus-server.c (dbus_server_listen): Support tcp: addresses. + + * dbus/dbus-transport-unix.c (_dbus_transport_new_for_tcp_socket): + Added to create a transport connecting using a tcp/ip socket. + + * dbus/dbus-sysdeps.c (_dbus_connect_tcp_socket): Added to connect + to a tcp socket at given host and port. + (_dbus_listen_tcp_socket): added to listen on tcp socket for given + hostname and port. + + * dbus/dbus-server.c (dbus_server_listen): Support tcp: addresses. + + * dbus/dbus-server-unix.c (_dbus_server_new_for_tcp_socket): + Added to create a server listening on a TCP/IP socket. + +2003-02-19 Havoc Pennington <hp@pobox.com> + + Throughout: mop up all the Doxygen warnings and undocumented + stuff. + + * dbus/dbus-sysdeps.c (do_exec): do not use execvp, we don't want + to search any paths. + + * dbus/dbus-threads.c: move global mutex initializers to + dbus-internals.h, multiple prototypes was confusing doxygen + besides being kind of ugly + + * Doxyfile (PREDEFINED): have Doxygen define + DOXYGEN_SHOULD_SKIP_THIS so we can exclude things from + docs with #ifndef DOXYGEN_SHOULD_SKIP_THIS + (do not abuse the feature! it's for stuff like the autogenerated + macros in dbus-md5.c, not just for things you don't feel like + documenting...) + +2003-02-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_zero): new function + + * dbus/dbus-md5.c: include MD5 implementation by L. Peter Deutsch, + wrap it in some dbus-friendly API + + * dbus/dbus-types.h: add 16-bit types + +2003-02-18 Joe Shaw <joe@assbarn.com> + + * dbus/dbus-auth.c (handle_server_data_stupid_test_mech): Just get + credentials from our currently running process. + (get_word): Fix a buglet where we were copying the entire length + instead of relative to our position. + + * dbus/dbus-hash.c (_dbus_hash_test): Don't try to allocate the + keys on the stack... it's 640k of data. + + * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): Always + read the credentials byte off the socket, even if we don't have + SO_PEERCRED. + (_dbus_poll): Implement poll() using select() for systems which + don't have it. + + * glib/test-dbus-glib.c (main): Print out an error if no + parameters are given. + + * test/data/auth/fallback.auth-script: Added. Tests that a client + can fallback to a secondary auth mechanism if the first fails. + +2003-02-18 Havoc Pennington <hp@pobox.com> + + * AUTHORS: add Alex + +2003-02-17 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: lots of cosmetic + cleanups/rearrangement, add assorted FIXME, change DBUS_ADDRESS + env variable to DBUS_BUS_ADDRESS, s/client/application/, + s/server/bus/ (except in authentication section). Add a section + "Message Bus Message Routing" + +2003-02-17 Anders Carlsson <andersca@codefactory.se.> + + Release 0.4 + + * NEWS: Update + +2003-02-17 Anders Carlsson <andersca@codefactory.se> + + * doc/dbus-specification.sgml: + Specification updates. + +2003-02-17 Anders Carlsson <andersca@codefactory.se> + + * bus/activation.c: (bus_activation_init), (child_setup), + (bus_activation_activate_service): + * bus/activation.h: + * bus/main.c: (main): + Set DBUS_ADDRESS environment variable. + + * dbus/dbus-errors.c: (dbus_set_error): + Don't use va_copy since that's a C99 feature. + + * dbus/dbus-sysdeps.c: (_dbus_setenv), (do_exec), + (_dbus_spawn_async): + * dbus/dbus-sysdeps.h: + Add child_setup_func to _dbus_spawn_async. + + * doc/dbus-specification.sgml: + Update specification. + + * test/spawn-test.c: (setup_func), (main): + Fix test. + +2003-02-17 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-connection.c (_dbus_connection_handler_destroyed_locked): + Added todo. + +2003-02-17 Anders Carlsson <andersca@codefactory.se> + + * doc/.cvsignore: + * doc/Makefile.am: + * doc/dbus-test-plan.sgml: + Add test plan document. + + * test/Makefile.am: + Fix distcheck. + +2003-02-17 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message.c: (decode_header_data), + (_dbus_message_loader_return_buffer): + Set the header padding amount when loading a message. + +2003-02-16 Anders Carlsson <andersca@codefactory.se> + + * bus/dispatch.c: (send_one_message): + Only send broadcast messages to registered connections. + + * dbus/dbus-message.c: (dbus_message_name_is): + * dbus/dbus-message.h: + New convenience function. + + * dbus/dbus-transport-debug.c: (do_reading): + Only dispatch one message per run. + + * test/Makefile.am: + * test/bus-test.c: (new_connection_callback), (die), + (test_hello_client1_handler), (test_hello_client2_handler), + (test_hello_replies), (main): + + * test/bus-test-loop.[ch]: + Add these. + +2003-02-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_dispatch_message): fix + backward conditional + +2003-02-16 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-connection.c: + Implement sent_message_with_reply. (with_reply_and block is still + busted). + Made dispatch_message not lose message if OOM. + + * dbus/dbus-errors.h: + Add NoReply error (for reply timeouts). + +2003-02-16 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-hash.c (_dbus_hash_table_unref): + Actually free keys and values when destroying hashtable. + +2003-02-16 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-auth.c: (client_try_next_mechanism): + Plug a leak. + + * dbus/dbus-threads.c: (dbus_condvar_wait_timeout): + Return TRUE if there's no thread implementation around. + + * glib/dbus-gmain.c: (free_source), + (dbus_connection_hookup_with_g_main): + Make sure to remove the GSource when the connection is finalized. + +2003-02-16 Anders Carlsson <andersca@codefactory.se> + + * bus/dispatch.c: (bus_dispatch_message_handler): + * dbus/dbus-errors.h: + Return an error if someone tries to send a message to a service + that doesn't exist. + +2003-02-16 Anders Carlsson <andersca@codefactory.se> + + * bus/activation.c: (load_directory), (bus_activation_init), + (bus_activation_activate_service): + * bus/activation.h: + * bus/driver.c: + (bus_driver_handle_activate_service), (bus_driver_handle_message): + More work on the activation handling. + + * dbus/dbus-errors.h: + Add some error messages + + * dbus/dbus-message.c: (dbus_message_new_error_reply): + * dbus/dbus-message.h: + New function that creates an error message. + + * dbus/dbus-protocol.h: + Add ACTIVATE_SERVER message. + + * dbus/dbus-server-unix.c: (unix_handle_watch), + (_dbus_server_new_for_domain_socket): + Call _dbus_fd_set_close_on_exec. + + * dbus/dbus-sysdeps.c: (make_pipe), (do_exec), + (_dbus_spawn_async), (_dbus_disable_sigpipe), + (_dbus_fd_set_close_on_exec): + * dbus/dbus-sysdeps.h: + Add _dbus_fd_set_close_on exec function. Also add function that checks + that all open fds are set to close-on-exec and warns otherwise. + + * dbus/dbus-transport-unix.c: + (_dbus_transport_new_for_domain_socket): + Call _dbus_fd_set_close_on_exec. + +2003-02-16 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_set_change_sigpipe): + allow people to avoid setting SIGPIPE to SIG_IGN + (_dbus_connection_new_for_transport): disable SIGPIPE unless + we've been asked not to + +2003-02-15 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-list.c: (_dbus_list_append_link), + (_dbus_list_prepend_link): + * dbus/dbus-memory.c: (dbus_malloc), (dbus_malloc0), + (dbus_realloc): + Warning fixes. + +2003-02-15 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + * bus/activation.c: (bus_activation_entry_free), + (add_desktop_file_entry), (load_directory), (bus_activation_init): + * bus/activation.h: + * bus/main.c: (main): + Add simple activation support, doesn't work yet though. + +2003-02-15 Zack Rusin <zack@kde.org> + + * qt/dbus-qthread.cpp: small casting fix + +2003-02-15 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-errors.c: (dbus_set_error): + * dbus/dbus-errors.h: + Add a few errors and make dbus_set_error void. + + * dbus/dbus-sysdeps.c: + (_dbus_errno_to_string), (close_and_tqinvalidate), (make_pipe), + (write_err_and_exit), (read_ints), (do_exec), (_dbus_spawn_async): + * dbus/dbus-sysdeps.h: + Add _dbus_spawn_async. + + * test/spawn-test.c: (main): + Test for _dbus_spawn_async. + +2003-02-15 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-internals.h: + Fix build without tests. + + * dbus/dbus-list.c: (alloc_link): + Fix a segfault when a malloc fails. + + * dbus/dbus-memory.c: (initialize_malloc_debug), (dbus_malloc), + (dbus_malloc0), (dbus_realloc): + Add support for malloc debugging. + +2003-02-15 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-threads.c: + * dbus/dbus-threads.h: + Add condvars. Remove static mutext from API. + Implement static mutexes by initializing them from threads_init. + + * glib/dbus-gthread.c: + * qt/dbus-qthread.cpp: + Update with the thread api changes. + + + * dbus/dbus-list.c: + * dbus/dbus-list.h: + Turn StaticMutex into normal mutex + init function. + Export new functions _dbus_list_alloc_link, _dbus_list_free_link, + _dbus_list_append_link, _dbus_list_prepend_link + + + * dbus/dbus-sysdeps.c: + * dbus/dbus-sysdeps.h: + New type dbus_atomic_t, and new functions _dbus_atomic_inc, + _dbus_atomic_dec. Only slow fallback implementation at the moment. + + * dbus/dbus-protocol.h: + Add DBUS_MESSAGE_LOCAL_DISCONNECT define + + * dbus/dbus-message.c: + Make ref/unref atomic. + Fix some docs. + + * dbus/dbus-connection-internal.h: + * dbus/dbus-connection.c: + * dbus/dbus-connection.h: + Make threadsafe. + Change _peek to _borrow,_return & _steal_borrowed. + Change disconnect callback to event. + Make dbus_connection_dispatch_messages reentrant. + + * dbus/dbus-transport.c: + Don't ref the connection on calls to the transport + implementation. + + * dbus/dbus-message-handler.c: + Make threadsafe. + + * glib/dbus-gmain.c: + Don't use peek_message anymore + + * test/Makefile.am: + * test/debug-thread.c: + * test/debug-thread.h: + Simple thread implementation that asserts() on deadlocks in + single-threaded code. + + * test/bus-test.c: + (main) Call debug_threads_init. + + * test/watch.c: + Use disconnect message instead of disconnect callback. + + * bus/connection.c: + * bus/connection.h: + Don't call dbus_connection_set_disconnect_function. Instead export + bus_connection_disconnect. + + * bus/dispatch.c: + Call bus_connection_disconnect when we get a disconnected message. + +2003-02-15 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_new): fool around with the + docs + +2003-02-14 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-mempool.c: fail if the debug functions so indicate + + * dbus/dbus-memory.c: fail if the debug functions indicate we + should + + * dbus/dbus-internals.c (_dbus_set_fail_alloc_counter) + (_dbus_decrement_fail_alloc_counter): debug functions to + simulate memory allocation failures + +2003-02-14 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-errors.h (struct DBusError): add a word of padding + to DBusError + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_handle_hello): + * bus/driver.h: + * bus/services.c: (bus_service_lookup): + Reorder message sending so we get a more sane order. + + * test/bus-test.c: (message_handler): + Fix tyop. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired), (bus_driver_handle_hello), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), + (bus_driver_handle_acquire_service), + (bus_driver_handle_service_exists): + * dbus/dbus-bus.c: (dbus_bus_register_client), + (dbus_bus_acquire_service), (dbus_bus_service_exists): + * dbus/dbus-errors.c: (dbus_result_to_string): + * dbus/dbus-errors.h: + * dbus/dbus-message.c: (dbus_message_append_args), + (dbus_message_append_args_valist), (dbus_message_get_args), + (dbus_message_get_args_valist), (dbus_message_get_args_iter), + (dbus_message_iter_get_arg_type), (dbus_message_iter_get_string), + (dbus_message_iter_get_byte_array), + (dbus_message_iter_get_string_array), (message_iter_test), + (check_message_handling), (_dbus_message_test): + * dbus/dbus-message.h: + * test/bus-test.c: (main): + Change fields to arguments in messages, so that they won't be + confused with header fields. + + * glib/test-dbus-glib.c: (main): + Remove append_fields from hello message. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-errors.c: + * dbus/dbus-message.c: + * dbus/dbus-string.c: + Documentation fixes. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * glib/dbus-gmain.c: (timeout_handler), (add_timeout), + (remove_timeout): + Implement support for timeouts in dbus-glib. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-message-builder.c: (_dbus_message_data_load): + * dbus/dbus-message.c: (process_test_subdir): + * test/break-loader.c: (tqfind_breaks_based_on): + Plug some memory leaks. + +2003-02-13 Richard Hult <rhult@codefactory.se> + + * bus/main.c: Fix build. + + * dbus/dbus-errors.h: + * dbus/dbus-errors.c: Fix copyright for Anders. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + Add utils.[ch] + + * bus/connection.c: (bus_connection_foreach): + Fix a warning. + + * bus/desktop-file.c: (grow_lines_in_section), (grow_sections), + (unescape_string), (new_section), (parse_section_start), + (parse_key_value), (report_error), (bus_desktop_file_load), + (bus_desktop_file_get_string): + * bus/desktop-file.h: + Use DBusError for error reporting. + + * bus/dispatch.c: (send_one_message), + (bus_dispatch_message_handler): + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired), (bus_driver_handle_hello), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), + (bus_driver_handle_acquire_service), + (bus_driver_handle_service_exists): + * bus/loop.c: (bus_loop_run): + * bus/main.c: + Use BUS_HANDLE_OOM instead of _DBUS_HANDLE_OOM. + + * bus/utils.c: (bus_wait_for_memory): + * bus/utils.h: + New files with general utility functions. + + * dbus/dbus-internals.h: + Remove _DBUS_HANDLE_OOM. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-errors.c: (dbus_result_to_string), (dbus_error_init), + (dbus_error_free), (dbus_set_error_const), (dbus_set_error): + * dbus/dbus-errors.h: + Add DBusError structure. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * test/data/valid-messages/standard-acquire-service.message: + * test/data/valid-messages/standard-hello.message: + * test/data/valid-messages/standard-list-services.message: + * test/data/valid-messages/standard-service-exists.message: + Add some standard messages. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), + (bus_driver_handle_acquire_service), + (bus_driver_handle_service_exists), (bus_driver_handle_message): + Update for API changes in libdbus. + + * dbus/dbus-message.c: (dbus_message_new_reply): + * dbus/dbus-message.h: + Remove the name argument. The spec states that replies shouldn't + have a name. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + + * bus/desktop-file.c: (parse_section_start), (parse_key_value), + (report_error), (bus_desktop_file_load), (lookup_section), + (lookup_line), (bus_desktop_file_get_raw), + (bus_desktop_file_get_string): + * bus/desktop-file.h: + Some fixes, and new functions for getting a key value from a section. + +2003-02-13 Havoc Pennington <hp@pobox.com> + + * test/data/auth/fail-after-n-attempts.auth-script: new test + + * dbus/dbus-auth.c (send_rejected): shutdown_mech() when we + reject the client. + +2003-02-13 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-auth.c (handle_server_data_external_mech): args to + dbus_credentials_match were backward + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): support + NO_CREDENTIALS and ROOT_CREDENTIALS + + * dbus/dbus-auth.c (_dbus_auth_do_work): move get_state() routine + into here. Never process more commands after we've reached an + end state; store further data as unused bytes. + + * test/data/auth/*: add more auth tests + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): support EXPECT + command to match exact string and EXPECT_UNUSED to match unused + bytes + + * test/Makefile.am (dist-hook): fix to dist all the test stuff + +2003-02-12 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_pop_line): fix to also strip + \r off of popped lines + + * dbus/dbus-auth.c (_dbus_auth_test): write code to run auth + scripts + + * dbus/dbus-auth-script.c (_dbus_auth_script_run): when doing a + SEND, append \r\n + +2003-02-12 Havoc Pennington <hp@pobox.com> + + * dbus/Makefile.am: remove break-loader from the build, since it + moved. + + * configure.in: add --enable-gcov to turn on coverage profiling + flags and disable optimization + +2003-02-10 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-auth-script.c, dbus/dbus-auth-script.h: sync + initial cut at test framework for DBusAuth from laptop. + Doesn't quite work yet but it compiles and I need to get + it off the 266mhz laptop. ;-) + + * dbus/dbus-server-debug.c (_dbus_server_debug_accept_transport): + fix a memleak in error case + +2003-02-12 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + * bus/desktop-file.c: + * bus/desktop-file.h: + Add a desktop file parser. + +2003-02-11 Zack Rusin <zack@kde.org> + + * qt/message.[h|cpp]: sample implementation + of the KDE wrapper for DBusMessage + +2003-02-09 Zack Rusin <zack@kde.org> + + * test/bus-test.c: make_it_compile + * doc/dbus-specification.sgml: minimal semantic fix + +2003-02-06 Anders Carlsson <andersca@codefactory.se> + + Release 0.3 + + * NEWS: Update + +2003-02-06 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: + * dbus/dbus-break-loader.c: + * test/Makefile.am: + * test/break-loader.c: + Move dbus-break-loader to test/ and rename it to break-loader. + +2003-02-02 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-keyring.c, dbus/dbus-keyring.h: template files + for code to manage cookies in your home directory + + * dbus/dbus-sysdeps.c (_dbus_generate_random_bytes): new function + + * dbus/dbus-auth.c (get_state): impose a maximum number of tries + to authenticate, then disconnect the client. + +2003-02-03 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-message.c (dbus_message_append_fields): + Correct docs. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * doc/dbus-specification.sgml: + Update address format section. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * test/Makefile.am: + * test/bus-test.c: (get_time), (add_timeout), (remove_timeout), + (message_handler), (new_connection_callback), (loop_quit), + (loop_run), (main): + Add bus test. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_handle_service_exists): + Simplify the code a bit. + + * dbus/dbus-bus.c: (dbus_bus_service_exists): + Fix a silly. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + Add libdbus-daemon.la and link to it. + +2003-02-01 James Willcox <jwillcox@gnome.org> + + * bus/driver.c: (bus_driver_handle_own_service): + Actually include the service reply code in the message. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_handle_service_exists): + Don't unref the incoming message. + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus.h: Add dbus-address.h and dbus-bus.h + +2003-02-02 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-server.c: (dbus_server_listen): + * dbus/dbus-transport.c: (_dbus_transport_open): + ifdef out the calls to the debug transport and server. + +2003-02-02 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-watch.c (dbus_watch_get_flags): + Add note in the docs that ERROR or HANGUP won't be returned + and are assumed always on. + + * glib/dbus-gmain.c (add_watch): + Always add IO_ERR | IO_HUP + + * dbus/dbus-message.h: + Add semicolon after dbus_message_iter_get_string_array(). + Makes qt code build again + +2003-02-01 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (create_unique_client_name), + (bus_driver_handle_hello): + Don't take a name, just use a numeric id to identify + each client. + + * dbus/Makefile.am: + * dbus/dbus-bus.c: (dbus_bus_register_client), + (dbus_bus_acquire_service), (dbus_bus_service_exists): + * dbus/dbus-bus.h: + Add new convenience functions for communicating with the bus. + + * dbus/dbus-message.h: + + * dbus/dbus-protocol.h: + Fix a typo. + +2003-02-01 Alexander Larsson <alexl@redhat.com> + + * dbus/dbus-message.c (dbus_message_append_fields): + Add some more doc comments. + +2003-02-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-break-loader.c (randomly_modify_length): change + a 4-byte value in the message as if it were a length + + * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): don't set + execute bit on saved files + +2003-02-01 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-break-loader.c (main): new program to tqfind messages + that break the loader. + + * dbus/dbus-sysdeps.c (_dbus_string_append_uint): new function + * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): new function + + * dbus/dbus-string.c (_dbus_string_set_byte): new + +2003-01-31 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c: refactor the test code to be more general, + in preparation for writing a "randomly permute test cases to + try to break the loader" program. + +2003-01-31 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: work on the specification + + * dbus/dbus-message.c (_dbus_message_loader_return_buffer): check + the protocol version of the message. + + * dbus/dbus-protocol.h: drop special _REPLY names, the spec + no longer specifies that. + (DBUS_SERVICE_REPLY_SERVICE_EXISTS): fix flags (1/2/4/8 not + 1/2/3/4) + + * dbus/dbus-marshal.c (_dbus_marshal_get_arg_end_pos): add missing + "break" for DBUS_TYPE_NIL, remove @todo + +2003-01-31 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_set_is_error_reply): rename + just set_is_error/get_is_error as this is a commonly-used + function, and write docs. + +2003-01-31 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-address.c: (dbus_address_entry_free): + Free key and value lists. + + * dbus/dbus-internals.c: (_dbus_type_to_string): + Add the types we didn't have. + + * dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos), + (_dbus_marshal_validate_arg): + Add NIL types. + + * dbus/dbus-message.c: (dbus_message_set_sender): + Remove todo about being able to set sender to NULL. + + (dbus_message_set_is_error_reply), + (dbus_message_get_is_error_reply): + * dbus/dbus-message.h: + New functions. + + * dbus/dbus-protocol.h: + Add error reply flag. + + * test/data/valid-messages/opposite-endian.message: + Add NIL type to test. + +2003-01-31 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: fully specify the header. Add + flags and major protocol version, and change header/body len to + unsigned. + + * dbus/dbus-message-builder.c (append_saved_length): append length + as uint32 + + * dbus/dbus-message.c (dbus_message_create_header): change header + length and body length to unsigned. Add the new fields from the + spec + (_dbus_message_loader_return_buffer): unsigned header/body len + +2003-01-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-auth.c: rework to use only REJECTED, no + MECHANISMS + + * doc/dbus-sasl-profile.txt: drop MECHANISMS and just + use REJECTED, suggested by Mark McLoughlin + +2003-01-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-server.c (dbus_server_listen): @todo about how we need + a better way to report errors here. e.g. "unix address lacks + path" or something. also "no such file" when the path doesn't + exist, etc. + + * dbus/dbus-address.c (dbus_address_entries_free): add @todo about + leaking list nodes + (dbus_parse_address): add @todo about documenting address format, + and allowing , and ; to be escaped + +2003-01-30 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: + Add dbus-address.[ch] + + * dbus/dbus-address.c: (dbus_address_entry_free), + (dbus_address_entries_free), (create_entry), + (dbus_address_entry_get_method), (dbus_address_entry_get_value), + (dbus_parse_address), (_dbus_address_test): + * dbus/dbus-address.h: + New files for dealing with address parsing. + + * dbus/dbus-connection.c: + Document timeout functions. + + * dbus/dbus-message.c: + Document dbus_message_new_from_message. + + * dbus/dbus-server-debug.c: + Document. + + * dbus/dbus-server.c: (dbus_server_listen): + Parse address and use correct server implementation. + + * dbus/dbus-string.c: (_dbus_string_tqfind_to), (_dbus_string_test): + * dbus/dbus-string.h: + New function with test. + + * dbus/dbus-test.c: (dbus_internal_symbol_do_not_use_run_tests): + * dbus/dbus-test.h: + Add address tests. + + * dbus/dbus-transport-debug.c: + Document. + + * dbus/dbus-transport.c: (_dbus_transport_open): + Parse address and use correct transport implementation. + +2003-01-30 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c: use message->byte_order instead of + DBUS_COMPILER_BYTE_ORDER throughout. + (dbus_message_create_header): pad header to align the + start of the body of the message to 8-byte boundary + + * dbus/dbus-marshal.h: make all the demarshalers take const + DBusString arguments. + + * dbus/dbus-message.c (_dbus_message_loader_return_buffer): + validate message args here, so we don't have to do slow validation + later, and so we catch bad messages as they are incoming. Also add + better checks on header_len and body_len. Also fill in + message->byte_order + + * dbus/dbus-string.c (_dbus_string_validate_utf8): new (not + implemented properly) + (_dbus_string_validate_nul): new function to check all-nul + + * dbus/dbus-marshal.c (_dbus_marshal_get_field_end_pos): rename + get_arg_end_pos and remove all validation + (_dbus_marshal_validate_arg): actually do validation here. + +2003-01-29 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (check_message_handling): fix assertion + failure on set_client_serial + +2003-01-28 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-server-debug.c: Add doc section comments + + * dbus/dbus-transport-debug.c: add doc section comments + +2003-01-28 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-string.c (_dbus_string_base64_decode): append bytes in + the reverse order from how I had it + (_dbus_string_base64_encode): reverse encoding order. I was + basically byteswapping everything during encoding. + +2003-01-28 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection-internal.h: + * dbus/dbus-connection.c: (_dbus_connection_add_timeout), + (_dbus_connection_remove_timeout): + Add functions for adding and removing timeouts. + + * dbus/dbus-message.c: (dbus_message_new_from_message): + Add new function that takes a message and creates an exact + copy of it, but with the refcount set to 1. + (check_message_handling): + Fix build error. + + * dbus/dbus-server-protected.h: + * dbus/dbus-server.c: (_dbus_server_init_base), + (_dbus_server_finalize_base), (_dbus_server_add_timeout), + (dbus_server_set_timeout_functions): + (_dbus_server_remove_timeout): + New functions so that a server can add and remove timeouts. + + (dbus_server_listen): + Add commented out call to dbus_server_debug_new. + + * dbus/dbus-timeout.c: (_dbus_timeout_new): + Actually set the handler, doh. + + * dbus/dbus-transport.c: (_dbus_transport_open): + Add commented out call to dbus_transport_debug_client_new. + + * dbus/Makefile.am: + Add dbus-transport-debug.[ch] and dbus-server-debug.[ch] + +2003-01-28 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (check_message_handling): function to check + on the loaded message, iterates over it etc. + +2003-01-28 Havoc Pennington <hp@pobox.com> + + * test/Makefile.am (dist-hook): fix make distdir + + * dbus/Makefile.am (TESTS_ENVIRONMENT): fix make check + +2003-01-27 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-mempool.c (time_for_size): tqreplace printf with + _dbus_verbose + + * dbus/dbus-message-builder.c (_dbus_message_data_load): allow + empty lines; fix the SAVE_LENGTH stuff to be + START_LENGTH/END_LENGTH so it actually works; couple other + bugfixes + + * test/Makefile.am (dist-hook): add dist-hook for .message files + + * dbus/dbus-string.c (DBUS_STRING_COPY_PREAMBLE): source of a copy + can be constant or locked. + (_dbus_string_free): allow freeing a const string as + documented/intended + + * dbus/dbus-sysdeps.c (_dbus_concat_dir_and_file): utility + + * dbus/dbus-test-main.c (main): take an argument which is the + directory containing test data + + * dbus/dbus-message.c (_dbus_message_test): pass a test_data_dir + argument to this and load all the messages in test/data/ + checking that they can be loaded or not loaded as appropriate. + +2003-01-27 Anders Carlsson <andersca@codefactory.se> + + * bus/dispatch.c: (bus_dispatch_message_handler): + Dispatch messages sent to services. + + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired): + Add helper functions for sending service related messages. + + (bus_driver_send_welcome_message): + Send HELLO_REPLY instead of WELCOME. + + (bus_driver_handle_list_services): + Send LIST_SERVICES_REPLY instead of SERVICES. + + (bus_driver_handle_own_service), + (bus_driver_handle_service_exists): + New message handlers. + + (bus_driver_handle_message): + Invoke new message handlers. + + (bus_driver_remove_connection): + Don't remove any services here since that's done automatically + by bus_service_remove_owner now. + + * bus/driver.h: + New function signatures. + + * bus/services.c: (bus_service_add_owner): + Send ServiceAcquired message if we're the only primary owner. + + (bus_service_remove_owner): + Send ServiceAcquired/ServiceLost messages. + + (bus_service_set_prohibit_tqreplacement), + (bus_service_get_prohibit_tqreplacement): + Functions for setting prohibit tqreplacement. + + (bus_service_has_owner): + New function that checks if a connection is in the owner queue of + a certain service. + + * bus/services.h: + Add new function signatures. + + * dbus/dbus-list.c: (_dbus_list_test): + Add tests for _dbus_list_remove_last and traversing the list backwards. + + * dbus/dbus-list.h: + Fix a typo in _dbus_list_get_prev_link, if we're at the first element we can't + go any further, so return NULL then. + + * dbus/dbus-protocol.h: + Add new messages, service flags and service replies. + +2003-01-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message-builder.c: implement, completely untested. + + * test/data/*: add data to be used in testing. + ".message" files are our simple loadable text format. + ".message-raw" will be binary dumps of messages. + + * dbus/dbus-string.c (_dbus_string_starts_with_c_str): new + +2003-01-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-sysdeps.c (_dbus_file_get_contents): new function + + * dbus/dbus-errors.c (dbus_result_to_string): add + file errors + + * dbus/dbus-message-builder.c: new file, will contain code to load + up messages from files. Not implemented yet. + +2003-01-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.c (dbus_message_set_sender): support deleting + the sender by setting to NULL + +2003-01-26 Havoc Pennington <hp@pobox.com> + + The unit tests pass, but otherwise untested. If it breaks, the + tests should have been better. ;-) + + * bus/driver.c (bus_driver_handle_hello): return if we disconnect + the connection. + + * dbus/dbus-message.c: redo everything so we maintain + message->header as the only copy of the various fields. + This avoids the possibility of out-of-memory in some cases, + for example dbus_message_lock() can't run out of memory anymore, + and avoids extra copying. Figured I may as well go ahead and do + this since it was busted for dbus_message_lock to not return + failure on OOM, and dbus_message_write_header was totally + unchecked for OOM. Also fixed some random other bugs. + + * dbus/dbus-marshal.c (_dbus_marshal_get_field_end_pos): verify + that strings are nul-terminated. Also, end_pos can be equal + to string length just not greater than, I think. + (_dbus_marshal_set_int32): new function + (_dbus_marshal_set_uint32): new function + (_dbus_marshal_set_string): new function + + * dbus/dbus-connection.c (_dbus_connection_new_for_transport): fix + a warning, init timeout_list to NULL + (dbus_connection_send_message): don't use uninitialized variable + "serial" + + * dbus/dbus-string.c (_dbus_string_tqreplace_len): new function + +2003-01-26 Anders Carlsson <andersca@codefactory.se> + + * bus/driver.c: (bus_driver_handle_hello), + (bus_driver_send_welcome_message): + Plug leaks + +2003-01-26 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-auth.c: (process_auth), (_dbus_auth_unref): + * dbus/dbus-connection.c: (_dbus_connection_new_for_transport), + (dbus_connection_unref): + * dbus/dbus-marshal.c: (_dbus_marshal_test): + * dbus/dbus-message.c: (dbus_message_unref), + Plug memory leaks. + + (dbus_message_get_fields): + Remove debugging printout. + + (_dbus_message_loader_return_buffer): + Don't store the header string. + + (_dbus_message_test): + Plug leaks. + +2003-01-26 Richard Hult <rhult@codefactory.se> + + * glib/dbus-gmain.c (dbus_connection_dispatch): Traverse a copy of + the file descriptor list, since it can change under us. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * glib/dbus-gmain.c: (dbus_connection_prepare), + (dbus_connection_check), (dbus_connection_dispatch), (add_watch), + (remove_watch), (dbus_connection_hookup_with_g_main): + Rewrite the glib handling to use its own GSource instead of a + GIOChannel so we can catch messages put in the queue while waiting + for a reply. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + * bus/connection.c: (connection_disconnect_handler), + (connection_watch_callback), (bus_connection_setup): + * bus/dispatch.c: (send_one_message), + (bus_dispatch_broadcast_message), (bus_dispatch_message_handler), + (bus_dispatch_add_connection), (bus_dispatch_remove_connection): + * bus/dispatch.h: + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_handle_hello), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), (bus_driver_remove_connection), + (bus_driver_handle_message): + * bus/driver.h: + Refactor code, put the message dispatching in its own file. Use + _DBUS_HANDLE_OOM. Also send ServiceDeleted messages when a client + is disconnected. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-internals.h: + Add _DBUS_HANDLE_OOM macro, it doesn't do anything currently. + + * dbus/dbus-message.c: (dbus_message_get_sender): + * dbus/dbus-message.h: + Implement dbus_message_get_sender. + + * dbus/dbus-protocol.h: + Add message and service defines. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection.c: (dbus_connection_send_message): + * dbus/dbus-message-internal.h: + * dbus/dbus-message.c: (_dbus_message_get_client_serial), + (dbus_message_write_header): + Remove _dbus_messag_unlock and don't set the client serial on a + message if one already exists. + +2003-01-24 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-list.c (alloc_link): put a thread lock on the global + list_pool + + * bus/driver.c (bus_driver_handle_list_services): fix a leak + on OOM + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-list.c: (alloc_link), (free_link): + Use a memory pool for the links. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * bus/connection.c: (bus_connection_foreach): + * bus/connection.h: + Add new bus_connection_foreach function. + + * bus/driver.c: (send_one_message), (bus_driver_broadcast_message): + Add function that broadcasts a message to all clients. + + (bus_driver_send_service_created), (bus_driver_handle_hello), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), (bus_driver_message_handler): + Implement functions that take care of listing services, and notifying + clients when new services are created. + + * bus/services.c: (bus_services_list): + * bus/services.h: + Add new function that returns an array of strings with the currently + registered services. + + * glib/dbus-glib.h: + * glib/dbus-gmain.c: + Update copyright year. + +2003-01-25 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection.c: (dbus_connection_send_message): + Unlock the message in case it was sent earlier. + + (dbus_connection_send_message_with_reply_and_block): + Remove the reply message from the list. + + * dbus/dbus-marshal.c: (_dbus_demarshal_string_array): + Set array_len and new_pos correctly. + + (_dbus_marshal_test): + Remove debug output. + + * dbus/dbus-message-internal.h: + * dbus/dbus-message.c: (_dbus_message_get_reply_serial): + New function that returns the reply serial. + + (_dbus_message_unlock): + New function that unlocks a message and resets its header. + + (dbus_message_append_string_array), + (dbus_message_get_fields_valist), + (dbus_message_iter_get_field_type), + (dbus_message_iter_get_string_array), + (dbus_message_get_fields), + (dbus_message_append_fields_valist): + Handle string arrays. + + (dbus_message_set_sender): + Make this function public since the bus daemon needs it. + + (decode_header_data): + Set the reply serial to -1 initially. + + * dbus/dbus-message.h: + Add dbus_message_set_sender. + +2003-01-24 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: add some stuff + +2003-01-22 Havoc Pennington <hp@pobox.com> + + * doc/dbus-specification.sgml: Start to document the protocol. + +2003-01-22 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c + (dbus_connection_send_message_with_reply_and_block): add some @todo + + * bus/driver.c (bus_driver_add_connection): add a FIXME about memleak + +2003-01-21 Havoc Pennington <hp@pobox.com> + + (patch untested because can't compile) + + * bus/driver.c (create_unique_client_name): make this function + never recycle client names. Also, caller should initialize + the DBusString. + + * dbus/dbus-sysdeps.c (_dbus_get_current_time): new function + +2003-01-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_double), + (_dbus_marshal_int32), (_dbus_marshal_uint32), + (_dbus_marshal_int32_array), (_dbus_marshal_uint32_array), + (_dbus_marshal_double_array), (_dbus_marshal_string_array), + (_dbus_demarshal_int32_array), (_dbus_demarshal_uint32_array), + (_dbus_demarshal_double_array), (_dbus_demarshal_string_array), + (_dbus_marshal_get_field_end_pos), (_dbus_marshal_test): + * dbus/dbus-marshal.h: + * dbus/dbus-protocol.h: + Add support for marshalling and demarshalling integer, double + and string arrays. + +2003-01-21 Anders Carlsson <andersca@codefactory.se> + + * bus/Makefile.am: + Add driver.[ch] + + * bus/connection.c: (connection_disconnect_handler): + Remove the connection from the bus driver's list. + + (connection_watch_callback): Dispatch messages. + + (free_connection_data): Free connection name. + + (bus_connection_setup): Add connection to the bus driver's list. + (bus_connection_remove_owned_service): + (bus_connection_set_name), (bus_connection_get_name): + Add functions for setting and getting the connection's name. + + * bus/connection.h: + Add function headers. + + * bus/driver.c: (create_unique_client_name), + (bus_driver_handle_hello_message), + (bus_driver_send_welcome_message), (bus_driver_message_handler), + (bus_driver_add_connection), (bus_driver_remove_connection): + * bus/driver.h: + * bus/main.c: + * bus/services.c: (bus_service_free): + * bus/services.h: + New file that handles communication and registreation with the bus + itself. + +2003-01-21 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection.c: (dbus_connection_send_message): + Add a new client_serial parameter. + + (dbus_connection_send_message_with_reply): + Remove a @todo since we've implemented the blocking function. + + (dbus_connection_send_message_with_reply_and_block): + New function that sends a message and waits for a reply and + then returns the reply. + + * dbus/dbus-connection.h: + Add new functions. + + * dbus/dbus-errors.c: (dbus_result_to_string): + * dbus/dbus-errors.h: + Add new DBUS_RESULT. + + * dbus/dbus-message-internal.h: + * dbus/dbus-message.c: (_dbus_message_get_reply_serial), + (_dbus_message_set_sender), (dbus_message_write_header), + (dbus_message_new_reply), (decode_header_data), + (_dbus_message_loader_return_buffer), (_dbus_message_test): + * dbus/dbus-message.h: + Add new functions that set the reply serial and sender. + Also marshal and demarshal them correctly and add test. + + * dbus/dbus-protocol.h: + Add new DBUS_MESSAGE_TYPE_SENDER. + + * glib/dbus-glib.h: + * glib/dbus-gmain.c: (watch_callback), (free_callback_data), + (add_watch), (remove_watch), (add_timeout), (remove_timeout), + (dbus_connection_hookup_with_g_main): + * glib/test-dbus-glib.c: (main): + Rewrite to use GIOChannel and remove the GSource crack. + + * test/echo-client.c: (main): + * test/watch.c: (check_messages): + Update for changed APIs + +2003-01-19 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: Add dbus-timeout.[cħ] + + * dbus/dbus-connection.c: (_dbus_connection_new_for_transport): + Create a DBusTimeoutList. + (dbus_connection_set_timeout_functions): Add new function to + set timeout callbacks + + * dbus/dbus-connection.h: Add public DBusTimeout API. + + * dbus/dbus-message.c: (dbus_message_get_service): + * dbus/dbus-message.h: New function. + + * dbus/dbus-server.c: Fix small doc typo. + + * dbus/dbus-timeout.[ch]: New files for mainloop timeouts. + +2003-01-19 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-string.c (_dbus_string_move_len): Don't delete all + of the string, just as long as specified. + +2003-01-19 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_get_is_authenticated): + new function + + * dbus/dbus-server.c (dbus_server_set_max_connections) + (dbus_server_get_max_connections, dbus_server_get_n_connections): + keep track of current number of connections, and add API for + setting a max (but haven't implemented enforcing the max yet) + +2003-01-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-transport-unix.c (unix_do_iteration): only do the + reading/writing if read_watch != NULL or write_watch != NULL. + + * dbus/dbus-message.c (_dbus_message_loader_return_buffer): fix + the message loader code to actually load message->header and + message->body into the newly-created message. + + * dbus/dbus-transport-unix.c (check_write_watch): fix a mem leak + in OOM case + + * dbus/dbus-connection.c (dbus_connection_set_max_message_size) + (dbus_connection_get_max_message_size) + (dbus_connection_set_max_live_messages_size) + (dbus_connection_get_max_live_messages_size): implement some + resource limitation functions + + * dbus/dbus-resources.c: new file implementing some of the + resource limits stuff + + * dbus/dbus-message.c (dbus_message_iter_get_byte_array): add + missing docs, add @todo to handle OOM etc. + + * dbus/dbus-marshal.c (_dbus_demarshal_byte_array): add missing + docs + +2003-01-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-connection.c (dbus_connection_unref): disconnect the + connection if it hasn't been already. + + * dbus/dbus-connection.h: kill off the idea of an ErrorFunction, + tqreplace with DisconnectFunction. + +2003-01-18 Havoc Pennington <hp@pobox.com> + + Building --disable-verbose-mode --disable-asserts --disable-tests + cuts the library from 112K to 45K or so + + * configure.in: check for varargs macro support, + add --enable-verbose-mode, --enable-asserts. + + * dbus/dbus-internals.h (_dbus_assert): support + DBUS_DISABLE_ASSERT + (_dbus_verbose): support DBUS_ENABLE_VERBOSE_MODE + +2003-01-18 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-test.c: include config.h so that tests actually run + + * dbus/dbus-string.c: add assertions that stuff is 8-byte aligned, + so the failure mode when that assumption fails will be plenty + obvious. + +2003-01-18 Havoc Pennington <hp@pobox.com> + + * configure.in: default --enable-tests to $USE_MAINTAINER_MODE + + * dbus/Makefile.am: fix it up so dubs-test-main.c is included in + the distribution + + * test/Makefile.am: don't use special variable "TESTS" for echo-* + since we don't want to use those in make check + +2003-01-15 Havoc Pennington <hp@redhat.com> + + Release 0.2 + + * NEWS: update + +2003-01-15 Havoc Pennington <hp@redhat.com> + + * test/Makefile.am: fix so that test source code ends up in the + distribution on make distcheck + +2003-01-15 Havoc Pennington <hp@redhat.com> + + Release 0.1. + + * NEWS: update + +2003-01-15 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-test.c (dbus_internal_symbol_do_not_use_run_tests): + fix build when --disable-tests + + * Makefile.am (EXTRA_DIST): put HACKING in here + + * HACKING: document procedure for making a tarball release. + +2003-01-14 Anders Carlsson <andersca@codefactory.se> + + * bus/connection.c: (connection_error_handler), + (bus_connection_setup): + * bus/main.c: (main): + Make sure that the DBusConnectionData struct is NULLed + out to prevent a segfault. + + * dbus/dbus-errors.c: (dbus_result_to_string): + * dbus/dbus-errors.h: + * dbus/dbus-message.c: (dbus_message_get_fields), + (dbus_message_get_fields_valist), (_dbus_message_test): + * dbus/dbus-message.h: + Make dbus_message_get_fields return a result code so we can + track invalid fields as well as oom. + +2003-01-11 Havoc Pennington <hp@pobox.com> + + * configure.in: change --enable-test/--enable-ansi action-if-given + to enable_foo=$enableval instead of enable_foo=yes + +2003-01-08 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-string.c (_dbus_string_align_length): new function + + * dbus/dbus-test-main.c: move main() for test app here + * dbus/dbus-test.c + (dbus_internal_symbol_do_not_use_run_tests): we have to export a + symbol to run tests, because dbus-test isn't in the main + library + + Code review nitpicks. + + * dbus/dbus-message.c (dbus_message_write_header): add newlines + for people with narrow emacs ;-). Assert client_serial was filled + in. Assert message->name != NULL. + (dbus_message_append_fields): have "first_field_type" arg separate + from va list, needed for C++ binding that also uses varargs IIRC + and helps with type safety + (dbus_message_new): add @todo about using DBusString to store + service/name internally + (dbus_message_new): don't leak ->service and ->name on OOM later + in the function + (dbus_message_unref): free the service name + (dbus_message_get_fields): same change to varargs + i.e. first_field_type + (_dbus_message_loader_return_buffer): assert that the message data + is aligned (if not it's a bug in our code). Put in verbose griping + about why we set corrupted = TRUE. + (decode_header_data): add FIXME that char* is evil. Was going to + add FIXME about evil locale-specific string.h strncmp, but just + switched to wacky string-as-uint32 optimization. Move check for + "no room for field name" above get_const_data_len() to avoid + assertion failure in get_const_data_len if we have trailing 2 + bytes or the like. Check for service and name fields being + provided twice. Don't leak service/name on error. Require field + names to be aligned to 4 bytes. + + * dbus/dbus-marshal.c: move byte swap stuff to header + (_dbus_pack_int32): uscore-prefix + (_dbus_unpack_int32): uscore-prefix + (_dbus_unpack_uint32): export + (_dbus_demarshal_string): add @todo complaining about use of + memcpy() + (_dbus_marshal_get_field_end_pos): add @todo about bad error + handling allowing corrupt data to go unchecked + +2003-01-08 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-transport-unix.c (unix_do_iteration): add read/write + to the select() as needed for authentication. (should be using + _dbus_poll() not select, but for another day) + + * dbus/dbus.h: include dbus/dbus-protocol.h + +2003-01-08 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am (dbusinclude_HEADERS): Install + dbus-connection.h + +2003-01-08 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-internals.c: (_dbus_type_to_string): + New function that returns a string describing a type. + + * dbus/dbus-marshal.c: (_dbus_demarshal_byte_array): + * dbus/dbus-marshal.h: + * dbus/dbus-message.c: (dbus_message_get_fields_valist), + (dbus_message_iter_get_field_type), (dbus_message_iter_get_double), + (dbus_message_iter_get_byte_array): + * dbus/dbus-message.h: + Add new convenience functions for appending and getting message fields. + Also add demarshalling routines for byte arrays. + +2003-01-07 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-connection-internal.h: + * dbus/dbus-connection.c: (_dbus_connection_new_for_transport), + (_dbus_connection_get_next_client_serial), + (dbus_connection_send_message): + * dbus/dbus-internals.h: + * dbus/dbus-marshal.c: (unpack_uint32), (dbus_unpack_int32), + (dbus_pack_int32), (_dbus_marshal_double), (_dbus_marshal_int32), + (_dbus_marshal_uint32), (_dbus_demarshal_double), + (_dbus_demarshal_int32), (_dbus_demarshal_uint32), + (_dbus_demarshal_string), (_dbus_marshal_get_field_end_pos), + (_dbus_verbose_bytes), (_dbus_marshal_test): + * dbus/dbus-marshal.h: + * dbus/dbus-message-internal.h: + * dbus/dbus-message.c: (_dbus_message_set_client_serial), + (dbus_message_write_header), (_dbus_message_lock), + (dbus_message_new), (dbus_message_ref), (dbus_message_unref), + (dbus_message_get_name), (dbus_message_append_int32), + (dbus_message_append_uint32), (dbus_message_append_double), + (dbus_message_append_string), (dbus_message_append_byte_array), + (dbus_message_get_fields_iter), (dbus_message_iter_ref), + (dbus_message_iter_unref), (dbus_message_iter_has_next), + (dbus_message_iter_next), (dbus_message_iter_get_field_type), + (dbus_message_iter_get_string), (dbus_message_iter_get_int32), + (dbus_message_iter_get_uint32), (dbus_message_iter_get_double), + (decode_header_data), (_dbus_message_loader_return_buffer), + (message_iter_test), (_dbus_message_test): + * dbus/dbus-message.h: + * dbus/dbus-protocol.h: + * dbus/dbus-test.c: (main): + * dbus/dbus-test.h: + * glib/test-dbus-glib.c: (message_handler), (main): + * test/echo-client.c: (main): + * test/watch.c: (check_messages): + Make messages sendable and receivable for real. + +2003-01-07 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_double), + (_dbus_marshal_string), (_dbus_marshal_byte_array): + * dbus/dbus-message.c: (dbus_message_append_int32), + (dbus_message_append_uint32), (dbus_message_append_double), + (dbus_message_append_string), (dbus_message_append_byte_array): + Handle OOM restoration. + +2003-01-07 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_string), + (_dbus_demarshal_string), (_dbus_marshal_test): + * dbus/dbus-marshal.h: + * dbus/dbus-message.c: (dbus_message_get_name), + Document these functions. + + (dbus_message_append_int32), (dbus_message_append_uint32), + (dbus_message_append_double), (dbus_message_append_string), + (dbus_message_append_byte_array): + * dbus/dbus-message.h: + Add functions for adding message fields of different types. + + * dbus/dbus-protocol.h: + Add the different types. + +2003-01-05 Havoc Pennington <hp@pobox.com> + + * bus/connection.c: implement routines for handling connections, + first thing is keeping a list of owned services on each connection + and setting up watches etc. + + * bus/services.c: implement a mapping from service names to lists + of connections + + * dbus/dbus-hash.c: add DBUS_HASH_POINTER + + * dbus/dbus-threads.c (dbus_static_mutex_lock): add functions + to use static mutexes for global data + + * dbus/dbus-connection.c (dbus_connection_set_data): add new + collection of functions to set/get application-specific data + on the DBusConnection. + +2003-01-04 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-sysdeps.c (_dbus_sleep_milliseconds): new function + (_dbus_poll): new function + + * dbus/dbus-internals.h (_DBUS_STRUCT_OFFSET): new macro + copied from GLib + + * bus/loop.c: initial code for the daemon main loop + +2003-01-04 Havoc Pennington <hp@pobox.com> + + * test/watch.c (error_handler): make it safe if the error handler + is called multiple times (if we s/error handler/disconnect + handler/ we should just guarantee it's called only once) + + * dbus/dbus-transport.c (_dbus_transport_disconnect): call the + error handler on disconnect (it's quite possible we should + just change the error handler to a "disconnect handler," I'm + not sure we have any other meaningful errors) + + * configure.in: check for getpwnam_r + + * dbus/dbus-transport.c, dbus/dbus-transport-unix.c, + dbus/dbus-auth.c: add credentials support, add EXTERNAL auth + mechanism as in SASL spec, using socket credentials + + * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): new function + (_dbus_send_credentials_unix_socket): new function + + * dbus/dbus-sysdeps.c (_dbus_accept_unix_socket): rename just + dbus_accept() + (_dbus_write): only check errno if <0 returned + (_dbus_write_two): ditto + +2003-01-02 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_utf8_string), + (_dbus_marshal_byte_array), (_dbus_demarshal_utf8_string), + (_dbus_marshal_test): + * dbus/dbus-marshal.h: + Add _dbus_marshal_byte_array and rename _dbus_marshal_string + to _dbus_marshal_utf8_string. Also fix some tests. + +2002-12-28 Harri Porten <porten@kde.org> + + * configure.in: added check for C++ compiler and a very cheesy + check for the Qt integration + + * Makefile.am (SUBDIRS): compile qt subdir if support is enabled + + * qt/Makefile.am: added + + * qt/.cvsignore: added + + * qt/dbus-qthread.cc, qt/dbus-qthread.cpp: renamed former to + latter, added #ifdef QT_THREAD_SUPPORT guard. + + * dbus/Makefile.am: added missing headers for make dist + +2002-12-28 Kristian Rietveld <kris@gtk.org> + + * dbus/Makefile.am: fixup export-symbols-regex. + +2002-12-27 Anders Carlsson <andersca@codefactory.se> + + * acinclude.m4: Add this file and put the + PKG_CHECK_MODULE macro in it. + +2002-12-27 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_string), + (_dbus_demarshal_double), (_dbus_demarshal_int32), + (_dbus_demarshal_uint32), (_dbus_demarshal_string), + (_dbus_marshal_test): + Make the demarshalling routines align the pos argument. + Add string marshalling tests and fix the obvious bugs + discovered. + +2002-12-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-auth.c: fixes fixes fixes + + * dbus/dbus-transport-unix.c: wire up support for + encoding/decoding data on the wire + + * dbus/dbus-auth.c (_dbus_auth_encode_data) + (_dbus_auth_decode_data): append to target string + instead of nuking it. + +2002-12-26 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-marshal.h (DBUS_COMPILER_BYTE_ORDER): #ifdef + WORDS_BIGENDIAN then compiler byte order is DBUS_BIG_ENDIAN, + doh + + * dbus/dbus-marshal.c: Add macros to do int swapping in-place and + avoid swap_bytes() overhead (ignoring possible assembly stuff for + now). Main point is because I wanted unpack_uint32 to implement + _dbus_verbose_bytes + (_dbus_verbose_bytes): new function + + * dbus/dbus-string.c (_dbus_string_validate_ascii): new function + + * dbus/dbus-message.c (_dbus_message_loader_get_is_corrupted): add + mechanism to handle a corrupt message stream + (_dbus_message_loader_new): fix preallocation to only prealloc, + not prelengthen + + * dbus/dbus-string.c (_dbus_string_skip_blank): fix this function + (_dbus_string_test): enhance tests for copy/move and fix the + functions + + * dbus/dbus-transport-unix.c: Hold references in more places to + avoid reentrancy problems + + * dbus/dbus-transport.c: ditto + + * dbus/dbus-connection.c (dbus_connection_dispatch_message): don't + leak reference count in no-message case + + * test/watch.c (do_mainloop): handle adding/removing watches + during iteration over the watches. Also, ref the connection/server + stored on a watch, so we don't try to mangle a destroyed one. + + * dbus/dbus-transport-unix.c (do_authentication): perform + authentication + + * dbus/dbus-auth.c (get_state): add a state + AUTHENTICATED_WITH_UNUSED_BYTES and return it if required + (_dbus_auth_get_unused_bytes): append the unused bytes + to the passed in string, rather than prepend + + * dbus/dbus-transport.c (_dbus_transport_init_base): create + the auth conversation DBusAuth + + * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd) + (_dbus_transport_new_for_domain_socket): when creating a + transport, pass in whether it's a client-side or server-side + transport so we know which DBusAuth to create + +2002-12-03 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-transport-unix.c (unix_finalize): finalize base + _after_ finalizing the derived members + (unix_connection_set): unref watch if we fail to add it + + * dbus/dbus-connection.c (dbus_connection_unref): delete the + transport first, so that the connection owned by the + transport will be valid as the transport finalizes. + + * dbus/dbus-transport-unix.c (unix_finalize): free the write_watch + if necessary, and remove watches from the connection. + + * dbus/dbus-watch.c (_dbus_watch_list_free): improve a comment + +2002-12-26 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-marshal.c: (_dbus_marshal_string), + (_dbus_demarshal_double), (_dbus_demarshal_int32), + (_dbus_demarshal_uint32), (_dbus_demarshal_string), + (_dbus_marshal_test): + * dbus/dbus-marshal.h: + Add string marshal functions and have the demarshal functions + return the new position. + +2002-12-25 Havoc Pennington <hp@pobox.com> + + * doc/dbus-sasl-profile.txt: docs on the authentication protocol, + it is a simple protocol that just maps directly to SASL. + + * dbus/dbus-auth.h, dbus/dbus-auth.c: authentication protocol + initial implementation, not actually used yet. + + * dbus/dbus-string.c (_dbus_string_tqfind): new function + (_dbus_string_equal): new function + (_dbus_string_base64_encode): new function + (_dbus_string_base64_decode): new function + +2002-12-25 Anders Carlsson <andersca@codefactory.se> + + * dbus/Makefile.am: + * dbus/dbus-marshal.c: (swap_bytes), (_dbus_marshal_double), + (_dbus_marshal_int32), (_dbus_marshal_uint32), + (_dbus_demarshal_double), (_dbus_demarshal_int32), + (_dbus_demarshal_uint32), (_dbus_marshal_test): + * dbus/dbus-marshal.h: + * dbus/dbus-protocol.h: + * dbus/dbus-test.c: (main): + * dbus/dbus-test.h: + Add un-optimized marshalling/demarshalling routines. + +2002-12-25 Harri Porten <porten@kde.org> + + * qt/dbus-qt.h: adjusted ctor and getter to KDE/Qt conventions + +2002-12-24 Zack Rusin <zack@kde.org> + + * qt/dbus-qthread.cc: adding - integrates QMutex into Dbus + * qt/dbus-qt.h: skeleton with two sample implemenatation of the + main loop stuff + +2002-12-24 Havoc Pennington <hp@pobox.com> + + * glib/dbus-gthread.c: fix include + + * glib/dbus-glib.h: rename DBusMessageHandler for now. + I think glib API needs to change, though, as you don't + want to use DBusMessageFunction, you want to use the + DBusMessageHandler object. Probably + dbus_connection_open_with_g_main_loop() + and dbus_connection_setup_g_main_loop() or something like that + (but think of better names...) that just create a connection + that has watch/timeout functions etc. already set up. + + * dbus/dbus-connection.c + (dbus_connection_send_message_with_reply): new function just to + show how the message handler helps us deal with replies. + + * dbus/dbus-list.c (_dbus_list_remove_last): new function + + * dbus/dbus-string.c (_dbus_string_test): free a string that + wasn't + + * dbus/dbus-hash.c: use memory pools for the hash entries + (rebuild_table): be more paranoid about overflow, and + shrink table when we can + (_dbus_hash_test): reduce number of sprintfs and write + valid C89. Add tests for case where we grow and then + shrink the hash table. + + * dbus/dbus-mempool.h, dbus/dbus-mempool.c: memory pools + + * dbus/dbus-connection.c (dbus_connection_register_handler) + (dbus_connection_unregister_handler): new functions + + * dbus/dbus-message.c (dbus_message_get_name): new + + * dbus/dbus-list.c: fix docs typo + + * dbus/dbus-message-handler.h, dbus/dbus-message-handler.c: + an object representing a handler for messages. + +2002-12-16 Anders Carlsson <andersca@codefactory.se> + + * glib/dbus-glib.h: + * glib/dbus-gthread.c: (dbus_gthread_init): + Don't use the gdbus prefix for public functions. + +2002-12-16 Anders Carlsson <andersca@codefactory.se> + + * Makefile.am: + * configure.in: + Add GLib checks and fixup .pc files + + * glib/Makefile.am: + * glib/dbus-glib.h: + * glib/dbus-gmain.c: (gdbus_connection_prepare), + (gdbus_connection_check), (gdbus_connection_dispatch), + (gdbus_add_connection_watch), (gdbus_remove_connection_watch), + (dbus_connection_gsource_new): + * glib/dbus-gthread.c: (dbus_gmutex_new), (dbus_gmutex_free), + (dbus_gmutex_lock), (dbus_gmutex_unlock), (dbus_gthread_init): + * glib/test-dbus-glib.c: (message_handler), (main): + Add GLib support. + +2002-12-15 Harri Porten <porten@kde.org> + + * autogen.sh: check for libtoolize before attempting to use it + + * dbus/dbus-transport-unix.c: include <sys/time.h> for timeval + struct. + + * .cvsignore: ignore more stamp files + + * dbus/dbus-watch.c (_dbus_watch_list_new): fixed doc error + + * test/Makefile.am: added -I$(top_srcdir) to be able to compile + without make install. + +2002-12-15 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-threads.c: add thread stubs that a higher library + layer can fill in. e.g. the GLib wrapper might fill them in with + GThread stuff. We still need to use this thread API to + thread-safe-ize the library. + +2002-12-12 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-transport-unix.c, dbus/dbus-server-unix.c: use the + below new interfaces and include fewer system headers. + + * dbus/dbus-sysdeps.c (_dbus_read): new function + (_dbus_write): new function + (_dbus_write_two): new function + (_dbus_connect_unix_socket): new function + (_dbus_listen_unix_socket): new function + + * dbus/dbus-message-internal.h: change interfaces to use + DBusString + +2002-12-11 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-types.h: add dbus_unichar + + * dbus/dbus-internals.c (_dbus_verbose): use _dbus_getenv + + * dbus/dbus-connection.c (dbus_connection_send_message): return + TRUE on success + + * dbus/dbus-transport.c: include dbus-watch.h + + * dbus/dbus-connection.c: include dbus-message-internal.h + + * HACKING: add file with coding guidelines stuff. + + * dbus/dbus-string.h, dbus/dbus-string.c: Encapsulate all string + handling here, for security purposes (as in vsftpd). Not actually + using this class yet. + + * dbus/dbus-sysdeps.h, dbus/dbus-sysdeps.c: Encapsulate all + system/libc usage here, as in vsftpd, for ease of auditing (and + should also simplify portability). Haven't actually moved all the + system/libc usage into here yet. + +2002-11-25 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-internals.c (_dbus_verbose): fix to not + always print the first verbose message. + +2002-11-24 Havoc Pennington <hp@pobox.com> + + * test/echo-client.c, test/echo-server.c: cheesy test + clients. + + * configure.in (AC_CHECK_FUNCS): check for writev + + * dbus/dbus-message.c (_dbus_message_get_network_data): new + function + + * dbus/dbus-list.c (_dbus_list_foreach): new function + + * dbus/dbus-internals.c (_dbus_verbose): new function + + * dbus/dbus-server.c, dbus/dbus-server.h: public object + representing a server that listens for connections. + + * dbus/.cvsignore: create + + * dbus/dbus-errors.h, dbus/dbus-errors.c: + public API for reporting errors + + * dbus/dbus-connection.h, dbus/dbus-connection.c: + public object representing a connection that + sends/receives messages. (Same object used for + both client and server.) + + * dbus/dbus-transport.h, dbus/dbus-transport.c: + Basic abstraction for different kinds of stream + that we might read/write messages from. + +2002-11-23 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-internals.h (_DBUS_INT_MAX): add _DBUS_INT_MIN + _DBUS_INT_MAX + + * dbus/dbus-test.c (main): add list test, and include + dbus-test.h as intended + + * dbus/dbus-hash.c (_dbus_hash_table_remove_string) + (_dbus_hash_table_remove_int): return value indicates + whether the entry existed to remove + + * dbus/dbus-list.c: add linked list utility class, + with docs and tests + + * dbus/dbus-hash.c: add TODO item about shrinking the hash bucket + array sometimes. + +2002-11-23 Havoc Pennington <hp@pobox.com> + + * Doxyfile.in (INCLUDE_FILE_PATTERNS): expand DBUS_BEGIN_DECLS/ + DBUS_END_DECLS to nothing, that should fix this once and for all + + * Doxyfile.in (JAVADOC_AUTOBRIEF): set to YES + + * dbus/dbus-message.c, dbus/dbus-hash.c: + add some missing @brief + +2002-11-23 Havoc Pennington <hp@pobox.com> + + * dbus/dbus-message.h: put semicolons after DEBUG_BEGIN_DECLS + to avoid confusing Doxygen + + * dbus/dbus-hash.c: @} not }@ + + * dbus/dbus-message.c (struct DBusMessage): split out + internals docs + +2002-11-23 Havoc Pennington <hp@pobox.com> + + * configure.in: pile on more warning flags if using gcc + + * Doxyfile.in (EXTRACT_STATIC): set to NO, so we don't have + to document static functions + + * configure.in: add summary to end of configure so it + looks nice and attractive + + * dbus/dbus-hash.c: finish implementation and write unit + tests and docs + + * configure.in: add --enable-tests to enable unit tests + + * dbus/dbus-test.c: test program to run unit tests + for all files in dbus/*, initially runs a test for + dbus-hash.c + + * dbus/dbus-internals.h: file to hold some internal utility stuff + +2002-11-22 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-hash.c: copy in Tcl hash table, not yet + "ported" away from Tcl + + * dbus/dbus-types.h: header for types such as dbus_bool_t + +2002-11-22 Havoc Pennington <hp@redhat.com> + + * dbus/dbus.h: fixups for doc warnings + + * Doxyfile.in (FILE_PATTERNS): we need to scan .h to pick up + macros + (QUIET): make it quiet so we can see warnings + + * dbus/dbus-memory.c: teach D-BUS to allocate and free memory + +2002-11-22 Havoc Pennington <hp@redhat.com> + + * Makefile.am: include "Doxyfile" target in all-local + + * configure.in: generate the Doxyfile + + * Doxyfile.in: move Doxyfile here, so we can use + configure to generate a Doxyfile with the right + version number etc. + +2002-11-22 Havoc Pennington <hp@redhat.com> + + * dbus/dbus-message.c: move inline docs into .c file + + * Doxyfile (OUTPUT_DIRECTORY): move output to doc/api + so all docs are under doc/ + (MAN_EXTENSION): generate man pages. Use extension + ".3dbus" which matches ".3qt" on my system, + I guess this is OK, I don't know really. + (FILE_PATTERNS): look for .c files not .h, makes sense + for plain C I think + +2002-11-22 Havoc Pennington <hp@pobox.com> + + * Makefile.am (SUBDIRS): rename subdir "server" to "bus" + because any app can be a server, and any app can be a client, + the bus is a special kind of server. + +Thu Nov 21 23:35:31 2002 Zack Rusin <zack@kde.org> + + * Doxyfile : adding. Still needs Makefile rules to be generated + automatically (just run "doxygen" in the toplevel dir for now to + generate docs) + + * dbus/dbus-message.h : Adding sample docs (javadoc since + resembles gtk-doc a little more) + + * dbus/dbus.h : Adding sample docs + +2002-11-21 Havoc Pennington <hp@redhat.com> + + * dbus/Makefile.am (INCLUDES): define DBUS_COMPILATION + so we can allow ourselves to include files directly, + instead of having to use dbus.h + + * dbus/dbus.h: fill in + + * dbus/dbus-message.h: sketch out a sample header file. + Include griping if you include it directly instead of + via dbus.h + + * dbus/dbus-macros.h: new file with macros for extern "C", + TRUE/FALSE, NULL, etc. + + * doc/file-boilerplate.c: put include guards in here + +2002-11-21 Havoc Pennington <hp@redhat.com> + + * doc/file-boilerplate.c: include both AFL and GPL boilerplate. + + * COPYING: include the GPL as well, and license code + under both AFL and GPL. + +2002-11-21 Havoc Pennington <hp@redhat.com> + + * acconfig.h: get rid of this + + * autogen.sh (run_configure): add --no-configure option + + * configure.in: remove AC_ARG_PROGRAM to make + autoconf complain less. add AC_PREREQ. + add AC_DEFINE third arg. + +2002-11-21 Anders Carlsson <andersca@codefactory.se> + + * doc/Makefile.am: + Fix references so we can distcheck. + +2002-11-21 Havoc Pennington <hp@redhat.com> + + * Initial module creation + diff --git a/main/dependencies/dbus-tqt-1/ConfigureChecks.cmake b/main/dependencies/dbus-tqt-1/ConfigureChecks.cmake new file mode 100644 index 000000000..a1722491b --- /dev/null +++ b/main/dependencies/dbus-tqt-1/ConfigureChecks.cmake @@ -0,0 +1,22 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# dbus-1 +pkg_search_module( DBUS dbus-1 ) +if( NOT DBUS_FOUND ) + tde_message_fatal( "dbus-1 is required, but was not found on your system" ) +endif( ) + +# qt3 +find_package( Qt ) + +# tqt +find_package( TQt ) diff --git a/main/dependencies/dbus-tqt-1/HACKING b/main/dependencies/dbus-tqt-1/HACKING new file mode 100644 index 000000000..d94783ba2 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/HACKING @@ -0,0 +1,200 @@ +The guidelines in this file are the ideals; it's better to send a +not-fully-following-guidelines patch than no patch at all, though. We +can always polish it up. + +Mailing list +=== + +The D-BUS mailing list is message-bus-list@freedesktop.org; discussion +of patches, etc. should go there. + +Security +=== + +Most of D-BUS is security sensitive. Guidelines related to that: + + - avoid memcpy(), sprintf(), strlen(), snprintf, strlcat(), + strstr(), strtok(), or any of this stuff. Use DBusString. + If DBusString doesn't have the feature you need, add it + to DBusString. + + There are some exceptions, for example + if your strings are just used to index a hash table + and you don't do any parsing/modification of them, perhaps + DBusString is wasteful and wouldn't help much. But definitely + if you're doing any parsing, reallocation, etc. use DBusString. + + - do not include system headers outside of dbus-memory.c, + dbus-sysdeps.c, and other places where they are already + included. This gives us one place to audit all external + dependencies on features in libc, etc. + + - do not use libc features that are "complicated" + and may contain security holes. For example, you probably shouldn't + try to use regcomp() to compile an untrusted regular expression. + Regular expressions are just too complicated, and there are many + different libc's out there. + + - we need to design the message bus daemon (and any similar features) + to use limited privileges, run in a chroot jail, and so on. + +http://vsftpd.beasts.org/ has other good security suggestions. + +Coding Style +=== + + - The C library uses GNU coding conventions, with GLib-like + extensions (e.g. lining up function arguments). The + Qt wrapper uses KDE coding conventions. + + - Write docs for all non-static functions and structs and so on. try + "doxygen Doxyfile" prior to commit and be sure there are no + warnings printed. + + - All external interfaces (network protocols, file formats, etc.) + should have documented specifications sufficient to allow an + alternative implementation to be written. Our implementation should + be strict about specification compliance (should not for example + heuristically parse a file and accept not-well-formed + data). Avoiding heuristics is also important for security reasons; + if it looks funny, ignore it (or exit, or disconnect). + +Making a release +=== + +To make a release of D-BUS, do the following: + + - check out a fresh copy from CVS + + - verify that the libtool versioning/library soname is + changed if it needs to be, or not changed if not + + - update the file NEWS based on the ChangeLog + + - add a ChangeLog entry containing the version number + you're releasing ("Released 0.3" or something) + so people can see which changes were before and after + a given release. + + - "make distcheck" (DO NOT just "make dist" - pass the check!) + + - if make distcheck fails, fix it. + + - once distcheck succeeds, "cvs commit" + + - if someone else made changes and the commit fails, + you have to "cvs up" and run "make distcheck" again + + - once the commit succeeds, "cvs tag DBUS_X_Y_Z" where + X_Y_Z map to version X.Y.Z + + - bump the version number up in configure.in, and commit + it. Make sure you do this *after* tagging the previous + release! + + - scp your tarball to freedesktop.org server and copy it + to /srv/dbus.freedesktop.org/releases. This should + be possible if you're in group "dbus" + + - update the wiki page http://www.freedesktop.org/Software/dbus by + adding the new release under the Download heading. Then, cut the + link and changelog for the previous that was there. + + - update the wiki page + http://www.freedesktop.org/Software/DbusReleaseArchive pasting the + previous release. Note that bullet points for each of the changelog + items must be indented three more spaces to conform to the + formatting of the other releases there. + + - post to dbus@lists.freedesktop.org announcing the release. + + +Environment variables +=== + +These are the environment variables that are used by the D-BUS client library + +DBUS_VERBOSE=1 +Turns on printing verbose messages. This only works if D-BUS has been +compiled with --enable-verbose-mode + +DBUS_MALLOC_FAIL_NTH=n +Can be set to a number, causing every nth call to dbus_alloc or +dbus_realloc to fail. This only works if D-BUS has been compiled with +--enable-tests. + +DBUS_MALLOC_FAIL_GREATER_THAN=n +Can be set to a number, causing every call to dbus_alloc or +dbus_realloc to fail if the number of bytes to be allocated is greater +than the specified number. This only works if D-BUS has been compiled with +--enable-tests. + +DBUS_TEST_MALLOC_FAILURES=n +Many of the D-BUS tests will run over and over, once for each malloc +involved in the test. Each run will fail a different malloc, plus some +number of mallocs following that malloc (because a fair number of bugs +only happen if two or more mallocs fail in a row, e.g. error recovery +that itself involves malloc). This env variable sets the number of +mallocs to fail. +Here's why you care: If set to 0, then the malloc checking is skipped, +which makes the test suite a heck of a lot faster. Just run with this +env variable unset before you commit. + +Tests +=== + +These are the test programs that are built if dbus is compiled using +--enable-tests. + +dbus/dbus-test +This is the main unit test program that tests all aspects of the D-BUS +client library. + +dbus/bus-test +This it the unit test program for the message bus. + +test/break-loader +A test that tries to break the message loader by passing it randomly +created invalid messages. + +"make check" runs all the deterministic test programs (i.e. not break-loader). + +"make check-coverage" is available if you configure with --enable-gcov and +gives a complete report on test suite coverage. You can also run +"test/decode-gcov foo.c" on any source file to get annotated source, +after running make check with a gcov-enabled tree. + +Patches +=== + +Please file them at http://bugzilla.freedesktop.org under component +dbus, and also post to the mailing list for discussion. The commit +rules are: + + - for fixes that don't affect API or protocol, they can be committed + if any one qualified reviewer other than patch author + reviews and approves + + - for fixes that do affect API or protocol, two people + in the reviewer group have to review and approve the commit, and + posting to the list is definitely mandatory + + - if there's a live unresolved controversy about a change, + don't commit it while the argument is still raging. + + - regardless of reviews, to commit a patch: + - make check must pass + - the test suite must be extended to cover the new code + as much as reasonably feasible + - the patch has to follow the portability, security, and + style guidelines + - the patch should as much as reasonable do one thing, + not many unrelated changes + No reviewer should approve a patch without these attributes, and + failure on these points is grounds for reverting the patch. + +The reviewer group that can approve patches: Havoc Pennington, Michael +Meeks, Alex Larsson, Zack Rusin, Joe Shaw, Mikael Hallendal, Richard +Hult, Owen Fraser-Green, Olivier Andrieu, Colin Walters. + + diff --git a/main/dependencies/dbus-tqt-1/INSTALL b/main/dependencies/dbus-tqt-1/INSTALL new file mode 100644 index 000000000..c6c0cd9c0 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/INSTALL @@ -0,0 +1,294 @@ + DBus Installation + ================= + +Quick start +=========== + +DBus uses GNU AutoTools for its build system, thus the basic install +procedure can be summarized as: + + ./configure --prefix=/usr + make + su make install + +The configure script will automatically determine whether to try and +build bindings for GLib, Qt, Qt3, Python and Mono based on what tools +are installed on the host system. The default build behaviour can be +overridden using the --enable-XXX/--disable-XXX arguments to configure. +A typical scenario in which it is desirable to override automatic +detection, is during packaging of binary builds, where a predictable +dependancy chain is required. For more details on GNU AutoTools +installation, consult the generic instructions later in this document + +External software dependancies +============================== + +The only fundamental requirement to build DBus is an XML parser, +however, there are a number of other software packages which (if +present) will enhance functionality. + +Core library +------------ + + Requisite: + + - Gettext + - expat or libxml-2 + + NB, expat is the recommended XML parser because it has more robust + handling of OOM conditions. + + Optional: + + - libselinux (for SELinux integration) + - dnotify (for automatic service file reload) + - doxygen (for API documentation) + - xmlto (for Spec & other XML documentation) + +GLib Bindings +------------- + + Requisite: + + - GLib >= 2.4 + + Optional: + + - GTK+ >= 2.4 (for dbus-viewer tool) + +Qt Bindings +----------- + + Requisite: + + - QtCore and QtXml >= 4.1.3 + + Optional: + + - QtTest (for Qt Unit tests) + - QtGui >= 4.1.3 (for the chat example program) + +Note: Qt 4.1.3 is not available in released form. You need to download +the 4.1.3 snapshots from Trolltech. However, the Qt binding compiles +and works in Qt 4.1.2, but not the dbusidl2cpp tool. + +Note that DBus detects QtCore and QtXml during the configure process +using pkg-config. You may need to set the PKG_CONFIG_PATH to include +the Qt4 library directory. If you don't have your Qt4 installed, then +you may also need to use the --with-qt-tqmoc directive to point to the +Qt4 tqmoc executable (e.g. $QTDIR/bin/tqmoc). + + +Qt 3 Bindings +------------- + + Requisite: + + - Qt >= 3.1 + +Mono Bindings +------------- + + Requisite: + + - Mono >= 0.95 + + Optional: + + - MonoDoc >= 0.16 (for API documentation) + +Python Bindings +--------------- + + Requisite: + + - Python >= 2.4 + - Pyrex + +==================================================================== + +The rest of this document tqcontains the generic GNU AutoTools install +insructions.... + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +tqcontains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory tqlayout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +tqfind the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/main/dependencies/dbus-tqt-1/NEWS b/main/dependencies/dbus-tqt-1/NEWS new file mode 100644 index 000000000..89a878f58 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/NEWS @@ -0,0 +1,504 @@ +D-BUS 0.62 (12 June 2006) +== +- Doc fixes +- Added support for all data-types for the dbus tools +- Fixed eavesdropping on method calls (dbus-monitor) +- Fixed silent dropping of method calls with interface=NULL +- Fixed console ownership problems in Solaris +- Fixed installation of dbus-signature.h and #include it in dbus/dbus.h +- Flush the user database cache on config reload +- GLib bindings: + - Fix memory leaks + - Fix properties in DBusGProxy so that they can be given in any + order + - Added lots of assertions to ensure correct use + - Remove duplicated code + - Fix static string pointer uses in GPtrArray-based collections +- Python bindings: + - Remove reference to sys/cdefs.h +- Qt4 bindings: + - Code reorganized + - Added the dbusidl2cpp, dbuscpp2xml and dbus tools + - Added example programs (ping-pong, complex ping-pong, listnames, chat) + - Updated selftests + - Fixed compilation and .tqmoc- and .ui-file processing and cleaning + - Made central classes derive from QObject + - Enhance error reporting + - Many bugfixes +- Mono bindings: + - Minor bugfixes + +D-BUS 0.61 (24 Febuary 2006) +== +- Documentation all around +- dbus-launch now produces correct sh and csh syntax +- Nested arrays now work correctly +- GLib bindings: + - Inheriting from DBusGProxy is now possible + - GPtrArrays can now be marshalled + - org.freedesktop.DBus.GLib.ClientCSymbol annotation added + - Openning connections to arbitrary addresses now supported +- Python bindings: + - sender_keyword and path_keyword keywords added to signal listener API + - Byte types now demarshal to unsigned char + - calling methods now do the correct thing +- Qt bindings: + - both Qt3 and Qt4 bindings can be built at the same time + - Use the standard org.freedesktop.DBus.Method.NoReply annotation + for the "async" calls instead of creating one for us. +- Mono bindings: + - 64bit arch fixes +- Massive bug fixing all around + +D-BUS 0.60 (30 November 2005) +== + +- major ABI/API changes - sonames changed +- RequestName queuing behavior has changed (refer to dbus-specification) + - DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT has been removed and + DBUS_NAME_FLAG_ALLOW_REPLACEMENT has been added to the flags +- Q_SIGNALS emitted by the bus now show up in the introspect data +- auth EXTERNAL now supported on BSD varients +- ReleaseName method added to the bus to allow a service + to remove itself as owner of a bus name +- dbus_connection_read_write added for getting messages off the bus + in the absence of a mainloop +- Qt4 bindings added and the Qt3 bindings have been depricated +- python bindings: + - marshal using introspect data if available + - better exception handling and propigation + - private connections are now supported + - UTF-8 cleanups + - out_signature added to method decorators for specifying + how the return values should be marshaled + - sender_keyword added to method decorators for specifying + and argument to provide the unique name of the method caller + - async_callbacks added to method decorators + - multiple inheritance of classes now supported +- GLib bindings: + - respect NoReply annotations + - dbus_g_method_return_get_reply and dbus_g_method_return_send_reply + added to the lowlevel code for use when the dbus-glib marshalling + code is not adiquate +- numerous bug fixes all around + +D-BUS 0.50 (06 September 2005) +=== +This is a minor release from 0.36.2. The series number has changed +not because of any technical reasons but as an indication that we +are moving closer to 1.0. It is hoped that this will be the last +series to see major changes, most of which will be isolated to the +GLib and Python bindings, as we transition to concentrate more on +bug busting and code auditing. + +- D-Bus builds on the Cygwin platform +- Makefile cleanups +- Various bug fixes +- Optimization of the dbus object tree +- Memleaks and GIL crasher bugs have been fixed in the Python bindings + +D-BUS 0.36.2 (29 August 2005) +=== +- Security: Restrict other users from connecting to another users + session bus + +D-BUS 0.36.1 (24 August 2005) +=== +- Python Bindings: + - fixed to work with hal-tqdevice-manager + - For 64bit builds everything is installed to lib64/python2.4/ + since Python can't handle multilib + +D-BUS 0.36 (23 August 2005) +=== +- Maximum sized of cached messages have been reduced to 10K +- Match rules now allow matching on arguments inside the message +- introspect.xsl XSLT style sheet added for formatting introspection + data into XHTML for analysis +- Python bindings: + - now have working type objects for explicit + typecasting + - Variant type has been added + - Dictionaries, Variants and Arrays can all be passed the signiture or + type(s) of their tqchildren + - the optional timeout= keyword has been added when making method calls + - match on args has been implemented + - a .pth file has been added for dealing with libraries and python files + being in different directories such as in 64bit installs + - various bug fixes +- GLib bindings: + - deeply recursive types now supported + - many symbols are no longer exported as part of the public API + - various memleak and other bug fixes + +D-BUS 0.35.2 (17 July 2005) +=== +- Rename Unix Security Context to SELinux Security Context in API +- Fixed more dist errors that distcheck didn't pick up on +- Fixed various bugs in the python bindings that prevented them from working + +D-BUS 0.35.1 (16 July 2005) +=== +- Fixed dist error where python/dbus_bindings.pxd was being shipped + instead of dbus_bindings.pxd.in +- Use this instead of the 0.35 tarball + +D-BUS 0.35 (15 July 2005) +=== +- --with-dbus-user added to the configure scripts for configuring the + user the system bus runs on +- --with-console-auth-dir added to configure scripts for configuring the + directory to look in for console user locks +- service files for auto-starting D-Bus services now has the ability to pass + in command line arguments to the executable +- Huge auto-start bug squashed which caused some services not to start when + requested in rapid succession +- SE-Linux security contexts can now be appended to messages for inspection + by services that enforce their own security policies +- Colin says the GLib binding are ready for general consumption +- New GLib tutorial +- New GLib example code +- Python bindings are now version (0,42,0) +- Python bindings API has changed on the service side +- dbus.service has been split out as a seperate module +- dbus.service.Service is renamed to dbus.service.BusName +- dbus.service.Object has swapped the bus_name and object_path constructor + parameters to make it easier to do inheritance over the bus +- dbus.glib has been seperated out in order to lessen the dependency on glib + and to allow other mainloops to be integrated with the bindings including + a planned generic mainloop for non-gui apps. +- Python bindings now aquire the GIL when calling back into the python + interpreter. Fixes crashes when using threading and other random segfaults. +- New Python tutorial +- Numerous D-Bus bug fixes all around + +D-BUS 0.34 (15 June 2005) +=== +- dbus_connection_disconnect is deprecated in favor of dbus_connection_close +- The bus can now use D_NOTIFY (if available) to check when configuration files + have changed and reload them +- New dbus_message_has_path/member/interface API added +- The Ping message from the org.freedesktop.DBus.Peer interface is now handled +- Complete glib bindings overhaul (and are still under construction) +- Tutorial now has an updated GLib section +- GLib bindings can now send/receive hash tables, arrays and other complex types +- Python bindings overhaul (most public facing API's done) +- Python bindings have been split up into separate files +- Python added new type classes for hinting to the marshaler what type + to send over the wire +- Python bindings now have decorators for specifying exported methods and Q_SIGNALS +- Numerous bug fixes + +D-BUS 0.33 (25 Apr 2005) +=== + +- downgrade requirement from GTK+-2.6 to 2.4 for building gtk components +- python binding API's have been overhalled to be more "pythonic" and cleaner +- python bindings now export dbus.version which is set to (0,40,0) +- python bindings now implement the org.freedesktop.DBus.Introspectable interface +- python binding match rules are now more flexable +- make check has been fixed +- many, many major bug fixes + +D-BUS 0.32 (29 Mar 2005) +=== + +- mono bindings now compiles correctly +- mono binding cleanups +- glib bindings generates wrappers for bus methods in dbus-glib-bindings.h +- glib binding cleanus +- users and groups can now be specified by UID and GID in config files +- numerous memory leak fixes +- various other fixes + +D-BUS 0.31 (07 Mar 2005) +=== + +- land the new message args API and recursive type system +- add docs and fixed Doxygen warnings throught source +- split out some functions not needed in libdbus to *-util.c source files +- take out type convienience functions +- libdbus now back below 150K +- booleans are now 32-bit instead of 8-bit +- specification updated +- grand renaming to strip out the use of "service" + just say "name" instead (or "bus name" when ambiguous) +- rename dbus-daemon-1 to dbus-daemon throughout +- rename activation to auto-start +- auto-start on by default now +- note that libdbus is the low-level API +- python bindings updated to the new API +- mono bindings updated to the new API +- add 16 bit types +- dictionaries are now ARRAYS of DICT_ENTRY +- dbus-glib-tool renamed to dbus-binding-tool +- massive rewrite of the glib bindings +- saner names for the dbus interface, object path and service defines +- new functions for handling type signitures +- bump sonames for libdbus and libdbus-glib +- various small fixes + +D-BUS 0.23 (11 Jan 2005) +=== + +- add setgroups() to drop supplementary groups +- updated SELinux support +- add an "at console" security policy +- fix a bug where org.freedesktop.DBus wasn't recognized as an existing + service. +- error out if --enable-mono is explicitly set and mono libs can't be found +- set the max_match_rules_per_connection limit from the config file. +- removed dbus_bug_get_with_g_main since it's been tqreplaced by + dbus_g_bus_get +- fix fd leaks in socket code +- lots and lots of mono binding updates, including fixes to make it + compatible with Mono 1.1.3 +- added --nofork option to override config file setting at runtime +- added support for int64 and uint64 to the python bindings +- lots of python binding updates +- config file DTD updates +- use SerivceOwnerChanges signal instead of ServiceCreated and + ServiceDeleted +- fixes to the authentication code +- new init script for Slackware +- print out the pid even when --fork is passed +- increase preallocation sizes in DBusMessage to heavily reduce + reallocs +- lots of performance enhancements +- lots more small bug fixes + +D-BUS 0.22 +=== + +- add --reply-timeout to dbus-send +- fix a memleak +- fix Solaris/Forte build +- switch to AFL 2.1 rather than 2.0 to address patent termination clause + concerns +- add SELinux support +- mostly repair libxml backend for config parser, still doesn't + pass out of memory tests +- fix distcheck to include language bindings +- add GetConnectionUnixUser method on bus driver +- also for UnixProcessID +- lots of Python, Mono, other binding fixes +- change GLib bindings to not include dbus/dbus.h (fully encapsulate libdbus) +- pass paths as strings, not arrays of string +- add message signature header field +- cleanups to marshaling code +- clean up authentication code +- reload conf files on SIGHUP +- rename SERVICE/SENDER_SERVICE to DESTINATION/SENDER +- fix circular conf file inclusion +- allow empty arrays +- tons of other small bugfixes + +D-BUS 0.21 +=== + +- implement "auto activation" flag on messages, so the destination + service can be launched automatically +- fix a bug in custom type marshaling +- optimize case where multiple apps activate the same service + (avoid "thundering herd") +- add dynamic service file discovery/reloading +- fix a busy loop when blocking for a reply +- fix a 64-bit crash involving varargs +- fix a bus crash when processing an AcquireService +- allow appending TYPE_BYTE via append_args_valist +- fix dicts-inside-dicts +- enhancements to Python and Qt bindings + +D-BUS 0.20 +=== + +This release lands some very large API changes and numerous bugfixes. +The list of changes is too large to fully document here; please refer +to the documentation, and message-bus-list archives. + +D-BUS 0.13 +=== + +This is probably the last release before landing the large API changes +on the "dbus-object-names" branch. + +- fix system bus to always use filesystem socket; anyone + can create any abstract socket, which isn't secure + since if you can crash the system bus you'd be able + to tqreplace it. +- add DTD for configuration file +- improve specification a bit + +D-BUS 0.12 +=== + +- fix "service messagebus status" on Red Hat +- fix demarshaling of DBUS_TYPE_NAMED +- fix "eval `dbus-launch --exit-with-session`" to exit properly +- fix build without --prefix +- useless fooling with Mono bindings +- useless fooling with gcj bindings +- fix srcdir != builddir +- fix various compiler warnings and other issues +- add get/set data to DBusMessage +- fix headers for C++ +- OS X build fixes +- abstract domain sockets support (Linux only) +- add dbus-cleanup-sockets utility for people + not using linux +- be consistent about defaulting to --session/--system + with command line tools +- merge in policies from included config files +- fix build on non-x86 +- docs updates +- lots of other bugfixes + +D-BUS 0.11 +=== + +- add --enable-docs to turn off/on the docbook stuff + (doesn't cover doxygen stuff yet) +- make people define DBUS_API_SUBJECT_TO_CHANGE + and read warning in README so they don't + expect the API to be frozen already +- rename .pc files to "dbus-1.pc" instead of + "dbus-1.0.pc" etc. - this will require changing + pkg-config invocations +- some docs cleanups +- add man pages for all executables +- allow send to/from bus driver in the default system.conf +- fix user lookup bug +- implement dbus-launch to launch the session message bus +- fix some thread deadlocks +- some performance profiling/optimization +- add dbus_bus_activate_service() function +- fix some minor bugs here and there +- install Red Hat initscript in the right place + +D-BUS 0.10 +=== + +- reversed order of args to dbus_message_new() +- renamed dbus_message_name_is() and some other + functions +- change DBusWatch to have dbus_watch_handle() + similar to dbus_timeout_handle(), drop + connection/server-specific handle routines +- change message serials to be unsigned +- implemented <allow>/<deny>/<limit> features for + config file; system bus now has a deny-all policy + by default. +- system.conf has <includedir>system.d</includedir> + so packages can install additions to the default + policy to <allow> the messages they need. e.g. + CUPS might install a cups.conf - see + test/data/valid-config-files/system.d/test.conf + for an example. +- add timeouts for authentication, activation +- add glib-style "checks" on public API, enable + those by default, disable assertions by default +- add GMainContext argument to GLib setup functions, + can be NULL for default context. Needed for threads. +- add 64-bit integer type +- validate type of standard message header fields +- consider messages in the org.freedesktop.Local + namespace to be invalid (to avoid fake disconnect + messages for example) +- fix assorted memory leaks and other bugs in + the SHA-1 auth mechanism +- cache user database information (groups user is + in, etc.) helps a lot with NIS +- always store uid_t, pid_t, gid_t in "ulong" + rather than "int" +- implement config file settings for which + users can connect +- SHA-1 unit test +- dbus-send, dbus-monitor command line utilities +- fixed lots of misc crashes and other bugs + +D-BUS 0.9 +=== + +- implemented a test case for service activation, + and fixed many bugs exposed by that +- implemented recursive argument marshaling/demarshaling + for messages, allowing multidimensional arrays +- fixed up integration of message dispatch with + main loop by adding a callback on change of + dispatch status +- add a pidfile feature to daemon +- some build fixes +- clean up unix domain sockets on exit +- add --print-address and the ability + to create a random server address + in a temporary directory + +D-BUS 0.8 +=== + +- fix dumb bug in 0.7 + +D-BUS 0.7 +=== + +- implement configuration file used to control bus characteristics +- implement daemon mode, changing user ID, and other system + bus features +- add init scripts for systemwide bus +- add "make check-coverage" target to check test coverage +- more test suite additions +- many, many bugfixes +- many API changes/fixes + +D-BUS 0.6 +=== +- Vastly improved bus daemon test suite +- Lots of misc. bugfixes and memory leak fixes +- Support for marshalling key/value data +- Activation improvements. + +D-BUS 0.5 +=== + +- Specification updates +- port to OS X and other BSD variants +- port to Solaris +- Partial work on cookie-based authentication +- Thread safety fixes +- Lots of misc. bugfixes +- Support for more array types +- Add data Q_SLOTS to DBusServer +- DBusString security audit fixes +- Fix for systems (or valgrind) with unaligned malloc blocks + +D-BUS 0.4 +=== + +- Preliminary activation support. +- Better authentication test suite +- Bus test program +- Specification updates +- Thread safety +- Bug fixes + +D-BUS 0.3 +=== + + - Preliminary limitations + - Message sending works + - Bus client + - Array marshalling/demarshalling + - Services + - Better OOM handling in the bus + - In-proc debug transport + - Transport/server address support + +D-BUS 0.2 +=== + + - Include test code in the tarball. + +D-BUS 0.1 +=== + + - Initial release. diff --git a/main/dependencies/dbus-tqt-1/README b/main/dependencies/dbus-tqt-1/README new file mode 100644 index 000000000..9124927dc --- /dev/null +++ b/main/dependencies/dbus-tqt-1/README @@ -0,0 +1,101 @@ +D-BUS is a simple IPC library based on messages. + +See also the file HACKING for notes of interest to developers working on D-BUS. + +See http://www.freedesktop.org/software/dbus/ for lots of documentation, +mailing lists, etc. + +Note +=== + +A core concept of the D-BUS implementation is that "libdbus" is +intended to be a low-level API, similar to Xlib. Most programmers are +intended to use the bindings to GLib, Qt, Python, Mono, Java, or +whatever. These bindings have varying levels of completeness. + +Configuration flags +=== + +These are the dbus-specific configuration flags that can be given to +the ./configure program. + + --enable-qt enable Qt-friendly client library (note: Qt4) + --enable-qt-debug enable Qt-friendly client library, linked to debug + Qt libraries + --enable-qt3 enable Qt3-friendly client library + --enable-glib enable GLib-friendly client library + --enable-gtk enable GTK-requiring executables + --enable-tests enable unit test code + --enable-ansi enable -ansi -pedantic gcc flags + --enable-verbose-mode support verbose debug mode + --enable-asserts include assertion checks + --enable-checks include sanity checks on public API + --enable-xml-docs build XML documentation (requires xmlto) + --enable-doxygen-docs build DOXYGEN documentation (requires Doxygen) + --enable-gcov compile with coverage profiling instrumentation (gcc only) + --enable-abstract-sockets + use abstract socket namespace (linux only) + --enable-gcj build gcj bindings + --enable-mono build mono bindings + --enable-mono-docs build mono docs + --enable-python build python bindings + --enable-selinux build with SELinux support + --enable-dnotify build with dnotify support (linux only) + + --with-qt-tqmoc=<path> tqmoc for Qt + --with-qt3-tqmoc=<path> tqmoc for Qt3 + --with-xml=libxml/expat XML library to use + --with-init-scripts=redhat Style of init scripts to install + --with-session-socket-dir=dirname Where to put sockets for the per-login-session message bus + --with-test-socket-dir=dirname Where to put sockets for make check + --with-system-pid-file=pidfile PID file for systemwide daemon + --with-system-socket=filename UNIX domain socket for systemwide daemon + --with-console-auth-dir=dirname directory to check for console ownerhip + --with-dbus-user=<user> User for running the DBUS daemon (messagebus) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-tags[=TAGS] include additional configurations [automatic] + --with-x use the X Window System + + +API/ABI Policy +=== + +D-BUS API/ABI and protocol necessarily remain in flux until we are +sure it will meet the various needs it's intended to meet. This means +we need to see some significant sample usage in the contexts of GNOME, +KDE, desktop applications, and systemwide uses such as print queue +monitoring, hotplug events, or whatever. We need the flexibility to +incorporate feedback from this sample usage. + +Once we feel confident in the protocol and the API, we will release a +version 1.0. At that point, the intent is: + + - The protocol will never be broken again; any message bus should + work with any client forever. However, extensions are possible + where the protocol is extensible. + + - If the library API is modified incompatibly, we will rename it + as in http://ometer.com/parallel.html - in other words, + it will always be possible to compile against and use the older + API, and apps will always get the API they expect. + +Until 1.0 is released, feedback that requires API changes may be +incorporated into D-BUS. This may break the API, the ABI, the +protocol, or all three. + +To avoid a huge soname, the plan is to increment the soname only +between official stable releases, not with every development snapshot. +Versions numbered 0.x are considered development snapshots. + +Until 1.0 is released, you have to define -DDBUS_API_SUBJECT_TO_CHANGE +just as a safety check to be sure everyone is aware of this API/ABI +policy and has the right expectations. + +We do need people to test the APIs, so please do use the development +snapshots of D-BUS. They are intended to work and we do actively +address bugs. + +However, if you're shipping a commercial binary-only application that +needs to keep running on M future versions of N operating systems, you +might want to include your own copy of D-BUS rather than relying on +the installed copy, for example. diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/FindTDE.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/FindTDE.cmake new file mode 100644 index 000000000..ab7592d14 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/FindTDE.cmake @@ -0,0 +1,86 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( NOT TDE_FOUND ) + + message( STATUS "checking for 'TDE'") + + # if the path is not already defined by user, + # find kde-config executable + if( NOT DEFINED KDECONFIG_EXECUTABLE ) + find_program( KDECONFIG_EXECUTABLE + NAMES kde-config + HINTS ${BIN_INSTALL_DIR} ) + if( NOT KDECONFIG_EXECUTABLE ) + tde_message_fatal( "kde-config are NOT found." ) + endif( NOT KDECONFIG_EXECUTABLE ) + endif( NOT DEFINED KDECONFIG_EXECUTABLE ) + + # check for installed trinity version + execute_process( + COMMAND ${KDECONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE _version + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if( _result ) + tde_message_fatal( "Unable to run kde-config!\n KDELIBS are correctly installed?\n Path to kde-config are corect?" ) + endif( _result ) + + # parse kde-config output, to extract TDE version + string( REGEX MATCH "KDE: ([0-9\\.]+)" __dummy "${_version}" ) + set( TDE_VERSION "${CMAKE_MATCH_1}" ) + + # ask kde-config for few paths + macro( __internal_get_path __type __var ) + execute_process( + COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type} + OUTPUT_VARIABLE ${__var} + OUTPUT_STRIP_TRAILING_WHITESPACE ) + endmacro( __internal_get_path ) + + __internal_get_path( include TDE_INCLUDE_DIR ) + __internal_get_path( lib TDE_LIB_DIR ) + __internal_get_path( exe TDE_BIN_DIR ) + __internal_get_path( data TDE_DATA_DIR ) + __internal_get_path( config TDE_CONFIG_DIR ) + __internal_get_path( html TDE_HTML_DIR ) + __internal_get_path( cmake TDE_CMAKE_DIR ) + __internal_get_path( qtplugins TDE_QTPLUGINS_DIR ) + + # find kde tools + macro( __internal_find_program __prog __var ) + find_program( ${__var} + NAMES ${__prog} + HINTS ${TDE_BIN_INSTALL_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if( NOT ${__var} ) + tde_message_fatal( "${__prog} are NOT found.\n KDELIBS are correctly installed?" ) + endif( NOT ${__var} ) + endmacro( __internal_find_program ) + + __internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE ) + __internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE ) + __internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE ) + __internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE ) + __internal_find_program( kconfig_compiler KDE3_KCFGC_EXECUTABLE ) + __internal_find_program( makekdewidgets KDE3_MAKEKDEWIDGETS_EXECUTABLE ) + + # dcopidlng is a bash script which using kde-config; + # if PATH to kde-config is not set, dcopidlng will fail; + # for this reason we set KDECONFIG environment variable before running dcopidlng + set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE} + CACHE INTERNAL KDE3_DCOPIDLNG_EXECUTABLE FORCE ) + + message( STATUS " found 'TDE', version ${TDE_VERSION}" ) + +endif( NOT TDE_FOUND ) + +include( "${TDE_CMAKE_DIR}/kdelibs.cmake" ) diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/FindTQt.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/FindTQt.cmake new file mode 100644 index 000000000..ea351385e --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/FindTQt.cmake @@ -0,0 +1,81 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +macro( tqt_message ) + message( STATUS "${ARGN}" ) +endmacro( ) + +pkg_search_module( TQT tqt ) + +if( NOT TQT_FOUND ) + tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." ) +endif( ) + +# tmoc_executable +execute_process( + COMMAND pkg-config tqt --variable=tmoc_executable + OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( TMOC_EXECUTABLE ) + tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to tmoc is not set.\n tqt is correctly installed?" ) +endif( ) + + +# moc_executable +execute_process( + COMMAND pkg-config tqt --variable=moc_executable + OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( MOC_EXECUTABLE ) + tqt_message( " moc path: ${MOC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" ) +endif( ) + + +# uic_executable +execute_process( + COMMAND pkg-config tqt --variable=uic_executable + OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( UIC_EXECUTABLE ) + tqt_message( " uic path: ${UIC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to uic is not set.\n tqt is correctly installed?" ) +endif( ) + + +# check if tqt is usable +tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) +set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} ) +foreach( _dirs ${TQT_LIBRARY_DIRS} ) + list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" ) +endforeach() +list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} ) + +check_cxx_source_compiles(" + #include <tqapplication.h> + int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } " + HAVE_USABLE_TQT ) + +if( NOT HAVE_USABLE_TQT ) + tde_message_fatal( "Unable to build a simple tqt test." ) +endif( ) + +tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) + + +# TQT_CXX_FLAGS +foreach( _flag ${TQT_CFLAGS_OTHER} ) + set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" ) +endforeach() diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/TDEMacros.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/TDEMacros.cmake new file mode 100644 index 000000000..b99aa8088 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/TDEMacros.cmake @@ -0,0 +1,1237 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( KDE3Macros ) # we will need this module for a while + + +################################################# +##### +##### tde_message_fatal + +macro( tde_message_fatal ) + message( FATAL_ERROR + "#################################################\n" + " ${ARGV}\n" + "#################################################" ) +endmacro( tde_message_fatal ) + + +################################################# +##### +##### tde_install_icons( <icons...> THEME <svgicons> DESTINATION <destdir> ) +##### default theme: hicolor +##### default destination: ${SHARE_INSTALL_DIR}/icons + +macro( tde_install_icons ) + + # clearing + unset( _dest ) + unset( _req_theme ) + unset( _icons ) + set( _var _icons ) + + # parse all arguments + foreach( _arg ${ARGV} ) + # directive DESTINATION + if( _arg STREQUAL "DESTINATION" ) + set( _var _dest ) + set( _directive 1 ) + endif( _arg STREQUAL "DESTINATION" ) + # directive THEME + if( _arg STREQUAL "THEME" ) + set( _var _req_theme ) + set( _directive 1 ) + endif( _arg STREQUAL "THEME" ) + # collect data + if( _directive ) + unset( _directive ) + else( _directive ) + set( ${_var} ${${_var}} ${_arg} ) + set( _var _icons ) + endif( _directive ) + endforeach( _arg ) + + #defaults + if( NOT _icons ) + set( _icons "*" ) + endif( NOT _icons ) + if( NOT _dest ) + set( _dest "${ICON_INSTALL_DIR}" ) + endif( NOT _dest ) + + foreach( _icon ${_icons} ) + unset( _theme ) # clearing + + file(GLOB _icon_files *-${_icon}.png _icon_files *-${_icon}.svg* ) + foreach( _icon_file ${_icon_files} ) + # FIXME need a review + string( REGEX MATCH "^.*/([a-zA-Z][a-zA-Z])([0-9a-zA-Z]+)\\-([a-z]+)\\-(.+)$" _dummy "${_icon_file}" ) + set( _type "${CMAKE_MATCH_1}" ) + set( _size "${CMAKE_MATCH_2}" ) + set( _group "${CMAKE_MATCH_3}" ) + set( _name "${CMAKE_MATCH_4}" ) + + # we must ignore invalid icon names + if( _type AND _size AND _group AND _name ) + + # autodetect theme + if( NOT _req_theme ) + unset( _theme ) + if( "${_type}" STREQUAL "cr" ) + set( _theme crystalsvg ) + elseif( "${_type}" STREQUAL "lo" ) + set( _theme locolor ) + endif( "${_type}" STREQUAL "cr" ) + # defaulting + if( NOT _theme ) + set( _theme hicolor ) + endif( NOT _theme ) + else( NOT _req_theme ) + set( _theme ${_req_theme} ) + endif( NOT _req_theme ) + + # fix "group" name + if( "${_group}" STREQUAL "mime" ) + set( _group "mimetypes" ) + endif( "${_group}" STREQUAL "mime" ) + if( "${_group}" STREQUAL "filesys" ) + set( _group "filesystems" ) + endif( "${_group}" STREQUAL "filesys" ) + if( "${_group}" STREQUAL "device" ) + set( _group "devices" ) + endif( "${_group}" STREQUAL "device" ) + if( "${_group}" STREQUAL "app" ) + set( _group "apps" ) + endif( "${_group}" STREQUAL "app" ) + if( "${_group}" STREQUAL "action" ) + set( _group "actions" ) + endif( "${_group}" STREQUAL "action" ) + + if( "${_size}" STREQUAL "sc" ) + install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/scalable/${_group}/ RENAME ${_name} ) + else( "${_size}" STREQUAL "sc" ) + install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/${_size}x${_size}/${_group}/ RENAME ${_name} ) + endif( "${_size}" STREQUAL "sc" ) + + endif( _type AND _size AND _group AND _name ) + + endforeach( _icon_file ) + endforeach( _icon ) + +endmacro( tde_install_icons ) + + +################################################# +##### +##### tde_add_lut( <source> <result> [depends] ) +##### default depends: source + +macro( tde_add_lut _src _lut _dep ) + set( create_hash_table ${CMAKE_SOURCE_DIR}/kjs/create_hash_table ) + if( NOT _dep ) + set( _dep ${_src} ) + endif( NOT _dep ) + add_custom_command( OUTPUT ${_lut} + COMMAND perl ARGS ${create_hash_table} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} -i > ${_lut} + DEPENDS ${_src} ) + set_source_files_properties( ${_dep} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_lut} ) + unset( _dep ) +endmacro( tde_add_lut ) + + +################################################# +##### +##### tde_add_luts( <sources...> ) + +macro( tde_add_luts ) + foreach( _src ${ARGV} ) + get_filename_component( _lut ${_src} NAME_WE ) + set( _lut "${_lut}.lut.h" ) + tde_add_lut( ${_src} ${_lut} ${_src} ) + endforeach( _src ) +endmacro( tde_add_luts ) + + +################################################# +##### +##### tde_file_to_cpp( <source> <destination> <variable> ) + +macro( tde_file_to_cpp _src _dst _var ) + if( IS_ABSOLUTE ${_dst} ) + set( dst ${_dst} ) + else( ) + set( dst "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" ) + endif( ) + file( READ ${_src} text ) + string( REGEX REPLACE "\n" "\\\\n\"\n\"" text "${text}" ) + set( text "/* Generated by CMake */\n\nconst char *${_var} = \n\n\"${text}\";\n" ) + string( REGEX REPLACE "\n\"\";\n$" ";\n" text "${text}" ) + file( WRITE ${dst} "${text}" ) +endmacro( ) + + +################################################# +##### +##### tde_install_la_file( <target> <destination> ) + +macro( tde_install_la_file _target _destination ) + + get_target_property( _target_location ${_target} LOCATION ) + get_filename_component( _laname ${_target_location} NAME_WE ) + get_filename_component( _soname ${_target_location} NAME ) + set( _laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la ) + + file( WRITE ${_laname} +"# ${_laname} - a libtool library file, generated by cmake +# The name that we can dlopen(3). +dlname='${_soname}' +# Names of this library +library_names='${_soname} ${_soname} ${_soname}' +# The name of the static archive +old_library='' +# Libraries that this one depends upon. +dependency_libs='' +# Version information.\ncurrent=0\nage=0\nrevision=0 +# Is this an already installed library?\ninstalled=yes +# Should we warn about portability when linking against -modules?\nshouldnotlink=yes +# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen='' +# Directory that this library needs to be installed in: +libdir='${_destination}' +" ) + + install( FILES ${_laname} DESTINATION ${_destination} ) + +endmacro( tde_install_la_file ) + + +################################################# +##### +##### tde_add_ui_files + +macro( tde_add_ui_files _sources ) + foreach( _ui_file ${ARGN} ) + + get_filename_component( _ui_basename ${_ui_file} NAME_WE ) + get_filename_component( _ui_absolute_path ${_ui_file} ABSOLUTE ) + + list( APPEND ${_sources} ${_ui_basename}.cpp ) + + add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp + COMMAND ${CMAKE_COMMAND} + -DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE} + -DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR} + -DUI_FILE:FILEPATH=${_ui_absolute_path} + -P ${CMAKE_MODULE_PATH}/tde_uic.cmake + COMMAND ${MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp + DEPENDS ${_ui_absolute_path} ) + + endforeach( _ui_file ) +endmacro( tde_add_ui_files ) + + +################################################# +##### +##### tde_moc + +macro( tde_moc _sources ) + foreach( _input_file ${ARGN} ) + + get_filename_component( _input_file "${_input_file}" ABSOLUTE ) + get_filename_component( _basename ${_input_file} NAME_WE ) + set( _output_file "${_basename}.moc" ) + add_custom_command( OUTPUT ${_output_file} + COMMAND + ${TMOC_EXECUTABLE} ${_input_file} -o ${_output_file} + DEPENDS + ${_input_file} ) + list( APPEND ${_sources} ${_output_file} ) + + endforeach( ) +endmacro( ) + + +################################################# +##### +##### tde_automoc + +macro( tde_automoc ) + foreach( _src_file ${ARGN} ) + + get_filename_component( _src_file "${_src_file}" ABSOLUTE ) + + if( EXISTS "${_src_file}" ) + + # read source file and check if have moc include + file( READ "${_src_file}" _src_content ) + string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" ) + + # found included moc(s)? + if( _moc_includes ) + foreach( _moc_file ${_moc_includes} ) + + # extracting moc filename + string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" ) + set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" ) + + # create header filename + get_filename_component( _src_path "${_src_file}" ABSOLUTE ) + get_filename_component( _src_path "${_src_path}" PATH ) + get_filename_component( _src_header "${_moc_file}" NAME_WE ) + set( _header_file "${_src_path}/${_src_header}.h" ) + + # if header doesn't exists, check in META_INCLUDES + if( NOT EXISTS "${_header_file}" ) + unset( _found ) + foreach( _src_path ${_meta_includes} ) + set( _header_file "${_src_path}/${_src_header}.h" ) + if( EXISTS "${_header_file}" ) + set( _found 1 ) + break( ) + endif( ) + endforeach( ) + if( NOT _found ) + get_filename_component( _moc_file "${_moc_file}" NAME ) + tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_file}.h' not found." ) + endif( ) + endif( ) + + # moc-ing header + add_custom_command( OUTPUT ${_moc_file} + COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file} + DEPENDS ${_header_file} ) + + # create dependency between source file and moc file + set_property( SOURCE ${_src_file} APPEND PROPERTY OBJECT_DEPENDS ${_moc_file} ) + + endforeach( _moc_file ) + + endif( _moc_includes ) + + endif( EXISTS "${_src_file}" ) + + endforeach( _src_file ) +endmacro( tde_automoc ) + + +################################################# +##### +##### __tde_internal_process_sources + +macro( __tde_internal_process_sources _sources ) + + unset( ${_sources} ) + + foreach( _arg ${ARGN} ) + get_filename_component( _ext ${_arg} EXT ) + get_filename_component( _name ${_arg} NAME_WE ) + get_filename_component( _path ${_arg} PATH ) + + # if not path, set it to "." + if( NOT _path ) + set( _path "./" ) + endif( NOT _path ) + + # handle .ui files + if( ${_ext} STREQUAL ".ui" ) + tde_add_ui_files( ${_sources} ${_arg} ) + + # handle .skel files + elseif( ${_ext} STREQUAL ".skel" ) + kde3_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) + + # handle .stub files + elseif( ${_ext} STREQUAL ".stub" ) + kde3_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) + + # handle .kcfgc files + elseif( ${_ext} STREQUAL ".kcfgc" ) + kde3_add_kcfg_files( ${_sources} ${_arg} ) + + # handle any other files + else( ${_ext} STREQUAL ".ui" ) + list(APPEND ${_sources} ${_arg} ) + endif( ${_ext} STREQUAL ".ui" ) + endforeach( _arg ) + +endmacro( __tde_internal_process_sources ) + + +################################################# +##### +##### tde_install_libtool_file + +macro( tde_install_libtool_file _target _destination ) + + get_target_property( _target_location ${_target} LOCATION ) + + # get name of target + get_filename_component( _name ${_target_location} NAME_WE ) + + # get .la name + set( _laname ${_name}.la ) + + # get .so name + get_filename_component( _soname ${_target_location} NAME ) + + # get version of target + get_target_property( _target_version ${_target} VERSION ) + get_target_property( _target_soversion ${_target} SOVERSION ) + + # we have so version + if( _target_version ) + set( _library_name_1 "${_soname}.${_target_version}" ) + set( _library_name_2 "${_soname}.${_target_soversion}" ) + set( _library_name_3 "${_soname}" ) + + string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_target_version}" ) + set( _version_current "${CMAKE_MATCH_1}" ) + set( _version_age "${CMAKE_MATCH_2}" ) + set( _version_revision "${CMAKE_MATCH_3}" ) + + # we have no so version (module?) + else( _target_version ) + set( _library_name_1 "${_soname}" ) + set( _library_name_2 "${_soname}" ) + set( _library_name_3 "${_soname}" ) + set( _version_current "0" ) + set( _version_age "0" ) + set( _version_revision "0" ) + endif( _target_version ) + + if( IS_ABSOLUTE ${_destination} ) + set( _libdir "${_destination}" ) + else( IS_ABSOLUTE ${_destination} ) + set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" ) + endif( IS_ABSOLUTE ${_destination} ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_libtool_file.cmake "${_laname}" @ONLY ) + + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} ) + +endmacro( tde_install_libtool_file ) + + +################################################# +##### +##### tde_install_export / tde_import + +function( tde_install_export ) + file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake ) + + set( mode "WRITE" ) + foreach( filename ${export_files} ) + file( READ ${filename} content ) + file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" ) + set( mode "APPEND" ) + endforeach( ) + + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} ) +endfunction( ) + + +macro( tde_import _library ) + message( STATUS "checking for '${_library}'" ) + string( TOUPPER "BUILD_${_library}" _build ) + if( ${_build} ) + message( STATUS " ok, activated for build" ) + else() + if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" ) + include( "${TDE_CMAKE_DIR}/${_library}.cmake" ) + message( STATUS " ok, found import file" ) + else() + tde_message_fatal( "'${_library}' are required,\n but is not installed nor selected for build" ) + endif() + endif() +endmacro() + + +################################################# +##### +##### tde_add_library + +macro( tde_add_library _arg_target ) + + unset( _target ) + unset( _type ) + unset( _static_pic ) + unset( _automoc ) + unset( _meta_includes ) + unset( _no_libtool_file ) + unset( _no_export ) + unset( _version ) + unset( _sources ) + unset( _destination ) + unset( _embed ) + unset( _link ) + unset( _dependencies ) + unset( _storage ) + + set( _shouldnotlink no ) + + foreach( _arg ${ARGV} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found one of directives: "SHARED", "STATIC", "MODULE" + if( "${_arg}" STREQUAL "SHARED" OR "${_arg}" STREQUAL "STATIC" OR "${_arg}" STREQUAL "MODULE" ) + set( _skip_store 1 ) + set( _type "${_arg}" ) + endif( "${_arg}" STREQUAL "SHARED" OR "${_arg}" STREQUAL "STATIC" OR "${_arg}" STREQUAL "MODULE" ) + + # found directive "STATIC_PIC" + if( "${_arg}" STREQUAL "STATIC_PIC" ) + set( _skip_store 1 ) + set( _type "STATIC" ) + set( _static_pic 1 ) + endif( "${_arg}" STREQUAL "STATIC_PIC" ) + + # found directive "AUTOMOC" + if( "${_arg}" STREQUAL "AUTOMOC" ) + set( _skip_store 1 ) + set( _automoc 1 ) + endif( "${_arg}" STREQUAL "AUTOMOC" ) + + # found directive "META_INCLUDES" + if( "${_arg}" STREQUAL "META_INCLUDES" ) + set( _skip_store 1 ) + set( _storage "_meta_includes" ) + endif( ) + + # found directive "NO_LIBTOOL_FILE" + if( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" ) + set( _skip_store 1 ) + set( _no_libtool_file 1 ) + endif( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" ) + + # found directive "NO_EXPORT" + if( "${_arg}" STREQUAL "NO_EXPORT" ) + set( _skip_store 1 ) + set( _no_export 1 ) + endif( "${_arg}" STREQUAL "NO_EXPORT" ) + + # found directive "VERSION" + if( "${_arg}" STREQUAL "VERSION" ) + set( _skip_store 1 ) + set( _storage "_version" ) + endif( "${_arg}" STREQUAL "VERSION" ) + + # found directive "SOURCES" + if( "${_arg}" STREQUAL "SOURCES" ) + set( _skip_store 1 ) + set( _storage "_sources" ) + endif( "${_arg}" STREQUAL "SOURCES" ) + + # found directive "EMBED" + if( "${_arg}" STREQUAL "EMBED" ) + set( _skip_store 1 ) + set( _storage "_embed" ) + endif( "${_arg}" STREQUAL "EMBED" ) + + # found directive "LINK" + if( "${_arg}" STREQUAL "LINK" ) + set( _skip_store 1 ) + set( _storage "_link" ) + endif( "${_arg}" STREQUAL "LINK" ) + + # found directive "DEPENDENCIES" + if( "${_arg}" STREQUAL "DEPENDENCIES" ) + set( _skip_store 1 ) + set( _storage "_dependencies" ) + endif( "${_arg}" STREQUAL "DEPENDENCIES" ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + list( APPEND ${_storage} ${_arg} ) + list( REMOVE_DUPLICATES ${_storage} ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + # if no type is set, we choose one + # based on BUILD_SHARED_LIBS + if( NOT _type ) + if( BUILD_SHARED_LIBS ) + set( _type "SHARED" ) + else( BUILD_SHARED_LIBS ) + set( _type "STATIC" ) + endif( BUILD_SHARED_LIBS ) + endif( NOT _type ) + + # change target name, based on type + string( TOLOWER "${_type}" _type_lower ) + set( _target "${_arg_target}-${_type_lower}" ) + + # create variables like "LIB_xxx" for convenience + if( ${_type} STREQUAL "SHARED" ) + string( TOUPPER "${_arg_target}" _tmp ) + set( LIB_${_tmp} ${_target} CACHE INTERNAL LIB_${tmp} FORCE ) + endif( ${_type} STREQUAL "SHARED" ) + + # disallow target without sources + if( NOT _sources ) + message( FATAL_ERROR "\nTarget [$_target] have no sources." ) + endif( NOT _sources ) + + # processing different types of sources + __tde_internal_process_sources( _sources ${_sources} ) + + # set automoc + if( _automoc ) + tde_automoc( ${_sources} ) + endif( _automoc ) + + # add target + add_library( ${_target} ${_type} ${_sources} ) + + # we assume that modules have no prefix and no version + # also, should not link + if( ${_type} STREQUAL "MODULE" ) + set_target_properties( ${_target} PROPERTIES PREFIX "" ) + unset( _version ) + set( _shouldnotlink yes ) + endif( ${_type} STREQUAL "MODULE" ) + + # set real name of target + set_target_properties( ${_target} PROPERTIES OUTPUT_NAME ${_arg_target} ) + + # set -fPIC flag for static libraries + if( _static_pic ) + set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC ) + endif( _static_pic ) + + # set version + if( _version ) + string( REGEX MATCH "^[0-9]+" _soversion ${_version} ) + set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} ) + endif( _version ) + + # set interface libraries (only for shared) + unset( _shared_libs ) + foreach( _lib ${_link} ) + #get_target_property( _lib_type ${_lib} TYPE ) + #if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) + if( NOT ${_lib} MATCHES ".+-static" ) + list( APPEND _shared_libs ${_lib} ) + endif( NOT ${_lib} MATCHES ".+-static" ) + #endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) + endforeach( _lib ) + target_link_libraries( ${_target} LINK_INTERFACE_LIBRARIES ${_shared_libs} ) + + # set embedded archives + if( _embed ) + list( INSERT _link 0 -Wl,-whole-archive ${_embed} -Wl,-no-whole-archive ) + endif( _embed ) + + # set link libraries + if( _link ) + target_link_libraries( ${_target} ${_link} ) + endif( ) + + # set dependencies + if( _dependencies ) + add_dependencies( ${_target} ${_dependencies} ) + endif( _dependencies ) + + # if destination directory is set + if( _destination ) + + # we export only shared libs (no static, no modules); + # also, do not export targets marked as "NO_EXPORT" (usually for kdeinit) + if( "SHARED" STREQUAL ${_type} AND NOT _no_export ) + + # get target properties: output name, version, soversion + get_target_property( _output ${_target} LOCATION ) + get_filename_component( _output ${_output} NAME ) + get_target_property( _version ${_target} VERSION ) + get_target_property( _soversion ${_target} SOVERSION ) + + if( _version ) + set( _location "${_destination}/${_output}.${_version}" ) + set( _soname "${_output}.${_soversion}" ) + else( ) + set( _location "${_destination}/${_output}" ) + set( _soname "${_output}" ) + endif( ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY ) + endif( ) + + # install target + install( TARGETS ${_target} DESTINATION ${_destination} ) + + # install .la files for dynamic libraries + if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file ) + tde_install_libtool_file( ${_target} ${_destination} ) + endif( ) + + endif( _destination ) + +endmacro( tde_add_library ) + + +################################################# +##### +##### tde_add_kpart + +macro( tde_add_kpart _target ) + tde_add_library( ${_target} ${ARGN} MODULE ) +endmacro( tde_add_kpart ) + + +################################################# +##### +##### tde_add_executable + +macro( tde_add_executable _arg_target ) + + unset( _target ) + unset( _automoc ) + unset( _meta_includes ) + unset( _setuid ) + unset( _sources ) + unset( _destination ) + unset( _link ) + unset( _dependencies ) + unset( _storage ) + + foreach( _arg ${ARGV} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found directive "AUTOMOC" + if( "${_arg}" STREQUAL "AUTOMOC" ) + set( _skip_store 1 ) + set( _automoc 1 ) + endif( "${_arg}" STREQUAL "AUTOMOC" ) + + # found directive "META_INCLUDES" + if( "${_arg}" STREQUAL "META_INCLUDES" ) + set( _skip_store 1 ) + set( _storage "_meta_includes" ) + endif( ) + + # found directive "SETUID" + if( "${_arg}" STREQUAL "SETUID" ) + set( _skip_store 1 ) + set( _setuid 1 ) + endif( "${_arg}" STREQUAL "SETUID" ) + + # found directive "SOURCES" + if( "${_arg}" STREQUAL "SOURCES" ) + set( _skip_store 1 ) + set( _storage "_sources" ) + endif( "${_arg}" STREQUAL "SOURCES" ) + + # found directive "LINK" + if( "${_arg}" STREQUAL "LINK" ) + set( _skip_store 1 ) + set( _storage "_link" ) + endif( "${_arg}" STREQUAL "LINK" ) + + # found directive "DEPENDENCIES" + if( "${_arg}" STREQUAL "DEPENDENCIES" ) + set( _skip_store 1 ) + set( _storage "_dependencies" ) + endif( "${_arg}" STREQUAL "DEPENDENCIES" ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + #set( ${_storage} "${${_storage}} ${_arg}" ) + list( APPEND ${_storage} ${_arg} ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + set( _target "${_arg_target}" ) + + # disallow target without sources + if( NOT _sources ) + message( FATAL_ERROR "\nTarget [$_target] have no sources." ) + endif( NOT _sources ) + + # processing different types of sources + __tde_internal_process_sources( _sources ${_sources} ) + + # set automoc + if( _automoc ) + tde_automoc( ${_sources} ) + endif( _automoc ) + + # add target + add_executable( ${_target} ${_sources} ) + + # set link libraries + if( _link ) + target_link_libraries( ${_target} ${_link} ) + endif( _link ) + + # set dependencies + if( _dependencies ) + add_dependencies( ${_target} ${_dependencies} ) + endif( _dependencies ) + + # set destination directory + if( _destination ) + if( _setuid ) + install( TARGETS ${_target} DESTINATION ${_destination} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE SETUID ) + else( _setuid ) + install( TARGETS ${_target} DESTINATION ${_destination} ) + endif( _setuid ) + endif( _destination ) + +endmacro( tde_add_executable ) + + +################################################# +##### +##### tde_add_kdeinit_executable + +macro( tde_add_kdeinit_executable _target ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_executable.cmake ${_target}_kdeinit_executable.cpp COPYONLY ) + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_module.cmake ${_target}_kdeinit_module.cpp COPYONLY ) + + unset( _sources ) + unset( _runtime_destination ) + unset( _library_destination ) + unset( _plugin_destination ) + + # default storage is _sources + set( _storage _sources ) + + # set default export to NO_EXPORT + set( _export "NO_EXPORT" ) + + foreach( _arg ${ARGN} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found directive "EXPORT" + if( "${_arg}" STREQUAL "EXPORT" ) + set( _skip_store 1 ) + unset( _export ) + endif( "${_arg}" STREQUAL "EXPORT" ) + + # found directive "RUNTIME_DESTINATION" + if( "${_arg}" STREQUAL "RUNTIME_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_runtime_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "RUNTIME_DESTINATION" ) + + # found directive "LIBRARY_DESTINATION" + if( "${_arg}" STREQUAL "LIBRARY_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_library_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "LIBRARY_DESTINATION" ) + + # found directive "PLUGIN_DESTINATION" + if( "${_arg}" STREQUAL "PLUGIN_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_plugin_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "PLUGIN_DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + list( APPEND ${_storage} ${_arg} ) + set( _storage "_sources" ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + # if destinations are not set, we using some defaults + # we assume that kdeinit executable MUST be installed + # (otherwise why we build it?) + if( NOT _runtime_destination ) + set( _runtime_destination ${BIN_INSTALL_DIR} ) + endif( NOT _runtime_destination ) + if( NOT _library_destination ) + set( _library_destination ${LIB_INSTALL_DIR} ) + endif( NOT _library_destination ) + if( NOT _plugin_destination ) + set( _plugin_destination ${PLUGIN_INSTALL_DIR} ) + endif( NOT _plugin_destination ) + + # create the library + tde_add_library( kdeinit_${_target} ${_sources} SHARED ${_export} + DESTINATION ${_library_destination} + ) + + # create the executable + tde_add_executable( ${_target} + SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_kdeinit_executable.cpp + LINK kdeinit_${_target}-shared + DESTINATION ${_runtime_destination} + ) + + # create the plugin + tde_add_kpart( ${_target} + SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_kdeinit_module.cpp + LINK kdeinit_${_target}-shared + DESTINATION ${_plugin_destination} + ) + +endmacro( tde_add_kdeinit_executable ) + + +################################################# +##### +##### tde_create_translation + +macro( tde_create_translation ) + + unset( _srcs ) + unset( _lang ) + unset( _dest ) + unset( _directive ) + unset( _var ) + + foreach( _arg ${ARGN} ) + + # found directive "FILES" + if( "${_arg}" STREQUAL "FILES" ) + unset( _srcs ) + set( _var _srcs ) + set( _directive 1 ) + endif( ) + + # found directive "LANG" + if( "${_arg}" STREQUAL "LANG" ) + unset( _lang ) + set( _var _lang ) + set( _directive 1 ) + endif( ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + unset( _dest ) + set( _var _dest ) + set( _directive 1 ) + endif( ) + + # collect data + if( _directive ) + unset( _directive ) + elseif( _var ) + list( APPEND ${_var} ${_arg} ) + endif() + + endforeach( ) + + if( NOT MSGFMT_EXECUTABLE ) + tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" ) + elseif( NOT _lang ) + tde_message_fatal( "missing LANG directive" ) + elseif( NOT _dest ) + set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" ) + endif( ) + + # if no file specified, include all *.po files + if( NOT _srcs ) + file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) + endif() + if( NOT _srcs ) + tde_message_fatal( "no source files" ) + endif() + + # generate *.mo files + foreach( _src ${_srcs} ) + get_filename_component( _src ${_src} ABSOLUTE ) + get_filename_component( _out ${_src} NAME_WE ) + set( _out_name "${_out}-${_lang}.mo" ) + set( _out_real_name "${_out}.mo" ) + add_custom_command( + OUTPUT ${_out_name} + COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_name} + DEPENDS ${_src} ) + add_custom_target( "${_out}-${_lang}-translation" ALL DEPENDS ${_out_name} ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} RENAME ${_out_real_name} DESTINATION ${_dest} ) + endforeach( ) + +endmacro( ) + + +################################################# +##### +##### tde_create_handbook + +macro( tde_create_handbook ) + + unset( _target ) + unset( _dest ) + unset( _noindex ) + unset( _srcs ) + unset( _extra ) + unset( _srcdir ) + + set( _lang en ) + set( _first_arg 1 ) + set( _var _target ) + + foreach( _arg ${ARGN} ) + + # found directive "NOINDEX" + if( "${_arg}" STREQUAL "NOINDEX" ) + set( _noindex 1 ) + set( _directive 1 ) + endif() + + # found directive "FILES" + if( "${_arg}" STREQUAL "FILES" ) + unset( _srcs ) + set( _var _srcs ) + set( _directive 1 ) + endif() + + # found directive "EXTRA" + if( "${_arg}" STREQUAL "EXTRA" ) + unset( _extra ) + set( _var _extra ) + set( _directive 1 ) + endif() + + # found directive "SRCDIR" + if( "${_arg}" STREQUAL "SRCDIR" ) + unset( _srcdir ) + set( _var _srcdir ) + set( _directive 1 ) + endif() + + # found directive DESTINATION + if( _arg STREQUAL "DESTINATION" ) + unset( _dest ) + set( _var _dest ) + set( _directive 1 ) + endif() + + # found directive "LANG" + if( "${_arg}" STREQUAL "LANG" ) + unset( _lang ) + set( _var _lang ) + set( _directive 1 ) + endif() + + # collect data + if( _directive ) + unset( _directive ) + elseif( _var ) + if( _first_arg ) + set( _target "${_arg}" ) + else() + list( APPEND ${_var} ${_arg} ) + endif() + endif() + + unset( _first_arg ) + + endforeach() + + # if no target specified, try to guess it from DESTINATION + if( NOT _target ) + if( NOT _dest ) + tde_message_fatal( "target name cannot be determined because DESTINATION is not set" ) + endif() + string( REPLACE "/" "-" _target "${_dest}" ) + endif() + + set( _target "${_target}-${_lang}-handbook" ) + + # if no file specified, include all docbooks, stylesheets and images + if( NOT _srcs ) + file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.docbook *.css *.png ) + endif() + + # if no destination specified, defaulting to HTML_INSTALL_DIR + if( NOT _dest ) + set( _dest "${HTML_INSTALL_DIR}/${_lang}" ) + # if destination is NOT absolute path, + # we assume that is relative to HTML_INSTALL_DIR + elseif( NOT IS_ABSOLUTE ${_dest} ) + set( _dest "${HTML_INSTALL_DIR}/${_lang}/${_dest}" ) + endif() + + if( NOT _srcs ) + tde_message_fatal( "no source files" ) + endif() + + if( NOT _noindex ) + + # check for index.docbook + list( FIND _srcs "index.docbook" _find_index ) + if( -1 EQUAL _find_index ) + tde_message_fatal( "missing index.docbook file" ) + endif() + + # check for srcdir + if( _srcdir ) + set( _srcdir "--srcdir=${_srcdir}" ) + endif() + + add_custom_command( + OUTPUT index.cache.bz2 + COMMAND ${KDE3_MEINPROC_EXECUTABLE} ${_srcdir} --check --cache index.cache.bz2 ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook + DEPENDS ${_srcs} ) + + add_custom_target( ${_target} ALL DEPENDS index.cache.bz2 ) + + list( APPEND _srcs ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ) + + endif() + + install( FILES ${_srcs} ${_extra} DESTINATION ${_dest} ) + tde_install_symlink( ${TDE_HTML_DIR}/${_lang}/common ${_dest} ) + +endmacro( ) + + +################################################# +##### +##### tde_include_tqt + +macro( tde_include_tqt ) + foreach( _cpp ${ARGN} ) + set_source_files_properties( ${_cpp} PROPERTIES COMPILE_FLAGS "-include tqt.h" ) + endforeach() +endmacro( ) + + +################################################# +##### +##### tde_install_symlink + +macro( tde_install_symlink _target _link ) + + # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX + if( IS_ABSOLUTE "${_link}" ) + set( _destination "${_link}" ) + else( IS_ABSOLUTE "${_link}" ) + set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" ) + endif( IS_ABSOLUTE "${_link}" ) + + get_filename_component( _path "${_destination}" PATH ) + if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) + install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" ) + endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) + + install( CODE "execute_process( COMMAND ln -s ${_target} \$ENV{DESTDIR}${_destination} )" ) + +endmacro( tde_install_symlink ) + + +################################################# +##### +##### tde_install_empty_directory + +macro( tde_install_empty_directory _path ) + + # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX + if( IS_ABSOLUTE "${_path}" ) + set( _destination "${_path}" ) + else( IS_ABSOLUTE "${_path}" ) + set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" ) + endif( IS_ABSOLUTE "${_path}" ) + + install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" ) + +endmacro( tde_install_empty_directory ) + + +################################################# +##### +##### tde_conditional_add_subdirectory + +macro( tde_conditional_add_subdirectory _cond _path ) + + if( ${_cond} ) + add_subdirectory( "${_path}" ) + endif( ${_cond} ) + +endmacro( tde_conditional_add_subdirectory ) + + +################################################# +##### +##### tde_auto_add_subdirectories + +macro( tde_auto_add_subdirectories ) + file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * ) + foreach( _dir ${_dirs} ) + if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ) + if( NOT ${_dir} STREQUAL ".svn" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt ) + add_subdirectory( ${_dir} ) + endif() + endif() + endforeach() +endmacro() + + +################################################# +##### +##### tde_save / tde_restore + +macro( tde_save ) + foreach( _var ${ARGN} ) + set( __bak_${_var} ${${_var}} ) + endforeach() +endmacro() + +macro( tde_restore ) + foreach( _var ${ARGN} ) + set( ${_var} ${__bak_${_var}} ) + unset( __bak_${_var} ) + endforeach() +endmacro() + + +################################################# +##### +##### tde_setup_install_path + +macro( tde_setup_install_path _path _default ) + if( DEFINED ${_path} ) + set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE ) + else( ) + set( ${_path} "${_default}" ) + endif( ) +endmacro( ) + + +################################################## + +if( ${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR} ) + tde_message_fatal( "Please use out-of-source building, like this: + \n rm ${CMAKE_SOURCE_DIR}/CMakeCache.txt + mkdir /tmp/${PROJECT_NAME}.build + cd /tmp/${PROJECT_NAME}.build + cmake ${CMAKE_SOURCE_DIR} [arguments...]" ) +endif( ) diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/TDESetupPaths.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/TDESetupPaths.cmake new file mode 100644 index 000000000..409a7b959 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/TDESetupPaths.cmake @@ -0,0 +1,67 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +################################################# +##### +##### tde_internal_setup_path + +macro( _tde_internal_setup_path _path _default _comment ) + if( DEFINED ${_path} ) + set( ${_path} "${${_path}}" CACHE PATH "${_comment}" ) + else( DEFINED ${_path} ) + set( ${_path} "${_default}" ) + endif( DEFINED ${_path} ) +endmacro( _tde_internal_setup_path ) + + +################################################# +##### +##### tde_setup_paths + +macro( tde_setup_paths ) + + # install paths + _tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" ) + _tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" ) + _tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" ) + _tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" ) + _tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" ) + _tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" ) + _tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" ) + + _tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" ) + _tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" ) + _tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" ) + _tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" ) + _tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/kde/HTML" "The HTML install dir for documentation" ) + _tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" ) + _tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files" ) + _tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" ) + _tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" ) + _tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" ) + _tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" ) + _tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" ) + _tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" ) + _tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" ) + _tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" ) + _tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir" ) + _tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" ) + + _tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" ) + _tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" ) + _tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" ) + + _tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" ) + _tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir" ) + _tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" ) + _tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" ) + +endmacro( tde_setup_paths ) diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/tde_uic.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/tde_uic.cmake new file mode 100644 index 000000000..a5458281f --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/tde_uic.cmake @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +get_filename_component( _ui_basename ${UI_FILE} NAME_WE ) + +# FIXME this will working only on out-of-source mode +set( local_ui_file ${_ui_basename}.ui ) +configure_file( ${UI_FILE} ${local_ui_file} COPYONLY ) +execute_process( COMMAND tqt-replace ${local_ui_file} ) + +execute_process( COMMAND ${UIC_EXECUTABLE} + -nounload -tr tr2i18n + ${local_ui_file} + OUTPUT_VARIABLE _ui_h_content ) + +if( _ui_h_content ) + string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" ) + string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" ) + file( WRITE ${_ui_basename}.h "${_ui_h_content}" ) +endif( ) + +if( TDE_QTPLUGINS_DIR ) + set( L -L ${TDE_QTPLUGINS_DIR} ) +endif( ) + +execute_process( COMMAND ${UIC_EXECUTABLE} + -nounload -tr tr2i18n + ${L} + -impl ${_ui_basename}.h + ${local_ui_file} + OUTPUT_VARIABLE _ui_cpp_content ) + +if( _ui_cpp_content ) + string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" ) + string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" ) + file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <klocale.h>\n\n${_ui_cpp_content}" ) +endif( ) diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/template_dummy_cpp.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/template_dummy_cpp.cmake new file mode 100644 index 000000000..8e1f5ff59 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/template_dummy_cpp.cmake @@ -0,0 +1,5 @@ +#ifdef _AIX + namespace { + void *not_empty_file; + } +#endif diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/template_export_library.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/template_export_library.cmake new file mode 100644 index 000000000..4d6cb3ff2 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/template_export_library.cmake @@ -0,0 +1,7 @@ +add_library( @_target@ @_type@ IMPORTED ) + +set_target_properties( @_target@ PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@" + IMPORTED_LOCATION "@_location@" + IMPORTED_SONAME "@_soname@" ) + diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_executable.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_executable.cmake new file mode 100644 index 000000000..3d480c44e --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_executable.cmake @@ -0,0 +1,2 @@ +extern "C" int kdemain(int argc, char* argv[]); +int main(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_module.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_module.cmake new file mode 100644 index 000000000..68be1e7c3 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/template_kdeinit_module.cmake @@ -0,0 +1,3 @@ +#include <kdemacros.h> +extern "C" int kdemain(int argc, char* argv[]); +extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/main/dependencies/dbus-tqt-1/cmake/modules/template_libtool_file.cmake b/main/dependencies/dbus-tqt-1/cmake/modules/template_libtool_file.cmake new file mode 100644 index 000000000..fcd73d462 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/cmake/modules/template_libtool_file.cmake @@ -0,0 +1,35 @@ +# @_laname@ - a libtool library file +# Generated by CMake - GNU libtool +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='@_library_name_2@' + +# Names of this library. +library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@' + +# The name of the static archive. +old_library='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Version information for @_name@. +current=@_version_current@ +age=@_version_age@ +revision=@_version_revision@ + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=@_shouldnotlink@ + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='@_libdir@' diff --git a/main/dependencies/dbus-tqt-1/connection.cpp b/main/dependencies/dbus-tqt-1/connection.cpp new file mode 100644 index 000000000..295bc1d51 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/connection.cpp @@ -0,0 +1,168 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* connection.cpp: TQt wrapper for DBusConnection + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.0 + * + * 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 "connection.h" + +using namespace DBusQt; + +#include "integrator.h" +using Internal::Integrator; + +struct Connection::Private +{ + Private( Connection *qq ); + void setConnection( DBusConnection *c ); + DBusConnection *connection; + int connectionSlot; + DBusError error; + Integrator *integrator; + int timeout; + Connection *q; +}; + +Connection::Private::Private( Connection *qq ) + : connection( 0 ), connectionSlot( 0 ), integrator( 0 ), + timeout( -1 ), q( qq ) +{ + dbus_error_init( &error ); +} + +void Connection::Private::setConnection( DBusConnection *c ) +{ + if (!c) { + qDebug( "error: %s, %s", error.name, error.message ); + dbus_error_free( &error ); + return; + } + connection = c; + integrator = new Integrator( c, q ); + connect( integrator, TQT_SIGNAL(readReady()), q, TQT_SLOT(dispatchRead()) ); +} + +Connection::Connection( TQObject *tqparent ) + : TQObject( tqparent ) +{ + d = new Private( this ); +} + +Connection::Connection( const TQString& host, TQObject *tqparent ) + : TQObject( tqparent ) +{ + d = new Private( this ); + + if ( !host.isEmpty() ) + init( host ); +} + +Connection::Connection( DBusBusType type, TQObject* tqparent ) + : TQObject( tqparent ) +{ + d = new Private( this ); + d->setConnection( dbus_bus_get(type, &d->error) ); +} + +void Connection::init( const TQString& host ) +{ + d->setConnection( dbus_connection_open( host.ascii(), &d->error) ); + //dbus_connection_allocate_data_slot( &d->connectionSlot ); + //dbus_connection_set_data( d->connection, d->connectionSlot, 0, 0 ); +} + +bool Connection::isConnected() const +{ + return dbus_connection_get_is_connected( d->connection ); +} + +bool Connection::isAuthenticated() const +{ + return dbus_connection_get_is_authenticated( d->connection ); +} + +void Connection::open( const TQString& host ) +{ + if ( host.isEmpty() ) return; + + init( host ); +} + +void Connection::close() +{ + dbus_connection_close( d->connection ); +} + +void Connection::flush() +{ + dbus_connection_flush( d->connection ); +} + +void Connection::dispatchRead() +{ + while ( dbus_connection_dispatch( d->connection ) == DBUS_DISPATCH_DATA_REMAINS ) + ; +} + +DBusConnection* Connection::connection() const +{ + return d->connection; +} + +Connection::Connection( DBusConnection *connection, TQObject *tqparent ) + : TQObject( tqparent ) +{ + d = new Private(this); + d->setConnection(connection); +} + +void Connection::send( const Message &m ) +{ + dbus_connection_send(d->connection, m.message(), 0); +} + +void Connection::sendWithReply( const Message& ) +{ +} + +Message Connection::sendWithReplyAndBlock( const Message &m ) +{ + DBusMessage *reply; + reply = dbus_connection_send_with_reply_and_block( d->connection, m.message(), d->timeout, &d->error ); + if (dbus_error_is_set(&d->error)) { + qDebug("error: %s, %s", d->error.name, d->error.message); + dbus_error_free(&d->error); + } + return Message( reply ); +} + +void* Connection::virtual_hook( int, void* ) +{ +} + +void Connection::dbus_connection_setup_with_qt_main (DBusConnection *connection) +{ + d->setConnection( connection ); +} + + + +///////////////////////////////////////////////////////// + +#include "connection.moc" diff --git a/main/dependencies/dbus-tqt-1/connection.h b/main/dependencies/dbus-tqt-1/connection.h new file mode 100644 index 000000000..eec6b5f9c --- /dev/null +++ b/main/dependencies/dbus-tqt-1/connection.h @@ -0,0 +1,84 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* connection.h: TQt wrapper for DBusConnection + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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 + * + */ +#ifndef DBUS_TQT_CONNECTION_H +#define DBUS_TQT_CONNECTION_H + +#include "message.h" + +#include <tqobject.h> +#include <tqstring.h> + +#include "dbus/dbus.h" + +namespace DBusQt { + namespace Internal { + class Integrator; + } + + class Connection : public TQObject + { + Q_OBJECT + TQ_OBJECT + public: + Connection( TQObject *tqparent =0 ); + Connection( const TQString& host, + TQObject *tqparent = 0 ); + Connection( DBusBusType type, TQObject* tqparent = 0 ); + + bool isConnected() const; + bool isAuthenticated() const; + + Message borrowMessage(); + Message popMessage(); + void stealBorrowMessage( const Message& ); + void dbus_connection_setup_with_qt_main (DBusConnection *connection); + + public slots: + void open( const TQString& ); + void close(); + void flush(); + void send( const Message& ); + void sendWithReply( const Message& ); + Message sendWithReplyAndBlock( const Message& ); + + protected slots: + void dispatchRead(); + + protected: + void init( const TQString& host ); + virtual void *virtual_hook( int id, void *data ); + + private: + friend class Internal::Integrator; + DBusConnection *connection() const; + Connection( DBusConnection *connection, TQObject *tqparent ); + + private: + struct Private; + Private *d; + }; + +} + + +#endif diff --git a/main/dependencies/dbus-tqt-1/dbus-qt.h b/main/dependencies/dbus-tqt-1/dbus-qt.h new file mode 100644 index 000000000..6b05f67d9 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/dbus-qt.h @@ -0,0 +1,81 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* + * dbus-qt.h TQt integration + * + * Copyright (C) 2002 DBus Developers + * + * Licensed under the Academic Free License version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + * + */ +#ifndef DBUS_TQT_H +#define DBUS_TQT_H + +#include <dbus/dbus.h> +/* + * Two approaches - one presented below a DBusQtConnection + * object which is a TQt wrapper around DBusConnection +class DBusQtConnection : public TQObject { + TQ_OBJECT +public: + DBusQtConnection( const char *address=0, TQObject *tqparent=0, + const char *name=0 ); + + bool open( const char *address ); + bool isConnected() const; + int numMessages() const; + +public slots: + void disconnect(); + void flush(); + void sendMessage( DBusMessage *message ); + +signals: + void message( DBusMessage* message ); + void error( const char* error ); +private: + DBusConnection *mConnection; + TQSocketNotifier *mReadNotifier; + TQSocketNotifier *mWriteNotifier; +}; + * + * Second approach is to have a static TQt dispatcher like: +class DBusQtNotifier : public TQObject { + TQ_OBJECT +public: + static DBusQtNotifier* dbus_qt_notifier(); + void addConnection(DBusConnection* connection); +signals: + void message (DBusConnection* connection, DBusMessage* message); + +private: + DBusQtNotifier(TQObject *tqparent); +private slots: + void processNotifiers( int socket ); +private: + //implemented in terms of TQSocketNotifiers + TQAsciiDict<DBusConnection> mReadNotifiers; + TQAsciiDict<DBusConnection> mWriteNotifiers; +}; + * + * First one gives us a full wrapper for DBusConnection (the TQt way), + * the other exposes DBusConnection, so would be easier to maintain + * and keep up while DBus evolves. + * + */ + +#endif /* DBUS_TQT_H */ diff --git a/main/dependencies/dbus-tqt-1/dbus-qthread.cpp b/main/dependencies/dbus-tqt-1/dbus-qthread.cpp new file mode 100644 index 000000000..92356b6a3 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/dbus-qthread.cpp @@ -0,0 +1,164 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* dbus-qthread.cpp TQt threads integration + * + * Copyright (C) 2002 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.0 + * + * 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 <dbus/dbus.h> +#include <tqmutex.h> + +//#if defined(TQT_THREAD_SUPPORT) +#if 0 + +static DBusMutex * dbus_qmutex_new (void); +static void dbus_qmutex_free (DBusMutex *mutex); +static dbus_bool_t dbus_qmutex_lock (DBusMutex *mutex); +static dbus_bool_t dbus_qmutex_unlock (DBusMutex *mutex); + +static DBusCondVar*dbus_qcondvar_new (void); +static void dbus_qcondvar_free (DBusCondVar *cond); +static void dbus_qcondvar_wait (DBusCondVar *cond, + DBusMutex *mutex); +static dbus_bool_t dbus_qcondvar_wait_timeout (DBusCondVar *cond, + DBusMutex *mutex, + int timeout_msec); +static void dbus_qcondvar_wake_one (DBusCondVar *cond); +static void dbus_qcondvar_wake_all (DBusCondVar *cond); + + +static const DBusThreadFunctions functions = +{ + DBUS_THREAD_FUNCTIONS_NEW_MASK | + DBUS_THREAD_FUNCTIONS_FREE_MASK | + DBUS_THREAD_FUNCTIONS_LOCK_MASK | + DBUS_THREAD_FUNCTIONS_UNLOCK_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK| + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK, + dbus_qmutex_new, + dbus_qmutex_free, + dbus_qmutex_lock, + dbus_qmutex_unlock + dbus_qcondvar_new, + dbus_qcondvar_free, + dbus_qcondvar_wait, + dbus_qcondvar_wait_timeout, + dbus_qcondvar_wake_one, + dbus_qcondvar_wake_all +}; + +static DBusMutex * +dbus_qmutex_new (void) +{ + TQMutex *mutex; + mutex = new TQMutex; + return static_cast<DBusMutex*>( mutex ); +} + +static void +dbus_qmutex_free (DBusMutex *mutex) +{ + TQMutex * qmutex = static_cast<TQMutex*>(mutex); + delete mutex; +} + +static dbus_bool_t +dbus_qmutex_lock (DBusMutex *mutex) +{ + TQMutex *qmutex = static_cast<TQMutex*>(mutex); + qmutex->lock(); + return TRUE; +} + +static dbus_bool_t +dbus_qmutex_unlock (DBusMutex *mutex) +{ + TQMutex *qmutex = static_cast<TQMutex*>(mutex); + qmutex->unlock(); + return TRUE; +} + +static DBusCondVar* +dbus_qcondvar_new (void) +{ + TQWaitCondition *cond; + cond = new TQWaitCondition; + return static_cast<DBusCondVar*>( cond ); +} + +static void +dbus_qcondvar_free (DBusCondVar *cond) +{ + TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond); + delete qcond; +} + +static void +dbus_qcondvar_wait (DBusCondVar *cond, + DBusMutex *mutex) +{ + TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond); + TQMutex *qmutex = static_cast<TQMutex*>(mutex); + + qcond->wait (qmutex); +} + +static dbus_bool_t +dbus_gcondvar_wait_timeout (DBusCondVar *cond, + DBusMutex *mutex, + int timeout_msec) +{ + TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond); + TQMutex *qmutex = static_cast<TQMutex*>(mutex); + + return qcond->wait (qmutex, timout_msec); +} + +static void +dbus_qcondvar_wake_one (DBusCondVar *cond) +{ + TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond); + + qcond->wakeOne (qmutex); +} + +static void +dbus_qcondvar_wake_all (DBusCondVar *cond) +{ + TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond); + + qcond->wakeAll (qmutex); +} + +extern "C" { + +void +dbus_qthread_init (void) +{ + //Do we want to do anything else here? + dbus_threads_init (&functions); +} + +} + +#endif // TQT_THREAD_SUPPORT diff --git a/main/dependencies/dbus-tqt-1/dbus-tqt.pc.cmake b/main/dependencies/dbus-tqt-1/dbus-tqt.pc.cmake new file mode 100644 index 000000000..9201faa5b --- /dev/null +++ b/main/dependencies/dbus-tqt-1/dbus-tqt.pc.cmake @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@PC_EXEC_PREFIX@ +libdir=@PC_LIB_DIR@ +includedir=@PC_INCLUDE_DIR@ + +Name: dbus-tqt +Description: DBUS bindings for the Trinity Qt [TQt] interface +Version: 0.9.0 +Libs: -L${libdir} -ldbus-tqt-1 -ldbus-1 +Cflags: -I${includedir} diff --git a/main/dependencies/dbus-tqt-1/debian/changelog b/main/dependencies/dbus-tqt-1/debian/changelog new file mode 100644 index 000000000..e7e0c9f42 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/changelog @@ -0,0 +1,6 @@ +dbus-tqt (0.63.svn.0ubuntu0) maverick; urgency=low + + * Migrate to Trinity Qt [TQt] Interface + + -- Timothy Pearson <kb9vqf@pearsoncomputing.net> Wed, 23 March 2011 17:11:00 -0600 + diff --git a/main/dependencies/dbus-tqt-1/debian/compat b/main/dependencies/dbus-tqt-1/debian/compat new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/compat @@ -0,0 +1 @@ +5 diff --git a/main/dependencies/dbus-tqt-1/debian/control b/main/dependencies/dbus-tqt-1/debian/control new file mode 100644 index 000000000..ca76e783a --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/control @@ -0,0 +1,39 @@ +Source: dbus-tqt +Section: devel +Priority: optional +Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org> +Uploaders: Sjoerd Simons <sjoerd@debian.org>, Sebastian Dröge <slomo@ubuntu.com> +Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.37.2), libtqtinterface-dev, libdbus-1-dev (>= 0.90), cmake +Standards-Version: 3.8.3 + +Package: libdbus-tqt-1-dev +Section: libdevel +Architecture: any +Depends: libdbus-tqt-1-1c2 (= ${Source-Version}), libdbus-1-dev (>= 0.90), libtqtinterface-dev +Conflicts: dbus-tqt-1-dev +Replaces: dbus-tqt-1-dev +Description: simple interprocess messaging system (TQt interface) + D-BUS is a message bus, used for sending messages between applications. + Conceptually, it fits somewhere in between raw sockets and CORBA in + terms of complexity. + . + This package provides a TQt-style interface to D-BUS. + . + See the dbus description for more information about D-BUS in general. + +Package: libdbus-tqt-1-1c2 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: dbus-tqt-1, dbus-tqt-1c2, libdbus-tqt-1-1 +Replaces: dbus-tqt-1, dbus-tqt-1c2, libdbus-tqt-1-1 +Description: simple interprocess messaging system (TQt-based shared library) + D-BUS is a message bus, used for sending messages between applications. + Conceptually, it fits somewhere in between raw sockets and CORBA in + terms of complexity. + . + This package provides the TQt-based shared library for applications using the + Qt interface to D-BUS. + . + See the dbus description for more information about D-BUS in general. + diff --git a/main/dependencies/dbus-tqt-1/debian/copyright b/main/dependencies/dbus-tqt-1/debian/copyright new file mode 100644 index 000000000..9541c0a8f --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/copyright @@ -0,0 +1,214 @@ +This package was debianized by Colin Walters <walters@debian.org> on +Thu, 6 Mar 2003 18:01:37 -0500 + +The source tarball was created by splitting out the qt3 bindings part from the +dbus-qt3 git repository: http://gitweb.freedesktop.org/?p=dbus/dbus-qt3.git + +This package is dual-licensed under the Academic Free License, and the +GPL. For a description of the GPL, see /usr/share/common-licenses/GPL +on your Debian system. + +Portions of the package are only licensed under the GPL (notably +tools/dbus-cleanup-sockets.c and test/decode-gcov.c ). + +The Academic Free License follows: + + The Academic Free License + v. 2.0 + +This Academic Free License (the "License") applies to any original +work of authorship (the "Original Work") whose owner (the "Licensor") +has placed the following notice immediately following the copyright +notice for the Original Work: + +Licensed under the Academic Free License version 2.0 + +1) Grant of Copyright License. Licensor hereby grants You a +world-wide, royalty-free, non-exclusive, perpetual, sublicenseable +license to do the following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original Work; + +c) to distribute copies of the Original Work and Derivative Works to the public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license, under +patent claims owned or controlled by the Licensor that are embodied in +the Original Work as furnished by the Licensor, to make, use, sell and +offer for sale the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the +preferred form of the Original Work for making modifications to it and +all available documentation describing how to modify the Original +Work. Licensor hereby agrees to provide a machine-readable copy of +the Source Code of the Original Work along with each copy of the +Original Work that Licensor distributes. Licensor reserves the right +to satisfy this obligation by placing a machine-readable copy of the +Source Code in an information repository reasonably calculated to +permit inexpensive and convenient access by You for as long as +Licensor continues to distribute the Original Work, and by publishing +the address of that information repository in a notice immediately +following the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor +the names of any contributors to the Original Work, nor any of their +trademarks or service marks, may be used to endorse or promote +products derived from this Original Work without express prior written +permission of the Licensor. Nothing in this License shall be deemed +to grant any rights to trademarks, copyrights, patents, trade secrets +or any other intellectual property of Licensor except as expressly +stated herein. No patent license is granted to make, use, sell or +offer to sell embodiments of any patent claims other than the licensed +claims defined in Section 2. No right is granted to the trademarks of +Licensor even if such marks are included in the Original Work. +Nothing in this License shall be interpreted to prohibit Licensor from +licensing under different terms from this License any Original Work +that Licensor otherwise would have a right to license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any +Derivative Works that You create, all copyright, patent or trademark +notices from the Source Code of the Original Work, as well as any +notices of licensing and any descriptive text identified therein as an +"Attribution Notice." You must cause the Source Code for any +Derivative Works that You create to carry a prominent Attribution +Notice reasonably calculated to inform recipients that You have +modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor +warrants that the copyright in and to the Original Work and the patent +rights granted herein by Licensor are owned by the Licensor or are +sublicensed to You under the terms of this License with the permission +of the contributor(s) of those copyrights and patent rights. Except +as expressly stated in the immediately proceeding sentence, the +Original Work is provided under this License on an "AS IS" BASIS and +WITHOUT WARRANTY, either express or implied, including, without +limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY +OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY +constitutes an essential part of this License. No license to Original +Work is granted hereunder except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal +theory, whether in tort (including negligence), contract, or +otherwise, shall the Licensor be liable to any person for any direct, +indirect, special, incidental, or consequential damages of any +character arising as a result of this License or the use of the +Original Work including, without limitation, damages for loss of +goodwill, work stoppage, computer failure or malfunction, or any and +all other commercial damages or losses. This limitation of liability +shall not apply to liability for death or personal injury resulting +from Licensor's negligence to the extent applicable law prohibits such +limitation. Some jurisdictions do not allow the exclusion or +limitation of incidental or consequential damages, so this exclusion +and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the +Original Work or a Derivative Work, You must make a reasonable effort +under the circumstances to obtain the express assent of recipients to +the terms of this License. Nothing else but this License (or another +written agreement between Licensor and You) grants You permission to +create Derivative Works based upon the Original Work or to exercise +any of the rights granted in Section 1 herein, and any attempt to do +so except under the terms of this License (or another written +agreement between Licensor and You) is expressly prohibited by +U.S. copyright law, the equivalent laws of other countries, and by +international treaty. Therefore, by exercising any of the rights +granted to You in Section 1 herein, You indicate Your acceptance of +this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate +automatically and You may no longer exercise any of the rights granted +to You by this License as of the date You commence an action, +including a cross-claim or counterclaim, for patent infringement (i) +against Licensor with respect to a patent applicable to software or +(ii) against any entity with respect to a patent applicable to the +Original Work (but excluding combinations of the Original Work with +other software or hardware). + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating +to this License may be brought only in the courts of a jurisdiction +wherein the Licensor resides or in which Licensor conducts its primary +business, and under the laws of that jurisdiction excluding its +conflict-of-law provisions. The application of the United Nations +Convention on Contracts for the International Sale of Goods is +expressly excluded. Any use of the Original Work outside the scope of +this License or after its termination shall be subject to the +requirements and penalties of the U.S. Copyright Act, 17 U.S.C. \u00a4 +101 et seq., the equivalent laws of other countries, and international +treaty. This section shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License +or seeking damages relating thereto, the prevailing party shall be +entitled to recover its costs and expenses, including, without +limitation, reasonable attorneys' fees and costs incurred in +connection with such action, including any appeal of such action. +This section shall survive the termination of this License. + +13) Miscellaneous. This License represents the complete agreement +concerning the subject matter hereof. If any provision of this +License is held to be unenforceable, such provision shall be reformed +only to the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this +License, whether in upper or lower case, means an individual or a +legal entity exercising rights under, and complying with all of the +terms of, this License. For legal entities, "You" includes any entity +that controls, is controlled by, or is under common control with you. +For purposes of this definition, "control" means (i) the power, direct +or indirect, to cause the direction or management of such entity, +whether by contract or otherwise, or (ii) ownership of fifty percent +(50%) or more of the outstanding shares, or (iii) beneficial ownership +of such entity. + +15) Right to Use. You may use the Original Work in all ways not +otherwise restricted or conditioned by this License or by law, and +Licensor promises not to interfere with or be responsible for such +uses by You. + +This license is Copyright (C) 2003 Lawrence E. Rosen. All rights +reserved. Permission is hereby granted to copy and distribute this +license without modification. This license may not be modified +without the express written permission of its copyright owner. + +-- +END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential +differences between the Academic Free License (AFL) version 1.0 and other +open source licenses: + +The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache +licenses in many respects but it is intended to solve a few problems with +those licenses. + +* The AFL is written so as to make it clear what software is being +licensed (by the inclusion of a statement following the copyright notice +in the software). This way, the license functions better than a template +license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software. + +* The AFL tqcontains a complete copyright grant to the software. The BSD +and Apache licenses are vague and incomplete in that respect. + +* The AFL tqcontains a complete patent grant to the software. The BSD, MIT, +UoI/NCSA and Apache licenses rely on an implied patent license and contain +no explicit patent grant. + +* The AFL makes it clear that no trademark rights are granted to the +licensor's trademarks. The Apache license tqcontains such a provision, but the +BSD, MIT and UoI/NCSA licenses do not. + +* The AFL includes the warranty by the licensor that it either owns the +copyright or that it is distributing the software under a license. None of +the other licenses contain that warranty. All other warranties are disclaimed, +as is the case for the other licenses. + +* The AFL is itself copyrighted (with the right granted to copy and distribute +without modification). This ensures that the owner of the copyright to the +license will control changes. The Apache license tqcontains a copyright notice, +but the BSD, MIT and UoI/NCSA licenses do not. diff --git a/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-1c2.install b/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-1c2.install new file mode 100644 index 000000000..bf44f3563 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-1c2.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libdbus-tqt-*.so.* diff --git a/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-dev.install b/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-dev.install new file mode 100644 index 000000000..6ee3e25c3 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/libdbus-tqt-1-dev.install @@ -0,0 +1,6 @@ +debian/tmp/usr/include/dbus*/dbus/dbus-qt.h +debian/tmp/usr/include/dbus*/dbus/connection.h +debian/tmp/usr/include/dbus*/dbus/server.h +debian/tmp/usr/include/dbus*/dbus/message.h +debian/tmp/usr/lib/libdbus-tqt-*.so +debian/tmp/usr/lib/pkgconfig/*.pc diff --git a/main/dependencies/dbus-tqt-1/debian/rules b/main/dependencies/dbus-tqt-1/debian/rules new file mode 100755 index 000000000..894533134 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f +# Copyright © 2002,2003 Colin Walters <walters@verbum.org> +# Copyright © 2003 Daniel Stone <daniels@debian.org> +# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org> + +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/rules/utils.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/cmake.mk + +# Strict library versioning +DEB_DH_MAKESHLIBS_ARGS_ALL := -V diff --git a/main/dependencies/dbus-tqt-1/depcomp b/main/dependencies/dbus-tqt-1/depcomp new file mode 100755 index 000000000..2ded90260 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/depcomp @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that tqcontains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and tqreplace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/main/dependencies/dbus-tqt-1/install-sh b/main/dependencies/dbus-tqt-1/install-sh new file mode 100755 index 000000000..3b7761ba7 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it tqcontains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) tqcontains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/main/dependencies/dbus-tqt-1/integrator.cpp b/main/dependencies/dbus-tqt-1/integrator.cpp new file mode 100644 index 000000000..dbb5a76a9 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/integrator.cpp @@ -0,0 +1,244 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* integrator.h: integrates D-BUS into TQt event loop + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.0 + * + * 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 "integrator.h" +#include "connection.h" + +#include <tqtimer.h> +#include <tqsocketnotifier.h> +#include <tqintdict.h> +#include <tqptrlist.h> + +namespace DBusQt +{ +namespace Internal { + +struct Watch { + Watch(): readSocket( 0 ), writeSocket( 0 ) { } + + DBusWatch *watch; + TQSocketNotifier *readSocket; + TQSocketNotifier *writeSocket; +}; + +////////////////////////////////////////////////////////////// +dbus_bool_t dbusAddWatch( DBusWatch *watch, void *data ) +{ + Integrator *con = static_cast<Integrator*>( data ); + con->addWatch( watch ); + return true; +} +void dbusRemoveWatch( DBusWatch *watch, void *data ) +{ + Integrator *con = static_cast<Integrator*>( data ); + con->removeWatch( watch ); +} + +void dbusToggleWatch( DBusWatch *watch, void *data ) +{ + Integrator *itg = static_cast<Integrator*>( data ); + if ( dbus_watch_get_enabled( watch ) ) + itg->addWatch( watch ); + else + itg->removeWatch( watch ); +} + +dbus_bool_t dbusAddTimeout( DBusTimeout *timeout, void *data ) +{ + if ( !dbus_timeout_get_enabled(timeout) ) + return true; + + Integrator *itg = static_cast<Integrator*>( data ); + itg->addTimeout( timeout ); + return true; +} + +void dbusRemoveTimeout( DBusTimeout *timeout, void *data ) +{ + Integrator *itg = static_cast<Integrator*>( data ); + itg->removeTimeout( timeout ); +} + +void dbusToggleTimeout( DBusTimeout *timeout, void *data ) +{ + Integrator *itg = static_cast<Integrator*>( data ); + + if ( dbus_timeout_get_enabled( timeout ) ) + itg->addTimeout( timeout ); + else + itg->removeTimeout( timeout ); +} + +void dbusWakeupMain( void* ) +{ +} + +void dbusNewConnection( DBusServer *server, + DBusConnection *new_connection, + void *data ) +{ + Integrator *itg = static_cast<Integrator*>( data ); + itg->handleConnection( new_connection ); +} +///////////////////////////////////////////////////////////// + +Timeout::Timeout( TQObject *tqparent, DBusTimeout *t ) + : TQObject( tqparent ), m_timeout( t ) +{ + m_timer = new TQTimer( this ); + connect( m_timer, TQT_SIGNAL(timeout()), + TQT_SLOT(slotTimeout()) ); +} + +void Timeout::slotTimeout() +{ + emit timeout( m_timeout ); +} + +void Timeout::start() +{ + m_timer->start( dbus_timeout_get_interval( m_timeout ) ); +} + +Integrator::Integrator( DBusConnection *conn, TQObject *tqparent ) + : TQObject( tqparent ), m_connection( conn ) +{ + m_timeouts.setAutoDelete( true ); + + dbus_connection_set_watch_functions( m_connection, + dbusAddWatch, + dbusRemoveWatch, + dbusToggleWatch, + this, 0 ); + dbus_connection_set_timeout_functions( m_connection, + dbusAddTimeout, + dbusRemoveTimeout, + dbusToggleTimeout, + this, 0 ); + dbus_connection_set_wakeup_main_function( m_connection, + dbusWakeupMain, + this, 0 ); +} + +Integrator::Integrator( DBusServer *server, TQObject *tqparent ) + : TQObject( tqparent ), m_server( server ) +{ + m_connection = reinterpret_cast<DBusConnection*>( m_server ); + m_timeouts.setAutoDelete( true ); + + dbus_server_set_watch_functions( m_server, + dbusAddWatch, + dbusRemoveWatch, + dbusToggleWatch, + this, 0 ); + dbus_server_set_timeout_functions( m_server, + dbusAddTimeout, + dbusRemoveTimeout, + dbusToggleTimeout, + this, 0 ); + dbus_server_set_new_connection_function( m_server, + dbusNewConnection, + this, 0 ); +} + +void Integrator::slotRead( int fd ) +{ + TQIntDictIterator<Watch> it( m_watches ); + for ( ; it.current(); ++it ) + dbus_watch_handle ( it.current()->watch, DBUS_WATCH_READABLE ); + + emit readReady(); +} + +void Integrator::slotWrite( int fd ) +{ + TQIntDictIterator<Watch> it( m_watches ); + for ( ; it.current(); ++it ) + dbus_watch_handle ( it.current()->watch, DBUS_WATCH_WRITABLE ); +} + +void Integrator::slotTimeout( DBusTimeout *timeout ) +{ + dbus_timeout_handle( timeout ); +} + +void Integrator::addWatch( DBusWatch *watch ) +{ + if ( !dbus_watch_get_enabled( watch ) ) + return; + + Watch *qtwatch = new Watch; + qtwatch->watch = watch; + + int flags = dbus_watch_get_flags( watch ); + int fd = dbus_watch_get_fd( watch ); + + if ( flags & DBUS_WATCH_READABLE ) { + qtwatch->readSocket = new TQSocketNotifier( fd, TQSocketNotifier::Read, this ); + TQObject::connect( qtwatch->readSocket, TQT_SIGNAL(activated(int)), TQT_SLOT(slotRead(int)) ); + } + + if (flags & DBUS_WATCH_WRITABLE) { + qtwatch->writeSocket = new TQSocketNotifier( fd, TQSocketNotifier::Write, this ); + TQObject::connect( qtwatch->writeSocket, TQT_SIGNAL(activated(int)), TQT_SLOT(slotWrite(int)) ); + } + + m_watches.insert( fd, qtwatch ); +} + +void Integrator::removeWatch( DBusWatch *watch ) +{ + int key = dbus_watch_get_fd( watch ); + + Watch *qtwatch = m_watches.take( key ); + + if ( qtwatch ) { + delete qtwatch->readSocket; qtwatch->readSocket = 0; + delete qtwatch->writeSocket; qtwatch->writeSocket = 0; + delete qtwatch; + } +} + +void Integrator::addTimeout( DBusTimeout *timeout ) +{ + Timeout *mt = new Timeout( this, timeout ); + m_timeouts.insert( timeout, mt ); + connect( mt, TQT_SIGNAL(timeout(DBusTimeout*)), + TQT_SLOT(slotTimeout(DBusTimeout*)) ); + mt->start(); +} + +void Integrator::removeTimeout( DBusTimeout *timeout ) +{ + m_timeouts.remove( timeout ); +} + +void Integrator::handleConnection( DBusConnection *c ) +{ + Connection *con = new Connection( c, this ); + emit newConnection( con ); +} + +}//end namespace Internal +}//end namespace DBusQt + +#include "integrator.moc" diff --git a/main/dependencies/dbus-tqt-1/integrator.h b/main/dependencies/dbus-tqt-1/integrator.h new file mode 100644 index 000000000..b43fd2676 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/integrator.h @@ -0,0 +1,94 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* integrator.h: integrates D-BUS into TQt event loop + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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 + * + */ +#ifndef DBUS_TQT_INTEGRATOR_H +#define DBUS_TQT_INTEGRATOR_H + +#include <tqobject.h> + +#include <tqintdict.h> +#include <tqptrdict.h> + +#include "dbus/dbus.h" + +class TQTimer; + +namespace DBusQt +{ + class Connection; + + namespace Internal + { + struct Watch; + + class Timeout : public TQObject + { + Q_OBJECT + TQ_OBJECT + public: + Timeout( TQObject *tqparent, DBusTimeout *t ); + public: + void start(); + signals: + void timeout( DBusTimeout* ); + protected slots: + void slotTimeout(); + private: + TQTimer *m_timer; + DBusTimeout *m_timeout; + }; + + class Integrator : public TQObject + { + Q_OBJECT + TQ_OBJECT + public: + Integrator( DBusConnection *connection, TQObject *tqparent ); + Integrator( DBusServer *server, TQObject *tqparent ); + + signals: + void readReady(); + void newConnection( Connection* ); + + protected slots: + void slotRead( int ); + void slotWrite( int ); + void slotTimeout( DBusTimeout *timeout ); + + public: + void addWatch( DBusWatch* ); + void removeWatch( DBusWatch* ); + + void addTimeout( DBusTimeout* ); + void removeTimeout( DBusTimeout* ); + + void handleConnection( DBusConnection* ); + private: + TQIntDict<Watch> m_watches; + TQPtrDict<Timeout> m_timeouts; + DBusConnection *m_connection; + DBusServer *m_server; + }; + } +} + +#endif diff --git a/main/dependencies/dbus-tqt-1/ltmain.sh b/main/dependencies/dbus-tqt-1/ltmain.sh new file mode 100644 index 000000000..6ef8d7290 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/ltmain.sh @@ -0,0 +1,6871 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that tqcontains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.22 Debian 1.5.22-4" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $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, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit $EXIT_SUCCESS +fi + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + SP2NL='tr \040 \012' + NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + SP2NL='tr \100 \n' + NL2SP='tr \r\n \100\100' + ;; +esac + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +# We save the old values to restore during execute mode. +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_utqmask=`utqmask` + utqmask 0077 + $mkdir "$my_tmpdir" + utqmask $save_mktempdir_utqmask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`tqfind unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`tqfind unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`tqfind $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname tqcontains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # tqreplaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is tqreplaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and tqcontains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T <<EOF +# $libobj - a libtool object file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +EOF + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + if test ! -d "${xdir}$objdir"; then + $show "$mkdir ${xdir}$objdir" + $run $mkdir ${xdir}$objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then + exit $exit_status + fi + fi + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + $run $rm "$lobj" "$output_obj" + + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile tqcontains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object='$objdir/$objname' + +EOF + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + else + # No PIC object so indicate it doesn't exist in the libtool + # object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object=none + +EOF + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$obj" "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile tqcontains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object='$objname' + +EOF + else + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object=none + +EOF + fi + + $run $mv "${libobj}T" "${libobj}" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit $EXIT_SUCCESS + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + base_compile="$nonopt $@" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + notinst_path= # paths that contain not-installed libtool libraries + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot tqfind name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the tqlayout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to tqfind any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot tqfind name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath tqcontains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot tqfind the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot tqfind name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot tqfind name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen tqfinds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath tqcontains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not tqfind such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path tqcontains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles tqcontains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles tqcontains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + fi + else + droppeddeps=yes + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody tqreplace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not tqfind such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody tqreplace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. + + Currently, it simply execs the wrapper *script* "/bin/sh $output", + but could eventually absorb all of the scripts functionality and + exec $objdir/$outputname directly. +*/ +EOF + cat >> $cwrappersource<<"EOF" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <sys/stat.h> + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * tqfind_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <<EOF + newargz[0] = (char *) xstrdup("$SHELL"); +EOF + + cat >> $cwrappersource <<"EOF" + newargz[1] = tqfind_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't tqfind %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i<argc+1; i++) + { + DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); + ; + } + +EOF + + case $host_os in + mingw*) + cat >> $cwrappersource <<EOF + execv("$SHELL",(char const **)newargz); +EOF + ;; + *) + cat >> $cwrappersource <<EOF + execv("$SHELL",newargz); +EOF + ;; + esac + + cat >> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +tqfind_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(tqfind_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of tqfinding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents tqfinding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we tqreplace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot tqfind \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still tqcontains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to <bug-libtool@gnu.org>." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that tqcontains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/main/dependencies/dbus-tqt-1/message.cpp b/main/dependencies/dbus-tqt-1/message.cpp new file mode 100644 index 000000000..64c57314b --- /dev/null +++ b/main/dependencies/dbus-tqt-1/message.cpp @@ -0,0 +1,561 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- */ +/* message.cpp: TQt wrapper for DBusMessage + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.0 + * + * 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 "message.h" + +#include <tqmap.h> + +#include <cstdlib> + +namespace DBusQt { + +struct Message::iterator::IteratorData { + DBusMessageIter *iter; + TQVariant var; + bool end; + DBusMessage *mesg; +}; + +/** + * Iterator. + */ +Message::iterator::iterator() +{ + d = new IteratorData; + d->iter = 0; d->end = true; +} + +/** + * Constructs iterator for the message. + * @param msg message whose fields we want to iterate + */ +Message::iterator::iterator( DBusMessage* msg ) +{ + d = new IteratorData; + d->mesg = msg; + d->iter = static_cast<DBusMessageIter *>( malloc( sizeof(DBusMessageIter) ) ); + dbus_message_iter_init( d->mesg, d->iter ); + if ( !d->iter ) { + qDebug("No iterator??"); + } + fillVar(); + d->end = false; +} + +/** + * Copy constructor for the iterator. + * @param itr iterator + */ +Message::iterator::iterator( const iterator& itr ) +{ + d = new IteratorData; + d->iter = itr.d->iter; + d->var = itr.d->var; + d->end = itr.d->end; +} + +/** + * Destructor. + */ +Message::iterator::~iterator() +{ + free( d->iter ); + delete d; d=0; +} + +/** + * Creates an iterator equal to the @p itr iterator + * @param itr other iterator + * @return + */ +Message::iterator& +Message::iterator::operator=( const iterator& itr ) +{ + IteratorData *tmp = new IteratorData; + tmp->iter = itr.d->iter; + tmp->var = itr.d->var; + tmp->end = itr.d->end; + delete d; d=tmp; + return *this; +} + +/** + * Returns the constant TQVariant held by the iterator. + * @return the constant reference to TQVariant held by this iterator + */ +const TQVariant& +Message::iterator::operator*() const +{ + return d->var; +} + +/** + * Returns the TQVariant held by the iterator. + * @return reference to TQVariant held by this iterator + */ +TQVariant& +Message::iterator::operator*() +{ + return d->var; +} + +/** + * Moves to the next field and return a reference to itself after + * incrementing. + * @return reference to self after incrementing + */ +Message::iterator& +Message::iterator::operator++() +{ + if ( d->end ) + return *this; + + if ( dbus_message_iter_next( d->iter ) ) { + fillVar(); + } else { + d->end = true; + d->var = TQVariant(); + } + return *this; +} + +/** + * Moves to the next field and returns self before incrementing. + * @return self before incrementing + */ +Message::iterator +Message::iterator::operator++(int) +{ + iterator itr( *this ); + operator++(); + return itr; +} + +/** + * Compares this iterator to @p it iterator. + * @param it the iterator to which we're comparing this one to + * @return true if they're equal, false otherwise + */ +bool +Message::iterator::operator==( const iterator& it ) +{ + if ( d->end == it.d->end ) { + if ( d->end == true ) { + return true; + } else { + return d->var == it.d->var; + } + } else + return false; +} + +/** + * Compares two iterators. + * @param it The other iterator. + * @return true if two iterators are not equal, false + * otherwise + */ +bool +Message::iterator::operator!=( const iterator& it ) +{ + return !operator==( it ); +} + +TQVariant Message::iterator::marshallBaseType( DBusMessageIter* i ) +{ + TQVariant ret; + switch (dbus_message_iter_get_arg_type(i)) { + case DBUS_TYPE_INT32: + { + dbus_int32_t v; + dbus_message_iter_get_basic (i, &v); + ret = TQVariant( v ); + } + break; + case DBUS_TYPE_UINT32: + { + dbus_uint32_t v; + dbus_message_iter_get_basic (i, &v); + ret = TQVariant( v ); + } + break; + case DBUS_TYPE_DOUBLE: + { + double v; + dbus_message_iter_get_basic (i, &v); + ret = TQVariant( v ); + } + break; + case DBUS_TYPE_STRING: + { + const char *v; + dbus_message_iter_get_basic (i, &v); + ret = TQVariant( v ); + } + break; + default: + ret = TQVariant(); + break; + } + return ret; +} + +/** + * Fills TQVariant based on what current DBusMessageIter helds. + */ +void +Message::iterator::fillVar() +{ + switch ( dbus_message_iter_get_arg_type( d->iter ) ) { + case DBUS_TYPE_INT32: + case DBUS_TYPE_UINT32: + case DBUS_TYPE_DOUBLE: + case DBUS_TYPE_STRING: + d->var = marshallBaseType( d->iter ); + break; + case DBUS_TYPE_ARRAY: { + switch ( dbus_message_iter_get_element_type( d->iter ) ) { + case DBUS_TYPE_STRING: { + TQStringList tempList; + DBusMessageIter sub; + dbus_message_iter_recurse (d->iter, &sub); + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) + { + const char *v; + dbus_message_iter_get_basic (&sub, &v); + tempList.append( TQString( v ) ); + dbus_message_iter_next (&sub); + } + d->var = TQVariant( tempList ); + break; + } + default: + qDebug( "Array of type not implemented" ); + d->var = TQVariant(); + break; + } + break; + } +#if 0 + /* DICT is gone for now, but expected to be reintroduced, or else + * reintroduced as a flag on the introspection data that can + * apply to array of struct of two fields + */ + case DBUS_TYPE_DICT: { + qDebug( "Got a hash!" ); + TQMap<TQString, TQVariant> tempMap; + DBusMessageIter dictIter; + dbus_message_iter_init_dict_iterator( d->iter, &dictIter ); + do { + char *key = dbus_message_iter_get_dict_key( &dictIter ); + tempMap[key] = marshallBaseType( &dictIter ); + dbus_free( key ); + dbus_message_iter_next( &dictIter ); + } while( dbus_message_iter_has_next( &dictIter ) ); + d->var = TQVariant( tempMap ); + break; + qDebug( "Hash/Dict type not implemented" ); + d->var = TQVariant(); + break; + } +#endif + default: + qDebug( "not implemented" ); + d->var = TQVariant(); + break; + } +} + +/** + * Returns a TQVariant help by this iterator. + * @return TQVariant held by this iterator + */ +TQVariant +Message::iterator::var() const +{ + return d->var; +} + +struct Message::Private { + DBusMessage *msg; +}; + +Message::Message( DBusMessage *m ) +{ + d = new Private; + d->msg = m; +} + +/** + * + */ +Message::Message( int messageType ) +{ + d = new Private; + d->msg = dbus_message_new( messageType ); +} + +/** + * Constructs a new Message with the given service and name. + * @param service service service that the message should be sent to + * @param name name of the message + */ +Message::Message( const TQString& service, const TQString& path, + const TQString& interface, const TQString& method ) +{ + d = new Private; + d->msg = dbus_message_new_method_call( service.latin1(), path.latin1(), + interface.latin1(), method.latin1() ); +} + +/** + * Constructs a message that is a reply to some other + * message. + * @param name the name of the message + * @param replayingTo original_message the message which the created + * message is a reply to. + */ +Message::Message( const Message& replayingTo ) +{ + d = new Private; + d->msg = dbus_message_new_method_return( replayingTo.d->msg ); +} + +Message:: Message( const TQString& path, const TQString& interface, + const TQString& name ) +{ + d = new Private; + d->msg = dbus_message_new_signal( path.ascii(), interface.ascii(), + name.ascii() ); +} + +Message::Message( const Message& replayingTo, const TQString& errorName, + const TQString& errorMessage ) +{ + d = new Private; + d->msg = dbus_message_new_error( replayingTo.d->msg, errorName.utf8(), + errorMessage.utf8() ); +} + +Message Message::operator=( const Message& other ) +{ + //FIXME: ref the other.d->msg instead of copying it? +} +/** + * Destructs message. + */ +Message::~Message() +{ + if ( d->msg ) { + dbus_message_unref( d->msg ); + } + delete d; d=0; +} + +int Message::type() const +{ + return dbus_message_get_type( d->msg ); +} + +void Message::setPath( const TQString& path ) +{ + dbus_message_set_path( d->msg, path.ascii() ); +} + +TQString Message::path() const +{ + return dbus_message_get_path( d->msg ); +} + +void Message::setInterface( const TQString& iface ) +{ + dbus_message_set_interface( d->msg, iface.ascii() ); +} + +TQString Message::interface() const +{ + return dbus_message_get_interface( d->msg ); +} + +void Message::setMember( const TQString& member ) +{ + dbus_message_set_member( d->msg, member.ascii() ); +} + +TQString Message::member() const +{ + return dbus_message_get_member( d->msg ); +} + +void Message::setErrorName( const TQString& err ) +{ + dbus_message_set_error_name( d->msg, err.ascii() ); +} + +TQString Message::errorName() const +{ + return dbus_message_get_error_name( d->msg ); +} + +void Message::setDestination( const TQString& dest ) +{ + dbus_message_set_destination( d->msg, dest.ascii() ); +} + +TQString Message::destination() const +{ + return dbus_message_get_destination( d->msg ); +} + +/** + * Sets the message sender. + * @param sender the sender + * @return false if unsuccessful + */ +bool +Message::setSender( const TQString& sender ) +{ + return dbus_message_set_sender( d->msg, sender.latin1() ); +} + +/** + * Returns sender of this message. + * @return sender + */ +TQString +Message::sender() const +{ + return dbus_message_get_sender( d->msg ); +} + +TQString Message::signature() const +{ + return dbus_message_get_signature( d->msg ); +} + + +/** + * Returns the starting iterator for the fields of this + * message. + * @return starting iterator + */ +Message::iterator +Message::begin() const +{ + return iterator( d->msg ); +} + +/** + * Returns the ending iterator for the fields of this + * message. + * @return ending iterator + */ +Message::iterator +Message::end() const +{ + return iterator(); +} + +/** + * Returns the field at position @p i + * @param i position of the wanted field + * @return TQVariant at position @p i or an empty TQVariant + */ +TQVariant +Message::at( int i ) +{ + iterator itr( d->msg ); + + while ( i-- ) { + if ( itr == end() ) + return TQVariant();//nothing there + ++itr; + } + return *itr; +} + +/** + * The underlying DBusMessage of this class. + * @return DBusMessage pointer. + */ +DBusMessage* +Message::message() const +{ + return d->msg; +} + +Message& Message::operator<<( bool b ) +{ + const dbus_bool_t right_size_bool = b; + dbus_message_append_args( d->msg, DBUS_TYPE_BOOLEAN, &right_size_bool, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( TQ_INT8 byte ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_BYTE, &byte, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( TQ_INT32 num ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_INT32, &num, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( TQ_UINT32 num ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_UINT32, &num, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( TQ_INT64 num ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_INT64, &num, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( TQ_UINT64 num ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_UINT64, &num, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( double num ) +{ + dbus_message_append_args( d->msg, DBUS_TYPE_DOUBLE, &num, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( const TQString& str ) +{ + const char *u = str.utf8(); + dbus_message_append_args( d->msg, DBUS_TYPE_STRING, &u, + DBUS_TYPE_INVALID ); +} + +Message& Message::operator<<( const TQVariant& custom ) +{ + //FIXME: imeplement +} + +} diff --git a/main/dependencies/dbus-tqt-1/message.h b/main/dependencies/dbus-tqt-1/message.h new file mode 100644 index 000000000..c882543db --- /dev/null +++ b/main/dependencies/dbus-tqt-1/message.h @@ -0,0 +1,131 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- */ +/* message.h: TQt wrapper for DBusMessage + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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 + * + */ +#ifndef DBUS_TQT_MESSAGE_H +#define DBUS_TQT_MESSAGE_H + +#include <tqvariant.h> +#include <tqstring.h> +#include <tqstringlist.h> + +#include "dbus/dbus.h" + +namespace DBusQt { + + class Message + { + public: + class iterator { + public: + iterator(); + iterator( const iterator& ); + iterator( DBusMessage* msg ); + ~iterator(); + + iterator& operator=( const iterator& ); + const TQVariant& operator*() const; + TQVariant& operator*(); + iterator& operator++(); + iterator operator++(int); + bool operator==( const iterator& it ); + bool operator!=( const iterator& it ); + + TQVariant var() const; + protected: + TQVariant marshallBaseType( DBusMessageIter* i ); + void fillVar(); + struct IteratorData; + IteratorData *d; + }; + + Message( int messageType ); + Message( DBusMessage * );//hide this one from the public implementation + Message( const TQString& service, const TQString& path, + const TQString& interface, const TQString& method ); + Message( const Message& replayingTo ); + Message( const TQString& path, const TQString& interface, + const TQString& name ); + Message( const Message& replayingTo, const TQString& errorName, + const TQString& errorMessage ); + + Message operator=( const Message& other ); + + virtual ~Message(); + + int type() const; + + void setPath( const TQString& ); + TQString path() const; + + void setInterface( const TQString& ); + TQString interface() const; + + void setMember( const TQString& ); + TQString member() const; + + void setErrorName( const TQString& ); + TQString errorName() const; + + void setDestination( const TQString& ); + TQString destination() const; + + bool setSender( const TQString& sender ); + TQString sender() const; + + TQString signature() const; + + iterator begin() const; + iterator end() const; + + TQVariant at( int i ); + + + public: + Message& operator<<( bool ); + Message& operator<<( TQ_INT8 ); + Message& operator<<( TQ_INT32 ); + Message& operator<<( TQ_UINT32 ); + Message& operator<<( TQ_INT64 ); + Message& operator<<( TQ_UINT64 ); + Message& operator<<( double ); + Message& operator<<( const TQString& ); + Message& operator<<( const TQVariant& ); + //Message& operator<<(); + //Message& operator<<(); + //Message& operator<<(); + //Message& operator<<(); + //Message& operator<<(); + //Message& operator<<(); + //Message& operator<<(); + + protected: + friend class Connection; + DBusMessage* message() const; + + private: + struct Private; + Private *d; + }; + +} + +#endif diff --git a/main/dependencies/dbus-tqt-1/missing b/main/dependencies/dbus-tqt-1/missing new file mode 100755 index 000000000..2630398e5 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that tqcontains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + tqfind . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a tqreplacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/main/dependencies/dbus-tqt-1/server.cpp b/main/dependencies/dbus-tqt-1/server.cpp new file mode 100644 index 000000000..a9610f55d --- /dev/null +++ b/main/dependencies/dbus-tqt-1/server.cpp @@ -0,0 +1,90 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* server.h: TQt wrapper for DBusServer + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.0 + * + * 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 "server.h" +#include "connection.h" + +#include "integrator.h" +using DBusQt::Internal::Integrator; + +namespace DBusQt +{ + +struct Server::Private { + Private() : integrator( 0 ), server( 0 ) + {} + + Integrator *integrator; + DBusServer *server; + DBusError error; +}; + +Server::Server( const TQString& addr, TQObject *tqparent ) + : TQObject( tqparent ) +{ + d = new Private; + + if ( !addr.isEmpty() ) { + init( addr ); + } +} + +Server::~Server() +{ + delete d; +} + +bool Server::isConnected() const +{ + return dbus_server_get_is_connected( d->server ); +} + +void Server::disconnect() +{ + dbus_server_disconnect( d->server ); +} + +TQString Server::address() const +{ + //FIXME: leak? + return dbus_server_get_address( d->server ); +} + +void Server::listen( const TQString& addr ) +{ + if ( !d->server ) { + init( addr ); + } +} + +void Server::init( const TQString& addr ) +{ + d->server = dbus_server_listen( addr.ascii(), &d->error ); + d->integrator = new Integrator( d->server, this ); + connect( d->integrator, TQT_SIGNAL(newConnection(Connection*)), + TQT_SIGNAL(newConnection(Connection*)) ); +} + +} + + +#include "server.moc" diff --git a/main/dependencies/dbus-tqt-1/server.h b/main/dependencies/dbus-tqt-1/server.h new file mode 100644 index 000000000..011b6d2e0 --- /dev/null +++ b/main/dependencies/dbus-tqt-1/server.h @@ -0,0 +1,58 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* server.h: TQt wrapper for DBusServer + * + * Copyright (C) 2003 Zack Rusin <zack@kde.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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 + * + */ +#ifndef DBUS_TQT_SERVER_H +#define DBUS_TQT_SERVER_H + +#include <tqobject.h> + +#include "dbus/dbus.h" + +namespace DBusQt +{ + class Connection; + class Server : public TQObject + { + Q_OBJECT + TQ_OBJECT + public: + Server( const TQString& addr = TQString(), TQObject *tqparent=0 ); + ~Server(); + + bool isConnected() const; + TQString address() const; + + public slots: + void listen( const TQString& addr ); + void disconnect(); + signals: + void newConnection( Connection* ); + + private: + void init( const TQString& addr ); + private: + struct Private; + Private *d; + }; +} + +#endif diff --git a/main/dependencies/dbus-tqt/AUTHORS b/main/dependencies/dbus-tqt/AUTHORS new file mode 100644 index 000000000..d4f9f8102 --- /dev/null +++ b/main/dependencies/dbus-tqt/AUTHORS @@ -0,0 +1,5 @@ +Harald Fernengel <harry@kdevelop.org> + Original developer + +Kevin Krammer <kevin.krammer@gmx.at> + Initial port, current maintainer diff --git a/main/dependencies/dbus-tqt/CMakeLists.txt b/main/dependencies/dbus-tqt/CMakeLists.txt new file mode 100644 index 000000000..9bfb0e4a0 --- /dev/null +++ b/main/dependencies/dbus-tqt/CMakeLists.txt @@ -0,0 +1,103 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +project( dbus-1-tqt ) + + +##### cmake setup ############################### + +cmake_minimum_required( VERSION 2.8 ) + +include( FindPkgConfig ) +include( CheckCXXSourceCompiles ) + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) +include( ConfigureChecks.cmake ) + + +##### install paths setup ####################### + +tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ) +tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" ) +tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ) +tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" ) +tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" ) + + +##### install headers ########################### + +install( FILES + tqdbuserror.h tqdbusmessage.h tqdbusconnection.h + tqdbusvariant.h tqdbusobject.h tqdbusproxy.h + tqdbusmacros.h tqdbusdata.h tqdbusdatalist.h + tqdbusdatamap.h tqdbusobjectpath.h tqdbusdataconverter.h + DESTINATION ${INCLUDE_INSTALL_DIR} ) + + +##### install other data ######################## + +##### write pkgconfig file ###################### + +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} ) +configure_file( dbus-1-tqt.pc.cmake dbus-1-tqt.pc @ONLY ) +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus-1-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) + + +##### build setup ############################### + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" ) +set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) + +add_definitions( + -DDBUS_COMPILATION + -DQT_THREAD_SUPPORT + ${TQT_CFLAGS_OTHER} +) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### dbus-1-tqt (shared) ######################### + +tde_add_library( dbus-1-tqt SHARED AUTOMOC + SOURCES ${dbus_tqt_MOCS} + tqdbusconnection.cpp tqdbuserror.cpp tqdbusintegrator.cpp + tqdbusmarshall.cpp tqdbusmessage.cpp tqdbusserver.cpp + tqdbusproxy.cpp tqdbusdata.cpp tqdbusdatalist.cpp + tqdbusobjectpath.cpp tqdbusdataconverter.cpp + VERSION 0.0.0 + LINK ${TQT_LIBRARIES} ${DBUS_LIBRARIES} + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### dbusxml2qt3 (executable) ################## + +tde_add_executable( dbusxml2qt3 + SOURCES + tools/dbusxml2qt3/classgen.cpp + tools/dbusxml2qt3/main.cpp + tools/dbusxml2qt3/methodgen.cpp + LINK ${TQT_LIBRARIES} + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/main/dependencies/dbus-tqt/COPYING b/main/dependencies/dbus-tqt/COPYING new file mode 100644 index 000000000..ec5ecb026 --- /dev/null +++ b/main/dependencies/dbus-tqt/COPYING @@ -0,0 +1,10 @@ +The software of this project is distributed under the terms of three +licenses. + +The Qt3 D-Bus bindings library is distributed under the terms of +the Academic Free License version 2.1 (see COPYING.AFL for details) +as well as the GNU Public License 2.1 (or at your option any later version, +see COPYING.GPL for details) + +The binding generator tool dbusxml2q3 is distributed under the terms +of the MIT licence (see tools/dbusxml2qt3/LICENSE for details) diff --git a/main/dependencies/dbus-tqt/COPYING.AFL b/main/dependencies/dbus-tqt/COPYING.AFL new file mode 100644 index 000000000..7c180c017 --- /dev/null +++ b/main/dependencies/dbus-tqt/COPYING.AFL @@ -0,0 +1,54 @@ +# Larry Rosen has ceased to use or recommend any version +# of the Academic Free License below version 2.1 + +The Academic Free License +v. 2.1 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work: + +Licensed under the Academic Free License version 2.1 + +1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original Work; + +c) to distribute copies of the Original Work and Derivative Works to the public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + +13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner. + + + diff --git a/main/dependencies/dbus-tqt/COPYING.GPL b/main/dependencies/dbus-tqt/COPYING.GPL new file mode 100644 index 000000000..0058a832a --- /dev/null +++ b/main/dependencies/dbus-tqt/COPYING.GPL @@ -0,0 +1,346 @@ +NOTE! The GPL below is copyrighted by the Free Software Foundation, but +the instance of code that it refers to (the kde programs) are copyrighted +by the authors who actually wrote it. + +--------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 tqcontains +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 tqcontains 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 tqcontains, 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/main/dependencies/dbus-tqt/ChangeLog b/main/dependencies/dbus-tqt/ChangeLog new file mode 100644 index 000000000..40fc384c8 --- /dev/null +++ b/main/dependencies/dbus-tqt/ChangeLog @@ -0,0 +1,51 @@ +2008-06-05 krake: Updating changelog after forgetting about it for a long + time. Rather incomplete list, listing only major changes. + * Added dbusxml2qt3 code generation tool for creating client and server side + code based on D-Bus XML introspection data + * Added cross-bindings test suite support + * Added QDBusDataConverter template to build helper classes for + transforming native C++ types into QDBusData objects and vice versa + * Added support for nested containers + * Added support for empty containers + * Added support for D-Bus variant + * Handling D-Bus object path different than String + +2006-01-28 krake: + * Added a default constructor to QDBusConnection which creates empty/null + connections suitable for variable initialization + * Fixed initialization of the connection member in QDBusProxy + * Use pkg-config to determine linker flags for the D-BUS base library + when building examples + * Added documentation on object registering to the service overview docs + * Added documentation on requesting service names to overview docs + * Added documentation on handling interfaces to service overview docs + * Added table of contents to client and service overview docs + +2006-01-25 krake: + * Fixed pkg-config input files and got them installed + * Fixed build files to use new package name dbus-1-qt3 instead of the too + generic qdbus + +2006-01-22 krake: + * API docs for QDBusMessage + +2006-01-21 krake: + * API docs for QDBusProxy and overview documentation for using the bindings + in a client. + * Adjusted example programs to changed build situation + * Changed example programs to use non-GUI QApplication + * API docs for QDBusError, QDBusObjectBase and overview documentation for + using the bindings to provide services. + * Fixed service example + * API docs for QDBusConnection + +2006-01-20 krake: + * Changed build files to be able to build with KDE 3.5 admin/ directory + +2006-01-19 krake: + * Changed library name to from dbus-qt3-1 dbus-1-qt3. Seems more logical to + to me having the DBus version number closer to "dbus" + +2006-01-17 krake: + * Imported my backport to the SVN directory originally created by Will + * Fixed licences (FSF address, missing licence in examle files) diff --git a/main/dependencies/dbus-tqt/ConfigureChecks.cmake b/main/dependencies/dbus-tqt/ConfigureChecks.cmake new file mode 100644 index 000000000..951e55f57 --- /dev/null +++ b/main/dependencies/dbus-tqt/ConfigureChecks.cmake @@ -0,0 +1,19 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# dbus-1 +pkg_search_module( DBUS dbus-1 ) +if( NOT DBUS_FOUND ) + tde_message_fatal( "dbus-1 is required, but was not found on your system" ) +endif( ) + +# tqt +find_package( TQt ) diff --git a/main/dependencies/dbus-tqt/INSTALL b/main/dependencies/dbus-tqt/INSTALL new file mode 100644 index 000000000..8a69d4ccd --- /dev/null +++ b/main/dependencies/dbus-tqt/INSTALL @@ -0,0 +1,184 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +tqcontains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `gmake' to compile the package. Or if you're using a Linux + powered machine, or if make is GNU make, type `make'. You can + check with make --version. KDE requires GNU make to build, if + gmake is appropriate, tqreplace any instance below of make with gmake. + It will give output similar to: + #make --version + GNU Make version 3.78.1, by Richard Stallman and Roland McGrath. + Built for i386--freebsd4.0 + Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 + ... + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/kde/bin', `/usr/local/kde/lib', etc. You can specify an +installation prefix other than `/usr/local/kde' by giving `configure' +the option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +tqfind the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/main/dependencies/dbus-tqt/NEWS b/main/dependencies/dbus-tqt/NEWS new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/main/dependencies/dbus-tqt/NEWS diff --git a/main/dependencies/dbus-tqt/README b/main/dependencies/dbus-tqt/README new file mode 100644 index 000000000..ab230e87c --- /dev/null +++ b/main/dependencies/dbus-tqt/README @@ -0,0 +1,20 @@ +This is a backport of Harald Fernengel's Qt4 D-Bus bindings. + +Some Qt4 based code had no direct equivalent in Qt3. Cases where this +transition to Qt3 might not be fully correct are marked with FIXME-QT4 + +Depending on the use case it might be necessary to extend QDBusMesssage +to allow marshalling/de-marshalling based on an application provided +helper as the Qt3 QVariant can not handle all cases the Qt4 pendant can +(user defined types, etc) + +In order to build you need to copy or symlink the kde-common/admin directory +into this directory and then run + +make -f Makefile.cvs + +to generate the configure script. + + + + diff --git a/main/dependencies/dbus-tqt/TODO b/main/dependencies/dbus-tqt/TODO new file mode 100644 index 000000000..b5c6423fa --- /dev/null +++ b/main/dependencies/dbus-tqt/TODO @@ -0,0 +1,11 @@ +- Have someone with Qt4 experience check the code marked with FIXME-QT4 + +- Port the Qt4 bindings' unit tests to something available for Qt3 + +- Add static methods for D-BUS standard errors to QDBusError. + At least for those a service implementation might need more often + +- Check possibility of a QObject adapter implementation of QDBusObjectBase, + i.e. a making an QObject's Q_SLOTS callable through D-BUS + + diff --git a/main/dependencies/dbus-tqt/cmake/modules/FindTDE.cmake b/main/dependencies/dbus-tqt/cmake/modules/FindTDE.cmake new file mode 100644 index 000000000..ab7592d14 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/FindTDE.cmake @@ -0,0 +1,86 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( NOT TDE_FOUND ) + + message( STATUS "checking for 'TDE'") + + # if the path is not already defined by user, + # find kde-config executable + if( NOT DEFINED KDECONFIG_EXECUTABLE ) + find_program( KDECONFIG_EXECUTABLE + NAMES kde-config + HINTS ${BIN_INSTALL_DIR} ) + if( NOT KDECONFIG_EXECUTABLE ) + tde_message_fatal( "kde-config are NOT found." ) + endif( NOT KDECONFIG_EXECUTABLE ) + endif( NOT DEFINED KDECONFIG_EXECUTABLE ) + + # check for installed trinity version + execute_process( + COMMAND ${KDECONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE _version + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if( _result ) + tde_message_fatal( "Unable to run kde-config!\n KDELIBS are correctly installed?\n Path to kde-config are corect?" ) + endif( _result ) + + # parse kde-config output, to extract TDE version + string( REGEX MATCH "KDE: ([0-9\\.]+)" __dummy "${_version}" ) + set( TDE_VERSION "${CMAKE_MATCH_1}" ) + + # ask kde-config for few paths + macro( __internal_get_path __type __var ) + execute_process( + COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type} + OUTPUT_VARIABLE ${__var} + OUTPUT_STRIP_TRAILING_WHITESPACE ) + endmacro( __internal_get_path ) + + __internal_get_path( include TDE_INCLUDE_DIR ) + __internal_get_path( lib TDE_LIB_DIR ) + __internal_get_path( exe TDE_BIN_DIR ) + __internal_get_path( data TDE_DATA_DIR ) + __internal_get_path( config TDE_CONFIG_DIR ) + __internal_get_path( html TDE_HTML_DIR ) + __internal_get_path( cmake TDE_CMAKE_DIR ) + __internal_get_path( qtplugins TDE_QTPLUGINS_DIR ) + + # find kde tools + macro( __internal_find_program __prog __var ) + find_program( ${__var} + NAMES ${__prog} + HINTS ${TDE_BIN_INSTALL_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if( NOT ${__var} ) + tde_message_fatal( "${__prog} are NOT found.\n KDELIBS are correctly installed?" ) + endif( NOT ${__var} ) + endmacro( __internal_find_program ) + + __internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE ) + __internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE ) + __internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE ) + __internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE ) + __internal_find_program( kconfig_compiler KDE3_KCFGC_EXECUTABLE ) + __internal_find_program( makekdewidgets KDE3_MAKEKDEWIDGETS_EXECUTABLE ) + + # dcopidlng is a bash script which using kde-config; + # if PATH to kde-config is not set, dcopidlng will fail; + # for this reason we set KDECONFIG environment variable before running dcopidlng + set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE} + CACHE INTERNAL KDE3_DCOPIDLNG_EXECUTABLE FORCE ) + + message( STATUS " found 'TDE', version ${TDE_VERSION}" ) + +endif( NOT TDE_FOUND ) + +include( "${TDE_CMAKE_DIR}/kdelibs.cmake" ) diff --git a/main/dependencies/dbus-tqt/cmake/modules/FindTQt.cmake b/main/dependencies/dbus-tqt/cmake/modules/FindTQt.cmake new file mode 100644 index 000000000..ea351385e --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/FindTQt.cmake @@ -0,0 +1,81 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +macro( tqt_message ) + message( STATUS "${ARGN}" ) +endmacro( ) + +pkg_search_module( TQT tqt ) + +if( NOT TQT_FOUND ) + tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." ) +endif( ) + +# tmoc_executable +execute_process( + COMMAND pkg-config tqt --variable=tmoc_executable + OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( TMOC_EXECUTABLE ) + tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to tmoc is not set.\n tqt is correctly installed?" ) +endif( ) + + +# moc_executable +execute_process( + COMMAND pkg-config tqt --variable=moc_executable + OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( MOC_EXECUTABLE ) + tqt_message( " moc path: ${MOC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" ) +endif( ) + + +# uic_executable +execute_process( + COMMAND pkg-config tqt --variable=uic_executable + OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) + +if( UIC_EXECUTABLE ) + tqt_message( " uic path: ${UIC_EXECUTABLE}" ) +else( ) + tde_message_fatal( "Path to uic is not set.\n tqt is correctly installed?" ) +endif( ) + + +# check if tqt is usable +tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) +set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} ) +foreach( _dirs ${TQT_LIBRARY_DIRS} ) + list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" ) +endforeach() +list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} ) + +check_cxx_source_compiles(" + #include <tqapplication.h> + int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } " + HAVE_USABLE_TQT ) + +if( NOT HAVE_USABLE_TQT ) + tde_message_fatal( "Unable to build a simple tqt test." ) +endif( ) + +tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) + + +# TQT_CXX_FLAGS +foreach( _flag ${TQT_CFLAGS_OTHER} ) + set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" ) +endforeach() diff --git a/main/dependencies/dbus-tqt/cmake/modules/TDEMacros.cmake b/main/dependencies/dbus-tqt/cmake/modules/TDEMacros.cmake new file mode 100644 index 000000000..eef5568bd --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/TDEMacros.cmake @@ -0,0 +1,1219 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( KDE3Macros ) # we will need this module for a while + + +################################################# +##### +##### tde_message_fatal + +macro( tde_message_fatal ) + message( FATAL_ERROR + "#################################################\n" + " ${ARGV}\n" + "#################################################" ) +endmacro( tde_message_fatal ) + + +################################################# +##### +##### tde_install_icons( <icons...> THEME <svgicons> DESTINATION <destdir> ) +##### default theme: hicolor +##### default destination: ${SHARE_INSTALL_DIR}/icons + +macro( tde_install_icons ) + + # clearing + unset( _dest ) + unset( _req_theme ) + unset( _icons ) + set( _var _icons ) + + # parse all arguments + foreach( _arg ${ARGV} ) + # directive DESTINATION + if( _arg STREQUAL "DESTINATION" ) + set( _var _dest ) + set( _directive 1 ) + endif( _arg STREQUAL "DESTINATION" ) + # directive THEME + if( _arg STREQUAL "THEME" ) + set( _var _req_theme ) + set( _directive 1 ) + endif( _arg STREQUAL "THEME" ) + # collect data + if( _directive ) + unset( _directive ) + else( _directive ) + set( ${_var} ${${_var}} ${_arg} ) + set( _var _icons ) + endif( _directive ) + endforeach( _arg ) + + #defaults + if( NOT _icons ) + set( _icons "*" ) + endif( NOT _icons ) + if( NOT _dest ) + set( _dest "${ICON_INSTALL_DIR}" ) + endif( NOT _dest ) + + foreach( _icon ${_icons} ) + unset( _theme ) # clearing + + file(GLOB _icon_files *-${_icon}.png _icon_files *-${_icon}.svg* ) + foreach( _icon_file ${_icon_files} ) + # FIXME need a review + string( REGEX MATCH "^.*/([a-zA-Z][a-zA-Z])([0-9a-zA-Z]+)\\-([a-z]+)\\-(.+)$" _dummy "${_icon_file}" ) + set( _type "${CMAKE_MATCH_1}" ) + set( _size "${CMAKE_MATCH_2}" ) + set( _group "${CMAKE_MATCH_3}" ) + set( _name "${CMAKE_MATCH_4}" ) + + # we must ignore invalid icon names + if( _type AND _size AND _group AND _name ) + + # autodetect theme + if( NOT _req_theme ) + unset( _theme ) + if( "${_type}" STREQUAL "cr" ) + set( _theme crystalsvg ) + elseif( "${_type}" STREQUAL "lo" ) + set( _theme locolor ) + endif( "${_type}" STREQUAL "cr" ) + # defaulting + if( NOT _theme ) + set( _theme hicolor ) + endif( NOT _theme ) + else( NOT _req_theme ) + set( _theme ${_req_theme} ) + endif( NOT _req_theme ) + + # fix "group" name + if( "${_group}" STREQUAL "mime" ) + set( _group "mimetypes" ) + endif( "${_group}" STREQUAL "mime" ) + if( "${_group}" STREQUAL "filesys" ) + set( _group "filesystems" ) + endif( "${_group}" STREQUAL "filesys" ) + if( "${_group}" STREQUAL "device" ) + set( _group "devices" ) + endif( "${_group}" STREQUAL "device" ) + if( "${_group}" STREQUAL "app" ) + set( _group "apps" ) + endif( "${_group}" STREQUAL "app" ) + if( "${_group}" STREQUAL "action" ) + set( _group "actions" ) + endif( "${_group}" STREQUAL "action" ) + + if( "${_size}" STREQUAL "sc" ) + install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/scalable/${_group}/ RENAME ${_name} ) + else( "${_size}" STREQUAL "sc" ) + install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/${_size}x${_size}/${_group}/ RENAME ${_name} ) + endif( "${_size}" STREQUAL "sc" ) + + endif( _type AND _size AND _group AND _name ) + + endforeach( _icon_file ) + endforeach( _icon ) + +endmacro( tde_install_icons ) + + +################################################# +##### +##### tde_add_lut( <source> <result> [depends] ) +##### default depends: source + +macro( tde_add_lut _src _lut _dep ) + set( create_hash_table ${CMAKE_SOURCE_DIR}/kjs/create_hash_table ) + if( NOT _dep ) + set( _dep ${_src} ) + endif( NOT _dep ) + add_custom_command( OUTPUT ${_lut} + COMMAND perl ARGS ${create_hash_table} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} -i > ${_lut} + DEPENDS ${_src} ) + set_source_files_properties( ${_dep} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_lut} ) + unset( _dep ) +endmacro( tde_add_lut ) + + +################################################# +##### +##### tde_add_luts( <sources...> ) + +macro( tde_add_luts ) + foreach( _src ${ARGV} ) + get_filename_component( _lut ${_src} NAME_WE ) + set( _lut "${_lut}.lut.h" ) + tde_add_lut( ${_src} ${_lut} ${_src} ) + endforeach( _src ) +endmacro( tde_add_luts ) + + +################################################# +##### +##### tde_install_la_file( <target> <destination> ) + +macro( tde_install_la_file _target _destination ) + + get_target_property( _target_location ${_target} LOCATION ) + get_filename_component( _laname ${_target_location} NAME_WE ) + get_filename_component( _soname ${_target_location} NAME ) + set( _laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la ) + + file( WRITE ${_laname} +"# ${_laname} - a libtool library file, generated by cmake +# The name that we can dlopen(3). +dlname='${_soname}' +# Names of this library +library_names='${_soname} ${_soname} ${_soname}' +# The name of the static archive +old_library='' +# Libraries that this one depends upon. +dependency_libs='' +# Version information.\ncurrent=0\nage=0\nrevision=0 +# Is this an already installed library?\ninstalled=yes +# Should we warn about portability when linking against -modules?\nshouldnotlink=yes +# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen='' +# Directory that this library needs to be installed in: +libdir='${_destination}' +" ) + + install( FILES ${_laname} DESTINATION ${_destination} ) + +endmacro( tde_install_la_file ) + + +################################################# +##### +##### tde_add_ui_files + +macro( tde_add_ui_files _sources ) + foreach( _ui_file ${ARGN} ) + + get_filename_component( _ui_basename ${_ui_file} NAME_WE ) + get_filename_component( _ui_absolute_path ${_ui_file} ABSOLUTE ) + + list( APPEND ${_sources} ${_ui_basename}.cpp ) + + add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp + COMMAND ${CMAKE_COMMAND} + -DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE} + -DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR} + -DUI_FILE:FILEPATH=${_ui_absolute_path} + -P ${CMAKE_MODULE_PATH}/tde_uic.cmake + COMMAND ${MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp + DEPENDS ${_ui_absolute_path} ) + + endforeach( _ui_file ) +endmacro( tde_add_ui_files ) + + +################################################# +##### +##### tde_moc + +macro( tde_moc _sources ) + foreach( _input_file ${ARGN} ) + + get_filename_component( _input_file "${_input_file}" ABSOLUTE ) + get_filename_component( _basename ${_input_file} NAME_WE ) + set( _output_file "${_basename}.moc" ) + add_custom_command( OUTPUT ${_output_file} + COMMAND + ${TMOC_EXECUTABLE} ${_input_file} -o ${_output_file} + DEPENDS + ${_input_file} ) + list( APPEND ${_sources} ${_output_file} ) + + endforeach( ) +endmacro( ) + + +################################################# +##### +##### tde_automoc + +macro( tde_automoc ) + foreach( _src_file ${ARGN} ) + + get_filename_component( _src_file "${_src_file}" ABSOLUTE ) + + if( EXISTS "${_src_file}" ) + + # read source file and check if have moc include + file( READ "${_src_file}" _src_content ) + string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" ) + + # found included moc(s)? + if( _moc_includes ) + foreach( _moc_file ${_moc_includes} ) + + # extracting moc filename + string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" ) + set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" ) + + # create header filename + get_filename_component( _src_path "${_src_file}" ABSOLUTE ) + get_filename_component( _src_path "${_src_path}" PATH ) + get_filename_component( _src_header "${_moc_file}" NAME_WE ) + set( _header_file "${_src_path}/${_src_header}.h" ) + + # if header doesn't exists, check in META_INCLUDES + if( NOT EXISTS "${_header_file}" ) + unset( _found ) + foreach( _src_path ${_meta_includes} ) + set( _header_file "${_src_path}/${_src_header}.h" ) + if( EXISTS "${_header_file}" ) + set( _found 1 ) + break( ) + endif( ) + endforeach( ) + if( NOT _found ) + get_filename_component( _moc_file "${_moc_file}" NAME ) + tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_file}.h' not found." ) + endif( ) + endif( ) + + # moc-ing header + add_custom_command( OUTPUT ${_moc_file} + COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file} + DEPENDS ${_header_file} ) + + # create dependency between source file and moc file + set_property( SOURCE ${_src_file} APPEND PROPERTY OBJECT_DEPENDS ${_moc_file} ) + + endforeach( _moc_file ) + + endif( _moc_includes ) + + endif( EXISTS "${_src_file}" ) + + endforeach( _src_file ) +endmacro( tde_automoc ) + + +################################################# +##### +##### __tde_internal_process_sources + +macro( __tde_internal_process_sources _sources ) + + unset( ${_sources} ) + + foreach( _arg ${ARGN} ) + get_filename_component( _ext ${_arg} EXT ) + get_filename_component( _name ${_arg} NAME_WE ) + get_filename_component( _path ${_arg} PATH ) + + # if not path, set it to "." + if( NOT _path ) + set( _path "./" ) + endif( NOT _path ) + + # handle .ui files + if( ${_ext} STREQUAL ".ui" ) + tde_add_ui_files( ${_sources} ${_arg} ) + + # handle .skel files + elseif( ${_ext} STREQUAL ".skel" ) + kde3_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) + + # handle .stub files + elseif( ${_ext} STREQUAL ".stub" ) + kde3_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) + + # handle .kcfgc files + elseif( ${_ext} STREQUAL ".kcfgc" ) + kde3_add_kcfg_files( ${_sources} ${_arg} ) + + # handle any other files + else( ${_ext} STREQUAL ".ui" ) + list(APPEND ${_sources} ${_arg} ) + endif( ${_ext} STREQUAL ".ui" ) + endforeach( _arg ) + +endmacro( __tde_internal_process_sources ) + + +################################################# +##### +##### tde_install_libtool_file + +macro( tde_install_libtool_file _target _destination ) + + get_target_property( _target_location ${_target} LOCATION ) + + # get name of target + get_filename_component( _name ${_target_location} NAME_WE ) + + # get .la name + set( _laname ${_name}.la ) + + # get .so name + get_filename_component( _soname ${_target_location} NAME ) + + # get version of target + get_target_property( _target_version ${_target} VERSION ) + get_target_property( _target_soversion ${_target} SOVERSION ) + + # we have so version + if( _target_version ) + set( _library_name_1 "${_soname}.${_target_version}" ) + set( _library_name_2 "${_soname}.${_target_soversion}" ) + set( _library_name_3 "${_soname}" ) + + string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_target_version}" ) + set( _version_current "${CMAKE_MATCH_1}" ) + set( _version_age "${CMAKE_MATCH_2}" ) + set( _version_revision "${CMAKE_MATCH_3}" ) + + # we have no so version (module?) + else( _target_version ) + set( _library_name_1 "${_soname}" ) + set( _library_name_2 "${_soname}" ) + set( _library_name_3 "${_soname}" ) + set( _version_current "0" ) + set( _version_age "0" ) + set( _version_revision "0" ) + endif( _target_version ) + + if( IS_ABSOLUTE ${_destination} ) + set( _libdir "${_destination}" ) + else( IS_ABSOLUTE ${_destination} ) + set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" ) + endif( IS_ABSOLUTE ${_destination} ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_libtool_file.cmake "${_laname}" @ONLY ) + + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} ) + +endmacro( tde_install_libtool_file ) + + +################################################# +##### +##### tde_install_export / tde_import + +function( tde_install_export ) + file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake ) + + set( mode "WRITE" ) + foreach( filename ${export_files} ) + file( READ ${filename} content ) + file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" ) + set( mode "APPEND" ) + endforeach( ) + + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} ) +endfunction( ) + + +macro( tde_import _library ) + message( STATUS "checking for '${_library}'" ) + string( TOUPPER "BUILD_${_library}" _build ) + if( ${_build} ) + message( STATUS " ok, activated for build" ) + else() + if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" ) + include( "${TDE_CMAKE_DIR}/${_library}.cmake" ) + message( STATUS " ok, found import file" ) + else() + tde_message_fatal( "'${_library}' are required,\n but is not installed nor selected for build" ) + endif() + endif() +endmacro() + + +################################################# +##### +##### tde_add_library + +macro( tde_add_library _arg_target ) + + unset( _target ) + unset( _type ) + unset( _static_pic ) + unset( _automoc ) + unset( _meta_includes ) + unset( _no_libtool_file ) + unset( _no_export ) + unset( _version ) + unset( _sources ) + unset( _destination ) + unset( _embed ) + unset( _link ) + unset( _dependencies ) + unset( _storage ) + + set( _shouldnotlink no ) + + foreach( _arg ${ARGV} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found one of directives: "SHARED", "STATIC", "MODULE" + if( "${_arg}" STREQUAL "SHARED" OR "${_arg}" STREQUAL "STATIC" OR "${_arg}" STREQUAL "MODULE" ) + set( _skip_store 1 ) + set( _type "${_arg}" ) + endif( "${_arg}" STREQUAL "SHARED" OR "${_arg}" STREQUAL "STATIC" OR "${_arg}" STREQUAL "MODULE" ) + + # found directive "STATIC_PIC" + if( "${_arg}" STREQUAL "STATIC_PIC" ) + set( _skip_store 1 ) + set( _type "STATIC" ) + set( _static_pic 1 ) + endif( "${_arg}" STREQUAL "STATIC_PIC" ) + + # found directive "AUTOMOC" + if( "${_arg}" STREQUAL "AUTOMOC" ) + set( _skip_store 1 ) + set( _automoc 1 ) + endif( "${_arg}" STREQUAL "AUTOMOC" ) + + # found directive "META_INCLUDES" + if( "${_arg}" STREQUAL "META_INCLUDES" ) + set( _skip_store 1 ) + set( _storage "_meta_includes" ) + endif( ) + + # found directive "NO_LIBTOOL_FILE" + if( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" ) + set( _skip_store 1 ) + set( _no_libtool_file 1 ) + endif( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" ) + + # found directive "NO_EXPORT" + if( "${_arg}" STREQUAL "NO_EXPORT" ) + set( _skip_store 1 ) + set( _no_export 1 ) + endif( "${_arg}" STREQUAL "NO_EXPORT" ) + + # found directive "VERSION" + if( "${_arg}" STREQUAL "VERSION" ) + set( _skip_store 1 ) + set( _storage "_version" ) + endif( "${_arg}" STREQUAL "VERSION" ) + + # found directive "SOURCES" + if( "${_arg}" STREQUAL "SOURCES" ) + set( _skip_store 1 ) + set( _storage "_sources" ) + endif( "${_arg}" STREQUAL "SOURCES" ) + + # found directive "EMBED" + if( "${_arg}" STREQUAL "EMBED" ) + set( _skip_store 1 ) + set( _storage "_embed" ) + endif( "${_arg}" STREQUAL "EMBED" ) + + # found directive "LINK" + if( "${_arg}" STREQUAL "LINK" ) + set( _skip_store 1 ) + set( _storage "_link" ) + endif( "${_arg}" STREQUAL "LINK" ) + + # found directive "DEPENDENCIES" + if( "${_arg}" STREQUAL "DEPENDENCIES" ) + set( _skip_store 1 ) + set( _storage "_dependencies" ) + endif( "${_arg}" STREQUAL "DEPENDENCIES" ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + list( APPEND ${_storage} ${_arg} ) + list( REMOVE_DUPLICATES ${_storage} ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + # if no type is set, we choose one + # based on BUILD_SHARED_LIBS + if( NOT _type ) + if( BUILD_SHARED_LIBS ) + set( _type "SHARED" ) + else( BUILD_SHARED_LIBS ) + set( _type "STATIC" ) + endif( BUILD_SHARED_LIBS ) + endif( NOT _type ) + + # change target name, based on type + string( TOLOWER "${_type}" _type_lower ) + set( _target "${_arg_target}-${_type_lower}" ) + + # create variables like "LIB_xxx" for convenience + if( ${_type} STREQUAL "SHARED" ) + string( TOUPPER "${_arg_target}" _tmp ) + set( LIB_${_tmp} ${_target} CACHE INTERNAL LIB_${tmp} FORCE ) + endif( ${_type} STREQUAL "SHARED" ) + + # disallow target without sources + if( NOT _sources ) + message( FATAL_ERROR "\nTarget [$_target] have no sources." ) + endif( NOT _sources ) + + # processing different types of sources + __tde_internal_process_sources( _sources ${_sources} ) + + # set automoc + if( _automoc ) + tde_automoc( ${_sources} ) + endif( _automoc ) + + # add target + add_library( ${_target} ${_type} ${_sources} ) + + # we assume that modules have no prefix and no version + # also, should not link + if( ${_type} STREQUAL "MODULE" ) + set_target_properties( ${_target} PROPERTIES PREFIX "" ) + unset( _version ) + set( _shouldnotlink yes ) + endif( ${_type} STREQUAL "MODULE" ) + + # set real name of target + set_target_properties( ${_target} PROPERTIES OUTPUT_NAME ${_arg_target} ) + + # set -fPIC flag for static libraries + if( _static_pic ) + set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC ) + endif( _static_pic ) + + # set version + if( _version ) + string( REGEX MATCH "^[0-9]+" _soversion ${_version} ) + set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} ) + endif( _version ) + + # set interface libraries (only for shared) + unset( _shared_libs ) + foreach( _lib ${_link} ) + #get_target_property( _lib_type ${_lib} TYPE ) + #if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) + if( NOT ${_lib} MATCHES ".+-static" ) + list( APPEND _shared_libs ${_lib} ) + endif( NOT ${_lib} MATCHES ".+-static" ) + #endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) + endforeach( _lib ) + target_link_libraries( ${_target} LINK_INTERFACE_LIBRARIES ${_shared_libs} ) + + # set embedded archives + if( _embed ) + list( INSERT _link 0 -Wl,-whole-archive ${_embed} -Wl,-no-whole-archive ) + endif( _embed ) + + # set link libraries + if( _link ) + target_link_libraries( ${_target} ${_link} ) + endif( ) + + # set dependencies + if( _dependencies ) + add_dependencies( ${_target} ${_dependencies} ) + endif( _dependencies ) + + # if destination directory is set + if( _destination ) + + # we export only shared libs (no static, no modules); + # also, do not export targets marked as "NO_EXPORT" (usually for kdeinit) + if( "SHARED" STREQUAL ${_type} AND NOT _no_export ) + + # get target properties: output name, version, soversion + get_target_property( _output ${_target} LOCATION ) + get_filename_component( _output ${_output} NAME ) + get_target_property( _version ${_target} VERSION ) + get_target_property( _soversion ${_target} SOVERSION ) + + if( _version ) + set( _location "${_destination}/${_output}.${_version}" ) + set( _soname "${_output}.${_soversion}" ) + else( ) + set( _location "${_destination}/${_output}" ) + set( _soname "${_output}" ) + endif( ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY ) + endif( ) + + # install target + install( TARGETS ${_target} DESTINATION ${_destination} ) + + # install .la files for dynamic libraries + if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file ) + tde_install_libtool_file( ${_target} ${_destination} ) + endif( ) + + endif( _destination ) + +endmacro( tde_add_library ) + + +################################################# +##### +##### tde_add_kpart + +macro( tde_add_kpart _target ) + tde_add_library( ${_target} ${ARGN} MODULE ) +endmacro( tde_add_kpart ) + + +################################################# +##### +##### tde_add_executable + +macro( tde_add_executable _arg_target ) + + unset( _target ) + unset( _automoc ) + unset( _meta_includes ) + unset( _setuid ) + unset( _sources ) + unset( _destination ) + unset( _link ) + unset( _dependencies ) + unset( _storage ) + + foreach( _arg ${ARGV} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found directive "AUTOMOC" + if( "${_arg}" STREQUAL "AUTOMOC" ) + set( _skip_store 1 ) + set( _automoc 1 ) + endif( "${_arg}" STREQUAL "AUTOMOC" ) + + # found directive "META_INCLUDES" + if( "${_arg}" STREQUAL "META_INCLUDES" ) + set( _skip_store 1 ) + set( _storage "_meta_includes" ) + endif( ) + + # found directive "SETUID" + if( "${_arg}" STREQUAL "SETUID" ) + set( _skip_store 1 ) + set( _setuid 1 ) + endif( "${_arg}" STREQUAL "SETUID" ) + + # found directive "SOURCES" + if( "${_arg}" STREQUAL "SOURCES" ) + set( _skip_store 1 ) + set( _storage "_sources" ) + endif( "${_arg}" STREQUAL "SOURCES" ) + + # found directive "LINK" + if( "${_arg}" STREQUAL "LINK" ) + set( _skip_store 1 ) + set( _storage "_link" ) + endif( "${_arg}" STREQUAL "LINK" ) + + # found directive "DEPENDENCIES" + if( "${_arg}" STREQUAL "DEPENDENCIES" ) + set( _skip_store 1 ) + set( _storage "_dependencies" ) + endif( "${_arg}" STREQUAL "DEPENDENCIES" ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + #set( ${_storage} "${${_storage}} ${_arg}" ) + list( APPEND ${_storage} ${_arg} ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + set( _target "${_arg_target}" ) + + # disallow target without sources + if( NOT _sources ) + message( FATAL_ERROR "\nTarget [$_target] have no sources." ) + endif( NOT _sources ) + + # processing different types of sources + __tde_internal_process_sources( _sources ${_sources} ) + + # set automoc + if( _automoc ) + tde_automoc( ${_sources} ) + endif( _automoc ) + + # add target + add_executable( ${_target} ${_sources} ) + + # set link libraries + if( _link ) + target_link_libraries( ${_target} ${_link} ) + endif( _link ) + + # set dependencies + if( _dependencies ) + add_dependencies( ${_target} ${_dependencies} ) + endif( _dependencies ) + + # set destination directory + if( _destination ) + if( _setuid ) + install( TARGETS ${_target} DESTINATION ${_destination} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE SETUID ) + else( _setuid ) + install( TARGETS ${_target} DESTINATION ${_destination} ) + endif( _setuid ) + endif( _destination ) + +endmacro( tde_add_executable ) + + +################################################# +##### +##### tde_add_kdeinit_executable + +macro( tde_add_kdeinit_executable _target ) + + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_executable.cmake ${_target}_kdeinit_executable.cpp COPYONLY ) + configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_module.cmake ${_target}_kdeinit_module.cpp COPYONLY ) + + unset( _sources ) + unset( _runtime_destination ) + unset( _library_destination ) + unset( _plugin_destination ) + + # default storage is _sources + set( _storage _sources ) + + # set default export to NO_EXPORT + set( _export "NO_EXPORT" ) + + foreach( _arg ${ARGN} ) + + # this variable help us to skip + # storing unapropriate values (i.e. directives) + unset( _skip_store ) + + # found directive "EXPORT" + if( "${_arg}" STREQUAL "EXPORT" ) + set( _skip_store 1 ) + unset( _export ) + endif( "${_arg}" STREQUAL "EXPORT" ) + + # found directive "RUNTIME_DESTINATION" + if( "${_arg}" STREQUAL "RUNTIME_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_runtime_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "RUNTIME_DESTINATION" ) + + # found directive "LIBRARY_DESTINATION" + if( "${_arg}" STREQUAL "LIBRARY_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_library_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "LIBRARY_DESTINATION" ) + + # found directive "PLUGIN_DESTINATION" + if( "${_arg}" STREQUAL "PLUGIN_DESTINATION" ) + set( _skip_store 1 ) + set( _storage "_plugin_destination" ) + unset( ${_storage} ) + endif( "${_arg}" STREQUAL "PLUGIN_DESTINATION" ) + + # storing value + if( _storage AND NOT _skip_store ) + list( APPEND ${_storage} ${_arg} ) + set( _storage "_sources" ) + endif( _storage AND NOT _skip_store ) + + endforeach( _arg ) + + # if destinations are not set, we using some defaults + # we assume that kdeinit executable MUST be installed + # (otherwise why we build it?) + if( NOT _runtime_destination ) + set( _runtime_destination ${BIN_INSTALL_DIR} ) + endif( NOT _runtime_destination ) + if( NOT _library_destination ) + set( _library_destination ${LIB_INSTALL_DIR} ) + endif( NOT _library_destination ) + if( NOT _plugin_destination ) + set( _plugin_destination ${PLUGIN_INSTALL_DIR} ) + endif( NOT _plugin_destination ) + + # create the library + tde_add_library( kdeinit_${_target} ${_sources} SHARED ${_export} + DESTINATION ${_library_destination} + ) + + # create the executable + tde_add_executable( ${_target} + SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_kdeinit_executable.cpp + LINK kdeinit_${_target}-shared + DESTINATION ${_runtime_destination} + ) + + # create the plugin + tde_add_kpart( ${_target} + SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_kdeinit_module.cpp + LINK kdeinit_${_target}-shared + DESTINATION ${_plugin_destination} + ) + +endmacro( tde_add_kdeinit_executable ) + + +################################################# +##### +##### tde_create_translation + +macro( tde_create_translation ) + + unset( _srcs ) + unset( _lang ) + unset( _dest ) + unset( _directive ) + unset( _var ) + + foreach( _arg ${ARGN} ) + + # found directive "FILES" + if( "${_arg}" STREQUAL "FILES" ) + unset( _srcs ) + set( _var _srcs ) + set( _directive 1 ) + endif( ) + + # found directive "LANG" + if( "${_arg}" STREQUAL "LANG" ) + unset( _lang ) + set( _var _lang ) + set( _directive 1 ) + endif( ) + + # found directive "DESTINATION" + if( "${_arg}" STREQUAL "DESTINATION" ) + unset( _dest ) + set( _var _dest ) + set( _directive 1 ) + endif( ) + + # collect data + if( _directive ) + unset( _directive ) + elseif( _var ) + list( APPEND ${_var} ${_arg} ) + endif() + + endforeach( ) + + if( NOT MSGFMT_EXECUTABLE ) + tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" ) + elseif( NOT _lang ) + tde_message_fatal( "missing LANG directive" ) + elseif( NOT _dest ) + set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" ) + endif( ) + + # if no file specified, include all *.po files + if( NOT _srcs ) + file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) + endif() + if( NOT _srcs ) + tde_message_fatal( "no source files" ) + endif() + + # generate *.mo files + foreach( _src ${_srcs} ) + get_filename_component( _src ${_src} ABSOLUTE ) + get_filename_component( _out ${_src} NAME_WE ) + set( _out_name "${_out}-${_lang}.mo" ) + set( _out_real_name "${_out}.mo" ) + add_custom_command( + OUTPUT ${_out_name} + COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_name} + DEPENDS ${_src} ) + add_custom_target( "${_out}-${_lang}-translation" ALL DEPENDS ${_out_name} ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} RENAME ${_out_real_name} DESTINATION ${_dest} ) + endforeach( ) + +endmacro( ) + + +################################################# +##### +##### tde_create_handbook + +macro( tde_create_handbook ) + + unset( _target ) + unset( _dest ) + unset( _noindex ) + unset( _srcs ) + unset( _extra ) + unset( _srcdir ) + + set( _lang en ) + set( _first_arg 1 ) + set( _var _target ) + + foreach( _arg ${ARGN} ) + + # found directive "NOINDEX" + if( "${_arg}" STREQUAL "NOINDEX" ) + set( _noindex 1 ) + set( _directive 1 ) + endif() + + # found directive "FILES" + if( "${_arg}" STREQUAL "FILES" ) + unset( _srcs ) + set( _var _srcs ) + set( _directive 1 ) + endif() + + # found directive "EXTRA" + if( "${_arg}" STREQUAL "EXTRA" ) + unset( _extra ) + set( _var _extra ) + set( _directive 1 ) + endif() + + # found directive "SRCDIR" + if( "${_arg}" STREQUAL "SRCDIR" ) + unset( _srcdir ) + set( _var _srcdir ) + set( _directive 1 ) + endif() + + # found directive DESTINATION + if( _arg STREQUAL "DESTINATION" ) + unset( _dest ) + set( _var _dest ) + set( _directive 1 ) + endif() + + # found directive "LANG" + if( "${_arg}" STREQUAL "LANG" ) + unset( _lang ) + set( _var _lang ) + set( _directive 1 ) + endif() + + # collect data + if( _directive ) + unset( _directive ) + elseif( _var ) + if( _first_arg ) + set( _target "${_arg}" ) + else() + list( APPEND ${_var} ${_arg} ) + endif() + endif() + + unset( _first_arg ) + + endforeach() + + # if no target specified, try to guess it from DESTINATION + if( NOT _target ) + if( NOT _dest ) + tde_message_fatal( "target name cannot be determined because DESTINATION is not set" ) + endif() + string( REPLACE "/" "-" _target "${_dest}" ) + endif() + + set( _target "${_target}-${_lang}-handbook" ) + + # if no file specified, include all docbooks, stylesheets and images + if( NOT _srcs ) + file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.docbook *.css *.png ) + endif() + + # if no destination specified, defaulting to HTML_INSTALL_DIR + if( NOT _dest ) + set( _dest "${HTML_INSTALL_DIR}/${_lang}" ) + # if destination is NOT absolute path, + # we assume that is relative to HTML_INSTALL_DIR + elseif( NOT IS_ABSOLUTE ${_dest} ) + set( _dest "${HTML_INSTALL_DIR}/${_lang}/${_dest}" ) + endif() + + if( NOT _srcs ) + tde_message_fatal( "no source files" ) + endif() + + if( NOT _noindex ) + + # check for index.docbook + list( FIND _srcs "index.docbook" _find_index ) + if( -1 EQUAL _find_index ) + tde_message_fatal( "missing index.docbook file" ) + endif() + + # check for srcdir + if( _srcdir ) + set( _srcdir "--srcdir=${_srcdir}" ) + endif() + + add_custom_command( + OUTPUT index.cache.bz2 + COMMAND ${KDE3_MEINPROC_EXECUTABLE} ${_srcdir} --check --cache index.cache.bz2 ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook + DEPENDS ${_srcs} ) + + add_custom_target( ${_target} ALL DEPENDS index.cache.bz2 ) + + list( APPEND _srcs ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ) + + endif() + + install( FILES ${_srcs} ${_extra} DESTINATION ${_dest} ) + tde_install_symlink( ${TDE_HTML_DIR}/${_lang}/common ${_dest} ) + +endmacro( ) + + +################################################# +##### +##### tde_include_tqt + +macro( tde_include_tqt ) + foreach( _cpp ${ARGN} ) + set_source_files_properties( ${_cpp} PROPERTIES COMPILE_FLAGS "-include tqt.h" ) + endforeach() +endmacro( ) + + +################################################# +##### +##### tde_install_symlink + +macro( tde_install_symlink _target _link ) + + # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX + if( IS_ABSOLUTE "${_link}" ) + set( _destination "${_link}" ) + else( IS_ABSOLUTE "${_link}" ) + set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" ) + endif( IS_ABSOLUTE "${_link}" ) + + get_filename_component( _path "${_destination}" PATH ) + if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) + install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" ) + endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) + + install( CODE "execute_process( COMMAND ln -s ${_target} \$ENV{DESTDIR}${_destination} )" ) + +endmacro( tde_install_symlink ) + + +################################################# +##### +##### tde_install_empty_directory + +macro( tde_install_empty_directory _path ) + + # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX + if( IS_ABSOLUTE "${_path}" ) + set( _destination "${_path}" ) + else( IS_ABSOLUTE "${_path}" ) + set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" ) + endif( IS_ABSOLUTE "${_path}" ) + + install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" ) + +endmacro( tde_install_empty_directory ) + + +################################################# +##### +##### tde_conditional_add_subdirectory + +macro( tde_conditional_add_subdirectory _cond _path ) + + if( ${_cond} ) + add_subdirectory( "${_path}" ) + endif( ${_cond} ) + +endmacro( tde_conditional_add_subdirectory ) + + +################################################# +##### +##### tde_auto_add_subdirectories + +macro( tde_auto_add_subdirectories ) + file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * ) + foreach( _dir ${_dirs} ) + if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ) + if( NOT ${_dir} STREQUAL ".svn" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt ) + add_subdirectory( ${_dir} ) + endif() + endif() + endforeach() +endmacro() + + +################################################# +##### +##### tde_save / tde_restore + +macro( tde_save ) + foreach( _var ${ARGN} ) + set( __bak_${_var} ${${_var}} ) + endforeach() +endmacro() + +macro( tde_restore ) + foreach( _var ${ARGN} ) + set( ${_var} ${__bak_${_var}} ) + unset( __bak_${_var} ) + endforeach() +endmacro() + + +################################################# +##### +##### tde_setup_install_path + +macro( tde_setup_install_path _path _default ) + if( DEFINED ${_path} ) + set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE ) + else( ) + set( ${_path} "${_default}" ) + endif( ) +endmacro( ) + + +################################################## + +if( ${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR} ) + tde_message_fatal( "Please use out-of-source building, like this: + \n rm ${CMAKE_SOURCE_DIR}/CMakeCache.txt + mkdir /tmp/${PROJECT_NAME}.build + cd /tmp/${PROJECT_NAME}.build + cmake ${CMAKE_SOURCE_DIR} [arguments...]" ) +endif( ) diff --git a/main/dependencies/dbus-tqt/cmake/modules/TDESetupPaths.cmake b/main/dependencies/dbus-tqt/cmake/modules/TDESetupPaths.cmake new file mode 100644 index 000000000..409a7b959 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/TDESetupPaths.cmake @@ -0,0 +1,67 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +################################################# +##### +##### tde_internal_setup_path + +macro( _tde_internal_setup_path _path _default _comment ) + if( DEFINED ${_path} ) + set( ${_path} "${${_path}}" CACHE PATH "${_comment}" ) + else( DEFINED ${_path} ) + set( ${_path} "${_default}" ) + endif( DEFINED ${_path} ) +endmacro( _tde_internal_setup_path ) + + +################################################# +##### +##### tde_setup_paths + +macro( tde_setup_paths ) + + # install paths + _tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" ) + _tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" ) + _tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" ) + _tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" ) + _tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" ) + _tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" ) + _tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" ) + + _tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" ) + _tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" ) + _tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" ) + _tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" ) + _tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/kde/HTML" "The HTML install dir for documentation" ) + _tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" ) + _tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files" ) + _tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" ) + _tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" ) + _tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" ) + _tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" ) + _tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" ) + _tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" ) + _tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" ) + _tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" ) + _tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir" ) + _tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" ) + + _tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" ) + _tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" ) + _tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" ) + + _tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" ) + _tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir" ) + _tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" ) + _tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" ) + +endmacro( tde_setup_paths ) diff --git a/main/dependencies/dbus-tqt/cmake/modules/tde_uic.cmake b/main/dependencies/dbus-tqt/cmake/modules/tde_uic.cmake new file mode 100644 index 000000000..a5458281f --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/tde_uic.cmake @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +get_filename_component( _ui_basename ${UI_FILE} NAME_WE ) + +# FIXME this will working only on out-of-source mode +set( local_ui_file ${_ui_basename}.ui ) +configure_file( ${UI_FILE} ${local_ui_file} COPYONLY ) +execute_process( COMMAND tqt-replace ${local_ui_file} ) + +execute_process( COMMAND ${UIC_EXECUTABLE} + -nounload -tr tr2i18n + ${local_ui_file} + OUTPUT_VARIABLE _ui_h_content ) + +if( _ui_h_content ) + string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" ) + string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" ) + file( WRITE ${_ui_basename}.h "${_ui_h_content}" ) +endif( ) + +if( TDE_QTPLUGINS_DIR ) + set( L -L ${TDE_QTPLUGINS_DIR} ) +endif( ) + +execute_process( COMMAND ${UIC_EXECUTABLE} + -nounload -tr tr2i18n + ${L} + -impl ${_ui_basename}.h + ${local_ui_file} + OUTPUT_VARIABLE _ui_cpp_content ) + +if( _ui_cpp_content ) + string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" ) + string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" ) + file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <klocale.h>\n\n${_ui_cpp_content}" ) +endif( ) diff --git a/main/dependencies/dbus-tqt/cmake/modules/template_dummy_cpp.cmake b/main/dependencies/dbus-tqt/cmake/modules/template_dummy_cpp.cmake new file mode 100644 index 000000000..8e1f5ff59 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/template_dummy_cpp.cmake @@ -0,0 +1,5 @@ +#ifdef _AIX + namespace { + void *not_empty_file; + } +#endif diff --git a/main/dependencies/dbus-tqt/cmake/modules/template_export_library.cmake b/main/dependencies/dbus-tqt/cmake/modules/template_export_library.cmake new file mode 100644 index 000000000..4d6cb3ff2 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/template_export_library.cmake @@ -0,0 +1,7 @@ +add_library( @_target@ @_type@ IMPORTED ) + +set_target_properties( @_target@ PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@" + IMPORTED_LOCATION "@_location@" + IMPORTED_SONAME "@_soname@" ) + diff --git a/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_executable.cmake b/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_executable.cmake new file mode 100644 index 000000000..3d480c44e --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_executable.cmake @@ -0,0 +1,2 @@ +extern "C" int kdemain(int argc, char* argv[]); +int main(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_module.cmake b/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_module.cmake new file mode 100644 index 000000000..68be1e7c3 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/template_kdeinit_module.cmake @@ -0,0 +1,3 @@ +#include <kdemacros.h> +extern "C" int kdemain(int argc, char* argv[]); +extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/main/dependencies/dbus-tqt/cmake/modules/template_libtool_file.cmake b/main/dependencies/dbus-tqt/cmake/modules/template_libtool_file.cmake new file mode 100644 index 000000000..fcd73d462 --- /dev/null +++ b/main/dependencies/dbus-tqt/cmake/modules/template_libtool_file.cmake @@ -0,0 +1,35 @@ +# @_laname@ - a libtool library file +# Generated by CMake - GNU libtool +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='@_library_name_2@' + +# Names of this library. +library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@' + +# The name of the static archive. +old_library='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Version information for @_name@. +current=@_version_current@ +age=@_version_age@ +revision=@_version_revision@ + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=@_shouldnotlink@ + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='@_libdir@' diff --git a/main/dependencies/dbus-tqt/dbus-1-tqt.pc.cmake b/main/dependencies/dbus-tqt/dbus-1-tqt.pc.cmake new file mode 100644 index 000000000..11aaf05a6 --- /dev/null +++ b/main/dependencies/dbus-tqt/dbus-1-tqt.pc.cmake @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@PC_EXEC_PREFIX@ +libdir=@PC_LIB_DIR@ +includedir=@PC_INCLUDE_DIR@ + +Name: dbus-tqt +Description: DBUS bindings for the Trinity Qt [TQt] interface +Version: 0.9.0 +Libs: -L${libdir} -ldbus-1-tqt +Cflags: -I${includedir} diff --git a/main/dependencies/dbus-tqt/debian/changelog b/main/dependencies/dbus-tqt/debian/changelog new file mode 100644 index 000000000..6ade667cf --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/changelog @@ -0,0 +1,5 @@ +dbus-1-tqt (0.9-0ubuntu1) maverick; urgency=low + + * Initial package + + -- Timothy Pearson <kb9vqf@pearsoncomputing.net> Tue, 23 Mar 2010 13:23:00 -0600 diff --git a/main/dependencies/dbus-tqt/debian/compat b/main/dependencies/dbus-tqt/debian/compat new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/compat @@ -0,0 +1 @@ +5 diff --git a/main/dependencies/dbus-tqt/debian/control b/main/dependencies/dbus-tqt/debian/control new file mode 100644 index 000000000..9a6e652a4 --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/control @@ -0,0 +1,32 @@ +Source: dbus-1-tqt +Section: devel +Priority: optional +Maintainer: Timothy Pearson <kb9vqf@pearsoncomputing.net> +Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.37.2), libtqtinterface-dev, libdbus-1-dev (>= 0.90), cmake +Standards-Version: 3.8.3 + +Package: libdbus-1-tqt-dev +Section: libdevel +Architecture: any +Depends: libdbus-1-tqt (= ${binary:Version}), libdbus-1-dev (>= 0.90), libtqtinterface-dev +Description: dbus bindings for the Trinity Qt [TQt] interface + D-BUS is a message bus, used for sending messages between applications. + Conceptually, it fits somewhere in between raw sockets and CORBA in + terms of complexity. + . + This package provides bindings for the Trinity Qt TQt interface. + . + See the dbus description for more information about D-BUS in general. + +Package: libdbus-1-tqt +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Description: dbus bindings for the Trinity Qt [TQt] interface + D-BUS is a message bus, used for sending messages between applications. + Conceptually, it fits somewhere in between raw sockets and CORBA in + terms of complexity. + . + This package provides bindings for the Trinity Qt TQt interface. + . + See the dbus description for more information about D-BUS in general. diff --git a/main/dependencies/dbus-tqt/debian/copyright b/main/dependencies/dbus-tqt/debian/copyright new file mode 100644 index 000000000..2369bdcef --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/copyright @@ -0,0 +1,93 @@ +This package was debianised by Jonathan Riddell <jriddell@ubuntu.com> on +Thu, 03 Jul 2008 18:21:06 +0100 + +Copyright (C) 2011 Timothy Pearson <kb9vqf@pearsoncomputing.net> +Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> +Copyright (C) 2005,2007 Kevin Krammer <kevin.krammer@gmx.at> + +The software of this project is distributed under the terms of three +licenses. + +The TQt D-Bus bindings library is distributed under the terms of the +Academic Free License version 2.1 as well as the GNU General Public +License 2 (or at your option any later version) + +See /usr/share/common-licenses/GPL-2 or below + +The binding generator tool dbusxml2q3 is distributed under the terms +of the MIT licence (see tools/dbusxml2qt3/LICENSE for details) + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +The Debian packaging is (C) 2008, Canonical Ltd and +is licensed under the GPL version 2 or later, see `/usr/share/common-licenses/GPL-2'. + + +The Academic Free License +v. 2.1 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work: + +Licensed under the Academic Free License version 2.1 + +1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original Work; + +c) to distribute copies of the Original Work and Derivative Works to the public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + +13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner. + + + + diff --git a/main/dependencies/dbus-tqt/debian/libdbus-1-tqt-dev.install b/main/dependencies/dbus-tqt/debian/libdbus-1-tqt-dev.install new file mode 100644 index 000000000..5464fd411 --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/libdbus-1-tqt-dev.install @@ -0,0 +1,5 @@ +debian/tmp/usr/include/* +debian/tmp/usr/lib/libdbus-1-tqt*.so +debian/tmp/usr/bin/dbusxml2qt3 +debian/tmp/usr/lib/pkgconfig/dbus-1-tqt.pc +debian/tmp/usr/lib/libdbus-1-tqt.la diff --git a/main/dependencies/dbus-tqt/debian/libdbus-1-tqt.install b/main/dependencies/dbus-tqt/debian/libdbus-1-tqt.install new file mode 100644 index 000000000..383103395 --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/libdbus-1-tqt.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libdbus-1-tqt*.so.* diff --git a/main/dependencies/dbus-tqt/debian/rules b/main/dependencies/dbus-tqt/debian/rules new file mode 100755 index 000000000..b7aa427f8 --- /dev/null +++ b/main/dependencies/dbus-tqt/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/rules/utils.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/cmake.mk diff --git a/main/dependencies/dbus-tqt/stamp-h.in b/main/dependencies/dbus-tqt/stamp-h.in new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/main/dependencies/dbus-tqt/stamp-h.in diff --git a/main/dependencies/dbus-tqt/subdirs b/main/dependencies/dbus-tqt/subdirs new file mode 100644 index 000000000..d8941a0e4 --- /dev/null +++ b/main/dependencies/dbus-tqt/subdirs @@ -0,0 +1,4 @@ +admin +dbus +debian +tools diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/LICENSE b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/LICENSE new file mode 100644 index 000000000..1edf08c35 --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/LICENSE @@ -0,0 +1,18 @@ +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.cpp b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.cpp new file mode 100644 index 000000000..fbe622b66 --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.cpp @@ -0,0 +1,1088 @@ +/* +* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +// TQt includes +#include <tqdom.h> +#include <tqfile.h> +#include <tqstringlist.h> +#include <tqtextstream.h> + +// local includes +#include "classgen.h" +#include "methodgen.h" + +class Set : public TQMap<TQString, bool> +{ +public: + void insertString(const TQString& key) + { + insert(key, true); + } + + void removeString(const TQString& key) + { + erase(key); + } + + void insertStringList(const TQStringList& list) + { + TQStringList::const_iterator it = list.begin(); + TQStringList::const_iterator endIt = list.end(); + for (; it != endIt; ++it) + { + insert(*it, true); + } + } +}; + +static void writeFileHeader(TQTextStream& stream) +{ + stream << "// File autogenerated" << endl; + stream << endl; +} + +static void writeFileFooter(TQTextStream& stream) +{ + stream << "// End of File" << endl; + stream << endl; +} + +static void openIncludeGuard(const TQString& className, TQTextStream& stream) +{ + stream << "#if !defined(" << className.upper() << "_H_INCLUDED)" << endl; + stream << "#define " << className.upper() << "_H_INCLUDED" << endl; + stream << endl; +} + +static void closeIncludeGuard(const TQString& className, TQTextStream& stream) +{ + stream << "#endif //" << className.upper() << "_H_INCLUDED" << endl; + stream << endl; +} + +static void openNamespaces(const TQStringList& namespaces, TQTextStream& stream) +{ + TQStringList::const_iterator it = namespaces.begin(); + TQStringList::const_iterator endIt = namespaces.end(); + for (; it != endIt; ++it) + { + stream << "namespace " << *it << endl; + stream << "{" << endl; + } + stream << endl; +} + +static void closeNamespaces(const TQStringList& namespaces, TQTextStream& stream) +{ + TQStringList::const_iterator it = namespaces.end(); + TQStringList::const_iterator endIt = namespaces.end(); + for (--it; it != endIt; --it) + { + stream << "}; // namespace " << *it << endl; + stream << endl; + } +} + +static void writeIncludes(const TQString& description, const TQStringList& includes, + TQTextStream& stream) +{ + if (includes.isEmpty()) return; + + stream << "// " << description << " includes" << endl; + + TQStringList::const_iterator it = includes.begin(); + TQStringList::const_iterator endIt = includes.end(); + for (;it != endIt; ++it) + { + stream << "#include " << *it << endl; + } + + stream << endl; +} + +static void extractHeaderIncludes(const Method& method, + TQMap<TQString, Set>& includes) +{ + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + if ((*it).headerIncludes.isEmpty()) continue; + + TQMap<TQString, TQStringList>::const_iterator mapIt = + (*it).headerIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator mapEndIt = + (*it).headerIncludes.end(); + + for (; mapIt != mapEndIt; ++mapIt) + { + includes[mapIt.key()].insertStringList(mapIt.data()); + } + } +} + +static void extractForwardDeclarations(const Method& method, Set& forwards) +{ + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + if ((*it).forwardDeclarations.isEmpty()) continue; + + forwards.insertStringList((*it).forwardDeclarations); + } +} + +static void writeHeaderIncludes(const Class& classData, Class::Role role, + TQTextStream& stream) +{ + TQMap<TQString, Set> includes; + Set forwards; + + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if ((*it).arguments.isEmpty()) continue; + + extractHeaderIncludes(*it, includes); + extractForwardDeclarations(*it, forwards); + } + + it = classData.msignals.begin(); + endIt = classData.msignals.end(); + for (; it != endIt; ++it) + { + if ((*it).arguments.isEmpty()) continue; + + extractHeaderIncludes(*it, includes); + extractForwardDeclarations(*it, forwards); + } + + + TQValueList<Property>::const_iterator propertyIt = classData.properties.begin(); + TQValueList<Property>::const_iterator propertyEndIt = classData.properties.end(); + for (; propertyIt != propertyEndIt; ++propertyIt) + { + if (!(*propertyIt).headerIncludes.isEmpty()) + { + TQMap<TQString, TQStringList>::const_iterator mapIt = + (*propertyIt).headerIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator mapEndIt = + (*propertyIt).headerIncludes.end(); + + for (; mapIt != mapEndIt; ++mapIt) + { + includes[mapIt.key()].insertStringList(mapIt.data()); + } + } + + if (!(*propertyIt).forwardDeclarations.isEmpty()) + { + forwards.insertStringList((*propertyIt).forwardDeclarations); + } + } + + switch (role) + { + case Class::Interface: + includes["tqdbus"].insertString("<tqdbusobject.h>"); + forwards.insertString("class TQT_DBusError"); + forwards.insertString("class TQDomElement"); + if (!classData.msignals.isEmpty()) + forwards.insertString("class TQString"); + if (!classData.asyncMethods.isEmpty()) + { + includes["TQt"].insertString("<tqmap.h>"); + forwards.erase("template <typename K, typename V> class TQMap"); + + includes["tqdbus"].insertString("<tqdbusmessage.h>"); + forwards.erase("class TQT_DBusMessage"); + } + break; + + case Class::Proxy: + includes["TQt"].insertString("<tqobject.h>"); + forwards.insertString("class TQT_DBusConnection"); + forwards.insertString("class TQT_DBusError"); + forwards.insertString("class TQT_DBusMessage"); + forwards.insertString("class TQT_DBusProxy"); + forwards.insertString("class TQString"); + if (!classData.properties.isEmpty()) + forwards.insertString("class TQT_DBusVariant"); + if (!classData.asyncMethods.isEmpty()) + { + includes["TQt"].insertString("<tqmap.h>"); + forwards.erase("template <typename K, typename V> class TQMap"); + } + break; + + case Class::Node: + includes["tqdbus"].insertString("<tqdbusobject.h>"); + forwards.insertString("class TQT_DBusConnection"); + forwards.insertString("class TQString"); + break; + } + + if (!includes["TQt"].isEmpty()) + writeIncludes("TQt", includes["TQt"].keys(), stream); + + if (!includes["tqdbus"].isEmpty()) + writeIncludes("TQt D-Bus", includes["tqdbus"].keys(), stream); + + if (!includes["local"].isEmpty()) + writeIncludes("local", includes["local"].keys(), stream); + + stream << "// forward declarations" << endl; + Set::const_iterator setIt = forwards.begin(); + Set::const_iterator setEndIt = forwards.end(); + for (; setIt != setEndIt; ++setIt) + { + stream << setIt.key() << ";" << endl; + } + stream << endl; +} + +static void extractSourceIncludes(const Method& method, + TQMap<TQString, Set>& includes) +{ + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + if ((*it).sourceIncludes.isEmpty()) continue; + + TQMap<TQString, TQStringList>::const_iterator mapIt = + (*it).sourceIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator mapEndIt = + (*it).sourceIncludes.end(); + + for (; mapIt != mapEndIt; ++mapIt) + { + includes[mapIt.key()].insertStringList(mapIt.data()); + } + } +} + +static void writeSourceIncludes(const Class& classData, Class::Role role, + TQTextStream& stream) +{ + TQMap<TQString, Set> includes; + + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if ((*it).arguments.isEmpty()) continue; + + extractSourceIncludes(*it, includes); + } + + it = classData.msignals.begin(); + endIt = classData.msignals.end(); + for (; it != endIt; ++it) + { + if ((*it).arguments.isEmpty()) continue; + + extractSourceIncludes(*it, includes); + } + + TQValueList<Property>::const_iterator propertyIt = classData.properties.begin(); + TQValueList<Property>::const_iterator propertyEndIt = classData.properties.end(); + for (; propertyIt != propertyEndIt; ++propertyIt) + { + if ((*propertyIt).sourceIncludes.isEmpty()) continue; + + TQMap<TQString, TQStringList>::const_iterator mapIt = + (*propertyIt).sourceIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator mapEndIt = + (*propertyIt).sourceIncludes.end(); + + for (; mapIt != mapEndIt; ++mapIt) + { + includes[mapIt.key()].insertStringList(mapIt.data()); + } + } + + switch (role) + { + case Class::Interface: + includes["TQt"].insertString("<tqdom.h>"); + includes["tqdbus"].insertString("<tqdbuserror.h>"); + includes["tqdbus"].insertString("<tqdbusmessage.h>"); + break; + + case Class::Proxy: + includes["tqdbus"].insertString("<tqdbuserror.h>"); + includes["tqdbus"].insertString("<tqdbusmessage.h>"); + includes["tqdbus"].insertString("<tqdbusproxy.h>"); + if (!classData.properties.isEmpty()) + { + includes["tqdbus"].insertString("<tqdbusconnection.h>"); + includes["tqdbus"].insertString("<tqdbusvariant.h>"); + } + break; + + case Class::Node: + includes["TQt"].insertString("<tqdom.h>"); + includes["TQt"].insertString("<tqmap.h>"); + includes["tqdbus"].insertString("<tqdbusconnection.h>"); + includes["tqdbus"].insertString("<tqdbusmessage.h>"); + break; + } + + if (!includes["TQt"].isEmpty()) + writeIncludes("TQt", includes["TQt"].keys(), stream); + + if (!includes["tqdbus"].isEmpty()) + writeIncludes("TQt D-Bus", includes["tqdbus"].keys(), stream); + + if (!includes["local"].isEmpty()) + writeIncludes("local", includes["local"].keys(), stream); + + stream << endl; +} + +static void writeInterfaceIncludes(const TQValueList<Class> interfaces, + TQTextStream& stream) +{ + stream << "// interface classes includes" << endl; + + TQValueList<Class>::const_iterator it = interfaces.begin(); + TQValueList<Class>::const_iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + stream << "#include \"" << (*it).name.lower() << ".h\"" << endl; + } + + stream << "#include \"introspectableinterface.h\"" << endl; + + stream << endl; +} + +static void openClassDeclaration(const Class& classData, + Class::Role role, TQTextStream& stream) +{ + switch (role) + { + case Class::Interface: + stream << "class " << classData.name << " : public TQT_DBusObjectBase" + << endl; + stream << "{" << endl; + stream << "public:" << endl; + stream << " virtual ~" << classData.name << "() {}" << endl; + stream << endl; + stream << " static void buildIntrospectionData(TQDomElement& interfaceElement);" << endl; + break; + + case Class::Proxy: + stream << "class " << classData.name << " : public TQObject" << endl; + stream << "{" << endl; + stream << " Q_OBJECT" << endl; + stream << " TQ_OBJECT" << endl; + stream << "public:" << endl; + stream << " " << classData.name + << "(const TQString& service, const TQString& path, TQObject* tqparent = 0, const char* name = 0);" << endl; + stream << endl; + + stream << " virtual ~" << classData.name << "();" << endl; + stream << endl; + + stream << " void setConnection(const TQT_DBusConnection& connection);" + << endl; + break; + + case Class::Node: + stream << "class " << classData.name << " : public TQT_DBusObjectBase" + << endl; + stream << "{" << endl; + stream << "public:" << endl; + stream << " " << classData.name << "();" << endl; + stream << endl; + stream << " virtual ~" << classData.name << "();" << endl; + stream << endl; + stream << " bool registerObject(const TQT_DBusConnection& connection, " + << "const TQString& path);" << endl; + stream << endl; + stream << " void unregisterObject();" << endl; + stream << endl; + stream << "protected:" << endl; + stream << " virtual TQT_DBusObjectBase* createInterface(" + << "const TQString& interfaceName) = 0;" << endl; + stream << endl; + stream << "protected: // usually no need to reimplement" << endl; + stream << " virtual bool handleMethodCall(const TQT_DBusMessage& message);" << endl; + stream << endl; + stream << "private:" << endl; + stream << " class Private;" << endl; + stream << " Private* m_private;" << endl; + break; + } + + stream << endl; +} + +static void closeClassDeclaration(const Class& classData, Class::Role role, + TQTextStream& stream) +{ + switch (role) + { + case Class::Interface: + break; + + case Class::Proxy: + stream << "private: // Hiding copy constructor and assignment operator" << endl; + stream << " " << classData.name << "(const " + << classData.name << "&);" << endl; + stream << " " << classData.name << "& operator=(const " + << classData.name << "&);" << endl; + break; + + case Class::Node: + stream << "private: // Hiding copy constructor and assignment operator" << endl; + stream << " " << classData.name << "(const " + << classData.name << "&);" << endl; + stream << " " << classData.name << "& operator=(const " + << classData.name << "&);" << endl; + break; + } + stream << "}; // class " << classData.name << endl; + stream << endl; +} + +static void writeMethodDeclarations(const Class& classData, Class::Role role, + TQTextStream& stream) +{ + if (role == Class::Interface && !classData.asyncReplyMethods.isEmpty()) + { + stream << "public:" << endl; + + TQValueList<Method>::const_iterator it = + classData.asyncReplyMethods.begin(); + TQValueList<Method>::const_iterator endIt = + classData.asyncReplyMethods.end(); + for (; it != endIt; ++it) + { + Method method = *it; + method.name += "AsyncReply"; + + stream << " virtual void "; + MethodGenerator::writeMethodDeclaration(method, false, false, stream); + + stream << " virtual void " << (*it).name + << "AsyncError(int asyncCallId, const TQT_DBusError& error);" + << endl; + stream << endl; + } + } + + if (!classData.methods.isEmpty() || !classData.asyncMethods.isEmpty()) + { + bool pureVirtual = true; + switch (role) + { + case Class::Interface: + pureVirtual = true; + stream << "protected:" << endl; + break; + + case Class::Proxy: + pureVirtual = false; + stream << "public:" << endl; + break; + + case Class::Node: // no variable methods + break; + } + + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if ((*it).async) continue; + + stream << " virtual bool "; + MethodGenerator::writeMethodDeclaration(*it, pureVirtual, true, stream); + } + + it = classData.asyncMethods.begin(); + endIt = classData.asyncMethods.end(); + for (; it != endIt; ++it) + { + Method method = *it; + method.name += "Async"; + + switch (role) + { + case Class::Interface: + stream << " virtual void "; + MethodGenerator::writeMethodDeclaration(method, pureVirtual, false, stream); + break; + + case Class::Proxy: + stream << " virtual bool "; + MethodGenerator::writeMethodDeclaration(method, pureVirtual, true, stream); + break; + + case Class::Node: // no async methods + break; + } + } + } + + if (!classData.properties.isEmpty()) + { + bool pureVirtual = true; + bool skip = false; + switch (role) + { + case Class::Interface: + qWarning("Properties not yet supported for interfaces"); + skip = true; + pureVirtual = true; + break; + + case Class::Proxy: + pureVirtual = false; + stream << "public:" << endl; + stream << " virtual void setDBusProperty(const TQString& name," + << " const TQT_DBusVariant& variant, TQT_DBusError& error);" + << endl; + stream << " virtual TQT_DBusVariant getDBusProperty(const TQString& name, TQT_DBusError& error) const;" << endl; + stream << endl; + break; + + case Class::Node: // no node properties + skip = true; + break; + } + + if (!skip) + { + TQValueList<Property>::const_iterator it = classData.properties.begin(); + TQValueList<Property>::const_iterator endIt = classData.properties.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writePropertyDeclaration(*it, pureVirtual, stream); + } + } + } + + switch (role) + { + case Class::Interface: + if (!classData.methods.isEmpty() || !classData.asyncMethods.isEmpty()) + { + stream << "protected: // implement sending replies" << endl; + stream << " virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;" << endl; + stream << endl; + stream << "protected: // usually no need to reimplement" << endl; + stream << " virtual bool handleMethodCall(const TQT_DBusMessage& message);" << endl; + } + else + { + stream << "protected: // no methods to handle" << endl; + stream << " virtual bool handleMethodCall(const TQT_DBusMessage&) { return false; }" << endl; + } + break; + + case Class::Proxy: + { + if (!classData.msignals.isEmpty()) + { + stream << "protected slots: // usually no need to reimplement" << endl; + stream << " virtual void slotHandleDBusSignal(const TQT_DBusMessage& message);" << endl; + stream << endl; + } + + if (!classData.asyncReplySignals.isEmpty()) + { + if (classData.msignals.isEmpty()) + { + stream << "protected slots: // usually no need to reimplement" << endl; + } + stream << " virtual void slotHandleAsyncReply(int id, const TQT_DBusMessage& message);" << endl; + stream << endl; + } + + stream << "protected:" << endl; + stream << " TQT_DBusProxy* m_baseProxy;" << endl; + + if (!classData.asyncMethods.isEmpty()) + { + stream << endl; + stream << " TQMap<int, TQString> m_asyncCalls;" << endl; + } + + break; + } + + case Class::Node: // not variable methods + break; + } + + stream << endl; +} + +static void writeSignalDeclarations(const Class& classData, Class::Role role, + TQTextStream& stream) +{ + if (classData.msignals.isEmpty() && classData.asyncReplySignals.isEmpty()) + return; + + TQString prefix; + switch (role) + { + case Class::Interface: + stream << "protected: // implement sending signals" << endl; + stream << " virtual bool handleSignalSend(const TQT_DBusMessage& reply) = 0;" << endl; + stream << " virtual TQString objectPath() const = 0;" << endl; + stream << endl; + stream << "protected: // for sending D-Bus signals" << endl; + prefix = " virtual bool emit"; + break; + + case Class::Proxy: + stream << "signals:" << endl; + prefix = " void "; + break; + + case Class::Node: // no signals + break; + } + + TQValueList<Method>::const_iterator it = classData.msignals.begin(); + TQValueList<Method>::const_iterator endIt = classData.msignals.end(); + for (; it != endIt; ++it) + { + stream << prefix; + MethodGenerator::writeMethodDeclaration(*it, false, false, stream); + } + + it = classData.asyncReplySignals.begin(); + endIt = classData.asyncReplySignals.end(); + for (; it != endIt; ++it) + { + stream << prefix; + + Method signal = *it; + signal.name += "AsyncReply"; + + MethodGenerator::writeMethodDeclaration(signal, false, false, stream); + } + + stream << endl; +} + +static void writeSignalEmitters(const Class& classData, TQTextStream& stream) +{ + if (classData.msignals.isEmpty()) return; + + TQValueList<Method>::const_iterator it = classData.msignals.begin(); + TQValueList<Method>::const_iterator endIt = classData.msignals.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writeSignalEmitter(classData, *it, stream); + } + + stream << endl; +} + +static void writeMethodCallDeclarations(const Class& classData, + TQTextStream& stream) +{ + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + stream << " "; + MethodGenerator::writeMethodCallDeclaration(*it, stream); + } + + if (!classData.asyncReplyMethods.isEmpty()) + { + stream << "protected:" << endl; + stream << " TQMap<int, TQT_DBusMessage> m_asyncCalls;" << endl; + stream << endl; + } +} + +static void writeInterfaceAsyncReplyHandlers(const Class& classData, + TQTextStream& stream) +{ + if (classData.asyncReplyMethods.isEmpty()) return; + + TQValueList<Method>::const_iterator it = classData.asyncReplyMethods.begin(); + TQValueList<Method>::const_iterator endIt = classData.asyncReplyMethods.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writeInterfaceAsyncReplyHandler(classData, *it, stream); + } +} + +static void writeMethodCalls(const Class& classData, TQTextStream& stream) +{ + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if ((*it).async) continue; + + MethodGenerator::writeMethodCall(classData, *it, stream); + } + + it = classData.asyncMethods.begin(); + endIt = classData.asyncMethods.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writeMethodCall(classData, *it, stream); + } +} + +static void writeProxyMethods(const Class& classData, TQTextStream& stream) +{ + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if ((*it).async) continue; + + MethodGenerator::writeProxyMethod(classData.name, *it, stream); + } + + it = classData.asyncMethods.begin(); + endIt = classData.asyncMethods.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writeProxyMethod(classData.name, *it, stream); + } +} + +static void writeProxyProperties(const Class& classData, TQTextStream& stream) +{ + if (classData.properties.isEmpty()) return; + + MethodGenerator::writeProxyGenericProperty(classData, stream); + + TQValueList<Property>::const_iterator it = classData.properties.begin(); + TQValueList<Property>::const_iterator endIt = classData.properties.end(); + for (; it != endIt; ++it) + { + MethodGenerator::writeProxyProperty(classData, *it, stream); + } +} + +static void splitAsyncProxyMethods(Class& classData) +{ + // create the async identifier + Argument idArgMethod; + idArgMethod.name = "asyncCallId"; + idArgMethod.signature = "int"; + idArgMethod.isPrimitive = true; + idArgMethod.direction = Argument::Out; + + Argument idArgSignal = idArgMethod; + idArgSignal.direction = Argument::In; + + TQValueList<Method>::iterator it = classData.methods.begin(); + TQValueList<Method>::iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if (!(*it).async) continue; + + Method method = *it; + + TQValueList<Argument> methodArgs; + TQValueList<Argument> signalArgs; + + // add id argument + methodArgs << idArgMethod; + signalArgs << idArgSignal; + + // split in/out arguments: "in" belong to the method, "out" to the new signal + TQValueList<Argument>::const_iterator argIt = method.arguments.begin(); + TQValueList<Argument>::const_iterator argEndIt = method.arguments.end(); + for (; argIt != argEndIt; ++argIt) + { + if ((*argIt).direction == Argument::Out) + { + // signal parameters are "out" but have "in" signature, + // e.g. "const T&" + Argument arg = *argIt; + arg.direction = Argument::In; + + signalArgs << arg; + } + else + methodArgs << *argIt; + } + + // change method + method.arguments = methodArgs; + + classData.asyncMethods << method; + + // create "callback" signal + Method signal = method; + signal.arguments = signalArgs; + + classData.asyncReplySignals << signal; + } +} + +static void splitAsyncInterfaceMethods(Class& classData) +{ + // create the async identifier + Argument idArgMethod; + idArgMethod.name = "asyncCallId"; + idArgMethod.signature = "int"; + idArgMethod.isPrimitive = true; + idArgMethod.direction = Argument::In; + + Argument idArgReply = idArgMethod; + + TQValueList<Method>::iterator it = classData.methods.begin(); + TQValueList<Method>::iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if (!(*it).async) continue; + + Method method = *it; + + TQValueList<Argument> methodArgs; + TQValueList<Argument> replyArgs; + + // add id argument + methodArgs << idArgMethod; + replyArgs << idArgReply; + + // split in/out arguments: "in" belong to the call, "out" to the reply + TQValueList<Argument>::const_iterator argIt = method.arguments.begin(); + TQValueList<Argument>::const_iterator argEndIt = method.arguments.end(); + for (; argIt != argEndIt; ++argIt) + { + if ((*argIt).direction == Argument::Out) + { + // reply parameters are "out" for the service but "in" for + // the reply handler + Argument arg = *argIt; + arg.direction = Argument::In; + + replyArgs << arg; + } + else + methodArgs << *argIt; + } + + // change method + method.arguments = methodArgs; + + classData.asyncMethods << method; + + // create reply handler + Method reply = method; + reply.arguments = replyArgs; + + classData.asyncReplyMethods << reply; + } +} + +bool ClassGenerator::initStreams(const TQString& baseName, + TQTextStream& headerStream, + TQTextStream& sourceStream) +{ + TQFile* headerFile = new TQFile(baseName + ".h"); + TQFile* sourceFile = new TQFile(baseName + ".cpp"); + + if (!headerFile->open(IO_WriteOnly) || !sourceFile->open(IO_WriteOnly)) + { + delete headerFile; + delete sourceFile; + + return false; + } + + headerStream.setDevice(TQT_TQIODEVICE(headerFile)); + sourceStream.setDevice(TQT_TQIODEVICE(sourceFile)); + + // create header + writeFileHeader(headerStream); + openIncludeGuard(baseName, headerStream); + + // create source + writeFileHeader(sourceStream); + sourceStream << "// declaration include" << endl; + sourceStream << "#include \"" << baseName << ".h\"" << endl; + sourceStream << endl; + + return true; +} + +bool ClassGenerator::finishStreams(const TQString& baseName, + TQTextStream& headerStream, + TQTextStream& sourceStream) +{ + closeIncludeGuard(baseName, headerStream); + writeFileFooter(headerStream); + writeFileFooter(sourceStream); + + TQIODevice* tqdevice = headerStream.tqdevice(); + headerStream.unsetDevice(); + delete tqdevice; + + tqdevice = sourceStream.tqdevice(); + sourceStream.unsetDevice(); + delete tqdevice; + + return true; +} + +bool ClassGenerator::extractClass(const TQDomElement& interfaceElement, + Class& classData) +{ + qDebug("ClassGenerator: processing interface '%s'", + interfaceElement.attribute("name").latin1()); + + classData.dbusName = interfaceElement.attribute("name"); + + TQStringList nameParts = TQStringList::split('.', classData.dbusName); + + if (nameParts.count() < 2) return false; + + classData.name = nameParts.back(); + nameParts.pop_back(); + classData.namespaces = nameParts; + + return MethodGenerator::extractMethods(interfaceElement, classData); +} + +bool ClassGenerator::generateInterface(const Class& classData, + TQTextStream& headerStream, + TQTextStream& sourceStream) +{ + Class classDataCopy = classData; + splitAsyncInterfaceMethods(classDataCopy); + + // create header + writeHeaderIncludes(classDataCopy, Class::Interface, headerStream); + + openNamespaces(classDataCopy.namespaces, headerStream); + openClassDeclaration(classDataCopy, Class::Interface, headerStream); + + writeSignalDeclarations(classDataCopy, Class::Interface, headerStream); + writeMethodDeclarations(classDataCopy, Class::Interface, headerStream); + writeMethodCallDeclarations(classDataCopy, headerStream); + + closeClassDeclaration(classDataCopy, Class::Interface, headerStream); + closeNamespaces(classDataCopy.namespaces, headerStream); + + // create source + writeSourceIncludes(classDataCopy, Class::Interface, sourceStream); + + openNamespaces(classDataCopy.namespaces, sourceStream); + + MethodGenerator::writeIntrospectionDataMethod(classDataCopy, sourceStream); + + writeSignalEmitters(classDataCopy, sourceStream); + writeInterfaceAsyncReplyHandlers(classDataCopy, sourceStream); + writeMethodCalls(classDataCopy, sourceStream); + + MethodGenerator::writeInterfaceMainMethod(classDataCopy, sourceStream); + + closeNamespaces(classDataCopy.namespaces, sourceStream); + + return true; +} + +bool ClassGenerator::generateProxy(const Class& classData, + TQTextStream& headerStream, + TQTextStream& sourceStream) +{ + Class classDataCopy = classData; + splitAsyncProxyMethods(classDataCopy); + + // create header + writeHeaderIncludes(classDataCopy, Class::Proxy, headerStream); + + openNamespaces(classDataCopy.namespaces, headerStream); + openClassDeclaration(classDataCopy, Class::Proxy, headerStream); + + writeSignalDeclarations(classDataCopy, Class::Proxy, headerStream); + writeMethodDeclarations(classDataCopy, Class::Proxy, headerStream); + + closeClassDeclaration(classDataCopy, Class::Proxy, headerStream); + closeNamespaces(classDataCopy.namespaces, headerStream); + + // create source + writeSourceIncludes(classDataCopy, Class::Proxy, sourceStream); + + openNamespaces(classDataCopy.namespaces, sourceStream); + + MethodGenerator::writeProxyBegin(classDataCopy, sourceStream); + + writeProxyMethods(classDataCopy, sourceStream); + + writeProxyProperties(classDataCopy, sourceStream); + + if (!classDataCopy.msignals.isEmpty()) + MethodGenerator::writeSignalHandler(classDataCopy, sourceStream); + + if (!classDataCopy.asyncReplySignals.isEmpty()) + MethodGenerator::writeProxyAsyncReplyHandler(classDataCopy, sourceStream); + + closeNamespaces(classDataCopy.namespaces, sourceStream); + + return true; +} + +bool ClassGenerator::generateNode(const Class& classData, + const TQValueList<Class>& interfaces, + TQTextStream& headerStream, + TQTextStream& sourceStream) +{ + // create header + writeHeaderIncludes(classData, Class::Node, headerStream); + + openNamespaces(classData.namespaces, headerStream); + openClassDeclaration(classData, Class::Node, headerStream); + + closeClassDeclaration(classData, Class::Node, headerStream); + closeNamespaces(classData.namespaces, headerStream); + + // create source + writeSourceIncludes(classData, Class::Node, sourceStream); + writeInterfaceIncludes(interfaces, sourceStream); + + openNamespaces(classData.namespaces, sourceStream); + + MethodGenerator::writeNodePrivate(classData, sourceStream); + + MethodGenerator::writeNodeBegin(classData, sourceStream); + + MethodGenerator::writeNodeMethods(classData, interfaces, sourceStream); + + closeNamespaces(classData.namespaces, sourceStream); + + return true; +} + +// End of File diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.h b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.h new file mode 100644 index 000000000..359789053 --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/classgen.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#if !defined(CLASSGEN_H_INCLUDED) +#define CLASSGEN_H_INCLUDED + +// forward declarations +class Class; +class TQDomElement; +class TQTextStream; +template<typename T> class TQValueList; + +class ClassGenerator +{ +public: + static bool initStreams(const TQString& baseName, + TQTextStream& headerStream, TQTextStream& sourceStream); + + static bool finishStreams(const TQString& baseName, + TQTextStream& headerStream, TQTextStream& sourceStream); + + static bool extractClass(const TQDomElement& interfaceElement, Class& classData); + static bool generateInterface(const Class& classData, + TQTextStream& headerStream, + TQTextStream& sourceStream); + static bool generateProxy(const Class& classData, + TQTextStream& headerStream, TQTextStream& sourceStream); + static bool generateNode(const Class& classData, + const TQValueList<Class>& interfaces, + TQTextStream& headerStream, TQTextStream& sourceStream); +}; + +#endif + +// End of File diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/main.cpp b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/main.cpp new file mode 100644 index 000000000..500febf0a --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/main.cpp @@ -0,0 +1,637 @@ +/* +* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +// standard includes +#include <iostream> +#include <cstdlib> + +// TQt includes +#include <tqdom.h> +#include <tqfile.h> +#include <tqmap.h> +#include <tqtextstream.h> + +// local includes +#include "classgen.h" +#include "methodgen.h" + +typedef TQMap<TQString, TQString> OptionMap; + +void usage(); + +OptionMap parseOptions(int argc, char** argv); + +bool checkForOption(const OptionMap& options, const TQString& option) +{ + return options.tqfind(option) != options.end(); +} + +int main(int argc, char** argv) +{ + const OptionMap options = parseOptions(argc, argv); + + if (!checkForOption(options, "filename")) + { + std::cerr << "dbusxml2qt3: introspection data file missing" << std::endl; + usage(); + exit(1); + } + + TQString fileName = options["filename"]; + TQFile file(fileName); + if (!file.exists()) + { + std::cerr << "dbusxml2qt3: introspection data file '" + << fileName.local8Bit().data() + << "' does not exist" << std::endl; + exit(2); + } + + if (!file.open(IO_ReadOnly)) + { + std::cerr << "dbusxml2qt3: introspection data file '" + << fileName.local8Bit().data() + << "' cannot be read" << std::endl; + exit(2); + } + + TQDomDocument document; + + if (!document.setContent(&file)) + { + file.close(); + + std::cerr << "dbusxml2qt3: introspection data file '" + << fileName.local8Bit().data() + << "' cannot be parsed" << std::endl; + exit(2); + } + + file.close(); + + TQDomElement rootElement = document.documentElement(); + if (rootElement.isNull() || rootElement.tagName() != "node") + { + std::cerr << "dbusxml2qt3: introspection data file '" + << fileName.local8Bit().data() + << "' does not have a 'node' element as its root node" + << std::endl; + exit(2); + } + + TQValueList<Class> interfaces; + bool hasIntrospectable = false; + + TQDomNode child = rootElement.firstChild(); + for (; !child.isNull(); child = child.nextSibling()) + { + if (!child.isElement()) continue; + + TQDomElement element = child.toElement(); + + if (element.tagName() == "interface") + { + if (!element.attribute("name").isEmpty()) + { + Class classData; + if (ClassGenerator::extractClass(element, classData)) + { + if (classData.dbusName == "org.freedesktop.DBus.Introspectable") + hasIntrospectable = true; + else + interfaces << classData; + } + } + } + } + + if (interfaces.isEmpty()) + { + std::cerr << "dbusxml2qt3: introspection data file '" + << fileName.local8Bit().data() + << "' does not contain any valid interface descriptions" + << std::endl; + exit(3); + } + + bool generateProxies = checkForOption(options, "proxy"); + bool generateInterfaces = checkForOption(options, "interface"); + bool generateNode = checkForOption(options, "node"); + + // if no specific option is selected, we generate everything + bool generateAll = !(generateProxies || generateInterfaces || generateNode); + + if (checkForOption(options, "classname")) + { + // class name only useful for single interfaces or just node + if (interfaces.count() > 1 && (generateAll || generateInterfaces || generateProxies)) + { + std::cerr << "dbusxml2qt3: class name option specified but " + << "introspection data file '" + << fileName.local8Bit().data() + << "' contains more than one interface description" + << std::endl; + exit(3); + } + + // class name for node is handled differently later on + if (!generateNode) + { + TQStringList nameParts = TQStringList::split("::", options["classname"]); + + interfaces[0].name = nameParts.back(); + + nameParts.pop_back(); + interfaces[0].namespaces = nameParts; + } + } + + if (checkForOption(options, "namespace")) + { + TQStringList nameParts = TQStringList::split("::", options["namespace"]); + + TQValueList<Class>::iterator it = interfaces.begin(); + TQValueList<Class>::iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + (*it).namespaces = nameParts; + } + } + + if (generateInterfaces || generateAll) + { + TQTextStream headerStream; + TQTextStream sourceStream; + + TQString baseName = options["interface"]; + if (!baseName.isEmpty()) + { + if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: proxy files, using base name '" + << baseName.local8Bit().data() + << "', could not be opened for writing" + << std::endl; + exit(4); + } + } + + TQValueList<Class>::const_iterator it = interfaces.begin(); + TQValueList<Class>::const_iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + if (baseName.isEmpty()) + { + if (!ClassGenerator::initStreams((*it).name.lower() + "interface", + headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: interface files, using base name '" + << baseName.local8Bit().data() + << "', could not be opened for writing" + << std::endl; + exit(4); + } + } + + ClassGenerator::generateInterface(*it, headerStream, sourceStream); + + if (baseName.isEmpty()) + { + ClassGenerator::finishStreams((*it).name.lower() + "interface", + headerStream, sourceStream); + } + } + + if (!baseName.isEmpty()) + ClassGenerator::finishStreams(baseName, headerStream, sourceStream); + } + + if (generateProxies || generateAll) + { + TQTextStream headerStream; + TQTextStream sourceStream; + + TQString baseName = options["proxy"]; + if (!baseName.isEmpty()) + { + if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: proxy files, using base name '" + << baseName.local8Bit().data() + << "', could not be opened for writing" + << std::endl; + exit(4); + } + } + + TQValueList<Class>::const_iterator it = interfaces.begin(); + TQValueList<Class>::const_iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + if (baseName.isEmpty()) + { + if (!ClassGenerator::initStreams((*it).name.lower() + "proxy", + headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: proxy files, using base name '" + << baseName.local8Bit().data() + << "', could not be opened for writing" + << std::endl; + exit(4); + } + } + + ClassGenerator::generateProxy(*it, headerStream, sourceStream); + + if (baseName.isEmpty()) + { + ClassGenerator::finishStreams((*it).name.lower() + "proxy", + headerStream, sourceStream); + } + } + + if (!baseName.isEmpty()) + ClassGenerator::finishStreams(baseName, headerStream, sourceStream); + } + + if (generateNode || generateAll) + { + if (!hasIntrospectable) + { + qDebug("Generating org.freedesktop.DBus.Introspectable on demand"); + + Class classData; + classData.name = "Introspectable"; + classData.dbusName = "org.freedesktop.DBus.Introspectable"; + + classData.namespaces << "org" << "freedesktop" << "DBus"; + + Method method; + method.name = "Introspect"; + method.noReply = false; + method.async = false; + + Argument argument; + argument.name = "data"; + argument.direction = Argument::Out; + argument.signature = "TQString"; + argument.accessor = "String"; + argument.isPrimitive = false; + argument.dbusSignature = "s"; + + argument.forwardDeclarations << "class TQString"; + argument.sourceIncludes["TQt"].append("<tqstring.h>"); + + method.arguments << argument; + classData.methods << method; + + TQTextStream headerStream; + TQTextStream sourceStream; + + if (!ClassGenerator::initStreams(classData.name.lower() + "interface", + headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: interface files, using base name '" + << classData.name.lower().local8Bit().data() << "interface" + << "', could not be opened for writing" + << std::endl; + exit(4); + } + + ClassGenerator::generateInterface(classData, + headerStream, sourceStream); + + ClassGenerator::finishStreams(classData.name.lower() + "interface", + headerStream, sourceStream); + } + + TQString nodeClassName = options["classname"]; + if (nodeClassName.isEmpty()) + { + nodeClassName = rootElement.attribute("name"); + if (nodeClassName.startsWith("/")) nodeClassName = nodeClassName.mid(1); + if (nodeClassName.isEmpty()) + { + std::cerr << "dbusxml2qt3: cannot generate node without class name." + << std::endl; + exit(3); + } + + nodeClassName.tqreplace('/', "_"); + } + + TQStringList nameParts = TQStringList::split("::", nodeClassName); + + Class classData; + classData.name = nameParts.back(); + + nameParts.pop_back(); + classData.namespaces = nameParts; + + if (checkForOption(options, "namespace")) + { + nameParts = TQStringList::split("::", options["namespace"]); + + classData.namespaces = nameParts; + } + + TQTextStream headerStream; + TQTextStream sourceStream; + + TQString baseName = options["node"]; + if (baseName.isEmpty()) baseName = classData.name.lower() + "node"; + + if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream)) + { + std::cerr << "dbusxml2qt3: interface files, using base name '" + << baseName.local8Bit().data() + << "', could not be opened for writing" + << std::endl; + exit(4); + } + + ClassGenerator::generateNode(classData, interfaces, + headerStream, sourceStream); + + ClassGenerator::finishStreams(baseName, headerStream, sourceStream); + } + + return 0; +} + +void usage() +{ + std::cout << "usage: dbusxml2qt3 [options] <introspectionfile>" << std::endl; + std::cout << std::endl; + + std::cout << "Options:" << std::endl; + std::cout << "-h, --help" << std::endl; + std::cout << "\tDisplay this help" << std::endl; + std::cout << std::endl; + + std::cout << "-c <classname>, --class <classname>" << std::endl; + std::cout << "\tUse 'classname' instead of last string in interface name" + << std::endl; + std::cout << std::endl; + + std::cout << "-N [namespace], --namespace [namespace]" << std::endl; + std::cout << "\tOverride namespaces. If provided, use 'namespace' instead, otherwise ignore namespaces" + << std::endl; + std::cout << std::endl; + + std::cout << "-i [basename], --interface [basename]" << std::endl; + std::cout << "\tGenerate interface files. If provided, use 'basename' for filenames" + << std::endl; + std::cout << std::endl; + + std::cout << "-p [basename], --proxy [basename]" << std::endl; + std::cout << "\tGenerate proxy files. If provided, use 'basename' for filenames" + << std::endl; + std::cout << std::endl; + + std::cout << "-n [basename], --node [basename]" << std::endl; + std::cout << "\tGenerate node files. If provided, use 'basename' for filenames" + << std::endl; + std::cout << std::endl; + + std::cout << "Examples:" << std::endl; + std::cout << "dbusxml2qt3 myinterface.xml" << std::endl; + std::cout << "\tGenerates as much as possible, i.e. interfaces, proxies and, " + << "if a node name is specified in 'myinterface.xml', the node files" + << std::endl; + std::cout << "\tUses lowercased interface names as plus type specific suffix " + << "for the file names" << std::endl; + std::cout << std::endl; + + std::cout << "dbusxml2qt3 myinterface.xml -N" << std::endl; + std::cout << "\tSame as first example but does not use namespaces" + << std::endl; + std::cout << std::endl; + + std::cout << "dbusxml2qt3 myinterface.xml -N org::myorg" << std::endl; + std::cout << "\tSame as first example but overrides namespaces with 'org::myorg'" + << std::endl; + std::cout << std::endl; + + std::cout << "dbusxml2qt3 myinterface.xml -n mynode -c MyNode" << std::endl; + std::cout << "\tGenerate only node files, use 'mynode' as the file basename " + << "and classname 'MyClass'" + << std::endl; + std::cout << std::endl; + + std::cout << "dbusxml2qt3 myinterface.xml -p" << std::endl; + std::cout << "\tGenerate only proxy files, use default file basename" + << std::endl; + std::cout << std::endl; + + std::cout << "dbusxml2qt3 myinterface.xml -p myproxy" << std::endl; + std::cout << "\tGenerate only proxy files, use 'myproxy' as the file basename" + << std::endl; + std::cout << std::endl; +} + +bool testAndSetOption(OptionMap& options, const TQString& option, const TQString& value) +{ + OptionMap::iterator it = options.tqfind(option); + if (it == options.end()) + { + options.insert(option, value); + return true; + } + + return false; +} + +OptionMap parseOptions(int argc, char** argv) +{ + TQStringList args; + for (int i = 1; i < argc; ++i) + { + args << TQString::fromLocal8Bit(argv[i]); + } + + OptionMap options; + + while (!args.isEmpty()) + { + TQString arg = args.front(); + args.pop_front(); + + if (arg.startsWith("-")) + { + if (arg.endsWith("help")) + { + usage(); + exit(0); + } + else if (arg == "-p" || arg == "--proxy") + { + // test for optional argument + TQString value; + if (!args.isEmpty() > 0 && !args[0].startsWith("-")) + { + value = args.front(); + args.pop_front(); + } + + if (!testAndSetOption(options, "proxy", value)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() << "'"; + + if (!value.isEmpty()) + std::cerr << ", value '" << value.local8Bit().data() << "':"; + else + std::cerr << ":"; + + std::cerr << " already set to '" + << options["proxy"].local8Bit().data() << std::endl; + } + } + else if (arg == "-i" || arg == "--interface") + { + // test for optional argument + TQString value; + if (!args.isEmpty() > 0 && !args[0].startsWith("-")) + { + value = args.front(); + args.pop_front(); + } + + if (!testAndSetOption(options, "interface", value)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() << "'"; + + if (!value.isEmpty()) + std::cerr << ", value '" << value.local8Bit().data() << "':"; + else + std::cerr << ":"; + + std::cerr << " already set to '" + << options["interface"].local8Bit().data() << std::endl; + } + } + else if (arg == "-n" || arg == "--node") + { + // test for optional argument + TQString value; + if (!args.isEmpty() > 0 && !args[0].startsWith("-")) + { + value = args.front(); + args.pop_front(); + } + + if (!testAndSetOption(options, "node", value)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() << "'"; + + if (!value.isEmpty()) + std::cerr << ", value '" << value.local8Bit().data() << "':"; + else + std::cerr << ":"; + + std::cerr << " already set to '" + << options["node"].local8Bit().data() << std::endl; + } + } + else if (arg == "-N" || arg == "--namespace") + { + // test for optional argument + TQString value; + if (!args.isEmpty() > 0 && !args[0].startsWith("-")) + { + value = args.front(); + args.pop_front(); + } + + if (!testAndSetOption(options, "namespace", value)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() << "'"; + + if (!value.isEmpty()) + std::cerr << ", value '" << value.local8Bit().data() << "':"; + else + std::cerr << ":"; + + std::cerr << " already set to '" + << options["namespace"].local8Bit().data() << std::endl; + } + } + else if (arg == "-c" || arg == "--class") + { + // test for mandatory argument + if (args.isEmpty() || args[0].startsWith("-")) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() + << "': mandatory parameter missing" << std::endl; + usage(); + exit(1); + } + + TQString value = args.front(); + args.pop_front(); + + if (!testAndSetOption(options, "classname", value)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() << "'"; + + if (!value.isEmpty()) + std::cerr << ", value '" << value.local8Bit().data() << "':"; + else + std::cerr << ":"; + + std::cerr << " already set to '" + << options["classname"].local8Bit().data() << std::endl; + } + } + else + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() + << "': unknown option" << std::endl; + usage(); + exit(1); + } + } + else + { + if (!testAndSetOption(options, "filename", arg)) + { + std::cerr << "Error while parsing command line argument '" + << arg.local8Bit().data() + << "': introspection file already given as '" + << options["filename"].local8Bit().data() << std::endl; + usage(); + exit(1); + } + } + } + + return options; +} + +// End of File diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.cpp b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.cpp new file mode 100644 index 000000000..5741f4e54 --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.cpp @@ -0,0 +1,1773 @@ +/* +* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +// TQt includes +#include <tqdom.h> +#include <tqtextstream.h> + +// local includes +#include "methodgen.h" + +static bool parseDBusSignature(const TQString& signature, Argument& argument) +{ + argument.dbusSignature = signature; + + if (signature.length() == 1) + { + if (signature == "b") + { + argument.signature = "bool"; + argument.accessor = "Bool"; + argument.isPrimitive = true; + } + else if (signature == "y") + { + argument.signature = "TQ_UINT8"; + argument.accessor = "Byte"; + argument.isPrimitive = true; + } + else if (signature == "n") + { + argument.signature = "TQ_INT16"; + argument.accessor = "Int16"; + argument.isPrimitive = true; + } + else if (signature == "q") + { + argument.signature = "TQ_UINT16"; + argument.accessor = "UInt16"; + argument.isPrimitive = true; + } + else if (signature == "i") + { + argument.signature = "TQ_INT32"; + argument.accessor = "Int32"; + argument.isPrimitive = true; + } + else if (signature == "u") + { + argument.signature = "TQ_UINT32"; + argument.accessor = "UInt32"; + argument.isPrimitive = true; + } + else if (signature == "x") + { + argument.signature = "TQ_INT64"; + argument.accessor = "Int64"; + argument.isPrimitive = true; + } + else if (signature == "t") + { + argument.signature = "TQ_UINT64"; + argument.accessor = "UInt64"; + argument.isPrimitive = true; + } + else if (signature == "d") + { + argument.signature = "double"; + argument.accessor = "Double"; + argument.isPrimitive = true; + } + else if (signature == "s") + { + argument.signature = "TQString"; + argument.accessor = "String"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQString"); + argument.sourceIncludes["TQt"].append("<tqstring.h>"); + } + else if (signature == "o") + { + argument.signature = "TQT_DBusObjectPath"; + argument.accessor = "ObjectPath"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQT_DBusObjectPath"); + argument.sourceIncludes["tqdbus"].append("<tqdbusobjectpath.h>"); + } + else if (signature == "v") + { + argument.signature = "TQT_DBusVariant"; + argument.accessor = "Variant"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQT_DBusVariant"); + argument.sourceIncludes["tqdbus"].append("<tqdbusvariant.h>"); + } + else + return false; + } + else if (signature.startsWith("a")) + { + if (signature == "as") + { + argument.signature = "TQStringList"; + argument.accessor = "List"; + argument.subAccessor = "TQStringList"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQStringList"); + + argument.sourceIncludes["tqdbus"].append("<tqdbusdatalist.h>"); + argument.sourceIncludes["TQt"].append("<tqstringlist.h>"); + } + else if (signature.startsWith("a{")) + { + int from = signature.tqfind("{"); + int to = signature.tqfindRev("}"); + if (from == -1 || to == -1 || (to - from - 1) < 2) return false; + + TQString dictSignature = signature.mid(from + 1, (to - from - 1)); + + Argument key; + if (!parseDBusSignature(dictSignature.left(1), key)) return false; + + Argument value; + if (parseDBusSignature(dictSignature.mid(1), value)) + { + if (!value.subAccessor.isEmpty()) + { + argument.isPrimitive = false; + argument.containerClass = "TQT_DBusDataMap<" + key.signature + ">"; + argument.signature = "TQT_DBusDataMap<" + key.signature + ">"; + argument.accessor = key.accessor + "KeyMap"; + + argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap"); + argument.forwardDeclarations += key.forwardDeclarations; + + argument.sourceIncludes = key.sourceIncludes; + argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>"); + } + else + { + argument.isPrimitive = false; + argument.containerClass = "TQT_DBusDataMap<" + key.signature + ">"; + argument.signature = "TQMap<" + key.signature + + ", " + value.signature + ">"; + argument.accessor = key.accessor + "KeyMap"; + argument.subAccessor = value.accessor + "Map"; + + argument.forwardDeclarations.append("template <typename K, typename V> class TQMap"); + argument.forwardDeclarations += key.forwardDeclarations; + argument.forwardDeclarations += value.forwardDeclarations; + + argument.sourceIncludes = key.sourceIncludes; + argument.sourceIncludes["TQt"].append("<tqmap.h>"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>"); + + TQMap<TQString, TQStringList>::const_iterator it = + value.sourceIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator endIt = + value.sourceIncludes.end(); + for (; it != endIt; ++it) + { + argument.sourceIncludes[it.key()] += it.data(); + } + } + } + else + { + argument.isPrimitive = false; + argument.containerClass = "TQT_DBusDataMap<" + key.signature + ">"; + argument.signature = "TQT_DBusDataMap<" + key.signature + ">"; + argument.accessor = key.accessor + "KeyMap"; + + argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap"); + argument.forwardDeclarations += key.forwardDeclarations; + + argument.sourceIncludes = key.sourceIncludes; + argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>"); + } + } + else + { + TQString itemSignature = signature.mid(1); + + Argument item; + if (parseDBusSignature(itemSignature, item)) + { + argument.isPrimitive = false; + argument.signature = "TQValueList<" + item.signature + ">"; + argument.accessor = "List"; + argument.subAccessor = item.accessor + "List"; + argument.containerClass = "TQT_DBusDataList"; + + argument.forwardDeclarations.append("class TQT_DBusDataList"); + argument.forwardDeclarations.append("template <typename T> class TQValueList"); + argument.forwardDeclarations += item.forwardDeclarations; + + argument.sourceIncludes["TQt"].append("<tqvaluelist.h>"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdatalist.h>"); + + TQMap<TQString, TQStringList>::const_iterator it = + item.sourceIncludes.begin(); + TQMap<TQString, TQStringList>::const_iterator endIt = + item.sourceIncludes.end(); + for (; it != endIt; ++it) + { + argument.sourceIncludes[it.key()] += it.data(); + } + } + else + { + argument.signature = "TQT_DBusDataList"; + argument.accessor = "List"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQT_DBusDataList"); + + argument.sourceIncludes["tqdbus"].append("<tqdbusdatalist.h>"); + } + } + } + else + return false; + + return true; +} + +static TQMap<TQString, TQString> extractTypeAnnotations(const TQDomElement& element) +{ + const TQString annotationPrefix = "org.freedesktop.DBus.TQt3.Type."; + + TQMap<TQString, TQString> annotations; + + TQDomNode node = element.firstChild(); + for (uint count = 1; !node.isNull(); node = node.nextSibling(), ++count) + { + if (!node.isElement()) continue; + + TQDomElement element = node.toElement(); + if (element.tagName() != "annotation") continue; + + TQString name = element.attribute("name"); + if (name.isEmpty()) continue; + + TQString value = element.attribute("value").stripWhiteSpace(); + if (value.isEmpty()) continue; + + if (!name.startsWith(annotationPrefix)) continue; + + TQString arg = name.mid(annotationPrefix.length()); + + annotations.insert(arg, value); + } + + return annotations; +} + +static bool hasAnnotation(const TQDomElement& element, const TQString& annotation, TQString* value = 0) +{ + for (TQDomNode node = element.firstChild(); !node.isNull(); + node = node.nextSibling()) + { + if (!node.isElement()) continue; + + TQDomElement childElement = node.toElement(); + if (childElement.tagName() != "annotation") continue; + if (childElement.attribute("name") != annotation) continue; + + if (value != 0) *value = childElement.attribute("value"); + return true; + } + + return false; +} + +static TQValueList<Argument> extractArguments(const TQDomElement& methodElement, + Class& classData) +{ + TQMap<TQString, TQString> argAnnotations = extractTypeAnnotations(methodElement); + + TQValueList<Argument> arguments; + + bool isSignal = methodElement.tagName() == "signal"; + + uint inCount = 0; + uint outCount = 0; + for (TQDomNode node = methodElement.firstChild(); !node.isNull(); + node = node.nextSibling()) + { + if (!node.isElement()) continue; + + TQDomElement element = node.toElement(); + if (element.tagName() != "arg") continue; + if (element.attribute("type").isEmpty()) continue; + + Argument argument; + argument.name = element.attribute("name"); + if (argument.name.isEmpty()) + argument.name = TQString("arg%1").arg(inCount + outCount); + + argument.direction = Argument::In; + if (!isSignal && element.attribute("direction", "in") == "out") + argument.direction = Argument::Out; + + TQString annotation; + if (!isSignal && argument.direction == Argument::In) + { + annotation = argAnnotations[TQString("In%1").arg(inCount)]; + ++inCount; + } + else + { + annotation = argAnnotations[TQString("Out%1").arg(outCount)]; + ++outCount; + } + + if (!annotation.isEmpty()) + { + // just assume nobody uses annotations for primitives + argument.annotatedType = annotation; + argument.signature = annotation; + argument.isPrimitive = false; + argument.dbusSignature = element.attribute("type"); + + TQString includeBase = + TQString("\"%1type%2.h\"").arg(classData.name.lower()); + + argument.headerIncludes["local"].append(includeBase.arg("declarations")); + argument.sourceIncludes["local"].append(includeBase.arg("includes")); + argument.sourceIncludes["tqdbus"].append("<tqdbusdataconverter.h>"); + } + else if (!parseDBusSignature(element.attribute("type"), argument)) + { + argument.signature = "TQT_DBusData"; + argument.isPrimitive = false; + + argument.forwardDeclarations.append("class TQT_DBusData"); + argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>"); + } + + arguments.append(argument); + } + + return arguments; +} + +static void writeVariable(const Argument& argument, uint index, + const TQString& prefix, TQTextStream& stream) +{ + stream << prefix << argument.signature << " _" << argument.name; + if (argument.direction == Argument::In) + { + if (!argument.annotatedType.isEmpty()) + { + stream << ";" << endl; + + // TODO: error handling? + stream << prefix << "TQT_DBusDataConverter::convertFromTQT_DBusData<" + << argument.annotatedType + << TQString(">(message[%1], _").arg(index) + << argument.name << ")"; + } + else if (!argument.accessor.isEmpty()) + { + stream << TQString::fromUtf8(" = message[%1].to").arg(index); + stream << argument.accessor; + + if (!argument.subAccessor.isEmpty()) + { + stream << TQString("().to%1").arg(argument.subAccessor); + } + + stream << "()"; + } + else + stream << TQString::fromUtf8(" = message[%1]").arg(index); + } + + stream << ";" << endl; +} + +static void writeVariables(const TQString& prefix, const Method& method, + TQTextStream& stream) +{ + uint count = 0; + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + writeVariable(*it, count, prefix, stream); + + if ((*it).direction == Argument::In) ++count; + } +} + +static void writeSignalEmit(const Method& signal, TQTextStream& stream) +{ + stream << " emit " << signal.name << "("; + + TQValueList<Argument>::const_iterator it = signal.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = signal.arguments.end(); + for (; it != endIt;) + { + stream << "_" << (*it).name; + + ++it; + if (it != endIt) stream << ", "; + } + + stream << ");" << endl; +} + +static void writeMethodIntrospection(const Method& method, bool& firstArgument, + TQTextStream& stream) +{ + stream << " methodElement.setAttribute(\"name\", \"" + << method.name << "\");" << endl; + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + stream << endl; + if (firstArgument) + { + firstArgument = false; + + stream << " TQDomElement argumentElement = document.createElement(" + << "\"arg\");" << endl; + } + else + { + stream << " argumentElement = document.createElement(" + << "\"arg\");" << endl; + } + + stream << " argumentElement.setAttribute(\"name\", \"" + << (*it).name << "\");" << endl; + + stream << " argumentElement.setAttribute(\"type\", \"" + << (*it).dbusSignature << "\");" << endl; + + stream << " argumentElement.setAttribute(\"direction\", \"" + << ((*it).direction == Argument::In ? "in" : "out") << "\");" + << endl; + + stream << " methodElement.appendChild(argumentElement);" << endl; + } + stream << endl; +} + +static void writeNodeInitialization(const Class& classData, + const TQValueList<Class>& interfaces, TQTextStream& stream) +{ + stream << "bool " << classData.name + << "::registerObject(const TQT_DBusConnection& connection, " + << "const TQString& path)" << endl; + stream << "{" << endl; + stream << " if (path.isEmpty()) return false;" << endl; + stream << endl; + + stream << " if (!m_private->objectPath.isEmpty()) unregisterObject();" + << endl; + stream << endl; + + stream << " m_private->connection = connection;" << endl; + stream << " m_private->objectPath = path;" << endl; + stream << endl; + stream << " if (!m_private->connection.registerObject(path, this))" << endl; + stream << " {" << endl; + stream << " m_private->connection = TQT_DBusConnection();" << endl; + stream << " m_private->objectPath = TQString();" << endl; + stream << endl; + stream << " return false;" << endl; + stream << " }" << endl; + stream << endl; + + stream << " if (m_private->interfaces.isEmpty())" << endl; + stream << " {" << endl; + stream << " TQString name = \"org.freedesktop.DBus.Introspectable\";" + << endl; + stream << " TQT_DBusObjectBase* interface = m_private;" << endl; + stream << " m_private->interfaces.insert(name, interface);" << endl; + + TQValueList<Class>::const_iterator it = interfaces.begin(); + TQValueList<Class>::const_iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + stream << endl; + stream << " name = \"" << (*it).dbusName << "\";" << endl; + stream << " interface = createInterface(name);" << endl; + stream << " Q_ASSERT(interface != 0);" << endl; + stream << " m_private->interfaces.insert(name, interface);" << endl; + } + + stream << " }" << endl; + stream << endl; + stream << " return true;" << endl; + stream << "}" << endl; + stream << endl; +} +static void writeNodeIntrospection(const Class& classData, + const TQValueList<Class>& interfaces, TQTextStream& stream) +{ + stream << "void " << classData.name << "::Private" + << "::cacheIntrospectionData()" << endl; + stream << "{" << endl; + + stream << " TQDomDocument doc;" << endl; + stream << " TQDomElement nodeElement = doc.createElement(\"node\");" << endl; + stream << " TQDomElement interfaceElement = doc.createElement(\"interface\");" + << endl; + stream << " org::freedesktop::DBus::Introspectable" + << "::buildIntrospectionData(interfaceElement);" << endl; + stream << " nodeElement.appendChild(interfaceElement);" << endl; + + TQValueList<Class>::const_iterator it = interfaces.begin(); + TQValueList<Class>::const_iterator endIt = interfaces.end(); + for (; it != endIt; ++it) + { + if ((*it).dbusName == "org.freedesktop.DBus.Introspectable") continue; + + stream << endl; + stream << " interfaceElement = doc.createElement(\"interface\");" + << endl; + stream << " " << (*it).namespaces.join("::") + "::" + (*it).name + << "::buildIntrospectionData(interfaceElement);" << endl; + stream << " nodeElement.appendChild(interfaceElement);" << endl; + } + + stream << endl; + stream << " doc.appendChild(nodeElement);" << endl; + stream << endl; + + stream << " introspectionData = \"<!DOCTYPE node PUBLIC \\\"" + << "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\\\"\\n" + << "\\\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" + << "\\\">\\n\";" << endl; + stream << " introspectionData += doc.toString();" << endl; + stream << "}" << endl; + stream << endl; +} + +bool MethodGenerator::extractMethods(const TQDomElement& interfaceElement, + Class& classData) +{ + TQMap<TQString, TQString> propertyAnnotations = + extractTypeAnnotations(interfaceElement); + + uint propertyCount = 0; + for (TQDomNode node = interfaceElement.firstChild(); !node.isNull(); + node = node.nextSibling()) + { + if (!node.isElement()) continue; + + TQDomElement element = node.toElement(); + if (element.attribute("name").isEmpty()) continue; + + if (element.tagName() == "method" || element.tagName() == "signal") + { + Method method; + method.name = element.attribute("name"); + method.arguments = extractArguments(element, classData); + method.noReply = false; + method.async = false; + + if (element.tagName() == "method") + { + method.async = hasAnnotation(element, "org.freedesktop.DBus.GLib.Async"); + classData.methods.append(method); + } + else + classData.msignals.append(method); + } + else if (element.tagName() == "property") + { + Property property; + property.name = element.attribute("name"); + property.read = element.attribute("access").tqfind("read") != -1; + property.write = element.attribute("access").tqfind("write") != -1; + + TQString annotation = + propertyAnnotations[TQString("Property%1").arg(propertyCount)]; + + if (!annotation.isEmpty()) + { + property.annotatedType = annotation; + property.signature = annotation; + property.dbusSignature = element.attribute("type"); + property.isPrimitive = false; + + TQString includeBase = + TQString("\"%1type%2.h\"").arg(classData.name.lower()); + + property.headerIncludes["local"].append(includeBase.arg("declarations")); + property.sourceIncludes["local"].append(includeBase.arg("includes")); + property.sourceIncludes["tqdbus"].append("<tqdbusdataconverter.h>"); + } + else if (!parseDBusSignature(element.attribute("type"), property)) + { + property.signature = "TQT_DBusData"; + property.isPrimitive = false; + + property.forwardDeclarations.append("class TQT_DBusData"); + property.sourceIncludes["tqdbus"].append("<tqdbusdata.h>"); + } + + classData.properties.append(property); + ++propertyCount; + } + } + + return !classData.methods.isEmpty() || !classData.msignals.isEmpty() || + !classData.properties.isEmpty(); +} + +void MethodGenerator::writeMethodDeclaration(const Method& method, bool pureVirtual, + bool withError, TQTextStream& stream) +{ + stream << method.name << "("; + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt;) + { + if (!(*it).isPrimitive && (*it).direction == Argument::In) + stream << "const "; + + stream << (*it).signature; + + if (!(*it).isPrimitive || (*it).direction == Argument::Out) stream << "&"; + + stream << " " << (*it).name; + + ++it; + if (it != endIt || withError) stream << ", "; + } + + if (withError) + stream << "TQT_DBusError& error)"; + else + stream << ")"; + + if (pureVirtual) + stream << " = 0;" << endl; + else + stream << ";" << endl; + + stream << endl; +} + +void MethodGenerator::writePropertyDeclaration(const Property& property, + bool pureVirtual, TQTextStream& stream) +{ + if (property.write) + { + stream << " virtual void set" << property.name << "("; + + if (!property.isPrimitive) stream << "const "; + + stream << property.signature; + + if (!property.isPrimitive) stream << "&"; + + stream << " value, TQT_DBusError& error)"; + + if (pureVirtual) + stream << " = 0;" << endl; + else + stream << ";" << endl; + } + + if (property.read) + { + stream << " virtual " << property.signature << " get" + << property.name << "(TQT_DBusError& error) const"; + + if (pureVirtual) + stream << " = 0;" << endl; + else + stream << ";" << endl; + } + + if (property.read || property.write) stream << endl; +} + +void MethodGenerator::writeMethodCallDeclaration(const Method& method, + TQTextStream& stream) +{ + if (method.async) + stream << "void call" << method.name << "Async"; + else + stream << "TQT_DBusMessage call" << method.name; + + stream << "(const TQT_DBusMessage& message);" << endl; + stream << endl; +} + +void MethodGenerator::writeMethodCall(const Class& classData, + const Method& method, TQTextStream& stream) +{ + if (method.async) + stream << "void " << classData.name << "::call" << method.name << "Async"; + else + stream << "TQT_DBusMessage " << classData.name << "::call" << method.name; + + stream << "(const TQT_DBusMessage& message)" << endl; + + stream << "{" << endl; + + if (method.async) + { + // FIXME: using writeVariables by removing asyncCallId argument + Method reducedMethod = method; + reducedMethod.arguments.pop_front(); + + writeVariables(" ", reducedMethod, stream); + } + else + { + stream << " TQT_DBusError error;" << endl; + stream << " TQT_DBusMessage reply;" << endl; + stream << endl; + + writeVariables(" ", method, stream); + } + + stream << endl; + + if (method.async) + { + stream << " int _asyncCallId = 0;" << endl; + stream << " while (m_asyncCalls.tqfind(_asyncCallId) != m_asyncCalls.end())" + << endl; + stream << " {" << endl; + stream << " ++_asyncCallId;" << endl; + stream << " }" << endl; + stream << " m_asyncCalls.insert(_asyncCallId, message);" << endl; + stream << endl; + + stream << " " << method.name << "Async("; + } + else + stream << " if (" << method.name << "("; + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + while (it != endIt) + { + stream << "_" << (*it).name; + + ++it; + if (it != endIt) stream << ", "; + } + + if (method.async) + { + stream << ");" << endl; + stream << endl; + + stream << " return;" << endl; + stream << "}" << endl; + stream << endl; + return; + } + + if (method.arguments.count() > 0) stream << ", "; + stream << "error))" << endl; + + stream << " {" << endl; + stream << " reply = TQT_DBusMessage::methodReply(message);" << endl; + + it = method.arguments.begin(); + for (; it != endIt; ++it) + { + if ((*it).direction == Argument::Out) + { + if (!(*it).annotatedType.isEmpty()) + { + stream << " TQT_DBusData " << (*it).name << "Data;" << endl; + stream << " TQT_DBusDataConverter::convertToTQT_DBusData<" + << (*it).annotatedType << ">(_" + << (*it).name << ", " << (*it).name << "Data);" + << endl; + stream << " reply << " << (*it).name << "Data"; + } + else if (!(*it).accessor.isEmpty()) + { + stream << " reply << TQT_DBusData::from" << (*it).accessor; + if (!(*it).subAccessor.isEmpty()) + { + stream << "(" << (*it).containerClass; + } + + stream << "(_" << (*it).name << ")"; + + if (!(*it).subAccessor.isEmpty()) + { + stream << ")"; + } + } + else + stream << " reply << _" << (*it).name; + + stream << ";" << endl; + } + } + stream << " }" << endl; + stream << " else" << endl; + stream << " {" << endl; + + stream << " if (!error.isValid())" << endl; + stream << " {" << endl; + stream << " qWarning(\"Call to implementation of "; + + TQStringList::const_iterator nsIt = classData.namespaces.begin(); + TQStringList::const_iterator nsEndIt = classData.namespaces.end(); + for (; nsIt != nsEndIt; ++nsIt) + { + stream << *nsIt << "::"; + } + + stream << classData.name << "::" << method.name; + stream << " returned 'false' but error object is not valid!\");" << endl; + stream << endl; + stream << " error = TQT_DBusError::stdFailed(\""; + + nsIt = classData.namespaces.begin(); + for (; nsIt != nsEndIt; ++nsIt) + { + stream << *nsIt << "."; + } + + stream << classData.name << "." << method.name << " execution failed\");" + << endl; + stream << " }" << endl; + stream << endl; + + stream << " reply = TQT_DBusMessage::methodError(message, error);" << endl; + + stream << " }" << endl; + stream << endl; + stream << " return reply;" << endl; + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeSignalEmitter(const Class& classData, + const Method& method, TQTextStream& stream) +{ + stream << "bool " << classData.name << "::emit" << method.name << "("; + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt;) + { + if (!(*it).isPrimitive && (*it).direction == Argument::In) + stream << "const "; + + stream << (*it).signature; + + if (!(*it).isPrimitive || (*it).direction == Argument::Out) stream << "&"; + + stream << " " << (*it).name; + + ++it; + if (it != endIt) stream << ", "; + } + + stream << ")" << endl; + + stream << "{" << endl; + + // TODO: create error or use enum for return + stream << " TQString path = objectPath();" << endl; + stream << " Q_ASSERT(!path.isEmpty());" << endl; + stream << endl; + + stream << " TQT_DBusMessage message = TQT_DBusMessage::signal(path, \""; + stream << classData.dbusName << "\", \"" << method.name << "\");" << endl; + stream << endl; + + it = method.arguments.begin(); + for (; it != endIt; ++it) + { + if ((*it).direction == Argument::In) + { + if (!(*it).annotatedType.isEmpty()) + { + // TODO: error handling + stream << " TQT_DBusData " << (*it).name << "Data;" << endl; + stream << " if (TQT_DBusDataConverter:convertToTQT_DBusData<" + << (*it).annotatedType << ">(" + << (*it).name << ", " << (*it).name << "Data" + << ") != TQT_DBusDataConverter::Success) return false;" + << endl; + stream << " message << " << (*it).name << "Data"; + } + else if (!(*it).accessor.isEmpty()) + { + stream << " message << TQT_DBusData::from" << (*it).accessor; + if (!(*it).subAccessor.isEmpty()) + { + stream << "(" << (*it).containerClass; + } + + stream << "(" << (*it).name << ")"; + + if (!(*it).subAccessor.isEmpty()) + { + stream << ")"; + } + } + else + stream << " message << " << (*it).name; + + stream << ";" << endl; + } + } + stream << endl; + + stream << " return handleSignalSend(message);" << endl; + + stream << "}" << endl; + stream << endl; +} + + +void MethodGenerator::writeInterfaceAsyncReplyHandler(const Class& classData, + const Method& method, TQTextStream& stream) +{ + stream << "void " << classData.name << "::" << method.name + << "AsyncReply("; + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + while (it != endIt) + { + if (!(*it).isPrimitive && (*it).direction == Argument::In) + stream << "const "; + + stream << (*it).signature; + + if (!(*it).isPrimitive || (*it).direction == Argument::Out) stream << "&"; + + stream << " " << (*it).name; + + ++it; + if (it != endIt) stream << ", "; + } + stream << ")" << endl; + stream << endl; + stream << "{" << endl; + + stream << " TQMap<int, TQT_DBusMessage>::iterator tqfindIt = m_asyncCalls.tqfind(asyncCallId);" << endl; + stream << " if (tqfindIt == m_asyncCalls.end()) return;" << endl; + stream << endl; + + stream << " TQT_DBusMessage call = tqfindIt.data();" << endl; + stream << " m_asyncCalls.erase(tqfindIt);" << endl; + stream << endl; + + stream << " TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);" + << endl; + + it = method.arguments.begin(); + for (++it; it != endIt; ++it) // skip asyncCallId at beginning + { + if (!(*it).annotatedType.isEmpty()) + { + stream << " TQT_DBusData " << (*it).name << "Data;" << endl; + + // TODO error handling + stream << " if (TQT_DBusDataConverter::convertToTQT_DBusData<" + << (*it).annotatedType << ">(" << (*it).name << ", " + << (*it).name << "Data" + << ") != TQT_DBusDataConverter::Success) return false;" + << endl; + stream << " reply << " << (*it).name << "Data;" << endl; + } + else if (!(*it).accessor.isEmpty()) + { + stream << " reply << TQT_DBusData::from" << (*it).accessor << "("; + + if ((*it).subAccessor.isEmpty()) + stream << (*it).name; + else + stream << (*it).containerClass << "(" << (*it).name << ")"; + + stream << ");" << endl; + } + else + stream << " reply << " << (*it).name << ";" << endl; + } + stream << endl; + + stream << " handleMethodReply(reply);" << endl; + + stream << "}" << endl; + stream << endl; + + stream << "void " << classData.name << "::" << method.name + << "AsyncError(int asyncCallId, const TQT_DBusError& error)"; + stream << endl; + + stream << "{" << endl; + + stream << " TQMap<int, TQT_DBusMessage>::iterator tqfindIt = m_asyncCalls.tqfind(asyncCallId);" << endl; + stream << " if (tqfindIt == m_asyncCalls.end()) return;" << endl; + stream << endl; + + stream << " TQT_DBusMessage call = tqfindIt.data();" << endl; + stream << " m_asyncCalls.erase(tqfindIt);" << endl; + stream << endl; + + stream << " TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);" + << endl; + stream << " handleMethodReply(reply);" << endl; + + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeInterfaceMainMethod(const Class& classData, + TQTextStream& stream) +{ + if (classData.methods.isEmpty()) return; + + stream << "bool " << classData.name + << "::handleMethodCall(const TQT_DBusMessage& message)" << endl; + stream << "{" << endl; + + stream << " if (message.interface() != \"" << classData.dbusName + << "\") return false;" << endl; + stream << endl; + + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + stream << " if (message.member() == \"" << (*it).name << "\")" << endl; + stream << " {" << endl; + + if ((*it).async) + { + stream << " call" << (*it).name << "Async(message);" << endl; + stream << endl; + } + else + { + stream << " TQT_DBusMessage reply = call" << (*it).name + << "(message);" << endl; + stream << " handleMethodReply(reply);" << endl; + stream << endl; + } + stream << " return true;" << endl; + stream << " }" << endl; + stream << endl; + } + + stream << " return false; " << endl; + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeSignalHandler(const Class& classData, + TQTextStream& stream) +{ + stream << "void " << classData.name + << "::slotHandleDBusSignal(const TQT_DBusMessage& message)" << endl; + stream << "{" << endl; + + TQValueList<Method>::const_iterator it = classData.msignals.begin(); + TQValueList<Method>::const_iterator endIt = classData.msignals.end(); + bool first = true; + for (; it != endIt; ++it) + { + stream << " "; + + if (!first) + stream << "else "; + else + first = false; + + stream << "if (message.member() == \"" << (*it).name << "\")" << endl; + stream << " {" << endl; + + writeVariables(" ", *it, stream); + stream << endl; + + writeSignalEmit(*it, stream); + + stream << " }" << endl; + } + + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeProxyBegin(const Class& classData, TQTextStream& stream) +{ + stream << classData.name << "::" << classData.name + << "(const TQString& service, const TQString& path, TQObject* tqparent, const char* name)" << endl; + stream << " : TQObject(tqparent, name)," << endl; + stream << " m_baseProxy(new TQT_DBusProxy())" << endl; + stream << "{" << endl; + stream << " m_baseProxy->setInterface(\"" + << classData.dbusName << "\");" << endl; + stream << " m_baseProxy->setPath(path);" << endl; + stream << " m_baseProxy->setService(service);" << endl; + stream << endl; + + if (!classData.msignals.isEmpty()) + { + stream << " TQObject::connect(m_baseProxy, " + << "TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&))," << endl; + stream << " this, " + << " TQT_SLOT(slotHandleDBusSignal(const TQT_DBusMessage&)));" + << endl; + } + + if (!classData.asyncReplySignals.isEmpty()) + { + stream << " TQObject::connect(m_baseProxy, " + << "TQT_SIGNAL(asyncReply(int, const TQT_DBusMessage&))," << endl; + stream << " this, " + << " TQT_SLOT(slotHandleAsyncReply(int, const TQT_DBusMessage&)));" + << endl; + } + + stream << "}" << endl; + + stream << endl; + + stream << classData.name << "::~" << classData.name << "()" << endl; + stream << "{" << endl; + stream << " delete m_baseProxy;" << endl; + stream << "}" << endl; + stream << endl; + + stream << "void " << classData.name + << "::setConnection(const TQT_DBusConnection& connection)" << endl; + stream << "{" << endl; + stream << " m_baseProxy->setConnection(connection);" << endl; + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeProxyMethod(const TQString& className, + const Method& method, TQTextStream& stream) +{ + stream << "bool " << className << "::" << method.name + << (method.async ? "Async(" : "("); + + TQValueList<Argument>::const_iterator it = method.arguments.begin(); + TQValueList<Argument>::const_iterator endIt = method.arguments.end(); + for (; it != endIt; ++it) + { + if (!(*it).isPrimitive && (*it).direction == Argument::In) + stream << "const "; + + stream << (*it).signature; + + if (!(*it).isPrimitive || (*it).direction == Argument::Out) stream << "&"; + + stream << " " << (*it).name << ", "; + } + + stream << "TQT_DBusError& error)" << endl; + + stream << "{" << endl; + stream << " TQValueList<TQT_DBusData> parameters;" << endl; + stream << endl; + + uint outCount = 0; + + it = method.arguments.begin(); + for (; it != endIt; ++it) + { + if ((*it).direction == Argument::Out) + { + ++outCount; + continue; + } + + if (!(*it).annotatedType.isEmpty()) + { + stream << " TQT_DBusData " << (*it).name << "Data;" << endl; + + // TODO error handling + stream << " if (TQT_DBusDataConverter::convertToTQT_DBusData<" + << (*it).annotatedType << ">(" << (*it).name << ", " + << (*it).name << "Data" + << ") != TQT_DBusDataConverter::Success) return false;" + << endl; + stream << " parameters << " << (*it).name << "Data;" << endl; + } + else if (!(*it).accessor.isEmpty()) + { + stream << " parameters << TQT_DBusData::from" << (*it).accessor << "("; + + if ((*it).subAccessor.isEmpty()) + stream << (*it).name; + else + stream << (*it).containerClass << "(" << (*it).name << ")"; + + stream << ");" << endl; + } + else + stream << " parameters << " << (*it).name << ";" << endl; + } + + stream << endl; + + if (outCount == 0 && method.noReply) + { + stream << " if (!m_baseProxy->send(\"" << method.name + << "\", parameters))" << endl; + stream << " {" << endl; + stream << " error = m_baseProxy->lastError();" << endl; + stream << " return false;" << endl; + stream << " }" << endl; + stream << " return true;" << endl; + stream << "}" << endl; + stream << endl; + return; + } + + if (method.async) + { + stream << " asyncCallId = m_baseProxy->sendWithAsyncReply(\""; + stream << method.name << "\", parameters);" << endl; + stream << endl; + + stream << " if (asyncCallId != 0) m_asyncCalls[asyncCallId] = \"" + << method.name << "\";" << endl; + stream << endl; + + stream << " return (asyncCallId != 0);" << endl; + stream << "}" << endl; + stream << endl; + return; + } + + stream << " TQT_DBusMessage reply = m_baseProxy->sendWithReply(\""; + stream << method.name << "\", parameters, &error);" << endl; + stream << endl; + + stream << " if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;" + << endl; + + if (outCount == 0) + { + stream << " return true;" << endl; + stream << "}" << endl; + stream << endl; + return; + } + + stream << endl; + + // TODO: create error or use enum for return + stream << " if (reply.count() != " << outCount << ") return false;" << endl; + stream << endl; + + bool firstAccessor = true; + bool firstSubAccessor = true; + + it = method.arguments.begin(); + for (; it != endIt; ++it) + { + if ((*it).direction == Argument::In) continue; + + --outCount; + + if (!(*it).annotatedType.isEmpty()) + { + // TODO error handling + stream << " if (TQT_DBusDataConverter::convertFromTQT_DBusData<" + << (*it).annotatedType << ">(reply.front(), " + << (*it).name + << ") != TQT_DBusDataConverter::Success) return false;" + << endl; + } + else if (!(*it).accessor.isEmpty()) + { + if (firstAccessor) + { + stream << " bool ok = false;" << endl; + stream << endl; + firstAccessor = false; + } + + if ((*it).subAccessor.isEmpty()) + { + stream << " " << (*it).name << " = reply.front().to" + << (*it).accessor << "(&ok);" << endl; + } + else + { + if (firstSubAccessor) + { + stream << " bool subOK = false;" << endl; + stream << endl; + firstSubAccessor = false; + } + + stream << " " << (*it).name << " = reply.front().to" + << (*it).accessor << "(&ok).to" << (*it).subAccessor + << "(&subOK);" << endl; + + // TODO: create error or use enum for return + stream << " if (!subOK) return false;" << endl; + } + + // TODO: create error or use enum for return + stream << " if (!ok) return false;" << endl; + } + else + stream << " " << (*it).name << " = reply.front();" << endl; + stream << endl; + + if (outCount > 0) + { + stream << " reply.pop_front();" << endl; + stream << endl; + } + } + + stream << " return true;" << endl; + + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeProxyGenericProperty(const Class& classData, + TQTextStream& stream) +{ + stream << "void " << classData.name + << "::setDBusProperty(const TQString& name, " + << "const TQT_DBusVariant& value, TQT_DBusError& error)" + << endl; + stream << "{" << endl; + + stream << " TQT_DBusConnection connection = m_baseProxy->connection();" << endl; + stream << endl; + stream << " TQT_DBusMessage message = TQT_DBusMessage::methodCall(" + << "m_baseProxy->service(), m_baseProxy->path(), " + << "\"org.freedesktop.DBus.Properties\", \"Set\");" << endl; + stream << endl; + + stream << " message << TQT_DBusData::fromString(m_baseProxy->interface());" + << endl; + stream << " message << TQT_DBusData::fromString(name);" << endl; + stream << " message << TQT_DBusData::fromVariant(value);" << endl; + stream << endl; + + stream << " connection.sendWithReply(message, &error);" << endl; + + stream << "}" << endl; + + stream << endl; + + stream << "TQT_DBusVariant " << classData.name + << "::getDBusProperty(const TQString& name, TQT_DBusError& error) const" + << endl; + stream << "{" << endl; + + stream << " TQT_DBusConnection connection = m_baseProxy->connection();" << endl; + stream << endl; + + stream << " TQT_DBusMessage message = TQT_DBusMessage::methodCall(" + << "m_baseProxy->service(), m_baseProxy->path(), " + << "\"org.freedesktop.DBus.Properties\", \"Get\");" << endl; + stream << endl; + + stream << " message << TQT_DBusData::fromString(m_baseProxy->interface());" + << endl; + stream << " message << TQT_DBusData::fromString(name);" << endl; + stream << endl; + + stream << " TQT_DBusMessage reply = connection.sendWithReply(message, &error);" + << endl; + stream << endl; + + stream << " if (reply.type() != TQT_DBusMessage::ReplyMessage)" + << " return TQT_DBusVariant();" << endl; + stream << " if (reply.count() != 1) return TQT_DBusVariant();" << endl; + + stream << endl; + + stream << " bool ok = false;" << endl; + stream << " TQT_DBusVariant value = reply.front().toVariant(&ok);" << endl; + + // TODO generate error + stream << " if (!ok) return TQT_DBusVariant();" << endl; + stream << endl; + + stream << " return value;" << endl; + + stream << "}" << endl; + + stream << endl; +} + +void MethodGenerator::writeProxyProperty(const Class& classData, + const Property& property, TQTextStream& stream) +{ + if (property.write) + { + stream << "void " << classData.name << "::set" << property.name << "("; + + if (!property.isPrimitive) stream << "const "; + + stream << property.signature; + + if (!property.isPrimitive) stream << "&"; + + stream << " value, TQT_DBusError& error)" << endl; + stream << "{" << endl; + stream << " TQT_DBusVariant variant;" << endl; + + if (!property.annotatedType.isEmpty()) + { + // TODO: error handling + stream << " TQT_DBusDataConverter::convertToTQT_DBusData<" + << property.annotatedType << ">(value, variant.value);" + << endl; + } + else if (!property.accessor.isEmpty()) + { + stream << " variant.value = TQT_DBusData::from" + << property.accessor << "("; + + if (property.subAccessor.isEmpty()) + stream << "value"; + else + stream << property.containerClass << "(value)"; + + stream << ");" << endl; + } + else + stream << " variant.value = TQT_DBusData(value);" << endl; + + stream << " variant.signature = \"" << property.dbusSignature << "\";" + << endl; + + stream << endl; + stream << " setDBusProperty(\"" << property.name + << "\", variant, error);" << endl; + + stream << "}" << endl; + stream << endl; + } + + if (property.read) + { + stream << property.signature << " " << classData.name + << "::get" << property.name << "(TQT_DBusError& error) const" << endl; + stream << "{" << endl; + + stream << " TQT_DBusVariant variant = getDBusProperty(\"" + << property.name << "\", error);" << endl; + stream << endl; + stream << " if (error.isValid()) return " + << property.signature << "();" << endl; + stream << endl; + + if (!property.annotatedType.isEmpty()) + { + stream << " " << property.signature << " result;" << endl; + + // TODO error handling + stream << " TQT_DBusDataConverter::convertFromTQT_DBusData<" + << property.annotatedType << ">(variant.value, result);" + << endl; + } + else if (!property.accessor.isEmpty()) + { + stream << " bool ok = false;" << endl; + stream << endl; + + if (property.subAccessor.isEmpty()) + { + stream << " " << property.signature << " result = "; + stream << " variant.value.to" << property.accessor + << "(&ok);" << endl; + } + else + { + stream << " bool subOK = false;" << endl; + stream << endl; + + stream << " " << property.signature << " result = "; + stream << " variant.value.to" + << property.accessor << "(&ok).to" << property.subAccessor + << "(&subOK);" << endl; + + // TODO: create error + stream << " if (!subOK) {}" << endl; + } + + // TODO: create error + stream << " if (!ok) {}" << endl; + } + else + stream << " " << property.signature << " result = variant.value;"; + stream << endl; + + stream << " return result;" << endl; + stream << "}" << endl; + stream << endl; + } +} + +void MethodGenerator::writeProxyAsyncReplyHandler(const Class& classData, + TQTextStream& stream) +{ + stream << "void " << classData.name + << "::slotHandleAsyncReply(int asyncCallId, const TQT_DBusMessage& message)" << endl; + stream << "{" << endl; + + stream << " TQMap<int, TQString>::iterator tqfindIt = " + << "m_asyncCalls.tqfind(asyncCallId);" << endl; + stream << " if (tqfindIt == m_asyncCalls.end()) return;" << endl; + stream << endl; + stream << " const TQString signalName = tqfindIt.data();" << endl; + stream << " m_asyncCalls.erase(tqfindIt);" << endl; + stream << endl; + + TQValueList<Method>::const_iterator it = classData.asyncReplySignals.begin(); + TQValueList<Method>::const_iterator endIt = classData.asyncReplySignals.end(); + bool first = true; + for (; it != endIt; ++it) + { + stream << " "; + + if (!first) + stream << "else "; + else + first = false; + + stream << "if (signalName == \"" << (*it).name << "\")" << endl; + stream << " {" << endl; + + // FIXME tricking writeVariables and writeSignalEmit into writing + // the reply emit code by manipulating arguments and name + stream << " int _asyncCallId = asyncCallId;" << endl; + + Method signal = *it; + signal.arguments.pop_front(); + + writeVariables(" ", signal, stream); + stream << endl; + + signal = *it; + signal.name += "AsyncReply"; + + writeSignalEmit(signal, stream); + + stream << " }" << endl; + } + + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeIntrospectionDataMethod(const Class& classData, + TQTextStream& stream) +{ + stream << "void " << classData.name + << "::buildIntrospectionData(TQDomElement& interfaceElement)" << endl; + stream << "{" << endl; + + stream << " interfaceElement.setAttribute(\"name\", \"" + << classData.dbusName << "\");" << endl; + stream << endl; + + bool firstMethod = true; + bool firstArgument = true; + + TQValueList<Method>::const_iterator it = classData.methods.begin(); + TQValueList<Method>::const_iterator endIt = classData.methods.end(); + for (; it != endIt; ++it) + { + if (firstMethod) + { + firstMethod = false; + stream << " TQDomDocument document = interfaceElement.ownerDocument();" << endl; + stream << " TQDomElement methodElement = document.createElement(" + << "\"method\");" << endl; + } + else + { + stream << endl; + stream << " methodElement = document.createElement(" + << "\"method\");" << endl; + } + + writeMethodIntrospection(*it, firstArgument, stream); + + stream << " interfaceElement.appendChild(methodElement);" << endl; + } + + it = classData.msignals.begin(); + endIt = classData.msignals.end(); + for (; it != endIt; ++it) + { + if (firstMethod) + { + firstMethod = false; + stream << " TQDomDocument document = interfaceElement.ownerDocument();" << endl; + stream << endl; + stream << " TQDomElement methodElement = document.createElement(" + << "\"signal\");" << endl; + } + else + { + stream << endl; + stream << " methodElement = document.createElement(" + << "\"signal\");" << endl; + } + + writeMethodIntrospection(*it, firstArgument, stream); + + stream << " interfaceElement.appendChild(methodElement);" << endl; + } + + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeNodePrivate(const Class& classData, TQTextStream& stream) +{ + stream << "class " << classData.name + << "::Private : public org::freedesktop::DBus::Introspectable" << endl; + stream << "{" << endl; + stream << "public:" << endl; + stream << " virtual ~Private();" << endl; + stream << endl; + + stream << "public:" << endl; + stream << " TQMap<TQString, TQT_DBusObjectBase*> interfaces;" << endl; + stream << " TQString introspectionData;" << endl; + stream << endl; + stream << " TQT_DBusConnection connection;" << endl; + stream << " TQString objectPath;" << endl; + stream << endl; + + stream << "protected:" << endl; + stream << " virtual bool Introspect(TQString& data, TQT_DBusError& error);" + << endl; + stream << endl; + stream << " virtual void handleMethodReply(const TQT_DBusMessage& reply);" + << endl; + + stream << "private:" << endl; + stream << " void cacheIntrospectionData();" << endl; + + stream << "};" << endl; + stream << endl; +} + +void MethodGenerator::writeNodeBegin(const Class& classData, TQTextStream& stream) +{ + stream << classData.name << "::" << classData.name + << "() : TQT_DBusObjectBase()," << endl; + stream << " m_private(new Private())" << endl; + stream << "{" << endl; + stream << "}" << endl; + stream << endl; + + stream << classData.name << "::~" << classData.name << "()" << endl; + stream << "{" << endl; + stream << " unregisterObject();" << endl; + stream << endl; + stream << " delete m_private;" << endl; + stream << "}" << endl; + stream << endl; +} + +void MethodGenerator::writeNodeMethods(const Class& classData, + const TQValueList<Class>& interfaces, TQTextStream& stream) +{ + writeNodeInitialization(classData, interfaces, stream); + + stream << "void " << classData.name << "::unregisterObject()" << endl; + stream << "{" << endl; + stream << " if (m_private->objectPath.isEmpty()) return;" << endl; + stream << endl; + stream << " m_private->connection.unregisterObject(m_private->objectPath);" << endl; + stream << endl; + stream << " m_private->connection = TQT_DBusConnection();" << endl; + stream << " m_private->objectPath = TQString();" << endl; + stream << "}" << endl; + stream << endl; + + stream << "bool " << classData.name + << "::handleMethodCall(const TQT_DBusMessage& message)" << endl; + stream << "{" << endl; + stream << " TQMap<TQString, TQT_DBusObjectBase*>::iterator tqfindIt = " + << "m_private->interfaces.tqfind(message.interface());" << endl; + stream << " if (tqfindIt == m_private->interfaces.end()) return false;" + << endl; + stream << endl; + stream << " return delegateMethodCall(message, tqfindIt.data());" << endl; + stream << "}" << endl; + stream << endl; + + stream << classData.name << "::Private::~Private()" << endl; + stream << "{" << endl; + stream << " TQMap<TQString, TQT_DBusObjectBase*>::const_iterator it = " + << "interfaces.begin();" << endl; + stream << " TQMap<TQString, TQT_DBusObjectBase*>::const_iterator endIt = " + << "interfaces.end();" << endl; + stream << " for (; it != endIt; ++it)" << endl; + stream << " {" << endl; + stream << " TQT_DBusObjectBase* interface = it.data();" << endl; + stream << " if (interface != this)" << endl; + stream << " delete interface;" << endl; + stream << " }" << endl; + stream << " interfaces.clear();" << endl; + stream << "}" << endl; + stream << endl; + + stream << "bool " << classData.name << "::Private" + << "::Introspect(TQString& data, TQT_DBusError& error)" << endl; + stream << "{" << endl; + stream << " Q_UNUSED(error);" << endl; + stream << " if (introspectionData.isEmpty()) cacheIntrospectionData();" + << endl; + stream << endl; + stream << " data = introspectionData;" << endl; + stream << endl; + stream << " return true;" << endl; + stream << "}" << endl; + stream << endl; + + stream << "void " << classData.name << "::Private" + << "::handleMethodReply(const TQT_DBusMessage& reply)" << endl; + stream << "{" << endl; + stream << " connection.send(reply);" << endl; + stream << "}" << endl; + stream << endl; + + writeNodeIntrospection(classData, interfaces, stream); +} + +// End of File diff --git a/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.h b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.h new file mode 100644 index 000000000..9954fb2ed --- /dev/null +++ b/main/dependencies/dbus-tqt/tools/dbusxml2qt3/methodgen.h @@ -0,0 +1,153 @@ +/* +* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#if !defined(METHODGEN_H_INCLUDED) +#define METHODGEN_H_INCLUDED + +// TQt includes +#include <tqmap.h> +#include <tqstringlist.h> + +// forward declarations +class TQTextStream; + +class Argument +{ +public: + enum Direction + { + In, + Out + }; + + TQString name; + TQString annotatedType; + TQString signature; + TQString accessor; + TQString subAccessor; + TQString containerClass; + Direction direction; + bool isPrimitive; + + TQStringList forwardDeclarations; + TQMap<TQString, TQStringList> headerIncludes; + TQMap<TQString, TQStringList> sourceIncludes; + + TQString dbusSignature; +}; + +class Method +{ +public: + TQString name; + TQValueList<Argument> arguments; + bool noReply; + bool async; +}; + +class Property : public Argument +{ +public: + bool read; + bool write; +}; + +class Class +{ +public: + enum Role + { + Interface, + Proxy, + Node + }; + + TQString name; + TQString dbusName; + TQStringList namespaces; + TQValueList<Method> methods; + TQValueList<Method> msignals; + TQValueList<Property> properties; + + TQValueList<Method> asyncMethods; + TQValueList<Method> asyncReplySignals; + TQValueList<Method> asyncReplyMethods; +}; + +class MethodGenerator +{ +public: + static bool extractMethods(const TQDomElement& interfaceElement, + Class& classData); + + static void writeMethodDeclaration(const Method& method, bool pureVirtual, + bool withError, TQTextStream& stream); + + static void writePropertyDeclaration(const Property& property, bool pureVirtual, + TQTextStream& stream); + + static void writeMethodCallDeclaration(const Method& method, + TQTextStream& stream); + + static void writeMethodCall(const Class& classData, const Method& method, + TQTextStream& stream); + + static void writeSignalEmitter(const Class& classData, const Method& method, + TQTextStream& stream); + + static void writeInterfaceAsyncReplyHandler(const Class& classData, + const Method& method, + TQTextStream& stream); + + static void writeInterfaceMainMethod(const Class& classData, + TQTextStream& stream); + + static void writeSignalHandler(const Class& classData, TQTextStream& stream); + + static void writeProxyBegin(const Class& classData, TQTextStream& stream); + + static void writeProxyMethod(const TQString& className, const Method& method, + TQTextStream& stream); + + static void writeProxyGenericProperty(const Class& classData, + TQTextStream& stream); + + static void writeProxyProperty(const Class& classData, const Property& property, + TQTextStream& stream); + + static void writeProxyAsyncReplyHandler(const Class& classData, + TQTextStream& stream); + + static void writeIntrospectionDataMethod(const Class& classData, + TQTextStream& stream); + + static void writeNodePrivate(const Class& classData, TQTextStream& stream); + + static void writeNodeBegin(const Class& classData, TQTextStream& stream); + + static void writeNodeMethods(const Class& classData, + const TQValueList<Class>& interfaces, TQTextStream& stream); +}; + +#endif + +// End of File diff --git a/main/dependencies/dbus-tqt/tqdbusatomic.h b/main/dependencies/dbus-tqt/tqdbusatomic.h new file mode 100644 index 000000000..50ceec395 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusatomic.h @@ -0,0 +1,40 @@ +/* qdbusatomic.h Dummy reference counter + * + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef ATOMIC_H +#define ATOMIC_H + +class Atomic +{ +public: + Atomic(int value); + + void ref(); + + bool deref(); + +private: + int m_value; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusconnection.cpp b/main/dependencies/dbus-tqt/tqdbusconnection.cpp new file mode 100644 index 000000000..1d77e4892 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusconnection.cpp @@ -0,0 +1,396 @@ +/* qdbusconnection.cpp + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include <tqapplication.h> + +#include "tqdbusconnection.h" +#include "tqdbuserror.h" +#include "tqdbusmessage.h" +#include "tqdbusconnection_p.h" + +QT_STATIC_CONST_IMPL char *TQT_DBusConnection::default_connection_name = "qt_dbus_default_connection"; + +class TQT_DBusConnectionManager +{ +public: + TQT_DBusConnectionManager(): default_connection(0) {} + ~TQT_DBusConnectionManager(); + void bindToApplication(); + TQT_DBusConnectionPrivate *connection(const TQString &name) const; + void removeConnection(const TQString &name); + void setConnection(const TQString &name, TQT_DBusConnectionPrivate *c); + + static TQT_DBusConnectionManager* instance() { + if (managerInstance == 0) managerInstance = new TQT_DBusConnectionManager(); + return managerInstance; + } + +private: + TQT_DBusConnectionPrivate *default_connection; + // FIXME-QT4 TQHash<TQString, TQT_DBusConnectionPrivate *> connectionHash; + typedef TQMap<TQString, TQT_DBusConnectionPrivate*> ConnectionHash; + ConnectionHash connectionHash; + + static TQT_DBusConnectionManager* managerInstance; +}; + +// FIXME-QT4 TQ_GLOBAL_STATIC(TQT_DBusConnectionManager, manager); +TQT_DBusConnectionManager* TQT_DBusConnectionManager::managerInstance = 0; +TQT_DBusConnectionManager* manager() { + return TQT_DBusConnectionManager::instance(); +} + +TQT_DBusConnectionPrivate *TQT_DBusConnectionManager::connection(const TQString &name) const +{ + if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name)) + return default_connection; + + ConnectionHash::const_iterator it = connectionHash.tqfind(name); + + return (it != connectionHash.end() ? it.data() : 0); +} + +void TQT_DBusConnectionManager::removeConnection(const TQString &name) +{ + TQT_DBusConnectionPrivate *d = 0; + if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name)) { + d = default_connection; + default_connection = 0; + } else { + ConnectionHash::iterator it = connectionHash.tqfind(name); + if (it == connectionHash.end()) + return; + + d = it.data(); + connectionHash.erase(it); + } + if (!d->ref.deref()) + delete d; +} + +TQT_DBusConnectionManager::~TQT_DBusConnectionManager() +{ + if (default_connection) { + delete default_connection; + default_connection = 0; + } +/* FIXME-QT4 + for (TQHash<TQString, TQT_DBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin(); + it != connectionHash.constEnd(); ++it) { + delete it.value(); + }*/ + for (ConnectionHash::const_iterator it = connectionHash.constBegin(); + it != connectionHash.constEnd(); ++it) + { + delete it.data(); + } + connectionHash.clear(); +} + +void TQT_DBusConnectionManager::bindToApplication() +{ + if (default_connection) { + default_connection->bindToApplication(); + } +/* FIXME-QT4 + for (TQHash<TQString, TQT_DBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin(); + it != connectionHash.constEnd(); ++it) { + (*it)->bindToApplication(); + }*/ + for (ConnectionHash::const_iterator it = connectionHash.constBegin(); + it != connectionHash.constEnd(); ++it) + { + it.data()->bindToApplication(); + } +} + +void qDBusBindToApplication() +{ + manager()->bindToApplication(); +} + +void TQT_DBusConnectionManager::setConnection(const TQString &name, TQT_DBusConnectionPrivate *c) +{ + if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name)) + default_connection = c; + else + connectionHash[name] = c; +} + + +TQT_DBusConnection::TQT_DBusConnection() : d(0) +{ +} + +TQT_DBusConnection::TQT_DBusConnection(const TQString &name) +{ + d = manager()->connection(name); + if (d) + d->ref.ref(); +} + +TQT_DBusConnection::TQT_DBusConnection(const TQT_DBusConnection &other) +{ + d = other.d; + if (d) + d->ref.ref(); +} + +TQT_DBusConnection::~TQT_DBusConnection() +{ + if (d && !d->ref.deref()) + delete d; +} + +TQT_DBusConnection &TQT_DBusConnection::operator=(const TQT_DBusConnection &other) +{ + if (other.d) + other.d->ref.ref(); +/* FIXME-QT4 + TQT_DBusConnectionPrivate *old = static_cast<TQT_DBusConnectionPrivate *>( + q_atomic_set_ptr(&d, other.d));*/ + TQT_DBusConnectionPrivate* old = d; + d = other.d; + if (old && !old->ref.deref()) + delete old; + + return *this; +} + +TQT_DBusConnection TQT_DBusConnection::sessionBus() +{ + return addConnection(TQT_DBusConnection::SessionBus); +} + +TQT_DBusConnection TQT_DBusConnection::systemBus() +{ + return addConnection(TQT_DBusConnection::SystemBus); +} + +TQT_DBusConnection TQT_DBusConnection::addConnection(BusType type, const TQString &name) +{ +// Q_ASSERT_X(TQCoreApplication::instance(), "TQT_DBusConnection::addConnection", +// "Cannot create connection without a Q[Core]Application instance"); + + TQT_DBusConnectionPrivate *d = manager()->connection(name); + if (d) + return TQT_DBusConnection(name); + + d = new TQT_DBusConnectionPrivate; + DBusConnection *c = 0; + switch (type) { + case SystemBus: + c = dbus_bus_get(DBUS_BUS_SYSTEM, &d->error); + break; + case SessionBus: + c = dbus_bus_get(DBUS_BUS_SESSION, &d->error); + break; + case ActivationBus: + c = dbus_bus_get(DBUS_BUS_STARTER, &d->error); + break; + } + d->setConnection(c); //setConnection does the error handling for us + + manager()->setConnection(name, d); + + return TQT_DBusConnection(name); +} + +TQT_DBusConnection TQT_DBusConnection::addConnection(const TQString &address, + const TQString &name) +{ +// Q_ASSERT_X(TQCoreApplication::instance(), "TQT_DBusConnection::addConnection", +// "Cannot create connection without a Q[Core]Application instance"); + + TQT_DBusConnectionPrivate *d = manager()->connection(name); + if (d) + return TQT_DBusConnection(name); + + d = new TQT_DBusConnectionPrivate; + // setConnection does the error handling for us + d->setConnection(dbus_connection_open(address.utf8().data(), &d->error)); + + manager()->setConnection(name, d); + + return TQT_DBusConnection(name); +} + +void TQT_DBusConnection::closeConnection(const TQString &name) +{ + manager()->removeConnection(name); +} + +void TQT_DBusConnectionPrivate::timerEvent(TQTimerEvent *e) +{ + DBusTimeout *timeout = timeouts[e->timerId()]; + dbus_timeout_handle(timeout); +} + +bool TQT_DBusConnection::send(const TQT_DBusMessage &message) const +{ + if (!d || !d->connection) + return false; + + DBusMessage *msg = message.toDBusMessage(); + if (!msg) + return false; + + bool isOk = dbus_connection_send(d->connection, msg, 0); + dbus_message_unref(msg); + return isOk; +} + +int TQT_DBusConnection::sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver, + const char *method) const +{ + if (!d || !d->connection) + return 0; + + return d->sendWithReplyAsync(message, receiver, method); +} + +TQT_DBusMessage TQT_DBusConnection::sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error) const +{ + if (!d || !d->connection) + return TQT_DBusMessage::fromDBusMessage(0); + + DBusMessage *msg = message.toDBusMessage(); + if (!msg) + return TQT_DBusMessage::fromDBusMessage(0); + DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg, + -1, &d->error); + if (d->handleError() && error) + *error = d->lastError; + + dbus_message_unref(msg); + + return TQT_DBusMessage::fromDBusMessage(reply); +} + +void TQT_DBusConnection::flush() const +{ + if (!d || !d->connection) return; + + d->flush(); +} + +void TQT_DBusConnection::dispatch() const +{ + if (!d || !d->connection) return; + + d->dispatch(); +} + +void TQT_DBusConnection::scheduleDispatch() const +{ + if (!d || !d->connection) return; + + d->scheduleDispatch(); +} + +bool TQT_DBusConnection::connect(TQObject* object, const char* slot) +{ + if (!d || !d->connection || !object || !slot) + return false; + + bool ok = object->connect(d, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)), slot); + + return ok; +} + +bool TQT_DBusConnection::disconnect(TQObject* object, const char* slot) +{ + if (!d || !d->connection || !object || !slot) + return false; + + bool ok = d->disconnect(object, slot); + + return ok; +} + +bool TQT_DBusConnection::registerObject(const TQString& path, TQT_DBusObjectBase* object) +{ + if (!d || !d->connection || !object || path.isEmpty()) + return false; + + TQT_DBusConnectionPrivate::ObjectMap::const_iterator it = d->registeredObjects.tqfind(path); + if (it != d->registeredObjects.end()) + return false; + + d->registeredObjects.insert(path, object); + + return true; +} + +void TQT_DBusConnection::unregisterObject(const TQString &path) +{ + if (!d || !d->connection || path.isEmpty()) + return; + + TQT_DBusConnectionPrivate::ObjectMap::iterator it = d->registeredObjects.tqfind(path); + if (it == d->registeredObjects.end()) + return ; + + d->registeredObjects.erase(it); +} + +bool TQT_DBusConnection::isConnected( ) const +{ + return d && d->connection && dbus_connection_get_is_connected(d->connection); +} + +TQT_DBusError TQT_DBusConnection::lastError() const +{ + return d ? d->lastError : TQT_DBusError(); +} + +TQString TQT_DBusConnection::uniqueName() const +{ + return d && d->connection ? + TQString::fromUtf8(dbus_bus_get_unique_name(d->connection)) + : TQString(); +} + +bool TQT_DBusConnection::requestName(const TQString &name, int modeFlags) +{ + Q_ASSERT(modeFlags >= 0); + + if (!d || !d->connection) + return false; + + if (modeFlags < 0) + return false; + + int dbusFlags = 0; + if (modeFlags & AllowReplace) + dbusFlags |= DBUS_NAME_FLAG_ALLOW_REPLACEMENT; + if (modeFlags & ReplaceExisting) + dbusFlags |= DBUS_NAME_FLAG_REPLACE_EXISTING; + + dbus_bus_request_name(d->connection, name.utf8(), dbusFlags, &d->error); + + return !d->handleError(); +} + +#include "tqdbusconnection.moc" diff --git a/main/dependencies/dbus-tqt/tqdbusconnection.h b/main/dependencies/dbus-tqt/tqdbusconnection.h new file mode 100644 index 000000000..f9ae54769 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusconnection.h @@ -0,0 +1,662 @@ +/* qdbusconnection.h TQT_DBusConnection object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSCONNECTION_H +#define TQDBUSCONNECTION_H + +/** + * @mainpage TQt3 Bindings for D-Bus + * + * D-Bus is an IPC (inter process communication) technology designed to allow + * applications to interoperate without requiring tight coupling. + * + * For more information about D-Bus itself see its website: + * http://www.freedesktop.org/wiki/Software_2fdbus + * + * The TQt3 D-Bus bindings described here are a TQt3 style API around the base + * implementation to enable TQt3 developers to use D-Bus in their applications + * without requiring them to know about the details of the C based D-Bus API. + * + * The two main use cases are: + * - using the API to access service implemented in other applications. + * See section @ref dbusclient for an introduction on this + * + * - using the API to provide access to services implemented in your application + * See section @ref dbusservice for an introduction on this + * + * Of course an application can do both at the same time. + */ + +/** + * @page dbusconventions Naming and syntax conventions in D-Bus + * + * @section dbusconventions-servicename Service names + * + * The service name is D-Bus application identifier, i.e. either + * the unique name handed out to the peer application by the bus on connect + * (see TQT_DBusConnection::uniqueName()) or, more likely, a well known name the + * peer application has requested, see TQT_DBusConnection::requestName() + * + * Such well known names have the form of word separated by dots, like + * Internet domain names but in reverse order. + * + * For example the name for the bus itself (the D-Bus daemon) would be + * @code + * "org.freedesktop.DBus" + * @endcode + * + * @section dbusconventions-objectpath Object paths + * + * The object path is like an address within the peer host application. + * The path format looks like a Unix file path, i.e. words separated by + * slash @c '/' characters. + * + * For example the path for the bus itself (the D-Bus daemon's main object) + * would be + * @code + * "/org/freedesktop/DBus" + * @endcode + * + * @section dbusconventions-interfacename Interface names + * + * The interface name specifies which group of methods and signals + * implemented by the peer service object is used in proxy operations. + * + * Interface names have the form of word separated by dots, like Internet + * domain names but in reverse order or like a fully qualified Java class name. + * + * For example the interface for the bus itself (the D-Bus daemon's main + * interface) would be + * @code + * "org.freedesktop.DBus" + * @endcode + * + * @section dbusconventions-errorname Error names + * + * A D-Bus error name is a sequence of words separated by dots, similar + * to D-Bus service names or interface names, or like a fully qualified + * Java class name. + * + * For example if a D-Bus service does not handle a method invocation sent + * to it because it doesn't know about the method it will return a D-Bus + * error named + * @code + * "org.freedesktop.DBus.Error.UnknownMethod" + * @endcode + * TQT_DBusError can create some of the more common errors based on a type value + * and decode their names into the type respectively. See TQT_DBusError#ErrorType + * + * @section dbusconventions-membername Method and signal names + * + * There is no mandatory convention for member names, neither for methods nor + * for signals. + * + * However, using the standard interfaces of D-Bus as a hint, it is recommended + * to use "camel case" names starting with an uppercase letter, for example + * @code + * "GetConnectionUnixUser" + * @endcode + */ + +#include "tqdbusmacros.h" +#include <tqstring.h> + +class TQT_DBusConnectionPrivate; +class TQT_DBusError; +class TQT_DBusMessage; +class TQT_DBusObjectBase; +class TQObject; + +/** + * @brief Provides access to a specific D-Bus bus + * + * In order to access a D-Bus message bus an application has to connect to it. + * This is very similar to connecting to an FTP server using TQFtp, where any + * number of commands can be sent in sequence over the same connection. + * + * Additionally to the asynchronous command execution provided by TQFtp a + * TQT_DBusConnection can also execute synchronous (blocking) calls so the + * code around those calls stays closer to in-process method incovations. + * + * However it is recommended to only perform blocking calls on D-Bus service + * methods that are likely to be processed fast. + * + * TQT_DBusConnection implements a shared resource, i.e. if you create a + * connection with a specific name in one part of your code and then + * create one with the same name somewhere else, the second creation will + * actually return the same shared connection object the first caller created. + * + * The application can be connected to more than one message bus simultaniously + * using one or more connections per bus, however the most common case is to + * have one connection per bus. + * + * The two main bus types are: + * - System bus: a bus connecting applications on one system across user + * or session boundaries, for example allowing to communicate + * with system services like printer spoolers, etc + * + * - Session bus: a bus connecting applications within one user session, for + * example started at login or by a session manager. Use cases + * or this kind of bus would be accessing user specific + * resources like addressbooks, retrieving user settings or + * controlling session services (e.g. disabling screensaver + * in a video player application during playback) + * + * While TQT_DBusConnection provides the basic API to access D-Bus services + * it is more convenient to use TQT_DBusProxy on top of the connection. + * + * See sections @ref dbusclient and @ref dbusservice for examples + */ +class TQDBUS_EXPORT TQT_DBusConnection +{ +public: + /** + * DBus bus types + */ + enum BusType + { + /** + * The session bus is a user and user session specific message + * channel. It will usually be started by a login script or a + * session manager. + */ + SessionBus, + + /** + * The system bus is a message channel bridging user level and + * system level process boundaries, e.g. it can allow a user process + * with normal user access restrictions to perform a limited subset + * of operations on a process running with elevated rights. + * + * @warning if an applications exposed services on the system bus, i.e. + * registers objects using registerObject(), it should be + * carefully examined on potential security issues + */ + SystemBus, + + // TODO tqfind out about ActivationBus purpose + ActivationBus + }; + + /** + * @brief Creates an empty/disconnected connection handle + * + * This is mainly used for initializing variables of this type, i.e. like + * the default TQString constructor. + * + * A variable set to such an empty connection can be assigned a working + * connection at any time. + */ + TQT_DBusConnection(); + + /** + * @brief Creates a connection handle to a named connection + * + * This will result in an disconnected connection handle if no + * connection with that name has been created by addConnection before. + * + * Therefore it is recommended to use addConnection() instead to get a + * connection handle. + * + * @param name identifier of the shared connection object + */ + TQT_DBusConnection(const TQString &name); + + /** + * @brief Creates a shallow copy of the given connection + * + * Allows to pass connection handles around by value, similar to TQString + * thus avoiding problems like dangling pointers in application code + * + * @param other the connection to copy from + */ + TQT_DBusConnection(const TQT_DBusConnection &other); + + /** + * @brief Destroys the connection handle + * + * If this handle is the last one referencing the shared connection object + * it will delete it, disconnecting it from any objects it was + * collaborating with + */ + ~TQT_DBusConnection(); + + /** + * @brief Creates a shallow copy of the given connection + * + * Allows to pass connection handles around by value, similar to TQString + * thus avoiding problems like dangling pointers in application code + * + * @param other the connection to copy from + * + * @return a reference to this instance as required by assigment operator + * semantics + */ + TQT_DBusConnection &operator=(const TQT_DBusConnection &other); + + /** + * @brief Returns whether the connection is connected to a bus + * + * @return @c true if the connection can be used, @c false if the handle + * does not have access to a shared connection object or if the + * connection to the bus could not be established or broke + */ + bool isConnected() const; + + /** + * @brief Returns the last error seen by the connection + * + * This can be a connection error, e.g. attempt to connect failed, or a + * transmission error or an error reported by a method call + * + * @return the last error seen by the connection + */ + TQT_DBusError lastError() const; + + /** + * @brief Flags for controlling the behavior name collision handling + * + * @see requestName() + */ + enum NameRequestMode + { + /** + * Do not allow others to take over a name requested by this + * application + */ + NoReplace = 0, + + /** + * Allow other applications that request the same name to get it, + * i.e. allow the bus to transfer the name from this application + * to the one requesting it + */ + AllowReplace = 1, + + /** + * Try to get the name transferred from the current owner to this + * application. This will only work if the other application as + * requested the name using the AllowReplace flag + */ + ReplaceExisting = 2 + }; + + /** + * @brief Requests to be addressable on the bus by a given name + * + * Each connection to a bus gets a unique name once the connection is + * established. This is similar to getting an IP address when connecting + * to the Internet. + * + * If an application's purpose is to provide services to other applications + * the other applications require to know how to address the service + * provider. Similar to a domain name on the Internet D-Bus allows to + * register names on the bus and be addressed through those names instead + * of the connection identifier. + * + * @note this is not required if the application only needs to acccess + * services or only implements generic service APIs + * + * If more than one application request the same name, D-Bus will try + * to resolve this conflict as good as possible. + * The #NameRequestMode flags allow to control how an application prefers + * to be treated in such a conflict. + * + * @param name the name the connection should be addressable with. See + * section @ref dbusconventions-servicename + * @param modeFlags an OR'ed combination of #NameRequestMode flags + * + * @return @c true if the name request was successfull, @c false if + * the connection is not connected to a bus or the name is already + * taken and cannot be tranferred + * + * @see uniqueName() + */ + bool requestName(const TQString &name, int modeFlags = NoReplace); + + /** + * @brief Returns the connection identifier assigned at connect + * + * The unique name is the connection address or identifier the bus assigned + * to this connection when it got established. + * + * @return the connection's unique bus identifier + * + * @see requestName() + */ + TQString uniqueName() const; + + /** + * @brief Sends a message over the bus + * + * Sends a message composed through the TQT_DBusMessage API to the bus. + * This is the main method for service objects (see TQT_DBusObjectBase) to + * send replies and errors for method calls they accepted or for sending + * D-Bus signals. + * + * @note for doing method calls it is more convenient to use TQT_DBusProxy, + * see TQT_DBusProxy::send() + * + * @param message the message to send + * + * @return @c true if sending succeeded, @c false if the connection is not + * connected, if the message lacks information about the recepient + * or if sending fails a at a lower level in the communication + * stack + * + * @see lastError() + */ + bool send(const TQT_DBusMessage &message) const; + + /** + * @brief Sends a message over the bus and waits for the reply + * + * Sends a message composed through the TQT_DBusMessage API to the bus. + * It then blocks and waits until the associated reply is received. + * Any message received in between is stored and can be processed + * by calling dispatch() or scheduleDispatch() + * + * @note for doing method calls it is more convenient to use TQT_DBusProxy, + * see TQT_DBusProxy::sendWithReply() + * + * @param message the message to send + * @param error an optional parameter to directly get any error that might + * occur during processing of the call + * + * @return a message containing either the call's reply or an invalid + * message in case the call failed + * + * @see lastError() + */ + TQT_DBusMessage sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error = 0) const; + + /** + * @brief Sends a message over the bus, specifying a receiver object for + * replies + * + * Sends a message composed through the TQT_DBusMessage API to the bus and + * returns an identifier number to associate with the reply once it is + * received by the given receiver. + * See TQT_DBusMessage::replySerialNumber() + * + * The required slot signature is + * @code + * void slotname(const TQT_DBusMessage&); + * @endcode + * + * @note for doing method calls it is more convenient to use TQT_DBusProxy, + * see TQT_DBusProxy::sendWithAsyncReply() + * + * @param message the message to send + * @param receiver the TQObject to relay the reply to + * @param slot the slot to invoke for the reply + * + * @return a numeric identifier for association with the reply or @c 0 if + * sending failed + * + * @see lastError() + */ + int sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver, + const char *slot) const; + + /** + * @brief Flushes buffered outgoing message + * + * Attempts to send all enqueued outgoing messages before returning. + */ + void flush() const; + + /** + * @brief Processes buffered inbound messages + * + * Attempts to process all enqueued inbound messages, e.g. replies to + * method calls or received signals. + * + * @warning dispatching message can result in TQt signals being emitted + * before this method returns. In case you just want to make sure + * no inbound message is forgotten, call scheduleDispatch() which + * will execute the dispatch delayed through the event loop. + */ + void dispatch() const; + + /** + * @brief Request a delayed check for inbound buffer processing + * + * Similar to dispatch() but delayed by a single shot timer to ensure + * the method has returned before the processing is started. + * + * If a asynchronous method call is followed by a synchronous call without + * returning to the event loop in between, a call to scheduleDispatch() + * ensures that a pending reply to the asynchronous call is processed + * as soon as possible + */ + void scheduleDispatch() const; + + /** + * @brief Connects an object to receive D-Bus signals + * + * This provides a basic access to all D-Bus signals received on this + * connection. + * For every D-Bus signal processed by the connection object a TQt signal + * is emitted and thus delivered to all receiver objects connected + * through this method. + * + * The required slot signature is + * @code + * void slotname(const TQT_DBusMessage&); + * @endcode + * + * so a suitable receiver could look like this + * @code + * class DBusSignalReceiver : public TQObject + * { + * TQ_OBJECT + * public slots: + * void dbusSignal(const TQT_DBusMessage&); + * }; + * @endcode + * + * and would be connected like this + * @code + * // assuming the following variables + * TQT_DBusConnection connection; + * DBusSignalReceiver* receiver; + * + * connection.connect(receiver, TQT_SLOT(dbusSignal(const TQT_DBusMessage&))); + * @endcode + * + * See TQT_DBusProxy::dbusSignal() for a more obvious way of connecting slots. + * + * @param object the receiver object + * @param slot the receiver slot (or signal for signal->signal connections) + * + * @return @c true if the connection was successfull, otherwise @c false + * + * @see disconnect() + */ + bool connect(TQObject* object, const char* slot); + + /** + * @brief Disconnects a given receiver from the D-Bus signal handling + * + * @param object the receiver object to disconnect from + * @param slot the receiver slot (or signal for signal->signal connections) + * + * @return @c true if the disconnect was successfull, otherwise @c false + * + * @see connect() + */ + bool disconnect(TQObject* object, const char* slot); + + /** + * @brief Registers a service object for a given path + * + * In order to receive method calls over the D-Bus connection the service + * objects path within its host application has to be registered with the + * connection. See section @ref dbusconventions-objectpath for details. + * + * Only one objects can be registered for a single object path, i.e. + * the path -> object mapping is unambiguous, similar to mapping of + * filesystem paths to files. + * + * If a service object offers more than one interface it is up to the + * service implementation if all are implemented in the object path to this + * method or if the passed object is just another demultiplexer which + * relays the message to the interface implementor. + * + * @param path the object path to register the object for + * @param object the service implementation object for that path + * + * @return @c true if the given object is now registered for the given path + * or @c false if path is empty, object is null or another object + * is already registered for this path + * + * @see unregisterObject() + */ + bool registerObject(const TQString& path, TQT_DBusObjectBase* object); + + /** + * @brief Unregister a service object on a given path + * + * Removes any mapping of object path to service object previously + * registered by registerObject(). + * See section @ref dbusconventions-objectpath for details. + * + * @warning always(!) unregister a service object before deleting it + * + * @param path the object path of the object to unregister + * + * @see registerObject() + */ + void unregisterObject(const TQString &path); + + /** + * @brief Gets a connection to the session bus + * + * Convenience overload for creating the default shared connection to the + * D-Bus session bus. + * + * Equivalent to calling addConnection(SessionBus); + * + * @return a connection handle. Check isConnected() to tqfind out if the + * connection attempt has been successfull + * + * @see addConnection(BusType,const TQString&); + */ + static TQT_DBusConnection sessionBus(); + + /** + * @brief Gets a connection to the system bus + * + * Convenience overload for creating the default shared connection to the + * D-Bus system bus. + * + * Equivalent to calling addConnection(SystemBus); + * + * @return a connection handle. Check isConnected() to tqfind out if the + * connection attempt has been successfull + * + * @see addConnection(BusType,const TQString&); + */ + static TQT_DBusConnection systemBus(); + + /** + * @brief Add a connection to a bus with a specific bus type + * + * This is a factory method as it will create a connection for the given + * name if its not available yet, but return a previously created + * connection for that name if available. + * + * Depending on the #BusType the D-Bus library will connect to the address + * configured for that type, so this is the recommended way to create + * connection to D-Bus. + * + * @code + * // Associate the default connection name with a connection to the user's + * // session bus + * TQT_DBusConnection con = TQT_DBusConnection::addConnection(TQT_DBusConnection::SessionBus); + * + * // check if we are connected and which uniqueName we got + * if (con.isConnected()) + * { + * qDebug("Connected to session bus. We got uniqueName %s", + * con.uniqueName().local8Bit().data()); + * } + * @endcode + * For the common use cases see also sessionBus() and systemBus() + * + * @param type the #BusType of the bus to connect to + * @param name the name to use for TQT_DBusConnection's connection sharing + * + * @return a connection handle. Check isConnected() to tqfind out if the + * connection attempt has been successfull + * + * @see closeConnection() + */ + static TQT_DBusConnection addConnection(BusType type, + const TQString &name = default_connection_name); + + /** + * @brief Add a connection to a bus at a specific address + * + * This is a factory method as it will create a connection for the given + * name if its not available yet, but return a previously created + * connection for that name if available. + * + * @note this requires to know the address of a D-Bus daemon to connect to + * + * @param address the address of the D-Bus daemon. Usually a Unix domain + * socket address + * @param name the name to use for TQT_DBusConnection's connection sharing + * + * @return a connection handle. Check isConnected() to tqfind out if the + * connection attempt has been successfull + * + * @see closeConnection() + */ + static TQT_DBusConnection addConnection(const TQString &address, + const TQString &name = default_connection_name); + + // TODO check why this doesn't close the D-Bus connection + /** + * @brief Closes a connection with a given name + * + * Removes the name from the pool of shared connections, i.e. a call to + * addConnection() with the same name afterwards will create a new + * connection. + * + * @param name the connection name as used in addConnection() + */ + static void closeConnection(const TQString &name = default_connection_name); + + /** + * String used as the default parameter for connection names + */ + QT_STATIC_CONST char *default_connection_name; + +private: + TQT_DBusConnectionPrivate *d; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusconnection_p.h b/main/dependencies/dbus-tqt/tqdbusconnection_p.h new file mode 100644 index 000000000..d43ee9af4 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusconnection_p.h @@ -0,0 +1,149 @@ +/* qdbusconnection_p.h TQT_DBusConnection private object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the public API. This header file may +// change from version to version without notice, or even be +// removed. +// +// We mean it. +// +// + +#ifndef TQDBUSCONNECTION_P_H +#define TQDBUSCONNECTION_P_H + +#include <tqguardedptr.h> +#include <tqmap.h> +#include <tqobject.h> +#include <tqvaluelist.h> + +#include <dbus/dbus.h> + +#include "tqdbusatomic.h" +#include "tqdbuserror.h" +#include "tqdbusobject.h" + +class TQT_DBusMessage; +class TQSocketNotifier; +class TQTimer; +class TQTimerEvent; + +struct DBusConnection; +struct DBusServer; + +class TQT_DBusConnectionPrivate: public TQObject +{ + Q_OBJECT + TQ_OBJECT + +public: + TQT_DBusConnectionPrivate(TQObject *tqparent = 0); + ~TQT_DBusConnectionPrivate(); + + void bindToApplication(); + + void setConnection(DBusConnection *connection); + void setServer(DBusServer *server); + void closeConnection(); + void timerEvent(TQTimerEvent *e); + + bool handleSignal(DBusMessage *msg); + bool handleObjectCall(DBusMessage *message); + bool handleError(); + + void emitPendingCallReply(const TQT_DBusMessage& message); + +signals: + void dbusSignal(const TQT_DBusMessage& message); + + void dbusPendingCallReply(const TQT_DBusMessage& message); + +public slots: + void socketRead(int); + void socketWrite(int); + + void objectDestroyed(TQObject* object); + + void purgeRemovedWatches(); + + void scheduleDispatch(); + void dispatch(); + +public: + DBusError error; + TQT_DBusError lastError; + + enum ConnectionMode { InvalidMode, ServerMode, ClientMode }; + + // FIXME TQAtomic ref; + Atomic ref; + ConnectionMode mode; + DBusConnection *connection; + DBusServer *server; + + TQTimer* dispatcher; + + static int messageMetaType; + static int registerMessageMetaType(); + int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver, + const char *method); + void flush(); + + struct Watcher + { + Watcher(): watch(0), read(0), write(0) {} + DBusWatch *watch; + TQSocketNotifier *read; + TQSocketNotifier *write; + }; + // FIXME typedef TQMultiHash<int, Watcher> WatcherHash; + typedef TQValueList<Watcher> WatcherList; + WatcherList removedWatches; + typedef TQMap<int, WatcherList> WatcherHash; + WatcherHash watchers; + + // FIXME typedef TQHash<int, DBusTimeout *> TimeoutHash; + typedef TQMap<int, DBusTimeout*> TimeoutHash; + TimeoutHash timeouts; + + typedef TQMap<TQString, TQT_DBusObjectBase*> ObjectMap; + ObjectMap registeredObjects; + + TQValueList<DBusTimeout *> pendingTimeouts; + + struct TQT_DBusPendingCall + { + TQGuardedPtr<TQObject> receiver; + TQCString method; + DBusPendingCall *pending; + }; + typedef TQMap<DBusPendingCall*, TQT_DBusPendingCall*> PendingCallMap; + PendingCallMap pendingCalls; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusdata.cpp b/main/dependencies/dbus-tqt/tqdbusdata.cpp new file mode 100644 index 000000000..5b95c7216 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdata.cpp @@ -0,0 +1,1054 @@ +/* qdbusdata.cpp DBUS data transport type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "dbus/dbus.h" + +#include "tqdbusdata.h" +#include "tqdbusdatalist.h" +#include "tqdbusdatamap.h" +#include "tqdbusobjectpath.h" +#include "tqdbusvariant.h" + +#include <tqshared.h> +#include <tqstring.h> +#include <tqvaluelist.h> + +class TQT_DBusData::Private : public TQShared +{ +public: + Private() : TQShared(), type(TQT_DBusData::Invalid), keyType(TQT_DBusData::Invalid) {} + + ~Private() + { + switch (type) + { + case TQT_DBusData::String: + delete (TQString*)value.pointer; + break; + + case TQT_DBusData::ObjectPath: + delete (TQT_DBusObjectPath*)value.pointer; + break; + + case TQT_DBusData::List: + delete (TQT_DBusDataList*)value.pointer; + break; + + case TQT_DBusData::Struct: + delete (TQValueList<TQT_DBusData>*)value.pointer; + break; + + case TQT_DBusData::Variant: + delete (TQT_DBusVariant*)value.pointer; + break; + + case TQT_DBusData::Map: + switch (keyType) + { + case TQT_DBusData::Byte: + delete (TQT_DBusDataMap<TQ_UINT8>*)value.pointer; + break; + + case TQT_DBusData::Int16: + delete (TQT_DBusDataMap<TQ_INT16>*)value.pointer; + break; + + case TQT_DBusData::UInt16: + delete (TQT_DBusDataMap<TQ_UINT16>*)value.pointer; + break; + + case TQT_DBusData::Int32: + delete (TQT_DBusDataMap<TQ_INT32>*)value.pointer; + break; + + case TQT_DBusData::UInt32: + delete (TQT_DBusDataMap<TQ_UINT32>*)value.pointer; + break; + + case TQT_DBusData::Int64: + delete (TQT_DBusDataMap<TQ_INT64>*)value.pointer; + break; + + case TQT_DBusData::UInt64: + delete (TQT_DBusDataMap<TQ_UINT64>*)value.pointer; + break; + + case TQT_DBusData::String: + delete (TQT_DBusDataMap<TQString>*)value.pointer; + break; + + case TQT_DBusData::ObjectPath: + delete (TQT_DBusDataMap<TQT_DBusObjectPath>*)value.pointer; + break; + + default: + qFatal("TQT_DBusData::Private: unhandled map key type %d(%s)", + keyType, TQT_DBusData::typeName(keyType)); + break; + } + break; + + default: + break; + } + } + +public: + Type type; + Type keyType; + + union + { + bool boolValue; + TQ_UINT8 byteValue; + TQ_INT16 int16Value; + TQ_UINT16 uint16Value; + TQ_INT32 int32Value; + TQ_UINT32 uint32Value; + TQ_INT64 int64Value; + TQ_UINT64 uint64Value; + double doubleValue; + void* pointer; + } value; +}; + +TQT_DBusData::TQT_DBusData() : d(new Private()) +{ +} + +TQT_DBusData::TQT_DBusData(const TQT_DBusData& other) : d(0) +{ + d = other.d; + + d->ref(); +} + +TQT_DBusData::~TQT_DBusData() +{ + if (d->deref()) delete d; +} + +TQT_DBusData& TQT_DBusData::operator=(const TQT_DBusData& other) +{ + if (&other == this) return *this; + + if (d->deref()) delete d; + + d = other.d; + + d->ref(); + + return *this; +} + +bool TQT_DBusData::operator==(const TQT_DBusData& other) const +{ + if (&other == this) return true; + + if (d == other.d) return true; + + if (d->type == other.d->type) + { + switch (d->type) + { + case TQT_DBusData::Invalid: + return true; + + case TQT_DBusData::Bool: + return d->value.boolValue == other.d->value.boolValue; + + case TQT_DBusData::Byte: + return d->value.byteValue == other.d->value.byteValue; + + case TQT_DBusData::Int16: + return d->value.int16Value == other.d->value.int16Value; + + case TQT_DBusData::UInt16: + return d->value.uint16Value == other.d->value.uint16Value; + + case TQT_DBusData::Int32: + return d->value.int32Value == other.d->value.int32Value; + + case TQT_DBusData::UInt32: + return d->value.uint32Value == other.d->value.uint64Value; + + case TQT_DBusData::Int64: + return d->value.int64Value == other.d->value.int64Value; + + case TQT_DBusData::UInt64: + return d->value.uint64Value == other.d->value.uint64Value; + + case TQT_DBusData::Double: + // FIXME: should not compare doubles for equality like this + return d->value.doubleValue == other.d->value.doubleValue; + + case TQT_DBusData::String: + return toString() == other.toString(); + + case TQT_DBusData::ObjectPath: + return toObjectPath() == other.toObjectPath(); + + case TQT_DBusData::List: + return toList() == other.toList(); + + case TQT_DBusData::Struct: + return toStruct() == other.toStruct(); + + case TQT_DBusData::Variant: + return toVariant() == other.toVariant(); + + case TQT_DBusData::Map: + if (d->keyType != other.d->keyType) return false; + + switch (d->keyType) + { + case TQT_DBusData::Byte: + toByteKeyMap() == other.toByteKeyMap(); + break; + + case TQT_DBusData::Int16: + toInt16KeyMap() == other.toInt16KeyMap(); + break; + + case TQT_DBusData::UInt16: + toUInt16KeyMap() == other.toUInt16KeyMap(); + break; + + case TQT_DBusData::Int32: + toInt32KeyMap() == other.toInt32KeyMap(); + break; + + case TQT_DBusData::UInt32: + toUInt32KeyMap() == other.toUInt32KeyMap(); + break; + case TQT_DBusData::Int64: + toInt64KeyMap() == other.toInt64KeyMap(); + break; + + case TQT_DBusData::UInt64: + toUInt64KeyMap() == other.toUInt64KeyMap(); + break; + + case TQT_DBusData::String: + toStringKeyMap() == other.toStringKeyMap(); + break; + + case TQT_DBusData::ObjectPath: + toObjectPathKeyMap() == other.toObjectPathKeyMap(); + break; + + default: + qFatal("TQT_DBusData operator== unhandled map key type %d(%s)", + d->keyType, TQT_DBusData::typeName(d->keyType)); + break; + } + + break; + } + } + + return false; +} + +bool TQT_DBusData::operator!=(const TQT_DBusData& other) const +{ + return !operator==(other); +} + +TQT_DBusData::Type TQT_DBusData::type() const +{ + return d->type; +} + +TQT_DBusData::Type TQT_DBusData::keyType() const +{ + if (d->type != TQT_DBusData::Map) return TQT_DBusData::Invalid; + + return d->keyType; +} + +const char* TQT_DBusData::typeName(Type type) +{ + switch (type) + { + case TQT_DBusData::Invalid: return "Invalid"; + case TQT_DBusData::Bool: return "Bool"; + case TQT_DBusData::Byte: return "Byte"; + case TQT_DBusData::Int16: return "Int16"; + case TQT_DBusData::UInt16: return "UInt16"; + case TQT_DBusData::Int32: return "Int32"; + case TQT_DBusData::UInt32: return "UInt32"; + case TQT_DBusData::Int64: return "Int64"; + case TQT_DBusData::UInt64: return "UInt64"; + case TQT_DBusData::Double: return "Double"; + case TQT_DBusData::String: return "String"; + case TQT_DBusData::ObjectPath: return "ObjectPath"; + case TQT_DBusData::List: return "List"; + case TQT_DBusData::Struct: return "Struct"; + case TQT_DBusData::Variant: return "Variant"; + case TQT_DBusData::Map: return "Map"; + } + + return 0; +} + +TQT_DBusData TQT_DBusData::fromBool(bool value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Bool; + data.d->value.boolValue = value; + + return data; +} + +bool TQT_DBusData::toBool(bool* ok) const +{ + if (d->type != TQT_DBusData::Bool) + { + if (ok != 0) *ok = false; + return false; + } + + if (ok != 0) *ok = true; + + return d->value.boolValue; +} + +TQT_DBusData TQT_DBusData::fromByte(TQ_UINT8 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Byte; + data.d->value.byteValue = value; + + return data; +} + +TQ_UINT8 TQT_DBusData::toByte(bool* ok) const +{ + if (d->type != TQT_DBusData::Byte) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.byteValue; +} + +TQT_DBusData TQT_DBusData::fromInt16(TQ_INT16 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Int16; + data.d->value.int16Value = value; + + return data; +} + +TQ_INT16 TQT_DBusData::toInt16(bool* ok) const +{ + if (d->type != TQT_DBusData::Int16) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.int16Value; +} + +TQT_DBusData TQT_DBusData::fromUInt16(TQ_UINT16 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::UInt16; + data.d->value.uint16Value = value; + + return data; +} + +TQ_UINT16 TQT_DBusData::toUInt16(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt16) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.uint16Value; +} + +TQT_DBusData TQT_DBusData::fromInt32(TQ_INT32 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Int32; + data.d->value.int32Value = value; + + return data; +} + +TQ_INT32 TQT_DBusData::toInt32(bool* ok) const +{ + if (d->type != TQT_DBusData::Int32) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.int32Value; +} + +TQT_DBusData TQT_DBusData::fromUInt32(TQ_UINT32 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::UInt32; + data.d->value.uint32Value = value; + + return data; +} + +TQ_UINT32 TQT_DBusData::toUInt32(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt32) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.uint32Value; +} + +TQT_DBusData TQT_DBusData::fromInt64(TQ_INT64 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Int64; + data.d->value.int64Value = value; + + return data; +} + +TQ_INT64 TQT_DBusData::toInt64(bool* ok) const +{ + if (d->type != TQT_DBusData::Int64) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.int64Value; +} + +TQT_DBusData TQT_DBusData::fromUInt64(TQ_UINT64 value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::UInt64; + data.d->value.uint64Value = value; + + return data; +} + +TQ_UINT64 TQT_DBusData::toUInt64(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt64) + { + if (ok != 0) *ok = false; + return 0; + } + + if (ok != 0) *ok = true; + + return d->value.uint64Value; +} + +TQT_DBusData TQT_DBusData::fromDouble(double value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Double; + data.d->value.doubleValue = value; + + return data; +} + +double TQT_DBusData::toDouble(bool* ok) const +{ + if (d->type != TQT_DBusData::Double) + { + if (ok != 0) *ok = false; + return 0.0; + } + + if (ok != 0) *ok = true; + + return d->value.doubleValue; +} + +TQT_DBusData TQT_DBusData::fromString(const TQString& value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::String; + data.d->value.pointer = new TQString(value); + + return data; +} + +TQString TQT_DBusData::toString(bool* ok) const +{ + if (d->type != TQT_DBusData::String) + { + if (ok != 0) *ok = false; + return TQString(); + } + + if (ok != 0) *ok = true; + + return *((TQString*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromObjectPath(const TQT_DBusObjectPath& value) +{ + TQT_DBusData data; + + if (value.isValid()) + { + data.d->type = TQT_DBusData::ObjectPath; + data.d->value.pointer = new TQT_DBusObjectPath(value); + } + + return data; +} + +TQT_DBusObjectPath TQT_DBusData::toObjectPath(bool* ok) const +{ + if (d->type != TQT_DBusData::ObjectPath) + { + if (ok != 0) *ok = false; + return TQT_DBusObjectPath(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusObjectPath*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromList(const TQT_DBusDataList& list) +{ + TQT_DBusData data; + + if (list.type() == TQT_DBusData::Invalid) return data; + + data.d->type = TQT_DBusData::List; + data.d->value.pointer = new TQT_DBusDataList(list); + + return data; +} + +TQT_DBusDataList TQT_DBusData::toList(bool* ok) const +{ + if (d->type != TQT_DBusData::List) + { + if (ok != 0) *ok = false; + return TQT_DBusDataList(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataList*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromTQValueList(const TQValueList<TQT_DBusData>& list) +{ + return fromList(TQT_DBusDataList(list)); +} + +TQValueList<TQT_DBusData> TQT_DBusData::toTQValueList(bool* ok) const +{ + bool internalOk = false; + TQT_DBusDataList list = toList(&internalOk); + + if (!internalOk) + { + if (ok != 0) *ok = false; + return TQValueList<TQT_DBusData>(); + } + + return list.toTQValueList(); +} + +TQT_DBusData TQT_DBusData::fromStruct(const TQValueList<TQT_DBusData>& memberList) +{ + TQT_DBusData data; + + TQValueList<TQT_DBusData>::const_iterator it = memberList.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = memberList.end(); + for (; it != endIt; ++it) + { + if ((*it).d->type == Invalid) return data; + } + + data.d->type = TQT_DBusData::Struct; + data.d->value.pointer = new TQValueList<TQT_DBusData>(memberList); + + return data; +} + +TQValueList<TQT_DBusData> TQT_DBusData::toStruct(bool* ok) const +{ + if (d->type != TQT_DBusData::Struct) + { + if (ok != 0) *ok = false; + return TQValueList<TQT_DBusData>(); + } + + if (ok != 0) *ok = true; + + return *((TQValueList<TQT_DBusData>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromVariant(const TQT_DBusVariant& value) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Variant; + data.d->value.pointer = new TQT_DBusVariant(value); + + return data; +} + +TQT_DBusVariant TQT_DBusData::toVariant(bool* ok) const +{ + if (d->type != TQT_DBusData::Variant) + { + if (ok != 0) *ok = false; + return TQT_DBusVariant(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusVariant*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromByteKeyMap(const TQT_DBusDataMap<TQ_UINT8>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT8>(map); + + return data; +} + +TQT_DBusDataMap<TQ_UINT8> TQT_DBusData::toByteKeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_UINT8>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_UINT8>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_UINT8>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromInt16KeyMap(const TQT_DBusDataMap<TQ_INT16>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_INT16>(map); + + return data; +} + +TQT_DBusDataMap<TQ_INT16> TQT_DBusData::toInt16KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT16>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_INT16>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_INT16>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromUInt16KeyMap(const TQT_DBusDataMap<TQ_UINT16>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT16>(map); + + return data; +} + +TQT_DBusDataMap<TQ_UINT16> TQT_DBusData::toUInt16KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && + d->keyType != TQT_DBusDataMap<TQ_UINT16>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_UINT16>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_UINT16>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromInt32KeyMap(const TQT_DBusDataMap<TQ_INT32>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_INT32>(map); + + return data; +} + +TQT_DBusDataMap<TQ_INT32> TQT_DBusData::toInt32KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT32>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_INT32>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_INT32>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromUInt32KeyMap(const TQT_DBusDataMap<TQ_UINT32>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT32>(map); + + return data; +} + +TQT_DBusDataMap<TQ_UINT32> TQT_DBusData::toUInt32KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && + d->keyType != TQT_DBusDataMap<TQ_UINT32>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_UINT32>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_UINT32>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromInt64KeyMap(const TQT_DBusDataMap<TQ_INT64>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_INT64>(map); + + return data; +} + +TQT_DBusDataMap<TQ_INT64> TQT_DBusData::toInt64KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT64>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_INT64>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_INT64>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromUInt64KeyMap(const TQT_DBusDataMap<TQ_UINT64>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT64>(map); + + return data; +} + +TQT_DBusDataMap<TQ_UINT64> TQT_DBusData::toUInt64KeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && + d->keyType != TQT_DBusDataMap<TQ_UINT64>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQ_UINT64>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQ_UINT64>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromStringKeyMap(const TQT_DBusDataMap<TQString>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQString>(map); + + return data; +} + +TQT_DBusDataMap<TQString> TQT_DBusData::toStringKeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQString>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQString>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQString>*)d->value.pointer); +} + +TQT_DBusData TQT_DBusData::fromObjectPathKeyMap(const TQT_DBusDataMap<TQT_DBusObjectPath>& map) +{ + TQT_DBusData data; + + data.d->type = TQT_DBusData::Map; + data.d->keyType = map.keyType(); + data.d->value.pointer = new TQT_DBusDataMap<TQT_DBusObjectPath>(map); + + return data; +} + +TQT_DBusDataMap<TQT_DBusObjectPath> TQT_DBusData::toObjectPathKeyMap(bool* ok) const +{ + if (d->type != TQT_DBusData::Map && + d->keyType != TQT_DBusDataMap<TQT_DBusObjectPath>::m_keyType) + { + if (ok != 0) *ok = false; + return TQT_DBusDataMap<TQT_DBusObjectPath>(); + } + + if (ok != 0) *ok = true; + + return *((TQT_DBusDataMap<TQT_DBusObjectPath>*)d->value.pointer); +} + +static const char* qDBusTypeForTQT_DBusType(TQT_DBusData::Type type) +{ + switch (type) + { + case TQT_DBusData::Invalid: + return 0; + case TQT_DBusData::Bool: + return DBUS_TYPE_BOOLEAN_AS_STRING; + case TQT_DBusData::Byte: + return DBUS_TYPE_BYTE_AS_STRING; + case TQT_DBusData::Int16: + return DBUS_TYPE_INT16_AS_STRING; + case TQT_DBusData::UInt16: + return DBUS_TYPE_UINT16_AS_STRING; + case TQT_DBusData::Int32: + return DBUS_TYPE_INT32_AS_STRING; + case TQT_DBusData::UInt32: + return DBUS_TYPE_UINT32_AS_STRING; + case TQT_DBusData::Int64: + return DBUS_TYPE_INT64_AS_STRING; + case TQT_DBusData::UInt64: + return DBUS_TYPE_UINT64_AS_STRING; + case TQT_DBusData::Double: + return DBUS_TYPE_DOUBLE_AS_STRING; + case TQT_DBusData::String: + return DBUS_TYPE_STRING_AS_STRING; + case TQT_DBusData::ObjectPath: + return DBUS_TYPE_OBJECT_PATH_AS_STRING; + case TQT_DBusData::Variant: + return DBUS_TYPE_VARIANT_AS_STRING; + default: + break; + } + return 0; +} + +template <typename T> +TQCString qDBusSignatureForMapValue(const TQT_DBusDataMap<T>& map) +{ + if (map.hasContainerValueType()) + return map.containerValueType().buildDBusSignature(); + else + return qDBusTypeForTQT_DBusType(map.valueType()); +} + +TQCString TQT_DBusData::buildDBusSignature() const +{ + TQCString signature; + + switch (d->type) + { + case TQT_DBusData::List: + { + TQT_DBusDataList* list = (TQT_DBusDataList*) d->value.pointer; + signature = DBUS_TYPE_ARRAY_AS_STRING; + if (list->hasContainerItemType()) + signature += list->containerItemType().buildDBusSignature(); + else + signature += qDBusTypeForTQT_DBusType(list->type()); + break; + } + + case TQT_DBusData::Struct: + { + signature += DBUS_STRUCT_BEGIN_CHAR; + + TQValueList<TQT_DBusData>* memberList = + (TQValueList<TQT_DBusData>*) d->value.pointer; + + TQValueList<TQT_DBusData>::const_iterator it = (*memberList).begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = (*memberList).end(); + for (; it != endIt; ++it) + { + signature += (*it).buildDBusSignature(); + } + signature += DBUS_STRUCT_END_CHAR; + break; + } + + case TQT_DBusData::Map: + signature += DBUS_TYPE_ARRAY_AS_STRING; + signature += DBUS_DICT_ENTRY_BEGIN_CHAR; + + signature += qDBusTypeForTQT_DBusType(keyType()); + + switch (keyType()) + { + case TQT_DBusData::Byte: + signature += qDBusSignatureForMapValue<TQ_UINT8>( + *((TQT_DBusDataMap<TQ_UINT8>*) d->value.pointer)); + break; + case TQT_DBusData::Int16: + signature += qDBusSignatureForMapValue<TQ_INT16>( + *((TQT_DBusDataMap<TQ_INT16>*) d->value.pointer)); + break; + case TQT_DBusData::UInt16: + signature += qDBusSignatureForMapValue<TQ_UINT16>( + *((TQT_DBusDataMap<TQ_UINT16>*) d->value.pointer)); + break; + case TQT_DBusData::Int32: + signature += qDBusSignatureForMapValue<TQ_INT32>( + *((TQT_DBusDataMap<TQ_INT32>*) d->value.pointer)); + break; + case TQT_DBusData::UInt32: + signature += qDBusSignatureForMapValue<TQ_UINT32>( + *((TQT_DBusDataMap<TQ_UINT32>*) d->value.pointer)); + break; + case TQT_DBusData::Int64: + signature += qDBusSignatureForMapValue<TQ_INT64>( + *((TQT_DBusDataMap<TQ_INT64>*) d->value.pointer)); + break; + case TQT_DBusData::UInt64: + signature += qDBusSignatureForMapValue<TQ_UINT64>( + *((TQT_DBusDataMap<TQ_UINT64>*) d->value.pointer)); + break; + case TQT_DBusData::String: + signature += qDBusSignatureForMapValue<TQString>( + *((TQT_DBusDataMap<TQString>*) d->value.pointer)); + break; + case TQT_DBusData::ObjectPath: + signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>( + *((TQT_DBusDataMap<TQT_DBusObjectPath>*) d->value.pointer)); + break; + default: + break; + } + + signature += DBUS_DICT_ENTRY_END_CHAR; + break; + + default: + signature = qDBusTypeForTQT_DBusType(d->type); + break; + } + + return signature; +} + + +// key type definitions for TQT_DBusDataMap +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_UINT8>::m_keyType = TQT_DBusData::Byte; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_INT16>::m_keyType = TQT_DBusData::Int16; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_UINT16>::m_keyType = TQT_DBusData::UInt16; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_INT32>::m_keyType = TQT_DBusData::Int32; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_UINT32>::m_keyType = TQT_DBusData::UInt32; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_INT64>::m_keyType = TQT_DBusData::Int64; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQ_UINT64>::m_keyType = TQT_DBusData::UInt64; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQString>::m_keyType = TQT_DBusData::String; + +template <> +const TQT_DBusData::Type TQT_DBusDataMap<TQT_DBusObjectPath>::m_keyType = + TQT_DBusData::ObjectPath; diff --git a/main/dependencies/dbus-tqt/tqdbusdata.h b/main/dependencies/dbus-tqt/tqdbusdata.h new file mode 100644 index 000000000..2e50c3dc2 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdata.h @@ -0,0 +1,1150 @@ +/* qdbusdata.h DBUS data transport type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSDATA_H +#define TQDBUSDATA_H + +#include "tqdbusmacros.h" +#include <tqglobal.h> + +class TQCString; +class TQT_DBusDataList; +class TQT_DBusVariant; +class TQT_DBusObjectPath; +class TQString; + +template<typename T> class TQValueList; +template<typename T> class TQT_DBusDataMap; + +/** + * @brief Class for accurately representing D-Bus data types + * + * The TQT_DBusData class can be compared to TQt's TQVariant class, but + * specialized to contain data types used in D-Bus messages. + * + * Like TQVariant objects of TQT_DBusData use implicit sharing, i.e. copying + * a TQT_DBusData object is a cheap operation and does not require that the + * content itself is copied. + * + * Depending on the #Type of the object, the content can be a recursive + * construct of TQT_DBusData objects, e.g. a #List can contain elements that are + * containers themselves, e.g. #Map, #Struct, #Variant or even #List again. + * + * @see TQT_DBusDataList + * @see TQT_DBusDataMap + * @see TQT_DBusDataConverter + */ +class TQDBUS_EXPORT TQT_DBusData +{ +public: + /** + * @brief Enum for the data types used in D-Bus messages + * + * In order to provide correct mapping of C++ and TQt types and the data + * types used in D-Bus messages, TQT_DBusData uses explicit naming of types + * where the name is usually the one used in D-Bus, with the exception of + * #List and #Map since this is closer to the TQt container they are + * implemented with (TQValueList and TQMap respectively) + * + * @see type(), keyType() + * @see typeName() + */ + enum Type + { + /** + * Base type for TQT_DBusData objects created by the default constructor. + * + * Also used as the type of returned objects when getter type methods + * fail due to type incompatabilties, i.e. toInt32() called on a #List + * object. + * + * @see isValid() + */ + Invalid = 0, + + /** + * Type when encapsulating a boolean value. + * + * @see fromBool(), toBool() + */ + Bool, + + /** + * Type when encapsulating a byte (unsigned char) value. + * + * @see fromByte(), toByte() + */ + Byte, + + /** + * Type when encapsulating a signed 16-bit integer value. + * + * @see fromInt16(), toInt16() + */ + Int16, + + /** + * Type when encapsulating an unsigned 16-bit integer value. + * + * @see fromUInt16(), toUInt16() + */ + UInt16, + + /** + * Type when encapsulating a signed 32-bit integer value. + * + * @see fromInt32(), toInt32() + */ + Int32, + + /** + * Type when encapsulating an unsigned 32-bit integer value. + * + * @see fromUInt32(), toUInt32() + */ + UInt32, + + /** + * Type when encapsulating a signed 64-bit integer value. + * + * @see fromInt64(), toInt64() + */ + Int64, + + /** + * Type when encapsulating an unsigned 64-bit integer value. + * + * @see fromUInt64(), toUInt64() + */ + UInt64, + + /** + * Type when encapsulating a double value. + * + * @see fromDouble(), toDouble() + */ + Double, + + /** + * Type when encapsulating a string value. + * + * All strings are converted to UTF-8 during transmission + * + * @see fromString(), toString() + */ + String, + + /** + * Type when encapsulating a D-Bus object path. + * + * D-Bus defines a special string variation for transporting the + * paths used to address objects within D-Bus services, see + * @ref dbusconventions-objectpath for formatting details. + * + * @note from the point of view of this bindings an object path is + * pretty much a normal string with externally checked restrictions. + * However, method calls or return values can require a signature + * to include an object path and any remote peer might then reject + * the normal string signature. + * + * @see fromObjectPath(), toObjectPath() + */ + ObjectPath, + + /** + * Type when encapsulating a list of values. + * + * The D-Bus type this maps to is called @c array but since the TQt + * container class used to implement this type is TQValueList (or rather + * TQT_DBusDataList), the TQT_DBusData type is called @c List instead. + * + * A list can contain any of the supported types as elements, even + * container types. + * However it can only contain elements with the same type per list + * object. + * + * @see fromList(), toList() + */ + List, + + /** + * Type when encapsulating a struct of values. + * + * A struct is basically a list of struct member variables, each + * member can be any of the supported types, even containers types. + * + * The C++/TQt value type used in the converter methods is a TQValueList + * with type TQT_DBusData. + * For example a TQRect could be mapped like this: + * @code + * TQRect rect(0, 0, 640, 480); + * TQValueList<TQT_DBusData> memberList; + * + * memberList << TQT_DBusData::fromInt32(rect.x()); + * memberList << TQT_DBusData::fromInt32(rect.y()); + * memberList << TQT_DBusData::fromInt32(rect.width()); + * memberList << TQT_DBusData::fromInt32(rect.height()); + * + * TQT_DBusData data = TQT_DBusData:fromStruct(memberList); + * @endcode + * + * And reconstructed like this: + * @code + * memberList = data.toStruct(); + * + * int x = memberList[0].toInt32(); + * int y = memberList[1].toInt32(); + * int w = memberList[2].toInt32(); + * int h = memberList[3].toInt32(); + * + * rect = TQRect(x, y, w, h); + * @endcode + * + * @note Empty structs, i.e. an empty member list, are not allowed + * + * @see fromStruct(), toStruct() + * @see TQT_DBusDataConverter + */ + Struct, + + /** + * Type when encapsulating a special variable container value. + * + * See TQT_DBusVariant for details on variant usage. + * + * @see fromVariant(), toVariant() + */ + Variant, + + /** + * Type when encapsulating a map of keys to values. + * + * The D-Bus type this maps to is called @c dict but since the TQt + * container class used to implement this type is TQMap (or rather + * TQT_DBusDataMap), the TQT_DBusData type is called @c Map instead. + * + * A map can contain any of the supported types as values, even + * container types, but only the following basic types as keys: + * - #Byte + * - #Int16 + * - #UInt16 + * - #Int32 + * - #UInt32 + * - #Int64 + * - #UInt64 + * - #String + * - #ObjectPath + * + * All values need to be of the same type. + * + * @see fromByteKeyMap(), toByteKeyMap() + * @see fromInt16KeyMap(), toInt16KeyMap() + * @see fromUInt16KeyMap(), toUInt16KeyMap() + * @see fromInt32KeyMap(), toInt32KeyMap() + * @see fromUInt32KeyMap(), toUInt32KeyMap() + * @see fromInt64KeyMap(), toInt64KeyMap() + * @see fromUInt64KeyMap(), toUInt64KeyMap() + * @see fromStringKeyMap(), toStringKeyMap() + * @see fromObjectPathKeyMap(), toObjectPathKeyMap() + */ + Map + }; + + /** + * @brief Creates an empty, #Invalid data object + */ + TQT_DBusData(); + + /** + * @brief Copies a given @p other data object + * + * Since TQT_DBusData is implicitly shared, both objects will have the + * same content and the last object to reference it will delete it. + * + * @param other the object to copy + */ + TQT_DBusData(const TQT_DBusData& other); + + /** + * @brief Destroys the data object + * + * If this is the last instance to a shared content, it will delete it + * as well. + */ + ~TQT_DBusData(); + + /** + * @brief Copies a given @p other data object + * + * Since TQT_DBusData is implicitly shared, both objects will have the + * same content and the last object to reference it will delete it. + * + * @param other the object to copy + * + * @return a reference to this instance + */ + TQT_DBusData& operator=(const TQT_DBusData& other); + + /** + * @brief Checks if the given @p other data object is equal to this instance + * + * Two TQT_DBusData object are considered equal if they reference the same + * shared content or have the same type and the content's equality operator + * says the contents are equal. + * + * @param other the object to compare with + * + * @return @c true if the two data objects are equal, otherwise @c false + */ + bool operator==(const TQT_DBusData& other) const; + + /** + * @brief Checks if the given @p other data object is different from this instance + * + * @param other the object to compare with + * + * @return @c false if the two data objects are not equal, otherwise @c false + * + * @see operator==() + */ + bool operator!=(const TQT_DBusData& other) const; + + /** + * @brief Checks whether the data object tqcontains a valid content + * + * This is equal to checking type() for not being #Invalid + * + * @return @c true if the data object is valid, otherwise @c false + */ + inline bool isValid() const { return type() != TQT_DBusData::Invalid; } + + /** + * @brief Returns the #Type of the data object + * + * @return one of the values of the #Type enum + * + * @see keyType() + * @see typeName() + */ + Type type() const; + + /** + * @brief Returns the #Type of the key type for maps + * + * If the type of the data object is #Map, this method returns the type + * of the map's key, #String for a TQT_DBusDataMap<TQString> + * + * If the type of the data object is not #Map, it will return #Invalid + * + * @return one of the values of the #Type enum, #Invalid if the object is + * not holding a #Map + * + * @see type() + * @see typeName() + */ + Type keyType() const; + + /** + * @brief Returns the string representation of the object's #Type + * + * @return an ASCII C-string for the object's type + * + * @see type() + * @see typeName(Type) + */ + inline const char* typeName() const { return typeName(type()); } + + /** + * @brief Returns the string representation for the given @p type + * + * @param type the #Type to get the string representation for + * + * @return an ASCII C-string for the given @p type + * + * @see type() + * @see typeName() + */ + static const char* typeName(Type type); + + /** + * @brief Creates a data object for the given boolean @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Bool containing the @p value + * + * @see toBool() + */ + static TQT_DBusData fromBool(bool value); + + /** + * @brief Tries to get the encapsulated boolean value + * + * If the data object is not of type #Bool this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Bool) + * + * @return the encapsulated boolean value or @c false if it fails + * + * @see fromBool() + */ + bool toBool(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given byte (unsigned char) @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Byte containing the @p value + * + * @see toByte() + */ + static TQT_DBusData fromByte(TQ_UINT8 value); + + /** + * @brief Tries to get the encapsulated byte (unsigned char) value + * + * If the data object is not of type #Byte this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Byte) + * + * @return the encapsulated byte (unsigned char) value or @c 0 if it fails + * + * @see fromByte() + */ + TQ_UINT8 toByte(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given signed 16-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Int16 containing the @p value + * + * @see toInt16() + */ + static TQT_DBusData fromInt16(TQ_INT16 value); + + /** + * @brief Tries to get the encapsulated signed 16-bit integer value + * + * If the data object is not of type #Int16 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Int16) + * + * @return the encapsulated signed 16-bit integer value or @c 0 if it fails + * + * @see fromInt16() + */ + TQ_INT16 toInt16(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given unsigned 16-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #UInt16 containing the @p value + * + * @see toUInt16() + */ + static TQT_DBusData fromUInt16(TQ_UINT16 value); + + /** + * @brief Tries to get the encapsulated unsigned 16-bit integer value + * + * If the data object is not of type #UInt16 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #UInt16) + * + * @return the encapsulated unsigned 16-bit integer value or @c 0 if it fails + * + * @see fromUInt16() + */ + TQ_UINT16 toUInt16(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given signed 32-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Int32 containing the @p value + * + * @see toInt32() + */ + static TQT_DBusData fromInt32(TQ_INT32 value); + + /** + * @brief Tries to get the encapsulated signed 32-bit integer value + * + * If the data object is not of type #Int32 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Int32) + * + * @return the encapsulated signed 32-bit integer value or @c 0 if it fails + * + * @see fromInt32() + */ + TQ_INT32 toInt32(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given unsigned 32-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #UInt32 containing the @p value + * + * @see toUInt32() + */ + static TQT_DBusData fromUInt32(TQ_UINT32 value); + + /** + * @brief Tries to get the encapsulated unsigned 32-bit integer value + * + * If the data object is not of type #UInt32 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #UInt32) + * + * @return the encapsulated unsigned 32-bit integer value or @c 0 if it fails + * + * @see fromUInt32() + */ + TQ_UINT32 toUInt32(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given signed 64-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Int64 containing the @p value + * + * @see toInt64() + */ + static TQT_DBusData fromInt64(TQ_INT64 value); + + /** + * @brief Tries to get the encapsulated signed 64-bit integer value + * + * If the data object is not of type #Int64 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Int64) + * + * @return the encapsulated signed 64-bit integer value or @c 0 if it fails + * + * @see fromInt64() + */ + TQ_INT64 toInt64(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given unsigned 64-bit integer @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #UInt64 containing the @p value + * + * @see toUInt64() + */ + static TQT_DBusData fromUInt64(TQ_UINT64 value); + + /** + * @brief Tries to get the encapsulated unsigned 64-bit integer value + * + * If the data object is not of type #UInt64 this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #UInt64) + * + * @return the encapsulated unsigned 64-bit integer value or @c 0 if it fails + * + * @see fromUInt64() + */ + TQ_UINT64 toUInt64(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given double @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Double containing the @p value + * + * @see toDouble() + */ + static TQT_DBusData fromDouble(double value); + + /** + * @brief Tries to get the encapsulated double value + * + * If the data object is not of type #Double this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Double) + * + * @return the encapsulated double value or @c 0.0 if it fails + * + * @see fromDouble() + */ + double toDouble(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given string @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #String containing the @p value + * + * @see toString() + */ + static TQT_DBusData fromString(const TQString& value); + + /** + * @brief Tries to get the encapsulated string value + * + * If the data object is not of type #String this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #String) + * + * @return the encapsulated string value or @c TQString() if it fails + * + * @see fromString() + */ + TQString toString(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given object path @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #ObjectPath containing the @p value + * + * @see toObjectPath() + */ + static TQT_DBusData fromObjectPath(const TQT_DBusObjectPath& value); + + /** + * @brief Tries to get the encapsulated object path value + * + * If the data object is not of type #ObjectPath this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #ObjectPath) + * + * @return the encapsulated object path value or an empty and invalid object + * if it fails + * + * @see fromObjectPath() + */ + TQT_DBusObjectPath toObjectPath(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p list + * + * \note The list is allowed to be empty but is required to have a valid type + * + * Unless the list the is empty, the convenience method fromTQValueList() will + * usually be easier to use since it does not require to create a + * TQT_DBusDataList first. For empty lists this method has to be used to + * make sure there is sufficient type information on the list's elements + * available for the binding's marshalling code. + * + * @param list the list to encapsulate + * + * @return a data object of type #List containing the @p list or + * an #Invalid object if the list's type is #Invalid + * + * @see toList() + */ + static TQT_DBusData fromList(const TQT_DBusDataList& list); + + /** + * @brief Tries to get the encapsulated list + * + * If the data object is not of type #List this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #List) + * + * @return the encapsulated list or an empty and #Invalid list if it fails + * + * @see fromList() + */ + TQT_DBusDataList toList(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p list + * + * @warning All elements of the list have to be of the same #Type + * + * Convenience overload for fromList(), usually more straight forward to use + * because it doesn't require to create a TQT_DBusDataList object first, + * however it can only handle lists which contain elements, for empty lists + * fromList() is the only option. + * + * @param list the list to encapsulate + * + * @return a data object of type #List containing the @p list or + * an #Invalid object if the list is empty or if elements have + * different types. + * + * @see toTQValueList() + */ + static TQT_DBusData fromTQValueList(const TQValueList<TQT_DBusData>& list); + + /** + * @brief Tries to get the encapsulated list + * + * Convenience overload for toList(). + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #List) + * + * @return the encapsulated list or an empty and #Invalid list if it fails + * + * @see fromTQValueList() + */ + TQValueList<TQT_DBusData> toTQValueList(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given struct's @p memberList + * + * See the documentation of #Struct for an example. + * + * @param memberList the list of already encapsulated struct members + * + * @return a data object of type #Struct containing the @p memberList + * + * @see toStruct() + */ + static TQT_DBusData fromStruct(const TQValueList<TQT_DBusData>& memberList); + + /** + * @brief Tries to get the encapsulated struct memberList + * + * If the data object is not of type #Struct this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * See the documentation of #Struct for an example. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Struct) + * + * @return the encapsulated memberList or an empty list if it fails + * + * @see fromStruct() + */ + TQValueList<TQT_DBusData> toStruct(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given variant @p value + * + * @param value the value to encapsulate + * + * @return a data object of type #Variant containing the @p value + * + * @see toVariant() + */ + static TQT_DBusData fromVariant(const TQT_DBusVariant& value); + + /** + * @brief Tries to get the encapsulated variant value + * + * If the data object is not of type #Variant this will fail, i.e. + * the parameter @p ok will be set to @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Variant) + * + * @return the encapsulated variant value or an empty variant if it fails + * + * @see fromVariant() + */ + TQT_DBusVariant toVariant(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #Byte. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toByteKeyMap() + */ + static TQT_DBusData fromByteKeyMap(const TQT_DBusDataMap<TQ_UINT8>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #Byte + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #Byte) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromByteKeyMap() + */ + TQT_DBusDataMap<TQ_UINT8> toByteKeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #Int16. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toInt16KeyMap() + */ + static TQT_DBusData fromInt16KeyMap(const TQT_DBusDataMap<TQ_INT16>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #Int16 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #Int16) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromInt16KeyMap() + */ + TQT_DBusDataMap<TQ_INT16> toInt16KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #UInt16. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toUInt16KeyMap() + */ + static TQT_DBusData fromUInt16KeyMap(const TQT_DBusDataMap<TQ_UINT16>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #UInt16 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #UInt16) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromUInt16KeyMap() + */ + TQT_DBusDataMap<TQ_UINT16> toUInt16KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #Int32. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toInt32KeyMap() + */ + static TQT_DBusData fromInt32KeyMap(const TQT_DBusDataMap<TQ_INT32>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #Int32 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #Int32) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromInt32KeyMap() + */ + TQT_DBusDataMap<TQ_INT32> toInt32KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #UInt32. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toUInt32KeyMap() + */ + static TQT_DBusData fromUInt32KeyMap(const TQT_DBusDataMap<TQ_UINT32>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #UInt32 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #UInt32) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromUInt32KeyMap() + */ + TQT_DBusDataMap<TQ_UINT32> toUInt32KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #Int64. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toInt64KeyMap() + */ + static TQT_DBusData fromInt64KeyMap(const TQT_DBusDataMap<TQ_INT64>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #Int64 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #Int64) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromInt64KeyMap() + */ + TQT_DBusDataMap<TQ_INT64> toInt64KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #UInt64. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toUInt64KeyMap() + */ + static TQT_DBusData fromUInt64KeyMap(const TQT_DBusDataMap<TQ_UINT64>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #UInt64 + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #UInt64) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromUInt64KeyMap() + */ + TQT_DBusDataMap<TQ_UINT64> toUInt64KeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #String. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toStringKeyMap() + */ + static TQT_DBusData fromStringKeyMap(const TQT_DBusDataMap<TQString>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not #String + * this will fail, i.e. the parameter @p ok will be set to @c false if + * present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #String) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromStringKeyMap() + */ + TQT_DBusDataMap<TQString> toStringKeyMap(bool* ok = 0) const; + + /** + * @brief Creates a data object for the given @p map + * + * \note The map is allowed to be empty but is required to have a valid + * value type + * + * The resulting data object will have the keyType() set to #ObjectPath. + * + * @param map the map to encapsulate + * + * @return a data object of type #Map containing the @p map or + * an #Invalid object if the map's value type is #Invalid + * + * @see toObjectPathKeyMap() + */ + static TQT_DBusData fromObjectPathKeyMap(const TQT_DBusDataMap<TQT_DBusObjectPath>& map); + + /** + * @brief Tries to get the encapsulated map + * + * If the data object is not of type #Map or if its value type is not + * #ObjectPath this will fail, i.e. the parameter @p ok will be set to + * @c false if present. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type #Map or + * value type not #ObjectPath) + * + * @return the encapsulated map or an empty and #Invalid map if it fails + * + * @see fromObjectPathKeyMap() + */ + TQT_DBusDataMap<TQT_DBusObjectPath> toObjectPathKeyMap(bool* ok = 0) const; + + /** + * @brief Creates the data objects D-Bus signature + * + * Recursivly builds the D-Bus signature of the data object if it holds a + * container type, i.e. if the object is of type #List, #Map or #Struct + * + * This can be used to create a signature for TQT_DBusVariant when creating one + * for sending over D-Bus. + * + * @return a string containing the content's signature, or a null string + * if the data object is #Invalid + */ + TQCString buildDBusSignature() const; + +private: + class Private; + Private* d; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusdataconverter.cpp b/main/dependencies/dbus-tqt/tqdbusdataconverter.cpp new file mode 100644 index 000000000..50575b8d7 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdataconverter.cpp @@ -0,0 +1,143 @@ +/* qdbusdataconverter.cpp TQT_DBusDataConverter template + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusdataconverter.h" +#include "tqdbusdata.h" + +#include <tqpoint.h> +#include <tqrect.h> +#include <tqsize.h> +#include <tqvaluelist.h> + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQRect>(const TQT_DBusData& dbusData, TQRect& typeData) +{ + if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature; + + TQValueList<TQT_DBusData> members = dbusData.toStruct(); + if (members.count() != 4) return InvalidSignature; + + TQ_INT32 values[4]; + + TQValueList<TQT_DBusData>::const_iterator it = members.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = members.end(); + for (uint i = 0; it != endIt; ++it, ++i) + { + bool ok = false; + values[i] = (*it).toInt32(&ok); + if (!ok) return InvalidSignature; + } + + typeData = TQRect(values[0], values[1], values[2], values[3]); + + return Success; +} + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQRect>(const TQRect& typeData, TQT_DBusData& dbusData) +{ + TQValueList<TQT_DBusData> members; + + members << TQT_DBusData::fromInt32(typeData.x()); + members << TQT_DBusData::fromInt32(typeData.y()); + members << TQT_DBusData::fromInt32(typeData.width()); + members << TQT_DBusData::fromInt32(typeData.height()); + + dbusData = TQT_DBusData::fromStruct(members); + + return Success; +} + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQPoint>(const TQT_DBusData& dbusData, TQPoint& typeData) +{ + if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature; + + TQValueList<TQT_DBusData> members = dbusData.toStruct(); + if (members.count() != 2) return InvalidSignature; + + TQ_INT32 values[2]; + + TQValueList<TQT_DBusData>::const_iterator it = members.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = members.end(); + for (uint i = 0; it != endIt; ++it, ++i) + { + bool ok = false; + values[i] = (*it).toInt32(&ok); + if (!ok) return InvalidSignature; + } + + typeData = TQPoint(values[0], values[1]); + + return Success; +} + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQPoint>(const TQPoint& typeData, TQT_DBusData& dbusData) +{ + TQValueList<TQT_DBusData> members; + + members << TQT_DBusData::fromInt32(typeData.x()); + members << TQT_DBusData::fromInt32(typeData.y()); + + dbusData = TQT_DBusData::fromStruct(members); + + return Success; +} + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQSize>(const TQT_DBusData& dbusData, TQSize& typeData) +{ + if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature; + + TQValueList<TQT_DBusData> members = dbusData.toStruct(); + if (members.count() != 2) return InvalidSignature; + + TQ_INT32 values[2]; + + TQValueList<TQT_DBusData>::const_iterator it = members.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = members.end(); + for (uint i = 0; it != endIt; ++it, ++i) + { + bool ok = false; + values[i] = (*it).toInt32(&ok); + if (!ok) return InvalidSignature; + } + + typeData = TQSize(values[0], values[1]); + + return Success; +} + +template <> +TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQSize>(const TQSize& typeData, TQT_DBusData& dbusData) +{ + TQValueList<TQT_DBusData> members; + + members << TQT_DBusData::fromInt32(typeData.width()); + members << TQT_DBusData::fromInt32(typeData.height()); + + dbusData = TQT_DBusData::fromStruct(members); + + return Success; +} diff --git a/main/dependencies/dbus-tqt/tqdbusdataconverter.h b/main/dependencies/dbus-tqt/tqdbusdataconverter.h new file mode 100644 index 000000000..dacc1b27a --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdataconverter.h @@ -0,0 +1,207 @@ +/* qdbusdataconverter.h TQT_DBusDataConverter template + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSDATACONVERTER_H +#define TQDBUSDATACONVERTER_H + +#include "tqdbusmacros.h" + +class TQT_DBusData; + +/** + * @brief Template based converter for getting complex data into or from TQT_DBusData objects + * + * Any data to transport over D-Bus, i.e. method/signal paramaters or properties, need + * to be converted into a TQT_DBusData instance. + * + * For complex types, e.g. structures or nested containers, this can be quite some code, + * and will likely be needed for more than one call. + * Therefore it is more convenient to implement the conversions once per complex type. + * + * Example: sending and recieving a TQRect over D-Bus. + * In D-Bus terminology a TQRect is a struct of four 32-bit signed integers. The code to do + * this manually looks like this: + * @code + * TQRect rect(0, 0, 100, 100); + * + * TQValueList<TQT_DBusData> structMembers; + * structMembers << TQT_DBusData::fromInt32(rect.x()); + * structMembers << TQT_DBusData::fromInt32(rect.y()); + * structMembers << TQT_DBusData::fromInt32(rect.wdth()); + * structMembers << TQT_DBusData::fromInt32(rect.height()); + * + * TQT_DBusData rectStruct = TQT_DBusData::fromStruct(structMembers); + * @endcode + * and reverse (without the error checking) + * @code + * TQT_DBusData dbusData; // assume we got this from a D-Bus call + * + * TQValueList<TQT_DBusData> structMembers = dbudData.toStruct(); + * + * int x = structMembers[0].toInt32(); + * int y = structMembers[1].toInt32(); + * int w = structMembers[2].toInt32(); + * int h = structMembers[3].toInt32(); + * + * TQRect rect(x, y, w, h); + * @endcode + * + * Rather than implementing it in the method which performs the D-Bus call, basically the same + * code can be used as a spezialisation of the TQT_DBusDataConverter methods and then used like this: + * @code + * TQRect rect(0, 0, 100, 100); + * TQT_DBusData rectStruct; + * + * TQT_DBusDataConverter::convertToTQT_DBusData<TQRect>(rect, rectStruct); + * @endcode + * and + * @code + * TQRect rect; + * TQT_DBusData dbusData; // assume we got this from a D-Bus call + * + * TQT_DBusDataConverter::convertFromTQT_DBusData<TQRect>(dbusData, rect); + * @endcode + * + * @note The bindings library tqcontains the spezialisations for TQRect, TQPoint and TQSize. + */ +class TQDBUS_EXPORT TQT_DBusDataConverter +{ +public: + /** + * @brief Conversion result values + */ + enum Result + { + /** + * Conversion successfull + */ + Success, + + /** + * Conversion failed because the passed TQT_DBusData instance does not contain data + * of the needed signature, e.g. too few to too many members for a struct or wrong types. + * + * @see TQT_DBusError::stdInvalidSignature() + */ + InvalidSignature, + + /** + * Conversion failed because the passed TQT_DBusData contained values which are not allowed, + * e.g. out of range for a numerical type used a an enum or flags. + * + * @see TQT_DBusError::stdInvalidArgs() + */ + InvalidArgument + }; + + /** + * @brief Conversion from a filled TQT_DBusData instance to a native type + * + * For example the implementation for TQPoint looks like this: + * @code + * template <> + * TQT_DBusDataConverter::Result + * TQT_DBusDataConverter::convertFromTQT_DBusData<TQPoint>(const TQT_DBusData& dbusData, TQPoint& typeData) + * { + * if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature; + * + * TQValueList<TQT_DBusData> members = dbusData.toStruct(); + * if (members.count() != 2) return InvalidSignature; + * + * bool ok = false; + * int x = members[0].toInt32(&ok); + * if (!ok) return InvalidSignature; + * + * int y = members[1].toInt32(&ok); + * if (!ok) return InvalidSignature; + * + * typeData = TQPoint(x, y); + * + * return Success; + * } + * @endcode + * + * And then can be used like this: + * @code + * TQT_DBusMessage reply; // assume we got this as a D-Bus call reply + * TQPoint point; + * + * if (TQT_DBusDataConverter::convertFromTQT_DBusData(reply[0], point) != TQT_DBusDataConverter::Success) + * { + * // error handling + * } + * @endcode + * + * @param dbusData the binding's data instance to get the content from + * @param typeData the native type instance to put the content into + * + * @return the conversion result value + */ + template <class T> + static Result convertFromTQT_DBusData(const TQT_DBusData& dbusData, T& typeData); + + /** + * @brief Conversion from a native type to a TQT_DBusData instance + * + * For example the implementation for TQPoint looks like this: + * @code + * template <> + * TQT_DBusDataConversion::Result + * TQT_DBusDataConversion::convertToTQT_DBusData<TQPoint>(const TQPoint& typeData, TQT_DBusData& dbusData) + * { + * TQValueList<TQT_DBusData> members; + * members << TQT_DBusData::fromInt32(typeData.x()); + * members << TQT_DBusData::fromInt32(typeData.y()); + * + * dbusData = TQT_DBusData::fromStruct(members); + * + * return Success; + * } + * @endcode + * + * And then can be used like this: + * @code + * TQPoint point(-10, 100); + * TQT_DBusMessage methodCall; // assume created by TQBusMessage::methodCall() + * + * TQT_DBusData dbusData; + * if (TQT_DBusDataConverter::convertToTQT_DBusData<TQPoint>(point, dbusData) != TQT_DBusDataConverter::Success) + * { + * // error handling + * } + * else + * { + * methodCall << dbusData; + * } + * @endcode + * + * @param typeData the native type instance to get the content from + * @param dbusData the binding's data instance to put the content into + * + * @return the conversion result value + */ + template <class T> + static Result convertToTQT_DBusData(const T& typeData, TQT_DBusData& dbusData); +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusdatalist.cpp b/main/dependencies/dbus-tqt/tqdbusdatalist.cpp new file mode 100644 index 000000000..ebfdf72b0 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdatalist.cpp @@ -0,0 +1,748 @@ +/* qdbusdatalist.cpp list of DBUS data transport type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusdatalist.h" +#include "tqdbusobjectpath.h" +#include "tqdbusvariant.h" + +#include <tqstringlist.h> + +class TQT_DBusDataList::Private +{ +public: + Private() : type(TQT_DBusData::Invalid) {} + +public: + TQT_DBusData::Type type; + TQT_DBusData containerItem; + TQValueList<TQT_DBusData> list; +}; + +TQT_DBusDataList::TQT_DBusDataList() : d(new Private()) +{ +} + +TQT_DBusDataList::TQT_DBusDataList(TQT_DBusData::Type simpleItemType) : d(new Private()) +{ + d->type = simpleItemType; +} + +TQT_DBusDataList::TQT_DBusDataList(const TQT_DBusData& containerItemType) : d(new Private()) +{ + d->type = containerItemType.type(); + + switch(d->type) + { + case TQT_DBusData::List: // fall through + case TQT_DBusData::Struct: // fall through + case TQT_DBusData::Map: + d->containerItem = containerItemType; + break; + + default: // not a container + break; + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQT_DBusDataList& other) : d(new Private()) +{ + d->type = other.d->type; + d->list = other.d->list; + d->containerItem = other.d->containerItem; +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusData>& other) : d(new Private()) +{ + if (other.isEmpty()) return; + + TQValueList<TQT_DBusData>::const_iterator it = other.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = other.end(); + + d->type = (*it).type(); + + TQCString elementSignature; + if (hasContainerItemType()) + { + d->containerItem = other[0]; // would be nice to get an empty one + elementSignature = d->containerItem.buildDBusSignature(); + } + + for (++it; it != endIt; ++it) + { + if (d->type != (*it).type()) + { + d->type = TQT_DBusData::Invalid; + d->containerItem = TQT_DBusData(); + + return; + } + else if (hasContainerItemType()) + { + if ((*it).buildDBusSignature() != elementSignature) + { + d->type = TQT_DBusData::Invalid; + d->containerItem = TQT_DBusData(); + + return; + } + } + } + + d->list = other; +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<bool>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Bool; + + if (other.isEmpty()) return; + + TQValueList<bool>::const_iterator it = other.begin(); + TQValueList<bool>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromBool(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT8>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Byte; + + if (other.isEmpty()) return; + + TQValueList<TQ_UINT8>::const_iterator it = other.begin(); + TQValueList<TQ_UINT8>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromByte(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT16>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Int16; + + if (other.isEmpty()) return; + + TQValueList<TQ_INT16>::const_iterator it = other.begin(); + TQValueList<TQ_INT16>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromInt16(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT16>& other) : d(new Private()) +{ + d->type = TQT_DBusData::UInt16; + + if (other.isEmpty()) return; + + TQValueList<TQ_UINT16>::const_iterator it = other.begin(); + TQValueList<TQ_UINT16>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromUInt16(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT32>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Int32; + + if (other.isEmpty()) return; + + TQValueList<TQ_INT32>::const_iterator it = other.begin(); + TQValueList<TQ_INT32>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromInt32(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT32>& other) : d(new Private()) +{ + d->type = TQT_DBusData::UInt32; + + if (other.isEmpty()) return; + + TQValueList<TQ_UINT32>::const_iterator it = other.begin(); + TQValueList<TQ_UINT32>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromUInt32(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT64>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Int64; + + if (other.isEmpty()) return; + + TQValueList<TQ_INT64>::const_iterator it = other.begin(); + TQValueList<TQ_INT64>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromInt64(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT64>& other) : d(new Private()) +{ + d->type = TQT_DBusData::UInt64; + + if (other.isEmpty()) return; + + TQValueList<TQ_UINT64>::const_iterator it = other.begin(); + TQValueList<TQ_UINT64>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromUInt64(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<double>& other) : d(new Private()) +{ + d->type = TQT_DBusData::Double; + + if (other.isEmpty()) return; + + TQValueList<double>::const_iterator it = other.begin(); + TQValueList<double>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromDouble(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusVariant>& other) + : d(new Private()) +{ + d->type = TQT_DBusData::Variant; + + if (other.isEmpty()) return; + + TQValueList<TQT_DBusVariant>::const_iterator it = other.begin(); + TQValueList<TQT_DBusVariant>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromVariant(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQStringList& other) : d(new Private()) +{ + d->type = TQT_DBusData::String; + + if (other.isEmpty()) return; + + TQStringList::const_iterator it = other.begin(); + TQStringList::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromString(*it); + } +} + +TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusObjectPath>& other) + : d(new Private()) +{ + d->type = TQT_DBusData::ObjectPath; + + if (other.isEmpty()) return; + + TQValueList<TQT_DBusObjectPath>::const_iterator it = other.begin(); + TQValueList<TQT_DBusObjectPath>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromObjectPath(*it); + } +} + +TQT_DBusDataList::~TQT_DBusDataList() +{ + delete d; +} + +TQT_DBusDataList& TQT_DBusDataList::operator=(const TQT_DBusDataList& other) +{ + if (&other == this) return *this; + + d->type = other.d->type; + d->list = other.d->list; + d->containerItem = other.d->containerItem; + + return *this; +} + +TQT_DBusDataList& TQT_DBusDataList::operator=(const TQValueList<TQT_DBusData>& other) +{ + d->list.clear(); + d->type = TQT_DBusData::Invalid; + d->containerItem = TQT_DBusData(); + + if (other.isEmpty()) return *this; + + TQValueList<TQT_DBusData>::const_iterator it = other.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = other.end(); + + d->type = (*it).type(); + + TQCString elementSignature; + if (hasContainerItemType()) + { + d->containerItem = other[0]; // would be nice to get an empty one + + elementSignature = d->containerItem.buildDBusSignature(); + } + + for (++it; it != endIt; ++it) + { + if (d->type != (*it).type()) + { + d->type = TQT_DBusData::Invalid; + d->containerItem = TQT_DBusData(); + + return *this; + } + else if (hasContainerItemType()) + { + if ((*it).buildDBusSignature() != elementSignature) + { + d->type = TQT_DBusData::Invalid; + d->containerItem = TQT_DBusData(); + + return *this; + } + } + } + + d->list = other; + + return *this; +} + +TQT_DBusDataList& TQT_DBusDataList::operator=(const TQStringList& other) +{ + d->list.clear(); + d->type = TQT_DBusData::String; + d->containerItem = TQT_DBusData(); + + TQStringList::const_iterator it = other.begin(); + TQStringList::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + d->list << TQT_DBusData::fromString(*it); + } + + return *this; +} + +TQT_DBusData::Type TQT_DBusDataList::type() const +{ + return d->type; +} + +bool TQT_DBusDataList::hasContainerItemType() const +{ + return d->type == TQT_DBusData::List || d->type == TQT_DBusData::Map + || d->type == TQT_DBusData::Struct; +} + +TQT_DBusData TQT_DBusDataList::containerItemType() const +{ + return d->containerItem; +} + +bool TQT_DBusDataList::isEmpty() const +{ + return d->list.isEmpty(); +} + +uint TQT_DBusDataList::count() const +{ + return d->list.count(); +} + +bool TQT_DBusDataList::operator==(const TQT_DBusDataList& other) const +{ + if (&other == this) return true; + if (d == other.d) return true; + + bool containerEqual = true; + if (hasContainerItemType()) + { + if (other.hasContainerItemType()) + { + containerEqual = d->containerItem.buildDBusSignature() == + other.d->containerItem.buildDBusSignature(); + } + else + containerEqual = false; + } + else if (other.hasContainerItemType()) + containerEqual = false; + + return d->type == other.d->type && containerEqual && d->list == other.d->list; +} + +bool TQT_DBusDataList::operator!=(const TQT_DBusDataList& other) const +{ + if (&other == this) return false; + if (d == other.d) return false; + + bool containerEqual = true; + if (hasContainerItemType()) + { + if (other.hasContainerItemType()) + { + containerEqual = d->containerItem.buildDBusSignature() == + other.d->containerItem.buildDBusSignature(); + } + else + containerEqual = false; + } + else if (other.hasContainerItemType()) + containerEqual = false; + + return d->type != other.d->type || !containerEqual || d->list != other.d->list; +} + +void TQT_DBusDataList::clear() +{ + d->list.clear(); +} + +TQT_DBusDataList& TQT_DBusDataList::operator<<(const TQT_DBusData& data) +{ + if (data.type() == TQT_DBusData::Invalid) return *this; + + if (d->type == TQT_DBusData::Invalid) + { + d->type = data.type(); + + // check if we are now have container items + if (hasContainerItemType()) d->containerItem = data; + + d->list << data; + } + else if (d->type != data.type()) + { + qWarning("TQT_DBusDataList: trying to add data of type %s to list of type %s", + data.typeName(), TQT_DBusData::typeName(d->type)); + } + else if (hasContainerItemType()) + { + TQCString ourSignature = d->containerItem.buildDBusSignature(); + TQCString dataSignature = data.buildDBusSignature(); + + if (ourSignature != dataSignature) + { + qWarning("TQT_DBusDataList: trying to add data with signature %s " + "to list with item signature %s", + dataSignature.data(), ourSignature.data()); + } + else + d->list << data; + } + else + d->list << data; + + return *this; +} + +TQValueList<TQT_DBusData> TQT_DBusDataList::toTQValueList() const +{ + return d->list; +} + +TQStringList TQT_DBusDataList::toTQStringList(bool* ok) const +{ + if (d->type != TQT_DBusData::String) + { + if (ok != 0) *ok = false; + return TQStringList(); + } + + TQStringList result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toString(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<bool> TQT_DBusDataList::toBoolList(bool* ok) const +{ + if (d->type != TQT_DBusData::Bool) + { + if (ok != 0) *ok = false; + return TQValueList<bool>(); + } + + TQValueList<bool> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toBool(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_UINT8> TQT_DBusDataList::toByteList(bool* ok) const +{ + if (d->type != TQT_DBusData::Byte) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_UINT8>(); + } + + TQValueList<TQ_UINT8> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toByte(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_INT16> TQT_DBusDataList::toInt16List(bool* ok) const +{ + if (d->type != TQT_DBusData::Int16) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_INT16>(); + } + + TQValueList<TQ_INT16> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toInt16(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_UINT16> TQT_DBusDataList::toUInt16List(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt16) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_UINT16>(); + } + + TQValueList<TQ_UINT16> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toUInt16(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_INT32> TQT_DBusDataList::toInt32List(bool* ok) const +{ + if (d->type != TQT_DBusData::Int32) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_INT32>(); + } + + TQValueList<TQ_INT32> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toInt32(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_UINT32> TQT_DBusDataList::toUInt32List(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt32) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_UINT32>(); + } + + TQValueList<TQ_UINT32> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toUInt32(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_INT64> TQT_DBusDataList::toInt64List(bool* ok) const +{ + if (d->type != TQT_DBusData::Int64) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_INT64>(); + } + + TQValueList<TQ_INT64> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toInt64(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQ_UINT64> TQT_DBusDataList::toUInt64List(bool* ok) const +{ + if (d->type != TQT_DBusData::UInt64) + { + if (ok != 0) *ok = false; + return TQValueList<TQ_UINT64>(); + } + + TQValueList<TQ_UINT64> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toUInt64(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<double> TQT_DBusDataList::toDoubleList(bool* ok) const +{ + if (d->type != TQT_DBusData::Double) + { + if (ok != 0) *ok = false; + return TQValueList<double>(); + } + + TQValueList<double> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toDouble(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQString> TQT_DBusDataList::toStringList(bool* ok) const +{ + return toTQStringList(ok); +} + +TQValueList<TQT_DBusObjectPath> TQT_DBusDataList::toObjectPathList(bool* ok) const +{ + if (d->type != TQT_DBusData::ObjectPath) + { + if (ok != 0) *ok = false; + return TQValueList<TQT_DBusObjectPath>(); + } + + TQValueList<TQT_DBusObjectPath> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toObjectPath(); + } + + if (ok != 0) *ok = true; + + return result; +} + +TQValueList<TQT_DBusVariant> TQT_DBusDataList::toVariantList(bool* ok) const +{ + if (d->type != TQT_DBusData::Variant) + { + if (ok != 0) *ok = false; + return TQValueList<TQT_DBusVariant>(); + } + + TQValueList<TQT_DBusVariant> result; + + TQValueList<TQT_DBusData>::const_iterator it = d->list.begin(); + TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end(); + for (; it != endIt; ++it) + { + result << (*it).toVariant(); + } + + if (ok != 0) *ok = true; + + return result; +} diff --git a/main/dependencies/dbus-tqt/tqdbusdatalist.h b/main/dependencies/dbus-tqt/tqdbusdatalist.h new file mode 100644 index 000000000..7b0432ce9 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdatalist.h @@ -0,0 +1,725 @@ +/* qdbusdatalist.h list of DBUS data transport type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSDATALIST_H +#define TQDBUSDATALIST_H + +#include "tqdbusdata.h" + +template <typename T> class TQValueList; +class TQT_DBusObjectPath; +class TQT_DBusVariant; +class TQString; +class TQStringList; + +/** + * @brief Class to transport lists of D-Bus data types + * + * \note while the D-Bus data type is actually called @c array this bindings + * use the term @c list since the behavior and characteristics of the + * implementation is more list like. + * + * There are basically two ways to create TQT_DBusDataList objects: + * - non-empty from content + * - empty by specifying the desired element type + * + * Example for creating a filled list from content + * @code + * TQValueList<TQ_INT16> intList; + * list << 2 << 3 << 5 << 7; + * + * TQT_DBusDataList dbusList(intList); + * TQT_DBusData data = TQT_DBusData::fromList(dbusList); + * + * // or even shorter, using implicit conversion + * TQT_DBusData other = TQT_DBusData::fromList(intList); + * @endcode + * + * Example for creating an empty list + * @code + * // empty list for a simple type + * TQT_DBusDataList list(TQT_DBusData::Double); + * + * // empty list for a list of string lists + * TQT_DBusData elementType = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::String)); + * TQT_DBusDataList outerList(elementType); + * @endcode + * + * @see TQT_DBusDataMap + */ +class TQDBUS_EXPORT TQT_DBusDataList +{ +public: + /** + * @brief Creates an empty and invalid list + * + * @see TQT_DBusData::Invalid + */ + TQT_DBusDataList(); + + /** + * @brief Creates an empty list with the given simple type for elements + * + * The given type has be one of the non-container types, i.e. any other than + * TQT_DBusData::Map, TQT_DBusData::List or TQT_DBusData::Struct + * + * For creating a list with elements which are containers themselves, use + * TQT_DBusDataList(const TQT_DBusData&); + * + * @param simpleItemType the type of the elements in the new list + */ + explicit TQT_DBusDataList(TQT_DBusData::Type simpleItemType); + + /** + * @brief Creates an empty list with the given container type for elements + * + * For creating a list with simple elements you can also use + * TQT_DBusDataList(TQT_DBusData::Type); + * + * @param containerItemType the type of the elements in the new list + * + * @see hasContainerItemType() + */ + explicit TQT_DBusDataList(const TQT_DBusData& containerItemType); + + /** + * @brief Creates a list from the given @p other list + * + * This behaves basically like copying a TQValueList through its copy + * constructor, i.e. no value are actually copied at this time. + * + * @param other the other list object to copy from + */ + TQT_DBusDataList(const TQT_DBusDataList& other); + + /** + * @brief Creates a list from the given TQValueList of TQT_DBusData objects + * + * If the @p other list is empty, this will behave like TQT_DBusDataList(), + * i.e. create an empty and invalid list object. + * + * Type information for the list object, i.e. element type and, if applicable, + * container item type, will be derived from the @p other list's elements. + * + * \warning if the elements of the @p other list do not all have the same + * type, the list object will also be empty and invalid + * + * @param other the TQValueList of TQT_DBusData objects to copy from + * + * @see toTQValueList() + */ + TQT_DBusDataList(const TQValueList<TQT_DBusData>& other); + + /** + * @brief Creates a list from the given TQValueList of boolean values + * + * Type information for the list object will be set to TQT_DBusData::Bool + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Bool + * + * @param other the TQValueList of boolean values to copy from + * + * @see toBoolList() + */ + TQT_DBusDataList(const TQValueList<bool>& other); + + /** + * @brief Creates a list from the given TQValueList of byte (unsigned char) values + * + * Type information for the list object will be set to TQT_DBusData::Byte + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Byte + * + * @param other the TQValueList of byte (unsigned char) values to copy from + * + * @see toByteList() + */ + TQT_DBusDataList(const TQValueList<TQ_UINT8>& other); + + /** + * @brief Creates a list from the given TQValueList of signed 16-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::Int16 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int16 + * + * @param other the TQValueList of signed 16-bit integer values to copy from + * + * @see toInt16List() + */ + TQT_DBusDataList(const TQValueList<TQ_INT16>& other); + + /** + * @brief Creates a list from the given TQValueList of unsigned 16-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::UInt16 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt16 + * + * @param other the TQValueList of unsigned 16-bit integer values to copy from + * + * @see toUInt16List() + */ + TQT_DBusDataList(const TQValueList<TQ_UINT16>& other); + + /** + * @brief Creates a list from the given TQValueList of signed 32-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::Int32 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int32 + * + * @param other the TQValueList of signed 32-bit integer values to copy from + * + * @see toInt32List() + */ + TQT_DBusDataList(const TQValueList<TQ_INT32>& other); + + /** + * @brief Creates a list from the given TQValueList of unsigned 32-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::UInt16 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt32 + * + * @param other the TQValueList of unsigned 32-bit integer values to copy from + * + * @see toUInt32List() + */ + TQT_DBusDataList(const TQValueList<TQ_UINT32>& other); + + /** + * @brief Creates a list from the given TQValueList of signed 64-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::Int64 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int64 + * + * @param other the TQValueList of signed 64-bit integer values to copy from + * + * @see toInt64List() + */ + TQT_DBusDataList(const TQValueList<TQ_INT64>& other); + + /** + * @brief Creates a list from the given TQValueList of unsigned 64-bit integer values + * + * Type information for the list object will be set to TQT_DBusData::UInt64 + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt64 + * + * @param other the TQValueList of unsigned 64-bit integer values to copy from + * + * @see toUInt64List() + */ + TQT_DBusDataList(const TQValueList<TQ_UINT64>& other); + + /** + * @brief Creates a list from the given TQValueList of double values + * + * Type information for the list object will be set to TQT_DBusData::Double + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Double + * + * @param other the TQValueList of double values to copy from + * + * @see toDoubleList() + */ + TQT_DBusDataList(const TQValueList<double>& other); + + /** + * @brief Creates a list from the given TQValueList of TQT_DBusVariant values + * + * Type information for the list object will be set to TQT_DBusData::Variant + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Variant + * + * @param other the TQValueList of variant values to copy from + * + * @see toVariantList() + */ + TQT_DBusDataList(const TQValueList<TQT_DBusVariant>& other); + + /** + * @brief Creates a list from the given TQStringList's values + * + * Type information for the list object will be set to TQT_DBusData::String + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::String + * + * @param other the TQStringList to copy from + * + * @see toTQStringList() + */ + TQT_DBusDataList(const TQStringList& other); + + /** + * @brief Creates a list from the given TQValueList of object path values + * + * Type information for the list object will be set to TQT_DBusData::ObjectPath + * also when the @p other list is empty, i.e. this allows to create an + * empty but valid list object, comparable to using + * TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::ObjectPath + * + * @param other the TQValueList of object path values to copy from + * + * @see toObjectPathList() + */ + TQT_DBusDataList(const TQValueList<TQT_DBusObjectPath>& other); + + /** + * @brief Destroys the list object + */ + ~TQT_DBusDataList(); + + /** + * @brief Copies from the given @p other list + * + * This behaves basically like copying a TQValueList through its assignment + * operator, i.e. no value are actually copied at this time. + * + * @param other the other list object to copy from + * + * @return a reference to this list object + */ + TQT_DBusDataList& operator=(const TQT_DBusDataList& other); + + /** + * @brief Copies from the given @p other list + * + * This behaves basically like copying a TQValueList through its assignment + * operator, i.e. no value are actually copied at this time. + * + * \warning the elements of the given @p other list have to be of the same + * type. If they aren't this list's content will cleared and the + * type will be set to TQT_DBusData::Invalid + * + * @param other the other list object to copy from + * + * @return a reference to this list object + */ + TQT_DBusDataList& operator=(const TQValueList<TQT_DBusData>& other); + + /** + * @brief Copies from the given @p other list + * + * Convenience overload as TQStringList is a very common data type in + * TQt and D-Bus methods also use "arrays of strings" quite often. + * + * The list object's type will be set to TQT_DBusData::String. If the object + * previously had a container as its element type, this will be reset, i.e. + * hasContainerItemType() will return @c false + * + * @param other the stringlist to copy from + * + * @return a reference to this list object + */ + TQT_DBusDataList& operator=(const TQStringList& other); + + /** + * @brief Returns the element type of the list object + * + * @return one of the values of the TQT_DBusData#Type enum + * + * @see hasContainerItemType() + * @see containerItemType() + */ + TQT_DBusData::Type type() const; + + /** + * @brief Checks whether the element type is a data container itself + * + * If the elements of the list are containers as well, this will return + * @c true + * In this case containerItemType() will return a prototype for such a + * container. + * + * @return @c true if the element type is either TQT_DBusData::Map, + * TQT_DBusData::List or TQT_DBusData::Struct, otherwise @c false + * + * @see TQT_DBusDataList(const TQT_DBusData&) + */ + bool hasContainerItemType() const; + + /** + * @brief Returns a container prototype for the list's element type + * + * Lists which have containers as their elements, i.e. hasContainerItemType() + * returns @c true this will actually specify the details for the use + * container, i.e. the returned data object can be queried for type and + * possible further subtypes. + * + * @return a data object detailing the element type or an invalid data object + * if the list does not have a container as its element type + * + * @see TQT_DBusDataList(const TQT_DBusData&); + * @see type() + * @see TQT_DBusData::Invalid + */ + TQT_DBusData containerItemType() const; + + /** + * @brief Checks whether this list object has a valid element type + * + * This is equal to checking type() for not being TQT_DBusData::Invalid + * + * @return @c true if the list object is valid, otherwise @c false + */ + inline bool isValid() const { return type() != TQT_DBusData::Invalid; } + + /** + * @brief Checks whether this list object has any elements + * + * @return @c true if there are no elements in this list, otherwise @c false + * + * @see count() + */ + bool isEmpty() const; + + /** + * @brief Returns the number of elements of this list object + * + * @return the number of elements + * + * @see isEmpty() + */ + uint count() const; + + /** + * @brief Checks whether the given @p other list is equal to this one + * + * Two lists are considered equal when they have the same type (and same + * container item type if the have one) and the element lists are equal + * as well. + * + * @param other the other list object to compare with + * + * @return @c true if the lists are equal, otherwise @c false + * + * @see TQT_DBusData::operator==() + */ + bool operator==(const TQT_DBusDataList& other) const; + + /** + * @brief Checks whether the given @p other list is different from this one + * + * Two lists are considered different when they have the different type (or + * different container item type if the have one) or the element lists are + * equal are different. + * + * @param other the other list object to compare with + * + * @return @c true if the lists are different, otherwise @c false + * + * @see TQT_DBusData::operator!=() + */ + bool operator!=(const TQT_DBusDataList& other) const; + + /** + * @brief Clears the list + * + * Type and, if applicable, container element type will stay untouched. + */ + void clear(); + + /** + * @brief Appends a given value to the list + * + * Basically works like the respective TQValueList operator, but checks if + * type of the new value matches the type of the list. + * Lists that are invalid will accept any new type and will then be + * typed accordingly. + * + * If @p data is invalid itself, it will not be appended at any time. + * + * \note the more common use case is to work with a TQValueList and then + * use the respective constructor to create the TQT_DBusDataList object + * + * @param data the data item to append to the list + * + * @return a reference to this list object + */ + TQT_DBusDataList& operator<<(const TQT_DBusData& data); + + /** + * @brief Converts the list object into a TQValueList with TQT_DBusData elements + * + * @return the values of the list object as a TQValueList + */ + TQValueList<TQT_DBusData> toTQValueList() const; + + /** + * @brief Tries to get the list object's elements as a TQStringList + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::String. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::String) + * + * @return a TQStringList containing the list object's string elements or + * an empty list when converting fails + * + * @see toStringList() + * @see TQT_DBusData::toString() + */ + TQStringList toTQStringList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of bool + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Bool. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Bool) + * + * @return a TQValueList of bool containing the list object's boolean + * elements or an empty list when converting fails + * + * @see TQT_DBusData::toBool() + */ + TQValueList<bool> toBoolList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_UINT8 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Byte. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Byte) + * + * @return a TQValueList of TQ_UINT8 containing the list object's byte + * elements or an empty list when converting fails + * + * @see TQT_DBusData::toByte() + */ + TQValueList<TQ_UINT8> toByteList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_INT16 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Int16. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Int16) + * + * @return a TQValueList of TQ_INT16 containing the list object's + * signed 16-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toInt16() + */ + TQValueList<TQ_INT16> toInt16List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_UINT16 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::UInt16. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::UInt16) + * + * @return a TQValueList of TQ_UINT16 containing the list object's + * unsigned 16-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toUInt16() + */ + TQValueList<TQ_UINT16> toUInt16List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_INT32 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Int32. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Int32) + * + * @return a TQValueList of TQ_INT32 containing the list object's + * signed 32-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toInt32() + */ + TQValueList<TQ_INT32> toInt32List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_UINT32 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::UInt32. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::UInt32) + * + * @return a TQValueList of TQ_UINT32 containing the list object's + * unsigned 32-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toUInt32() + */ + TQValueList<TQ_UINT32> toUInt32List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_INT64 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Int64. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Int64) + * + * @return a TQValueList of TQ_INT64 containing the list object's + * signed 64-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toInt64() + */ + TQValueList<TQ_INT64> toInt64List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQ_UINT64 + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::UInt64. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::UInt64) + * + * @return a TQValueList of TQ_UINT64 containing the list object's + * unsigned 64-bit integer elements or an empty list when converting + * fails + * + * @see TQT_DBusData::toUInt64() + */ + TQValueList<TQ_UINT64> toUInt64List(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of double + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Double. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Double) + * + * @return a TQValueList of double containing the list object's double + * elements or an empty list when converting fails + * + * @see TQT_DBusData::toDouble() + */ + TQValueList<double> toDoubleList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQString + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::String, see also toTQStringList(). + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::String) + * + * @return a TQValueList of TQString containing the list object's string + * elements or an empty list when converting fails + * + * @see TQT_DBusData::toString() + */ + TQValueList<TQString> toStringList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of object paths + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::ObjectPath) + * + * @return a TQValueList of object paths containing the list object's object path + * elements or an empty list when converting fails + * + * @see TQT_DBusData::toObjectPath() + */ + TQValueList<TQT_DBusObjectPath> toObjectPathList(bool* ok = 0) const; + + /** + * @brief Tries to get the list object's elements as a TQValueList of TQT_DBusVariant + * + * This is a convenience overload for the case when the list is of + * type TQT_DBusData::Variant. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of type + * TQT_DBusData::Variant) + * + * @return a TQValueList of TQT_DBusVariant containing the list object's + * TQT_DBusVariant elements or an empty list when converting fails + * + * @see TQT_DBusData::toVariant() + */ + TQValueList<TQT_DBusVariant> toVariantList(bool* ok = 0) const; + +private: + class Private; + Private* d; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusdatamap.h b/main/dependencies/dbus-tqt/tqdbusdatamap.h new file mode 100644 index 000000000..959270137 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusdatamap.h @@ -0,0 +1,1222 @@ +/* qdbusdatamap.h DBUS data mapping transport type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSDATAMAP_H +#define TQDBUSDATAMAP_H + +#include "tqdbusmacros.h" +#include <tqmap.h> + +class TQT_DBusData; +class TQT_DBusObjectPath; +class TQT_DBusVariant; + +/** + * @brief Class to transport maps of D-Bus data types + * + * \note while the D-Bus data type is actually called @c dict this bindings + * use the term @c map since TQT_DBusDataMap is essentially a TQMap + * + * There are basically two ways to create TQT_DBusDataMap objects: + * - non-empty from content + * - empty by specifying the desired element type + * + * Example for creating a filled map from content + * @code + * TQMap<TQ_INT16, TQString> intToStringMap; + * map.insert(2, "two"); + * map.insert(3, "three"); + * map.insert(5, "five"); + * map.insert(7, "seven"); + * + * TQT_DBusDataMap<TQ_INT16> dbusMap(intToStringMap); + * TQT_DBusData data = TQT_DBusData::fromInt16KeyMap(dbusMap); + * + * // or even shorter, using implicit conversion + * TQT_DBusData other = TQT_DBusData::fromInt16KeyMap(intList); + * @endcode + * + * Example for creating an empty map + * @code + * // empty map for a simple type, mapping from TQString to double + * TQT_DBusDataMap<TQString> list(TQT_DBusData::Double); + * + * // empty map for value type string lists + * TQT_DBusData valueType = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::String)); + * TQT_DBusDataMap<TQString> map(valueType); + * @endcode + * + * @see TQT_DBusDataList + */ +template <typename T> +class TQDBUS_EXPORT TQT_DBusDataMap : private TQMap<T, TQT_DBusData> +{ + friend class TQT_DBusData; + +public: + /** + * Constant iterator. A TQMapConstIterator with value type specified + * as TQT_DBusData + */ + typedef TQMapConstIterator<T, TQT_DBusData> const_iterator; + + /** + * @brief Creates an empty and invalid map + * + * @see TQT_DBusData::Invalid + */ + TQT_DBusDataMap<T>() + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Invalid) {} + + /** + * @brief Creates an empty map with the given simple type for values + * + * The given type has be one of the non-container types, i.e. any other than + * TQT_DBusData::Map, TQT_DBusData::List or TQT_DBusData::Struct + * + * For creating a map with elements which are containers themselves, use + * TQT_DBusDataMap<T>(const TQT_DBusData&); + * + * @param simpleValueType the type of the values in the new map + */ + explicit TQT_DBusDataMap<T>(TQT_DBusData::Type simpleValueType) + : TQMap<T, TQT_DBusData>(), m_valueType(simpleValueType) {} + + /** + * @brief Creates an empty map with the given container type for values + * + * For creating a map with simple values you can also use + * TQT_DBusDataMap<T>(TQT_DBusData::Type); + * + * @param containerValueType the type of the values in the new map + * + * @see hasContainerValueType() + */ + explicit TQT_DBusDataMap<T>(const TQT_DBusData& containerValueType) + : TQMap<T, TQT_DBusData>(), m_valueType(containerValueType.type()) + { + if (hasContainerValueType()) m_containerValueType = containerValueType; + } + + /** + * @brief Creates a map from the given @p other map + * + * This behaves basically like copying a TQMap through its copy + * constructor, i.e. no value are actually copied at this time. + * + * @param other the other map object to copy from + */ + TQT_DBusDataMap<T>(const TQT_DBusDataMap<T>& other) + : TQMap<T, TQT_DBusData>(other), m_valueType(other.m_valueType), + m_containerValueType(other.m_containerValueType) {} + + /** + * @brief Creates a map from the given TQMap of TQT_DBusData objects + * + * If the @p other map is empty, this will behave like TQT_DBusDataMap<T>(), + * i.e. create an empty and invalid map object. + * + * Type information for the map object, i.e. value type and, if applicable, + * container value type, will be derived from the @p other map's elements. + * + * \warning if the values of the @p other map do not all have the same + * type, the map object will also be empty and invalid + * + * @param other the TQMap of TQT_DBusData objects to copy from + * + * @see toTQMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusData>& other) + : TQMap<T, TQT_DBusData>(other), m_valueType(TQT_DBusData::Invalid) + { + const_iterator it = begin(); + if (it == end()) return; + + m_valueType = (*it).type(); + + TQCString containerSignature; + if (hasContainerValueType()) + { + m_containerValueType = it.data(); + containerSignature = m_containerValueType.buildDBusSignature(); + } + + for (++it; it != end(); ++it) + { + if ((*it).type() != m_valueType) + { + m_valueType = TQT_DBusData::Invalid; + m_containerValueType = TQT_DBusData(); + + clear(); + return; + } + else if (hasContainerValueType()) + { + if (it.data().buildDBusSignature() != containerSignature) + { + m_valueType = TQT_DBusData::Invalid; + m_containerValueType = TQT_DBusData(); + + clear(); + return; + } + } + } + } + + /** + * @brief Creates a list from the given TQMap of boolean values + * + * Type information for the map object will be set to TQT_DBusData::Bool + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Bool + * + * @param other the TQMap of boolean values to copy from + * + * @see toBoolMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, bool>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Bool) + { + typename TQMap<T, bool>::const_iterator it = other.begin(); + typename TQMap<T, bool>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromBool(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of byte (unsigned char) values + * + * Type information for the map object will be set to TQT_DBusData::Byte + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Byte + * + * @param other the TQMap of byte (unsigned char) values to copy from + * + * @see toByteMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_UINT8>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Byte) + { + typename TQMap<T, TQ_UINT8>::const_iterator it = other.begin(); + typename TQMap<T, TQ_UINT8>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromByte(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of signed 16-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::Int16 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Int16 + * + * @param other the TQMap of signed 16-bit integer values to copy from + * + * @see toInt16Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_INT16>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Int16) + { + typename TQMap<T, TQ_INT16>::const_iterator it = other.begin(); + typename TQMap<T, TQ_INT16>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt16(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of unsigned 16-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::UInt16 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::UInt16 + * + * @param other the TQMap of unsigned 16-bit integer values to copy from + * + * @see toUInt16Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_UINT16>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::UInt16) + { + typename TQMap<T, TQ_UINT16>::const_iterator it = other.begin(); + typename TQMap<T, TQ_UINT16>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt16(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of signed 32-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::Int32 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Int32 + * + * @param other the TQMap of signed 32-bit integer values to copy from + * + * @see toInt32Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_INT32>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Int32) + { + typename TQMap<T, TQ_INT32>::const_iterator it = other.begin(); + typename TQMap<T, TQ_INT32>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt32(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of unsigned 32-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::UInt16 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::UInt32 + * + * @param other the TQMap of unsigned 32-bit integer values to copy from + * + * @see toUInt32Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_UINT32>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::UInt32) + { + typename TQMap<T, TQ_UINT32>::const_iterator it = other.begin(); + typename TQMap<T, TQ_UINT32>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt32(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of signed 64-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::Int64 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Int64 + * + * @param other the TQMap of signed 64-bit integer values to copy from + * + * @see toInt64Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_INT64>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Int64) + { + typename TQMap<T, TQ_INT64>::const_iterator it = other.begin(); + typename TQMap<T, TQ_INT64>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt64(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of unsigned 64-bit integer values + * + * Type information for the map object will be set to TQT_DBusData::UInt64 + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::UInt64 + * + * @param other the TQMap of unsigned 64-bit integer values to copy from + * + * @see toUInt64Map() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQ_UINT64>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::UInt64) + { + typename TQMap<T, TQ_UINT64>::const_iterator it = other.begin(); + typename TQMap<T, TQ_UINT64>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt64(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of double values + * + * Type information for the map object will be set to TQT_DBusData::Double + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Double + * + * @param other the TQMap of double values to copy from + * + * @see toDoubleMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, double>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Double) + { + typename TQMap<T, double>::const_iterator it = other.begin(); + typename TQMap<T, double>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromDouble(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQString values + * + * Type information for the map object will be set to TQT_DBusData::String + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::String + * + * @param other the TQMap of TQString values to copy from + * + * @see toStringMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQString>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::String) + { + typename TQMap<T, TQString>::const_iterator it = other.begin(); + typename TQMap<T, TQString>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromString(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of object path values + * + * Type information for the map object will be set to TQT_DBusData::ObjectPath + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::ObjectPath + * + * @param other the TQMap of object path values to copy from + * + * @see toObjectPathMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusObjectPath>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::ObjectPath) + { + typename TQMap<T, TQT_DBusObjectPath>::const_iterator it = other.begin(); + typename TQMap<T, TQT_DBusObjectPath>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromObjectPath(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusVariant values + * + * Type information for the map object will be set to TQT_DBusData::Variant + * also when the @p other map is empty, i.e. this allows to create an + * empty but valid map object, comparable to using + * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::Variant + * + * @param other the TQMap of variant values to copy from + * + * @see toVariantMap() + */ + TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusVariant>& other) + : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Variant) + { + typename TQMap<T, TQT_DBusVariant>::const_iterator it = other.begin(); + typename TQMap<T, TQT_DBusVariant>::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromVariant(it.data())); + } + } + + /** + * @brief Copies from the given @p other map + * + * This behaves basically like copying a TQMap through its assignment + * operator, i.e. no value are actually copied at this time. + * + * @param other the other map object to copy from + * + * @return a reference to this map object + */ + TQT_DBusDataMap<T>& operator=(const TQT_DBusDataMap<T>& other) + { + TQMap<T, TQT_DBusData>::operator=(other); + + m_valueType = other.m_valueType; + m_containerValueType = other.m_containerValueType; + + return *this; + } + + /** + * @brief Copies from the given @p other map + * + * This behaves basically like copying a TQMap through its assignment + * operator, i.e. no value are actually copied at this time. + * + * \warning the value of the given @p other map have to be of the same + * type. If they aren't this maps's content will cleared and the + * value type will be set to TQT_DBusData::Invalid + * + * @param other the other map object to copy from + * + * @return a reference to this map object + */ + TQT_DBusDataMap<T>& operator=(const TQMap<T, TQT_DBusData>& other) + { + TQMap<T, TQT_DBusData>::operator=(other); + + m_valueType = TQT_DBusData::Invalid; + m_containerValueType = TQT_DBusData(); + + const_iterator it = begin(); + if (it == end()) return *this; + + m_valueType = (*it).type(); + + TQCString containerSignature; + if (hasContainerValueType()) + { + m_containerValueType = it.data(); + containerSignature = m_containerValueType.buildDBusSignature(); + } + + for (++it; it != end(); ++it) + { + if ((*it).type() != m_valueType) + { + m_valueType = TQT_DBusData::Invalid; + m_containerValueType = TQT_DBusData(); + + clear(); + return *this; + } + else if (hasContainerValueType()) + { + if (it.data()->buildSignature() != containerSignature) + { + m_valueType = TQT_DBusData::Invalid; + m_containerValueType = TQT_DBusData(); + + clear(); + return *this; + } + } + } + + return *this; + } + + /** + * @brief Returns the key type of the map object + * + * @return one of the values of the TQT_DBusData#Type enum suitable for + * map keys. See TQT_DBusData::Map for details + * + * @see valueType() + */ + TQT_DBusData::Type keyType() const { return m_keyType; } + + /** + * @brief Returns the value type of the map object + * + * @return one of the values of the TQT_DBusData#Type enum + * + * @see hasContainerValueType() + * @see containerValueType() + * @see keyType() + */ + TQT_DBusData::Type valueType() const { return m_valueType; } + + /** + * @brief Checks whether the value type is a data container itself + * + * If the value of the map are containers as well, this will return + * @c true + * In this case containerValueType() will return a prototype for such a + * container. + * + * @return @c true if the value type is either TQT_DBusData::Map, + * TQT_DBusData::List or TQT_DBusData::Struct, otherwise @c false + * + * @see TQT_DBusDataMap<T>(const TQT_DBusData&) + */ + bool hasContainerValueType() const + { + return m_valueType == TQT_DBusData::List || m_valueType == TQT_DBusData::Struct + || m_valueType == TQT_DBusData::Map; + } + + /** + * @brief Returns a container prototype for the map's value type + * + * Lists which have containers as their elements, i.e. hasContainerValueType() + * returns @c true this will actually specify the details for the use + * container, i.e. the returned data object can be queried for type and + * possible further subtypes. + * + * @return a data object detailing the value type or an invalid data object + * if the map does not have a container as its element type + * + * @see TQT_DBusDataMap<T>(const TQT_DBusData&); + * @see valueType() + * @see TQT_DBusData::Invalid + */ + TQT_DBusData containerValueType() const { return m_containerValueType; } + + /** + * @brief Checks whether this map object has a valid value type + * + * This is equal to checking valueType() for not being TQT_DBusData::Invalid + * + * @return @c true if the map object is valid, otherwise @c false + */ + inline bool isValid() const { return valueType() != TQT_DBusData::Invalid; } + + /** + * @brief Checks whether this map object has any key/value pairs + * + * @return @c true if there are no key/values in this map, otherwise @c false + * + * @see count() + */ + bool isEmpty() const { return TQMap<T, TQT_DBusData>::empty(); } + + /** + * @brief Returns the number of key/value pairs of this map object + * + * @return the number of key/value pairs + * + * @see isEmpty() + */ + uint count() const { return TQMap<T, TQT_DBusData>::count(); } + + /** + * @brief Checks whether the given @p other map is equal to this one + * + * Two maps are considered equal when they have the same value type (and same + * container value type if the have one) and the key/value pairs are equal + * as well. + * + * @param other the other map object to compare with + * + * @return @c true if the maps are equal, otherwise @c false + * + * @see TQT_DBusData::operator==() + */ + bool operator==(const TQT_DBusDataMap<T>& other) const + { + if (m_valueType != other.m_valueType) return false; + + if (count() != other.count()) return false; + + if (hasContainerValueType() != other.hasContainerValueType()) return false; + + if (hasContainerValueType()) + { + if (m_containerValueType.buildDBusSignature() != + other.m_containerValueType.buildDBusSignature()) return false; + } + + const_iterator it = begin(); + const_iterator otherIt = other.begin(); + for (; it != end() && otherIt != other.end(); ++it, ++otherIt) + { + if (it.key() != otherIt.key()) return false; + + if (!(it.data() == otherIt.data())) return false; + } + + return true; + } + + /** + * @brief Clears the map + * + * Value type and, if applicable, container value type will stay untouched. + */ + void clear() { TQMap<T, TQT_DBusData>::clear(); } + + /** + * @brief Returns an iterator to the first item according to the key sort order + * + * @see TQMap::begin() + */ + const_iterator begin() const + { + return TQMap<T, TQT_DBusData>::begin(); + } + + /** + * @brief Returns an iterator to an invalid position + * + * @see TQMap::end() + */ + const_iterator end() const + { + return TQMap<T, TQT_DBusData>::end(); + } + + /** + * @brief Inserts a given value for a given key + * + * Basically works like the respective TQMap method, but checks if + * type of the new value matches the value type of the list. + * Maps that are invalid will accept any new type and will then be + * typed accordingly. + * + * If @p data is invalid itself, it will not be inserted at any time. + * + * \note the more common use case is to work with a TQMap and then + * use the respective constructor to create the TQT_DBusDataMap object + * + * @param key the key were to insert into the map + * @param data the data item to insert into the map + * + * @return @c true on successfull insert, otherwise @c false + */ + bool insert(const T& key, const TQT_DBusData& data) + { + if (data.type() == TQT_DBusData::Invalid) return false; + + if (m_valueType == TQT_DBusData::Invalid) + { + m_valueType = data.type(); + + // TODO: create empty copy of container + if (hasContainerValueType()) m_containerValueType = data; + + TQMap<T, TQT_DBusData>::insert(key, data); + } + else if (data.type() != m_valueType) + { + qWarning("TQT_DBusDataMap: trying to add data of type %s to map of type %s", + data.typeName(), TQT_DBusData::typeName(m_valueType)); + } + else if (hasContainerValueType()) + { + TQCString ourSignature = m_containerValueType.buildDBusSignature(); + TQCString dataSignature = data.buildDBusSignature(); + + if (ourSignature != dataSignature) + { + qWarning("TQT_DBusDataMap: trying to add data with signature %s " + "to map with value signature %s", + dataSignature.data(), ourSignature.data()); + } + else + TQMap<T, TQT_DBusData>::insert(key, data); + } + else + TQMap<T, TQT_DBusData>::insert(key, data); + + return true; + } + + /** + * @brief Converts the map object into a TQMap with TQT_DBusData elements + * + * @return the key/value pairs of the map object as a TQMap + */ + TQMap<T, TQT_DBusData> toTQMap() const { return *this; } + + /** + * @brief Tries to get the map object's pairs as a TQMap of bool + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Bool. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Bool) + * + * @return a TQMap of bool containing the list object's boolean + * values or an empty map when converting fails + * + * @see TQT_DBusData::toBool() + */ + TQMap<T, bool> toBoolMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Bool) + { + if (ok != 0) *ok = false; + return TQMap<T, bool>(); + } + + TQMap<T, bool> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toBool()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_UINT8 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Byte. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Byte) + * + * @return a TQMap of TQ_UINT8 containing the list object's byte + * values or an empty map when converting fails + * + * @see TQT_DBusData::toBool() + */ + TQMap<T, TQ_UINT8> toByteMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Byte) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_UINT8>(); + } + + TQMap<T, TQ_UINT8> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toByte()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_INT16 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Int16. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Int16) + * + * @return a TQMap of TQ_INT16 containing the map object's + * signed 16-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toInt16() + */ + TQMap<T, TQ_INT16> toInt16Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Int16) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_INT16>(); + } + + TQMap<T, TQ_INT16> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toInt16()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_UINT16 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::UInt16. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::UInt16) + * + * @return a TQMap of TQ_UINT16 containing the map object's + * unsigned 16-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toUInt16() + */ + TQMap<T, TQ_UINT16> toUInt16Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::UInt16) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_UINT16>(); + } + + TQMap<T, TQ_UINT16> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toUInt16()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_INT32 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Int32. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Int32) + * + * @return a TQMap of TQ_INT32 containing the map object's + * signed 32-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toInt32() + */ + TQMap<T, TQ_INT32> toInt32Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Int32) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_INT32>(); + } + + TQMap<T, TQ_INT32> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toInt32()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_UINT32 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::UInt32. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::UInt32) + * + * @return a TQMap of TQ_UINT32 containing the map object's + * unsigned 32-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toUInt32() + */ + TQMap<T, TQ_UINT32> toUInt32Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::UInt32) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_UINT32>(); + } + + TQMap<T, TQ_UINT32> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toUInt32()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_INT64 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Int64. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Int64) + * + * @return a TQMap of TQ_INT64 containing the map object's + * signed 64-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toInt64() + */ + TQMap<T, TQ_INT64> toInt64Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Int64) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_INT64>(); + } + + TQMap<T, TQ_INT64> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toInt64()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQ_UINT64 + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::UInt64. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::UInt64) + * + * @return a TQMap of TQ_UINT64 containing the map object's + * unsigned 64-bit integer values or an empty map when converting + * fails + * + * @see TQT_DBusData::toUInt64() + */ + TQMap<T, TQ_UINT64> toUInt64Map(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::UInt64) + { + if (ok != 0) *ok = false; + return TQMap<T, TQ_UINT64>(); + } + + TQMap<T, TQ_UINT64> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toUInt64()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of double + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Double. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Double) + * + * @return a TQMap of double containing the map object's double + * values or an empty map when converting fails + * + * @see TQT_DBusData::toDouble() + */ + TQMap<T, double> toDoubleMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Double) + { + if (ok != 0) *ok = false; + return TQMap<T, double>(); + } + + TQMap<T, double> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toDouble()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQString + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::String, see also toTQStringList(). + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::String) + * + * @return a TQMap of TQString containing the map object's string + * values or an empty map when converting fails + * + * @see TQT_DBusData::toString() + */ + TQMap<T, TQString> toStringMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::String) + { + if (ok != 0) *ok = false; + return TQMap<T, TQString>(); + } + + TQMap<T, TQString> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toString()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of object paths + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::ObjectPath) + * + * @return a TQMap of object paths containing the map object's object path + * values or an empty map when converting fails + * + * @see TQT_DBusData::toObjectPath() + */ + TQMap<T, TQT_DBusObjectPath> toObjectPathMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::ObjectPath) + { + if (ok != 0) *ok = false; + return TQMap<T, TQT_DBusObjectPath>(); + } + + TQMap<T, TQT_DBusObjectPath> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toObjectPath()); + } + + if (ok != 0) *ok = true; + + return result; + } + + /** + * @brief Tries to get the map object's pairs as a TQMap of TQT_DBusVariant + * + * This is a convenience overload for the case when the map is of + * value type TQT_DBusData::Variant. + * + * @param ok optional pointer to a bool variable to store the + * success information in, i.e. will be set to @c true on success + * and to @c false if the conversion failed (not of value type + * TQT_DBusData::Variant) + * + * @return a TQMap of TQT_DBusVariant containing the map object's + * TQT_DBusVariant values or an empty map when converting fails + * + * @see TQT_DBusData::toVariant() + */ + TQMap<T, TQT_DBusVariant> toVariantMap(bool* ok = 0) const + { + if (m_valueType != TQT_DBusData::Variant) + { + if (ok != 0) *ok = false; + return TQMap<T, TQT_DBusVariant>(); + } + + TQMap<T, TQT_DBusVariant> result; + + const_iterator it = begin(); + const_iterator endIt = end(); + for (; it != endIt; ++it) + { + result.insert(it.key(), (*it).toVariant()); + } + + if (ok != 0) *ok = true; + + return result; + } + +private: + TQT_DBusData::Type m_valueType; + TQT_DBusData m_containerValueType; + + static const TQT_DBusData::Type m_keyType; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbuserror.cpp b/main/dependencies/dbus-tqt/tqdbuserror.cpp new file mode 100644 index 000000000..22f57542c --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbuserror.cpp @@ -0,0 +1,216 @@ +/* qdbuserror.cpp TQT_DBusError object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbuserror.h" + +#include <dbus/dbus.h> + +#include <tqmap.h> + +typedef TQMap<TQString, TQT_DBusError::ErrorType> ErrorNameMap; +static ErrorNameMap errorTypesByName; + +static TQString qDBusErrorNameForType(TQT_DBusError::ErrorType type) +{ + switch (type) + { + case TQT_DBusError::InvalidError: + Q_ASSERT(false); + return TQString(); + + case TQT_DBusError::Failed: + return TQString::fromUtf8(DBUS_ERROR_FAILED); + case TQT_DBusError:: NoMemory: + return TQString::fromUtf8(DBUS_ERROR_NO_MEMORY); + case TQT_DBusError:: ServiceUnknown: + return TQString::fromUtf8(DBUS_ERROR_SERVICE_UNKNOWN); + case TQT_DBusError:: NameHasNoOwner: + return TQString::fromUtf8(DBUS_ERROR_NAME_HAS_NO_OWNER); + case TQT_DBusError:: NoReply: + return TQString::fromUtf8(DBUS_ERROR_NO_REPLY); + case TQT_DBusError:: IOError: + return TQString::fromUtf8(DBUS_ERROR_IO_ERROR); + case TQT_DBusError:: BadAddress: + return TQString::fromUtf8(DBUS_ERROR_BAD_ADDRESS); + case TQT_DBusError:: NotSupported: + return TQString::fromUtf8(DBUS_ERROR_NOT_SUPPORTED); + case TQT_DBusError:: LimitsExceeded: + return TQString::fromUtf8(DBUS_ERROR_LIMITS_EXCEEDED); + case TQT_DBusError:: AccessDenied: + return TQString::fromUtf8(DBUS_ERROR_ACCESS_DENIED); + case TQT_DBusError:: AuthFailed: + return TQString::fromUtf8(DBUS_ERROR_AUTH_FAILED); + case TQT_DBusError:: NoServer: + return TQString::fromUtf8(DBUS_ERROR_NO_SERVER); + case TQT_DBusError:: Timeout: + return TQString::fromUtf8(DBUS_ERROR_TIMEOUT); + case TQT_DBusError:: NoNetwork: + return TQString::fromUtf8(DBUS_ERROR_NO_NETWORK); + case TQT_DBusError:: Disconnected: + return TQString::fromUtf8(DBUS_ERROR_DISCONNECTED); + case TQT_DBusError:: InvalidArgs: + return TQString::fromUtf8(DBUS_ERROR_INVALID_ARGS); + case TQT_DBusError:: FileNotFound: + return TQString::fromUtf8(DBUS_ERROR_FILE_NOT_FOUND); + case TQT_DBusError:: FileExists: + return TQString::fromUtf8(DBUS_ERROR_FILE_EXISTS); + case TQT_DBusError:: UnknownMethod: + return TQString::fromUtf8(DBUS_ERROR_UNKNOWN_METHOD); + case TQT_DBusError:: TimedOut: + return TQString::fromUtf8(DBUS_ERROR_TIMED_OUT); + case TQT_DBusError:: InvalidSignature: + return TQString::fromUtf8(DBUS_ERROR_INVALID_SIGNATURE); + + case TQT_DBusError::UserDefined: + Q_ASSERT(false); + return TQString(); + } + + Q_ASSERT(false); + return TQString(); +} + +static void qDBusErrorSetupNameMapping() +{ + for (int i = TQT_DBusError::InvalidError + 1; i < TQT_DBusError::UserDefined; ++i) + { + TQT_DBusError::ErrorType type = static_cast<TQT_DBusError::ErrorType>(i); + errorTypesByName[qDBusErrorNameForType(type)] = type; + } +} + +static TQT_DBusError::ErrorType qDBusErrorTypeForName(const TQString& name) +{ + if (name.isEmpty()) return TQT_DBusError::InvalidError; + + if (errorTypesByName.isEmpty()) + qDBusErrorSetupNameMapping(); + + ErrorNameMap::const_iterator it = errorTypesByName.tqfind(name); + if (it != errorTypesByName.end()) return it.data(); + + return TQT_DBusError::UserDefined; +} + +TQT_DBusError::TQT_DBusError() : errorType(InvalidError) +{ +} + +TQT_DBusError::TQT_DBusError(const DBusError *error) : errorType(InvalidError) +{ + if (!error || !dbus_error_is_set(error)) + return; + + nm = TQString::fromUtf8(error->name); + msg = TQString::fromUtf8(error->message); + + errorType = qDBusErrorTypeForName(nm); +} + +TQT_DBusError::TQT_DBusError(const TQString& error, const TQString& message) + : errorType(UserDefined), nm(error), msg(message) +{ + errorType = qDBusErrorTypeForName(nm); +} + +bool TQT_DBusError::isValid() const +{ + return errorType != InvalidError && !nm.isEmpty() && !msg.isEmpty(); +} + +TQT_DBusError::TQT_DBusError(ErrorType type, const TQString& message) + : errorType(type), msg(message) +{ + nm = qDBusErrorNameForType(type); +} + +TQT_DBusError TQT_DBusError::stdFailed(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::Failed, message); +} + +TQT_DBusError TQT_DBusError::stdNoMemory(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::NoMemory, message); +} + +TQT_DBusError TQT_DBusError::stdNoReply(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::NoReply, message); +} + +TQT_DBusError TQT_DBusError::stdIOError(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::IOError, message); +} + +TQT_DBusError TQT_DBusError::stdNotSupported(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::NotSupported, message); +} + +TQT_DBusError TQT_DBusError::stdLimitsExceeded(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::LimitsExceeded, message); +} + +TQT_DBusError TQT_DBusError::stdAccessDenied(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::AccessDenied, message); +} + +TQT_DBusError TQT_DBusError::stdAuthFailed(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::AuthFailed, message); +} + +TQT_DBusError TQT_DBusError::stdTimeout(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::Timeout, message); +} + +TQT_DBusError TQT_DBusError::stdInvalidArgs(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::InvalidArgs, message); +} + +TQT_DBusError TQT_DBusError::stdFileNotFound(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::FileNotFound, message); +} + +TQT_DBusError TQT_DBusError::stdFileExists(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::FileExists, message); +} + +TQT_DBusError TQT_DBusError::stdUnknownMethod(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::UnknownMethod, message); +} + +TQT_DBusError TQT_DBusError::stdInvalidSignature(const TQString& message) +{ + return TQT_DBusError(TQT_DBusError::InvalidSignature, message); +} diff --git a/main/dependencies/dbus-tqt/tqdbuserror.h b/main/dependencies/dbus-tqt/tqdbuserror.h new file mode 100644 index 000000000..c33698d54 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbuserror.h @@ -0,0 +1,461 @@ +/* qdbuserror.h TQT_DBusError object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSERROR_H +#define TQDBUSERROR_H + +#include "tqdbusmacros.h" +#include <tqstring.h> + +struct DBusError; + +/** + * @brief Class for transporting D-Bus errors + * + * A D-Bus error has two parts: an error name (see section + * @ref dbusconventions-errorname) and a message string detailing the error in + * human presentable form. + */ +class TQDBUS_EXPORT TQT_DBusError +{ +public: + /** + * @brief Enum of standard D-Bus error types + * + * D-Bus defines a list of common error types and their names. + * The values of this enum map to those an application is likely to encounter + * and likely to create itself. + * + * Standard errors can either be created by specifying the D-Bus error name + * or, as a convenience, by using factory methods of this class for the + * most common ones. + * + * All D-Bus standard error names are within the @c "org.freedesktop.DBus.Error" + * namespace. + * + * @see name() + */ + enum ErrorType + { + /** + * @brief TQT_DBusError specific value, to represent invalid error objects. + * + * @see isValid() + */ + InvalidError, + + /** + * @brief Generic failure cause + * + * Can be used whenever the other predefined errors do no match. Basically + * just meaning "something when wrong, see message() for details" + * + * @see stdFailed() + */ + Failed, + + /** + * @brief An operation could not allocate enough memory + * + * @see stdNoMemory() + */ + NoMemory, + + /** + * @brief An addressed service is neither connected nor can it be activated + */ + ServiceUnknown, + + /** + * @brief A non-unique name used in a message is not known + * + * If a message addresses a D-Bus connection through a non-unique + * (requested) name and the D-Bus does not have a mapping to any of the + * unique names. + */ + NameHasNoOwner, + + /** + * @brief An call failed to send a reply but one was expected + * + * @see stdNoReply() + */ + NoReply, + + /** + * @brief An IO error occured during an operation + * + * Generic indicator that some kind of IO operation failed, e.g. + * reading from a socket. + * + * @see stdIOError() + */ + IOError, + + /** + * @brief Caused by trying to connect to a malformed address + * + * Returned by TQT_DBusConnection's addConnection if the specified address + * isn't a valid D-Bus bus address. + * + * @see TQT_DBusConnection::addConnection(const TQString&,const TQString&); + */ + BadAddress, + + /** + * @brief An otherwise valid operation request could not be handled + * + * Primarily useful when a service implements a specific interface but + * does not (yet) handle all possible situations. + * + * @see stdNotSupported() + */ + NotSupported, + + /** + * @brief Use of a limited resource reached its limit + * + * @see stdLimitsExceeded() + */ + LimitsExceeded, + + /** + * @brief Caused by security restrictions denying an operation + * + * Primarily useful when a client tries to manipulate resources a service + * has associated with a different client and which should not be changable + * by anyone else. + * + * @see stdAccessDenied() + */ + AccessDenied, + + /** + * @brief An authentification mechanism failed + * + * @see stdAuthFailed() + */ + AuthFailed, + + /** + * @brief Connection to a D-Bus server failed + */ + NoServer, + + /** + * @brief An timeout occured during an operation + * + * @warning D-Bus defined to quite similar errors but does not detail + * when either one can occur. See #TimedOut + * + * @see stdTimeout() + */ + Timeout, + + /** + * @brief The network intended as a transport channel is not available + */ + NoNetwork, + + /** + * @brief Caused by trying to use an unconnected D-Bus connection + * + * @see TQT_DBusConnection::isConnected() + */ + Disconnected, + + /** + * @brief Caused by invalid arguments passed to a method call + * + * Primarily usefull for service implementations when the incoming + * call does not transport the expected parameters, e.g. wrong types + * or wrong values. + * + * @see stdInvalidArgs() + */ + InvalidArgs, + + /** + * @brief A file necessary for an operation is not avaiable + * + * @see stdFileNotFound() + */ + FileNotFound, + + /** + * @brief Target file exists but operation does not allow overwriting + * + * @see stdFileExists() + */ + FileExists, + + /** + * @brief A method call addresses and unknown method + * + * @see stdUnknownMethod() + */ + UnknownMethod, + + /** + * @brief An operation timed out + * + * @warning D-Bus defined to quite similar errors but does not detail + * when either one can occur. See #Timeout + */ + TimedOut, + + /** + * @brief An type signature is not valid + * + * A possible cause is a TQT_DBusVariant with an invalid signature, i.e. + * the transported signature is empty, tqcontains unknown type characters + * or has mismatched container enclosings. + * + * @note in case a service implementation wants to indicate that a method + * call did not transport the correct parameter types, use + * #InvalidArgs instead + * + * @see stdInvalidSignature() + */ + InvalidSignature, + + /** + * @brief Generic type for all errors not matching on of the other predefined + * + * @see TQT_DBusError(const TQString&,const TQString&); + */ + UserDefined + }; + + /** + * @brief Creates an empty and invalid error object + */ + TQT_DBusError(); + + /** + * @brief Creates an error object from an C API D-Bus error object + * + * @param error a pointer to the C API D-Bus error + */ + TQT_DBusError(const DBusError *error); + + /** + * @brief Creates an error object for its two given components + * + * @param error a D-Bus error name + * @param message the potentially i18n'ed error description message + * + * @see name() + */ + TQT_DBusError(const TQString& error, const TQString& message); + + /** + * @brief Returns the D-Bus error name + * + * See section @ref dbusconventions-errorname for details. + * + * @return the D-Bus error name + * + * @see message() + */ + inline TQString name() const { return nm; } + + /** + * @brief Returns a string describing the error + * + * The message is meant to further detail or describe the error. + * It is usually a translated error message meant for direct + * presentation to the user. + * + * @return the error's message + * + * @see name() + */ + inline TQString message() const { return msg; } + + /** + * @brief Returns a type for checking of standard errors + * + * D-Bus specifies a couple of standard error names, which are mapped to + * TQT_DBusError types in order to make creating and checking for them easier. + * + * @return the error's type + * + * @see name() + */ + inline ErrorType type() const { return errorType; } + + /** + * @brief Returns whether the error object is valid + * + * A TQT_DBusError is considered valid if both name and message are set. + * + * @return @c true if neither name nor message is @c TQString() and the + * error type is a valid type + */ + bool isValid() const; + + /** + * @brief Creates a D-Bus standard error for generic failure + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #Failed with the given @p message + */ + static TQT_DBusError stdFailed(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for out of memory situations + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #NoMemory with the given @p message + */ + static TQT_DBusError stdNoMemory(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for expected reply missing + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #NoReply with the given @p message + */ + static TQT_DBusError stdNoReply(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for generic IO errors + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #IOError with the given @p message + */ + static TQT_DBusError stdIOError(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for unsupported operations + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #NotSupported with the given @p message + */ + static TQT_DBusError stdNotSupported(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for exceeding a limited resource + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #LimitsExceeded with the given @p message + */ + static TQT_DBusError stdLimitsExceeded(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for access to a resource being denied + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #AccessDenied with the given @p message + */ + static TQT_DBusError stdAccessDenied(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for failed authentification + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #AuthFailed with the given @p message + */ + static TQT_DBusError stdAuthFailed(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for timeouts during operations + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #Timeout with the given @p message + */ + static TQT_DBusError stdTimeout(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for call arguments being invalid + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #InvalidArgs with the given @p message + */ + static TQT_DBusError stdInvalidArgs(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for a file not being available + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #FileNotFound with the given @p message + */ + static TQT_DBusError stdFileNotFound(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for a file being in the way + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #FileExists with the given @p message + */ + static TQT_DBusError stdFileExists(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for an unknown methods being called + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #UnknownMethod with the given @p message + */ + static TQT_DBusError stdUnknownMethod(const TQString& message); + + /** + * @brief Creates a D-Bus standard error for D-Bus type signature not valid + * + * @param message the message detailing the encountered problem + * + * @return an error object of type #InvalidSignature with the given @p message + */ + static TQT_DBusError stdInvalidSignature(const TQString& message); + +private: + ErrorType errorType; + + TQString nm, msg; + + /** + * @brief Creates an error object for one of the standard D-Bus errors + * + * @param type one of the standard error causes + * @param message the potentially i18n'ed error description message + * + * @see ErrorType + */ + TQT_DBusError(ErrorType type, const TQString& message); +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusintegrator.cpp b/main/dependencies/dbus-tqt/tqdbusintegrator.cpp new file mode 100644 index 000000000..c61801f37 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusintegrator.cpp @@ -0,0 +1,626 @@ +/* qdbusintegrator.cpp TQT_DBusConnection private implementation + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include <tqapplication.h> +#include <tqevent.h> +#include <tqmetaobject.h> +#include <tqsocketnotifier.h> +#include <tqtimer.h> + +#include "tqdbusconnection_p.h" +#include "tqdbusmessage.h" + +Atomic::Atomic(int value) : m_value(value) +{ +} + +void Atomic::ref() +{ + m_value++; +} + +bool Atomic::deref() +{ + m_value--; + return m_value > 0; +} + +int TQT_DBusConnectionPrivate::messageMetaType = 0; + +static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data) +{ + Q_ASSERT(timeout); + Q_ASSERT(data); + + // qDebug("addTimeout %d", dbus_timeout_get_interval(timeout)); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + + if (!dbus_timeout_get_enabled(timeout)) + return true; + + if (!tqApp) { + d->pendingTimeouts.append(timeout); + return true; + } + int timerId = d->startTimer(dbus_timeout_get_interval(timeout)); + if (!timerId) + return false; + + d->timeouts[timerId] = timeout; + return true; +} + +static void qDBusRemoveTimeout(DBusTimeout *timeout, void *data) +{ + Q_ASSERT(timeout); + Q_ASSERT(data); + + // qDebug("removeTimeout"); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + for (TQValueList<DBusTimeout*>::iterator it = d->pendingTimeouts.begin(); + it != d->pendingTimeouts.end();) { + if ((*it) == timeout) { + it = d->pendingTimeouts.erase(it); + } + else + ++it; + } + + TQT_DBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin(); + while (it != d->timeouts.end()) { + if (it.data() == timeout) { + d->killTimer(it.key()); + TQT_DBusConnectionPrivate::TimeoutHash::iterator copyIt = it; + ++it; + d->timeouts.erase(copyIt); + } else { + ++it; + } + } +} + +static void qDBusToggleTimeout(DBusTimeout *timeout, void *data) +{ + Q_ASSERT(timeout); + Q_ASSERT(data); + + //qDebug("ToggleTimeout"); + + qDBusRemoveTimeout(timeout, data); + qDBusAddTimeout(timeout, data); +} + +static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data) +{ + Q_ASSERT(watch); + Q_ASSERT(data); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + + int flags = dbus_watch_get_flags(watch); + int fd = dbus_watch_get_unix_fd(watch); + + TQT_DBusConnectionPrivate::Watcher watcher; + if (flags & DBUS_WATCH_READABLE) { + bool enabled = dbus_watch_get_enabled(watch); + //qDebug("addReadWatch %d %s", fd, (enabled ? "enabled" : "disabled")); + watcher.watch = watch; + if (tqApp) { + watcher.read = new TQSocketNotifier(fd, TQSocketNotifier::Read, d); + if (!enabled) watcher.read->setEnabled(false); + d->connect(watcher.read, TQT_SIGNAL(activated(int)), TQT_SLOT(socketRead(int))); + } + } + if (flags & DBUS_WATCH_WRITABLE) { + bool enabled = dbus_watch_get_enabled(watch); + //qDebug("addWriteWatch %d %s", fd, (enabled ? "enabled" : "disabled")); + watcher.watch = watch; + if (tqApp) { + watcher.write = new TQSocketNotifier(fd, TQSocketNotifier::Write, d); + if (!enabled) watcher.write->setEnabled(false); + d->connect(watcher.write, TQT_SIGNAL(activated(int)), TQT_SLOT(socketWrite(int))); + } + } + // FIXME-QT4 d->watchers.insertMulti(fd, watcher); + TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd); + if (it == d->watchers.end()) + { + it = d->watchers.insert(fd, TQT_DBusConnectionPrivate::WatcherList()); + } + it.data().append(watcher); + + return true; +} + +static void qDBusRemoveWatch(DBusWatch *watch, void *data) +{ + Q_ASSERT(watch); + Q_ASSERT(data); + + //qDebug("remove watch"); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + int fd = dbus_watch_get_unix_fd(watch); + + TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd); + if (it != d->watchers.end()) + { + TQT_DBusConnectionPrivate::WatcherList& list = *it; + for (TQT_DBusConnectionPrivate::WatcherList::iterator wit = list.begin(); + wit != list.end(); ++wit) + { + if ((*wit).watch == watch) + { + // migth be called from a function triggered by a socket listener + // so just disconnect them and schedule their delayed deletion. + + d->removedWatches.append(*wit); + if ((*wit).read) + { + (*wit).read->disconnect(d); + (*wit).read = 0; + } + if ((*wit).write) + { + (*wit).write->disconnect(d); + (*wit).write = 0; + } + (*wit).watch = 0; + } + } + } + + if (d->removedWatches.count() > 0) + TQTimer::singleShot(0, d, TQT_SLOT(purgeRemovedWatches())); +} + +static void qDBusToggleWatch(DBusWatch *watch, void *data) +{ + Q_ASSERT(watch); + Q_ASSERT(data); + + //qDebug("toggle watch"); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + int fd = dbus_watch_get_unix_fd(watch); + + TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd); + if (it != d->watchers.end()) { + TQT_DBusConnectionPrivate::WatcherList& list = *it; + for (TQT_DBusConnectionPrivate::WatcherList::iterator wit = list.begin(); wit != list.end(); + ++wit) + { + if ((*wit).watch == watch) { + bool enabled = dbus_watch_get_enabled(watch); + int flags = dbus_watch_get_flags(watch); + +// qDebug("toggle watch %d to %d (write: %d, read: %d)", +// dbus_watch_get_unix_fd(watch), enabled, +// flags & DBUS_WATCH_WRITABLE, flags & DBUS_WATCH_READABLE); + + if (flags & DBUS_WATCH_READABLE && (*wit).read) + (*wit).read->setEnabled(enabled); + if (flags & DBUS_WATCH_WRITABLE && (*wit).write) + (*wit).write->setEnabled(enabled); + return; + } + } + } +} + +static void qDBusNewConnection(DBusServer *server, DBusConnection *c, void *data) +{ + Q_ASSERT(data); Q_ASSERT(server); Q_ASSERT(c); + + qDebug("SERVER: GOT A NEW CONNECTION"); // TODO +} + +static DBusHandlerResult qDBusSignalFilter(DBusConnection *connection, + DBusMessage *message, void *data) +{ + Q_ASSERT(data); + Q_UNUSED(connection); + + TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data); + if (d->mode == TQT_DBusConnectionPrivate::InvalidMode) + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + + int msgType = dbus_message_get_type(message); + bool handled = false; + + //TQT_DBusMessage amsg = TQT_DBusMessage::fromDBusMessage(message); + //qDebug() << "got message: " << dbus_message_get_type(message) << amsg; + + if (msgType == DBUS_MESSAGE_TYPE_SIGNAL) { + handled = d->handleSignal(message); + } else if (msgType == DBUS_MESSAGE_TYPE_METHOD_CALL) { + handled = d->handleObjectCall(message); + } + + return handled ? DBUS_HANDLER_RESULT_HANDLED : + DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + +int TQT_DBusConnectionPrivate::registerMessageMetaType() +{ + // FIXME-QT4 int tp = messageMetaType = qRegisterMetaType<TQT_DBusMessage>("TQT_DBusMessage"); + int tp = 0; + return tp; +} + +TQT_DBusConnectionPrivate::TQT_DBusConnectionPrivate(TQObject *tqparent) + : TQObject(tqparent), ref(1), mode(InvalidMode), connection(0), server(0), + dispatcher(0) +{ + static const int msgType = registerMessageMetaType(); + Q_UNUSED(msgType); + + dbus_error_init(&error); + + dispatcher = new TQTimer(this); + TQObject::connect(dispatcher, TQT_SIGNAL(timeout()), this, TQT_SLOT(dispatch())); +} + +TQT_DBusConnectionPrivate::~TQT_DBusConnectionPrivate() +{ + if (dbus_error_is_set(&error)) + dbus_error_free(&error); + + closeConnection(); +} + +void TQT_DBusConnectionPrivate::closeConnection() +{ + ConnectionMode oldMode = mode; + mode = InvalidMode; // prevent reentrancy + if (oldMode == ServerMode) { + if (server) { + dbus_server_disconnect(server); + dbus_server_unref(server); + server = 0; + } + } else if (oldMode == ClientMode) { + if (connection) { + // closing shared connections is forbidden +#if 0 + dbus_connection_close(connection); + // send the "close" message + while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS); +#endif + dbus_connection_unref(connection); + connection = 0; + } + } +} + +bool TQT_DBusConnectionPrivate::handleError() +{ + lastError = TQT_DBusError(&error); + if (dbus_error_is_set(&error)) + dbus_error_free(&error); + return lastError.isValid(); +} + +void TQT_DBusConnectionPrivate::emitPendingCallReply(const TQT_DBusMessage& message) +{ + emit dbusPendingCallReply(message); +} + +void TQT_DBusConnectionPrivate::bindToApplication() +{ + // Yay, now that we have an application we are in business + // Re-add all watchers + WatcherHash oldWatchers = watchers; + watchers.clear(); + // FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(oldWatchers); + for (WatcherHash::const_iterator it = oldWatchers.begin(); it != oldWatchers.end(); ++it) + { + const WatcherList& list = *it; + for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit) + { + if (!(*wit).read && !(*wit).write) { + qDBusAddWatch((*wit).watch, this); + } + } + } + + // Re-add all timeouts + while (!pendingTimeouts.isEmpty()) { + qDBusAddTimeout(pendingTimeouts.first(), this); + pendingTimeouts.pop_front(); + } +} + +void TQT_DBusConnectionPrivate::socketRead(int fd) +{ + // FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(watchers); + WatcherHash::const_iterator it = watchers.tqfind(fd); + if (it != watchers.end()) { + const WatcherList& list = *it; + for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit) { + if ((*wit).read && (*wit).read->isEnabled()) { + if (!dbus_watch_handle((*wit).watch, DBUS_WATCH_READABLE)) + qDebug("OUT OF MEM"); + } + } + } + if (mode == ClientMode) + scheduleDispatch(); +} + +void TQT_DBusConnectionPrivate::socketWrite(int fd) +{ + // FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(watchers); + WatcherHash::const_iterator it = watchers.tqfind(fd); + if (it != watchers.end()) { + const WatcherList& list = *it; + for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit) { + if ((*wit).write && (*wit).write->isEnabled()) { + if (!dbus_watch_handle((*wit).watch, DBUS_WATCH_WRITABLE)) + qDebug("OUT OF MEM"); + } + } + } +} + +void TQT_DBusConnectionPrivate::objectDestroyed(TQObject* object) +{ + //qDebug("Object destroyed"); + for (PendingCallMap::iterator it = pendingCalls.begin(); it != pendingCalls.end();) + { + TQObject* receiver = (TQObject*) it.data()->receiver; + if (receiver == object || receiver == 0) + { + PendingCallMap::iterator copyIt = it; + ++it; + + dbus_pending_call_cancel(copyIt.key()); + dbus_pending_call_unref(copyIt.key()); + delete copyIt.data(); + pendingCalls.erase(copyIt); + } + else + ++it; + } +} + +void TQT_DBusConnectionPrivate::purgeRemovedWatches() +{ + if (removedWatches.isEmpty()) return; + + WatcherList::iterator listIt = removedWatches.begin(); + for (; listIt != removedWatches.end(); ++listIt) + { + delete (*listIt).read; + delete (*listIt).write; + } + removedWatches.clear(); + + uint count = 0; + WatcherHash::iterator it = watchers.begin(); + while (it != watchers.end()) + { + WatcherList& list = *it; + listIt = list.begin(); + while (listIt != list.end()) + { + if (!((*listIt).read) && !((*listIt).write)) + { + listIt = list.erase(listIt); + ++count; + } + } + + if (list.isEmpty()) + { + WatcherHash::iterator copyIt = it; + ++it; + watchers.erase(copyIt); + } + else + ++it; + } +} + +void TQT_DBusConnectionPrivate::scheduleDispatch() +{ + dispatcher->start(0); +} + +void TQT_DBusConnectionPrivate::dispatch() +{ + if (mode == ClientMode) + { + if (dbus_connection_dispatch(connection) != DBUS_DISPATCH_DATA_REMAINS) + { + // stop dispatch timer + dispatcher->stop(); + } + } +} + +bool TQT_DBusConnectionPrivate::handleObjectCall(DBusMessage *message) +{ + TQT_DBusMessage msg = TQT_DBusMessage::fromDBusMessage(message); + + ObjectMap::iterator it = registeredObjects.tqfind(msg.path()); + if (it == registeredObjects.end()) + return false; + + return it.data()->handleMethodCall(msg); +} + +bool TQT_DBusConnectionPrivate::handleSignal(DBusMessage *message) +{ + TQT_DBusMessage msg = TQT_DBusMessage::fromDBusMessage(message); + + // yes, it is a single "|" below... + // FIXME-QT4 + //return handleSignal(TQString(), msg) | handleSignal(msg.path(), msg); + + dbusSignal(msg); + return true; +} + +static dbus_int32_t server_slot = -1; + +void TQT_DBusConnectionPrivate::setServer(DBusServer *s) +{ + if (!server) { + handleError(); + return; + } + + server = s; + mode = ServerMode; + + dbus_server_allocate_data_slot(&server_slot); + if (server_slot < 0) + return; + + dbus_server_set_watch_functions(server, qDBusAddWatch, qDBusRemoveWatch, + qDBusToggleWatch, this, 0); // ### check return type? + dbus_server_set_timeout_functions(server, qDBusAddTimeout, qDBusRemoveTimeout, + qDBusToggleTimeout, this, 0); + dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0); + + dbus_server_set_data(server, server_slot, this, 0); +} + +void TQT_DBusConnectionPrivate::setConnection(DBusConnection *dbc) +{ + if (!dbc) { + handleError(); + return; + } + + connection = dbc; + mode = ClientMode; + + dbus_connection_set_exit_on_disconnect(connection, false); + dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, + qDBusToggleWatch, this, 0); + dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, + qDBusToggleTimeout, this, 0); +// dbus_bus_add_match(connection, "type='signal',interface='com.trolltech.dbus.Signal'", &error); +// dbus_bus_add_match(connection, "type='signal'", &error); + + dbus_bus_add_match(connection, "type='signal'", &error); + if (handleError()) { + closeConnection(); + return; + } + + const char *service = dbus_bus_get_unique_name(connection); + if (service) { + TQCString filter; + filter += "destination='"; + filter += service; + filter += "\'"; + + dbus_bus_add_match(connection, filter.data(), &error); + if (handleError()) { + closeConnection(); + return; + } + } else { + qWarning("TQT_DBusConnectionPrivate::SetConnection: Unable to get unique name"); + } + + dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); + + //qDebug("unique name: %s", service); +} + +static void qDBusResultReceived(DBusPendingCall *pending, void *user_data) +{ + //qDebug("Pending Call Result received"); + TQT_DBusConnectionPrivate* d = reinterpret_cast<TQT_DBusConnectionPrivate*>(user_data); + TQT_DBusConnectionPrivate::PendingCallMap::iterator it = d->pendingCalls.tqfind(pending); + + DBusMessage *dbusReply = dbus_pending_call_steal_reply(pending); + + dbus_set_error_from_message(&d->error, dbusReply); + d->handleError(); + + if (it != d->pendingCalls.end()) + { + TQT_DBusMessage reply = TQT_DBusMessage::fromDBusMessage(dbusReply); + + TQObject::connect(d, TQT_SIGNAL(dbusPendingCallReply(const TQT_DBusMessage&)), + it.data()->receiver, it.data()->method.data()); + + d->emitPendingCallReply(reply); + + TQObject::disconnect(d, TQT_SIGNAL(dbusPendingCallReply(const TQT_DBusMessage&)), + it.data()->receiver, it.data()->method.data()); + } + + dbus_message_unref(dbusReply); + dbus_pending_call_unref(pending); + delete it.data(); + + d->pendingCalls.erase(it); +} + +int TQT_DBusConnectionPrivate::sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver, + const char *method) +{ + if (!receiver || !method) + return 0; + + if (!TQObject::connect(receiver, TQT_SIGNAL(destroyed(TQObject*)), + this, TQT_SLOT(objectDestroyed(TQObject*)))) + return false; + + DBusMessage *msg = message.toDBusMessage(); + if (!msg) + return 0; + + DBusPendingCall *pending = 0; + if (dbus_connection_send_with_reply(connection, msg, &pending, message.timeout())) { + TQT_DBusPendingCall *pcall = new TQT_DBusPendingCall; + pcall->receiver = receiver; + pcall->method = method; + pcall->pending = dbus_pending_call_ref(pending); + pendingCalls.insert(pcall->pending, pcall); + + dbus_pending_call_set_notify(pending, qDBusResultReceived, this, 0); + + return dbus_message_get_serial(msg); + } + + return 0; +} + +void TQT_DBusConnectionPrivate::flush() +{ + if (!connection) return; + + dbus_connection_flush(connection); +} + +#include "tqdbusconnection_p.moc" diff --git a/main/dependencies/dbus-tqt/tqdbusmacros.h b/main/dependencies/dbus-tqt/tqdbusmacros.h new file mode 100644 index 000000000..2470094df --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmacros.h @@ -0,0 +1,31 @@ +/* qdbusmacros TQDBUS macro definitions + * + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSMACROS_H +#define TQDBUSMACROS_H + +#include <tqglobal.h> + +#define TQDBUS_EXPORT TQ_EXPORT + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusmarshall.cpp b/main/dependencies/dbus-tqt/tqdbusmarshall.cpp new file mode 100644 index 000000000..cf5618b07 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmarshall.cpp @@ -0,0 +1,1118 @@ +/* qdbusmarshall.cpp + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusmarshall.h" +#include "tqdbusdata.h" +#include "tqdbusdatalist.h" +#include "tqdbusdatamap.h" +#include "tqdbusobjectpath.h" +#include "tqdbusvariant.h" + +#include <tqvariant.h> +#include <tqvaluelist.h> +#include <tqmap.h> +#include <tqstringlist.h> +#include <tqvaluevector.h> + +#include <dbus/dbus.h> + +template <typename T> +inline T qIterGet(DBusMessageIter *it) +{ + T t; + dbus_message_iter_get_basic(it, &t); + return t; +} + +static TQT_DBusData::Type qSingleTypeForDBusSignature(char signature) +{ + switch (signature) + { + case 'b': return TQT_DBusData::Bool; + case 'y': return TQT_DBusData::Byte; + case 'n': return TQT_DBusData::Int16; + case 'q': return TQT_DBusData::UInt16; + case 'i': return TQT_DBusData::Int32; + case 'u': return TQT_DBusData::UInt32; + case 'x': return TQT_DBusData::Int64; + case 't': return TQT_DBusData::UInt64; + case 'd': return TQT_DBusData::Double; + case 's': return TQT_DBusData::String; + case 'o': return TQT_DBusData::ObjectPath; + case 'g': return TQT_DBusData::String; + case 'v': return TQT_DBusData::Variant; + + default: + break; + } + + return TQT_DBusData::Invalid; +} + +static TQValueList<TQT_DBusData> parseSignature(TQCString& signature) +{ +// qDebug("parseSignature(%s)", signature.data()); + TQValueList<TQT_DBusData> result; + + while (!signature.isEmpty()) + { + switch (signature[0]) + { + case '(': { + signature = signature.mid(1); + TQValueList<TQT_DBusData> memberList = parseSignature(signature); + result << TQT_DBusData::fromStruct(memberList); + Q_ASSERT(!signature.isEmpty() && signature[0] == ')'); + signature = signature.mid(1); + break; + } + case ')': return result; + case '{': { + TQT_DBusData::Type keyType = + qSingleTypeForDBusSignature(signature[1]); + TQT_DBusData::Type valueType = + qSingleTypeForDBusSignature(signature[2]); + if (valueType != TQT_DBusData::Invalid) + { + switch (keyType) + { + case TQT_DBusData::Byte: + result << TQT_DBusData::fromByteKeyMap( + TQT_DBusDataMap<TQ_UINT8>(valueType)); + break; + case TQT_DBusData::Int16: + result << TQT_DBusData::fromInt16KeyMap( + TQT_DBusDataMap<TQ_INT16>(valueType)); + break; + case TQT_DBusData::UInt16: + result << TQT_DBusData::fromUInt16KeyMap( + TQT_DBusDataMap<TQ_UINT16>(valueType)); + break; + case TQT_DBusData::Int32: + result << TQT_DBusData::fromInt32KeyMap( + TQT_DBusDataMap<TQ_INT32>(valueType)); + break; + case TQT_DBusData::UInt32: + result << TQT_DBusData::fromUInt32KeyMap( + TQT_DBusDataMap<TQ_UINT32>(valueType)); + break; + case TQT_DBusData::Int64: + result << TQT_DBusData::fromInt64KeyMap( + TQT_DBusDataMap<TQ_INT64>(valueType)); + break; + case TQT_DBusData::UInt64: + result << TQT_DBusData::fromUInt64KeyMap( + TQT_DBusDataMap<TQ_UINT64>(valueType)); + break; + case TQT_DBusData::String: + result << TQT_DBusData::fromStringKeyMap( + TQT_DBusDataMap<TQString>(valueType)); + break; + case TQT_DBusData::ObjectPath: + result << TQT_DBusData::fromObjectPathKeyMap( + TQT_DBusDataMap<TQT_DBusObjectPath>(valueType)); + break; + default: + qWarning("TQT_DBusMarshall: unsupported map key type %s " + "at de-marshalling", + TQT_DBusData::typeName(keyType)); + break; + } + signature = signature.mid(3); + } + else + { + signature = signature.mid(2); + TQValueList<TQT_DBusData> valueContainer = + parseSignature(signature); + Q_ASSERT(valueContainer.count() == 1); + + switch (keyType) + { + case TQT_DBusData::Byte: + result << TQT_DBusData::fromByteKeyMap( + TQT_DBusDataMap<TQ_UINT8>(valueContainer[0])); + break; + case TQT_DBusData::Int16: + result << TQT_DBusData::fromInt16KeyMap( + TQT_DBusDataMap<TQ_INT16>(valueContainer[0])); + break; + case TQT_DBusData::UInt16: + result << TQT_DBusData::fromUInt16KeyMap( + TQT_DBusDataMap<TQ_UINT16>(valueContainer[0])); + break; + case TQT_DBusData::Int32: + result << TQT_DBusData::fromInt32KeyMap( + TQT_DBusDataMap<TQ_INT32>(valueContainer[0])); + break; + case TQT_DBusData::UInt32: + result << TQT_DBusData::fromUInt32KeyMap( + TQT_DBusDataMap<TQ_UINT32>(valueContainer[0])); + break; + case TQT_DBusData::Int64: + result << TQT_DBusData::fromInt64KeyMap( + TQT_DBusDataMap<TQ_INT64>(valueContainer[0])); + break; + case TQT_DBusData::UInt64: + result << TQT_DBusData::fromUInt64KeyMap( + TQT_DBusDataMap<TQ_UINT64>(valueContainer[0])); + break; + case TQT_DBusData::String: + result << TQT_DBusData::fromStringKeyMap( + TQT_DBusDataMap<TQString>(valueContainer[0])); + break; + case TQT_DBusData::ObjectPath: + result << TQT_DBusData::fromObjectPathKeyMap( + TQT_DBusDataMap<TQT_DBusObjectPath>(valueContainer[0])); + break; + default: + qWarning("TQT_DBusMarshall: unsupported map key type %s " + "at de-marshalling", + TQT_DBusData::typeName(keyType)); + break; + } + } + Q_ASSERT(!signature.isEmpty() && signature[0] == '}'); + signature = signature.mid(1); + break; + } + case '}': return result; + case 'a': { + TQT_DBusData::Type elementType = + qSingleTypeForDBusSignature(signature[1]); + if (elementType != TQT_DBusData::Invalid) + { + TQT_DBusDataList list(elementType); + result << TQT_DBusData::fromList(list); + signature = signature.mid(2); + } + else + { + signature = signature.mid(1); + bool array = signature[0] != '{'; + + TQValueList<TQT_DBusData> elementContainer = + parseSignature(signature); + Q_ASSERT(elementContainer.count() == 1); + + if (array) + { + TQT_DBusDataList list(elementContainer[0]); + result << TQT_DBusData::fromList(list); + } + else + result << elementContainer[0]; + } + break; + } + default: + result << TQT_DBusData(); + signature = signature.mid(1); + break; + } + } + + return result; +} + +static TQT_DBusData qFetchParameter(DBusMessageIter *it); + +void qFetchByteKeyMapEntry(TQT_DBusDataMap<TQ_UINT8>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_UINT8 key = qFetchParameter(&itemIter).toByte(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchInt16KeyMapEntry(TQT_DBusDataMap<TQ_INT16>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_INT16 key = qFetchParameter(&itemIter).toInt16(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchUInt16KeyMapEntry(TQT_DBusDataMap<TQ_UINT16>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_UINT16 key = qFetchParameter(&itemIter).toUInt16(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchInt32KeyMapEntry(TQT_DBusDataMap<TQ_INT32>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_INT32 key = qFetchParameter(&itemIter).toInt32(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchUInt32KeyMapEntry(TQT_DBusDataMap<TQ_UINT32>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_UINT32 key = qFetchParameter(&itemIter).toUInt32(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchInt64KeyMapEntry(TQT_DBusDataMap<TQ_INT64>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_INT64 key = qFetchParameter(&itemIter).toInt64(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchUInt64KeyMapEntry(TQT_DBusDataMap<TQ_UINT64>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQ_UINT64 key = qFetchParameter(&itemIter).toUInt64(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +void qFetchStringKeyMapEntry(TQT_DBusDataMap<TQString>& map, DBusMessageIter* it) +{ + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + Q_ASSERT(dbus_message_iter_has_next(&itemIter)); + + TQString key = qFetchParameter(&itemIter).toString(); + + dbus_message_iter_next(&itemIter); + + map.insert(key, qFetchParameter(&itemIter)); +} + +static TQT_DBusData qFetchMap(DBusMessageIter *it, const TQT_DBusData& prototype) +{ + if (dbus_message_iter_get_arg_type(it) == DBUS_TYPE_INVALID) + return prototype; + + DBusMessageIter itemIter; + dbus_message_iter_recurse(it, &itemIter); + if (dbus_message_iter_get_arg_type(&itemIter) == DBUS_TYPE_INVALID) + return prototype; + + switch (dbus_message_iter_get_arg_type(&itemIter)) { + case DBUS_TYPE_BYTE: { + TQT_DBusDataMap<TQ_UINT8> map = prototype.toByteKeyMap(); + do { + qFetchByteKeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromByteKeyMap(map); + } + + case DBUS_TYPE_INT16: { + TQT_DBusDataMap<TQ_INT16> map = prototype.toInt16KeyMap(); + do { + qFetchInt16KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromInt16KeyMap(map); + } + + case DBUS_TYPE_UINT16: { + TQT_DBusDataMap<TQ_UINT16> map = prototype.toUInt16KeyMap(); + do { + qFetchUInt16KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromUInt16KeyMap(map); + } + + case DBUS_TYPE_INT32: { + TQT_DBusDataMap<TQ_INT32> map = prototype.toInt32KeyMap(); + do { + qFetchInt32KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromInt32KeyMap(map); + } + + case DBUS_TYPE_UINT32: { + TQT_DBusDataMap<TQ_UINT32> map = prototype.toUInt32KeyMap(); + do { + qFetchUInt32KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromUInt32KeyMap(map); + } + + case DBUS_TYPE_INT64: { + TQT_DBusDataMap<TQ_INT64> map = prototype.toInt64KeyMap(); + do { + qFetchInt64KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromInt64KeyMap(map); + } + + case DBUS_TYPE_UINT64: { + TQT_DBusDataMap<TQ_UINT64> map = prototype.toUInt64KeyMap(); + do { + qFetchUInt64KeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromUInt64KeyMap(map); + } + + case DBUS_TYPE_STRING: // fall through + case DBUS_TYPE_OBJECT_PATH: // fall through + case DBUS_TYPE_SIGNATURE: { + TQT_DBusDataMap<TQString> map = prototype.toStringKeyMap(); + do { + qFetchStringKeyMapEntry(map, it); + } while (dbus_message_iter_next(it)); + + return TQT_DBusData::fromStringKeyMap(map); + } + + default: + break; + } + + return prototype; +} + +static TQT_DBusData qFetchParameter(DBusMessageIter *it) +{ + switch (dbus_message_iter_get_arg_type(it)) { + case DBUS_TYPE_BOOLEAN: + return TQT_DBusData::fromBool(qIterGet<dbus_bool_t>(it)); + case DBUS_TYPE_BYTE: + return TQT_DBusData::fromByte(qIterGet<unsigned char>(it)); + case DBUS_TYPE_INT16: + return TQT_DBusData::fromInt16(qIterGet<dbus_int16_t>(it)); + case DBUS_TYPE_UINT16: + return TQT_DBusData::fromUInt16(qIterGet<dbus_uint16_t>(it)); + case DBUS_TYPE_INT32: + return TQT_DBusData::fromInt32(qIterGet<dbus_int32_t>(it)); + case DBUS_TYPE_UINT32: + return TQT_DBusData::fromUInt32(qIterGet<dbus_uint32_t>(it)); + case DBUS_TYPE_INT64: + return TQT_DBusData::fromInt64(qIterGet<dbus_int64_t>(it)); + case DBUS_TYPE_UINT64: + return TQT_DBusData::fromUInt64(qIterGet<dbus_uint64_t>(it)); + case DBUS_TYPE_DOUBLE: + return TQT_DBusData::fromDouble(qIterGet<double>(it)); + case DBUS_TYPE_STRING: + case DBUS_TYPE_SIGNATURE: + return TQT_DBusData::fromString(TQString::fromUtf8(qIterGet<char *>(it))); + case DBUS_TYPE_OBJECT_PATH: + return TQT_DBusData::fromObjectPath(TQT_DBusObjectPath(qIterGet<char *>(it))); + case DBUS_TYPE_ARRAY: { + int arrayType = dbus_message_iter_get_element_type(it); + + char* sig = dbus_message_iter_get_signature(it); + TQCString signature = sig; + dbus_free(sig); + + TQValueList<TQT_DBusData> prototypeList = parseSignature(signature); + + if (arrayType == DBUS_TYPE_DICT_ENTRY) { + DBusMessageIter sub; + dbus_message_iter_recurse(it, &sub); + + return qFetchMap(&sub, prototypeList[0]); + +// } else if (arrayType == DBUS_TYPE_BYTE) { +// DBusMessageIter sub; +// dbus_message_iter_recurse(it, &sub); +// int len = dbus_message_iter_get_array_len(&sub); +// char* data; +// dbus_message_iter_get_fixed_array(&sub,&data,&len); +// return TQCString(data,len); +// } else { + + } else { + TQT_DBusDataList list = prototypeList[0].toList(); + + DBusMessageIter arrayIt; + dbus_message_iter_recurse(it, &arrayIt); + + while (dbus_message_iter_get_arg_type(&arrayIt) != DBUS_TYPE_INVALID) { + list << qFetchParameter(&arrayIt); + + dbus_message_iter_next(&arrayIt); + } + + return TQT_DBusData::fromList(list); + } + } + case DBUS_TYPE_VARIANT: { + TQT_DBusVariant dvariant; + DBusMessageIter sub; + dbus_message_iter_recurse(it, &sub); + + char* signature = dbus_message_iter_get_signature(&sub); + dvariant.signature = TQString::fromUtf8(signature); + dbus_free(signature); + + dvariant.value = qFetchParameter(&sub); + + return TQT_DBusData::fromVariant(dvariant); + } + case DBUS_TYPE_STRUCT: { + TQValueList<TQT_DBusData> memberList; + + DBusMessageIter subIt; + dbus_message_iter_recurse(it, &subIt); + + uint index = 0; + while (dbus_message_iter_get_arg_type(&subIt) != DBUS_TYPE_INVALID) { + memberList << qFetchParameter(&subIt); + + dbus_message_iter_next(&subIt); + ++index; + } + + return TQT_DBusData::fromStruct(memberList); + } +#if 0 + case DBUS_TYPE_INVALID: + // TODO: check if there is better way to detect empty arrays + return TQT_DBusData(); + break; +#endif + default: + qWarning("TQT_DBusMarshall: Don't know how to de-marshall type %d '%c'", + dbus_message_iter_get_arg_type(it), + dbus_message_iter_get_arg_type(it)); + return TQT_DBusData(); + break; + } +} + +void TQT_DBusMarshall::messageToList(TQValueList<TQT_DBusData>& list, DBusMessage* message) +{ + Q_ASSERT(message); + + DBusMessageIter it; + if (!dbus_message_iter_init(message, &it)) return; + + do + { + list << qFetchParameter(&it); + } + while (dbus_message_iter_next(&it)); +} + +static void tqAppendToMessage(DBusMessageIter *it, const TQString &str) +{ + TQByteArray ba = str.utf8(); + const char *cdata = ba.data(); + dbus_message_iter_append_basic(it, DBUS_TYPE_STRING, &cdata); +} + +static void tqAppendToMessage(DBusMessageIter *it, const TQT_DBusObjectPath &path) +{ + const char *cdata = path.data(); + dbus_message_iter_append_basic(it, DBUS_TYPE_OBJECT_PATH, &cdata); +} + +static const char* qDBusTypeForTQT_DBusType(TQT_DBusData::Type type) +{ + switch (type) + { + case TQT_DBusData::Invalid: + return 0; + + case TQT_DBusData::Bool: + return DBUS_TYPE_BOOLEAN_AS_STRING; + + case TQT_DBusData::Byte: + return DBUS_TYPE_BYTE_AS_STRING; + + case TQT_DBusData::Int16: + return DBUS_TYPE_INT16_AS_STRING; + + case TQT_DBusData::UInt16: + return DBUS_TYPE_UINT16_AS_STRING; + + case TQT_DBusData::Int32: + return DBUS_TYPE_INT32_AS_STRING; + + case TQT_DBusData::UInt32: + return DBUS_TYPE_UINT32_AS_STRING; + + case TQT_DBusData::Int64: + return DBUS_TYPE_INT64_AS_STRING; + + case TQT_DBusData::UInt64: + return DBUS_TYPE_UINT64_AS_STRING; + + case TQT_DBusData::Double: + return DBUS_TYPE_DOUBLE_AS_STRING; + + case TQT_DBusData::String: + return DBUS_TYPE_STRING_AS_STRING; + + case TQT_DBusData::ObjectPath: + return DBUS_TYPE_OBJECT_PATH_AS_STRING; + + case TQT_DBusData::List: + return DBUS_TYPE_ARRAY_AS_STRING; + + case TQT_DBusData::Struct: + return DBUS_TYPE_STRUCT_AS_STRING; + + case TQT_DBusData::Variant: + return DBUS_TYPE_VARIANT_AS_STRING; + + case TQT_DBusData::Map: + return DBUS_TYPE_DICT_ENTRY_AS_STRING; + } + return 0; +} + +static void qDBusDataToIterator(DBusMessageIter* it, const TQT_DBusData& var); + +static void qDBusByteKeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_UINT8> map = var.toByteKeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_UINT8>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_BYTE, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusInt16KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_INT16> map = var.toInt16KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_INT16>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_INT16, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusUInt16KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_UINT16> map = var.toUInt16KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_UINT16>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT16, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusInt32KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_INT32> map = var.toInt32KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_INT32>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_INT32, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusUInt32KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_UINT32> map = var.toUInt32KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_UINT32>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT32, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusInt64KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_INT64> map = var.toInt64KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_INT64>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_INT64, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusUInt64KeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQ_UINT64> map = var.toUInt64KeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQ_UINT64>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT64, &(mit.key())); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusStringKeyMapToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQString> map = var.toStringKeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQString>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + tqAppendToMessage(&itemIterator, mit.key()); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusObjectPathKeyMapToIterator(DBusMessageIter* it, + const TQT_DBusData& var) +{ + DBusMessageIter sub; + TQCString sig; + + TQT_DBusDataMap<TQT_DBusObjectPath> map = var.toObjectPathKeyMap(); + + sig += DBUS_DICT_ENTRY_BEGIN_CHAR; + sig += qDBusTypeForTQT_DBusType(map.keyType()); + + if (map.hasContainerValueType()) + sig += map.containerValueType().buildDBusSignature(); + else + sig += qDBusTypeForTQT_DBusType(map.valueType()); + sig += DBUS_DICT_ENTRY_END_CHAR; + + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub); + + TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator mit = map.begin(); + for (; mit != map.end(); ++mit) + { + DBusMessageIter itemIterator; + dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, + 0, &itemIterator); + + tqAppendToMessage(&itemIterator, mit.key()); + qDBusDataToIterator(&itemIterator, mit.data()); + + dbus_message_iter_close_container(&sub, &itemIterator); + } + + dbus_message_iter_close_container(it, &sub); +} + +static void qDBusDataToIterator(DBusMessageIter* it, const TQT_DBusData& var) +{ + switch (var.type()) + { + case TQT_DBusData::Bool: + { + dbus_bool_t value = var.toBool(); + dbus_message_iter_append_basic(it, DBUS_TYPE_BOOLEAN, &value); + break; + } + case TQT_DBusData::Byte: + { + TQ_UINT8 value = var.toByte(); + dbus_message_iter_append_basic(it, DBUS_TYPE_BYTE, &value); + break; + } + case TQT_DBusData::Int16: { + TQ_INT16 value = var.toInt16(); + dbus_message_iter_append_basic(it, DBUS_TYPE_INT16, &value); + break; + } + case TQT_DBusData::UInt16: { + TQ_UINT16 value = var.toUInt16(); + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT16, &value); + break; + } + case TQT_DBusData::Int32: { + TQ_INT32 value = var.toInt32(); + dbus_message_iter_append_basic(it, DBUS_TYPE_INT32, &value); + break; + } + case TQT_DBusData::UInt32: { + TQ_UINT32 value = var.toUInt32(); + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT32, &value); + break; + } + case TQT_DBusData::Int64: { + TQ_INT64 value = var.toInt64(); + dbus_message_iter_append_basic(it, DBUS_TYPE_INT64, &value); + break; + } + case TQT_DBusData::UInt64: { + TQ_UINT64 value = var.toUInt64(); + dbus_message_iter_append_basic(it, DBUS_TYPE_UINT64, &value); + break; + } + case TQT_DBusData::Double: { + double value = var.toDouble(); + dbus_message_iter_append_basic(it, DBUS_TYPE_DOUBLE, &value); + break; + } + case TQT_DBusData::String: + tqAppendToMessage(it, var.toString()); + break; + case TQT_DBusData::ObjectPath: + tqAppendToMessage(it, var.toObjectPath()); + break; + case TQT_DBusData::List: { + TQT_DBusDataList list = var.toList(); + + TQCString signature = 0; + if (list.hasContainerItemType()) + signature = list.containerItemType().buildDBusSignature(); + else + signature = qDBusTypeForTQT_DBusType(list.type()); + + DBusMessageIter sub; + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, + signature.data(), &sub); + + const TQValueList<TQT_DBusData> valueList = var.toTQValueList(); + TQValueList<TQT_DBusData>::const_iterator listIt = valueList.begin(); + TQValueList<TQT_DBusData>::const_iterator listEndIt = valueList.end(); + for (; listIt != listEndIt; ++listIt) + { + qDBusDataToIterator(&sub, *listIt); + } + dbus_message_iter_close_container(it, &sub); + break; + } + case TQT_DBusData::Map: { + switch (var.keyType()) { + case TQT_DBusData::Byte: + qDBusByteKeyMapToIterator(it, var); + break; + case TQT_DBusData::Int16: + qDBusInt16KeyMapToIterator(it, var); + break; + case TQT_DBusData::UInt16: + qDBusUInt16KeyMapToIterator(it, var); + break; + case TQT_DBusData::Int32: + qDBusInt32KeyMapToIterator(it, var); + break; + case TQT_DBusData::UInt32: + qDBusUInt32KeyMapToIterator(it, var); + break; + case TQT_DBusData::Int64: + qDBusInt64KeyMapToIterator(it, var); + break; + case TQT_DBusData::UInt64: + qDBusUInt64KeyMapToIterator(it, var); + break; + case TQT_DBusData::String: + qDBusStringKeyMapToIterator(it, var); + break; + case TQT_DBusData::ObjectPath: + qDBusObjectPathKeyMapToIterator(it, var); + break; + default: + qWarning("TQT_DBusMarshall: unhandled map key type %s " + "at marshalling", + TQT_DBusData::typeName(var.keyType())); + break; + } + break; + } + case TQT_DBusData::Variant: { + TQT_DBusVariant variant = var.toVariant(); + if (variant.signature.isEmpty() || !variant.value.isValid()) break; + + DBusMessageIter sub; + dbus_message_iter_open_container(it, DBUS_TYPE_VARIANT, + variant.signature.utf8(), &sub); + + qDBusDataToIterator(&sub, variant.value); + + dbus_message_iter_close_container(it, &sub); + break; + } + case TQT_DBusData::Struct: { + TQValueList<TQT_DBusData> memberList = var.toStruct(); + if (memberList.isEmpty()) break; + + DBusMessageIter sub; + dbus_message_iter_open_container(it, DBUS_TYPE_STRUCT, NULL, &sub); + + TQValueList<TQT_DBusData>::const_iterator memberIt = memberList.begin(); + TQValueList<TQT_DBusData>::const_iterator memberEndIt = memberList.end(); + for (; memberIt != memberEndIt; ++memberIt) + { + qDBusDataToIterator(&sub, *memberIt); + } + + dbus_message_iter_close_container(it, &sub); + } +#if 0 + case TQVariant::ByteArray: { + const TQByteArray array = var.toByteArray(); + const char* cdata = array.data(); + DBusMessageIter sub; + dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &sub); + dbus_message_iter_append_fixed_array(&sub, DBUS_TYPE_BYTE, &cdata, array.size()); + dbus_message_iter_close_container(it, &sub); + break; + } +#endif + default: + //qWarning("Don't know how to handle type %s", var.typeName()); + break; + } +} + +void qListToIterator(DBusMessageIter* it, const TQValueList<TQT_DBusData>& list) +{ + if (list.isEmpty()) return; + + TQValueList<TQT_DBusData>::const_iterator listIt = list.begin(); + TQValueList<TQT_DBusData>::const_iterator listEndIt = list.end(); + for (; listIt != listEndIt; ++listIt) + { + qDBusDataToIterator(it, *listIt); + } +} + +void TQT_DBusMarshall::listToMessage(const TQValueList<TQT_DBusData> &list, DBusMessage *msg) +{ + Q_ASSERT(msg); + DBusMessageIter it; + dbus_message_iter_init_append(msg, &it); + qListToIterator(&it, list); +} diff --git a/main/dependencies/dbus-tqt/tqdbusmarshall.h b/main/dependencies/dbus-tqt/tqdbusmarshall.h new file mode 100644 index 000000000..6c41587fa --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmarshall.h @@ -0,0 +1,40 @@ +/* qdbusmarshall.h TQT_DBusMarshall object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSMARSHALL_H +#define TQDBUSMARSHALL_H + +struct DBusMessage; + +class TQT_DBusData; + +template <typename T> class TQValueList; + +class TQT_DBusMarshall +{ +public: + static void listToMessage(const TQValueList<TQT_DBusData> &list, DBusMessage* message); + static void messageToList(TQValueList<TQT_DBusData>& list, DBusMessage* message); +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusmessage.cpp b/main/dependencies/dbus-tqt/tqdbusmessage.cpp new file mode 100644 index 000000000..2b1d61899 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmessage.cpp @@ -0,0 +1,263 @@ +/* qdbusmessage.cpp + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusmessage.h" + +#include <tqstringlist.h> + +#include <dbus/dbus.h> + +#include "tqdbusmarshall.h" +#include "tqdbusmessage_p.h" + +TQT_DBusMessagePrivate::TQT_DBusMessagePrivate(TQT_DBusMessage *qq) + : msg(0), reply(0), q(qq), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), ref(1) +{ +} + +TQT_DBusMessagePrivate::~TQT_DBusMessagePrivate() +{ + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); +} + +/////////////// + + +TQT_DBusMessage TQT_DBusMessage::signal(const TQString &path, const TQString &interface, + const TQString &member) +{ + TQT_DBusMessage message; + message.d->type = DBUS_MESSAGE_TYPE_SIGNAL; + message.d->path = path; + message.d->interface = interface; + message.d->member = member; + + return message; +} + +TQT_DBusMessage TQT_DBusMessage::methodCall(const TQString &service, const TQString &path, + const TQString &interface, const TQString &method) +{ + TQT_DBusMessage message; + message.d->type = DBUS_MESSAGE_TYPE_METHOD_CALL; + message.d->service = service; + message.d->path = path; + message.d->interface = interface; + message.d->member = method; + + return message; +} + +TQT_DBusMessage TQT_DBusMessage::methodReply(const TQT_DBusMessage &other) +{ + Q_ASSERT(other.d->msg); + + TQT_DBusMessage message; + message.d->type = DBUS_MESSAGE_TYPE_METHOD_RETURN; + message.d->reply = dbus_message_ref(other.d->msg); + + return message; +} + +TQT_DBusMessage TQT_DBusMessage::methodError(const TQT_DBusMessage &other, const TQT_DBusError& error) +{ + Q_ASSERT(other.d->msg); + + TQT_DBusMessage message; + if (!error.isValid()) + { + qWarning("TQT_DBusMessage: error passed to methodError() is not valid!"); + return message; + } + + message.d->type = DBUS_MESSAGE_TYPE_ERROR; + message.d->reply = dbus_message_ref(other.d->msg); + message.d->error = error; + + return message; +} + +TQT_DBusMessage::TQT_DBusMessage() +{ + d = new TQT_DBusMessagePrivate(this); +} + +TQT_DBusMessage::TQT_DBusMessage(const TQT_DBusMessage &other) + : TQValueList<TQT_DBusData>(other) +{ + d = other.d; + d->ref.ref(); +} + +TQT_DBusMessage::~TQT_DBusMessage() +{ + if (!d->ref.deref()) + delete d; +} + +TQT_DBusMessage &TQT_DBusMessage::operator=(const TQT_DBusMessage &other) +{ + TQValueList<TQT_DBusData>::operator=(other); + // FIXME-QT4 qAtomicAssign(d, other.d); + if (other.d) other.d->ref.ref(); + TQT_DBusMessagePrivate* old = d; + d = other.d; + if (old && !old->ref.deref()) + delete old; + return *this; +} + +DBusMessage *TQT_DBusMessage::toDBusMessage() const +{ + DBusMessage *msg = 0; + switch (d->type) { + case DBUS_MESSAGE_TYPE_METHOD_CALL: + msg = dbus_message_new_method_call(d->service.utf8().data(), + d->path.utf8().data(), d->interface.utf8().data(), + d->member.utf8().data()); + break; + case DBUS_MESSAGE_TYPE_SIGNAL: + msg = dbus_message_new_signal(d->path.utf8().data(), + d->interface.utf8().data(), d->member.utf8().data()); + break; + case DBUS_MESSAGE_TYPE_METHOD_RETURN: + msg = dbus_message_new_method_return(d->reply); + break; + case DBUS_MESSAGE_TYPE_ERROR: + msg = dbus_message_new_error(d->reply, d->error.name().utf8().data(), + d->error.message().utf8().data()); + break; + } + if (!msg) + return 0; + + TQT_DBusMarshall::listToMessage(*this, msg); + return msg; +} + +TQT_DBusMessage TQT_DBusMessage::fromDBusMessage(DBusMessage *dmsg) +{ + TQT_DBusMessage message; + if (!dmsg) + return message; + + message.d->type = dbus_message_get_type(dmsg); + message.d->path = TQString::fromUtf8(dbus_message_get_path(dmsg)); + message.d->interface = TQString::fromUtf8(dbus_message_get_interface(dmsg)); + message.d->member = TQString::fromUtf8(dbus_message_get_member(dmsg)); + message.d->sender = TQString::fromUtf8(dbus_message_get_sender(dmsg)); + message.d->msg = dbus_message_ref(dmsg); + + DBusError dbusError; + dbus_error_init(&dbusError); + if (dbus_set_error_from_message(&dbusError, dmsg)) + { + message.d->error = TQT_DBusError(&dbusError); + } + + TQT_DBusMarshall::messageToList(message, dmsg); + + return message; +} + +TQString TQT_DBusMessage::path() const +{ + return d->path; +} + +TQString TQT_DBusMessage::interface() const +{ + return d->interface; +} + +TQString TQT_DBusMessage::member() const +{ + return d->member; +} + +TQString TQT_DBusMessage::sender() const +{ + return d->sender; +} + +TQT_DBusError TQT_DBusMessage::error() const +{ + return d->error; +} + +int TQT_DBusMessage::timeout() const +{ + return d->timeout; +} + +void TQT_DBusMessage::setTimeout(int ms) +{ + d->timeout = ms; +} + +/*! + Returns the unique serial number assigned to this message + or 0 if the message was not sent yet. + */ +int TQT_DBusMessage::serialNumber() const +{ + if (!d->msg) + return 0; + return dbus_message_get_serial(d->msg); +} + +/*! + Returns the unique serial number assigned to the message + that triggered this reply message. + + If this message is not a reply to another message, 0 + is returned. + + */ +int TQT_DBusMessage::replySerialNumber() const +{ + if (!d->msg) + return 0; + return dbus_message_get_reply_serial(d->msg); +} + +TQT_DBusMessage::MessageType TQT_DBusMessage::type() const +{ + switch (d->type) { + case DBUS_MESSAGE_TYPE_METHOD_CALL: + return MethodCallMessage; + case DBUS_MESSAGE_TYPE_METHOD_RETURN: + return ReplyMessage; + case DBUS_MESSAGE_TYPE_ERROR: + return ErrorMessage; + case DBUS_MESSAGE_TYPE_SIGNAL: + return SignalMessage; + default: + return InvalidMessage; + } +} + diff --git a/main/dependencies/dbus-tqt/tqdbusmessage.h b/main/dependencies/dbus-tqt/tqdbusmessage.h new file mode 100644 index 000000000..665a83f36 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmessage.h @@ -0,0 +1,514 @@ +/* qdbusmessage.h TQT_DBusMessage object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSMESSAGE_H +#define TQDBUSMESSAGE_H + +#include "tqdbusmacros.h" +#include "tqdbusdata.h" + +#include <tqvaluelist.h> + +#include <limits.h> + +class TQT_DBusError; +class TQT_DBusMessagePrivate; +struct DBusMessage; + +/** + * @brief A message converts and transports data over D-Bus + * + * A TQT_DBusMessage is implicitly shared, similar to a TQString, i.e. copying + * a message creates just a shallow copy. + * + * The TQT_DBusMessage is the TQt3 bindings means of encapsulating data for a + * method call, a method reply or an error. + * + * Data specifying the sender and receipient is directly accessible through + * getter methods, while data, e.g. method parameters or return values, are + * managed as a list of TQT_DBusData. + * + * To create a message suitable for sending use one of the static factory + * methods: + * - signal() for creating a D-Bus signal message + * + * - methodCall() for creating a D-Bus method calls to a service object + * + * - methodReply() for creating a method reply on success + * + * - methodError() for creating a method reply on error + * + * @note for applications that just want to perform method calls and/or receive + * signals, it is usually more convenient to use TQT_DBusProxy instead. + * + * Message sending is achieved through TQT_DBusConnection + * + * Example: + * @code + * TQT_DBusConnection con = TQT_DBusConnection::sessionBus(); + * + * // receipient service is the bus' main interface + * + * TQString service = "org.freedesktop.DBus"; + * TQString path = "/org/freedesktop/DBus"; + * TQString interface = "org.freedesktop.DBus"; + * + * TQT_DBusMessage msg = TQBusMessage::methodCall(service, path, interface, "ListNames"); + * + * TQT_DBusMessage reply = con.sendWithReply(msg); + * + * // awaiting for a message list + * + * if (reply.type() != TQT_DBusMessage::ReplyMessage || reply.count() != 2 || + * reply[0].type() != TQT_DBusData::List) + * { + * // error handling here + * } + * else + * { + * TQStringList list = reply[0].toTQStringList(); + * + * // reply handling here + * } + * @endcode + * + * A service returning such a reply would do something like this + * @code + * bool Service::handleMethodCall(const TQT_DBusMessage& call) + * { + * // checks for correctness, i.e. correct interface, member, + * // would usually haven been placed here + * + * TQStringList result; + * result << "Foo" << "Bar"; + * + * TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call); + * reply << TQT_DBusData::fromList(result); + * + * connection.send(reply); + * + * return true; + * } + * @endcode + */ +class TQDBUS_EXPORT TQT_DBusMessage: public TQValueList<TQT_DBusData> +{ + friend class TQT_DBusConnection; +public: + /** + * @brief Anonymous enum for timeout constants + * + * @see timeout() + * @see setTimeout() + */ + enum + { + /** + * Use whatever D-Bus has as default timeout + */ + DefaultTimeout = -1, + + /** + * Use no timeout at all, i.e. wait as long as necessary + */ + NoTimeout = INT_MAX + }; + + /** + * @brief D-Bus message types + * + * A message of a specific type can be created using the respective factory + * method. A message created by the default constructor becomes an + * InvalidMessage + * + * @see type() + * @see signal() + * @see methodCall() + * @see methodReply() + * @see methodError() + */ + enum MessageType + { + /** + * An invalid message cannot be sent over D-Bus. This type serves for + * initializing message variables without requiring a "real" message + */ + InvalidMessage, + + /** + * A message for doing method calls on remote service objects + * + * @see methodCall() + */ + MethodCallMessage, + + /** + * A message for replying to a method call in case of success + * + * @see methodReply() + */ + ReplyMessage, + + /** + * A message for replying to a method call in case of failure + * + * @see methodError() + */ + ErrorMessage, + + /** + * A message for emitting D-Bus signals + * + * @see signal() + */ + SignalMessage + }; + + /** + * @brief Creates an empty and invalid message + * + * To create a message suitable for sending through D-Bus see the factory + * methods signal(), methodCall(), methodReply() and methodError() + * + * @see #InvalidMessage + */ + TQT_DBusMessage(); + + + /** + * @brief Creates a shallow copy of the given message + * + * This instance will become a handle to the same message data the other + * message is using, including #MessageType + * + * @param other the message to copy + */ + TQT_DBusMessage(const TQT_DBusMessage &other); + + /** + * @brief Destroys a message + * + * If this message handle is the last one using this respective message + * content, the message content will be deleted as well + */ + ~TQT_DBusMessage(); + + /** + * @brief Creates a shallow copy of the given message + * + * This instance will become a handle to the same message data the other + * message is usingm including #MessageType + * + * Any content used in this instance will be deleted if this instance was + * the last handle using that content + * + * @param other the message to copy + * + * @return a reference to this instance as required by assignment operator + * semantics + */ + TQT_DBusMessage &operator=(const TQT_DBusMessage &other); + + /** + * @brief Creates a message for sending a D-Bus signal + * + * Sending/emitting a signal over D-Bus requires a message of type + * #SignalMessage as well as the information where it is coming from, i.e. + * which interface of which object is sending it. + * See @ref dbusconventions for recommendations on those parameters. + * + * @param path the object path of the service object + * @param interface the object's interface to which the signal belongs + * @param member the signal's name + * + * @return a message suitable for appending arguments and for sending + * + * @see TQT_DBusConnection::send() + */ + static TQT_DBusMessage signal(const TQString &path, const TQString &interface, + const TQString &member); + + /** + * @brief Creates a message for sending a D-Bus method call + * + * Invoking a method over D-Bus requires a message of type + * #MethodCallMessage as well as the information where it should be sent + * to, e.g which interface of which object in which service. + * See @ref dbusconventions for recommendations on those parameters. + * + * @param service the D-Bus name of the application hosting the service + * object + * @param path the object path of the service object + * @param interface the object's interface to which the method belongs + * @param method the method's name + * + * @return a message suitable for appending arguments and for sending + * + * @see methodReply() + * @see methodError() + * @see TQT_DBusConnection::send() + */ + static TQT_DBusMessage methodCall(const TQString &service, const TQString &path, + const TQString &interface, const TQString &method); + + /** + * @brief Creates a message for replying to a D-Bus method call + * + * Replying to a D-Bus method call in the case of success requires a message + * of type #ReplyMessage as well as the information to which method call it + * is replying to. + * + * @param other the method call message it is replying to + * + * @return a message suitable for appending arguments and for sending + * + * @see methodCall() + * @see methodError() + * @see TQT_DBusConnection::send() + */ + static TQT_DBusMessage methodReply(const TQT_DBusMessage &other); + + /** + * @brief Creates a message for replying to a D-Bus method call + * + * Replying to a D-Bus method call in the case of failure requires a message + * of type #ErrorMessage as well as the information to which method call it + * is replying to and which error occured. + * + * @param other the method call message it is replying to + * @param error the error which occured during during the method call + * + * @return a message suitable for appending arguments and for sending + * + * @see methodCall() + * @see methodReply() + * @see TQT_DBusConnection::send() + */ + static TQT_DBusMessage methodError(const TQT_DBusMessage &other, const TQT_DBusError& error); + + /** + * @brief Returns the message's object path + * + * See section @ref dbusconventions-objectpath for details. + * + * The context of the object path depends on the message type: + * - #SignalMessage: the path of the service object which emits the signal + * - #MethodCallMessage: the path of the service object the call is sent to + * - #ReplyMessage: the path of the object which is replying + * - #ErrorMessage: the path of the object which is replying + * + * @return a non-empty object path or @c TQString() + * + * @see interface() + * @see member() + * @see sender() + */ + TQString path() const; + + /** + * @brief Returns the message's interface name + * + * See section @ref dbusconventions-interfacename for details. + * + * The context of the interface name depends on the message type: + * - #SignalMessage: the name of the interface which emits the signal + * - #MethodCallMessage: the name of the interface the call is sent to + * - #ReplyMessage: the name of the interface to which the method belonged + * - #ErrorMessage: the name of the interface to which the method belonged + * + * @return a non-empty interface name or @c TQString() + * + * @see path() + * @see member() + * @see sender() + */ + TQString interface() const; + + /** + * @brief Returns the message's member name + * + * See section @ref dbusconventions-membername for details. + * + * The context of the member name depends on the message type: + * - #SignalMessage: the name of the emitted signal + * - #MethodCallMessage: the name of the method to call + * - #ReplyMessage: the name of the method which replies + * - #ErrorMessage: the name of the method which replies + * + * @return a non-empty member name or @c TQString() + * + * @see path() + * @see interface() + * @see sender() + */ + TQString member() const; + + /** + * @brief Returns the name of the message sender + * + * The message sender name or address used on the D-Bus message bus + * to refer to the application which sent this message. + * + * See section @ref dbusconventions-servicename for details. + * + * This can either be a unique name as handed out by the bus, see + * TQT_DBusConnection::uniqueName() or a name registered with + * TQT_DBusConnection::requestName() + * + * @return a non-empty D-Bus sender name or @c TQString() + * + * @see path() + * @see interface() + * @see member() + */ + TQString sender() const; + + /** + * @brief Returns the error of an error message + * + * If this message is of type #ErrorMessage, this method can be used + * to retrieve the respective error object + * + * @return the transported error object. Will be empty if this is not an + * error message + * + * @see type() + */ + TQT_DBusError error() const; + + /** + * @brief Returns which kind of message this is + * + * @return the message's type + */ + MessageType type() const; + + /** + * @brief Returns the message's timeout + * + * @return the asynchronous wait timeout in milliseconds + * + * @see setTimeout() + */ + int timeout() const; + + /** + * @brief Sets the message's timeout + * + * The timeout is the number of milliseconds the D-Bus connection will + * wait for the reply of an asynchronous call. + * + * If no reply is received in time, an error message will be delivered to + * the asynchronous reply receiver. + * + * If no timeout is set explicitly, #DefaultTimeout is assumed, which is + * usually the best option + * + * @return the asynchronous wait timeout in milliseconds + * + * @param ms timeout in milliseconds + * + * @see timeout() + * @see #DefaultTimeout + * @see #NoTimeout + */ + void setTimeout(int ms); + + /** + * @brief Returns the message's serial number + * + * The serial number is some kind of short term identifier for messages + * travelling the same connection. + * + * It can be used to associate a reply or error message with a method + * call message. + * + * @return the message's serial number or @c 0 if the message hasn't been + * send yets + * + * @see replySerialNumber() + */ + int serialNumber() const; + + /** + * @brief Returns the message's reply serial number + * + * The reply serial number is the serial number of the method call message + * this message is a reply to. + * + * If this is neither a message of type #ReplyMessage or #ErrorMessage, the + * returned value will be @c 0 + * + * It can be used to associate a reply or error message with a method + * call message. + * + * @return the serial number of the associated method call message or @c 0 + * if this message is not a reply message + * + * @see serialNumber() + * @see methodReply() + * @see methodError() + * @see TQT_DBusConnection::sendWithAsyncReply() + * @see TQT_DBusProxy::sendWithAsyncReply() + */ + int replySerialNumber() const; + +//protected: + /** + * @brief Creates a raw D-Bus message from this TQt3-bindings message + * + * Marshalls data contained in the message's value list into D-Bus data + * format and creates a low level API D-Bus message for it. + * + * @note ownership of the returned message is transferred to the caller, + * i.e. it has to be deleted using dbus_message_unref() + * + * @return a C API D-Bus message or @c 0 if this is an #InvalidMessage + * or marshalling failed + */ + DBusMessage *toDBusMessage() const; + + /** + * @brief Creates a TQt3-bindings message from the given raw D-Bus message + * + * De-marshalls data contained in the message to a list of TQT_DBusData. + * + * @note ownership of the given message is shared between the caller and + * the returned message, i.e. the message as increased the reference + * counter and will still have access to the raw message even if the + * caller "deleted" it using dbus_message_unref() + * + * @param dmsg a C API D-Bus message + * + * @return a TQt3 bindings message. Can be an #InvalidMessage if the given + * message was @c 0 or if de-marshalling failed + */ + static TQT_DBusMessage fromDBusMessage(DBusMessage *dmsg); + +private: + TQT_DBusMessagePrivate *d; +}; + +#endif + diff --git a/main/dependencies/dbus-tqt/tqdbusmessage_p.h b/main/dependencies/dbus-tqt/tqdbusmessage_p.h new file mode 100644 index 000000000..657460f27 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusmessage_p.h @@ -0,0 +1,52 @@ +/* qdbusmessage.h TQT_DBusMessage private object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSMESSAGE_P_H +#define TQDBUSMESSAGE_P_H + +#include <tqstring.h> + +#include "tqdbusatomic.h" +#include "tqdbuserror.h" + +struct DBusMessage; + +class TQT_DBusMessagePrivate +{ +public: + TQT_DBusMessagePrivate(TQT_DBusMessage *qq); + ~TQT_DBusMessagePrivate(); + + TQString path, interface, member, service, sender; + TQT_DBusError error; + DBusMessage *msg; + DBusMessage *reply; + TQT_DBusMessage *q; + int type; + int timeout; + // FIXME-QT4 TQAtomic ref; + Atomic ref; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusobject.h b/main/dependencies/dbus-tqt/tqdbusobject.h new file mode 100644 index 000000000..2e07a4443 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusobject.h @@ -0,0 +1,372 @@ +/* qdbusobject.h DBUS service object interface + * + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSOBJECT_H +#define TQDBUSOBJECT_H + +/** + * @page dbusservice Providing services over D-Bus + * + * Contents: + * - @ref dbusservice-introduction + * - @ref dbusservice-example + * - @ref dbusservice-requestname + * - @ref dbusservice-registerobjects + * - @ref dbusservice-interfaces + * + * @section dbusservice-introduction Introduction + * + * The TQt3 bindings do not support autogeneration of service objects yet. In + * order to provide interfaces over D-Bus, an application has to implement the + * TQT_DBusObjectBase interface and register an instance of the resulting class + * with the TQT_DBusConnection. + * + * @section dbusservice-example A simple D-Bus client example + * + * @code + * #include <dbus/tqdbusconnection.h>; + * #include <dbus/tqdbusobject.h>; + * + * class TQStringList; + * + * class TestService : public TQT_DBusObjectBase + * { + * public: + * TestService(const TQT_DBusConnection& connection); + * virtual ~TestService(); + * + * protected: + * virtual bool handleMethodCall(const TQT_DBusMessage& message); + * + * private: + * TQT_DBusConnection m_connection; + * + * private: + * TQStringList sortStrings(const TQStringList& list); + * }; + * @endcode + * @code + * + * #include <tqstringlist.h>; + * + * #include <dbus/tqdbuserror.h>; + * #include <dbus/tqdbusmessage.h>; + * + * TestService::TestService(const TQT_DBusConnection& connection) : m_connection(connection) + * { + * m_connection.registerObject("/ListSorter", this); + * } + * + * TestService::~TestService() + * { + * m_connection.unregisterObject("/ListSorter"); + * } + * + * // return false to let D-Bus send a standard error message that the method is unknown + * + * bool TestService::handleMethod(const TQT_DBusMessage& message) + * { + * if (message.interface() != "org.example.Sort") return false; + * + * if (message.member() == "Strings") + * { + * // check parameters + * + * if (message.count() != 1 || message[0].type() != TQT_DBusData::List) + * { + * // method signature not what we expected + * + * TQT_DBusError error = TQT_DBusError::stdInvalidArgs( + * "Expected one argument of type array of string"); + * + * TQT_DBusMessage reply = TQT_DBusMessage::methodError(message, error); + * + * // send error + * + * m_connection.send(reply); + * + * // tell D-Bus we did handle the call + * + * return true; + * } + * + * // call implementation + * + * TQStringList result = sortStrings(message[0].toTQStringList()); + * + * // prepare reply + * + * TQT_DBusMessage reply = TQT_DBusMessage::methodReply(message); + * + * reply << TQT_DBusData::fromList(result); + * + * // send reply + * + * m_connection.send(reply); + * + * // tell D-Bus we did handle the call + * + * return true; + * } + * + * return false; + * } + * + * TQStringList TestService::sortStrings(const TQStringList& list) + * { + * TQStringList result = list; + * + * result.sort(); + * + * return result; + * } + * @endcode + * @code + * int main(int argc, char** argv) + * { + * TQApplication app(argc, argv, false); + * + * TQT_DBusConnection connection = TQT_DBusConnection::sessionBus(); + * if (!connection.isConnected()) + * qFatal("Cannot connect to session bus"); + * + * // try to get a specific service name + * if (!connection.requestName("org.example.SortService")) + * { + * qWarning("Requesting name 'org.example.SortService' failed. " + * "Will only be addressable through unique name '%s'", + * connection.uniqueName().local8Bit().data()); + * } + * else + * { + * qDebug("Requesting name 'org.example.SortService' successfull"); + * } + * + * TestService service(connection); + * + * return app.exec(); + * } + * @endcode + * + * @section dbusservice-requestname Requesting service name + * + * When an application connects to D-Bus it gets a unique name generated by + * the bus daemon. + * + * However, an application providing service will often want to be reachable + * under a fixed name, like a webserver being reachable through a domain name + * independent from its actual IP address. + * See section @ref dbusconventions-servicename for details on service names. + * + * In order to get such a specific name an application has to request it + * using TQT_DBusConnection::requestName() + * + * The example above request @c "org.example.SortService" but continues with + * the default unique name in the case some other application is currently + * owning that name. + * + * @section dbusservice-registerobjects Registering objects + * + * To make service objects available to other applications on the same + * bus the application has to register the objects instances with the + * connection to the bus using TQT_DBusConnection::registerObject() + * + * Registering means to specify an object path where the object will be + * located, i.e. how it can be unambiguously be addressed in method calls. + * See section @ref dbusconventions-objectpath for details on object paths. + * + * If the applications has introspectable objects it is recommended to + * register an introspectable root object, i.e. using @c "/" as the path, so + * other applications have a common place to start asking for introspection + * data. + * + * In the example above a service object providing sorting services on lists is + * registered on the path @c "/ListSorter" + * + * @section dbusservice-interfaces Service interfaces + * + * D-Bus methods and signals of a service object a grouped into interfaces. + * + * See section @ref dbusconventions-interfacename for details on interface + * naming. + * + * An object can implement any number of interfaces, for example the interface + * for the functionality it wants to provide and a D-Bus standard interface like + * @c "org.freedesktop.DBus.Introspectable" for providing an XML description of + * all its interfaces. + * + * + * The service object of the example above implements just one interface + * @c "org.example.Sort" and its handleMethodCall() explicitly checks all + * received messages and rejects any messsage not sent to this particular + * interface by returning @c false and thus telling the D-Bus layer to + * generate a standard error response. + * + * Multiple interfaces can of course be directly implemented in one C++ class, + * however it might sometimes be wise to delegate calls for different + * interfaces to different implementations: + * @code + * class Interface1 : public TQT_DBusObjectBase + * { + * public: + * Interface1(const TQT_DBusConnection&); + * + * protected: + * virtual bool handleMethodCall(const TQT_DBusMessage&); + * }; + * + * class Interface2 : public TQT_DBusObjectBase + * { + * public: + * Interface2(const TQT_DBusConnection&); + * + * protected: + * virtual bool handleMethodCall(const TQT_DBusMessage&); + * }; + * + * class MultiInterfaceService : public TQT_DBusObjectBase + * { + * public: + * MultiInterfaceService(const TQT_DBusConnection&); + * + * protected: + * virtual bool handleMethodCall(const TQT_DBusMessage&); + * + * private: + * TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; + * }; + * + * MultiInterfaceService::MultiInterfaceService(const TQT_DBusConnection& connection) + * { + * m_interfaces.insert("org.example.Interface1", new Interface1(connection)); + * m_interfaces.insert("org.example.Interface2", new Interface2(connection)); + * } + * + * bool MultiInterfaceService::handleMethodCall(const TQT_DBusMessage& message) + * { + * // delegate call to its interface handler + * TQT_DBusObjectBase* handler = m_interfaces[message.interface()]; + * if (handler != 0) + * return delegateMethodCall->(message, handler); + * else + * return false; // no such interface + * } + * @endcode + */ + +/** + * @include example-service.h + * @example example-service.cpp + */ + +#include "tqdbusmacros.h" + +class TQT_DBusMessage; + +/** + * @brief Base interface for D-Bus service objects + * + * In order to register a service object with the TQT_DBusConnection it needs to + * implement the interface specified by this class. + * + * The connection will forward all method calls that have a path equivalent + * to the path the service object was registered with to the object's + * handleMethodCall() method. See TQT_DBusConnection::registerObject() + * + * If for some reason, e.g. the call is not meant for this interface, or the + * method is unknown, the implementation can just return @c false and the + * connection will handle the rest. + * + * See section @ref dbusservice for documentation on how to use TQT_DBusObjectBase + */ +class TQDBUS_EXPORT TQT_DBusObjectBase +{ + friend class TQT_DBusConnectionPrivate; +public: + /** + * @brief Destroys the object + */ + virtual ~TQT_DBusObjectBase() {} + +protected: + /** + * @brief Method call entry point + * + * This method has to be implemented to handle method calls sent to the + * service object. + * An object implementation can handle all its interfaces in one class or + * again forward the method call to interface implementators. + * + * If for some reason, e.g. the call is not meant for this interface, or + * the method is unknown, the implementation can just return @c false and + * the connection will handle the rest. + * + * If an error occurs during the method call, e.g. the number of parameters + * or their types are not what would be expected, the service object + * should reply with a TQT_DBusMessage of type TQT_DBusMessage::ErrorMessage + * which in turn should include the D-Bus error describing the problem. + * See TQT_DBusConnection::send() for sending reply messages. + * + * See TQT_DBusMessage::methodError() and TQT_DBusMessage::methodReply() on + * how to create suitable reply messages for the given method call. + * + * @param message the method call to handle + * + * @return @c true if the message can be handled independent if handling + * resulted in an error. In this case implementations should an + * error reply. Returns @c false only if interface or method are + * unknown + */ + virtual bool handleMethodCall(const TQT_DBusMessage& message) = 0; + + /** + * @brief Delegate a method call to another object + * + * When a service object is built as a collection of separated interface + * class instances, i.e. each interface of the object is implemented in + * its own TQT_DBusObjectBase subclass and the main object just wanst to pass + * on the method calls to the respective interface implementations, it + * can do so by calling this base class method. + * + * Since it is a method of the base class, it can call the otherwise + * protected handleMethodCall() of the interface implementor. + * + * See @ref dbusservice-interfaces for an example. + * + * @param message the method call to delegate + * @param delegate the object which should handle the call instead + * + * @return @c true if the message can be handled independent if handling + * resulted in an error. In this case implementations should an + * error reply. Returns @c false only if interface or method are + * unknown + * + */ + bool delegateMethodCall(const TQT_DBusMessage& message, TQT_DBusObjectBase* delegate) + { + return delegate->handleMethodCall(message); + } +}; + +#endif + diff --git a/main/dependencies/dbus-tqt/tqdbusobjectpath.cpp b/main/dependencies/dbus-tqt/tqdbusobjectpath.cpp new file mode 100644 index 000000000..48fab0ff4 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusobjectpath.cpp @@ -0,0 +1,79 @@ +/* qdbusobjectpath.cpp DBUS object path data type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusobjectpath.h" + +TQT_DBusObjectPath::TQT_DBusObjectPath() : TQCString() +{ +} + +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& other) : TQCString(static_cast<const TQCString&>(other)) +{ +} + +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQCString& other) : TQCString(static_cast<const TQCString&>(other)) +{ +} + +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& tqparentNode, + const TQCString& nodeName) + : TQCString(static_cast<const TQCString&>(tqparentNode)) +{ + if (tqparentNode.length() != 1) append("/"); + + append(nodeName); +} + +bool TQT_DBusObjectPath::isValid() const +{ + return (validate(*this) == -1); +} + +TQT_DBusObjectPath TQT_DBusObjectPath::tqparentNode() const +{ + if (length() == 1) return TQT_DBusObjectPath(); + + int index = tqfindRev('/'); + + if (index == -1) return TQT_DBusObjectPath(); + + if (index == 0) return left(1); + + return left(index); +} + +int TQT_DBusObjectPath::validate(const TQCString& path) +{ + if (path.isEmpty()) return 0; + + if (path[0] != '/') return 0; + + // TODO add additional checks + + uint len = path.length(); + + // only root node allowed to end in slash + if (path[len - 1] == '/' && len > 1) return (len - 1); + + return -1; +} diff --git a/main/dependencies/dbus-tqt/tqdbusobjectpath.h b/main/dependencies/dbus-tqt/tqdbusobjectpath.h new file mode 100644 index 000000000..6f0bd5b5e --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusobjectpath.h @@ -0,0 +1,118 @@ +/* qdbusobjectpath.h DBUS object path data type + * + * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSOBJECTPATH_H +#define TQDBUSOBJECTPATH_H + +#include <tqcstring.h> + +/** + * @brief Class for representing D-Bus object paths + * + * This data type is necessary to correctly represent object paths in the + * context of D-Bus messages, since normal strings have a different D-Bus + * signature than object paths. + * + * @see @ref dbusconventions-objectpath + */ +class TQT_DBusObjectPath : public TQCString +{ +public: + /** + * @brief Creates an empty and invalid object path + */ + TQT_DBusObjectPath(); + + /** + * @brief Creates copy of the given @p other object path + * + * @param other the object path to copy + */ + TQT_DBusObjectPath(const TQT_DBusObjectPath& other); + + /** + * @brief Creates copy of the given @p other object path + * + * @param other the object path to copy + */ + TQT_DBusObjectPath(const TQCString& other); + + /** + * @brief Creates an object path for an object as a child of the tqparent node + * + * This is basically like specifying a directory and a file name to create + * the file's full path. + * + * Example: + * @code + * TQT_DBusObjectPath rootNode("/"); // => "/" + * + * TQT_DBusObjectPath childNod(rootNode, "child"); // => "/child" + * + * TQT_DBusObjectPath grandChildNode(childNode, "grandchild"); // => "/child/grandchild" + * @endcode + * + * @param tqparentNode the object path to create the child on + * @param nodeName the name of the child node + */ + TQT_DBusObjectPath(const TQT_DBusObjectPath& tqparentNode, const TQCString& nodeName); + + /** + * @brief Returns whether the current content is considered a valid object path + * + * @note Calls validate() to perform a check on the current content + * + * @return \c true if the object's content describe a valid object path, + * otherwise @c false + * + * @see @ref dbusconventions-objectpath + */ + bool isValid() const; + + /** + * @brief Returns the object path of this path's tqparent node + * + * This is basically like getting the directory of an file path + * + * @return the tqparent node's object path or an empty and invalid object + * if this is already the root node + */ + TQT_DBusObjectPath tqparentNode() const; + + /** + * @brief Checks the given string for validity as a D-Bus object path + * + * See section @ref dbusconventions-objectpath for information on object + * path formatting. + * + * @param path the string to check + * + * @return @c -1 if the object path is valid, otherwise the index of the + * first violating character + * + * @see isValid() + */ + static int validate(const TQCString& path); +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusproxy.cpp b/main/dependencies/dbus-tqt/tqdbusproxy.cpp new file mode 100644 index 000000000..605481e25 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusproxy.cpp @@ -0,0 +1,209 @@ +/* qdbusproxy.cpp DBUS Object proxy + * + * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbuserror.h" +#include "tqdbusconnection.h" +#include "tqdbusmessage.h" +#include "tqdbusproxy.h" + +class TQT_DBusProxy::Private +{ +public: + Private() : canSend(false) {} + ~Private() {} + + void checkCanSend() + { + canSend = !path.isEmpty() && !service.isEmpty() && !interface.isEmpty(); + } + +public: + TQT_DBusConnection connection; + + TQString service; + TQString path; + TQString interface; + bool canSend; + + TQT_DBusError error; +}; + +TQT_DBusProxy::TQT_DBusProxy(TQObject* tqparent, const char* name) + : TQObject(tqparent, (name ? name : "TQT_DBusProxy")), + d(new Private()) +{ +} + +TQT_DBusProxy::TQT_DBusProxy(const TQT_DBusConnection& connection, + TQObject* tqparent, const char* name) + : TQObject(tqparent, (name ? name : "TQT_DBusProxy")), + d(new Private()) +{ + setConnection(connection); +} + +TQT_DBusProxy::TQT_DBusProxy(const TQString& service, const TQString& path, + const TQString& interface, const TQT_DBusConnection& connection, + TQObject* tqparent, const char* name) + : TQObject(tqparent, (name ? name : "TQT_DBusProxy")), + d(new Private()) +{ + setConnection(connection); + + d->service = service; + d->path = path; + d->interface = interface; + d->checkCanSend(); +} + +TQT_DBusProxy::~TQT_DBusProxy() +{ + delete d; +} + +bool TQT_DBusProxy::setConnection(const TQT_DBusConnection& connection) +{ + d->connection.disconnect(this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&))); + + d->connection = connection; + + return d->connection.connect(this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&))); +} + +const TQT_DBusConnection& TQT_DBusProxy::connection() const +{ + return d->connection; +} + +void TQT_DBusProxy::setService(const TQString& service) +{ + d->service = service; + d->checkCanSend(); +} + +TQString TQT_DBusProxy::service() const +{ + return d->service; +} + +void TQT_DBusProxy::setPath(const TQString& path) +{ + d->path = path; + d->checkCanSend(); +} + +TQString TQT_DBusProxy::path() const +{ + return d->path; +} + +void TQT_DBusProxy::setInterface(const TQString& interface) +{ + d->interface = interface; + d->checkCanSend(); +} + +TQString TQT_DBusProxy::interface() const +{ + return d->interface; +} + +bool TQT_DBusProxy::canSend() const +{ + return d->canSend && d->connection.isConnected(); +} + +bool TQT_DBusProxy::send(const TQString& method, const TQValueList<TQT_DBusData>& params) const +{ + if (!d->canSend || method.isEmpty() || !d->connection.isConnected()) + return false; + + TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path, + d->interface, method); + message += params; + + return d->connection.send(message); +} + +TQT_DBusMessage TQT_DBusProxy::sendWithReply(const TQString& method, + const TQValueList<TQT_DBusData>& params, + TQT_DBusError* error) const +{ + if (!d->canSend || method.isEmpty() || !d->connection.isConnected()) + return TQT_DBusMessage(); + + TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path, + d->interface, method); + message += params; + + TQT_DBusMessage reply = d->connection.sendWithReply(message, &d->error); + + if (error) + *error = d->error; + + return reply; +} + +int TQT_DBusProxy::sendWithAsyncReply(const TQString& method, const TQValueList<TQT_DBusData>& params) +{ + if (!d->canSend || method.isEmpty() || !d->connection.isConnected()) + return 0; + + TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path, + d->interface, method); + message += params; + + return d->connection.sendWithAsyncReply(message, this, + TQT_SLOT(handleAsyncReply(const TQT_DBusMessage&))); +} + +TQT_DBusError TQT_DBusProxy::lastError() const +{ + return d->error; +} + +void TQT_DBusProxy::handleDBusSignal(const TQT_DBusMessage& message) +{ + if (!d->path.isEmpty() && d->path != message.path()) + return; + + // only filter by service name if the name is a unique name + // because signals are always coming from a connection's unique name + // and filtering by a generic name would reject all signals + if (d->service.startsWith(":") && d->service != message.sender()) + return; + + if (!d->interface.isEmpty() && d->interface != message.interface()) + return; + + emit dbusSignal(message); +} + +void TQT_DBusProxy::handleAsyncReply(const TQT_DBusMessage& message) +{ + d->error = message.error(); + + emit asyncReply(message.replySerialNumber(), message); +} + +#include "tqdbusproxy.moc" diff --git a/main/dependencies/dbus-tqt/tqdbusproxy.h b/main/dependencies/dbus-tqt/tqdbusproxy.h new file mode 100644 index 000000000..0e925e5c2 --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusproxy.h @@ -0,0 +1,584 @@ +/* qdbusproxy.h DBUS Object proxy + * + * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSPROXY_H +#define TQDBUSPROXY_H + +/** + * @page dbusclient Using D-Bus as a client + * + * Contents: + * - @ref dbusclient-introduction + * + * - @ref dbusclient-example + * + * - @ref dbusclient-initialization + * + * - @ref dbusclient-methodcall + * - @ref dbusclient-synccall + * - @ref dbusclient-asynccall + * + * - @ref dbusclient-signals + * - @ref dbusclient-signals-example + * + * @section dbusclient-introduction Introduction + * + * While it is of course possible to just exchange D-Bus messages with a + * D-Bus service, it is a lot more comfortable to use TQT_DBusProxy. + * + * With TQT_DBusProxy you only need to specify the service object once, i.e. + * its D-Bus name, path and interface, and just provide the method and its + * parameters when initiating an invokation. + * + * Additionally the proxy transforms D-Bus signals from the proxy's peer + * (the D-Bus service object's interface it is associated with) to TQObject + * signal carrying the original signal's content. + * + * @section dbusclient-example A simple D-Bus client example + * + * @code + * #include <dbus/tqdbusconnection.h> + * #include <dbus/tqdbusmessage.h> + * #include <dbus/tqdbusproxy.h> + * + * int main() + * { + * // establish a connection to the session bus + * + * TQT_DBusConnection connection = TQT_DBusConnection::sessionBus(); + * if (!connection.isConnected()) + * qFatal("Failed to connect to session bus"); + * + * // create a proxy object for method calls + * + * TQT_DBusProxy proxy(connection); + * proxy.setService("org.freedesktop.DBus"); // who we work with + * proxy.setPath("/org/freedesktop/DBus"); // which object inside the peer work with + * proxy.setInterface("org.freedesktop.DBus"); // which of its interfaces we will use + * + * // call the "ListNames" method. It returns an array of string, in TQt3 terms + * // a TQStringList, it expects no parameters + * + * TQValueList<TQT_DBusData> params; + * TQT_DBusMessage reply = proxy.sendWithReply("ListNames", params); + * + * if (reply.type() != TQT_DBusMessage::ReplyMessage) + * qFatal("Call failed"); + * + * if (reply.count() != 1 || reply[0].type() != TQT_DBusData::List) + * qFatal("Unexpected reply"); + * + * bool ok = false; + * TQStringList names = reply[0].toTQStringList(&ok); + * + * if (!ok) qFatal("Unexpected reply"); + * + * for (TQStringList::iterator it = names.begin(); it != names.end(); ++it) + * { + * qDebug("%s", (*it).local8Bit().data()); + * } + * + * return 0; + * } + * @endcode + * + * @section dbusclient-initialization Program initialization + * + * A connection to the bus is acquired using TQT_DBusConnection::sessionBus() + * + * Next, a proxy is created for the object @c "/org/freedesktop/DBus" with + * interface @c "org.freedesktop.DBus" on the service @c "org.freedesktop.DBus" + * + * This is a proxy for the message bus itself. + * + * @section dbusclient-methodcall Method invocation + * + * There are two choices for method invocation: + * - sychronous (blocking) calls + * - asynchronous (non-blocking) calls + * + * @subsection dbusclient-synccall Synchronous method calls + * + * As seen in the example code above, a synchronous method call can be achieved + * by TQT_DBusProxy::sendWithReply(). It sends a method call to the remote object, + * and blocks until reply is received. The outgoing arguments are specified as + * a list of TQT_DBusData. + * + * @subsection dbusclient-asynccall Asynchronous method calls + * + * To invoke a method asynchronously, connect the proxy's signal + * TQT_DBusProxy::asyncReply(int, const TQT_DBusMessage&) to a suitable slot like + * with any other TQt Signal-Slot connection. + * + * Then call TQT_DBusProxy::sendWithAsyncReply() + * It returns a numerical identifier of the call, so it can be related in the + * slot once the result is available. + * + * The slot's first argument is the reveived reply's call identifier as + * returned by the method call. The second parameter is the reply message + * similar to the one in the synchronous call. + * + * @note For asynchronous calls you'll need a running event loop, i.e. a + * TQApplication object and its exec() having been invoked. + * + * @section dbusclient-signals Connecting to D-Bus signals + * + * To receive D-BUS signals just connect to the TQT_DBusProxy's signal + * TQT_DBusProxy::dbusSignal(const TQT_DBusMessage&) + * + * It will be emitted whenever a D-Bus signal message is received from the peer + * object. + * Filtering of signals is based on the value set for @c service, @c path and + * @c interface + * + * @note Filtering for @c service will only happen if @c service is a unique + * D-Bus name, i.e. if it starts with a colon @c ":" since D-Bus signals + * carry the sender's unique name and filtering by a requested name + * would reject all signals + * + * Usually a proxy will be also be used to send to the peer object, thus having + * them all set. However if a proxy is only needed for signals, any of the + * three properties can be omitted (e.g. set to @c TQString() ), in which + * case only the available properties will be checked against the respective + * message field when deciding about dropping or emitting the message. + * See TQT_DBusProxy::handleDBusSignal() + * + * If you want all signal travelling on the bus, or apply filtering for + * different criteria, e.g. get all signals coming from interfaces starting + * with @c "org.", use @c TQT_DBusConnection::connect() instead. + * The signature of the slot stays the same. + * + * @subsection dbusclient-signals-example Signal example + * + * First declare a receiver class: + * @code + * class MyReceiver : public TQObject + * { + * TQ_OBJECT + * public slots: + * void handleDBusSignal(const TQT_DBusMessage&); + * }; + * @endcode + * Then somewhere else in a source file: + * @code + * TQT_DBusConnection connection = TQT_DBusConnection::sessionBus(); + * + * MyReceiver* receiver1 = new MyReceiver(); + * + * connection.connect(receiver1, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&))); + * @endcode + * @c receiver1 will get all signals on this connection + * + * @code + * TQT_DBusProxy* proxy = new TQT_DBusProxy(connection); + * proxy->setService("org.freedesktop.DBus"); // who we work with + * proxy->setPath("/org/freedesktop/DBus"); // which object inside the peer work with + * proxy->setInterface("org.freedesktop.DBus"); // which of its interfaces we will use + * + * MyReceiver* receiver2 = new MyReceiver(); + * + * TQObject::connect(proxy, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)), + * receiver2, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&))); + * @endcode + * @c receiver2 will only get signals coming from the proxy's peer interface + */ + +/** + * @include example-client.h + * @example example-client.cpp + */ + +#include <tqobject.h> + +#include "tqdbusmacros.h" + +class TQT_DBusConnection; +class TQT_DBusData; +class TQT_DBusError; +class TQT_DBusMessage; + +template <class T> class TQValueList; + +/** + * @brief Client interface to a remote service object + * + * TQT_DBusProxy provides a convenience interface for working with D-Bus services, + * or more precisely, interfaces of D-Bus service objects. + * + * A D-Bus service object is identified through the name of its host application + * on the bus and its path (logical location) within the host application. + * Such a service object can implement any number of interfaces, i.e. groups + * methods and signals, and can create a TQT_DBusProxy instance for every one + * your application needs to work with. + * + * See section @ref dbusclient for documentation on how to use TQT_DBusProxy + */ +class TQDBUS_EXPORT TQT_DBusProxy : public TQObject +{ + Q_OBJECT + TQ_OBJECT +public: + /** + * @brief Creates a proxy without binding it to a service or connection + * + * This basic constructor allows to create a proxy and specify the peer + * object and interface later on. + * + * @param tqparent TQObject tqparent + * @param name TQObject name + */ + TQT_DBusProxy(TQObject* tqparent = 0, const char* name = 0); + + /** + * @brief Creates a proxy on a given connection without binding it to a + * service + * + * Similar to the above constructor, it does not yet specify and details + * about the proxy's peer, but already specifies which connection to work + * on. + * + * This can be useful to monitor all signal on a connection without + * filtering for a specific peer. + * + * @param connection the D-Bus connection to work on + * @param tqparent TQObject tqparent + * @param name TQObject name + */ + TQT_DBusProxy(const TQT_DBusConnection& connection, TQObject* tqparent = 0, + const char* name = 0); + + /** + * @brief Creates a proxy for a given peer on a given connection + * + * This creates a proxy for a specific peer object-interface combination + * It is equvalent to creating an "empty" proxy and calling setConnection(), + * setService(), setPath() and setInterface() manually. + * + * @param service the name the peer's host application uses on the bus + * @param path the peer object's path within its host application + * @param interface the interface to work with + * @param connection the D-Bus connection to work on + * @param tqparent TQObject tqparent + * @param name TQObject name + */ + TQT_DBusProxy(const TQString& service, const TQString& path, + const TQString& interface, const TQT_DBusConnection& connection, + TQObject* tqparent = 0, const char* name = 0); + + /** + * @brief Destroys the proxy instance + */ + virtual ~TQT_DBusProxy(); + + /** + * @brief Sets the D-Bus connection to work on + * + * Disconnects from any previously used connection and connects + * to the new connection's signal distribution. + * If no peer information has been provided at creation time or through + * the other set methods, the instance's signal dbusSignal() will emit + * all signals received on the given connection. + * + * @param connection the D-Bus connection to work on + * + * @return @c true if connecting to the new connection's signal succeeded, + * @c false if it failed, e.g. if the connection is a "null" + * connection + * + * @see connection() + * @see setService() + * @see setPath() + * @see setInterface() + */ + bool setConnection(const TQT_DBusConnection& connection); + + /** + * @brief Returns the currently used D-Bus connection + * + * @see setConnection() + */ + const TQT_DBusConnection& connection() const; + + /** + * @brief Sets the peer's service name + * + * A non-empty service name is required if the proxy is to be used for + * method calls. See section @ref dbusconventions-servicename for details. + * + * If a string other than @c TQString() is set, it will be used to + * filter signals, i.e. a signal received by the proxy will only be emitted + * if the service name matches. + * + * @param service the peer's name on the bus + * + * @see service() + * @see setPath() + * @see setInterface() + */ + void setService(const TQString& service); + + /** + * @brief Returns the peer's service name + * + * @return the peer object's service name + * + * @see setService() + */ + TQString service() const; + + /** + * @brief Sets the peer's object path + * + * A non-empty object path is required if the proxy is to be used for + * method calls. See section @ref dbusconventions-objectpath for details. + * + * If a string other than @c TQString() is set, it will be used to + * filter signals, i.e. a signal received by the proxy will only be emitted + * if the object path matches. + * + * @param path the peer's object path inside its host application + * (logical address) + * + * @see path() + * @see setService() + * @see setInterface() + */ + void setPath(const TQString& path); + + /** + * @brief Returns the peer's object path + * + * @return the peer object's path + * + * @see setPath() + */ + TQString path() const; + + /** + * @brief Sets the name of the peer interface + * + * A non-empty interface name is required if the proxy is to be used for + * method calls. See section @ref dbusconventions-interfacename for + * details. + * + * If a string other than @c TQString() is set, it will be used to + * filter signals, i.e. a signal received by the proxy will only be emitted + * if the interface name matches. + * + * @param interface the peer's interface to work with + * + * @see interface() + * @see setService() + * @see setPath() + */ + void setInterface(const TQString& interface); + + /** + * @brief Returns the name of the peer interface + * + * @return the peer object's interface + * + * @see setInterface() + */ + TQString interface() const; + + /** + * @brief Returns whether the proxy can be used to send method calls + * + * The capabilitly to send method calls depends on having all necessary + * base information: + * - Service name, see setService() + * - Object path, see setPath() + * - Interface, see setInterface() + * + * and a working connection, see setConnection() + * + * @return @c true if method calls can be sent, @c false if any of the three + * base information is missing or if the connection is not connected + * + * @see send() + * @see sendWithReply() + * @see sendWithAsyncReply() + */ + bool canSend() const; + + /** + * @brief Sends a method call to the peer object + * + * This is roughly equivalent to calling a C++ method with no return value + * or like ignoring the it. + * + * @param method the name of the method to invoke + * @param params the method parameters. Use an empty list if the method + * does not require parameters + * + * @return @c true if sending succeeded, @c false if sending failed, + * the method name was empty or any of the conditions for + * successfull sending as described for canSend() are not met + * + * @see lastError() + * @see sendWithReply() + * @see sendWithAsyncReply() + * @see @ref dbusconventions-membername + */ + bool send(const TQString& method, const TQValueList<TQT_DBusData>& params) const; + + /** + * @brief Sends a method call to the peer object and waits for the reply + * + * This is roughly equivalent to calling a C++ method on a local object. + * + * @param method the name of the method to invoke + * @param params the method parameters. Use an empty list if the method + * does not require parameters + * @param error optional parameter to get any error directly + * + * @return a TQT_DBusMessage containing any return values of the invoked method. + * Will be an invalid message if an error occurs. The error can be + * accessed through the optional paramater @p error or through + * lastError() + * + * @see canSend() + * @see send() + * @see sendWithAsyncReply() + * @see @ref dbusconventions-membername + */ + TQT_DBusMessage sendWithReply(const TQString& method, + const TQValueList<TQT_DBusData>& params, TQT_DBusError* error = 0) const; + + /** + * @brief Sends a method call to the peer object but does not wait for an + * answer + * + * This is roughly equivalent to calling a C++ method on a local TQt + * event loop driven object, where the result of the method call is + * delivered later through a signal. + * + * @note as with TQt's asychronous classes this needs a running event loop + * + * @param method the name of the method to invoke + * @param params the method parameters. Use an empty list if the method + * does not require parameters + * + * @return a serial number to easily identify the reply once it is received + * or 0 if the call is not possible, i.e. the method name is empty + * or any of the conditions for canSend() are not met + * + * @warning if a asynchronous call is followed by a synchronous call, e.g. + * using sendWithReply(), without returning to the event loop, + * is recommended to call TQT_DBusConnection::scheduleDispatch() + * after the synchronous call to make sure any reply received + * during the blocking call is delivered + * + * @see asyncReply() + * @see send() + * @see sendWithReply() + * @see @ref dbusconventions-membername + */ + int sendWithAsyncReply(const TQString& method, const TQValueList<TQT_DBusData>& params); + + /** + * @brief Returns the last error seen by the proxy + * + * The last error can a connection error, e.g. sending a message failed due + * connection being lost, or the error of the last call to sendWithReply or + * the error of the last received asyncReply() + * + * @return the last dbus error seen by this proxy + */ + TQT_DBusError lastError() const; + +signals: + /** + * @brief Signal emitted for D-Bus signals from the peer + * + * Signals received on the proxy's connection are filtered by + * handleDBusSignal() for all proxy properties that are not empty. + * + * @param message the signal's content + * + * @see TQT_DBusMessage::SignalMessage + */ + void dbusSignal(const TQT_DBusMessage& message); + + /** + * @brief Signal emitted for received replies to asynchronous method calls + * + * If a method invoked by using sendWithAsyncReply() send a response, e.g. + * method return value or errors, this signal is emitted to notify the + * proxy's user. + * + * @param callID the method call's serial number as returned by + * sendWithAsyncReply() + * @param message the reply's content + * + * @see handleAsyncReply() + * @see TQT_DBusMessage::replySerialNumber() + */ + void asyncReply(int callID, const TQT_DBusMessage& message); + +protected slots: + /** + * @brief Handles D-Bus signals received on the proxy's connection + * + * The base implementation checks each non-empty property, i.e. service + * name, object path and interface, with the respective field of the + * signal's D-Bus message. + * + * If all available matches succeed, the message is emitted by + * dbusSignal(), otherwise it is discarded. + * + * @note Filtering for @c service will only happen if @c service is a + * unique D-Bus name, i.e. if it starts with a colon @c ":" since + * D-Bus signals carry the sender's unique name and filtering by a + * requested name would reject all signals. + * + * @param message the D-Bus signal message as received + * + * @see TQT_DBusMessage::SignalMessage + */ + virtual void handleDBusSignal(const TQT_DBusMessage& message); + + /** + * @brief Handles replies to asynchronous method calls + * + * The base implementation simply extracts the reply's error and makes + * it available for lastError(). It then emits asyncReply() + * + * @param message the D-Bus reply message as received + * + * @see TQT_DBusMessage::replySerialNumber() + */ + virtual void handleAsyncReply(const TQT_DBusMessage& message); + +private: + class Private; + Private* d; + +private: + TQT_DBusProxy(const TQT_DBusProxy&); + TQT_DBusProxy& operator=(const TQT_DBusProxy&); +}; + +#endif + diff --git a/main/dependencies/dbus-tqt/tqdbusserver.cpp b/main/dependencies/dbus-tqt/tqdbusserver.cpp new file mode 100644 index 000000000..628fdc9aa --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusserver.cpp @@ -0,0 +1,60 @@ +/* qdbusserver.cpp + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#include "tqdbusserver.h" +#include "tqdbusconnection_p.h" + +TQT_DBusServer::TQT_DBusServer(const TQString &addr, TQObject *tqparent) + : TQObject(tqparent) +{ + d = new TQT_DBusConnectionPrivate(this); + + if (addr.isEmpty()) + return; + + d->setServer(dbus_server_listen(addr.utf8().data(), &d->error)); +} + +bool TQT_DBusServer::isConnected() const +{ + return d->server && dbus_server_get_is_connected(d->server); +} + +TQT_DBusError TQT_DBusServer::lastError() const +{ + return d->lastError; +} + +TQString TQT_DBusServer::address() const +{ + TQString addr; + if (d->server) { + char *c = dbus_server_get_address(d->server); + addr = TQString::fromUtf8(c); + dbus_free(c); + } + + return addr; +} + +#include "tqdbusserver.moc" diff --git a/main/dependencies/dbus-tqt/tqdbusserver.h b/main/dependencies/dbus-tqt/tqdbusserver.h new file mode 100644 index 000000000..eec27b19e --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusserver.h @@ -0,0 +1,53 @@ +/* qdbusserver.h TQT_DBusServer object + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSSERVER_H +#define TQDBUSSERVER_H + +#include "tqdbusmacros.h" +#include <tqobject.h> + +class TQString; + +class TQT_DBusConnectionPrivate; +class TQT_DBusError; + + +class TQDBUS_EXPORT TQT_DBusServer: public TQObject +{ + Q_OBJECT + TQ_OBJECT +public: + TQT_DBusServer(const TQString &address, TQObject *tqparent = 0); + + bool isConnected() const; + TQT_DBusError lastError() const; + TQString address() const; + +private: + TQT_DBusServer(const TQT_DBusServer&); + TQT_DBusServer& operator=(const TQT_DBusServer&); + TQT_DBusConnectionPrivate *d; +}; + +#endif diff --git a/main/dependencies/dbus-tqt/tqdbusvariant.h b/main/dependencies/dbus-tqt/tqdbusvariant.h new file mode 100644 index 000000000..11c0ec58e --- /dev/null +++ b/main/dependencies/dbus-tqt/tqdbusvariant.h @@ -0,0 +1,120 @@ +/* qdbusvariant.h DBUS variant struct + * + * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +#ifndef TQDBUSVARIANT_H +#define TQDBUSVARIANT_H + +#include "tqdbusmacros.h" +#include "tqdbusdata.h" + +#include <tqstring.h> + +/** + * @brief Data type for representing a D-Bus variant + * + * When D-Bus methods or signal require that a paramater can have any of the + * D-Bus data types, a D-Bus variant can be used. + * + * Basically a D-Bus variant includes the actual data and a D-Bus data signature + * to allow a receiver to determine the contents. + * + * Since the TQT_DBusVariant's #value member will already be fully de-marshalled, + * a receiver using this bindings can savely ignore the signature if it doesn't + * need it for a different purpose (e.g. logging). + * + * However, when creating a TQT_DBusVariant object for sending, make sure the + * #signature member is correctly setup, for example by using the #value + * member's buildDBusSignature() method. + * + * @code + * TQT_DBusVariant variant; + * + * variant.value = TQT_DBusData::fromInt32(131719); + * variant.signature = variant.value.buildDBusSignature(); + * @endcode + */ +class TQDBUS_EXPORT TQT_DBusVariant +{ +public: + /** + * @brief Creates an empty variant object + */ + TQT_DBusVariant() {} + + /** + * @brief Copies the given @p other variant object + * + * @param other the variant object to copy from + */ + TQT_DBusVariant(const TQT_DBusVariant& other) + { + signature = other.signature; + value = other.value; + } + + /** + * @brief Checks if the given @p other variant is equal to this one + * + * @param other the variant object to compare with + * + * @return @c true if both #signature and #value are equal, otherwise + * @c false + */ + inline bool operator==(const TQT_DBusVariant& other) const + { + if (&other == this) return true; + + return signature == other.signature && value == other.value; + } + + /** + * @brief Checks if the given @p other variant is not equal to this one + * + * @param other the variant object to compare with + * + * @return @c true if either #signature or #value is different, otherwise + * @c false + */ + inline bool operator!=(const TQT_DBusVariant& other) const + { + if (&other == this) return false; + + return signature != other.signature || value != other.value; + } + +public: + /** + * @brief The D-Bus data signature of the data contained in #value + * + * @see TQT_DBusData::buildDBusSignature() + */ + TQString signature; + + /** + * @brief The D-Bus data type to transport as a variant + */ + TQT_DBusData value; +}; + +#endif + |