summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormueller <mueller@afe2bf4a-e733-0410-8a33-86f594647bc7>1999-12-15 19:29:47 (GMT)
committermueller <mueller@afe2bf4a-e733-0410-8a33-86f594647bc7>1999-12-15 19:29:47 (GMT)
commitdaf91dc906e217e81f77f491e0abf505a91289b8 (patch)
tree223d088e44a6b0956dd0437ed4851244b2e7f36c
parenta6cb7ef1dc7c3d6b6ff949646b9b2deda3fc0bf3 (diff)
downloadDoxygen-daf91dc906e217e81f77f491e0abf505a91289b8.zip
Doxygen-daf91dc906e217e81f77f491e0abf505a91289b8.tar.gz
Doxygen-daf91dc906e217e81f77f491e0abf505a91289b8.tar.bz2
mods for doxygen-0.49-990728
-rw-r--r--INSTALL30
-rw-r--r--LICENSE483
-rw-r--r--Makefile7
-rw-r--r--Makefile.config2
-rw-r--r--README4
-rw-r--r--doc/Doxyfile4
-rw-r--r--doc/commands.doc4
-rw-r--r--doc/config.doc18
-rw-r--r--doc/doxygen_manual.tex2
-rw-r--r--doc/doxysearch_usage.doc15
-rw-r--r--doc/faq.doc49
-rw-r--r--doc/index.doc26
-rw-r--r--doc/language.doc264
-rw-r--r--doc/starting.doc118
-rw-r--r--examples/Makefile6
-rw-r--r--examples/example.cfg1
-rw-r--r--examples/example.tag2
-rw-r--r--examples/resdefine.cfg6
-rw-r--r--examples/resdefine.cpp21
-rw-r--r--examples/templ.cpp10
-rw-r--r--src/Makefile2
-rw-r--r--src/classdef.cpp169
-rw-r--r--src/classdef.h35
-rw-r--r--src/code.h4
-rw-r--r--src/code.l55
-rw-r--r--src/config.h124
-rw-r--r--src/config.l603
-rw-r--r--src/constexp.h6
-rw-r--r--src/constexp.l4
-rw-r--r--src/debug.cpp7
-rw-r--r--src/declinfo.h18
-rw-r--r--src/declinfo.l59
-rw-r--r--src/defargs.h2
-rw-r--r--src/defargs.l17
-rw-r--r--src/define.cpp2
-rw-r--r--src/define.h18
-rw-r--r--src/definition.cpp13
-rw-r--r--src/definition.h24
-rw-r--r--src/diagram.cpp18
-rw-r--r--src/diagram.h7
-rw-r--r--src/doxygen.cpp929
-rw-r--r--src/doxygen.h15
-rw-r--r--src/doxygen.pro2
-rw-r--r--src/doxysearch.cpp34
-rw-r--r--src/doxytag.l50
-rw-r--r--src/entry.cpp33
-rw-r--r--src/entry.h50
-rw-r--r--src/example.h8
-rw-r--r--src/filedef.cpp53
-rw-r--r--src/filedef.h30
-rw-r--r--src/filename.cpp10
-rw-r--r--src/filename.h3
-rw-r--r--src/formula.cpp15
-rw-r--r--src/formula.h6
-rw-r--r--src/groupdef.cpp3
-rw-r--r--src/groupdef.h8
-rw-r--r--src/htmlgen.cpp66
-rw-r--r--src/htmlgen.h9
-rw-r--r--src/image.cpp107
-rw-r--r--src/index.cpp146
-rw-r--r--src/index.h3
-rw-r--r--src/instdox.cpp11
-rw-r--r--src/language.cpp16
-rw-r--r--src/latexgen.cpp253
-rw-r--r--src/latexgen.h2
-rw-r--r--src/logos.cpp9
-rw-r--r--src/mangen.cpp29
-rw-r--r--src/mangen.h2
-rw-r--r--src/memberdef.cpp51
-rw-r--r--src/memberdef.h44
-rw-r--r--src/memberlist.cpp21
-rw-r--r--src/membername.h8
-rw-r--r--src/message.cpp4
-rw-r--r--src/namespacedef.cpp9
-rw-r--r--src/namespacedef.h20
-rw-r--r--src/outputgen.cpp9
-rw-r--r--src/outputgen.h8
-rw-r--r--src/outputlist.h6
-rw-r--r--src/pre.h15
-rw-r--r--src/pre.l499
-rw-r--r--src/qtbc.h42
-rw-r--r--src/scanner.h8
-rw-r--r--src/scanner.l422
-rw-r--r--src/searchindex.cpp3
-rw-r--r--src/searchindex.h6
-rw-r--r--src/section.h8
-rw-r--r--src/suffixtree.cpp6
-rw-r--r--src/suffixtree.h4
-rw-r--r--src/tag.l33
-rw-r--r--src/translator.h277
-rw-r--r--src/translator_cz.h212
-rw-r--r--src/translator_de.h559
-rw-r--r--src/translator_es.h405
-rw-r--r--src/translator_fr.h216
-rw-r--r--src/translator_it.h499
-rw-r--r--src/translator_jp.h268
-rw-r--r--src/translator_nl.h252
-rw-r--r--src/translator_se.h489
-rw-r--r--src/util.cpp1354
-rw-r--r--src/util.h29
100 files changed, 6753 insertions, 3194 deletions
diff --git a/INSTALL b/INSTALL
index 6a9e9b9..c62f167 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,12 +1,12 @@
-DOXYGEN Version 0.49-990522
+DOXYGEN Version 0.49-990728
INSTALLATION INSTRUCTIONS FOR UNIX:
-----------------------------------
1. Unpack the archive, unless you already have:
- gunzip doxygen-0.49-990522.src.tar.gz # uncompress the archive
- tar xf doxygen-0.49-990522.src.tar # unpack it
+ gunzip doxygen-0.49-990728.src.tar.gz # uncompress the archive
+ tar xf doxygen-0.49-990728.src.tar # unpack it
2. Make sure Qt is installed properly (check the environment variable $QTDIR)
@@ -104,7 +104,7 @@ KNOWN CONFIGURATION PROBLEMS
HTML RELATED PROBLEMS:
- the indent continuously increases.
This seems to be a problem that can be observed with Netscape 4.01.
- It is not present in many later and earlier versions.
+ It is not present in many later and earlier versions I tested.
LATEX RELATED PROBLEMS:
@@ -116,16 +116,32 @@ LATEX RELATED PROBLEMS:
- the file fancyheader.sty is known as fancyhdr.sty on some systems.
Please change that in src/latexgen.cpp
-HP-UX PROBLEMS:
+HP-UX / DIGITAL UNIX PROBLEMS:
- If you are compiling for HP-UX with aCC and you get this error:
/opt/aCC/lbin/ld: Unsatisfied symbols:
alloca (code)
- then you should edit ce_parse.cpp and replace
+ then you should (according to Anke Selig) edit ce_parse.cpp and replace
extern "C" {
void *alloca (unsigned int);
};
with
#include <alloca.h>
+- If you are compiling for Digital Unix, the same problem can be solved
+ (according to Barnard Schmallhof) by replacing the following in
+ ce_parse.cpp:
+
+ #else /* not GNU C. */
+ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) ||
+ defined (__sparc) || defined (__sgi)
+ #include <alloca.h>
+
+ with
+
+ #else /* not GNU C. */
+ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) ||
+ defined (__sparc) || defined (__sgi) || defined (__osf__)
+ #include <alloca.h>
+
This seems to be a problem with bison, but I don't know how to fix it.
-----------------------------------------------------------------------------
@@ -138,4 +154,4 @@ The latest version of doxygen can be obtained at
Enjoy,
-Dimitri van Heesch (22 May 1999)
+Dimitri van Heesch (30 July 1999)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0b643ac
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,483 @@
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, 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 library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, 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 companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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.
+
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
diff --git a/Makefile b/Makefile
index 037c87a..7fb6010 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,11 @@ dgux-g++: src/version.cpp
TMAKEPATH=../tmake/lib/dgux-g++ \
$(MAKE)
+gnu-g++: src/version.cpp
+ cd src; \
+ TMAKEPATH=../tmake/lib/gnu-g++ \
+ $(MAKE)
+
freebsd-g++: src/version.cpp
cd src; \
TMAKEPATH=../tmake/lib/freebsd-g++ \
@@ -170,7 +175,7 @@ ps: docs
archive: clean
$(TAR) zcvf backup/dx`date +%y%m%d`.tgz tmake doc examples bin objects \
src Makefile Makefile.windows INSTALL make.bat Makefile.config \
- LANGUAGE.HOWTO
+ LANGUAGE.HOWTO LICENSE
src/version.cpp: FORCE
echo "char versionString[]=\"$(VERSION)\";" > src/version.cpp
diff --git a/Makefile.config b/Makefile.config
index a10a57b..9dc23f3 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -9,4 +9,4 @@ PERL = perl
# The values below should probably be left unmodified
TAR = tar # name of the GNU tar tool
TMAKE = ../tmake/bin/tmake
-VERSION = 0.49-990522
+VERSION = 0.49-990728
diff --git a/README b/README
index 899040e..d79e9b8 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-DOXYGEN Version 0.49-990522
+DOXYGEN Version 0.49-990728
Please read INSTALL for compilation instructions.
@@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at
Enjoy,
-Dimitri van Heesch (22 May 1999)
+Dimitri van Heesch (30 July 1999)
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 79cbb31..5891572 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -10,11 +10,11 @@ EXTRACT_PRIVATE = NO
GENERATE_LATEX = YES
GENERATE_HTML = YES
ENABLE_PREPROCESSING = NO
-INPUT = index.doc install.doc starting.doc trouble.doc \
+INPUT = index.doc install.doc starting.doc faq.doc trouble.doc \
history.doc features.doc \
doxygen_usage.doc doxytag_usage.doc doxysearch_usage.doc \
installdox_usage.doc autolink.doc \
- config.doc commands.doc htmlcmds.doc
+ config.doc commands.doc htmlcmds.doc language.doc
FILE_PATTERNS = *.cpp *.h *.doc
EXAMPLE_PATH = ../examples
RECURSIVE = NO
diff --git a/doc/commands.doc b/doc/commands.doc
index 48f5c53..5965aaf 100644
--- a/doc/commands.doc
+++ b/doc/commands.doc
@@ -183,6 +183,7 @@ Doxygen. Unrecognized commands are treated as normal text.
\sa section \ref cmdcode "\\code"
<hr>
+
\subsection cmdenum \enum <name>
\addindex \enum
@@ -664,6 +665,7 @@ Doxygen. Unrecognized commands are treated as normal text.
\sa
Section \ref cmdpage "\\page" for an example of the \\cmdsection command.
+
<hr>
\subsection cmdsubsection \subsection <subsection-name> (subsection title)
@@ -677,6 +679,7 @@ Doxygen. Unrecognized commands are treated as normal text.
\sa
Section \ref cmdpage "\\page" for an example of the \\cmdsubsection command.
+
<hr>
<h2>\htmlonly <center> --- \endhtmlonly
@@ -1054,7 +1057,6 @@ Doxygen. Unrecognized commands are treated as normal text.
character has to be escaped because it has a special meaning in HTML.
<hr>
-
<h2>\htmlonly <center> --- \endhtmlonly
Commands included for JavaDoc compatibility
\htmlonly --- </center>\endhtmlonly</h2>
diff --git a/doc/config.doc b/doc/config.doc
index 481925c..2bf3dc7 100644
--- a/doc/config.doc
+++ b/doc/config.doc
@@ -63,6 +63,14 @@ Below is a list of tags that are recognized for each category.
If a relative path is entered, it will be relative to the location
where doxygen was started. If left blank the current directory will be used.
+<dt>\c OUTPUT_LANGUAGE <dd>
+ \addindex OUTPUT_LANGUAGE
+ The \c OUTPUT_LANGUAGE tag is used to specify the language in which all
+ documentation generated by doxygen is written. Doxygen will use this
+ information to generate all constant output in the proper language.
+ The default language is English, other supported languages are:
+ Dutch, French, Italian, Czech, Swedish, German and Japanese.
+
<dt>\c QUIET <dd>
\addindex QUIET
The \c QUIET tag can be used to turn on/off the messages that are generated
@@ -268,6 +276,11 @@ Below is a list of tags that are recognized for each category.
\endverbatim
If the tag is left blank doxygen will generate a
standard header.
+
+ The following commands have a special meaning inside the header:
+ <code>\$title</code>, <code>\$datetime</code>, <code>\$date</code>.
+ Doxygen will replace them by respectively
+ the title of the page, the current date and time, or only the current date.
<dt>\c HTML_FOOTER <dd>
\addindex HTML_FOOTER
@@ -280,6 +293,11 @@ Below is a list of tags that are recognized for each category.
\endverbatim
If the tag is left blank doxygen will generate a standard footer.
+ The following commands have a special meaning inside the footer:
+ <code>\$title</code>, <code>\$datetime</code>, <code>\$date</code>.
+ Doxygen will replace them by respectively
+ the title of the page, the current date and time, or only the current date.
+
</dl>
\subsection latex_output LaTeX related options
diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex
index 8d28a55..bb8d599 100644
--- a/doc/doxygen_manual.tex
+++ b/doc/doxygen_manual.tex
@@ -26,6 +26,7 @@ Written by Dimitri van Heesch\\[2ex]
\part{User Manual}
\input{install}
\input{starting}
+\input{faq}
\input{trouble}
\part{Reference Manual}
\input{features}
@@ -38,5 +39,6 @@ Written by Dimitri van Heesch\\[2ex]
\input{config}
\input{commands}
\input{htmlcmds}
+\input{langhowto}
\printindex
\end{document}
diff --git a/doc/doxysearch_usage.doc b/doc/doxysearch_usage.doc
index a4a3e96..e3b1657 100644
--- a/doc/doxysearch_usage.doc
+++ b/doc/doxysearch_usage.doc
@@ -67,7 +67,7 @@ follow these steps:
documentation. Apart from the documentation, Doxygen will create the
following files:
<ul>
- <li>A small CGI script. the name of the script is determined by the
+ <li>A small shell script. the name of the script is determined by the
\c CGI_NAME tag in the configuration file.
The script is a small wrapper that calls \c doxysearch with
the correct parameters. Using this script allows multiple
@@ -80,6 +80,16 @@ follow these steps:
<li>\c search.gif: this is the image that is used for the search button.
</ul>
+ \par Notice:
+ On the Windows platform Unix shell scripts cannot be used.
+ In fact the HTTP daemon that I tried (apache for Windows) only
+ recognized <code>.cgi</code> files that were renamed
+ executables (so DOS batch files do not seem to work either). Therefore,
+ on Windows a small C program will generated by doxygen.
+ You should compile and link the program with your favourite
+ compiler and change the extension of the executable from
+ <code>.exe</code> to <code>.cgi</code>.
+
<li>Copy (or move) the CGI script to the directory where the CGI binaries
are located.
This is usually a special directory on your system or in your
@@ -112,7 +122,8 @@ This can be done by carefully following these steps:
<li>Goto the html directory of the Qt-distribution:
<pre>cd $QTDIR/html</pre>
<li>Generate the search index by typing:
- <pre>doxytag -s search.idx *.html</pre>
+ <pre>doxytag -s search.idx</pre>
+ in the directory where the HTML files are located.
This will parse all files and build a search index.
Apart from the file <code>search.idx</code> two other files
will be generated: <code>search.gif</code> and <code>search.cgi</code>
diff --git a/doc/faq.doc b/doc/faq.doc
new file mode 100644
index 0000000..c730289
--- /dev/null
+++ b/doc/faq.doc
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ */
+/*! \page faq Frequently Asked Questions
+
+<ol>
+<li><b>How do get information on the index page in HTML?</b>
+<p>
+There is no real support for title pages at the moment. But you can
+override the default index page, by using the following comment block:
+\verbatim
+/*! \page index My Personal Index Page
+ *
+ * This is my index personal index page.
+ */
+\endverbatim
+
+<li><b>How can I avoid that some code fragment is parsed by Doxyen?</b>
+<p>
+You can use Doxygen's preprocessor for this:
+If you put
+\verbatim
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ /* code that must be skipped by Doxygen */
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+\endverbatim
+around the blocks that should be hidden and put:
+\verbatim
+ PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS
+\endverbatim
+in the config file then all blocks should be skipped by Doxygen as long
+as <code>PREPROCESSING = YES</code>.
+</ol>
+*/
+
diff --git a/doc/index.doc b/doc/index.doc
index f60eec9..7db1d27 100644
--- a/doc/index.doc
+++ b/doc/index.doc
@@ -58,10 +58,12 @@ sections.
The first part forms a user manual:
<ul>
-<li>Section \ref install discusses how to download, compile and install
+<li>Section \ref install discusses how to
+ <a href="http://www.stack.nl/~dimitri/doxygen/download.html">download</a>, compile and install
doxygen for your platform.
<li>Section \ref starting tells you how to generate your first piece of
documentation quickly.
+<li>Section \ref faq gives answers to frequently asked questions.
<li>Section \ref trouble tells you what to do when you have problems.
</ul>
@@ -84,8 +86,23 @@ The second part forms a reference manual:
used within the documentation.
<li>Section \ref htmlcmds shows an overview of the HTML commands that
can be used within the documentation.
+<li>Section \ref langhowto explains how to add support for new
+ output languages.
</ul>
+
+<h2>Projects using doxygen</h2>
+
+I have compiled a small
+\htmlonly
+<a href="http://www.stack.nl/~dimitri/doxygen/projects.html">list of projects</a>
+that use doxygen
+\endhtmlonly
+\latexonly
+list of projects that use doxygen (see {\tt http://www.stack.nl/$\sim$dimitri/doxygen/projects.html})
+\endlatexonly
+If you know other projects, let me know and I'll add them.
+
<h2>Acknowledgements</h2>
\addindex acknowledgements
Thanks go to:
@@ -156,9 +173,10 @@ Olaf Meeuwissen,
Feiyi Wang,
Robert J. Clark,
Matthias Baas,
-Walter Mueller, and
-William van Dieten
- for suggestions, patches and bug reports.
+Walter Mueller,
+William van Dieten, and
+Joshua Jensen and
+many others for suggestions, patches and bug reports.
</ul>
*/
diff --git a/doc/language.doc b/doc/language.doc
new file mode 100644
index 0000000..f05dce3
--- /dev/null
+++ b/doc/language.doc
@@ -0,0 +1,264 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ */
+/*! \page langhowto Internationalization
+
+<h3>Support for multiple languages</h3>
+
+Doxygen has support for multiple languages. This means that the text fragments that
+doxygen generates can changed into languages other than English
+(the default) at configuration time.
+<p>
+Currently, supported languages are English, French, Czech, Dutch,
+Swedish, Italian, German and Japanese. A number
+of people have volunteered to add support for other languages as well.
+Here is a list of the languages and their current maintainers:
+<p>
+
+\htmlonly
+<TABLE ALIGN=center CELLSPACING=0 CELLPADDING=0 BORDER=0>
+<TR BGCOLOR="#000000">
+<TD>
+ <TABLE CELLSPACING=1 CELLPADDING=2 BORDER=0>
+ <TR BGCOLOR="#4040c0">
+ <TD ><b><font size=+1 color="#ffffff"> Language </font></b></TD>
+ <TD ><b><font size=+1 color="#ffffff"> Maintainer </font></b></TD>
+ <TD ><b><font size=+1 color="#ffffff"> Contact address </font></b></TD>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ German
+ </TD>
+ <TD>
+ Jens Breitenstein
+ </TD>
+ <TD>
+ <a href="mailto:Jens.Breitenstein@tlc.de">
+ Jens.Breitenstein@tlc.de</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ French
+ </TD>
+ <TD>
+ Christophe Bordeux
+ </TD>
+ <TD>
+ <a href="mailto:bordeux@lig.di.epfl.ch">
+ bordeux@lig.di.epfl.ch</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Swedish
+ </TD>
+ <TD>
+ Samuel Hägglund<BR>
+ XeT Erixon
+ </TD>
+ <TD>
+ <a href="mailto:sahag96@nts.mh.se">
+ sahag96@nts.mh.se</a><br>
+ <a href="mailto:xet@hem.passagen.se">
+ xet@hem.passagen.se</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Czech
+ </TD>
+ <TD>
+ Vlastimil Havran
+ </TD>
+ <TD>
+ <a href="mailto:havran@fel.cvut.cz">
+ havran@fel.cvut.cz</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Romanian
+ </TD>
+ <TD>
+ Ionutz Borcoman
+ </TD>
+ <TD>
+ <a href="mailto:borco@borco-ei.eng.hokudai.ac.jp">
+ borco@borco-ei.eng.hokudai.ac.jp</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Polish
+ </TD>
+ <TD>
+ Piotr Piatkowski
+ </TD>
+ <TD>
+ <a href="mailto:kompas@ceti.com.pl">
+ kompas@ceti.com.pl</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Italian
+ </TD>
+ <TD>
+ Ahmed Aldo Faisal<br>
+ Alessandro Falappa
+ </TD>
+ <TD>
+ <a href="mailto:aaf23@cam.ac.uk">
+ aaf23@cam.ac.uk</a><br>
+ <a href="mailto:a.falappa@flashnet.it">
+ a.falappa@flashnet.it</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Japanese
+ </TD>
+ <TD>
+ Kenji Nagamatsu
+ </TD>
+ <TD>
+ <a href="mailto:naga@joyful.club.ne.jp">
+ naga@joyful.club.ne.jp</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Spanish
+ </TD>
+ <TD>
+ Francisco Oltra Thennet
+ </TD>
+ <TD>
+ <a href="mailto:foltra@puc.cl">
+ foltra@puc.cl</a>
+ </TD>
+ </TR>
+ <TR BGCOLOR="#ffffff">
+ <TD>
+ Dutch
+ </TD>
+ <TD>
+ Dimitri van Heesch
+ </TD>
+ <TD>
+ <a href="mailto:dimitri@stack.nl">
+ dimitri@stack.nl</a>
+ </TD>
+ </TR>
+ </TABLE>
+</TD>
+</TR>
+</TABLE>
+\endhtmlonly
+\latexonly
+\begin{tabular}{|l|l|l|}
+ \hline
+ {\bf Language} & {\bf Maintainer} & {Contact address} \\
+ \hline
+ German & Jens Breitenstein & {\tt Jens.Breitenstein@tlc.de} \\
+ \hline
+ French & Christophe Bordeux & {\tt bordeux@lig.di.epfl.ch} \\
+ \hline
+ Swedish & Samuel Hägglund & {\tt sahag96@nts.mh.se} \\
+ & XeT Erixon & {\tt xet@hem.passagen.se} \\
+ \hline
+ Czech & Vlastimil Havran & {\tt havran@fel.cvut.cz} \\
+ \hline
+ Romanian & Ionutz Borcoman & {\tt borco@borco-ei.eng.hokudai.ac.jp} \\
+ \hline
+ Polish & Piotr Piatkowski & {\tt kompas@ceti.com.pl} \\
+ \hline
+ Italian & Ahmed Aldo Faisal & {\tt aaf23@cam.ac.uk} \\
+ & Alessandro Falappa & {\tt a.falappa@flashnet.it} \\
+ \hline
+ Japanese & Kenji Nagamatsu & {\tt naga@joyful.club.ne.jp} \\
+ \hline
+ Spanish & Francisco Oltra Thennet & {\tt foltra@puc.cl} \\
+ \hline
+ Dutch & Dimitri van Heesch & {\tt dimitri@stack.nl} \\
+ \hline
+\end{tabular}
+\endlatexonly
+<p>
+
+Most people on the list have indicated that they were also busy
+doing other things, so if you want to help to speed things up please
+let them (or me) know.
+
+If you want to add support for a language that is not yet listed
+please see the next section.
+
+<h3>Language HOWTO</h3>
+
+This short HOWTO explains how to add support for a new language to Doxygen:
+
+Just follow these steps:
+<ol>
+<li>Tell me for which language you want to add support. If no one else
+ is already working on support for that language, you will be
+ assigned as the maintainer for the language.
+<li>Create a copy of translator_nl.h and name it
+ translator_<your_2_letter_counter_code>.h
+ I'll use xx in the rest of this document.
+<li>Edit language.cpp:
+ Add a
+\verbatim
+#include<translator_xx.h>
+\endverbatim
+ in <code>setTranslator()</code> add
+\verbatim
+ else if (L_EQUAL("your_language_name"))
+ {
+ theTranslator = new TranslatorYourLanguage;
+ }
+\endverbatim
+ after the <code>if { ... }</code>
+<li>Edit doxygen.pro and add \c translator_xx.h to
+ the \c HEADERS line in the file doxygen.pro.
+<li>Edit <code>translator_xx.h</code>:
+ <ul>
+ <li>Rename <code>TRANSLATOR_NL_H</code> to <code>TRANSLATOR_XX_H</code> twice.
+ <li>Rename TranslatorDutch to TranslatorYourLanguage
+ <li>In the member <code>latexBabelPackage()</code> change "dutch" into the name of the
+ latex package that adds support for your language.
+ <li>Edit all the strings that are returned by the members that start
+ with tr.
+ Look at the corresponding member in translator.h for the english text
+ that is returned and translate that into your language.
+ Try to match punctuation and capitals!
+ To enter special characters (with accents) you can:
+ <ul>
+ <li> Enter them directly if your keyboard supports that and you are
+ using a Latin-1 font.
+ Doxygen will translate the characters to proper Latex and
+ leave the Html and man output for what it is.
+ <li> Use html codes like \&auml; for an a with an umlaut (i.e. &auml;).
+ See the HTML specification for the codes.
+ </ul>
+ </ul>
+<li>Recompile everything (do this from the root of the distribution,
+ because the Makefile.dox* have to be regenerated!)
+<li>Now you can use <code>OUTPUT_LANGUAGE = your_language_name</code>
+ in the config file to generate output in your language.
+<li>Send <code>translator_xx.h</code> or a <code>diff -u</code> of the changes
+ to me so I can add it to doxygen.
+</ol>
+*/
+
diff --git a/doc/starting.doc b/doc/starting.doc
index 1d3cbcd..78f9309 100644
--- a/doc/starting.doc
+++ b/doc/starting.doc
@@ -397,6 +397,122 @@ from typos in formulas. It may have to be necessary to remove the
file formula.repository that is written in the html directory to
a rid of an incorrect formula
+\subsection preprocessing Preprocessing
+
+Source files that are used as input to doxygen can be parsed by doxygen's
+build-in C-preprocessor.
+
+By default doxygen does only partial preprocessing. That is, it
+evaluates conditional compilation statements (like \#if) and
+evaluates macro definitions, but is does not perform macro expansion.
+
+So if you have the following code fragment
+\verbatim
+#define VERSION 200
+#define CONST_STRING const char *
+
+#if VERSION >= 200
+ static CONST_STRING version = "2.xx";
+#else
+ static CONST_STRING version = "1.xx";
+#endif
+\endverbatim
+
+Then by default doxygen will feed the following to its parser:
+
+\verbatim
+#define VERSION
+#define CONST_STRING
+
+ static CONST_STRING version = "1.xx";
+\endverbatim
+
+You can disable all preprocessing by setting \c ENABLE_PREPROCESSING to \c
+NO in the configuation file. In the case above doxygen will then read
+both statements!
+
+In case you want to expand the \c CONST_STRING macro, you should set the
+\c MACRO_EXPANSION tag in the config file to \c YES. Then the result
+after preprocessing becomes:
+
+\verbatim
+#define VERSION
+#define CONST_STRING
+
+ static const char * version = "1.xx";
+\endverbatim
+
+Notice that doxygen will now expand \e all macro definitions
+(recursively if needed). This is often too much, therefore doxygen also
+allows you to expand only those defines that you explicitly
+specify. For this you have to set the \c EXPAND_ONLY_PREDEF tag to \c YES
+and specify the macro definitions after the \c PREDEFINED tag.
+
+As an example, suppose you have the following obfusciated code fragment
+of an abstract base class called \c IUnknown:
+
+\verbatim
+/*! A reference to an IID */
+#ifdef __cplusplus
+#define REFIID const IID &
+#else
+#define REFIID const IID *
+#endif
+
+/*! The IUnknown interface */
+DECLARE_INTERFACE(IUnknown)
+{
+ MEMBER(HRESULT,QueryInterface) (THIS_ REFIID iid, void **ppv) PURE;
+ MEMBER(ULONG,AddRef) (THIS) PURE;
+ MEMBER(ULONG,Release) (THIS) PURE;
+};
+\endverbatim
+
+without macro expansion doxygen will get confused, but we may not want to
+expand the REFIID macro, because it is documented and the user that reads
+the documentation should use it when implementing the interface.
+
+By setting the following in the config file:
+
+\verbatim
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+PREDEFINED = "DECLARE_INTERFACE(name)=class name" \
+ "MEMBER(result,name)=virtual result name" \
+ "PURE= = 0" \
+ THIS_= \
+ THIS= \
+ __cplusplus
+\endverbatim
+
+we can make sure that the proper result is fed to doxygen's parser:
+\verbatim
+/*! A reference to an IID */
+#define REFIID
+
+/*! The IUnknown interface */
+class IUnknown
+{
+ virtual HRESULT QueryInterface ( REFIID iid, void **ppv) = 0;
+ virtual ULONG AddRef () = 0;
+ virtual ULONG Release () = 0;
+};
+\endverbatim
+
+Notice that the \c PREDEFINED tag accepts function like macro definitions
+(like \c DECLARE_INTERFACE), normal macro substitutions (like \c PURE
+and \c THIS) and plain defines (like \c __cplusplus).
+
+Notice also that preprocessor definitions that are normally defined
+automatically by the preprocessor (like \c __cplusplus), have to be defined
+by hand with doxygen's parser (this is done because these defines
+are often platform/compiler specific).
+
+As you can see doxygen's preprocessor is quite powerful, but if you want
+even more flexibility you can always write an input filter and specify it on
+the \c INPUT_FILTER flag.
+
\subsection moreinfo More information
\addindex QdbtTabular
@@ -405,7 +521,7 @@ the documentation of QdbtTabular</a> \latexonly
({\tt http://www.stack.nl/$\sim$dimitri/qdbttabular/html})\endlatexonly.
\htmlonly
I hope that was clear. If not, please let me know, so I can improve this document. If you have problems
-take a look at the <a href="trouble.html">troubleshooting</a> section.
+take a look at the <a href="faq.html">faq</a> and the <a href="trouble.html">troubleshooting</a> sections.
\endhtmlonly
*/
diff --git a/examples/Makefile b/examples/Makefile
index dd97c2c..1bbc2c1 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -17,7 +17,6 @@ all: class/html/index.html \
jdstyle/html/index.html \
structcmd/html/index.html \
autolink/html/index.html \
- resdefine/html/index.html \
restypedef/html/index.html \
afterdoc/html/index.html \
template/html/index.html \
@@ -26,7 +25,7 @@ all: class/html/index.html \
clean:
rm -rf class define enum file func page relates author \
par overload example include qtstyle jdstyle structcmd \
- autolink tag resdefine restypedef afterdoc template
+ autolink tag restypedef afterdoc template
class/html/index.html: class.h class.cfg
$(DOXYDIR)/doxygen class.cfg
@@ -81,9 +80,6 @@ tag/html/index.html: tag.cpp tag.cfg
sed -e "1,1s.perl.$(PERL).g" tag/html/installdox >tag/html/installdox.perl
cd tag/html ; $(PERL) installdox.perl -lexample.tag@../../example/html
-resdefine/html/index.html: resdefine.cpp resdefine.cfg
- $(DOXYDIR)/doxygen resdefine.cfg
-
restypedef/html/index.html: restypedef.cpp restypedef.cfg
$(DOXYDIR)/doxygen restypedef.cfg
diff --git a/examples/example.cfg b/examples/example.cfg
index a30b3ff..dc4cb86 100644
--- a/examples/example.cfg
+++ b/examples/example.cfg
@@ -1,5 +1,6 @@
PROJECT_NAME = "Example Command"
OUTPUT_DIRECTORY = example
+GENERATE_TAGFILE = example.tag
GENERATE_LATEX = NO
GENERATE_MAN = NO
INPUT = example.cpp
diff --git a/examples/example.tag b/examples/example.tag
index 3998b90..d30de7b 100644
--- a/examples/example.tag
+++ b/examples/example.tag
@@ -1,2 +1,2 @@
->Test:
+>Test: "class_test.html"
example a0 "()"
diff --git a/examples/resdefine.cfg b/examples/resdefine.cfg
deleted file mode 100644
index 009a4e8..0000000
--- a/examples/resdefine.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-PROJECT_NAME = "Resolving Defines"
-OUTPUT_DIRECTORY = resdefine
-GENERATE_LATEX = NO
-GENERATE_MAN = NO
-INPUT = resdefine.cpp
-QUIET = YES
diff --git a/examples/resdefine.cpp b/examples/resdefine.cpp
deleted file mode 100644
index 05a77c5..0000000
--- a/examples/resdefine.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#define ExportedName InternalName
-
-class InternalName
-{
- public:
- InternalName() {}
- ~InternalName() {}
-};
-
-/*! \class ExportedName
- * This class's real name is InternalName but everyone should use
- * ExportedName.
- */
-
-/*! \fn ExportedName::ExportedName()
- * The constructor
- */
-
-/*! \fn ExportedName::~ExportedName()
- * The destructor
- */
diff --git a/examples/templ.cpp b/examples/templ.cpp
index c838c6e..3250abc 100644
--- a/examples/templ.cpp
+++ b/examples/templ.cpp
@@ -1,10 +1,10 @@
+
/*! A template class */
template<class T,int i=100> class Test
{
public:
Test();
Test(const Test &);
- friend void friendTempFunc(Test &, int=5);
};
/*! complete specialization */
@@ -15,7 +15,7 @@ template<> class Test<void *,200>
};
/*! A partial template specialization */
-template<class T> class Test< T * > : public Test<void *,200>
+template<class T> class Test<T *> : public Test<void *,200>
{
public:
Test();
@@ -27,11 +27,9 @@ template<class T,int i> Test<T,i>::Test() {}
/*! The copy constructor */
template<class T,int i> Test<T,i>::Test(const Test<T,i> &t) {}
-/*! A friend function of a template class */
-template<class T,int i> void friendTempFunc(Test<T,i> &t,int a) {}
+/*! The constructor of the partial specilization */
+template<class T> Test<T *>::Test() {}
/*! The constructor of the specilization */
template<> Test<void *,200>::Test() {}
-/*! The constructor of the partial specilization */
-template<class T> Test<T*>::Test() {}
diff --git a/src/Makefile b/src/Makefile
index e57994c..9812d37 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -39,6 +39,6 @@ clean:
$(MAKE) -f Makefile.doxysearch clean
-rm -f scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \
ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp \
- declinfo.cpp defargs.cpp version.cpp
+ declinfo.cpp defargs.cpp
FORCE:
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 50cd54c..005a397 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -29,9 +29,9 @@
#include "diagram.h"
#include "language.h"
-static QString stripExtension(const char *fName)
+static QCString stripExtension(const char *fName)
{
- QString result=fName;
+ QCString result=fName;
if (result.right(5)==".html") result=result.left(result.length()-5);
return result;
}
@@ -47,7 +47,7 @@ ClassDef::ClassDef(const char *nm,CompoundType ct,const char *ref,const char *fN
fileName="class_"+nameToFile(nm);
if (ref)
{
- //url=(QString)"doxygen=\""+ref+":\" href=\""+fileName;
+ //url=(QCString)"doxygen=\""+ref+":\" href=\""+fileName;
exampleList = 0;
exampleDict = 0;
}
@@ -105,7 +105,7 @@ void ClassDef::insertMember(const MemberDef *md)
//printf("adding %s::%s\n",name(),md->name());
if (!reference)
{
- if (md->isRelated() && (extractPrivateFlag || md->protection()!=Private))
+ if (md->isRelated() && (Config::extractPrivateFlag || md->protection()!=Private))
{
related.append(md);
}
@@ -152,7 +152,7 @@ void ClassDef::insertMember(const MemberDef *md)
}
}
// check if we should add this member in the `all members' list
- if (md->isFriend() || md->protection()!=Private || extractPrivateFlag)
+ if (md->isFriend() || md->protection()!=Private || Config::extractPrivateFlag)
{
MemberInfo *mi = new MemberInfo((MemberDef *)md,Public,Normal);
MemberNameInfo *mni=0;
@@ -220,8 +220,8 @@ static void writeInheritanceSpecifier(OutputList &ol,BaseClassDef *bcd)
void ClassDef::writeDocumentation(OutputList &ol)
{
// write title
- QString pageTitle=name().copy();
- QString pageType;
+ QCString pageTitle=name().copy();
+ QCString pageType;
switch(compType)
{
case Class: pageType=" Class"; break;
@@ -257,12 +257,12 @@ void ClassDef::writeDocumentation(OutputList &ol)
if (incFile)
{
- QString nm=incName.copy();
+ QCString nm=incName.copy();
if (incName.isNull()) nm=incFile->name();
ol.startTypewriter();
ol.docify("#include <");
ol.disable(OutputGenerator::Man);
- if (verbatimHeaderFlag)
+ if (Config::verbatimHeaderFlag)
{
ol.writeObjectLink(0,fileName+"-include",0,nm);
}
@@ -279,9 +279,9 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.newParagraph();
}
- if (genTagFile.length()>0) tagFile << ">" << name() << ":";
+ if (Config::genTagFile.length()>0) tagFile << ">" << name() << ":";
- if (classDiagramFlag) ol.disableAllBut(OutputGenerator::Man);
+ if (Config::classDiagramFlag) ol.disableAllBut(OutputGenerator::Man);
// write superclasses
int count;
@@ -289,7 +289,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
{
//parseText(ol,theTranslator->trInherits()+" ");
- QString inheritLine = theTranslator->trInheritsList(inherits->count());
+ QCString inheritLine = theTranslator->trInheritsList(inherits->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
// now replace all markers in inheritLine with links to the classes
@@ -304,7 +304,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ClassDef *cd=bcd->classDef;
if (cd->hasDocumentation() || cd->isReference())
{
- if (genTagFile.length()>0) tagFile << cd->getOutputFileBase() << "?";
+ if (Config::genTagFile.length()>0) tagFile << cd->getOutputFileBase() << "?";
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()+bcd->templSpecifiers);
}
else
@@ -320,41 +320,14 @@ void ClassDef::writeDocumentation(OutputList &ol)
}
parseText(ol,inheritLine.right(inheritLine.length()-index));
ol.newParagraph();
-
-#if 0
- BaseClassDef *bcd=inherits->first();
- while (bcd)
- {
- ClassDef *cd=bcd->classDef;
- if (cd->hasDocumentation() || cd->isReference())
- {
- if (genTagFile.length()>0) tagFile << cd->classFile() << "?";
- ol.writeObjectLink(cd->getReference(),cd->classFile(),0,cd->name()+bcd->templSpecifiers);
- }
- else
- {
- ol.docify(cd->name());
- }
- writeInheritanceSpecifier(ol,bcd);
- bcd=inherits->next();
- if (bcd)
- {
- if (inherits->at()==count-1)
- parseText(ol," "+theTranslator->trAnd()+" ");
- else
- ol.writeString(", ");
- }
- }
- ol.writeString(".");
-#endif
}
- if (genTagFile.length()>0) tagFile << " \"" << fileName << ".html\"\n";
+ if (Config::genTagFile.length()>0) tagFile << " \"" << fileName << ".html\"\n";
// write subclasses
if ((count=inheritedBy->count())>0)
{
- QString inheritLine = theTranslator->trInheritedByList(inheritedBy->count());
+ QCString inheritLine = theTranslator->trInheritedByList(inheritedBy->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
// now replace all markers in inheritLine with links to the classes
@@ -381,37 +354,9 @@ void ClassDef::writeDocumentation(OutputList &ol)
}
parseText(ol,inheritLine.right(inheritLine.length()-index));
ol.newParagraph();
-
-#if 0
- parseText(ol,theTranslator->trInheritedBy()+" ");
- BaseClassDef *bcd=inheritedBy->first();
- while (bcd)
- {
- ClassDef *cd=bcd->classDef;
- if (cd->hasDocumentation() || cd->isReference())
- {
- ol.writeObjectLink(cd->getReference(),cd->classFile(),0,cd->name());
- }
- else
- {
- ol.docify(cd->name());
- }
- writeInheritanceSpecifier(ol,bcd);
- bcd=inheritedBy->next();
- if (bcd)
- {
- if (inheritedBy->at()==count-1)
- parseText(ol," "+theTranslator->trAnd()+" ");
- else
- ol.writeString(", ");
- }
- }
- ol.writeString(".");
- ol.newParagraph();
-#endif
}
- if (classDiagramFlag) ol.enableAll();
+ if (Config::classDiagramFlag) ol.enableAll();
count=0;
BaseClassDef *ibcd;
@@ -419,23 +364,17 @@ void ClassDef::writeDocumentation(OutputList &ol)
while (ibcd)
{
ClassDef *icd=ibcd->classDef;
- if (//(icd->protection()!=Private || extractPrivateFlag) &&
- //(icd->hasDocumentation() || !hideClassFlag || icd->isReference())
- icd->isVisibleExt()
- ) count++;
+ if ( icd->isVisibleExt()) count++;
ibcd=inheritedBy->next();
}
ibcd=inherits->first();
while (ibcd)
{
ClassDef *icd=ibcd->classDef;
- if (//(icd->protection()!=Private || extractPrivateFlag) &&
- //(icd->hasDocumentation() || !hideClassFlag | icd->isReference())
- icd->isVisibleExt()
- ) count++;
+ if ( icd->isVisibleExt()) count++;
ibcd=inherits->next();
}
- if (classDiagramFlag && count>0)
+ if (Config::classDiagramFlag && count>0)
// write class diagram
{
ClassDiagram diagram(this); // create a diagram of this class.
@@ -465,7 +404,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDecs(ol,this,0,0,theTranslator->trProtectedMembers(),0,&proMembers);
writeMemberDecs(ol,this,0,0,theTranslator->trProtectedSlots(),0,&proSlots);
writeMemberDecs(ol,this,0,0,theTranslator->trStaticProtectedMembers(),0,&proStaticMembers);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDecs(ol,this,0,0,theTranslator->trPrivateMembers(),0,&priMembers);
writeMemberDecs(ol,this,0,0,theTranslator->trPrivateSlots(),0,&priSlots);
@@ -491,10 +430,28 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader();
parseText(ol,theTranslator->trDetailedDescription());
ol.endGroupHeader();
- if (tempArgs) // class is a template
+
+ ArgumentList *al=0;
+ int ti;
+ ClassDef *pcd=0;
+ int pi=0;
+ // find the outer most class scope
+ while ((ti=name().find("::",pi))!=-1 &&
+ (pcd=getClass(name().left(ti)))==0
+ ) pi=ti+2;
+
+ if (pcd)
+ {
+ al=pcd->templateArguments();
+ }
+ else
+ {
+ al=tempArgs;
+ }
+
+ if (al) // class is a template
{
ol.startSubsubsection();
- ArgumentList *al=tempArgs;
ol.docify("template<");
Argument *a=al->first();
while (a)
@@ -554,7 +511,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
signals.countDocMembers();
if ( pubMembers.typedefCount() + proMembers.typedefCount() +
- (extractPrivateFlag ? priMembers.typedefCount() : 0 )
+ (Config::extractPrivateFlag ? priMembers.typedefCount() : 0 )
)
{
ol.writeRuler();
@@ -564,7 +521,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDocs(ol,&pubMembers,name(),MemberDef::Typedef);
writeMemberDocs(ol,&proMembers,name(),MemberDef::Typedef);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDocs(ol,&priMembers,name(),MemberDef::Typedef);
}
@@ -572,7 +529,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
if (pubMembers.enumCount() +
proMembers.enumCount() +
- ( extractPrivateFlag ? priMembers.enumCount() : 0 )
+ ( Config::extractPrivateFlag ? priMembers.enumCount() : 0 )
)
{
ol.writeRuler();
@@ -582,7 +539,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDocs(ol,&pubMembers,name(),MemberDef::Enumeration);
writeMemberDocs(ol,&proMembers,name(),MemberDef::Enumeration);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDocs(ol,&priMembers,name(),MemberDef::Enumeration);
}
@@ -590,7 +547,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
if (pubMembers.enumValueCount() +
proMembers.enumValueCount() +
- ( extractPrivateFlag ? priMembers.enumValueCount() : 0 )
+ ( Config::extractPrivateFlag ? priMembers.enumValueCount() : 0 )
)
{
ol.writeRuler();
@@ -600,7 +557,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDocs(ol,&pubMembers,name(),MemberDef::EnumValue);
writeMemberDocs(ol,&proMembers,name(),MemberDef::EnumValue);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDocs(ol,&priMembers,name(),MemberDef::EnumValue);
}
@@ -610,7 +567,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
pubStaticMembers.funcCount() +
proMembers.funcCount() + proSlots.funcCount() +
proStaticMembers.funcCount() +
- (extractPrivateFlag ?
+ (Config::extractPrivateFlag ?
priMembers.funcCount() + priSlots.funcCount() +
priStaticMembers.funcCount() : 0
)
@@ -628,7 +585,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDocs(ol,&proMembers,name(),MemberDef::Function);
writeMemberDocs(ol,&proSlots,name(),MemberDef::Slot);
writeMemberDocs(ol,&proStaticMembers,name(),MemberDef::Function);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDocs(ol,&priMembers,name(),MemberDef::Function);
writeMemberDocs(ol,&priSlots,name(),MemberDef::Slot);
@@ -636,7 +593,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
}
}
- if ( friends.count() + related.count() )
+ if ( friends.friendCount() + related.count() )
{
ol.writeRuler();
ol.startGroupHeader();
@@ -649,7 +606,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
if ( pubMembers.varCount() + pubStaticMembers.varCount() +
proMembers.varCount() + proStaticMembers.varCount() +
- (extractPrivateFlag ?
+ (Config::extractPrivateFlag ?
priMembers.varCount() + priStaticMembers.varCount() : 0
)
)
@@ -663,7 +620,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
writeMemberDocs(ol,&pubStaticMembers,name(),MemberDef::Variable);
writeMemberDocs(ol,&proMembers,name(),MemberDef::Variable);
writeMemberDocs(ol,&proStaticMembers,name(),MemberDef::Variable);
- if (extractPrivateFlag)
+ if (Config::extractPrivateFlag)
{
writeMemberDocs(ol,&priMembers,name(),MemberDef::Variable);
writeMemberDocs(ol,&priStaticMembers,name(),MemberDef::Variable);
@@ -691,13 +648,13 @@ void ClassDef::writeDocumentation(OutputList &ol)
}
ol.writeListItem();
- QString path=fd->getPath().copy();
- if (fullPathNameFlag)
+ QCString path=fd->getPath().copy();
+ if (Config::fullPathNameFlag)
{
// strip part of the path
- if (path.left(stripFromPath.length())==stripFromPath)
+ if (path.left(Config::stripFromPath.length())==Config::stripFromPath)
{
- path=path.right(path.length()-stripFromPath.length());
+ path=path.right(path.length()-Config::stripFromPath.length());
}
ol.docify(path);
}
@@ -723,7 +680,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader();
parseText(ol,theTranslator->trAuthor());
ol.endGroupHeader();
- parseText(ol,theTranslator->trGeneratedAutomatically(projectName));
+ parseText(ol,theTranslator->trGeneratedAutomatically(Config::projectName));
ol.enableAll();
endFile(ol);
@@ -776,7 +733,7 @@ void ClassDef::writeMemberList(OutputList &ol)
if (cd && !md->name().isEmpty() && md->name()[0]!='@' &&
(
md->isFriend() ||
- (mi->prot!=Private && (protect!=Private || extractPrivateFlag))
+ (mi->prot!=Private && (protect!=Private || Config::extractPrivateFlag))
)
)
{
@@ -784,7 +741,7 @@ void ClassDef::writeMemberList(OutputList &ol)
if (cd->isVisible() && (md->hasDocumentation() || md->isReference()))
// create a link to the documentation
{
- QString name=mi->ambiguityResolutionScope+md->name();
+ QCString name=mi->ambiguityResolutionScope+md->name();
ol.writeListItem();
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
md->anchor(),name);
@@ -801,7 +758,7 @@ void ClassDef::writeMemberList(OutputList &ol)
ol.writeString("\n");
memberWritten=TRUE;
}
- else if (!hideMemberFlag) // no documentation,
+ else if (!Config::hideMemberFlag) // no documentation,
// generate link to the class instead.
{
ol.writeListItem();
@@ -874,7 +831,7 @@ void ClassDef::writeIncludeFile(OutputList &ol)
ol.disableAllBut(OutputGenerator::Html);
startFile(ol,fileName+"-include",name()+" Include File");
startTitle(ol);
- QString n=incName.copy();
+ QCString n=incName.copy();
if (incName.isNull()) n=incFile->name();
parseText(ol,n);
endTitle(ol,0);
@@ -917,7 +874,7 @@ bool ClassDef::hasExamples()
// write the list of all examples that are use this class.
void ClassDef::writeExample(OutputList &ol)
{
- QString exampleLine=theTranslator->trWriteList(exampleList->count());
+ QCString exampleLine=theTranslator->trWriteList(exampleList->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
@@ -970,9 +927,9 @@ void ClassDef::setTemplateArguments(ArgumentList *al)
}
}
-QString ClassDef::getTemplateNameString()
+QCString ClassDef::getTemplateNameString()
{
- QString result;
+ QCString result;
if (!tempArgs || tempArgs->count()==0) return result;
result="<";
Argument *a=tempArgs->first();
diff --git a/src/classdef.h b/src/classdef.h
index d5fc466..dd24b69 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -17,11 +17,11 @@
#ifndef CLASSDEF_H
#define CLASSDEF_H
-#include <qstring.h>
+//#include <qtstream.h>
+#include "qtbc.h"
#include <qfileinf.h>
#include <qlist.h>
#include <qdict.h>
-#include <qtstream.h>
#include <qstrlist.h>
#include "membername.h"
@@ -51,8 +51,8 @@ class ClassDef : public Definition
ClassDef(const char *name,CompoundType ct,const char *ref=0,const char *fName=0);
~ClassDef();
- //QString classFile() const { return fileName; }
- QString getOutputFileBase() const { return fileName; }
+ //QCString classFile() const { return fileName; }
+ QCString getOutputFileBase() const { return fileName; }
CompoundType compoundType() const { return compType; }
const char *memberListFileName() const { return memListFileName; }
void insertBaseClass(ClassDef *,Protection p,Specifier s,const char *t=0);
@@ -81,34 +81,35 @@ class ClassDef : public Definition
Protection protection() const { return prot; }
bool isVisible()
{ return !name().isEmpty() && name().at(0)!='@' &&
- (prot!=Private || extractPrivateFlag) &&
+ (prot!=Private || Config::extractPrivateFlag) &&
hasDocumentation();
}
bool hasNonReferenceSuperClass();
bool isVisibleExt()
- { return (allExtFlag || hasNonReferenceSuperClass()) &&
+ { return (Config::allExtFlag || hasNonReferenceSuperClass()) &&
!name().isEmpty() && name().at(0)!='@' &&
- (prot!=Private || extractPrivateFlag) &&
- (hasDocumentation() || !hideClassFlag || !reference.isNull());
+ (prot!=Private || Config::extractPrivateFlag) &&
+ (hasDocumentation() || !Config::hideClassFlag ||
+ !reference.isNull());
}
// template argument functions
ArgumentList *templateArguments() const { return tempArgs; }
void setTemplateArguments(ArgumentList *al);
- QString getTemplateNameString();
+ QCString getTemplateNameString();
void setNamespace(NamespaceDef *nd) { nspace = nd; }
NamespaceDef *getNamespace() { return nspace; }
bool visited;
private:
- //QString name; // name of the class
- QString fileName; // HTML containing the class docs
- //QString doc; // general class documentation
+ //QCString name; // name of the class
+ QCString fileName; // HTML containing the class docs
+ //QCString doc; // general class documentation
FileDef *incFile; // header file to refer to
- QString incName; // alternative include file name
- //QString brief; // brief class discription
- QString memListFileName;
+ QCString incName; // alternative include file name
+ //QCString brief; // brief class discription
+ QCString memListFileName;
BaseClassList *inherits;
BaseClassList *inheritedBy;
NamespaceDef *nspace; // the namespace this class is in
@@ -128,7 +129,7 @@ class ClassDef : public Definition
MemberNameInfoDict *allMemberNameInfoDict;
ArgumentList *tempArgs;
QStrList files;
- QString reference;
+ QCString reference;
ExampleList *exampleList;
ExampleDict *exampleDict;
CompoundType compType;
@@ -143,7 +144,7 @@ struct BaseClassDef
ClassDef *classDef;
Protection prot;
Specifier virt;
- QString templSpecifiers;
+ QCString templSpecifiers;
};
class BaseClassList : public QList<BaseClassDef>
diff --git a/src/code.h b/src/code.h
index 4b781fb..bf67df6 100644
--- a/src/code.h
+++ b/src/code.h
@@ -17,12 +17,12 @@
#ifndef CODE_H
#define CODE_H
+#include "qtbc.h"
#include <stdio.h>
-#include <qstring.h>
class OutputList;
-extern void parseCode(OutputList &,const char *,const QString &,
+extern void parseCode(OutputList &,const char *,const QCString &,
bool ,const char *);
extern void initParseCodeContext();
#endif
diff --git a/src/code.l b/src/code.l
index dd5ec0c..beafeca 100644
--- a/src/code.l
+++ b/src/code.l
@@ -24,8 +24,7 @@
#include <assert.h>
#include <ctype.h>
-#include <qstring.h>
-
+#include "qtbc.h"
#include "scanner.h"
#include "entry.h"
#include "doxygen.h"
@@ -47,7 +46,7 @@ class CodeClassDef
}
~CodeClassDef() {}
- QString name;
+ QCString name;
QStrList bases;
};
@@ -63,9 +62,9 @@ class CodeVarDef
}
~CodeVarDef() {}
- QString name;
- QString type;
- QString classScope;
+ QCString name;
+ QCString type;
+ QCString classScope;
};
typedef QList<CodeClassDef> CodeClassList;
@@ -91,19 +90,19 @@ static int bracketCount = 0;
static int curlyCount = 0;
static int sharpCount = 0;
static int yyLineNr = 0;
-static QString type;
-static QString name;
-static QString args;
-static QString parmType;
-static QString parmName;
+static QCString type;
+static QCString name;
+static QCString args;
+static QCString parmType;
+static QCString parmName;
static bool inClass;
-static QString classScope;
+static QCString classScope;
static OutputList *code;
static CodeClassDef ccd;
static CodeVarDef cvd;
static bool exampleBlock;
-static QString exampleName;
-static QString exampleFile;
+static QCString exampleName;
+static QCString exampleFile;
static int anchorCount;
static void addType()
@@ -125,9 +124,9 @@ static void addParmType()
parmName.resize(0) ;
}
-static void setClassScope(const QString &name)
+static void setClassScope(const QCString &name)
{
- QString n=name;
+ QCString n=name;
n=n.simplifyWhiteSpace();
int index;
if ((index=n.find("::"))!=-1)
@@ -165,14 +164,14 @@ static void addParameter()
static void generateClassLink(OutputList &ol,const char *clName)
{
- QString className=clName;
+ QCString className=clName;
if (className.length()==0) return;
ClassDef *cd;
if ((cd=getClass(className)) && cd->isVisible())
{
if (exampleBlock)
{
- QString anchor;
+ QCString anchor;
anchor.sprintf("_a%d",anchorCount);
//printf("addExampleClass(%s,%s,%s)\n",anchor.data(),exampleName.data(),
// exampleFile.data());
@@ -200,16 +199,16 @@ static bool getLink(const char *className,
ClassDef *cd;
FileDef *fd;
NamespaceDef *nd;
- QString m=memberName;
- QString c=className;
+ QCString m=memberName;
+ QCString c=className;
//printf("Trying `%s'::`%s'\n",c.data(),m.data());
- if (getDefs(m,c,"()",md,cd,fd,nd) &&
+ if (getDefs(c,m,"()",md,cd,fd,nd) &&
(md->hasDocumentation() || md->isReference()))
{
//printf("Found!\n");
if (exampleBlock)
{
- QString anchor;
+ QCString anchor;
anchor.sprintf("a%d",anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),exampleName.data(),
// exampleFile.data());
@@ -339,6 +338,8 @@ static int yyread(char *buf,int max_size)
ID [a-z_A-Z][a-z_A-Z0-9]*
+%option noyywrap
+
%x SkipString
%x SkipCPP
%x SkipComment
@@ -380,7 +381,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
code->codify(yytext);
}
char c=yyinput();
- QString text;
+ QCString text;
text+=c;
code->codify(text);
BEGIN( Body );
@@ -663,7 +664,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
}
<SkipSpecialComment>[ \t]*"*/"[ \t\n]*"\n"/"/*" {
//code->codify("\n");
- QString lineText=yytext;
+ QCString lineText=yytext;
yyLineNr+=lineText.contains('\n');
BEGIN( lastDContext ) ;
}
@@ -700,7 +701,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
code->codify(yytext);
}
<*>([ \t\n]*"\n"){2,} { // combine multiple blank lines
- QString sepLine=yytext;
+ QCString sepLine=yytext;
code->codify("\n\n");
yyLineNr+=sepLine.contains('\n');
}
@@ -723,7 +724,7 @@ void initParseCodeContext()
anchorCount = 0;
}
-void parseCode(OutputList &ol,const char *className,const QString &s,
+void parseCode(OutputList &ol,const char *className,const QCString &s,
bool e, const char *exName)
{
code = new OutputList(&ol);
@@ -752,6 +753,6 @@ void parseCode(OutputList &ol,const char *className,const QString &s,
}
extern "C" { // some bogus code to keep the compiler happy
- int codeYYwrap() { return 1 ; }
+// int codeYYwrap() { return 1 ; }
void codeYYdummy() { yy_flex_realloc(0,0); }
}
diff --git a/src/config.h b/src/config.h
index 492f356..d2bec11 100644
--- a/src/config.h
+++ b/src/config.h
@@ -17,66 +17,78 @@
#ifndef CONFIG_H
#define CONFIG_H
-#include <qstring.h>
+#ifndef DOXYWIZARD
+#include "qtbc.h"
+#endif
#include <qstrlist.h>
#include <qfile.h>
-extern void parseConfig(const QString &config);
+extern void parseConfig(const QCString &config);
extern void writeTemplateConfig(QFile *f,bool shortList);
+extern void checkConfig();
+
+struct Config
+{
+ static void init();
-extern QString projectName; // the name of the project
-extern QString projectNumber; // the number of the project
-extern QString htmlOutputDir; // the directory to put the HTML files
-extern QString latexOutputDir; // the directory to put the Latex files
-extern QString manOutputDir; // the directory to put the man pages
-extern QString headerFile; // the name of the personal HTML header
-extern QString footerFile; // the name of the personal HTML footer
-extern QString cgiName; // the name of the CGI binary
-extern QString cgiURL; // the absolute URL to the CGI binary
-extern QString docURL; // the absolute URL to the documentation
-extern QString binAbsPath; // the absolute path to the doxysearch
-extern QString docAbsPath; // the absolute path to the documentation
-extern QString perlPath; // the absolute path to perl
-extern QString genTagFile; // the tag file to generate
-extern QString inputFilter; // a filter command that is applied to input files
-extern QString paperType; // the page type to generate docs for
-extern QString stripFromPath; // the string to strip from the file path
-extern QString manExtension; // extension the man page files
-extern QStrList includePath; // list of include paths
-extern QStrList examplePath; // list of example paths
-extern QStrList inputSources; // list of input files
-extern QStrList excludeSources; // list of files to exclude from the input
-extern QStrList filePatternList; // list of file patterns
-extern QStrList excludePatternList; // list of patterns to exclude from input
-extern QStrList tagFileList; // list of tag files
-extern QStrList extDocPathList; // list of external doc. directories.
-extern QStrList predefined; // list of predefined macro names.
-extern QStrList extraPackageList; // list of extra LaTeX packages.
-extern bool quietFlag; // generate progress messages flag
-extern bool warningFlag; // generate warnings flag
-extern bool recursiveFlag; // scan directories recursively
-extern bool allExtFlag; // include all external classes flag
-extern bool searchEngineFlag; // generate search engine flag
-extern bool extractAllFlag; // gererate docs for all classes flag
-extern bool extractPrivateFlag; // generate docs for private members flag
-extern bool noIndexFlag; // generate condensed index flag
-extern bool generateHtml; // generate HTML output
-extern bool generateLatex; // generate Latex output
-extern bool generateMan; // generate Man pages
-extern bool preprocessingFlag; // enable preprocessing
-extern bool briefMemDescFlag; // enable `inline' brief member descr.
-extern bool hideMemberFlag; // hide undocumented members.
-extern bool hideClassFlag; // hide undocumented members.
-extern bool searchIncludeFlag; // search for included files
-extern bool macroExpansionFlag; // expand macros in the source.
-extern bool onlyPredefinedFlag; // expand only predefined macros
-extern bool fullPathNameFlag; // using full path name in output
-extern bool classDiagramFlag; // enable the generation of class diagrams.
-extern bool compactLatexFlag; // generate compact LaTeX documentation.
-extern bool repeatBriefFlag; // repeat brief descriptions.
-extern bool internalDocsFlag; // determines what happens to internal docs.
-extern bool caseSensitiveNames; // determines if output can be mixed case.
-extern bool verbatimHeaderFlag; // enable/disable generation of verb headers.
-extern bool htmlAlignMemberFlag; // align members in HTML using tables.
+ static QCString projectName; // the name of the project
+ static QCString projectNumber; // the number of the project
+ static QCString outputDir; // the global output directory
+ static QCString htmlOutputDir; // the directory to put the HTML files
+ static QCString latexOutputDir; // the directory to put the Latex files
+ static QCString manOutputDir; // the directory to put the man pages
+ static QCString outputLanguage; // the output language
+ static QCString headerFile; // the name of the personal HTML header
+ static QCString footerFile; // the name of the personal HTML footer
+ static QCString cgiName; // the name of the CGI binary
+ static QCString cgiURL; // the absolute URL to the CGI binary
+ static QCString docURL; // the absolute URL to the documentation
+ static QCString binAbsPath; // the absolute path to the doxysearch
+ static QCString docAbsPath; // the absolute path to the documentation
+ static QCString perlPath; // the absolute path to perl
+ static QCString genTagFile; // the tag file to generate
+ static QCString inputFilter; // a filter command that is applied to input files
+ static QCString paperType; // the page type to generate docs for
+ static QCString stripFromPath; // the string to strip from the file path
+ static QCString manExtension; // extension the man page files
+ static QStrList includePath; // list of include paths
+ static QStrList examplePath; // list of example paths
+ static QStrList inputSources; // list of input files
+ static QStrList excludeSources; // list of files to exclude from the input
+ static QStrList filePatternList; // list of file patterns
+ static QStrList excludePatternList; // list of patterns to exclude from input
+ static QStrList tagFileList; // list of tag files
+ static QStrList extDocPathList; // list of external doc. directories.
+ static QStrList predefined; // list of predefined macro names.
+ static QStrList extraPackageList; // list of extra LaTeX packages.
+ static bool quietFlag; // generate progress messages flag
+ static bool warningFlag; // generate warnings flag
+ static bool recursiveFlag; // scan directories recursively
+ static bool allExtFlag; // include all external classes flag
+ static bool searchEngineFlag; // generate search engine flag
+ static bool extractAllFlag; // gererate docs for all classes flag
+ static bool extractPrivateFlag; // generate docs for private members flag
+ static bool noIndexFlag; // generate condensed index flag
+ static bool generateHtml; // generate HTML output
+ static bool generateLatex; // generate Latex output
+ static bool generateMan; // generate Man pages
+ static bool preprocessingFlag; // enable preprocessing
+ static bool briefMemDescFlag; // enable `inline' brief member descr.
+ static bool hideMemberFlag; // hide undocumented members.
+ static bool hideClassFlag; // hide undocumented members.
+ static bool searchIncludeFlag; // search for included files
+ static bool macroExpansionFlag; // expand macros in the source.
+ static bool onlyPredefinedFlag; // expand only predefined macros
+ static bool fullPathNameFlag; // using full path name in output
+ static bool classDiagramFlag; // enable the generation of class diagrams.
+ static bool compactLatexFlag; // generate compact LaTeX documentation.
+ static bool repeatBriefFlag; // repeat brief descriptions.
+ static bool internalDocsFlag; // determines what happens to internal docs.
+ static bool caseSensitiveNames; // determines if output can be mixed case.
+ static bool verbatimHeaderFlag; // enable/disable generation of verb headers.
+ static bool htmlAlignMemberFlag; // align members in HTML using tables.
+ static bool includeSourceFlag; // include source code in documentation.
+ static bool autoBriefFlag; // javadoc comments behaves as Qt comments.
+};
#endif
diff --git a/src/config.l b/src/config.l
index 0545f32..57897e9 100644
--- a/src/config.l
+++ b/src/config.l
@@ -24,17 +24,36 @@
#include <assert.h>
#include <ctype.h>
-#include <qstring.h>
#include <qfileinf.h>
#include <qdir.h>
#include <qtstream.h>
-#include "doxygen.h"
#include "config.h"
+#include "version.h"
+
+#ifdef DOXYWIZARD
+#include <stdarg.h>
+void err(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+void warn(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+#else
+#include "doxygen.h"
#include "message.h"
#include "pre.h"
#include "version.h"
#include "language.h"
+#endif
#define YY_NEVER_INTERACTIVE 1
@@ -43,62 +62,65 @@
* exported variables
*/
-QString projectName;
-QString projectNumber;
-QString outputDir;
-QString htmlOutputDir;
-QString latexOutputDir;
-QString manOutputDir;
-QString headerFile;
-QString footerFile;
-QString cgiName;
-QString cgiURL;
-QString docURL;
-QString binAbsPath;
-QString docAbsPath;
-QString perlPath;
-QString genTagFile;
-QString inputFilter;
-QString paperType;
-QString outputLanguage;
-QString stripFromPath;
-QString manExtension;
-QStrList includePath;
-QStrList examplePath;
-QStrList inputSources;
-QStrList excludeSources;
-QStrList filePatternList;
-QStrList excludePatternList;
-QStrList tagFileList;
-QStrList extDocPathList;
-QStrList predefined;
-QStrList extraPackageList;
-bool quietFlag = FALSE;
-bool warningFlag = FALSE;
-bool recursiveFlag = FALSE;
-bool allExtFlag = FALSE;
-bool searchEngineFlag = FALSE;
-bool extractAllFlag = FALSE;
-bool extractPrivateFlag = FALSE;
-bool noIndexFlag = FALSE;
-bool hideMemberFlag = FALSE;
-bool hideClassFlag = FALSE;
-bool macroExpansionFlag = FALSE;
-bool onlyPredefinedFlag = FALSE;
-bool fullPathNameFlag = FALSE;
-bool compactLatexFlag = FALSE;
-bool internalDocsFlag = FALSE;
-bool caseSensitiveNames = FALSE;
-bool generateHtml = TRUE;
-bool generateLatex = TRUE;
-bool generateMan = TRUE;
-bool preprocessingFlag = TRUE;
-bool briefMemDescFlag = TRUE;
-bool searchIncludeFlag = TRUE;
-bool classDiagramFlag = TRUE;
-bool repeatBriefFlag = TRUE;
-bool verbatimHeaderFlag = TRUE;
-bool htmlAlignMemberFlag = TRUE;
+
+QCString Config::projectName;
+QCString Config::projectNumber;
+QCString Config::outputDir;
+QCString Config::htmlOutputDir;
+QCString Config::latexOutputDir;
+QCString Config::manOutputDir;
+QCString Config::outputLanguage;
+QCString Config::headerFile;
+QCString Config::footerFile;
+QCString Config::cgiName;
+QCString Config::cgiURL;
+QCString Config::docURL;
+QCString Config::binAbsPath;
+QCString Config::docAbsPath;
+QCString Config::perlPath;
+QCString Config::genTagFile;
+QCString Config::inputFilter;
+QCString Config::paperType;
+QCString Config::stripFromPath;
+QCString Config::manExtension;
+QStrList Config::includePath;
+QStrList Config::examplePath;
+QStrList Config::inputSources;
+QStrList Config::excludeSources;
+QStrList Config::filePatternList;
+QStrList Config::excludePatternList;
+QStrList Config::tagFileList;
+QStrList Config::extDocPathList;
+QStrList Config::predefined;
+QStrList Config::extraPackageList;
+bool Config::quietFlag = FALSE;
+bool Config::recursiveFlag = FALSE;
+bool Config::allExtFlag = FALSE;
+bool Config::searchEngineFlag = FALSE;
+bool Config::extractAllFlag = FALSE;
+bool Config::extractPrivateFlag = FALSE;
+bool Config::noIndexFlag = FALSE;
+bool Config::hideMemberFlag = FALSE;
+bool Config::hideClassFlag = FALSE;
+bool Config::macroExpansionFlag = FALSE;
+bool Config::onlyPredefinedFlag = FALSE;
+bool Config::fullPathNameFlag = FALSE;
+bool Config::compactLatexFlag = FALSE;
+bool Config::internalDocsFlag = FALSE;
+bool Config::caseSensitiveNames = FALSE;
+bool Config::includeSourceFlag = FALSE;
+bool Config::autoBriefFlag = TRUE;
+bool Config::warningFlag = TRUE;
+bool Config::generateHtml = TRUE;
+bool Config::generateLatex = TRUE;
+bool Config::generateMan = TRUE;
+bool Config::preprocessingFlag = TRUE;
+bool Config::briefMemDescFlag = TRUE;
+bool Config::searchIncludeFlag = TRUE;
+bool Config::classDiagramFlag = TRUE;
+bool Config::repeatBriefFlag = TRUE;
+bool Config::verbatimHeaderFlag = TRUE;
+bool Config::htmlAlignMemberFlag = TRUE;
/* -----------------------------------------------------------------
*
@@ -108,13 +130,13 @@ bool htmlAlignMemberFlag = TRUE;
static const char * inputString;
static int inputPosition;
static int yyLineNr;
-static QString tmpString;
-static QString * s=0;
+static QCString tmpString;
+static QCString * s=0;
static bool * b=0;
static QStrList * l=0;
static int lastState;
static int lastEnvState;
-static QString elemStr;
+static QCString elemStr;
/* -----------------------------------------------------------------
*/
@@ -134,6 +156,8 @@ static int yyread(char *buf,int max_size)
%}
+%option noyywrap
+
%x Start
%x SkipComment
%x GetString
@@ -146,62 +170,64 @@ static int yyread(char *buf,int max_size)
<*>\0x0d
<Start,GetString,GetStrList,GetBool>"#" { BEGIN(SkipComment); }
-<Start>"PROJECT_NAME"[ \t]*"=" { BEGIN(GetString); s=&projectName; }
-<Start>"PROJECT_NUMBER"[ \t]*"=" { BEGIN(GetString); s=&projectNumber; }
-<Start>"OUTPUT_DIRECTORY"[ \t]*"=" { BEGIN(GetString); s=&outputDir; }
-<Start>"HTML_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&htmlOutputDir; }
-<Start>"MAN_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&manOutputDir; }
-<Start>"LATEX_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&latexOutputDir; }
-<Start>"HTML_HEADER"[ \t]*"=" { BEGIN(GetString); s=&headerFile; }
-<Start>"HTML_FOOTER"[ \t]*"=" { BEGIN(GetString); s=&footerFile; }
-<Start>"CGI_NAME"[ \t]*"=" { BEGIN(GetString); s=&cgiName; }
-<Start>"CGI_URL"[ \t]*"=" { BEGIN(GetString); s=&cgiURL; }
-<Start>"DOC_URL"[ \t]*"=" { BEGIN(GetString); s=&docURL; }
-<Start>"BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&binAbsPath; }
-<Start>"DOC_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&docAbsPath; }
-<Start>"PERL_PATH"[ \t]*"=" { BEGIN(GetString); s=&perlPath; }
-<Start>"GENERATE_TAGFILE"[ \t]*"=" { BEGIN(GetString); s=&genTagFile; }
-<Start>"INPUT_FILTER"[ \t]*"=" { BEGIN(GetString); s=&inputFilter; }
-<Start>"PAPER_TYPE"[ \t]*"=" { BEGIN(GetString); s=&paperType; }
-<Start>"OUTPUT_LANGUAGE"[ \t]*"=" { BEGIN(GetString); s=&outputLanguage; }
-<Start>"STRIP_FROM_PATH"[ \t]*"=" { BEGIN(GetString); s=&stripFromPath; }
-<Start>"MAN_EXTENSION"[ \t]*"=" { BEGIN(GetString); s=&manExtension; }
-<Start>"INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePath; elemStr=""; }
-<Start>"EXAMPLE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&examplePath; elemStr=""; }
-<Start>"INPUT"[ \t]*"=" { BEGIN(GetStrList); l=&inputSources; elemStr=""; }
-<Start>"EXCLUDE"[ \t]*"=" { BEGIN(GetStrList); l=&excludeSources; elemStr=""; }
-<Start>"FILE_PATTERNS"[ \t]*"=" { BEGIN(GetStrList); l=&filePatternList; elemStr=""; }
-<Start>"EXCLUDE_PATTERNS"[ \t]*"=" { BEGIN(GetStrList); l=&excludePatternList; elemStr=""; }
-<Start>"TAGFILES"[ \t]*"=" { BEGIN(GetStrList); l=&tagFileList; elemStr=""; }
-<Start>"EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&extDocPathList; elemStr=""; }
-<Start>"PREDEFINED"[ \t]*"=" { BEGIN(GetStrList); l=&predefined; elemStr=""; }
-<Start>"EXTRA_PACKAGES"[ \t]*"=" { BEGIN(GetStrList); l=&extraPackageList; elemStr=""; }
-<Start>"QUIET"[ \t]*"=" { BEGIN(GetBool); b=&quietFlag; }
-<Start>"WARNINGS"[ \t]*"=" { BEGIN(GetBool); b=&warningFlag; }
-<Start>"RECURSIVE"[ \t]*"=" { BEGIN(GetBool); b=&recursiveFlag; }
-<Start>"ALLEXTERNALS"[ \t]*"=" { BEGIN(GetBool); b=&allExtFlag; }
-<Start>"SEARCHENGINE"[ \t]*"=" { BEGIN(GetBool); b=&searchEngineFlag; }
-<Start>"EXTRACT_ALL"[ \t]*"=" { BEGIN(GetBool); b=&extractAllFlag; }
-<Start>"EXTRACT_PRIVATE"[ \t]*"=" { BEGIN(GetBool); b=&extractPrivateFlag; }
-<Start>"DISABLE_INDEX"[ \t]*"=" { BEGIN(GetBool); b=&noIndexFlag; }
-<Start>"GENERATE_LATEX"[ \t]*"=" { BEGIN(GetBool); b=&generateLatex; }
-<Start>"GENERATE_HTML"[ \t]*"=" { BEGIN(GetBool); b=&generateHtml; }
-<Start>"GENERATE_MAN"[ \t]*"=" { BEGIN(GetBool); b=&generateMan; }
-<Start>"ENABLE_PREPROCESSING"[ \t]*"=" { BEGIN(GetBool); b=&preprocessingFlag; }
-<Start>"MACRO_EXPANSION"[ \t]*"=" { BEGIN(GetBool); b=&macroExpansionFlag; }
-<Start>"SEARCH_INCLUDES"[ \t]*"=" { BEGIN(GetBool); b=&searchIncludeFlag; }
-<Start>"BRIEF_MEMBER_DESC"[ \t]*"=" { BEGIN(GetBool); b=&briefMemDescFlag; }
-<Start>"HIDE_UNDOC_MEMBERS"[ \t]*"=" { BEGIN(GetBool); b=&hideMemberFlag; }
-<Start>"HIDE_UNDOC_CLASSES"[ \t]*"=" { BEGIN(GetBool); b=&hideClassFlag; }
-<Start>"EXPAND_ONLY_PREDEF"[ \t]*"=" { BEGIN(GetBool); b=&onlyPredefinedFlag; }
-<Start>"FULL_PATH_NAMES"[ \t]*"=" { BEGIN(GetBool); b=&fullPathNameFlag; }
-<Start>"CLASS_DIAGRAMS"[ \t]*"=" { BEGIN(GetBool); b=&classDiagramFlag; }
-<Start>"COMPACT_LATEX"[ \t]*"=" { BEGIN(GetBool); b=&compactLatexFlag; }
-<Start>"REPEAT_BRIEF"[ \t]*"=" { BEGIN(GetBool); b=&repeatBriefFlag; }
-<Start>"INTERNAL_DOCS"[ \t]*"=" { BEGIN(GetBool); b=&internalDocsFlag; }
-<Start>"CASE_SENSE_NAMES"[ \t]*"=" { BEGIN(GetBool); b=&caseSensitiveNames; }
-<Start>"VERBATIM_HEADERS"[ \t]*"=" { BEGIN(GetBool); b=&verbatimHeaderFlag; }
-<Start>"HTML_ALIGN_MEMBERS"[ \t]*"=" { BEGIN(GetBool); b=&htmlAlignMemberFlag; }
+<Start>"PROJECT_NAME"[ \t]*"=" { BEGIN(GetString); s=&Config::projectName; }
+<Start>"PROJECT_NUMBER"[ \t]*"=" { BEGIN(GetString); s=&Config::projectNumber; }
+<Start>"OUTPUT_DIRECTORY"[ \t]*"=" { BEGIN(GetString); s=&Config::outputDir; }
+<Start>"HTML_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&Config::htmlOutputDir; }
+<Start>"MAN_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&Config::manOutputDir; }
+<Start>"LATEX_OUTPUT"[ \t]*"=" { BEGIN(GetString); s=&Config::latexOutputDir; }
+<Start>"HTML_HEADER"[ \t]*"=" { BEGIN(GetString); s=&Config::headerFile; }
+<Start>"HTML_FOOTER"[ \t]*"=" { BEGIN(GetString); s=&Config::footerFile; }
+<Start>"CGI_NAME"[ \t]*"=" { BEGIN(GetString); s=&Config::cgiName; }
+<Start>"CGI_URL"[ \t]*"=" { BEGIN(GetString); s=&Config::cgiURL; }
+<Start>"DOC_URL"[ \t]*"=" { BEGIN(GetString); s=&Config::docURL; }
+<Start>"BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::binAbsPath; }
+<Start>"DOC_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::docAbsPath; }
+<Start>"PERL_PATH"[ \t]*"=" { BEGIN(GetString); s=&Config::perlPath; }
+<Start>"GENERATE_TAGFILE"[ \t]*"=" { BEGIN(GetString); s=&Config::genTagFile; }
+<Start>"INPUT_FILTER"[ \t]*"=" { BEGIN(GetString); s=&Config::inputFilter; }
+<Start>"PAPER_TYPE"[ \t]*"=" { BEGIN(GetString); s=&Config::paperType; }
+<Start>"OUTPUT_LANGUAGE"[ \t]*"=" { BEGIN(GetString); s=&Config::outputLanguage; }
+<Start>"STRIP_FROM_PATH"[ \t]*"=" { BEGIN(GetString); s=&Config::stripFromPath; }
+<Start>"MAN_EXTENSION"[ \t]*"=" { BEGIN(GetString); s=&Config::manExtension; }
+<Start>"INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&Config::includePath; elemStr=""; }
+<Start>"EXAMPLE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&Config::examplePath; elemStr=""; }
+<Start>"INPUT"[ \t]*"=" { BEGIN(GetStrList); l=&Config::inputSources; elemStr=""; }
+<Start>"EXCLUDE"[ \t]*"=" { BEGIN(GetStrList); l=&Config::excludeSources; elemStr=""; }
+<Start>"FILE_PATTERNS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::filePatternList; elemStr=""; }
+<Start>"EXCLUDE_PATTERNS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::excludePatternList; elemStr=""; }
+<Start>"TAGFILES"[ \t]*"=" { BEGIN(GetStrList); l=&Config::tagFileList; elemStr=""; }
+<Start>"EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extDocPathList; elemStr=""; }
+<Start>"PREDEFINED"[ \t]*"=" { BEGIN(GetStrList); l=&Config::predefined; elemStr=""; }
+<Start>"EXTRA_PACKAGES"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extraPackageList; elemStr=""; }
+<Start>"QUIET"[ \t]*"=" { BEGIN(GetBool); b=&Config::quietFlag; }
+<Start>"WARNINGS"[ \t]*"=" { BEGIN(GetBool); b=&Config::warningFlag; }
+<Start>"RECURSIVE"[ \t]*"=" { BEGIN(GetBool); b=&Config::recursiveFlag; }
+<Start>"ALLEXTERNALS"[ \t]*"=" { BEGIN(GetBool); b=&Config::allExtFlag; }
+<Start>"SEARCHENGINE"[ \t]*"=" { BEGIN(GetBool); b=&Config::searchEngineFlag; }
+<Start>"EXTRACT_ALL"[ \t]*"=" { BEGIN(GetBool); b=&Config::extractAllFlag; }
+<Start>"EXTRACT_PRIVATE"[ \t]*"=" { BEGIN(GetBool); b=&Config::extractPrivateFlag; }
+<Start>"DISABLE_INDEX"[ \t]*"=" { BEGIN(GetBool); b=&Config::noIndexFlag; }
+<Start>"GENERATE_LATEX"[ \t]*"=" { BEGIN(GetBool); b=&Config::generateLatex; }
+<Start>"GENERATE_HTML"[ \t]*"=" { BEGIN(GetBool); b=&Config::generateHtml; }
+<Start>"GENERATE_MAN"[ \t]*"=" { BEGIN(GetBool); b=&Config::generateMan; }
+<Start>"ENABLE_PREPROCESSING"[ \t]*"=" { BEGIN(GetBool); b=&Config::preprocessingFlag; }
+<Start>"MACRO_EXPANSION"[ \t]*"=" { BEGIN(GetBool); b=&Config::macroExpansionFlag; }
+<Start>"SEARCH_INCLUDES"[ \t]*"=" { BEGIN(GetBool); b=&Config::searchIncludeFlag; }
+<Start>"BRIEF_MEMBER_DESC"[ \t]*"=" { BEGIN(GetBool); b=&Config::briefMemDescFlag; }
+<Start>"HIDE_UNDOC_MEMBERS"[ \t]*"=" { BEGIN(GetBool); b=&Config::hideMemberFlag; }
+<Start>"HIDE_UNDOC_CLASSES"[ \t]*"=" { BEGIN(GetBool); b=&Config::hideClassFlag; }
+<Start>"EXPAND_ONLY_PREDEF"[ \t]*"=" { BEGIN(GetBool); b=&Config::onlyPredefinedFlag; }
+<Start>"FULL_PATH_NAMES"[ \t]*"=" { BEGIN(GetBool); b=&Config::fullPathNameFlag; }
+<Start>"CLASS_DIAGRAMS"[ \t]*"=" { BEGIN(GetBool); b=&Config::classDiagramFlag; }
+<Start>"COMPACT_LATEX"[ \t]*"=" { BEGIN(GetBool); b=&Config::compactLatexFlag; }
+<Start>"REPEAT_BRIEF"[ \t]*"=" { BEGIN(GetBool); b=&Config::repeatBriefFlag; }
+<Start>"INTERNAL_DOCS"[ \t]*"=" { BEGIN(GetBool); b=&Config::internalDocsFlag; }
+<Start>"CASE_SENSE_NAMES"[ \t]*"=" { BEGIN(GetBool); b=&Config::caseSensitiveNames; }
+<Start>"VERBATIM_HEADERS"[ \t]*"=" { BEGIN(GetBool); b=&Config::verbatimHeaderFlag; }
+<Start>"HTML_ALIGN_MEMBERS"[ \t]*"=" { BEGIN(GetBool); b=&Config::htmlAlignMemberFlag; }
+<Start>"SOURCE_BROWSER"[ \t]*"=" { BEGIN(GetBool); b=&Config::includeSourceFlag; }
+<Start>"JAVADOC_AUTOBRIEF"[ \t]*"=" { BEGIN(GetBool); b=&Config::autoBriefFlag; }
<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); }
<GetString,GetBool>\n { yyLineNr++; BEGIN(Start); }
<GetStrList>\n {
@@ -258,7 +284,7 @@ static int yyread(char *buf,int max_size)
}
<GetQuotedString>. { tmpString+=*yytext; }
<GetBool>[a-zA-Z]+ {
- QString bs=yytext;
+ QCString bs=yytext;
bs=bs.upper();
if (bs=="YES")
*b=TRUE;
@@ -272,11 +298,6 @@ static int yyread(char *buf,int max_size)
bs.data(),yyLineNr);
}
}
- /*
-<GetStrList>[a-z_A-Z.*:?~0-9/\\\-]+ {
- elemStr+=yytext;
- }
- */
<GetStrList>[^ \#\"\$\t\r\n]+ {
elemStr+=yytext;
}
@@ -294,56 +315,122 @@ static int yyread(char *buf,int max_size)
void dumpConfig()
{
- printf("projectName=`%s'\n",projectName.data());
- printf("outputDir=`%s'\n", outputDir.data());
- printf("headerFile=`%s'\n", headerFile.data());
- printf("footerFile=`%s'\n", footerFile.data());
- char *ip=includePath.first();
+ printf("projectName=`%s'\n",Config::projectName.data());
+ printf("outputDir=`%s'\n", Config::outputDir.data());
+ printf("headerFile=`%s'\n", Config::headerFile.data());
+ printf("footerFile=`%s'\n", Config::footerFile.data());
+ char *ip=Config::includePath.first();
while (ip)
{
printf("includePath=`%s'\n",ip);
- ip=includePath.next();
+ ip=Config::includePath.next();
}
- printf("quiet=`%d'\n", quietFlag);
- printf("warnings=`%d'\n", warningFlag);
- char *is=inputSources.first();
+ printf("quiet=`%d'\n", Config::quietFlag);
+ printf("warnings=`%d'\n", Config::warningFlag);
+ char *is=Config::inputSources.first();
while (is)
{
printf("inputSources=`%s'\n",is);
- is=inputSources.next();
+ is=Config::inputSources.next();
}
- char *fp=filePatternList.first();
+ char *fp=Config::filePatternList.first();
while (fp)
{
printf("filePattern=`%s'\n",fp);
- fp=filePatternList.next();
+ fp=Config::filePatternList.next();
}
- printf("recusive=`%d'\n",recursiveFlag);
- printf("inputFilter=`%s'\n",inputFilter.data());
- char *tf=tagFileList.first();
+ printf("recusive=`%d'\n",Config::recursiveFlag);
+ printf("inputFilter=`%s'\n",Config::inputFilter.data());
+ char *tf=Config::tagFileList.first();
while (tf)
{
printf("tagFile=`%s'\n",tf);
- tf=tagFileList.next();
- }
- printf("allExternals=`%d'\n",allExtFlag);
- printf("searchEngine=`%d'\n",searchEngineFlag);
- printf("cgiName=`%s'\n",cgiName.data());
- printf("cgiURL=`%s'\n",cgiURL.data());
- printf("docURL=`%s'\n",docURL.data());
- printf("binAbsPath=`%s'\n",binAbsPath.data());
- char *ed=extDocPathList.first();
+ tf=Config::tagFileList.next();
+ }
+ printf("allExternals=`%d'\n",Config::allExtFlag);
+ printf("searchEngine=`%d'\n",Config::searchEngineFlag);
+ printf("cgiName=`%s'\n",Config::cgiName.data());
+ printf("cgiURL=`%s'\n",Config::cgiURL.data());
+ printf("docURL=`%s'\n",Config::docURL.data());
+ printf("binAbsPath=`%s'\n",Config::binAbsPath.data());
+ char *ed=Config::extDocPathList.first();
while (ed)
{
printf("binAbsPathFile=`%s'\n",ed);
- ed=extDocPathList.next();
+ ed=Config::extDocPathList.next();
}
}
+void Config::init()
+{
+ Config::projectName.resize(0);
+ Config::projectNumber.resize(0);
+ Config::outputDir.resize(0);
+ Config::htmlOutputDir = "html";
+ Config::latexOutputDir ="latex";
+ Config::manOutputDir ="man";
+ Config::outputLanguage = "English";
+ Config::headerFile.resize(0);
+ Config::footerFile.resize(0);
+ Config::cgiName = "search.cgi";
+ Config::cgiURL.resize(0);
+ Config::docURL.resize(0);
+ Config::binAbsPath = "/usr/local/bin/";
+ Config::docAbsPath.resize(0);
+ Config::perlPath = "/usr/bin/perl";
+ Config::genTagFile.resize(0);
+ Config::inputFilter.resize(0);
+ Config::paperType = "a4wide";
+ Config::stripFromPath.resize(0);
+ Config::manExtension = ".3";
+ Config::includePath.clear();
+ Config::examplePath.clear();
+ Config::inputSources.clear();
+ Config::excludeSources.clear();
+ Config::filePatternList.clear();
+ Config::excludePatternList.clear();
+ Config::tagFileList.clear();
+ Config::extDocPathList.clear();
+ Config::predefined.clear();
+ Config::extraPackageList.clear();
+ Config::quietFlag = FALSE;
+ Config::recursiveFlag = FALSE;
+ Config::allExtFlag = FALSE;
+ Config::searchEngineFlag = FALSE;
+ Config::extractAllFlag = FALSE;
+ Config::extractPrivateFlag = FALSE;
+ Config::noIndexFlag = FALSE;
+ Config::hideMemberFlag = FALSE;
+ Config::hideClassFlag = FALSE;
+ Config::macroExpansionFlag = FALSE;
+ Config::onlyPredefinedFlag = FALSE;
+ Config::fullPathNameFlag = FALSE;
+ Config::compactLatexFlag = FALSE;
+ Config::internalDocsFlag = FALSE;
+ Config::caseSensitiveNames = FALSE;
+ Config::includeSourceFlag = FALSE;
+ Config::warningFlag = TRUE;
+ Config::generateHtml = TRUE;
+ Config::generateLatex = TRUE;
+ Config::generateMan = TRUE;
+ Config::preprocessingFlag = TRUE;
+ Config::briefMemDescFlag = TRUE;
+ Config::searchIncludeFlag = TRUE;
+ Config::classDiagramFlag = TRUE;
+ Config::repeatBriefFlag = TRUE;
+ Config::verbatimHeaderFlag = TRUE;
+ Config::htmlAlignMemberFlag = TRUE;
+ Config::autoBriefFlag = TRUE;
+}
+
void writeTemplateConfig(QFile *f,bool sl)
{
QTextStream t(f);
+#ifdef DOXYWIZARD
+ t << "# Doxygen configuration generated by Doxywizard version " << versionString << endl;
+#else
t << "# Doxyfile " << versionString << endl;
+#endif
if (!sl)
{
t << "# This file describes the settings to be used by doxygen for a project\n";
@@ -387,7 +474,8 @@ void writeTemplateConfig(QFile *f,bool sl)
t << "# The OUTPUT_LANGUAGE tag is used to specify the language in which all\n";
t << "# documentation generated by doxygen is written. Doxygen will use this\n";
t << "# information to generate all constant output in the proper language.\n";
- t << "# The default language is English, other supported languages are: Dutch\n";
+ t << "# The default language is English, other supported languages are: \n";
+ t << "# Dutch, French, Italian, Czech, Swedish, German and Japanese\n";
t << "\n";
}
t << "OUTPUT_LANGUAGE = English\n";
@@ -516,11 +604,20 @@ void writeTemplateConfig(QFile *f,bool sl)
t << "# supports case sensitive file names.\n";
t << "\n";
}
+ t << "SOURCE_BROWSER = NO\n";
+ if (!sl)
+ {
+ t << "\n";
+ t << "# If the SOURCE_BROWSER tag is set to YES than the body of a member or\n";
+ t << "# function will be appended as a block of code to the documentation of.\n";
+ t << "# that member or function.\n";
+ t << "\n";
+ }
t << "CASE_SENSE_NAMES = NO\n";
if (!sl)
{
t << "\n";
- t << "# If the VERBATIM_HEADERS tag is set the YES (the default) then Doxygen\n";
+ t << "# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen\n";
t << "# will generate a verbatim copy of the header file for each class for\n";
t << "# which an include is specified. Set to NO to disable this.\n";
t << "\n";
@@ -529,6 +626,16 @@ void writeTemplateConfig(QFile *f,bool sl)
if (!sl)
{
t << "\n";
+ t << "# If the JAVADOC_NO_AUTOBRIEF is set to YES (the default) then Doxygen\n";
+ t << "# will interpret the first line (until the first dot) of a JavaDoc-style\n";
+ t << "# comment as the brief description. If set to NO, the Javadoc-style will\n";
+ t << "# behave just like the Qt-style comments.\n";
+ t << "\n";
+ }
+ t << "JAVADOC_AUTOBRIEF = YES\n";
+ if (!sl)
+ {
+ t << "\n";
t << "#---------------------------------------------------------------------------\n";
t << "# configuration options related to the input files\n";
t << "#---------------------------------------------------------------------------\n";
@@ -817,7 +924,7 @@ void writeTemplateConfig(QFile *f,bool sl)
t << "# interpreter (i.e. the result of `which perl').\n";
t << "\n";
}
- t << "PERL_PATH = /usr/local/bin/perl\n";
+ t << "PERL_PATH = /usr/bin/perl\n";
if (!sl)
{
t << "\n";
@@ -893,147 +1000,154 @@ void checkConfig()
//}
// set default man page extension if non is given by the user
- if (manExtension.isEmpty())
+ if (Config::manExtension.isEmpty())
{
- manExtension=".3";
+ Config::manExtension=".3";
}
- paperType = paperType.lower().stripWhiteSpace();
- if (paperType.isEmpty())
+ Config::paperType = Config::paperType.lower().stripWhiteSpace();
+ if (Config::paperType.isEmpty())
{
- paperType = "a4wide";
+ Config::paperType = "a4wide";
}
- if (paperType!="a4" && paperType!="a4wide" && paperType!="letter" &&
- paperType!="legal" && paperType!="executive")
+ if (Config::paperType!="a4" && Config::paperType!="a4wide" && Config::paperType!="letter" &&
+ Config::paperType!="legal" && Config::paperType!="executive")
{
err("Error: Unknown page type specified");
}
- outputLanguage=outputLanguage.stripWhiteSpace();
- if (outputLanguage.isEmpty())
+ Config::outputLanguage=Config::outputLanguage.stripWhiteSpace();
+ if (Config::outputLanguage.isEmpty())
{
+ Config::outputLanguage = "English";
+#ifndef DOXYWIZARD
setTranslator("English");
+#endif
}
else
{
- if (!setTranslator(outputLanguage))
+#ifndef DOXYWIZARD
+ if (!setTranslator(Config::outputLanguage))
{
- err("Error: Output language %s not supported! Using english instead.\n",
- outputLanguage.data());
+ err("Error: Output language %s not supported! Using English instead.\n",
+ Config::outputLanguage.data());
}
+#endif
}
// Test to see if output directory is valid
- if (outputDir.isEmpty())
- outputDir=QDir::currentDirPath();
+ if (Config::outputDir.isEmpty())
+ Config::outputDir=QDir::currentDirPath();
else
{
- QDir dir(outputDir);
+ QDir dir(Config::outputDir);
if (!dir.exists())
{
dir.setPath(QDir::currentDirPath());
- if (!dir.mkdir(outputDir))
+ if (!dir.mkdir(Config::outputDir))
{
err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
- "exist and cannot be created\n",outputDir.data());
+ "exist and cannot be created\n",Config::outputDir.data());
exit(1);
}
- else if (!quietFlag)
+ else if (!Config::quietFlag)
{
err("Notice: Output directory `%s' does not exist. "
- "I have created it for you.\n", outputDir.data());
+ "I have created it for you.\n", Config::outputDir.data());
}
- dir.cd(outputDir);
+ dir.cd(Config::outputDir);
}
- outputDir=dir.absPath();
+ Config::outputDir=dir.absPath();
}
- if (htmlOutputDir.isEmpty() && generateHtml)
+ if (Config::htmlOutputDir.isEmpty() && Config::generateHtml)
{
- htmlOutputDir=outputDir+"/html";
+ Config::htmlOutputDir=Config::outputDir+"/html";
}
- else if (htmlOutputDir && htmlOutputDir[0]!='/')
+ else if (Config::htmlOutputDir && Config::htmlOutputDir[0]!='/')
{
- htmlOutputDir.prepend(outputDir+'/');
+ Config::htmlOutputDir.prepend(Config::outputDir+'/');
}
- QDir htmlDir(htmlOutputDir);
- if (!htmlDir.exists() && !htmlDir.mkdir(htmlOutputDir))
+ QDir htmlDir(Config::htmlOutputDir);
+ if (!htmlDir.exists() && !htmlDir.mkdir(Config::htmlOutputDir))
{
- err("Could not create output directory %s\n",htmlOutputDir.data());
+ err("Could not create output directory %s\n",Config::htmlOutputDir.data());
exit(1);
}
- if (latexOutputDir.isEmpty() && generateLatex)
+ if (Config::latexOutputDir.isEmpty() && Config::generateLatex)
{
- latexOutputDir=outputDir+"/latex";
+ Config::latexOutputDir=Config::outputDir+"/latex";
}
- else if (latexOutputDir && latexOutputDir[0]!='/')
+ else if (Config::latexOutputDir && Config::latexOutputDir[0]!='/')
{
- latexOutputDir.prepend(outputDir+'/');
+ Config::latexOutputDir.prepend(Config::outputDir+'/');
}
- QDir latexDir(latexOutputDir);
- if (!latexDir.exists() && !latexDir.mkdir(latexOutputDir))
+ QDir latexDir(Config::latexOutputDir);
+ if (!latexDir.exists() && !latexDir.mkdir(Config::latexOutputDir))
{
- err("Could not create output directory %s\n",latexOutputDir.data());
+ err("Could not create output directory %s\n",Config::latexOutputDir.data());
exit(1);
}
- if (manOutputDir.isEmpty() && generateMan)
+ if (Config::manOutputDir.isEmpty() && Config::generateMan)
{
- manOutputDir=outputDir+"/man";
+ Config::manOutputDir=Config::outputDir+"/man";
}
- else if (manOutputDir && manOutputDir[0]!='/')
+ else if (Config::manOutputDir && Config::manOutputDir[0]!='/')
{
- manOutputDir.prepend(outputDir+'/');
+ Config::manOutputDir.prepend(Config::outputDir+'/');
}
- QDir manDir(manOutputDir);
- if (!manDir.exists() && !manDir.mkdir(manOutputDir))
+ QDir manDir(Config::manOutputDir);
+ if (!manDir.exists() && !manDir.mkdir(Config::manOutputDir))
{
- err("Could not create output directory %s\n",manOutputDir.data());
+ err("Could not create output directory %s\n",Config::manOutputDir.data());
exit(1);
}
// Test to see if HTML header is valid
- if (headerFile.length()>0)
+ if (Config::headerFile.length()>0)
{
- QFileInfo fi(headerFile);
+ QFileInfo fi(Config::headerFile);
if (!fi.exists())
{
err("Error: tag HTML_HEADER: header file `%s' "
- "does not exist\n",headerFile.data());
+ "does not exist\n",Config::headerFile.data());
exit(1);
}
}
// Test to see if HTML footer is valid
- if (footerFile.length()>0)
+ if (Config::footerFile.length()>0)
{
- QFileInfo fi(footerFile);
+ QFileInfo fi(Config::footerFile);
if (!fi.exists())
{
err("Error: tag HTML_FOOTER: footer file `%s' "
- "does not exist\n",footerFile.data());
+ "does not exist\n",Config::footerFile.data());
exit(1);
}
}
// check include path
- char *s=includePath.first();
+ char *s=Config::includePath.first();
while (s)
{
QFileInfo fi(s);
if (!fi.exists()) err("Warning: tag INCLUDE_PATH: include path `%s' "
"does not exist\n",s);
+#ifndef DOXYWIZARD
addSearchDir(fi.absFilePath());
- s=includePath.next();
+#endif
+ s=Config::includePath.next();
}
// check input
- if (inputSources.count()==0)
+ if (Config::inputSources.count()==0)
{
err("Error: tag INPUT: no input files specified after the INPUT tag.\n");
exit(1);
}
else
{
- s=inputSources.first();
+ s=Config::inputSources.first();
while (s)
{
QFileInfo fi(s);
@@ -1042,89 +1156,105 @@ void checkConfig()
err("Error: tag INPUT: input source `%s' does not exist\n",s);
exit(1);
}
- s=inputSources.next();
+ s=Config::inputSources.next();
}
}
// add default pattern if needed
- if (filePatternList.count()==0)
+ if (Config::filePatternList.count()==0)
{
- filePatternList.append("*");
+ Config::filePatternList.append("*");
}
// more checks needed if and only if the search engine is enabled.
- if (searchEngineFlag)
+ if (Config::searchEngineFlag)
{
// check cgi name
- if (cgiName.length()==0)
+ if (Config::cgiName.length()==0)
{
err("Error: tag CGI_NAME: no cgi script name after the CGI_NAME tag.\n");
exit(1);
}
// check cgi URL
- if (cgiURL.length()==0)
+ if (Config::cgiURL.length()==0)
{
err("Error: tag CGI_URL: no URL to cgi directory specified.\n");
exit(1);
}
- else if (cgiURL.left(7)!="http://")
+ else if (Config::cgiURL.left(7)!="http://")
{
err("Error: tag CGI_URL: URL to cgi directory is invalid (must "
"start with http://).\n");
exit(1);
}
// check documentation URL
- if (docURL.length()==0)
+ if (Config::docURL.length()==0)
{
- docURL = outputDir.copy().prepend("file://").append("html");
+ Config::docURL = Config::outputDir.copy().prepend("file://").append("html");
}
- else if (docURL.left(7)!="http://" && docURL.left(7)!="file://")
+ else if (Config::docURL.left(7)!="http://" && Config::docURL.left(7)!="file://")
{
err("Error: tag DOC_URL: URL to documentation is invalid or "
"not absolute.\n");
exit(1);
}
// check absolute documentation path
- if (docAbsPath.length()==0)
+ if (Config::docAbsPath.length()==0)
{
- docAbsPath = outputDir+"/html";
+ Config::docAbsPath = Config::outputDir+"/html";
}
- else if (docAbsPath && docAbsPath[0]!='/')
+ else if (Config::docAbsPath[0]!='/' && Config::docAbsPath[1]!=':')
{
- err("Error: tag DOC_ABSPATH: path is not absolute\n");
+ err("Error: tag DOC_ABSPATH: path is not absolute!\n");
exit(1);
}
// check path to doxysearch
- if (binAbsPath.length()==0)
+ if (Config::binAbsPath.length()==0)
{
err("Error: tag BIN_ABSPATH: no absolute path to doxysearch "
"specified.\n");
exit(1);
}
- else
+ else if (Config::binAbsPath[0]!='/' && Config::binAbsPath[1]!=':')
{
- if (binAbsPath && binAbsPath[0]!='/')
- {
- err("Error: tag BIN_ABSPATH: path is not absolute "
- "(must start with /).\n");
- exit(1);
- }
+ err("Error: tag BIN_ABSPATH: path is not absolute!\n");
+ exit(1);
}
+
// check perl path
- if (perlPath.length()==0)
+ bool found=FALSE;
+ if (Config::perlPath.length()==0)
{
- perlPath="/usr/local/bin/perl";
+ QFileInfo fi;
+ fi.setFile("/usr/bin/perl");
+ if (fi.exists())
+ {
+ Config::perlPath="/usr/bin/perl";
+ found=TRUE;
+ }
+ else
+ {
+ fi.setFile("/usr/local/bin/perl");
+ if (fi.exists())
+ {
+ Config::perlPath="/usr/local/bin/perl";
+ found=TRUE;
+ }
+ }
}
- QFileInfo fi(perlPath);
- if (!fi.exists())
+ if (!found)
{
- err("Error: tag PERL_PATH: perl interpreter not found at `%s'\n",
- perlPath.data());
- exit(1);
+ QFileInfo fi(Config::perlPath);
+ if (!fi.exists())
+ {
+ warn("Warning: tag PERL_PATH: perl interpreter not found at default or"
+ "user specified (%s) location\n",
+ Config::perlPath.data());
+ }
}
}
}
-void parseConfig(const QString &s)
+void parseConfig(const QCString &s)
{
inputString = s;
inputPosition = 0;
@@ -1132,9 +1262,8 @@ void parseConfig(const QString &s)
configYYrestart( configYYin );
BEGIN( Start );
configYYlex();
- checkConfig();
}
-extern "C" { // some bogus code to keep the compiler happy
- int configYYwrap() { return 1 ; }
-}
+//extern "C" { // some bogus code to keep the compiler happy
+// int configYYwrap() { return 1 ; }
+//}
diff --git a/src/constexp.h b/src/constexp.h
index 9979bfd..8c33a5e 100644
--- a/src/constexp.h
+++ b/src/constexp.h
@@ -18,13 +18,13 @@
#ifndef _CONSTEXP_H
#define _CONSTEXP_H
-#include <qstring.h>
+#include "qtbc.h"
#include "cppvalue.h"
-extern bool parseCppExpression(const QString &s);
+extern bool parseCppExpression(const QCString &s);
extern int cppExpYYparse();
extern int cppExpYYdebug;
-extern QString strToken;
+extern QCString strToken;
extern CPPValue resultValue;
#endif
diff --git a/src/constexp.l b/src/constexp.l
index f023507..43c7167 100644
--- a/src/constexp.l
+++ b/src/constexp.l
@@ -24,7 +24,7 @@
#define YY_NO_UNPUT
#define YY_NEVER_INTERACTIVE 1
-QString strToken;
+QCString strToken;
static const char *inputString;
static int inputPosition;
@@ -94,7 +94,7 @@ static int yyread(char *buf,int max_size)
%%
-bool parseCppExpression(const QString &s)
+bool parseCppExpression(const QCString &s)
{
//printf("Expression: `%s'\n",s.data());
inputString = s;
diff --git a/src/debug.cpp b/src/debug.cpp
index fc2731d..d7f1ba8 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -14,10 +14,11 @@
*
*/
-#include "debug.h"
#include <stdarg.h>
#include <stdio.h>
-#include <qstring.h>
+
+#include "qtbc.h"
+#include "debug.h"
Debug::DebugMask Debug::curMask = Debug::Quiet;
int Debug::curPrio = 0;
@@ -35,7 +36,7 @@ void Debug::print(DebugMask mask,int prio,const char *fmt,...)
static int labelToEnumValue(const char *l)
{
- QString label=l;
+ QCString label=l;
if (label=="FindMembers")
return Debug::FindMembers;
else if (label=="Functions")
diff --git a/src/declinfo.h b/src/declinfo.h
index 4ec3ec5..df206e0 100644
--- a/src/declinfo.h
+++ b/src/declinfo.h
@@ -17,16 +17,16 @@
#ifndef DECLINFO_H
#define DECLINFO_H
+#include "qtbc.h"
#include <stdio.h>
-#include <qstring.h>
-extern void parseFuncDecl(const QString &decl,
- QString &clName,
- QString &classTempList,
- QString &type,
- QString &name,
- QString &args,
- QString &funcTempList,
- QString &exceptions
+extern void parseFuncDecl(const QCString &decl,
+ QCString &clName,
+ QCString &classTempList,
+ QCString &type,
+ QCString &name,
+ QCString &args,
+ QCString &funcTempList,
+ QCString &exceptions
);
#endif
diff --git a/src/declinfo.l b/src/declinfo.l
index 0f0505d..dfa3e47 100644
--- a/src/declinfo.l
+++ b/src/declinfo.l
@@ -37,18 +37,18 @@
static const char * inputString;
static int inputPosition;
-static QString scope;
-static QString className;
-static QString classTempList;
-static QString funcTempList;
-static QString type;
-static QString name;
-static QString args;
-static QString tmpType;
+static QCString scope;
+static QCString className;
+static QCString classTempList;
+static QCString funcTempList;
+static QCString type;
+static QCString name;
+static QCString args;
+static QCString tmpType;
static int sharpCount;
static bool classTempListFound;
static bool funcTempListFound;
-static QString exceptionString;
+static QCString exceptionString;
static void addType()
{
@@ -95,6 +95,8 @@ static int yyread(char *buf,int max_size)
B [ \t]
ID [a-z_A-Z][a-z_A-Z0-9]*
+%option noyywrap
+
%x Start
%x Template
%x ReadArgs
@@ -198,8 +200,8 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
/*@ ----------------------------------------------------------------------------
*/
-void parseFuncDecl(const QString &decl,QString &cl,QString &ctl,QString &t,
- QString &n,QString &a,QString &ftl,QString &exc)
+void parseFuncDecl(const QCString &decl,QCString &cl,QCString &ctl,QCString &t,
+ QCString &n,QCString &a,QCString &ftl,QCString &exc)
{
inputString = decl;
//printf("Input=`%s'\n",inputString);
@@ -221,17 +223,18 @@ void parseFuncDecl(const QString &decl,QString &cl,QString &ctl,QString &t,
declinfoYYlex();
cl=scope.copy();
- int i;
- if ((i=cl.find('<'))!=-1) // split up scope and template arguments
+ int il,ir;
+ if ((il=cl.find('<'))!=-1 && (ir=cl.findRev('>'))!=-1) // split up scope and template arguments
{
- ctl=removeRedundantWhiteSpace(cl.right(cl.length()-i));
- cl=cl.left(i);
+ if (ir==-1) ir=cl.length(); else ir++;
+ ctl=removeRedundantWhiteSpace(cl.mid(il,ir-il));
+ cl=cl.left(il)+cl.right(cl.length()-ir);
}
n=removeRedundantWhiteSpace(name);
- if ((i=n.find('<'))!=-1 && n.left(8)!="operator")
+ if ((il=n.find('<'))!=-1 && n.left(8)!="operator")
{
- ftl=removeRedundantWhiteSpace(n.right(n.length()-i));
- n=n.left(i);
+ ftl=removeRedundantWhiteSpace(n.right(n.length()-il));
+ n=n.left(il);
}
//ctl=classTempList.copy();
@@ -253,20 +256,20 @@ void parseFuncDecl(const QString &decl,QString &cl,QString &ctl,QString &t,
}
-extern "C" { // some bogus code to keep the compiler happy
- int declinfoYYwrap() { return 1 ; }
- void declinfoYYdummy() { yy_flex_realloc(0,0); }
-}
+//extern "C" { // some bogus code to keep the compiler happy
+// int declinfoYYwrap() { return 1 ; }
+// void declinfoYYdummy() { yy_flex_realloc(0,0); }
+//}
#if 0
void dumpDecl(const char *s)
{
- QString className;
- QString classTNames;
- QString type;
- QString name;
- QString args;
- QString funcTNames;
+ QCString className;
+ QCString classTNames;
+ QCString type;
+ QCString name;
+ QCString args;
+ QCString funcTNames;
printf("-----------------------------------------\n");
parseFuncDecl(s,className,classTNames,type,name,args,funcTNames);
printf("type=`%s' class=`%s' classTempl=`%s' name=`%s' "
diff --git a/src/defargs.h b/src/defargs.h
index d2cd8f2..70e901c 100644
--- a/src/defargs.h
+++ b/src/defargs.h
@@ -17,8 +17,8 @@
#ifndef DEFARGS_H
#define DEFARGS_H
+#include "qtbc.h"
#include <stdio.h>
-#include <qstring.h>
class ArgumentList;
diff --git a/src/defargs.l b/src/defargs.l
index b7dfd57..d82c2fe 100644
--- a/src/defargs.l
+++ b/src/defargs.l
@@ -19,6 +19,7 @@
/*
* includes
*/
+#include "qtbc.h"
#include <stdio.h>
#include <iostream.h>
#include <assert.h>
@@ -40,10 +41,10 @@
static const char *inputString;
static int inputPosition;
static ArgumentList *argList;
-static QString *copyArgValue;
-static QString curArgTypeName;
-static QString curArgDefValue;
-static QString curArgName;
+static QCString *copyArgValue;
+static QCString curArgTypeName;
+static QCString curArgDefValue;
+static QCString curArgName;
static int argRoundCount;
static int argSharpCount;
static int argCurlyCount;
@@ -72,6 +73,8 @@ static int yyread(char *buf,int max_size)
B [ \t]
ID [a-z_A-Z][a-z_A-Z0-9]*
+%option noyywrap
+
%x Start
%x CopyArgString
%x CopyArgRound
@@ -239,7 +242,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
}
}
<ReadFuncArgType,ReadFuncArgPtr>{ID} {
- QString name=yytext; //resolveDefines(yytext);
+ QCString name=yytext; //resolveDefines(yytext);
//printf("resolveName `%s'->`%s'\n",yytext,name.data());
curArgTypeName+=name;
}
@@ -250,7 +253,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
curArgDefValue+=*yytext;
}
<CopyArgRound,CopyArgRound2,CopyArgSharp,CopyArgCurly>{ID} {
- QString name=yytext; //resolveDefines(yytext);
+ QCString name=yytext; //resolveDefines(yytext);
*copyArgValue+=name;
}
<CopyArgRound,CopyArgRound2,CopyArgSharp,CopyArgCurly>. {
@@ -293,6 +296,6 @@ void stringToArgumentList(const char *argsString,ArgumentList* &al)
}
extern "C" { // some bogus code to keep the compiler happy
- int defargsYYwrap() { return 1 ; }
+// int defargsYYwrap() { return 1 ; }
void defargsYYdummy() { yy_flex_realloc(0,0); }
}
diff --git a/src/define.cpp b/src/define.cpp
index 2fa7fa4..336d6da 100644
--- a/src/define.cpp
+++ b/src/define.cpp
@@ -39,5 +39,5 @@ Define::~Define()
bool Define::hasDocumentation()
{
- return definition && (doc || extractAllFlag);
+ return definition && (doc || Config::extractAllFlag);
}
diff --git a/src/define.h b/src/define.h
index 14ac008..92027af 100644
--- a/src/define.h
+++ b/src/define.h
@@ -17,8 +17,8 @@
#ifndef DEFINE_H
#define DEFINE_H
+#include "qtbc.h"
#include <qdict.h>
-#include <qstring.h>
#include "util.h"
class FileDef;
@@ -30,13 +30,13 @@ class Define
Define(const Define &d);
~Define();
bool hasDocumentation();
- QString name;
- QString definition;
- QString fileName;
- QString doc;
- QString brief;
- QString args;
- QString anchor;
+ QCString name;
+ QCString definition;
+ QCString fileName;
+ QCString doc;
+ QCString brief;
+ QCString args;
+ QCString anchor;
FileDef *fileDef;
int lineNr;
int nargs;
@@ -67,7 +67,7 @@ class DefineName : public QList<Define>
}
private:
- QString name;
+ QCString name;
};
class DefineNameList : public QList<DefineName>
diff --git a/src/definition.cpp b/src/definition.cpp
index 328bebe..4474113 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -14,6 +14,7 @@
*
*/
+#include "qtbc.h"
#include <ctype.h>
#include "definition.h"
#include "doxygen.h"
@@ -28,23 +29,23 @@ Definition::~Definition()
delete sectionList;
}
-QString Definition::nameToFile(const char *name)
+QCString Definition::nameToFile(const char *name)
{
- QString result;
+ QCString result;
char c;
const char *p=name;
while ((c=*p++)!=0)
{
switch(c)
{
- case ':': break;
+ case ':': result+="_"; break;
case '<': result+="_lt"; break;
case '>': result+="_gt"; break;
case '*': result+="_ast"; break;
case '&': result+="_amp"; break;
case ' ': break;
default:
- if (caseSensitiveNames)
+ if (Config::caseSensitiveNames)
result+=c;
else
result+=tolower(c);
@@ -54,10 +55,10 @@ QString Definition::nameToFile(const char *name)
return result;
}
-void Definition::addSectionsToDefinition(QList<QString> *anchorList)
+void Definition::addSectionsToDefinition(QList<QCString> *anchorList)
{
if (!anchorList) return;
- QString *s=anchorList->first();
+ QCString *s=anchorList->first();
while (s)
{
SectionInfo *si=0;
diff --git a/src/definition.h b/src/definition.h
index 48301bc..282ecdc 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -17,7 +17,7 @@
#ifndef DEFINITION_H
#define DEFINITION_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qlist.h>
#include "config.h"
#include "section.h"
@@ -31,13 +31,13 @@ class Definition
//! destroys the definition
virtual ~Definition();
//! returns the name of the definition
- QString name() const { return n; }
+ QCString name() const { return n; }
//! returns the base name of the output file that contains this definition.
- virtual QString getOutputFileBase() const = 0;
+ virtual QCString getOutputFileBase() const = 0;
//! returns the detailed description of this definition
- QString documentation() const { return doc; }
+ QCString documentation() const { return doc; }
//! returns the brief description of this definition
- QString briefDescription() const { return brief; }
+ QCString briefDescription() const { return brief; }
//! sets a new name for the definition
void setName(const char *name) { n=name; }
//! sets the documentation of this definition
@@ -54,16 +54,16 @@ class Definition
brief.at(bl-1)!='?') brief+='.';
}
//! returns TRUE iff the definition is documented
- bool hasDocumentation()
- { return !doc.isNull() || !brief.isNull() || extractAllFlag; }
- QString nameToFile(const char *name);
+ virtual bool hasDocumentation()
+ { return !doc.isNull() || !brief.isNull() || Config::extractAllFlag; }
+ QCString nameToFile(const char *name);
- void addSectionsToDefinition(QList<QString> *anchorList);
+ void addSectionsToDefinition(QList<QCString> *anchorList);
private:
- QString n; // name of the definition
- QString brief; // brief description
- QString doc; // detailed description
+ QCString n; // name of the definition
+ QCString brief; // brief description
+ QCString doc; // detailed description
SectionList *sectionList; // list of all sections
};
diff --git a/src/diagram.cpp b/src/diagram.cpp
index 87d5488..8cbe128 100644
--- a/src/diagram.cpp
+++ b/src/diagram.cpp
@@ -15,10 +15,10 @@
*
*/
+#include "qtbc.h"
#include <stdio.h>
#include <stdlib.h>
#include <qlist.h>
-#include <qstring.h>
#include <qarray.h>
#include <qtstream.h>
#include <qfile.h>
@@ -43,9 +43,9 @@ const uint labelVertSpacing = 32; // vertical distance between labels
const uint labelHorMargin = 6; // horiz. spacing between label and box
const uint fontHeight = 12; // height of a character
-//static QString escapeLatex(const char *s)
+//static QCString escapeLatex(const char *s)
//{
-// QString result;
+// QCString result;
// char c;
// while ((c=*s++))
// {
@@ -77,7 +77,7 @@ static uint protToColor(Protection p)
return 0;
}
-static QString protToString(Protection p)
+static QCString protToString(Protection p)
{
switch(p)
{
@@ -180,12 +180,12 @@ DiagramItem::~DiagramItem()
delete children;
}
-QString DiagramItem::label() const
+QCString DiagramItem::label() const
{
return classDef->name()+templSpec;
}
-QString DiagramItem::fileName() const
+QCString DiagramItem::fileName() const
{
return classDef->getOutputFileBase();
}
@@ -960,10 +960,10 @@ void ClassDiagram::writeFigure(QTextStream &output,const char *path,
//printf("writeFigure rows=%d cols=%d\n",rows,cols);
- QFile f1((QString)path+"/"+fileName+".eps");
+ QFile f1((QCString)path+"/"+fileName+".eps");
if (!f1.open(IO_WriteOnly))
{
- err("Could not open file %s for writing\n",f1.name());
+ err("Could not open file %s for writing\n",convertToQCString(f1.name()).data());
exit(1);
}
QTextStream t(&f1);
@@ -1229,7 +1229,7 @@ void ClassDiagram::writeImageMap(QTextStream &t,const char *path,
base->drawConnectors(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight);
super->drawConnectors(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight);
- image.save((QString)path+"/"+fileName+".gif");
+ image.save((QCString)path+"/"+fileName+".gif");
t << "</MAP></P>" << endl;
}
diff --git a/src/diagram.h b/src/diagram.h
index 5bc30f8..792aa8f 100644
--- a/src/diagram.h
+++ b/src/diagram.h
@@ -15,6 +15,7 @@
*
*/
+#include "qtbc.h"
#include "entry.h"
class ClassDef;
@@ -30,8 +31,8 @@ class DiagramItem
DiagramItem(DiagramItem *p,int number,ClassDef *cd,
Protection prot,Specifier virt,const char *ts);
~DiagramItem();
- QString label() const;
- QString fileName() const;
+ QCString label() const;
+ QCString fileName() const;
DiagramItem *parentItem() { return parent; }
DiagramItemList *getChildren() { return children; }
void move(int dx,int dy) { x+=dx; y+=dy; }
@@ -53,7 +54,7 @@ class DiagramItem
int num;
Protection prot;
Specifier virt;
- QString templSpec;
+ QCString templSpec;
bool inList;
ClassDef *classDef;
};
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 8c11c0b..76518ba 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -15,7 +15,7 @@
*
*/
-#include <qstring.h>
+#include "qtbc.h"
#include <qfileinf.h>
#include <qfile.h>
#include <qdir.h>
@@ -109,6 +109,7 @@ QTextStream tagFile;
void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
bool over_load);
+const char idMask[] = "[A-Za-z_][A-Za-z_0-9]*";
//----------------------------------------------------------------------
// Returns the standard string that is generated when the \overload
@@ -166,8 +167,8 @@ void buildGroupList(Entry *root)
//
// if ((gd=groupDict[root->name]))
// {
-// QListIterator<QString> sli(*root->groups);
-// QString *s;
+// QListIterator<QCString> sli(*root->groups);
+// QCString *s;
// for (;(s=sli.current());++sli)
// {
// GroupDef *pgd;
@@ -192,7 +193,7 @@ void buildGroupList(Entry *root)
void buildFileList(Entry *root)
{
if (((root->section==Entry::FILEDOC_SEC) ||
- ((root->section & Entry::FILE_MASK) && extractAllFlag)) &&
+ ((root->section & Entry::FILE_MASK) && Config::extractAllFlag)) &&
root->name.length()>0
)
{
@@ -212,8 +213,8 @@ void buildFileList(Entry *root)
fd->setDocumentation(root->doc);
fd->setBriefDescription(root->brief);
fd->addSectionsToDefinition(root->anchors);
- QListIterator<QString> sli(*root->groups);
- QString *s;
+ QListIterator<QCString> sli(*root->groups);
+ QCString *s;
for (;(s=sli.current());++sli)
{
GroupDef *gd=0;
@@ -307,11 +308,11 @@ void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root)
/*! Input is a scopeName, output is the scopename split into a
* namespace part (as large as possible) and a classname part.
*/
-void extractNamespaceName(const QString &scopeName,
- QString &className,QString &namespaceName)
+void extractNamespaceName(const QCString &scopeName,
+ QCString &className,QCString &namespaceName)
{
- QString clName=scopeName.copy();
- QString nsName;
+ QCString clName=scopeName.copy();
+ QCString nsName;
if (clName.length()>0 && namespaceDict[clName])
{ // the whole name is a namespace
namespaceName=clName.copy();
@@ -346,7 +347,9 @@ static bool addNamespace(Entry *root,ClassDef *cd)
if (e->section==Entry::NAMESPACE_SEC)
{
NamespaceDef *nd=0;
- if (!e->name.isEmpty() && (nd=namespaceDict[e->name]))
+ if (!e->name.isEmpty() && e->name.at(0)!='@' &&
+ (nd=namespaceDict[e->name])
+ )
{
cd->setNamespace(nd);
nd->insertClass(cd);
@@ -359,6 +362,7 @@ static bool addNamespace(Entry *root,ClassDef *cd)
return FALSE;
}
+
//----------------------------------------------------------------------
// build a list of all classes mentioned in the documentation
// and all classes that have a documentation block before their definition.
@@ -370,7 +374,7 @@ void buildClassList(Entry *root)
root->name.length()>0
)
{
- QString fullName=root->name.copy();
+ QCString fullName=root->name.copy();
if (fullName.length()==0)
{
// this should not be called
@@ -379,19 +383,7 @@ void buildClassList(Entry *root)
}
else
{
- //QString className;
- //QString namespaceName;
- //extractNamespaceName(fullName,className,namespaceName);
-
- //printf("Found class %s in %s at line %d\n",fullName.data(),
- // root->fileName.data(),root->startLine);
- // add class name substitution entry iff the class name is alterned by a
- // define. This is needed to properly document Qt's template classes
- // (although, it's quite general)
- //if (resolveDefines(fullName)!=fullName)
- //{
- // substituteDict.insert(resolveDefines(fullName),new QString(fullName));
- //}
+ fullName=stripAnnonymousScope(fullName);
bool ambig;
ClassDef *cd;
@@ -427,13 +419,7 @@ void buildClassList(Entry *root)
}
addNamespace(root,cd);
}
- else if (fullName[0]!='@' /* &&
- (root->doc.length()>0 ||
- root->brief.length()>0 ||
- extractAllFlag
- )*/
- )
- // new class
+ else // new class
{
ClassDef::CompoundType sec=ClassDef::Class;
switch(root->section)
@@ -448,13 +434,12 @@ void buildClassList(Entry *root)
ClassDef *cd=new ClassDef(fullName,sec);
cd->setDocumentation(root->doc); // copy docs to definition
cd->setBriefDescription(root->brief);
- //printf("new ClassDef tempArgList=%p\n",root->tArgList);
cd->setTemplateArguments(root->tArgList);
cd->setProtection(root->protection);
cd->addSectionsToDefinition(root->anchors);
- QListIterator<QString> sli(*root->groups);
- QString *s;
+ QListIterator<QCString> sli(*root->groups);
+ QCString *s;
for (;(s=sli.current());++sli)
{
GroupDef *gd=0;
@@ -475,7 +460,7 @@ void buildClassList(Entry *root)
// if the class is not in a namespace then we insert
// it in the file definition
if (!found && ifd) ifd->insertClass(cd);
-
+
// the empty string test is needed for extract all case
cd->setBriefDescription(root->brief);
cd->insertUsedFile(root->fileName);
@@ -506,7 +491,7 @@ void buildNamespaceList(Entry *root)
root->name.length()>0
)
{
- QString fullName=root->name.copy();
+ QCString fullName=root->name.copy();
if (fullName.length()==0)
{
// this should not be called
@@ -549,7 +534,7 @@ void buildNamespaceList(Entry *root)
}
else /* if (root->doc.length()>0 ||
root->brief.length()>0 ||
- extractAllFlag
+ Config::extractAllFlag
)
*/
{
@@ -558,8 +543,8 @@ void buildNamespaceList(Entry *root)
nd->setBriefDescription(root->brief);
nd->addSectionsToDefinition(root->anchors);
- QListIterator<QString> sli(*root->groups);
- QString *s;
+ QListIterator<QCString> sli(*root->groups);
+ QCString *s;
for (;(s=sli.current());++sli)
{
GroupDef *gd=0;
@@ -645,35 +630,29 @@ void buildVarList(Entry *root)
}
}
- QString scope,name=root->name.copy();
+ QCString scope,name=root->name.copy();
bool stat=root->stat;
- ClassDef *cd=0;
Entry *p = root->parent;
- while ((p->section & Entry::COMPOUND_MASK) ||
- p->section==Entry::NAMESPACE_SEC)
+ while ((p->section & Entry::SCOPE_MASK))
{
- if (p->name.length()>0 && p->name[0]!='@')
+ QCString scopeName = stripAnnonymousScope(p->name);
+ if (!scopeName.isEmpty())
{
- if (!scope.isEmpty()) scope.prepend("::");
- scope.prepend(p->name);
+ scope.prepend(scopeName);
break;
}
+ //if (p->name.length()>0 && p->name[0]!='@')
+ //{
+ // if (!scope.isEmpty()) scope.prepend("::");
+ // scope.prepend(p->name);
+ // break;
+ //}
p=p->parent;
}
//printf("scope=%s\n",scope.data());
int ni;
-#if 0
- if ((ni=root->name.findRev("::"))!=-1)
- {
- if (scope.length()>0) scope+="::";
- scope+=root->name.left(ni);
- name=root->name.right(root->name.length()-ni-2);
- stat=TRUE;
- }
-#endif
-
if ((ni=root->name.findRev("::"))!=-1) goto nextMember;
/* skip this member, because it is a
* static variable definition (always?), which will be
@@ -684,7 +663,7 @@ void buildVarList(Entry *root)
MemberDef::MemberType mtype;
// NamespaceDef *nd = 0;
- QString type=root->type.stripWhiteSpace();
+ QCString type=root->type.stripWhiteSpace();
if (type=="@")
mtype=MemberDef::EnumValue;
else if (type.left(8)=="typedef ")
@@ -694,6 +673,7 @@ void buildVarList(Entry *root)
else
mtype=MemberDef::Variable;
+ ClassDef *cd=0;
if (scope.length()>0 && name.length()>0 && (cd=getClass(scope)))
{
@@ -712,7 +692,7 @@ void buildVarList(Entry *root)
// scope+=cd->getTemplateNameString();
//}
// generate member definition.
- QString def;
+ QCString def;
if (root->type.length()>0)
{
if (mtype==MemberDef::Friend)
@@ -743,23 +723,6 @@ void buildVarList(Entry *root)
if (md->memberClass()==cd) // member already in the scope
{
addMemberDocs(root,md,def,FALSE);
-
-#if 0
- // always trust the most protected scope, so adjust if needed
- // This is needed to properly place static private variables,
- // which are defined in a `public' scope.
- printf("Checking protection level\n");
- if (root->protection==Private || md->protection()!=Private)
- {
- printf("Set to private\n");
- md->setProtection(Private);
- }
- else if (root->protection==Protected && md->protection()==Public)
- {
- printf("Set to protected\n");
- md->setProtection(Protected);
- }
-#endif
found=TRUE;
}
md=mn->next();
@@ -802,56 +765,6 @@ void buildVarList(Entry *root)
cd->insertUsedFile(root->fileName);
}
}
-#if 0
- else if (scope.length()>0 && name.length()>0 && (nd=namespaceDict[scope]))
- {
- Debug::print(Debug::Variables,0,
- " namespace variable:\n"
- " type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d\n",
- root->type.data(),
- scope.data(),
- name.data(),
- root->args.data(),
- root->protection
- );
- // new global variable, enum value or typedef
- MemberDef *md=new MemberDef(root->type,name,root->args,0,
- Public, Normal,root->stat,FALSE,
- mtype,0,0);
- md->setDefFile(root->fileName);
- md->setDefLine(root->startLine);
- md->setDocumentation(root->doc);
- md->setBriefDescription(root->brief);
- md->addSectionsToDefinition(root->anchors);
- QString def;
- nd->insertMember(md);
- md->setNamespace(nd);
- if (root->type.length()>0)
- {
- def=root->type+" "+nd->name()+"::"+name+root->args;
- }
- else
- {
- def=nd->name()+"::"+name+root->args;
- }
- if (def.left(7)=="static ") def=def.right(def.length()-7);
- md->setDefinition(def);
-
- MemberName *mn;
- // add member definition to the list of globals
- if ((mn=namespaceNameDict[name]))
- {
- mn->inSort(md);
- }
- else
- {
- mn = new MemberName(name);
- mn->inSort(md);
- namespaceNameDict.insert(name,mn);
- namespaceNameList.inSort(mn);
- }
- }
-#endif
else if (name.length()>0) // global variable
{
Debug::print(Debug::Variables,0,
@@ -873,15 +786,15 @@ void buildVarList(Entry *root)
md->setDocumentation(root->doc);
md->setBriefDescription(root->brief);
md->addSectionsToDefinition(root->anchors);
- QString def;
+ QCString def;
// see if the function is inside a namespace
NamespaceDef *nd = 0;
- if (root->parent->section == Entry::NAMESPACE_SEC )
+ if (scope.length()>0)
{
- nd = namespaceDict[root->parent->name];
+ nd = namespaceDict[scope];
}
- if (nd)
+ if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{
nd->insertMember(md);
md->setNamespace(nd);
@@ -901,8 +814,8 @@ void buildVarList(Entry *root)
}
// determine the definition of the global variable
- if (nd) // variable is inside a namespace, so put the scope
- // before the name
+ if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
+ // variable is inside a namespace, so put the scope before the name
{
if (root->type.length()>0)
{
@@ -961,20 +874,20 @@ void buildMemberList(Entry *root)
{
Debug::print(Debug::Functions,0,
"FUNCTION_SEC:\n"
- " `%s' `%s'::`%s' `%s' relates=`%s' file=`%s' #targs=%d\n",
+ " `%s' `%s'::`%s' `%s' relates=`%s' file=`%s' #targs=%d docs=`%s'\n",
root->type.data(),
root->parent->name.data(),
root->name.data(),
root->args.data(),
root->relates.data(),
root->fileName.data(),
- root->tArgList ? (int)root->tArgList->count() : -1
+ root->tArgList ? (int)root->tArgList->count() : -1,
+ root->doc.data()
);
bool isFriend=root->type.find("friend ")!=-1;
- //if (isFriend && root->relates.length()==0)
- // root->relates=root->parent->name.copy();
- if (root->name.length()>0 /* && !isFriend */)
+
+ if (root->name.length()>0)
{
ClassDef *cd=0;
@@ -983,11 +896,12 @@ void buildMemberList(Entry *root)
//printf("root->parent=`%s' cd=%p root->type.find(re,0)=%d\n",
// root->parent->name.data(),getClass(root->parent->name),
// root->type.find(re,0));
+ QCString scope=stripAnnonymousScope(root->parent->name.copy());
int i;
if (root->parent &&
root->parent->name.length()>0 &&
(root->parent->section & Entry::COMPOUND_MASK) &&
- (cd=getClass(root->parent->name)) &&
+ (cd=getClass(scope)) &&
// do some fuzzy things to exclude function pointers
(root->type.isNull() || root->type.find(re,0)==-1 ||
root->type.find(")(")!=-1 || root->type.find("operator")!=-1
@@ -1001,7 +915,7 @@ void buildMemberList(Entry *root)
root->type=root->type.left(i+l);
}
- QString name=removeRedundantWhiteSpace(root->name);
+ QCString name=removeRedundantWhiteSpace(root->name);
if (name.left(2)=="::") name=name.right(name.length()-2);
MemberDef::MemberType mtype;
@@ -1009,7 +923,16 @@ void buildMemberList(Entry *root)
else if (root->sig) mtype=MemberDef::Signal;
else if (root->slot) mtype=MemberDef::Slot;
else mtype=MemberDef::Function;
- // new member of function, signal or slot.
+
+ //if (Config::includeSourceFlag && !root->body.isEmpty())
+ //{
+ // printf("Function: %s\n-----------------\n%s\n------------------\n",
+ // root->name.data(),root->body.data());
+ //}
+
+ // new member function, signal or slot.
+ //printf("new member: %s class template args=`%s'\n",
+ // root->args.data(),argListToString(cd->templateArguments()).data());
MemberDef *md=new MemberDef(root->type,name,root->args,root->exception,
root->protection,root->virt,root->stat,root->relates.length()>0,
mtype,root->tArgList,root->argList);
@@ -1018,8 +941,10 @@ void buildMemberList(Entry *root)
md->setDefLine(root->startLine);
md->setDocumentation(root->doc);
md->setBriefDescription(root->brief);
+ md->setBody(root->body);
+ //md->setScopeTemplateArguments(cd->templateArguments());
md->addSectionsToDefinition(root->anchors);
- QString def;
+ QCString def;
if (root->relates.length()>0 || isFriend)
{
if (root->type.length()>0)
@@ -1047,7 +972,6 @@ void buildMemberList(Entry *root)
}
else
{
- QString scope=root->parent->name.copy();
if (root->type.length()>0)
{
if (root->argList)
@@ -1110,7 +1034,9 @@ void buildMemberList(Entry *root)
!(root->parent->section & Entry::COMPOUND_MASK) &&
root->name.find("::")==-1 &&
root->relates.length()==0 &&
- root->type.left(7)!="extern ")
+ root->type.left(7)!="extern " &&
+ root->type.left(8)!="typedef "
+ )
// no member => unrelated function
{
/* check the uniqueness of the function name in the file.
@@ -1153,7 +1079,7 @@ void buildMemberList(Entry *root)
// root->type.data(),root->name.data(),root->args.data());
// new global function
- QString name=removeRedundantWhiteSpace(root->name);
+ QCString name=removeRedundantWhiteSpace(root->name);
MemberDef *md=new MemberDef(root->type,name,root->args,root->exception,
root->protection,root->virt,root->stat,FALSE,
MemberDef::Function,root->tArgList,root->argList);
@@ -1162,8 +1088,9 @@ void buildMemberList(Entry *root)
md->setDocumentation(root->doc);
md->setBriefDescription(root->brief);
md->setPrototype(root->proto);
+ md->setBody(root->body);
md->addSectionsToDefinition(root->anchors);
- QString def;
+ QCString def;
if (root->type.length()>0)
{
if (root->argList)
@@ -1205,7 +1132,8 @@ void buildMemberList(Entry *root)
{
nd = namespaceDict[root->parent->name];
}
- if (nd)
+
+ if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{
nd->insertMember(md);
md->setNamespace(nd);
@@ -1386,22 +1314,23 @@ void computeClassRelations(Entry *root)
if (!cd->visited)
{
cd->visited=TRUE; // mark class as used (in case the are multiple classes
- // with the same name!)
+ // with the same name!)
if (root->extends->count()>0) // there are base classes
{
- QString scopePrefix;
+ QCString scopePrefix;
Entry *p=root->parent;
+ bool found=FALSE;
// For nested classes the base class could also be nested!
// To find the correct scope, we try to prepend the scope to the base
// name, starting with the largest, most inner scope.
- while (p->section&Entry::COMPOUND_MASK)
+ while (p->section&Entry::COMPOUND_MASK && !found)
{
scopePrefix=p->name+"::";
QList<BaseInfo> *baseList=root->extends;
BaseInfo *bi=baseList->first();
- while (bi) // for each base class
+ while (bi && !found) // for each base class
{
- QString cName=scopePrefix+bi->name;
+ QCString cName=scopePrefix+bi->name;
//printf("Base class %s\n",cName.data());
ClassDef *baseClass=getClass(cName);
if (baseClass) // base class is documented
@@ -1411,6 +1340,7 @@ void computeClassRelations(Entry *root)
cd->insertBaseClass(baseClass,bi->prot,bi->virt);
// add this class as super class to the base class
baseClass->insertSuperClass(cd,bi->prot,bi->virt);
+ found=TRUE;
}
//else // base class not documented
//{
@@ -1421,71 +1351,75 @@ void computeClassRelations(Entry *root)
}
p=p->parent;
}
- // The base class could ofcouse also be a non-nested class
- QList<BaseInfo> *baseList=root->extends;
- BaseInfo *bi=baseList->first();
- while (bi) // for each base class
+ if (!found)
{
- ClassDef *baseClass=getClass(bi->name);
- //printf("baseClass %s of %s found (%s and %s)\n",
- // bi->name.data(),
- // root->name.data(),
- // (bi->prot==Private)?"private":((bi->prot==Protected)?"protected":"public"),
- // (bi->virt==Normal)?"normal":"virtual"
- // );
- int i;
- QString templSpec,baseClassName=bi->name.copy();
- if (!baseClass && (i=bi->name.find('<'))!=-1)
- // base class has template specifiers
- {
- // TODO: here we should try to find the correct template specialization
- // but for now, we only look for the unspecializated base class.
- baseClassName=bi->name.left(i);
- baseClass=getClass(baseClassName);
- templSpec=bi->name.right(bi->name.length()-i);
- }
- if (baseClass) // base class is documented
- {
- // add base class to this class
- cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec);
- // add this class as super class to the base class
- baseClass->insertSuperClass(cd,bi->prot,bi->virt,templSpec);
- }
- else // base class not documented
+ // The base class could ofcouse also be a non-nested class
+ QList<BaseInfo> *baseList=root->extends;
+ BaseInfo *bi=baseList->first();
+ while (bi) // for each base class
{
- NamespaceDef *nd=cd->getNamespace();
- //printf("Found undocumented base class `%s' namespace scope=`%s'\n",
- // bi->name.data(),nd ? nd->name().data() : "<none>");
- if (nd && (baseClass=getClass(nd->name()+"::"+baseClassName)))
- // class is defined inside namespace
+ ClassDef *baseClass=getClass(bi->name);
+ //printf("baseClass %s of %s found (%s and %s)\n",
+ // bi->name.data(),
+ // root->name.data(),
+ // (bi->prot==Private)?"private":((bi->prot==Protected)?"protected":"public"),
+ // (bi->virt==Normal)?"normal":"virtual"
+ // );
+ int i;
+ QCString templSpec,baseClassName=bi->name.copy();
+ if (!baseClass && (i=bi->name.find('<'))!=-1)
+ // base class has template specifiers
{
- // add base class to this class
- cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec);
- // add this class as super class to the base class
- baseClass->insertSuperClass(cd,bi->prot,bi->virt,templSpec);
+ // TODO: here we should try to find the correct template specialization
+ // but for now, we only look for the unspecializated base class.
+ baseClassName=bi->name.left(i);
+ baseClass=getClass(baseClassName);
+ templSpec=bi->name.right(bi->name.length()-i);
}
- else // undocumented base class
+ if (baseClass) // base class is documented
{
- baseClass=new ClassDef(bi->name,ClassDef::Class);
// add base class to this class
cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec);
// add this class as super class to the base class
baseClass->insertSuperClass(cd,bi->prot,bi->virt,templSpec);
- // the undocumented base was found in this file
- baseClass->insertUsedFile(root->fileName);
- // add class to the list
- classList.inSort(baseClass);
- //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data());
- //classDict.insert(resolveDefines(bi->name),baseClass);
- classDict.insert(bi->name,baseClass);
}
+ else // base class not documented
+ {
+ NamespaceDef *nd=cd->getNamespace();
+ //printf("Found undocumented base class `%s' namespace scope=`%s'\n",
+ // bi->name.data(),nd ? nd->name().data() : "<none>");
+ if (nd && (baseClass=getClass(nd->name()+"::"+baseClassName)))
+ // class is defined inside namespace
+ {
+ // add base class to this class
+ cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec);
+ // add this class as super class to the base class
+ baseClass->insertSuperClass(cd,bi->prot,bi->virt,templSpec);
+ }
+ else // undocumented base class
+ {
+ //printf(">>> Undocumented base class = %s\n",bi->name.data());
+ baseClass=new ClassDef(baseClassName,ClassDef::Class);
+ // add base class to this class
+ cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec);
+ // add this class as super class to the base class
+ baseClass->insertSuperClass(cd,bi->prot,bi->virt,templSpec);
+ // the undocumented base was found in this file
+ baseClass->insertUsedFile(root->fileName);
+ // add class to the list
+ classList.inSort(baseClass);
+ //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data());
+ //classDict.insert(resolveDefines(bi->name),baseClass);
+ classDict.insert(bi->name,baseClass);
+ }
+ }
+ bi=baseList->next();
}
- bi=baseList->next();
}
}
// else // class has no base classes
// {
-// QString resName=resolveDefines(root->name);
+// QCString resName=resolveDefines(root->name);
// int i;
// // Check if this class is a template instance of another class.
// // If this is the case, we act as if this class `inherits' from the
@@ -1570,7 +1504,7 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
{
//printf("addMemberDocs: `%s'::`%s' `%s' funcDecl=`%s'\n",
// root->parent->name.data(),md->name().data(),md->argsString(),funcDecl);
- QString fDecl=funcDecl;
+ QCString fDecl=funcDecl;
// strip extern specifier
if (fDecl.left(7)=="extern ") fDecl=fDecl.right(fDecl.length()-7);
md->setDefinition(fDecl);
@@ -1580,10 +1514,13 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
cd ? cd->name().data() : 0,
nd ? nd->name().data() : 0
)
- ) mergeArguments(md->argumentList(),root->argList);
+ )
+ {
+ mergeArguments(md->argumentList(),root->argList);
+ }
if (over_load) // the \overload keyword was used
{
- QString doc=getOverloadDocs();
+ QCString doc=getOverloadDocs();
if (!root->doc.isNull())
{
doc+="<p>";
@@ -1596,7 +1533,7 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
// documentation outside a compound overrides the documentation inside it
if ( /* !md->isStatic() && !root->stat && do not replace doc of a static */
(
- !md->documentation() || /* no docs yet */
+ md->documentation().isEmpty() || /* no docs yet */
(root->parent->name.isNull() && /* or overwrite prototype docs */
!root->proto && md->isPrototype() /* with member definition docs */
)
@@ -1610,13 +1547,18 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
// outside it
if ( /* !md->isStatic() && !root->stat && do not replace doc of static */
(
- !md->briefDescription() || /* no docs yet */
- !root->parent->name.isNull() /* member of a class */
+ md->briefDescription().isEmpty() || /* no docs yet */
+ !root->parent->name.isNull() /* member of a class */
) && root->brief.length()>0
)
{
md->setBriefDescription(root->brief);
}
+
+ if (md->bodyCode().isEmpty() && !root->body.isEmpty()) /* no body yet */
+ {
+ md->setBody(root->body);
+ }
}
md->setDefFile(root->fileName);
md->setDefLine(root->startLine);
@@ -1630,13 +1572,13 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
// function declaration `decl' to the corresponding member definition.
bool findUnrelatedFunction(Entry *root,
- const QString &namespaceName,
+ const QCString &namespaceName,
const char *name,
const char *,
const char *decl)
{
MemberName *mn=0;
- QString n=name;
+ QCString n=name;
if (n.find("::")!=-1) return FALSE; // skip undefined class members
//printf("findUnrelatedFunction(%s)\n",name);
if (n.length()>0 && (mn=functionNameDict[n])) // function name defined
@@ -1646,7 +1588,7 @@ bool findUnrelatedFunction(Entry *root,
while (md)
{
NamespaceDef *nd=md->getNamespace();
- QString nsName = nd ? nd->name().data() : "";
+ QCString nsName = nd ? nd->name().data() : "";
if (namespaceName.length()==0 ||
nsName==namespaceName)
{
@@ -1698,6 +1640,89 @@ bool findUnrelatedFunction(Entry *root,
return TRUE;
}
+void substituteTemplateArgNames(ArgumentList *src,
+ const QCString &s,
+ ArgumentList *tempArgs,
+ ArgumentList *dst)
+{
+ ArgumentListIterator ali(*src);
+ Argument *a=0;
+ for (ali.toFirst();(a=ali.current());++ali) // for each member argument
+ {
+ QCString type=a->type.copy();
+ bool isReplaced=FALSE;
+ QRegExp re(idMask);
+ int i,p=0,l,c=0;
+ while ((i=re.match(s,p,&l))!=-1) // for each template name found at the
+ // member definition
+ {
+ Argument *ta = tempArgs->at(c);
+ if (ta) // get matching template argument of the class
+ {
+ QCString dstName=s.mid(i,l);
+ QCString srcName=ta->type.copy();
+ int bi;
+ if ((bi=srcName.findRev(' '))!=-1) // search for separator
+ {
+ // strip the type specifier (usuall class or typename)
+ srcName=srcName.right(srcName.length()-bi-1);
+ }
+
+ //if (srcName.left(6)=="class ") srcName=srcName.right(srcName.length()-6);
+ //if (srcName.left(9)=="typename ") srcName=srcName.right(srcName.length()-9);
+ //printf("Template Name = `%s' -> `%s'\n",srcName.data(),dstName.data());
+ if (srcName!=dstName) /* we need to substitute */
+ {
+ int ti,tp=0;
+ QCString result;
+ int sl=srcName.length();
+ while ((ti=type.find(srcName,tp))!=-1)
+ {
+ result+=type.mid(tp,ti-tp);
+ if (
+ (ti==0 || !isId(type.at(ti-1))) &&
+ (ti+sl==(int)type.length() || !isId(type.at(ti+sl)))
+ ) /* idenitifier -> replace */
+ {
+ result+=dstName;
+ }
+ else /* substring of an identifier */
+ {
+ result+=srcName;
+ }
+ tp=ti+sl;
+ }
+ result+=type.right(type.length()-tp);
+ type=result;
+ isReplaced = TRUE;
+ }
+ }
+ p=i+l;
+ c++;
+ }
+ Argument *na = new Argument(*a);
+ if (isReplaced)
+ {
+ //printf("Template Arg: `%s' -> `%s'\n",na->type.data(),type.data());
+ na->type=type;
+ }
+ else
+ {
+ //printf("Template Arg `%s' not changed\n",a->type.data());
+ }
+ dst->append(na);
+ }
+ //printf("substituteTemplateArgNames(src=`%s',tempNameStr=`%s',tempArgs=`%s',dest=`%s')\n",
+ // argListToString(src).data(),
+ // s.data(),
+ // argListToString(tempArgs).data(),
+ // argListToString(dst).data()
+ // );
+ dst->constSpecifier = src->constSpecifier;
+ dst->volatileSpecifier = src->volatileSpecifier;
+ dst->pureSpecifier = src->pureSpecifier;
+
+}
//----------------------------------------------------------------------
// This function tries to find a member (in a documented class/file/namespace)
@@ -1710,23 +1735,28 @@ bool findUnrelatedFunction(Entry *root,
// The boolean overloaded is used to specify whether or not a standard
// overload documentation line should be generated.
-void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
+void findMember(Entry *root,QCString funcDecl,QCString related,bool overloaded,
bool isFunc)
{
Debug::print(Debug::FindMembers,0,
- "findMember(root=%p,funcDecl=`%s',related=`%s',overload=%d,isFunc=%d)\n",
- root,funcDecl.data(),related.data(),overloaded,isFunc
+ "findMember(root=%p,funcDecl=`%s',related=`%s',overload=%d,isFunc=%d\n====\ndoc=%s\n====\n)\n",
+ root,funcDecl.data(),related.data(),overloaded,isFunc,root->doc.data()
);
+ if (Config::includeSourceFlag && !root->body.isEmpty())
+ {
+ //printf("Function: %s\n-----------------\n%s\n------------------\n",
+ //root->name.data(),root->body.data());
+ }
- QString scopeName;
- QString className;
- QString namespaceName;
- QString classTempList;
- QString funcType;
- QString funcName;
- QString funcArgs;
- QString funcTempList;
- QString exceptions;
+ QCString scopeName;
+ QCString className;
+ QCString namespaceName;
+ QCString classTempList;
+ QCString funcType;
+ QCString funcName;
+ QCString funcArgs;
+ QCString funcTempList;
+ QCString exceptions;
bool isRelated=FALSE;
bool isFriend=FALSE;
@@ -1764,7 +1794,8 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
// if a related class name is specified and the class name could
// not be derived from the function declaration, then use the
// related field.
- //printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data());
+ //printf("scopeName=`%s' classTempList=`%s' className=`%s'\n",
+ // scopeName.data(),classTempList.data(),className.data());
if (/*scopeName.isEmpty() &&*/ !related.isEmpty() && !isRelated)
{
isRelated=TRUE;
@@ -1805,6 +1836,41 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
}
}
+ // see if (part of) the scope name is a namespace name
+ extractNamespaceName(scopeName,className,namespaceName);
+
+ QCString tempScopeName=scopeName.copy();
+ int ti;
+ int spi = namespaceName.isEmpty() ? 0 : namespaceName.length()+2;
+ if ((ti=tempScopeName.find("::",spi))!=-1 && !classTempList.isEmpty())
+ {
+ // insert template parameters after the first scope name
+ tempScopeName=tempScopeName.left(ti)+classTempList+
+ tempScopeName.right(tempScopeName.length()-ti);
+ }
+ else
+ {
+ tempScopeName+=classTempList;
+ }
+
+
+ if (root->tArgList==0 && !classTempList.isEmpty())
+ {
+ // no template specifiers found during parsing (because \fn was used),
+ // but there are template names in the scope, so we build the template
+ // specifiers from that.
+ root->tArgList = new ArgumentList;
+ QRegExp re(idMask);
+ int i,p=0,l;
+ while ((i=re.match(classTempList,p,&l))!=-1) // for each template name found
+ {
+ Argument *a = new Argument;
+ a->type = "class "+classTempList.mid(i,l);
+ root->tArgList->append(a);
+ p=i+l;
+ }
+ }
+
//printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data());
// rebuild the function declaration (needed to get the scope right).
if (scopeName.length()>0 && !isRelated && !isFriend)
@@ -1813,22 +1879,22 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
{
if (isFunc) // a function -> we use argList for the arguments
{
- funcDecl=funcType+" "+scopeName+classTempList+"::"+funcName+funcTempList;
+ funcDecl=funcType+" "+tempScopeName+"::"+funcName+funcTempList;
}
else
{
- funcDecl=funcType+" "+scopeName+classTempList+"::"+funcName+funcArgs;
+ funcDecl=funcType+" "+tempScopeName+"::"+funcName+funcArgs;
}
}
else
{
if (isFunc) // a function => we use argList for the arguments
{
- funcDecl=scopeName+classTempList+"::"+funcName+funcTempList;
+ funcDecl=tempScopeName+"::"+funcName+funcTempList;
}
else // variable => add `argument' list
{
- funcDecl=scopeName+classTempList+"::"+funcName+funcArgs;
+ funcDecl=tempScopeName+"::"+funcName+funcArgs;
}
}
}
@@ -1858,12 +1924,10 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
}
}
- QString fullFuncDecl=funcDecl.copy();
+ QCString fullFuncDecl=funcDecl.copy();
if (isFunc) fullFuncDecl+=argListToString(root->argList);
//printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data());
- // see if (part of) the scope name is a namespace name
- extractNamespaceName(scopeName,className,namespaceName);
//printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data());
// destructor => do backward class name substitution if needed
@@ -1902,11 +1966,11 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
if (className.length()>0) // class name is valid
{
int count=0;
- MemberDef *md=mn->first();
+ MemberDef *md=mn->first(); // for each member with that name
while (md)
{
ClassDef *cd=md->memberClass();
- //printf("Member %s member className=%s this className=%s\n",md->name().data(),cd->name().data(),className.data());
+ //printf("Member %s (member scopeName=%s) (this scopeName=%s) classTempList=%s\n",md->name().data(),cd->name().data(),scopeName.data(),classTempList.data());
ClassDef *tcd=0;
if (classTempList.length()>0) // try to find the correct specialization
{
@@ -1917,15 +1981,60 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
{
tcd=getClass(scopeName);
}
- //printf("tcd=%p\n",tcd);
- if (cd && tcd==cd)
+ if (cd && tcd==cd) // member's classes match
{
- //printf("Class %s\n",cd->name().data());
+ int ci;
+ ArgumentList *classTemplArgs = cd->templateArguments();
+ if ((ci=cd->name().find("::"))!=-1) // nested class
+ {
+ ClassDef *parentClass = getClass(cd->name().left(ci));
+ if (parentClass)
+ classTemplArgs = parentClass->templateArguments();
+ }
+ //printf("cd->name=%s classTemplArgs=%s\n",cd->name().data(),
+ // argListToString(classTemplArgs).data());
+ ArgumentList *argList = 0;
+ bool substDone=FALSE;
+ if (!classTempList.isEmpty() &&
+ classTemplArgs &&
+ md->argumentList()
+ )
+ {
+ /* the function definition has template arguments
+ * and the class also has template arguments, so
+ * we must substitute the template names if they are
+ * different before doing the match
+ */
+ argList = new ArgumentList;
+ argList->setAutoDelete(TRUE);
+ substituteTemplateArgNames(
+ md->argumentList(), /* source argument list */
+ classTempList, /* template names source */
+ classTemplArgs, /* template names dest */
+ argList /* dest argument list */
+ );
+ substDone=TRUE;
+ }
+ else /* no template arguments, compare argument lists directly */
+ {
+ argList = md->argumentList();
+ }
bool matching=
md->isVariable() || md->isTypedef() || // needed for function pointers
(md->argumentList()==0 && root->argList->count()==0) ||
- matchArguments(md->argumentList(), root->argList,
- className,namespaceName);
+ matchArguments(argList, root->argList,className,namespaceName);
+
+ if (substDone) // found a new argument list
+ {
+ //printf("root->tArgList=`%s'\n",argListToString(root->tArgList).data());
+ if (matching) // replace member's argument list
+ {
+ md->setScopeTemplateArguments(root->tArgList);
+ md->setArgumentList(argList);
+ }
+ else // no match -> delete argument list
+ delete argList;
+ }
if (matching)
{
addMemberDocs(root,md,funcDecl,overloaded);
@@ -1975,7 +2084,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
ASSERT(md);
ClassDef *cd=md->memberClass();
ASSERT(cd);
- QString className=cd->name().copy();
+ QCString className=cd->name().copy();
md=mn->next();
bool unique=TRUE;
while (md)
@@ -1997,7 +2106,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
mtype,root->tArgList,root->argList);
md->setMemberClass(cd);
md->setDefinition(funcDecl);
- QString doc=getOverloadDocs();
+ QCString doc=getOverloadDocs();
doc+="<p>";
doc+=root->doc;
md->setDocumentation(doc);
@@ -2007,6 +2116,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
md->setDefLine(root->startLine);
md->setPrototype(root->proto);
md->addSectionsToDefinition(root->anchors);
+ md->setBody(root->body);
mn->inSort(md);
cd->insertMember(md);
cd->insertUsedFile(root->fileName);
@@ -2071,6 +2181,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded,
md->setDefFile(root->fileName);
md->setDefLine(root->startLine);
md->setPrototype(root->proto);
+ md->setBody(root->body);
md->addSectionsToDefinition(root->anchors);
mn->inSort(md);
cd->insertMember(md);
@@ -2118,8 +2229,8 @@ void findMemberDocumentation(Entry *root)
int i,l;
QRegExp re("([a-zA-Z0-9: ]*\\*+[ \\*]*");
Debug::print(Debug::FindMembers,0,
- "root->type=`%s' root->name=`%s' root->args=`%s'\n",
- root->type.data(),root->name.data(),root->args.data()
+ "root->type=`%s' root->name=`%s' root->args=`%s' section=%x\n",
+ root->type.data(),root->name.data(),root->args.data(),root->section
);
bool isFunc=TRUE;
if ((i=re.match(root->type,0,&l))!=-1) // func variable/typedef to func ptr
@@ -2151,8 +2262,12 @@ void findMemberDocumentation(Entry *root)
//printf("Overloaded member %s found\n",root->name.data());
findMember(root,root->name,root->relates,TRUE,isFunc);
}
- else if (root->section==Entry::FUNCTION_SEC &&
- (root->doc.length()>0 || root->brief.length()>0 || extractAllFlag))
+ else if
+ (root->section==Entry::FUNCTION_SEC &&
+ (!root->doc.isEmpty() || !root->brief.isEmpty() ||
+ !root->body.isEmpty() /*|| Config::extractAllFlag*/
+ )
+ )
{
//printf("Documentation for member `%s' found args=`%s' excp=`%s'\n",
// root->name.data(),root->args.data(),root->exception.data());
@@ -2179,6 +2294,10 @@ void findMemberDocumentation(Entry *root)
//if (root->relates.length()>0) printf(" Relates %s\n",root->relates.data());
findMember(root,root->name,root->relates,FALSE,FALSE);
}
+ else
+ {
+ // skip section
+ }
EntryListIterator eli(*root->sublist);
Entry *e;
for (;(e=eli.current());++eli)
@@ -2195,31 +2314,31 @@ void findEnums(Entry *root)
if (root->section==Entry::ENUM_SEC)
// non anonymous enumeration
{
- MemberDef *md=0;
- ClassDef *cd=0;
- FileDef *fd=0;
- NamespaceDef *nd=0;
+ MemberDef *md=0;
+ ClassDef *cd=0;
+ FileDef *fd=0;
+ NamespaceDef *nd=0;
MemberNameDict *mnd=0;
MemberNameList *mnl=0;
bool isGlobal;
//printf("Found enum with name `%s'\n",root->name.data());
int i;
- QString name;
+ QCString name;
if ((i=root->name.findRev("::"))!=-1) // scope is specified
{
- QString scope=root->name.left(i); // extract scope
+ QCString scope=root->name.left(i); // extract scope
name=root->name.right(root->name.length()-i-2); // extract name
- cd=getClass(scope);
- if (!cd) nd=namespaceDict[scope];
+ if ((cd=getClass(scope))==0) nd=namespaceDict[scope];
}
else // no scope, check the scope in which the docs where found
{
- if (( root->parent->section & Entry::COMPOUND_MASK )
+ if (( root->parent->section & Entry::SCOPE_MASK )
&& root->parent->name.length()>0
) // found enum docs inside a compound
{
- cd=getClass(root->parent->name);
+ QCString scope=root->parent->name;
+ if ((cd=getClass(scope))==0) nd=namespaceDict[scope];
}
name=root->name.copy();
}
@@ -2231,7 +2350,7 @@ void findEnums(Entry *root)
mnl=&memberNameList;
isGlobal=FALSE;
}
- else if (nd) // found enum inside namespace
+ else if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') // found enum inside namespace
{
mnd=&functionNameDict;
mnl=&functionNameList;
@@ -2254,7 +2373,7 @@ void findEnums(Entry *root)
md->setDefFile(root->fileName);
md->setDefLine(root->startLine);
md->addSectionsToDefinition(root->anchors);
- if (nd)
+ if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{
md->setDefinition(nd->name()+"::"+name);
nd->insertMember(md);
@@ -2299,12 +2418,12 @@ void findEnums(Entry *root)
// get list of members with the same name as the field
{
MemberDef *fmd=fmn->first();
- while (fmd) // search for the class with the right name
+ while (fmd) // search for the scope with the right name
{
- if (nd)
+ if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{
NamespaceDef *fnd=fmd->getNamespace();
- if (fnd==nd)
+ if (fnd==nd) // enum value is inside a namespace
{
md->insertEnumField(fmd);
fmd->setEnumScope(md);
@@ -2313,7 +2432,7 @@ void findEnums(Entry *root)
else if (isGlobal)
{
FileDef *ffd=fmd->getFileDef();
- if (ffd==fd)
+ if (ffd==fd) // enum value has file scope
{
md->insertEnumField(fmd);
fmd->setEnumScope(md);
@@ -2322,7 +2441,7 @@ void findEnums(Entry *root)
else
{
ClassDef *fcd=fmd->memberClass();
- if (fcd==cd)
+ if (fcd==cd) // enum value is inside a class
{
md->insertEnumField(fmd); // add field def to list
fmd->setEnumScope(md); // cross ref with enum name
@@ -2358,10 +2477,10 @@ void findEnumDocumentation(Entry *root)
//printf("Found docs for enum with name `%s'\n",root->name.data());
int i;
ClassDef *cd=0;
- QString name;
+ QCString name;
if ((i=root->name.findRev("::"))!=-1) // scope is specified
{
- QString scope=root->name.left(i); // extract scope
+ QCString scope=root->name.left(i); // extract scope
name=root->name.right(root->name.length()-i-2); // extract name
cd=getClass(scope);
//printf("Scope=`%s' Name=`%s'\n",scope.data(),name.data());
@@ -2382,7 +2501,7 @@ void findEnumDocumentation(Entry *root)
if (cd)
{
//printf("Enum: scope=`%s' name=`%s'\n",cd->name(),name.data());
- QString className=cd->name().copy();
+ QCString className=cd->name().copy();
MemberName *mn=memberNameDict[name];
if (mn)
{
@@ -2519,29 +2638,30 @@ void computeMemberRelations()
while (mn) // for each member name
{
MemberNameIterator mdi(*mn);
- for ( ; mdi.current() ; ++mdi) // for each function with a specific name
+ for ( ; mdi.current() ; ++mdi) // for each member with a specific arg list
{
MemberDef *md=mdi.current();
MemberNameIterator bmdi(*mn);
- for ( ; bmdi.current() ; ++bmdi) // for each other function with that name
+ for ( ; bmdi.current() ; ++bmdi) // for each other member with that signature
{
MemberDef *bmd=bmdi.current();
- if (md!=bmd && bmd->memberClass() && md->memberClass() &&
- isBaseClass(bmd->memberClass(),md->memberClass()))
+ ClassDef *bmcd = bmd->memberClass();
+ ClassDef *mcd = md->memberClass();
+ //printf("Check relation between `%s'::`%s' and `%s'::`%s'\n",
+ // mcd->name().data(),md->name().data(),
+ // bmcd->name().data(),bmd->name().data()
+ // );
+ if (md!=bmd && bmcd && mcd && isBaseClass(bmcd,mcd))
{
- //printf("Checking Base: %s\nWith normal : %s\n",bmd->definition(),md->definition());
- if (/*matchArguments(bmd->argsString(),md->argsString())*/
- matchArguments(bmd->argumentList(),md->argumentList())
- )
+ //printf(" Base argList=`%s'\n Super argList=`%s'\n",
+ // argListToString(bmd->argumentList()).data(),
+ // argListToString(md->argumentList()).data()
+ // );
+ if ( matchArguments(bmd->argumentList(),md->argumentList()) )
{
- //printf("Base: %s\nNorm: %s\n",bmd->definition(),md->definition());
- ClassDef *bmcd = bmd->memberClass();
- ClassDef *mcd = md->memberClass();
+ //printf(" match found!\n");
if (mcd && bmcd &&
- (bmcd->protection()!=Private || extractPrivateFlag) &&
- (bmcd->hasDocumentation() || !hideClassFlag) &&
- (mcd->protection()!=Private || extractPrivateFlag) &&
- (mcd->hasDocumentation() || !hideClassFlag)
+ mcd->isVisibleExt() && bmcd->isVisibleExt()
)
{
md->setReimplements(bmd);
@@ -2564,7 +2684,7 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
//if (mcd->flag==TRUE)
//{
// err("Error: Cyclic inhertance dependency found for class %s\n",mcd->name());
- // return;
+ // return;
//}
//mcd->flag=TRUE;
@@ -2618,6 +2738,7 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
found =
/*matchArguments(srcMd->argsString(),dstMd->argsString());*/
matchArguments(srcMd->argumentList(),dstMd->argumentList());
+ ambigue=!found;
}
else // member is in a non base class => multiple inheritance
// using the same base class.
@@ -2627,7 +2748,7 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
// dstMd->name().data(),
// dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
- QString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
+ QCString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
dstMi->ambiguityResolutionScope.prepend(scope);
ambigue=TRUE;
@@ -2648,7 +2769,7 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
// dstMd->name().data(),
// dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
- QString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
+ QCString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
dstMi->ambiguityResolutionScope.prepend(scope);
ambigue=TRUE;
@@ -2660,7 +2781,6 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
Specifier virt=srcMi->virt;
if (srcMi->virt==Normal && bcd->virt!=Normal) virt=bcd->virt;
MemberInfo *newMi = new MemberInfo(srcMd,bcd->prot,virt);
- //if (srcMi->memberDef->memberClass()!=bClass)
newMi->scopePath=bClass->name()+"::"+srcMi->scopePath;
if (ambigue)
{
@@ -2669,7 +2789,7 @@ void mergeMembers(ClassDef *cd,BaseClassList *bcl)
// srcMd->name().data(),
// bClass->name().data());
- QString scope=bClass->name().copy(); scope+="::";
+ QCString scope=bClass->name().copy(); scope+="::";
if (scope!=srcMi->ambiguityResolutionScope.left(scope.length()))
newMi->ambiguityResolutionScope=
scope+srcMi->ambiguityResolutionScope;
@@ -2764,7 +2884,8 @@ void generateFileDocs()
void generateClassDocs()
{
// write the installdox script if necessary
- if (generateHtml && (tagFileList.count()>0 || searchEngineFlag))
+ if (Config::generateHtml &&
+ (Config::tagFileList.count()>0 || Config::searchEngineFlag))
writeInstallScript();
msg("Generating index page...\n");
@@ -2797,8 +2918,8 @@ void generateClassDocs()
if (!cd->isReference() &&
//!cd->name().isEmpty() &&
//cd->name().at(0)!='@' &&
- //(cd->protection()!=Private || extractPrivateFlag) &&
- //(cd->hasDocumentation() || !hideClassFlag)
+ //(cd->protection()!=Private || Config::extractPrivateFlag) &&
+ //(cd->hasDocumentation() || !Config::hideClassFlag)
cd->isVisible()
)
// skip external references and anonymous compounds
@@ -2807,7 +2928,7 @@ void generateClassDocs()
cd->writeDocumentation(*outputList);
cd->writeMemberList(*outputList);
- if (verbatimHeaderFlag) cd->writeIncludeFile(*outputList);
+ if (Config::verbatimHeaderFlag) cd->writeIncludeFile(*outputList);
}
}
}
@@ -2912,31 +3033,33 @@ void buildPageList(Entry *root)
}
else
{
- QString baseName=root->name.copy();
+ QCString baseName=root->name.copy();
if (baseName.right(4)==".tex")
baseName=baseName.left(baseName.length()-4);
else if (baseName.right(5)==".html")
baseName=baseName.left(baseName.length()-5);
pi=new PageInfo(baseName, root->doc,
root->args.stripWhiteSpace());
- setFileNameForSections(root->anchors,root->name);
+ QCString pageName;
+ if (Config::caseSensitiveNames)
+ pageName=pi->name.copy();
+ else
+ pageName=pi->name.lower();
+ setFileNameForSections(root->anchors,pageName);
+
pageList.append(pi);
pageDict.insert(baseName,pi);
if (pi->title.length()>0)
{
- QString pageName;
- if (caseSensitiveNames)
- pageName=pi->name.copy();
- else
- pageName=pi->name.lower();
//outputList->writeTitle(pi->name,pi->title);
// a page name is a label as well!
SectionInfo *si=new SectionInfo(
pi->name,pi->title,SectionInfo::Section);
si->fileName=pageName+".html";
+ //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
//printf("Adding section info %s\n",pi->name.data());
- sectionDict.insert(pi->name,si);
+ sectionDict.insert(pageName,si);
}
}
}
@@ -2979,8 +3102,8 @@ void generatePageDocs()
{
msg("Generating docs for page %s...\n",pi->name.data());
outputList->disable(OutputGenerator::Man);
- QString pageName;
- if (caseSensitiveNames)
+ QCString pageName;
+ if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
@@ -3047,7 +3170,7 @@ void generateExampleDocs()
while (pi)
{
msg("Generating docs for example %s...\n",pi->name.data());
- QString n=convertSlashes(pi->name,TRUE)+"-example";
+ QCString n=convertSlashes(pi->name,TRUE)+"-example";
startFile(*outputList,n,"Example Documentation");
//outputList->writeTitle(pi->name,pi->name);
parseExample(*outputList,pi->doc+"\n\\include "+pi->name,pi->name);
@@ -3081,37 +3204,64 @@ void generateNamespaceDocs()
NamespaceDef *nd;
for (;(nd=nli.current());++nli)
{
- msg("Generating docs for namespace %s\n",nd->name().data());
- nd->writeDocumentation(*outputList);
+ if ((nd->getReference() || nd->hasDocumentation()) &&
+ !nd->name().isEmpty() && nd->name().at(0)!='@')
+ {
+ msg("Generating docs for namespace %s\n",nd->name().data());
+ nd->writeDocumentation(*outputList);
+ }
}
}
+#if defined(_WIN32)
+static QCString fixSlashes(QCString &s)
+{
+ QCString result;
+ uint i;
+ for (i=0;i<s.length();i++)
+ {
+ switch(s.at(i))
+ {
+ case '/':
+ case '\\':
+ result+="\\\\";
+ break;
+ default:
+ result+=s.at(i);
+ }
+ }
+ return result;
+}
+#endif
+
+
//----------------------------------------------------------------------------
// generate files for the search engine
void generateSearchIndex()
{
- if (searchEngineFlag && generateHtml)
+ if (Config::searchEngineFlag && Config::generateHtml)
{
// create search index
- QString fileName;
- writeSearchButton(htmlOutputDir);
+ QCString fileName;
+ writeSearchButton(Config::htmlOutputDir);
+#if !defined(_WIN32)
// create cgi script
- fileName = htmlOutputDir+"/"+cgiName;
+ fileName = Config::htmlOutputDir+"/"+Config::cgiName;
QFile f(fileName);
if (f.open(IO_WriteOnly))
{
QTextStream t(&f);
t << "#!/bin/sh" << endl
- << "DOXYSEARCH=" << binAbsPath << "/doxysearch" << endl
- << "DOXYPATH=" << docAbsPath << " ";
+ << "DOXYSEARCH=" << Config::binAbsPath << "/doxysearch" << endl
+ << "DOXYPATH=" << Config::docAbsPath << " ";
- char *s=extDocPathList.first();
+ char *s=Config::extDocPathList.first();
while (s)
{
t << s << " ";
- s=extDocPathList.next();
+ s=Config::extDocPathList.next();
}
t << endl
@@ -3121,28 +3271,65 @@ void generateSearchIndex()
<< "else" << endl
<< " echo \"Content-Type: text/html\"" << endl
<< " echo \"\"" << endl
- << " echo \"<H1>Error: $DOXYSEARCH not found. Check cgi script!\"" << endl
+ << " echo \"<h2>Error: $DOXYSEARCH not found. Check cgi script!</h2>\"" << endl
<< "fi" << endl;
f.close();
struct stat stat_struct;
stat(fileName,&stat_struct);
-#if !defined(_WIN32)
chmod(fileName,stat_struct.st_mode|S_IXUSR|S_IXGRP|S_IXOTH);
-#endif
}
else
{
err("Error: Cannot open file %s for writing\n",fileName.data());
}
+#else /* Windows platform */
+ // create cgi program
+ fileName = Config::cgiName.copy();
+ if (fileName.right(4)==".cgi")
+ fileName=fileName.left(fileName.length()-4);
+ fileName+=".c";
+ fileName.prepend(Config::htmlOutputDir+"/");
+ QFile f(fileName);
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream t(&f);
+ t << "#include <stdio.h>" << endl;
+ t << "#include <stdlib.h>" << endl;
+ t << "#include <process.h>" << endl;
+ t << endl;
+ t << "const char *DOXYSEARCH = \"" <<
+ fixSlashes(Config::binAbsPath) << "\\\\doxysearch.exe\";" << endl;
+ t << "const char *DOXYPATH = \"" <<
+ fixSlashes(Config::docAbsPath) << "\";" << endl;
+ t << endl;
+ t << "int main(void)" << endl;
+ t << "{" << endl;
+ t << " char buf[1024];" << endl;
+ t << " sprintf(buf,\"%s %s\",DOXYSEARCH,DOXYPATH);" << endl;
+ t << " if (system(buf))" << endl;
+ t << " {" << endl;
+ t << " printf(\"Content-Type: text/html\\n\\n\");" << endl;
+ t << " printf(\"<h2>Error: failed to execute %s</h2>\\n\",DOXYSEARCH);" << endl;
+ t << " exit(1);" << endl;
+ t << " }" << endl;
+ t << " return 0;" << endl;
+ t << "}" << endl;
+ f.close();
+ }
+ else
+ {
+ err("Error: Cannot open file %s for writing\n",fileName.data());
+ }
+#endif /* !defined(_WIN32) */
// create config file
- fileName = htmlOutputDir+"/search.cfg";
+ fileName = Config::htmlOutputDir+"/search.cfg";
f.setName(fileName);
if (f.open(IO_WriteOnly))
{
QTextStream t(&f);
- t << docURL << endl << cgiURL << "/" << cgiName << endl;
+ t << Config::docURL << endl << Config::cgiURL << "/" << Config::cgiName << endl;
f.close();
}
else
@@ -3194,7 +3381,7 @@ void generateConfigFile(const char *configFile,bool shortList)
//----------------------------------------------------------------------------
// read and parse a tag file
-bool readLineFromFile(QFile &f,QString &s)
+bool readLineFromFile(QFile &f,QCString &s)
{
char c=0;
s.resize(0);
@@ -3226,7 +3413,12 @@ bool patternMatch(QFileInfo *fi,QStrList *patList)
char *pattern=patList->first();
while (pattern && !found)
{
- found = found || QDir::match(pattern,fi->fileName());
+#if defined(_WIN32) // windows
+ QRegExp re(pattern,FALSE,TRUE); // case insensitive match
+#else // unix
+ QRegExp re(pattern,TRUE,TRUE); // case sensitive match
+#endif
+ found = found || re.match(fi->fileName())!=-1;
pattern=patList->next();
}
}
@@ -3245,7 +3437,7 @@ void copyAndFilterFile(const char *fileName,BufStr &dest)
QFileInfo fi(fileName);
if (!fi.exists()) return;
- if (inputFilter.isEmpty())
+ if (Config::inputFilter.isEmpty())
{
QFile f(fileName);
if (!f.open(IO_ReadOnly))
@@ -3266,11 +3458,11 @@ void copyAndFilterFile(const char *fileName,BufStr &dest)
{
int c;
// char *p=dest;
- QString cmd=inputFilter+" "+fileName;
+ QCString cmd=Config::inputFilter+" "+fileName;
FILE *f=popen(cmd,"r");
if (!f)
{
- err("Error: could not execute filter %s\n",inputFilter.data());
+ err("Error: could not execute filter %s\n",Config::inputFilter.data());
return;
}
while ((c=fgetc(f))!=EOF) dest.addChar(c),size++;
@@ -3295,17 +3487,17 @@ void copyAndFilterFile(const char *fileName,BufStr &dest)
void readFiles(BufStr &output)
{
- QString *s=inputFiles.first();
+ QCString *s=inputFiles.first();
// char *p=output.data();
while (s)
{
- QString fileName=*s;
+ QCString fileName=*s;
//int fileSize=fi->fileInfo()->size();
int fileNameSize=fileName.length();
//int streamLength=fileSize+fileNameSize+4;
- //QString fileText(streamLength);
+ //QCString fileText(streamLength);
// add begin filename marker
// *p++=0x06;
@@ -3320,7 +3512,7 @@ void readFiles(BufStr &output)
output.addChar(0x06);
// *p++='\n'; // to make ^ work while scanning the first line of a file!
output.addChar('\n');
- if (preprocessingFlag)
+ if (Config::preprocessingFlag)
{
msg("Preprocessing %s...\n",s->data());
preprocessFile(fileName,output);
@@ -3376,7 +3568,7 @@ int readDir(QFileInfo *fi,
patternMatch(cfi,patList) && !patternMatch(cfi,exclPatList))
{
totalSize+=cfi->size()+cfi->absFilePath().length()+4;
- QString name=cfi->fileName();
+ QCString name=convertToQCString(cfi->fileName());
if (fnDict)
{
FileDef *fd=new FileDef(cfi->dirPath()+"/",name);
@@ -3393,15 +3585,15 @@ int readDir(QFileInfo *fi,
fnDict->insert(name,fn);
}
}
- QString *rs=0;
+ QCString *rs=0;
if (resultList || resultDict)
{
- rs=new QString(cfi->absFilePath());
+ rs=new QCString(cfi->absFilePath());
}
if (resultList) resultList->append(rs);
if (resultDict) resultDict->insert(cfi->absFilePath(),rs);
}
- else if (recursiveFlag && cfi->isDir() && cfi->fileName()!="." &&
+ else if (Config::recursiveFlag && cfi->isDir() && cfi->fileName()!="." &&
cfi->fileName()!="..")
{
cfi->setFile(cfi->absFilePath());
@@ -3417,9 +3609,9 @@ int readDir(QFileInfo *fi,
//----------------------------------------------------------------------------
// read the file with name `name' into a string.
-QString readExampleFile(const char *name)
+QCString readExampleFile(const char *name)
{
- QString example;
+ QCString example;
QFileInfo fi(name);
if (fi.exists())
{
@@ -3477,7 +3669,7 @@ int readFileOrDirectory(const char *s,
{
totalSize+=fi.size()+fi.absFilePath().length()+4; //readFile(&fi,fiList,input);
//fiList->inSort(new FileInfo(fi));
- QString name=fi.fileName();
+ QCString name=convertToQCString(fi.fileName());
if (fnDict)
{
FileDef *fd=new FileDef(fi.dirPath(TRUE)+"/",name);
@@ -3494,10 +3686,10 @@ int readFileOrDirectory(const char *s,
fnDict->insert(name,fn);
}
}
- QString *rs=0;
+ QCString *rs=0;
if (resultList || resultDict)
{
- rs=new QString(fi.absFilePath());
+ rs=new QCString(fi.absFilePath());
}
if (resultList) resultList->append(rs);
if (resultDict) resultDict->insert(fi.absFilePath(),rs);
@@ -3514,11 +3706,11 @@ int readFileOrDirectory(const char *s,
void readFormulaRepository()
{
- QFile f(htmlOutputDir+"/formula.repository");
+ QFile f(Config::htmlOutputDir+"/formula.repository");
if (f.open(IO_ReadOnly)) // open repository
{
QTextStream t(&f);
- QString line;
+ QCString line;
while (!t.eof())
{
line=t.readLine();
@@ -3530,8 +3722,8 @@ void readFormulaRepository()
}
else
{
- QString formName = line.left(se);
- QString formText = line.right(line.length()-se-1);
+ QCString formName = line.left(se);
+ QCString formText = line.right(line.length()-se-1);
Formula *f=new Formula(formText);
formulaList.append(f);
formulaDict.insert(formText,f);
@@ -3627,7 +3819,7 @@ int main(int argc,char **argv)
}
QFileInfo configFileInfo1("Doxyfile"),configFileInfo2("doxyfile");
- QString config;
+ QCString config;
if (optind>=argc)
{
if (configFileInfo1.exists())
@@ -3646,23 +3838,24 @@ int main(int argc,char **argv)
config=fileToString(argv[1]);
parseConfig(config);
+ checkConfig();
/**************************************************************************
* Initialize output generators *
**************************************************************************/
outputList = new OutputList(TRUE);
- if (generateHtml)
+ if (Config::generateHtml)
{
outputList->add(new HtmlGenerator);
HtmlGenerator::init();
}
- if (generateLatex)
+ if (Config::generateLatex)
{
outputList->add(new LatexGenerator);
LatexGenerator::init();
}
- if (generateMan)
+ if (Config::generateMan)
{
outputList->add(new ManGenerator);
ManGenerator::init();
@@ -3674,42 +3867,43 @@ int main(int argc,char **argv)
// gather names of all files in the include path
msg("Searching for include files...\n");
- s=includePath.first();
+ s=Config::includePath.first();
while (s)
{
- readFileOrDirectory(s,0,&includeNameDict,0,&filePatternList,
- &excludePatternList,0,0);
- s=includePath.next();
+ readFileOrDirectory(s,0,&includeNameDict,0,&Config::filePatternList,
+ &Config::excludePatternList,0,0);
+ s=Config::includePath.next();
}
msg("Searching for example files...\n");
- s=examplePath.first();
+ s=Config::examplePath.first();
while (s)
{
- readFileOrDirectory(s,0,&exampleNameDict,0,&filePatternList,
- &excludePatternList,0,0);
- s=examplePath.next();
+ readFileOrDirectory(s,0,&exampleNameDict,0,&Config::filePatternList,
+ &Config::excludePatternList,0,0);
+ s=Config::examplePath.next();
}
msg("Searching for files to exclude\n");
- s=excludeSources.first();
+ s=Config::excludeSources.first();
while (s)
{
- readFileOrDirectory(s,0,0,0,&filePatternList,
+ readFileOrDirectory(s,0,0,0,&Config::filePatternList,
0,0,&excludeNameDict);
- s=excludeSources.next();
+ s=Config::excludeSources.next();
}
msg("Reading input files...\n");
int inputSize=0;
- s=inputSources.first();
+ s=Config::inputSources.first();
while (s)
{
inputSize+=readFileOrDirectory(s,&inputNameList,
&inputNameDict,&excludeNameDict,
- &filePatternList,&excludePatternList,
+ &Config::filePatternList,
+ &Config::excludePatternList,
&inputFiles,0);
- s=inputSources.next();
+ s=Config::inputSources.next();
}
//msg("Input size %d bytes\n",inputSize);
@@ -3732,19 +3926,21 @@ int main(int argc,char **argv)
msg("Reading tag files\n");
- s=tagFileList.first();
+ s=Config::tagFileList.first();
while (s)
{
readTagFile(s);
- s=tagFileList.next();
+ s=Config::tagFileList.next();
}
- QFile *tag =new QFile(genTagFile);
- if (genTagFile.length()>0)
+ QFile *tag =new QFile(Config::genTagFile);
+ if (Config::genTagFile.length()>0)
{
if (!tag->open(IO_WriteOnly))
{
- err("Error: cannot open tag file %s for writing\n",genTagFile.data());
+ err("Error: cannot open tag file %s for writing\n",
+ Config::genTagFile.data()
+ );
exit(1);
}
tagFile.setDevice(tag);
@@ -3756,7 +3952,7 @@ int main(int argc,char **argv)
// Notice: the order of the function calls below is very important!
- if (generateHtml)
+ if (Config::generateHtml)
{
msg("Reading formula repository...\n");
readFormulaRepository();
@@ -3801,7 +3997,6 @@ int main(int argc,char **argv)
msg("Searching for friends...\n");
findFriends();
-
msg("Searching for documented variables...\n");
buildVarList(root);
@@ -3910,31 +4105,31 @@ int main(int argc,char **argv)
outputList->writeStyleInfo(0); // write first part
outputList->disableAllBut(OutputGenerator::Latex);
parseText(*outputList,
- theTranslator->trGeneratedAt(dateToString(TRUE),projectName)
+ theTranslator->trGeneratedAt(dateToString(TRUE),Config::projectName)
);
outputList->writeStyleInfo(1); // write second part
parseText(*outputList,theTranslator->trWrittenBy());
outputList->writeStyleInfo(2); // write third part
parseText(*outputList,
- theTranslator->trGeneratedAt(dateToString(TRUE),projectName)
+ theTranslator->trGeneratedAt(dateToString(TRUE),Config::projectName)
);
outputList->writeStyleInfo(3); // write fourth part
parseText(*outputList,theTranslator->trWrittenBy());
outputList->writeStyleInfo(4); // write last part
outputList->enableAll();
- if (formulaList.count()>0 && generateHtml)
+ if (formulaList.count()>0 && Config::generateHtml)
{
msg("Generating bitmaps for formulas in HTML...\n");
- formulaList.generateBitmaps(htmlOutputDir);
+ formulaList.generateBitmaps(Config::htmlOutputDir);
}
- if (searchEngineFlag || tagFileList.count()>0)
+ if (Config::searchEngineFlag || Config::tagFileList.count()>0)
{
msg("\nNow copy the file\n\n %s\n\nto the directory where the CGI binaries are "
- "located and don't forget to run\n\n",(htmlOutputDir+"/"+cgiName).data());
+ "located and don't forget to run\n\n",(Config::htmlOutputDir+"/"+Config::cgiName).data());
msg(" %s/installdox\n\nto replace any dummy links.\n\n",
- htmlOutputDir.data());
+ Config::htmlOutputDir.data());
}
delete tag;
diff --git a/src/doxygen.h b/src/doxygen.h
index 005ac7e..17c8cd8 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -18,6 +18,7 @@
#ifndef DOXYGEN_H
#define DOXYGEN_H
+#include "qtbc.h"
#include "groupdef.h"
#include "filedef.h"
#include "classdef.h"
@@ -34,9 +35,9 @@ struct PageInfo
{
PageInfo(const char *n,const char *d,const char *t)
{ name=n; doc=d; title=t; }
- QString name;
- QString doc;
- QString title;
+ QCString name;
+ QCString doc;
+ QCString title;
};
class PageList : public QList<PageInfo>
@@ -47,10 +48,10 @@ class PageList : public QList<PageInfo>
}
};
-class BufStr : public QString
+class BufStr : public QCString
{
public:
- BufStr(int size) : QString(size), offset(0), spareRoom(10240) {}
+ BufStr(int size) : QCString(size), offset(0), spareRoom(10240) {}
void addChar(char c)
{
if (offset>=size()) resize(size()+spareRoom);
@@ -73,11 +74,11 @@ class BufStr : public QString
const int spareRoom; // 10Kb extra room to avoid frequent resizing
};
-typedef QList<QString> StringList;
+typedef QList<QCString> StringList;
typedef QDict<MemberDef> MemberDict;
typedef QDict<ClassDef> ClassDict;
typedef QDict<FileDef> FileDict;
-typedef QDict<QString> StringDict;
+typedef QDict<QCString> StringDict;
typedef QDict<PageInfo> PageDict;
typedef QDict<GroupDef> GroupDict;
diff --git a/src/doxygen.pro b/src/doxygen.pro
index 21e2ea5..e6dd3c0 100644
--- a/src/doxygen.pro
+++ b/src/doxygen.pro
@@ -14,7 +14,7 @@
# TMake project file for doxygen
TEMPLATE = doxygen.t
-CONFIG = console qt warn_on release #debug
+CONFIG = console qt warn_on release #debug
HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \
membername.h index.h memberlist.h definition.h \
entry.h logos.h instdox.h message.h code.h \
diff --git a/src/doxysearch.cpp b/src/doxysearch.cpp
index cd59d02..027b185 100644
--- a/src/doxysearch.cpp
+++ b/src/doxysearch.cpp
@@ -259,7 +259,15 @@ void printSearchPage(bool open=FALSE)
int readInt(FILE *f)
{
- return (fgetc(f)<<24)+(fgetc(f)<<16)+(fgetc(f)<<8)+fgetc(f);
+ unsigned char c_24 = fgetc(f);
+ unsigned char c_16 = fgetc(f);
+ unsigned char c_08 = fgetc(f);
+ unsigned char c_00 = fgetc(f);
+ return ((unsigned int)c_24<<24)+
+ ((unsigned int)c_16<<16)+
+ ((unsigned int)c_08<<8)+
+ c_00;
+ //return (fgetc(f)<<24)+(fgetc(f)<<16)+(fgetc(f)<<8)+fgetc(f);
}
//----------------------------------------------------------------------------
@@ -755,10 +763,10 @@ void fileToBuf(const char *name, char **buf)
{
FILE *f;
struct stat file_stats;
- if ((f=fopen(name,"r"))==NULL) return;
+ if ((f=fopen(name,"rb"))==NULL) return;
if (stat(name,&file_stats)==-1)
{
- message("Error: could not fstat header file %s\n",name);
+ message("Error: could not fstat file %s\n",name);
exit(1);
}
unsigned int len=file_stats.st_size;
@@ -769,7 +777,7 @@ void fileToBuf(const char *name, char **buf)
}
if (fread(*buf,1,len,f)!=len)
{
- message("Error: could not read header file %s\n",name);
+ message("Error: could not read file %s\n",name);
exit(1);
}
(*buf)[len]='\0';
@@ -808,12 +816,20 @@ void getConfig(const char *s)
char headerFile[MAXSTRLEN];
strcpy(headerFile,s);
+#if defined(_WIN32)
+ strcat(headerFile,"\\header.html");
+#else
strcat(headerFile,"/header.html");
+#endif
fileToBuf(headerFile,&headerBuf);
char footerFile[MAXSTRLEN];
strcpy(footerFile,s);
+#if defined(_WIN32)
+ strcat(footerFile,"\\footer.html");
+#else
strcat(footerFile,"/footer.html");
+#endif
fileToBuf(footerFile,&footerBuf);
}
@@ -908,16 +924,24 @@ int main(int argc,char **argv)
{
char configFile[MAXSTRLEN];
strcpy(configFile,argv[argIndex]);
+#if defined(_WIN32)
+ strcat(configFile,"\\search.cfg");
+#else
strcat(configFile,"/search.cfg");
+#endif
char indexFile[MAXSTRLEN];
strcpy(indexFile,argv[argIndex]);
+#if defined(_WIN32)
+ strcat(indexFile,"\\search.idx");
+#else
strcat(indexFile,"/search.idx");
+#endif
FileInfo *fi=fileList.add();
FILE *g;
- if ((fi->f=fopen(indexFile,"r"))==NULL)
+ if ((fi->f=fopen(indexFile,"rb"))==NULL)
{
message("Error: could not open index file %s\n",indexFile);
exit(1);
diff --git a/src/doxytag.l b/src/doxytag.l
index 0c70dc6..4e2debd 100644
--- a/src/doxytag.l
+++ b/src/doxytag.l
@@ -23,7 +23,7 @@
#include <assert.h>
#include <ctype.h>
-#include <qstring.h>
+#include "qtbc.h"
#include <qstrlist.h>
#include <qfileinf.h>
#include <qfile.h>
@@ -38,16 +38,16 @@
struct MemberDef
{
- QString name;
- QString anchor;
- QString args;
+ QCString name;
+ QCString anchor;
+ QCString args;
};
struct ClassDef
{
- QString name;
+ QCString name;
QStrList bases;
- QString fileName;
+ QCString fileName;
bool isFile;
QList<MemberDef> memberList;
};
@@ -61,19 +61,19 @@ static bool genTag;
static bool genIndex;
static QStrList bases;
-static QString inputString;
+static QCString inputString;
static int inputPosition;
-static QString yyFileName;
+static QCString yyFileName;
static int yyLineNr;
-static QString classFile;
-static QString memberRef;
-static QString memberName;
-static QString memberArgs;
-static QString className;
+static QCString classFile;
+static QCString memberRef;
+static QCString memberName;
+static QCString memberArgs;
+static QCString className;
//static bool newClass;
-static QString docBaseLink;
-static QString docAnchor;
-static QString docRefName;
+static QCString docBaseLink;
+static QCString docAnchor;
+static QCString docRefName;
static bool nameBug;
static SearchIndex searchIndex;
@@ -152,9 +152,9 @@ static void addReference()
}
}
-QString unhtmlify(const char *str)
+QCString unhtmlify(const char *str)
{
- QString result;
+ QCString result;
const char *p=str;
char c;
while ((c=*p)!='\0')
@@ -236,7 +236,7 @@ QString unhtmlify(const char *str)
}
<SkipPreformated>[^\<]+
<CheckConstructor>[a-z_A-Z0-9~:]+ {
- QString s=yytext;
+ QCString s=yytext;
if (s.find("::")!=-1)
{
docRefName=yytext;
@@ -401,7 +401,7 @@ QString unhtmlify(const char *str)
*/
-void parse(QString &s)
+void parse(QCString &s)
{
bases.clear();
nameBug = FALSE;
@@ -425,7 +425,7 @@ void parseFile(QFileInfo &fi)
className.resize(0);
memberName.resize(0);
//printf("Parsing file %s...\n",fi.fileName().data());
- QString input(fi.size()+1);
+ QCString input(fi.size()+1);
docBaseLink=fi.fileName();
docRefName=fi.fileName().copy();
searchIndex.addReference(docRefName,docBaseLink);
@@ -503,8 +503,8 @@ const char *getArg(int argc,char **argv,int &optind,const char c)
int main(int argc,char **argv)
{
- QString tagName;
- QString indexName;
+ QCString tagName;
+ QCString indexName;
int optind=1;
const char *arg;
@@ -554,7 +554,7 @@ int main(int argc,char **argv)
}
if (genIndex)
{
- printf("Writing search index\n");
+ //printf("Writing search index\n");
if (!searchIndex.saveIndex(indexName))
{
fprintf(stderr,"Error: Could not write search index\n");
@@ -562,7 +562,7 @@ int main(int argc,char **argv)
QFileInfo fi(indexName);
if (fi.exists())
{
- QString dir=fi.dir().absPath();
+ QCString dir=convertToQCString(fi.dir().absPath());
fi.setFile(dir+"/search.gif");
if (!fi.exists()) writeSearchButton(dir);
fi.setFile(dir+"/doxygen.gif");
diff --git a/src/entry.cpp b/src/entry.cpp
index 51724ce..4e2ca93 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -16,31 +16,32 @@
#include "entry.h"
-static int newCount=0;
+int Entry::num=0;
Entry::Entry()
{
- num=newCount++;
+ num++;
//printf("New Entry %d\n",num);
parent=0;
sublist = new QList<Entry>;
sublist->setAutoDelete(TRUE);
extends = new QList<BaseInfo>;
extends->setAutoDelete(TRUE);
- groups = new QList<QString>;
+ groups = new QList<QCString>;
groups->setAutoDelete(TRUE);
- anchors = new QList<QString>;
+ anchors = new QList<QCString>;
anchors->setAutoDelete(TRUE);
argList = new ArgumentList;
argList->setAutoDelete(TRUE);
//printf("Entry::Entry() tArgList=0\n");
tArgList = 0;
+ mGrpId = -1;
reset();
}
Entry::Entry(const Entry &e)
{
- num=newCount++;
+ num++;
//printf("Copy New Entry %d\n",num);
section = e.section;
protection = e.protection;
@@ -62,13 +63,14 @@ Entry::Entry(const Entry &e)
inside = e.inside.copy();
fileName = e.fileName.copy();
startLine = e.startLine;
+ mGrpId = e.mGrpId;
sublist = new QList<Entry>;
sublist->setAutoDelete(TRUE);
extends = new QList<BaseInfo>;
extends->setAutoDelete(TRUE);
- groups = new QList<QString>;
+ groups = new QList<QCString>;
groups->setAutoDelete(TRUE);
- anchors = new QList<QString>;
+ anchors = new QList<QCString>;
anchors->setAutoDelete(TRUE);
argList = new ArgumentList;
argList->setAutoDelete(TRUE);
@@ -92,17 +94,17 @@ Entry::Entry(const Entry &e)
}
// deep copy group list
- QListIterator<QString> sli(*e.groups);
- QString *s;
+ QListIterator<QCString> sli(*e.groups);
+ QCString *s;
for (;(s=sli.current());++sli)
{
- groups->append(new QString(*s));
+ groups->append(new QCString(*s));
}
- QListIterator<QString> sli2(*e.anchors);
+ QListIterator<QCString> sli2(*e.anchors);
for (;(s=sli2.current());++sli2)
{
- anchors->append(new QString(*s));
+ anchors->append(new QCString(*s));
}
// deep copy argument list
@@ -140,8 +142,8 @@ Entry::~Entry()
delete groups;
delete anchors;
delete argList;
- //printf("Entry::~Entry() tArgList=%p\n",tArgList);
delete tArgList;
+ num--;
}
void Entry::addSubEntry(Entry *current)
@@ -171,6 +173,7 @@ void Entry::reset()
args.resize(0);
exception.resize(0);
program.resize(0);
+ body.resize(0);
includeFile.resize(0);
includeName.resize(0);
doc.resize(0);
@@ -178,6 +181,7 @@ void Entry::reset()
brief.resize(0);
inside.resize(0);
fileName.resize(0);
+ mGrpId = -1;
section = EMPTY_SEC;
sig = FALSE;
virt = Normal;
@@ -202,6 +206,7 @@ int Entry::getSize()
size+=args.length()+1;
size+=exception.length()+1;
size+=program.length()+1;
+ size+=body.length()+1;
size+=includeFile.length()+1;
size+=includeName.length()+1;
size+=doc.length()+1;
@@ -216,7 +221,7 @@ int Entry::getSize()
size+=bi->name.length()+1+sizeof(bi->prot)+sizeof(bi->virt);
bi=extends->next();
}
- QString *s=groups->first();
+ QCString *s=groups->first();
while (s)
{
size+=sizeof(QLNode);
diff --git a/src/entry.h b/src/entry.h
index a302955..94cf52b 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -17,7 +17,7 @@
#ifndef ENTRY_H
#define ENTRY_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qlist.h>
enum Protection { Public, Protected, Private } ;
@@ -26,7 +26,7 @@ enum Specifier { Normal, Virtual, Pure } ;
struct BaseInfo
{
BaseInfo(const char *n,Protection p,Specifier v) : name(n),prot(p),virt(v) {}
- QString name; // the name of the base class
+ QCString name; // the name of the base class
Protection prot; // inheritance type
Specifier virt; // virtualness
};
@@ -51,9 +51,9 @@ struct Argument
return *this;
}
- QString type; // argument type
- QString name; // argument name (if any)
- QString defval; // argument default value (if any)
+ QCString type; // argument type
+ QCString name; // argument name (if any)
+ QCString defval; // argument default value (if any)
};
class ArgumentList : public QList<Argument>
@@ -115,35 +115,37 @@ class Entry
void addSubEntry (Entry* e) ;
void reset();
- int section; // entry type;
+ int section; // entry type (see Sections);
Protection protection; // class protection
bool sig; // a Qt signal ?
bool slot; // a Qt slot ?
bool stat; // static ?
bool proto; // prototype ?
- Specifier virt; // virtualness of the entry
- Entry *parent; // parent node in the tree
- QString type; // member type
- QString name; // member name
- QString args; // member argument string
+ Specifier virt; // virtualness of the entry
+ Entry *parent; // parent node in the tree
+ QCString type; // member type
+ QCString name; // member name
+ QCString args; // member argument string
ArgumentList *argList; // member arguments as a list
ArgumentList *tArgList; // template argument list
- ArgumentList *tNameList; // template name list
- QString program; // the program text
- QString includeFile; // include file (2 arg of \class, must be unique)
- QString includeName; // include name (3 arg of \class)
- QString doc; // documentation block (partly parsed)
- QString relates; // related class (doc block)
- QString brief; // brief description (doc block)
- QString inside; // name of the class in which documents are found
- QString exception; // throw specification
+ QCString program; // the program text
+ QCString body; // the function body
+ QCString includeFile; // include file (2 arg of \class, must be unique)
+ QCString includeName; // include name (3 arg of \class)
+ QCString doc; // documentation block (partly parsed)
+ QCString relates; // related class (doc block)
+ QCString brief; // brief description (doc block)
+ QCString inside; // name of the class in which documents are found
+ QCString exception; // throw specification
+ int mGrpId; // member group id
+ QCString mGrpHeader; // member group header
QList<Entry> *sublist; // entries that are children of this one
QList<BaseInfo> *extends; // list of base classes
- QList<QString> *groups; // list of groups this entry belongs to
- QList<QString> *anchors; // list of anchors defined in this entry
- QString fileName; // file this entry was extracted from
+ QList<QCString> *groups; // list of groups this entry belongs to
+ QList<QCString> *anchors; // list of anchors defined in this entry
+ QCString fileName; // file this entry was extracted from
int startLine; // start line of entry in the source
- int num;
+ static int num; // counts the total number of entries
private:
Entry &operator=(const Entry &);
} ;
diff --git a/src/example.h b/src/example.h
index eef33ce..b43733f 100644
--- a/src/example.h
+++ b/src/example.h
@@ -17,16 +17,16 @@
#ifndef EXAMPLE_H
#define EXAMPLE_H
-#include <qstring.h>
+#include "qtbc.h"
class ClassDef;
class MemberName;
struct Example
{
- QString anchor;
- QString name;
- QString file;
+ QCString anchor;
+ QCString name;
+ QCString file;
};
class ExampleList : public QList<Example>
diff --git a/src/filedef.cpp b/src/filedef.cpp
index 7921bf7..5f62357 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -14,6 +14,7 @@
*
*/
+#include "qtbc.h"
#include "memberlist.h"
#include "classlist.h"
#include "define.h"
@@ -66,14 +67,14 @@ void FileDef::writeDocumentation(OutputList &ol)
{
//funcList->countDecMembers();
- QString pageTitle=name()+" File Reference";
+ QCString pageTitle=name()+" File Reference";
startFile(ol,diskname,pageTitle);
startTitle(ol);
parseText(ol,theTranslator->trFileReference(name()));
endTitle(ol,name());
//ol.newParagraph();
- if (genTagFile.length()>0) tagFile << "&" << name() << ":\n";
+ if (Config::genTagFile.length()>0) tagFile << "&" << name() << ":\n";
//brief=brief.stripWhiteSpace();
//int bl=brief.length();
@@ -97,17 +98,53 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.writeSynopsis();
ol.startMemberSections();
+
+ if (namespaceList->count()>0)
+ {
+ NamespaceDef *nd=namespaceList->first();
+ bool found=FALSE;
+ while (nd)
+ {
+ if (nd->isVisibleExt())
+ {
+ if (!found)
+ {
+ ol.startMemberHeader();
+ parseText(ol,theTranslator->trNamespaces());
+ ol.endMemberHeader();
+ ol.startMemberList();
+ found=TRUE;
+ }
+ ol.startMemberItem();
+ ol.writeString("namespace ");
+ ol.insertMemberAlign();
+ if (nd->hasDocumentation())
+ {
+ ol.writeObjectLink(nd->getReference(),
+ nd->getOutputFileBase(),
+ 0,
+ nd->name()
+ );
+ }
+ else
+ {
+ ol.startBold();
+ ol.docify(nd->name());
+ ol.endBold();
+ }
+ ol.endMemberItem();
+ }
+ nd=namespaceList->next();
+ }
+ if (found) ol.endMemberList();
+ }
if (classList->count()>0)
{
ClassDef *cd=classList->first();
bool found=FALSE;
while (cd)
{
- if (//cd->name()[0]!='@' &&
- //(cd->protection()!=Private || extractPrivateFlag) &&
- //(cd->hasDocumentation() || !hideClassFlag))
- cd->isVisibleExt()
- )
+ if ( cd->isVisibleExt() )
{
if (!found)
{
@@ -247,7 +284,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader();
parseText(ol,theTranslator->trAuthor());
ol.endGroupHeader();
- parseText(ol,theTranslator->trGeneratedAutomatically(projectName));
+ parseText(ol,theTranslator->trGeneratedAutomatically(Config::projectName));
ol.enableAll();
endFile(ol);
}
diff --git a/src/filedef.h b/src/filedef.h
index ca95e20..b5c9585 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -17,8 +17,8 @@
#ifndef FILEDEF_H
#define FILEDEF_H
-#include <qlist.h>
#include "index.h"
+#include <qlist.h>
#include "config.h"
#include "definition.h"
@@ -53,9 +53,9 @@ class FileDef : public Definition
~FileDef();
/*! Returns the unique file name (this may include part of the path). */
- QString name() const
+ QCString name() const
{
- if (fullPathNameFlag)
+ if (Config::fullPathNameFlag)
return filename;
else
return Definition::name();
@@ -63,10 +63,10 @@ class FileDef : public Definition
/*! Returns nameString with all slashes replaced by underscores. */
//const char *diskName() const { return diskname; }
- QString getOutputFileBase() const { return diskname; }
+ QCString getOutputFileBase() const { return diskname; }
/*! Returns the absolute path including the file name. */
- QString absFilePath() const { return filepath; }
+ QCString absFilePath() const { return filepath; }
/*! Returns the name of the verbatim copy of this file (if any). */
const char *includeName() const { return incName; }
@@ -87,7 +87,7 @@ class FileDef : public Definition
//void setDocumentation(const char *d) { doc=d; }
/*! Returns the absolute path of this file. */
- QString getPath() const { return path; }
+ QCString getPath() const { return path; }
/*! Returns true iff any documentation for this file is found. */
//bool hasDocumentation()
@@ -117,15 +117,15 @@ class FileDef : public Definition
FileList *includeList;
NamespaceList *namespaceList;
DefineList *defineList;
- //QString n;
- //QString doc;
- //QString brief;
- QString reference;
- QString path;
- QString filepath;
- QString diskname;
- QString filename;
- QString incName;
+ //QCString n;
+ //QCString doc;
+ //QCString brief;
+ QCString reference;
+ QCString path;
+ QCString filepath;
+ QCString diskname;
+ QCString filename;
+ QCString incName;
//FileType ftype;
};
diff --git a/src/filename.cpp b/src/filename.cpp
index 60367dc..a345969 100644
--- a/src/filename.cpp
+++ b/src/filename.cpp
@@ -26,9 +26,9 @@ FileName::~FileName()
{
}
-//static QString convertSlashes(const char *s)
+//static QCString convertSlashes(const char *s)
//{
-// QString result=s;
+// QCString result=s;
// int i,l=result.length();
// for (i=0;i<l;i++) if (result.at(i)=='/') result.at(i)='_';
// return result;
@@ -36,7 +36,7 @@ FileName::~FileName()
void FileName::generateDiskNames()
{
- QString commonPrefix;
+ QCString commonPrefix;
FileDef *fd=first();
int count=0;
while (fd) { if (!fd->isReference()) count++; fd=next(); }
@@ -66,8 +66,8 @@ void FileName::generateDiskNames()
//printf("i=%d fd->path=`%s' fd->name=`%s'\n",i,fd->path.data(),fd->name().data());
if (i==(int)fd->path.length())
{
- warning("Warning: Input file found multiple times!\n"
- " The generated documentation for this file may not be correct!\n");
+ warning("Warning: Input file %s found multiple times!\n"
+ " The generated documentation for this file may not be correct!\n",fd->absFilePath().data());
found=TRUE;
}
else if (fd->path[i]!=c)
diff --git a/src/filename.h b/src/filename.h
index 2932d18..cb39ce5 100644
--- a/src/filename.h
+++ b/src/filename.h
@@ -17,6 +17,7 @@
#ifndef FILENAME_H
#define FILENAME_H
+#include "qtbc.h"
#include <qdict.h>
#include "filedef.h"
@@ -30,7 +31,7 @@ class FileName : public QList<FileDef>
int compareItems(GCI item1,GCI item2);
private:
- QString name;
+ QCString name;
};
class FileNameIterator : public QListIterator<FileDef>
diff --git a/src/formula.cpp b/src/formula.cpp
index 53e8b38..0a961ca 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <unistd.h>
+#include "qtbc.h"
#include <qfile.h>
#include <qtstream.h>
#include <qfileinf.h>
@@ -49,12 +50,12 @@ void FormulaList::generateBitmaps(const char *path)
QDir d(path);
// store the original directory
if (!d.exists()) { err("Error: Output dir %s does not exist!\n",path); exit(1); }
- QString oldDir = QDir::currentDirPath().copy();
+ QCString oldDir = convertToQCString(QDir::currentDirPath());
// goto the html output directory (i.e. path)
QDir::setCurrent(d.absPath());
QDir thisDir;
// generate a latex file containing one formula per page.
- QString texName="_formulas.tex";
+ QCString texName="_formulas.tex";
QList<int> pagesToGenerate;
pagesToGenerate.setAutoDelete(TRUE);
FormulaListIterator fli(*this);
@@ -70,7 +71,7 @@ void FormulaList::generateBitmaps(const char *path)
int page=0;
for (fli.toFirst();(formula=fli.current());++fli)
{
- QString resultName;
+ QCString resultName;
resultName.sprintf("form-%d.gif",formula->getId());
// only formulas for which no image exists are generated
QFileInfo fi(resultName);
@@ -99,7 +100,7 @@ void FormulaList::generateBitmaps(const char *path)
int pageNum=*pagePtr;
msg("Generating image form-%d.gif for formula\n",pageNum);
char dviCmd[256];
- QString formBase;
+ QCString formBase;
formBase.sprintf("_form%d",pageNum);
// run dvips to convert the page with number pageIndex to an
// encapsulated postscript.
@@ -110,7 +111,7 @@ void FormulaList::generateBitmaps(const char *path)
QFileInfo fi(formBase+".eps");
if (fi.exists())
{
- QString eps = fileToString(formBase+".eps");
+ QCString eps = fileToString(formBase+".eps");
int i=eps.find("%%BoundingBox:");
if (i!=-1)
{
@@ -162,7 +163,7 @@ void FormulaList::generateBitmaps(const char *path)
if (f.open(IO_ReadOnly))
{
QTextStream t(&f);
- QString s;
+ QCString s;
if (!t.eof())
s=t.readLine();
if (s.length()<2 || s.left(2)!="P6")
@@ -233,7 +234,7 @@ void FormulaList::generateBitmaps(const char *path)
}
}
// save the result as a gif
- QString resultName;
+ QCString resultName;
resultName.sprintf("form-%d.gif",pageNum);
// the option parameter 1 is used here as a temporary hack
// to select the right color palette!
diff --git a/src/formula.h b/src/formula.h
index 977ccfe..9edd583 100644
--- a/src/formula.h
+++ b/src/formula.h
@@ -17,7 +17,7 @@
#ifndef FORMULA_H
#define FORMULA_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qlist.h>
#include <qdict.h>
@@ -27,11 +27,11 @@ class Formula
Formula(const char *text);
~Formula();
int getId();
- QString getFormulaText() const { return form; }
+ QCString getFormulaText() const { return form; }
private:
int number;
- QString form;
+ QCString form;
};
class FormulaList : public QList<Formula>
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 924199e..e1e28ab 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -15,6 +15,7 @@
*/
#include <ctype.h>
+#include "qtbc.h"
#include "groupdef.h"
#include "classdef.h"
#include "filedef.h"
@@ -118,7 +119,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ClassDef *cd=classList->first();
while (cd)
{
- QString type;
+ QCString type;
switch (cd->compoundType())
{
case ClassDef::Class: type="class"; break;
diff --git a/src/groupdef.h b/src/groupdef.h
index a8bc562..ab54ea6 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -17,7 +17,7 @@
#ifndef GROUPDEF_H
#define GROUPDEF_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qlist.h>
#include "definition.h"
@@ -36,7 +36,7 @@ class GroupDef : public Definition
GroupDef(const char *name,const char *title);
~GroupDef();
//const char *groupFile() const { return fileName; }
- QString getOutputFileBase() const { return fileName; }
+ QCString getOutputFileBase() const { return fileName; }
const char *groupTitle() const { return title; }
void addFile(const FileDef *def);
void addClass(const ClassDef *def);
@@ -45,8 +45,8 @@ class GroupDef : public Definition
int countMembers() const;
private:
- QString title; // title of the group
- QString fileName; // base name of the generated file
+ QCString title; // title of the group
+ QCString fileName; // base name of the generated file
FileList *fileList; // list of all files in the group
ClassList *classList; // list of all classes in the group
NamespaceList *namespaceList; // list of all namespace in the group
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 8c5b50a..1a44646 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -14,8 +14,10 @@
*
*/
-#include <qdir.h>
#include <stdlib.h>
+
+#include "qtbc.h"
+#include <qdir.h>
#include "message.h"
#include "htmlgen.h"
#include "config.h"
@@ -26,9 +28,9 @@
HtmlGenerator::HtmlGenerator() : OutputGenerator()
{
- if (headerFile.length()>0) header=fileToString(headerFile);
- if (footerFile.length()>0) footer=fileToString(footerFile);
- dir=htmlOutputDir;
+ if (Config::headerFile.length()>0) header=fileToString(Config::headerFile);
+ if (Config::footerFile.length()>0) footer=fileToString(Config::footerFile);
+ dir=Config::htmlOutputDir;
}
HtmlGenerator::~HtmlGenerator()
@@ -42,18 +44,18 @@ void HtmlGenerator::append(const OutputGenerator *g)
void HtmlGenerator::init()
{
- QDir d(htmlOutputDir);
- if (!d.exists() && !d.mkdir(htmlOutputDir))
+ QDir d(Config::htmlOutputDir);
+ if (!d.exists() && !d.mkdir(Config::htmlOutputDir))
{
- err("Could not create output directory %s\n",htmlOutputDir.data());
+ err("Could not create output directory %s\n",Config::htmlOutputDir.data());
exit(1);
}
- writeLogo(htmlOutputDir);
+ writeLogo(Config::htmlOutputDir);
}
void HtmlGenerator::startFile(const char *name,const char *title,bool external)
{
- QString fileName=name;
+ QCString fileName=name;
lastTitle=title;
if (fileName.right(5)!=".html") fileName+=".html";
startPlainFile(fileName);
@@ -156,7 +158,9 @@ void HtmlGenerator::writeStyleInfo(int part)
if (part==0)
{
startPlainFile("doxygen.css");
- t << "H1 { border-width: thin; border: solid; text-align: center }" << endl
+ t
+ //<< "H1 { border-width: thin; border: solid; text-align: center }" << endl
+ << "H1 { text-align: center }" << endl
<< "A.el { text-decoration: none; font-weight: bold }" << endl
<< "DL.el { margin-left: -1cm }" << endl
<< "DIV.fragment { width: 100%; border: none; background-color: #eeeeee }" << endl
@@ -274,7 +278,7 @@ void HtmlGenerator::writeSection(const char *lab,const char *title,bool sub)
void HtmlGenerator::writeSectionRef(const char *name,const char *lab,
const char *title)
{
- QString refName=name;
+ QCString refName=name;
if (refName.right(5)!=".html") refName+=".html";
t << "<a href=\"" << refName << "#" << lab << "\">";
docify(title);
@@ -284,7 +288,7 @@ void HtmlGenerator::writeSectionRef(const char *name,const char *lab,
void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab,
const char *title)
{
- QString refName=name;
+ QCString refName=name;
if (refName.right(5)!=".html") refName+=".html";
t << "<a href=\"" << refName << "#" << lab << "\">";
docify(title);
@@ -356,7 +360,7 @@ void HtmlGenerator::endClassDiagram(ClassDiagram &d,
void HtmlGenerator::startColorFont(uchar red,uchar green,uchar blue)
{
- QString colorString;
+ QCString colorString;
colorString.sprintf("%02x%02x%02x",red,green,blue);
t << "<font color=\"#" << colorString << "\">";
}
@@ -370,12 +374,12 @@ void HtmlGenerator::writeFormula(const char *n,const char *text)
{
if (text && text[0]=='\\') t << "<p><center>" << endl;
t << "<img align=\"top\" src=\"" << n << "\">" << endl;
- if (text && text[0]=='\\') t << "</center></p>" << endl;
+ if (text && text[0]=='\\') t << "</center><p>" << endl;
}
void HtmlGenerator::startMemberList()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
//t << endl << "<p><table border=0 cellspacing=2 cellpadding=0>" << endl;
}
@@ -387,7 +391,7 @@ void HtmlGenerator::startMemberList()
void HtmlGenerator::endMemberList()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
//t << "</table>" << endl;
}
@@ -399,7 +403,7 @@ void HtmlGenerator::endMemberList()
void HtmlGenerator::startMemberItem()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "<tr><td align=right valign=top>";
}
@@ -411,15 +415,15 @@ void HtmlGenerator::startMemberItem()
void HtmlGenerator::insertMemberAlign()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
- t << "</td><td valign=top>";
+ t << "&nbsp;</td><td valign=top>";
}
}
void HtmlGenerator::endMemberItem()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "</td></tr>";
}
@@ -428,7 +432,7 @@ void HtmlGenerator::endMemberItem()
void HtmlGenerator::startMemberDescription()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "<tr><td></td><td><font size=-1><em>";
}
@@ -440,7 +444,7 @@ void HtmlGenerator::startMemberDescription()
void HtmlGenerator::endMemberDescription()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "</em></font><br><br></td></tr>" << endl;
}
@@ -452,7 +456,7 @@ void HtmlGenerator::endMemberDescription()
void HtmlGenerator::startMemberSections()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "<table border=0 cellpadding=0 cellspacing=1>" << endl;
}
@@ -460,7 +464,7 @@ void HtmlGenerator::startMemberSections()
void HtmlGenerator::endMemberSections()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "</table>" << endl;
}
@@ -468,7 +472,7 @@ void HtmlGenerator::endMemberSections()
void HtmlGenerator::startMemberHeader()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "<tr><td colspan=2><br><h2>";
}
@@ -480,7 +484,7 @@ void HtmlGenerator::startMemberHeader()
void HtmlGenerator::endMemberHeader()
{
- if (htmlAlignMemberFlag)
+ if (Config::htmlAlignMemberFlag)
{
t << "</h2></td></tr>" << endl;
}
@@ -490,3 +494,13 @@ void HtmlGenerator::endMemberHeader()
}
}
+void HtmlGenerator::startMemberSubtitle()
+{
+ if (Config::htmlAlignMemberFlag) t << "<tr><td colspan=2>";
+}
+
+void HtmlGenerator::endMemberSubtitle()
+{
+ if (Config::htmlAlignMemberFlag) t << "<br><br></td></tr>" << endl;
+}
+
diff --git a/src/htmlgen.h b/src/htmlgen.h
index 556a334..5eb4484 100644
--- a/src/htmlgen.h
+++ b/src/htmlgen.h
@@ -17,6 +17,7 @@
#ifndef HTMLGEN_H
#define HTMLGEN_H
+#include "qtbc.h"
#include "outputgen.h"
class QFile;
@@ -85,6 +86,8 @@ class HtmlGenerator : public OutputGenerator
void endMemberSections();
void startMemberHeader();
void endMemberHeader();
+ void startMemberSubtitle();
+ void endMemberSubtitle();
void startMemberList();
void endMemberList();
void startMemberItem();
@@ -169,9 +172,9 @@ class HtmlGenerator : public OutputGenerator
//static void docifyStatic(QTextStream &t,const char *str);
private:
- QString header;
- QString footer;
- QString lastTitle;
+ QCString header;
+ QCString footer;
+ QCString lastTitle;
HtmlGenerator &operator=(const HtmlGenerator &g);
HtmlGenerator(const HtmlGenerator &g);
diff --git a/src/image.cpp b/src/image.cpp
index 853d4ea..78f92c1 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -15,10 +15,10 @@
*
*/
+#include "qtbc.h"
#include "image.h"
#include "gifenc.h"
#include <qglobal.h>
-#include <qstring.h>
const int charSetWidth=80;
const int charHeight=12;
@@ -140,111 +140,6 @@ unsigned char fontRaw[charSetWidth*charHeight] = {
0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0xac, 0x00, 0x00
};
-
-#if 0
-const int charSetWidth=68;
-const int charHeight=12;
-const int numChars=80;
-
-unsigned short charPos[numChars] =
- { 0, 7, 14, 21, 28, 35, 42, 49,
- 56, 63, 70, 73, 76, 83, 90, 97,
- 104,116,125,133,142,151,159,167,
- 176,185,188,195,203,210,221,230,
- 240,248,258,266,274,281,289,298,
- 309,318,327,336,339,343,346,352,
- 359,362,369,376,383,390,397,401,
- 407,414,417,420,426,429,438,445,
- 452,459,465,470,476,479,486,493,
- 502,508,515,521,525,528,532,539
- };
-
-unsigned char charWidth[numChars] =
- {
- 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 3, 3, 7, 7, 7, 7,
- 12, 9, 8, 9, 9, 8, 8, 9,
- 9, 3, 7, 8, 7,11, 9,10,
- 8,10, 8, 8, 7, 8, 9,11,
- 9, 9, 9, 3, 4, 3, 6, 7,
- 3, 7, 7, 7, 7, 7, 4, 6,
- 7, 3, 3, 6, 3, 9, 7, 7,
- 7, 6, 5, 6, 3, 7, 7, 9,
- 6, 7, 6, 4, 3, 4, 7, 5
- };
-
-unsigned char fontRaw[charSetWidth*charHeight] = {
- 0x38, 0x20, 0xe1, 0xc0, 0x8f, 0x8e, 0x3e, 0x38, 0x70, 0x00, 0x00, 0x00,
- 0x1c, 0x0f, 0x80, 0x83, 0xe0, 0xf1, 0xf0, 0xfc, 0xfc, 0x3c, 0x41, 0x20,
- 0x48, 0x48, 0x10, 0x12, 0x08, 0x78, 0x7c, 0x1e, 0x1f, 0x0f, 0x3f, 0xa1,
- 0x20, 0x91, 0x12, 0x09, 0x04, 0xfe, 0x71, 0x80, 0x00, 0x80, 0x20, 0x00,
- 0x08, 0x01, 0x80, 0x81, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x44, 0xe1, 0x12, 0x21,
- 0x88, 0x11, 0x02, 0x44, 0x88, 0x00, 0x00, 0x00, 0x22, 0x30, 0x41, 0x42,
- 0x11, 0x09, 0x08, 0x80, 0x80, 0x42, 0x41, 0x20, 0x48, 0x88, 0x18, 0x33,
- 0x08, 0x84, 0x42, 0x21, 0x10, 0x90, 0x84, 0x21, 0x20, 0x91, 0x11, 0x11,
- 0x04, 0x02, 0x50, 0x88, 0x01, 0x00, 0x20, 0x00, 0x08, 0x02, 0x00, 0x80,
- 0x04, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x22, 0x20, 0x00, 0x44, 0x20, 0x10, 0x22, 0x88, 0x10, 0x04, 0x44,
- 0x88, 0x00, 0x00, 0x00, 0x22, 0x26, 0xa1, 0x42, 0x12, 0x01, 0x04, 0x80,
- 0x80, 0x80, 0x41, 0x20, 0x49, 0x08, 0x18, 0x32, 0x89, 0x02, 0x42, 0x40,
- 0x90, 0x90, 0x04, 0x21, 0x11, 0x11, 0x11, 0x10, 0x88, 0x04, 0x48, 0x94,
- 0x01, 0x8e, 0x2c, 0x38, 0x68, 0xe7, 0x34, 0xb1, 0x24, 0x92, 0x91, 0x61,
- 0xc5, 0x86, 0x94, 0xce, 0x89, 0x14, 0x46, 0x14, 0x4f, 0x22, 0x20, 0x00,
- 0x44, 0x20, 0x20, 0xc2, 0x8f, 0x16, 0x04, 0x38, 0x89, 0x20, 0xc0, 0x18,
- 0x04, 0x49, 0x22, 0x22, 0x12, 0x01, 0x04, 0x80, 0x80, 0x80, 0x41, 0x20,
- 0x4a, 0x08, 0x14, 0x52, 0x89, 0x02, 0x42, 0x40, 0x90, 0x8c, 0x04, 0x21,
- 0x11, 0x09, 0x20, 0xa0, 0x88, 0x08, 0x48, 0xa2, 0x00, 0x11, 0x32, 0x44,
- 0x99, 0x12, 0x4c, 0xc9, 0x25, 0x13, 0x69, 0x92, 0x26, 0x49, 0x99, 0x24,
- 0x89, 0x14, 0x45, 0x24, 0x41, 0x22, 0x20, 0x00, 0x44, 0x20, 0x40, 0x24,
- 0x80, 0x99, 0x08, 0x44, 0x78, 0x03, 0x0f, 0x86, 0x04, 0x51, 0x22, 0x23,
- 0xe2, 0x01, 0x04, 0xfc, 0xf8, 0x8e, 0x7f, 0x20, 0x4e, 0x08, 0x14, 0x52,
- 0x49, 0x02, 0x7c, 0x40, 0x9f, 0x03, 0x04, 0x21, 0x11, 0x0a, 0xa0, 0x40,
- 0x50, 0x10, 0x44, 0x80, 0x00, 0x01, 0x22, 0x40, 0x89, 0x12, 0x44, 0x89,
- 0x26, 0x12, 0x49, 0x12, 0x24, 0x48, 0x91, 0x04, 0x89, 0x12, 0x48, 0xc4,
- 0x42, 0x22, 0x26, 0x40, 0x44, 0x20, 0x80, 0x28, 0x80, 0x91, 0x08, 0x44,
- 0x08, 0x0c, 0x00, 0x01, 0x88, 0x51, 0x23, 0xe2, 0x12, 0x01, 0x04, 0x80,
- 0x80, 0x82, 0x41, 0x20, 0x49, 0x08, 0x12, 0x92, 0x29, 0x02, 0x40, 0x44,
- 0x91, 0x00, 0x84, 0x21, 0x0a, 0x0a, 0xa0, 0xa0, 0x20, 0x20, 0x44, 0x80,
- 0x00, 0x0f, 0x22, 0x40, 0x89, 0xf2, 0x44, 0x89, 0x26, 0x12, 0x49, 0x12,
- 0x24, 0x48, 0x90, 0xc4, 0x88, 0xa2, 0x48, 0xc4, 0x84, 0x42, 0x19, 0x80,
- 0x44, 0x21, 0x02, 0x2f, 0xc8, 0x91, 0x08, 0x44, 0x08, 0x03, 0x0f, 0x86,
- 0x08, 0x53, 0x44, 0x12, 0x12, 0x01, 0x04, 0x80, 0x80, 0x82, 0x41, 0x24,
- 0x48, 0x88, 0x12, 0x92, 0x29, 0x02, 0x40, 0x42, 0x90, 0x90, 0x84, 0x21,
- 0x0a, 0x04, 0x41, 0x10, 0x20, 0x40, 0x44, 0x80, 0x00, 0x11, 0x22, 0x40,
- 0x89, 0x02, 0x44, 0x89, 0x25, 0x12, 0x49, 0x12, 0x24, 0x48, 0x90, 0x24,
- 0x88, 0xa2, 0xa9, 0x22, 0x84, 0x22, 0x20, 0x00, 0x44, 0x21, 0x02, 0x20,
- 0x88, 0x91, 0x10, 0x44, 0x88, 0x00, 0xc0, 0x18, 0x00, 0x4d, 0x84, 0x12,
- 0x11, 0x09, 0x08, 0x80, 0x80, 0x46, 0x41, 0x24, 0x48, 0x48, 0x11, 0x12,
- 0x18, 0x84, 0x40, 0x21, 0x10, 0x90, 0x84, 0x21, 0x04, 0x04, 0x41, 0x10,
- 0x20, 0x80, 0x42, 0x80, 0x00, 0x11, 0x32, 0x44, 0x99, 0x12, 0x4c, 0x89,
- 0x24, 0x92, 0x49, 0x12, 0x26, 0x49, 0x91, 0x24, 0x98, 0x41, 0x12, 0x12,
- 0x88, 0x22, 0x20, 0x00, 0x38, 0x21, 0xf1, 0xc0, 0x87, 0x0e, 0x10, 0x38,
- 0x71, 0x20, 0x00, 0x00, 0x08, 0x20, 0x04, 0x13, 0xe0, 0xf1, 0xf0, 0xfc,
- 0x80, 0x3a, 0x41, 0x23, 0x88, 0x2f, 0x91, 0x12, 0x08, 0x78, 0x40, 0x1e,
- 0x90, 0x8f, 0x04, 0x1e, 0x04, 0x04, 0x42, 0x08, 0x20, 0xfe, 0x42, 0x80,
- 0x00, 0x0e, 0xac, 0x38, 0x68, 0xe2, 0x34, 0x89, 0x24, 0x52, 0x49, 0x11,
- 0xc5, 0x86, 0x90, 0xc6, 0x68, 0x41, 0x12, 0x11, 0x0f, 0x22, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x40, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x1a, 0xc0, 0x00
-};
-#endif
-
static Color palette[] =
{
{ 0xff, 0xff, 0xff },
diff --git a/src/index.cpp b/src/index.cpp
index dcd457f..d8bd56c 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -34,7 +34,7 @@
//----------------------------------------------------------------------------
// strips w from s iff s starts with w
-bool stripWord(QString &s,QString w)
+bool stripWord(QCString &s,QCString w)
{
bool success=FALSE;
if (s.left(w.length())==w)
@@ -47,12 +47,12 @@ bool stripWord(QString &s,QString w)
//----------------------------------------------------------------------------
// some quasi intelligent brief description abbreviator :^)
-QString abbreviate(const char *s,const char *name)
+QCString abbreviate(const char *s,const char *name)
{
- QString result=s;
- QString start1=(QString)"The "+name+" class ";
- QString start2=(QString)"The "+name+" widget ";
- QString start3=(QString)"The "+name+" file ";
+ QCString result=s;
+ QCString start1=(QCString)"The "+name+" class ";
+ QCString start2=(QCString)"The "+name+" widget ";
+ QCString start3=(QCString)"The "+name+" file ";
result=result.simplifyWhiteSpace();
// strip trailing .
if (result.length()>0 && result.at(result.length()-1)=='.')
@@ -236,7 +236,7 @@ void writeHierarchicalIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"hierarchy","Hierarchical Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trClassHierarchy());
+ parseText(ol,Config::projectName+" "+theTranslator->trClassHierarchy());
endTitle(ol,0);
parseText(ol,theTranslator->trClassHierarchyDescription());
ol.newParagraph();
@@ -272,10 +272,10 @@ void writeFileIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"files","File Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trFileList());
+ parseText(ol,Config::projectName+" "+theTranslator->trFileList());
endTitle(ol,0);
ol.newParagraph();
- parseText(ol,theTranslator->trFileListDescription(extractAllFlag));
+ parseText(ol,theTranslator->trFileListDescription(Config::extractAllFlag));
ol.newParagraph();
ol.startIndexList();
@@ -289,13 +289,13 @@ void writeFileIndex(OutputList &ol)
{
//ol.writeIndexItem(fd->getReference(),fd->diskName(),
// fd->name());
- QString path;
- if (fullPathNameFlag)
+ QCString path;
+ if (Config::fullPathNameFlag)
{
path=fd->getPath().copy();
// strip part of the path
- if (path.left(stripFromPath.length())==stripFromPath)
- path=path.right(path.length()-stripFromPath.length());
+ if (path.left(Config::stripFromPath.length())==Config::stripFromPath)
+ path=path.right(path.length()-Config::stripFromPath.length());
}
ol.writeStartAnnoItem("file",
@@ -337,7 +337,7 @@ int countNamespaces()
NamespaceDef *nd;
for (;(nd=nli.current());++nli)
{
- if (!nd->getReference() && nd->hasDocumentation()) count++;
+ if (nd->isVisible()) count++;
}
return count;
}
@@ -350,17 +350,17 @@ void writeNamespaceIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"namespaces","Namespace Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trNamespaceList());
+ parseText(ol,Config::projectName+" "+theTranslator->trNamespaceList());
endTitle(ol,0);
ol.newParagraph();
- parseText(ol,theTranslator->trNamespaceListDescription(extractAllFlag));
+ parseText(ol,theTranslator->trNamespaceListDescription(Config::extractAllFlag));
ol.newParagraph();
ol.startIndexList();
NamespaceDef *nd=namespaceList.first();
while (nd)
{
- if (!nd->getReference() && nd->hasDocumentation())
+ if (nd->isVisible())
{
ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name());
ol.docify(" (");
@@ -419,12 +419,12 @@ void writeAnnotatedClassList(OutputList &ol)
{
if (!cd->isReference() &&
//!cd->name().isEmpty() && cd->name()[0]!='@' &&
- //(cd->protection()!=Private || extractPrivateFlag) &&
+ //(cd->protection()!=Private || Config::extractPrivateFlag) &&
//(cd->hasDocumentation() || !hideClassFlag)
cd->isVisible()
)
{
- QString type;
+ QCString type;
switch (cd->compoundType())
{
case ClassDef::Class: type="class"; break;
@@ -465,7 +465,7 @@ void writeAnnotatedIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"annotated","Annotated Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trCompoundList());
+ parseText(ol,Config::projectName+" "+theTranslator->trCompoundList());
endTitle(ol,0);
parseText(ol,theTranslator->trCompoundListDescription());
writeAnnotatedClassList(ol);
@@ -487,7 +487,7 @@ void writeMemberList(OutputList &ol)
while (md && !found)
{
ClassDef *cd;
- if ((md->isFriend() || md->protection()!=Private || extractPrivateFlag) &&
+ if ((md->isFriend() || md->protection()!=Private || Config::extractPrivateFlag) &&
!md->isReference() && md->hasDocumentation() &&
md->name()[0]!='@' && (cd=md->memberClass()) &&
cd->isVisible()
@@ -506,12 +506,12 @@ void writeMemberList(OutputList &ol)
ol.writeString("\n");
int count=0;
- md=mn->first();
- QString prevName;
+ md=mn->last();
+ QCString prevName;
while (md)
{
ClassDef *cd=md->memberClass();
- if (cd && (md->isFriend() || md->protection()!=Private || extractPrivateFlag) &&
+ if (cd && (md->isFriend() || md->protection()!=Private || Config::extractPrivateFlag) &&
!md->isReference() && md->hasDocumentation() &&
prevName!=cd->name() &&
cd->isVisible()
@@ -526,7 +526,7 @@ void writeMemberList(OutputList &ol)
count++;
prevName=cd->name();
}
- md=mn->next();
+ md=mn->prev();
}
}
mn=memberNameList.next();
@@ -548,11 +548,11 @@ int countClassMembers()
ClassDef *cd;
while (md && !found)
{
- if ((md->isFriend() || md->protection()!=Private || extractPrivateFlag) &&
+ if ((md->isFriend() || md->protection()!=Private || Config::extractPrivateFlag) &&
!md->isReference() && !md->isRelated() && md->hasDocumentation() &&
md->name()[0]!='@' && (cd=md->memberClass()) && cd->isVisible())
otherMd=md;
- if ((md->isFriend() || md->protection()!=Private || extractPrivateFlag) &&
+ if ((md->isFriend() || md->protection()!=Private || Config::extractPrivateFlag) &&
!md->isReference() && md->isRelated() && md->hasDocumentation() &&
md->name()[0]!='@' && (cd=md->memberClass()) && cd->isVisible())
found=TRUE;
@@ -574,9 +574,9 @@ void writeMemberIndex(OutputList &ol)
ol.disable(OutputGenerator::Latex);
startFile(ol,"functions","Compound Member Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trCompoundMembers());
+ parseText(ol,Config::projectName+" "+theTranslator->trCompoundMembers());
endTitle(ol,0);
- parseText(ol,theTranslator->trCompoundMembersDescription(extractAllFlag));
+ parseText(ol,theTranslator->trCompoundMembersDescription(Config::extractAllFlag));
writeMemberList(ol);
endFile(ol);
ol.enable(OutputGenerator::Latex);
@@ -615,8 +615,8 @@ void writeFileMemberList(OutputList &ol)
ol.writeString("\n");
int count=0;
- md=mn->first();
- QString prevName;
+ md=mn->last();
+ QCString prevName;
while (md)
{
FileDef *fd=md->getFileDef() ? md->getFileDef() : md->getFileDec();
@@ -633,7 +633,7 @@ void writeFileMemberList(OutputList &ol)
ol.docify(": ");
else
ol.docify(", ");
- QString baseName=fd->name().copy();
+ QCString baseName=fd->name().copy();
//int s;
//if ((s=baseName.findRev("/"))!=-1)
// baseName=baseName.right(baseName.length()-s-1);
@@ -642,7 +642,7 @@ void writeFileMemberList(OutputList &ol)
count++;
prevName=fd->name();
}
- md=mn->next();
+ md=mn->prev();
}
}
mn=functionNameList.next();
@@ -663,11 +663,9 @@ void writeNamespaceMemberList(OutputList &ol)
while (md && !found)
{
NamespaceDef *nd=md->getNamespace();
- if (nd && nd->hasDocumentation() &&
- !md->isReference() &&
- md->hasDocumentation() &&
- !md->name().isEmpty() &&
- md->name()[0]!='@') found=TRUE;
+ if (nd && nd->isVisible() &&
+ !md->isReference() && md->hasDocumentation() &&
+ !md->name().isEmpty() && md->name().at(0)!='@') found=TRUE;
else
md=mn->next();
}
@@ -679,16 +677,16 @@ void writeNamespaceMemberList(OutputList &ol)
ol.writeString("\n");
int count=0;
- md=mn->first();
- QString prevName;
+ md=mn->last();
+ QCString prevName;
while (md)
{
NamespaceDef *nd=md->getNamespace();
- if (nd && nd->hasDocumentation() &&
- !md->isReference() &&
- md->hasDocumentation() &&
- !md->name().isEmpty() && md->name()[0]!='@'
- )
+ if (nd && nd->isVisible() &&
+ !md->isReference() && md->hasDocumentation() &&
+ !md->name().isEmpty() && md->name().at(0)!='@' &&
+ prevName!=nd->name()
+ )
{
if (count==0)
ol.docify(": ");
@@ -697,8 +695,9 @@ void writeNamespaceMemberList(OutputList &ol)
ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
md->anchor(),nd->name());
count++;
+ prevName=nd->name();
}
- md=mn->next();
+ md=mn->prev();
}
}
mn=functionNameList.next();
@@ -718,10 +717,11 @@ int countNamespaceMembers()
bool found=FALSE;
while (md && !found)
{
- if (md->getNamespace() &&
+ NamespaceDef *nd=md->getNamespace();
+ if (nd && nd->isVisible() &&
!md->isReference() && md->hasDocumentation() &&
- !md->name().isEmpty() && md->name()[0]!='@'
- )
+ !md->name().isEmpty() && md->name().at(0)!='@'
+ )
found=TRUE;
else
md=mn->next();
@@ -771,9 +771,9 @@ void writeFileMemberIndex(OutputList &ol)
ol.disable(OutputGenerator::Latex);
startFile(ol,"globals","File Member Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trFileMembers());
+ parseText(ol,Config::projectName+" "+theTranslator->trFileMembers());
endTitle(ol,0);
- parseText(ol,theTranslator->trFileMembersDescription(extractAllFlag));
+ parseText(ol,theTranslator->trFileMembersDescription(Config::extractAllFlag));
writeFileMemberList(ol);
endFile(ol);
ol.enable(OutputGenerator::Latex);
@@ -789,9 +789,9 @@ void writeNamespaceMemberIndex(OutputList &ol)
ol.disable(OutputGenerator::Latex);
startFile(ol,"namespacemembers","Namespace Member Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trNamespaceMembers());
+ parseText(ol,Config::projectName+" "+theTranslator->trNamespaceMembers());
endTitle(ol,0);
- parseText(ol,theTranslator->trNamespaceMemberDescription(extractAllFlag));
+ parseText(ol,theTranslator->trNamespaceMemberDescription(Config::extractAllFlag));
writeNamespaceMemberList(ol);
endFile(ol);
ol.enable(OutputGenerator::Latex);
@@ -809,13 +809,13 @@ void writeHeaderFileList(OutputList &ol)
while (fd)
{
ol.writeListItem();
- QString path;
- if (fullPathNameFlag)
+ QCString path;
+ if (Config::fullPathNameFlag)
{
path=fd->getPath().copy();
// strip part of the path
- if (path.left(stripFromPath.length())==stripFromPath)
- path=path.right(path.length()-stripFromPath.length());
+ if (path.left(Config::stripFromPath.length())==Config::stripFromPath)
+ path=path.right(path.length()-Config::stripFromPath.length());
}
if (!path.isEmpty()) ol.docify(path);
ol.writeObjectLink(0,fd->includeName(),0,fd->name());
@@ -835,7 +835,7 @@ void writeHeaderIndex(OutputList &ol)
ol.disable(OutputGenerator::Latex);
startFile(ol,"headers","Header File Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trHeaderFiles());
+ parseText(ol,Config::projectName+" "+theTranslator->trHeaderFiles());
endTitle(ol,0);
parseText(ol,theTranslator->trHeaderFilesDescription());
writeHeaderFileList(ol);
@@ -852,7 +852,7 @@ void writeExampleIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"examples","Example Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trExamples());
+ parseText(ol,Config::projectName+" "+theTranslator->trExamples());
endTitle(ol,0);
parseText(ol,theTranslator->trExamplesDescription());
ol.startIndexList();
@@ -860,7 +860,7 @@ void writeExampleIndex(OutputList &ol)
while (pi)
{
ol.writeListItem();
- QString n=convertSlashes(pi->name,TRUE)+"-example";
+ QCString n=convertSlashes(pi->name,TRUE)+"-example";
if (!pi->title.isEmpty())
{
ol.writeObjectLink(0,n,0,pi->title);
@@ -885,16 +885,16 @@ void writePageIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"pages","Page Index");
startTitle(ol);
- ol.docify(projectName+" "+theTranslator->trRelatedPages());
+ ol.docify(Config::projectName+" "+theTranslator->trRelatedPages());
endTitle(ol,0);
parseText(ol,theTranslator->trRelatedPagesDescription());
ol.startIndexList();
PageInfo *pi=pageList.first();
while (pi)
{
- QString pageName,pageTitle;
+ QCString pageName,pageTitle;
- if (caseSensitiveNames)
+ if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
@@ -960,7 +960,7 @@ void writeGroupIndex(OutputList &ol)
ol.disable(OutputGenerator::Man);
startFile(ol,"modules","Module Index");
startTitle(ol);
- parseText(ol,projectName+" "+theTranslator->trModules());
+ parseText(ol,Config::projectName+" "+theTranslator->trModules());
endTitle(ol,0);
parseText(ol,theTranslator->trModulesDescription());
writeGroupList(ol);
@@ -975,27 +975,27 @@ void writeIndex(OutputList &ol)
bool texEnabled = ol.isEnabled(OutputGenerator::Latex);
bool htmEnabled = ol.isEnabled(OutputGenerator::Html);
- QString projPrefix;
- if (!projectName.isEmpty())
+ QCString projPrefix;
+ if (!Config::projectName.isEmpty())
{
- projPrefix=projectName+" ";
+ projPrefix=Config::projectName+" ";
}
// write HTML index
ol.disable(OutputGenerator::Man);
ol.disable(OutputGenerator::Latex);
ol.startFile("index","Main Index",FALSE);
- if (!noIndexFlag) writeQuickLinks(ol,TRUE);
+ if (!Config::noIndexFlag) writeQuickLinks(ol,TRUE);
ol.startTitleHead();
parseText(ol,projPrefix+theTranslator->trDocumentation());
ol.endTitleHead(0);
ol.newParagraph();
- if (!projectNumber.isEmpty())
+ if (!Config::projectNumber.isEmpty())
{
ol.startProjectNumber();
- parseDoc(ol,0,0,projectNumber);
+ parseDoc(ol,0,0,Config::projectNumber);
ol.endProjectNumber();
}
- if (noIndexFlag) writeQuickLinks(ol,FALSE);
+ if (Config::noIndexFlag) writeQuickLinks(ol,FALSE);
endFile(ol);
ol.disable(OutputGenerator::Html);
@@ -1004,10 +1004,10 @@ void writeIndex(OutputList &ol)
ol.startFile("refman",0,FALSE);
ol.startIndexSection(isTitlePageStart);
parseText(ol,projPrefix+theTranslator->trReferenceManual());
- if (!projectNumber.isEmpty())
+ if (!Config::projectNumber.isEmpty())
{
ol.startProjectNumber();
- parseDoc(ol,0,0,projectNumber);
+ parseDoc(ol,0,0,Config::projectNumber);
ol.endProjectNumber();
}
ol.endIndexSection(isTitlePageStart);
diff --git a/src/index.h b/src/index.h
index 0091f6a..a472a7a 100644
--- a/src/index.h
+++ b/src/index.h
@@ -17,8 +17,9 @@
#ifndef INDEX_H
#define INDEX_H
+#include "qtbc.h"
#include <qfile.h>
-#include <qtstream.h>
+//#include <qtstream.h>
enum IndexSections
{
diff --git a/src/instdox.cpp b/src/instdox.cpp
index ad22c89..4faa2e6 100644
--- a/src/instdox.cpp
+++ b/src/instdox.cpp
@@ -16,7 +16,8 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <qstring.h>
+
+#include "qtbc.h"
#include <qfile.h>
#include <qfileinf.h>
#include <qtstream.h>
@@ -28,19 +29,19 @@
void writeInstallScript()
{
- QString fileName=htmlOutputDir+"/installdox";
+ QCString fileName=Config::htmlOutputDir+"/installdox";
QFile f(fileName);
if (f.open(IO_WriteOnly))
{
QTextStream t(&f);
- t << "#!" << perlPath << endl << endl << "%subst = ( ";
+ t << "#!" << Config::perlPath << endl << endl << "%subst = ( ";
- char *s=tagFileList.first();
+ char *s=Config::tagFileList.first();
while (s)
{
QFileInfo fi(s);
t << "\"" << fi.fileName() << "\", \"\"";
- s=tagFileList.next();
+ s=Config::tagFileList.next();
if (s) t << ", ";
}
diff --git a/src/language.cpp b/src/language.cpp
index f5e2dde..cee63a8 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -20,7 +20,9 @@
#include "translator_cz.h"
#include "translator_fr.h"
#include "translator_it.h"
-#include <qstring.h>
+#include "translator_de.h"
+#include "translator_jp.h"
+#include "translator_es.h"
#define L_EQUAL(a) !stricmp(langName,a)
@@ -52,6 +54,18 @@ bool setTranslator(const char *langName)
{
theTranslator=new TranslatorItalian;
}
+ else if (L_EQUAL("german"))
+ {
+ theTranslator=new TranslatorGerman;
+ }
+ else if (L_EQUAL("japanese"))
+ {
+ theTranslator=new TranslatorJapanese;
+ }
+ else if (L_EQUAL("spanish"))
+ {
+ theTranslator=new TranslatorSpanish;
+ }
else // use the default language (i.e. english)
{
theTranslator=new Translator;
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 2f2f62b..2f49efa 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -15,6 +15,8 @@
*/
#include <stdlib.h>
+
+#include "qtbc.h"
#include <qdir.h>
#include "latexgen.h"
#include "config.h"
@@ -24,9 +26,9 @@
#include "diagram.h"
#include "language.h"
-//static QString escapeLabelName(const QString &s)
+//static QCString escapeLabelName(const QCString &s)
//{
-// QString result;
+// QCString result;
// uint i;
// for (i=0;i<s.length();i++)
// {
@@ -45,7 +47,7 @@
LatexGenerator::LatexGenerator()
: OutputGenerator()
{
- dir=latexOutputDir;
+ dir=Config::latexOutputDir;
col=0;
}
@@ -68,7 +70,7 @@ void LatexGenerator::append(const OutputGenerator *g)
void LatexGenerator::init()
{
- QString dir=latexOutputDir;
+ QCString dir=Config::latexOutputDir;
QDir d(dir);
if (!d.exists() && !d.mkdir(dir))
{
@@ -76,7 +78,7 @@ void LatexGenerator::init()
exit(1);
}
- QString fileName=dir+"/Makefile";
+ QCString fileName=dir+"/Makefile";
QFile file(fileName);
if (!file.open(IO_WriteOnly))
{
@@ -104,7 +106,7 @@ void LatexGenerator::init()
void LatexGenerator::startFile(const char *name,const char *,bool)
{
- QString fileName=name;
+ QCString fileName=name;
if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex";
startPlainFile(fileName);
}
@@ -126,16 +128,16 @@ void LatexGenerator::startProjectNumber()
void LatexGenerator::startIndexSection(IndexSections is)
{
- QString paperName;
+ QCString paperName;
switch (is)
{
case isTitlePageStart:
{
- if (paperType=="a4wide") paperName="a4"; else paperName=paperType;
+ if (Config::paperType=="a4wide") paperName="a4"; else paperName=Config::paperType;
t << "\\documentclass[" << paperName << "paper]{";
- if (compactLatexFlag) t << "article"; else t << "book";
+ if (Config::compactLatexFlag) t << "article"; else t << "book";
t << "}\n";
- if (paperType=="a4wide") t << "\\usepackage{a4wide}\n";
+ if (Config::paperType=="a4wide") t << "\\usepackage{a4wide}\n";
t << "\\usepackage{makeidx}\n"
"\\usepackage{fancyheadings}\n"
"\\usepackage{epsf}\n"
@@ -145,11 +147,11 @@ void LatexGenerator::startIndexSection(IndexSections is)
{
t << "\\usepackage{" << theTranslator->latexBabelPackage() << "}\n";
}
- const char *s=extraPackageList.first();
+ const char *s=Config::extraPackageList.first();
while (s)
{
t << "\\usepackage{" << s << "}\n";
- s=extraPackageList.next();
+ s=Config::extraPackageList.next();
}
t << "\\makeindex\n"
"\\setcounter{tocdepth}{1}\n"
@@ -169,23 +171,23 @@ void LatexGenerator::startIndexSection(IndexSections is)
t << "}\n\\author{";
break;
case isModuleIndex:
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Module Index}\n"
break;
case isNamespaceIndex:
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Namespace Index}\"
break;
case isClassHierarchyIndex:
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Hierarchical Index}\n"
break;
case isCompoundIndex:
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Annotated Compound Index}\n"
break;
case isFileIndex:
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Annotated File Index}\n"
break;
case isModuleDocumentation:
@@ -196,7 +198,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
{
if (gd->hasDocumentation() || gd->countMembers()>0)
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Module Documentation}\n";
found=TRUE;
}
@@ -212,7 +214,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
{
if (nd->hasDocumentation())
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; // Namespace Documentation}\n":
found=TRUE;
}
@@ -228,7 +230,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
{
if (!cd->isReference() && cd->isVisible())
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Compound Documentation}\n";
found=TRUE;
}
@@ -249,7 +251,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
{
if (isFirst)
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //File Documentation}\n";
isFirst=FALSE;
break;
@@ -263,13 +265,13 @@ void LatexGenerator::startIndexSection(IndexSections is)
break;
case isExampleDocumentation:
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Example Documentation}\n";
}
break;
case isPageDocumentation:
{
- if (compactLatexFlag) t << "\\section"; else t << "\\chapter";
+ if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter";
t << "{"; //Page Documentation}\n";
}
break;
@@ -289,9 +291,9 @@ void LatexGenerator::endIndexSection(IndexSections is)
"\\date{" << dateToString(TRUE) << "}\n"
"\\maketitle\n"
"\\pagenumbering{roman}\n";
- if (!compactLatexFlag) t << "\\clearemptydoublepage\n";
+ if (!Config::compactLatexFlag) t << "\\clearemptydoublepage\n";
t << "\\tableofcontents\n";
- if (!compactLatexFlag) t << "\\clearemptydoublepage\n";
+ if (!Config::compactLatexFlag) t << "\\clearemptydoublepage\n";
t << "\\pagenumbering{arabic}\n";
break;
case isModuleIndex:
@@ -326,7 +328,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
{
if (gd->hasDocumentation() || gd->countMembers()>0)
{
- if (compactLatexFlag) t << "\\input"; else t << "\\include";
+ if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
t << "{" << gd->getOutputFileBase() << "}\n";
}
gd=groupList.next();
@@ -350,7 +352,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
{
if (nd->hasDocumentation() || nd->countMembers()>0)
{
- if (compactLatexFlag) t << "\\input"; else t << "\\include";
+ if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
t << "{" << nd->getOutputFileBase() << "}\n";
}
nd=namespaceList.next();
@@ -382,7 +384,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
// )
if (!cd->isReference() && cd->isVisible())
{
- if (compactLatexFlag) t << "\\input"; else t << "\\include";
+ if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
t << "{" << cd->getOutputFileBase() << "}\n";
}
cd=classList.next();
@@ -407,7 +409,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
}
else
{
- if (compactLatexFlag) t << "\\input" ; else t << "\\include";
+ if (Config::compactLatexFlag) t << "\\input" ; else t << "\\include";
t << "{" << fd->getOutputFileBase() << "}\n";
}
}
@@ -428,7 +430,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
}
while (pi)
{
- if (compactLatexFlag) t << "\\input" ; else t << "\\include";
+ if (Config::compactLatexFlag) t << "\\input" ; else t << "\\include";
t << "{" << convertSlashes(pi->name,TRUE) << "-example}\n";
pi=exampleList.next();
}
@@ -440,8 +442,8 @@ void LatexGenerator::endIndexSection(IndexSections is)
PageInfo *pi=pageList.first();
if (pi)
{
- QString pageName;
- if (caseSensitiveNames)
+ QCString pageName;
+ if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
@@ -450,9 +452,9 @@ void LatexGenerator::endIndexSection(IndexSections is)
}
while (pi)
{
- if (compactLatexFlag) t << "\\input" ; else t << "\\include";
- QString pageName;
- if (caseSensitiveNames)
+ if (Config::compactLatexFlag) t << "\\input" ; else t << "\\include";
+ QCString pageName;
+ if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
@@ -473,7 +475,7 @@ void LatexGenerator::writeStyleInfo(int part)
{
case 0:
{
- QString pname=projectName.stripWhiteSpace();
+ QCString pname=Config::projectName.stripWhiteSpace();
startPlainFile("doxygen.sty");
t << "\\NeedsTeXFormat{LaTeX2e}\n";
t << "\\ProvidesPackage{doxygen}\n";
@@ -484,7 +486,7 @@ void LatexGenerator::writeStyleInfo(int part)
t << "\\addtolength{\\headwidth}{\\marginparwidth}\n";
t << "\\newcommand{\\clearemptydoublepage}{\\newpage{\\pagestyle{empty}";
t << "\\cleardoublepage}}\n";
- if (!compactLatexFlag)
+ if (!Config::compactLatexFlag)
t << "\\renewcommand{\\chaptermark}[1]{\\markboth{#1}{}}\n";
t << "\\renewcommand{\\sectionmark}[1]{\\markright{\\thesection\\ #1}}\n";
t << "\\lhead[\\fancyplain{}{\\bfseries\\thepage}]\n";
@@ -501,7 +503,7 @@ void LatexGenerator::writeStyleInfo(int part)
case 2:
{
t << " Dimitri van Heesch \\copyright 1997-1999}]{}\n";
- //QString dtString=dateToString(FALSE);
+ //QCString dtString=dateToString(FALSE);
t << "\\lfoot[]{\\fancyplain{}{\\bfseries\\scriptsize ";
}
break;
@@ -646,7 +648,7 @@ void LatexGenerator::writeObjectLink(const char *, const char *,
void LatexGenerator::writePageRef(const char *clname, const char *anchor)
{
- t << " {\\rm (p. \\pageref{";
+ t << " {\\rm (p.~\\pageref{";
if (clname) t << clname;
if (anchor) t << "_" << anchor;
t << "})}";
@@ -662,12 +664,12 @@ void LatexGenerator::writeCodeLink(const char *,const char *,
void LatexGenerator::startTitle()
{
- if (compactLatexFlag) t << "\\subsection{"; else t << "\\section{";
+ if (Config::compactLatexFlag) t << "\\subsection{"; else t << "\\section{";
}
void LatexGenerator::startGroupHeader()
{
- if (compactLatexFlag) t << "\\subsubsection*{"; else t << "\\subsection*{";
+ if (Config::compactLatexFlag) t << "\\subsubsection*{"; else t << "\\subsection*{";
}
void LatexGenerator::endGroupHeader()
@@ -700,7 +702,7 @@ void LatexGenerator::startMemberDoc(const char *clname,
}
t << "}" << endl;
//
- if (compactLatexFlag) t << "\\subsubsection{"; else t << "\\subsection{";
+ if (Config::compactLatexFlag) t << "\\subsubsection{"; else t << "\\subsection{";
t << "\\setlength{\\rightskip}{0pt plus 5cm}";
}
@@ -762,7 +764,7 @@ void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab,
startBold();
docify(title);
endBold();
- t << " (p. \\pageref{" << lab << "})" << endl;
+ t << " (p.~\\pageref{" << lab << "})" << endl;
}
//void LatexGenerator::docify(const char *str)
@@ -808,78 +810,101 @@ void LatexGenerator::docify(const char *str)
else
{ t << "$\\backslash$"; }
break;
- // the Latin-1 characters
- case 161: t << "!`"; break;
- case 181: t << "$\\mu$"; break;
- case 191: t << "?`"; break;
- case 192: t << "\\`{A}"; break;
- case 193: t << "\\'{A}"; break;
- case 194: t << "\\^{A}"; break;
- case 195: t << "\\~{A}"; break;
- case 196: t << "\\\"{A}"; break;
- case 197: t << "\\AA "; break;
- case 198: t << "\\AE "; break;
- case 199: t << "\\c{C}"; break;
- case 200: t << "\\`{E}"; break;
- case 201: t << "\\'{E}"; break;
- case 202: t << "\\^{E}"; break;
- case 203: t << "\\\"{E}"; break;
- case 204: t << "\\`{I}"; break;
- case 205: t << "\\'{I}"; break;
- case 206: t << "\\^{I}"; break;
- case 207: t << "\\\"{I}"; break;
- case 208: t << "D "; break; // anyone know the real code?
- case 209: t << "\\~{N}"; break;
- case 210: t << "\\`{O}"; break;
- case 211: t << "\\'{O}"; break;
- case 212: t << "\\^{O}"; break;
- case 213: t << "\\~{O}"; break;
- case 214: t << "\\\"{O}"; break;
- case 215: t << "$\\times$"; break;
- case 216: t << "\\O"; break;
- case 217: t << "\\`{U}"; break;
- case 218: t << "\\'{U}"; break;
- case 219: t << "\\^{U}"; break;
- case 220: t << "\\\"{U}"; break;
- case 221: t << "\\'{Y}"; break;
- case 223: t << "\"s "; break; // assumes german package
- case 224: t << "\\`{a}"; break;
- case 225: t << "\\'{a}"; break;
- case 226: t << "\\^{a}"; break;
- case 227: t << "\\~{a}"; break;
- case 228: t << "\\\"{a}"; break;
- case 229: t << "\\aa "; break;
- case 230: t << "\\ae "; break;
- case 231: t << "\\c{c}"; break;
- case 232: t << "\\`{e}"; break;
- case 233: t << "\\'{e}"; break;
- case 234: t << "\\^{e}"; break;
- case 235: t << "\\\"{e}"; break;
- case 236: t << "\\`{\\i}"; break;
- case 237: t << "\\'{\\i}"; break;
- case 238: t << "\\^{\\i}"; break;
- case 239: t << "\\\"{\\i}"; break;
- case 241: t << "\\~{n}"; break;
- case 242: t << "\\`{o}"; break;
- case 243: t << "\\'{o}"; break;
- case 244: t << "\\^{o}"; break;
- case 245: t << "\\~{o}"; break;
- case 246: t << "\\\"{o}"; break;
- case 248: t << "\\o "; break;
- case 249: t << "\\`{u}"; break;
- case 250: t << "\\'{u}"; break;
- case 251: t << "\\^{u}"; break;
- case 252: t << "\\\"{u}"; break;
- case 253: t << "\\'{y}"; break;
- case 255: t << "\\\"{y}"; break;
default:
- if ((isupper(c) && islower(pc))
- // ||
- // (pc!=':' && c==':') ||
- // (pc==':' && c!=':')
- ) t << "\\-";
- t << (char)c;
+ if (theTranslator->latexBabelPackage()=="a4j")
+ { // language is japanese
+ if (c>=128) // wide character
+ {
+ t << (char)c;
+ if (*p)
+ {
+ c = *p++;
+ t << (char)c;
+ }
+ else // ascii char => see if we can insert hypenation hint
+ {
+ if (isupper(c) && islower(pc)) t << "\\-";
+ t << (char)c;
+ }
+ }
+ }
+ else // language is other than japanese
+ {
+ switch(c)
+ {
+ // the Latin-1 characters
+ case 161: t << "!`"; break;
+ case 181: t << "$\\mu$"; break;
+ case 191: t << "?`"; break;
+ case 192: t << "\\`{A}"; break;
+ case 193: t << "\\'{A}"; break;
+ case 194: t << "\\^{A}"; break;
+ case 195: t << "\\~{A}"; break;
+ case 196: t << "\\\"{A}"; break;
+ case 197: t << "\\AA "; break;
+ case 198: t << "\\AE "; break;
+ case 199: t << "\\c{C}"; break;
+ case 200: t << "\\`{E}"; break;
+ case 201: t << "\\'{E}"; break;
+ case 202: t << "\\^{E}"; break;
+ case 203: t << "\\\"{E}"; break;
+ case 204: t << "\\`{I}"; break;
+ case 205: t << "\\'{I}"; break;
+ case 206: t << "\\^{I}"; break;
+ case 207: t << "\\\"{I}"; break;
+ case 208: t << "D "; break; // anyone know the real code?
+ case 209: t << "\\~{N}"; break;
+ case 210: t << "\\`{O}"; break;
+ case 211: t << "\\'{O}"; break;
+ case 212: t << "\\^{O}"; break;
+ case 213: t << "\\~{O}"; break;
+ case 214: t << "\\\"{O}"; break;
+ case 215: t << "$\\times$"; break;
+ case 216: t << "\\O"; break;
+ case 217: t << "\\`{U}"; break;
+ case 218: t << "\\'{U}"; break;
+ case 219: t << "\\^{U}"; break;
+ case 220: t << "\\\"{U}"; break;
+ case 221: t << "\\'{Y}"; break;
+ case 223: t << "\"s "; break; // assumes german package
+ case 224: t << "\\`{a}"; break;
+ case 225: t << "\\'{a}"; break;
+ case 226: t << "\\^{a}"; break;
+ case 227: t << "\\~{a}"; break;
+ case 228: t << "\\\"{a}"; break;
+ case 229: t << "\\aa "; break;
+ case 230: t << "\\ae "; break;
+ case 231: t << "\\c{c}"; break;
+ case 232: t << "\\`{e}"; break;
+ case 233: t << "\\'{e}"; break;
+ case 234: t << "\\^{e}"; break;
+ case 235: t << "\\\"{e}"; break;
+ case 236: t << "\\`{\\i}"; break;
+ case 237: t << "\\'{\\i}"; break;
+ case 238: t << "\\^{\\i}"; break;
+ case 239: t << "\\\"{\\i}"; break;
+ case 241: t << "\\~{n}"; break;
+ case 242: t << "\\`{o}"; break;
+ case 243: t << "\\'{o}"; break;
+ case 244: t << "\\^{o}"; break;
+ case 245: t << "\\~{o}"; break;
+ case 246: t << "\\\"{o}"; break;
+ case 248: t << "\\o "; break;
+ case 249: t << "\\`{u}"; break;
+ case 250: t << "\\'{u}"; break;
+ case 251: t << "\\^{u}"; break;
+ case 252: t << "\\\"{u}"; break;
+ case 253: t << "\\'{y}"; break;
+ case 255: t << "\\\"{y}"; break;
+ default: // normal ascii char
+ {
+ // see if we can insert an hyphenation hint
+ if (isupper(c) && islower(pc)) t << "\\-";
+ t << (char)c;
+ }
+ }
+ }
}
pc = c;
}
@@ -916,7 +941,7 @@ void LatexGenerator::writeChar(char c)
void LatexGenerator::startClassDiagram()
{
- if (compactLatexFlag) t << "\\subsubsection*"; else t << "\\subsection*";
+ if (Config::compactLatexFlag) t << "\\subsubsection*"; else t << "\\subsection*";
t << "{";
}
diff --git a/src/latexgen.h b/src/latexgen.h
index 5cabe66..cfd8230 100644
--- a/src/latexgen.h
+++ b/src/latexgen.h
@@ -83,6 +83,8 @@ class LatexGenerator : public OutputGenerator
void endMemberSections() {}
void startMemberHeader() { startGroupHeader(); }
void endMemberHeader() { endGroupHeader(); }
+ void startMemberSubtitle() {}
+ void endMemberSubtitle() {}
void startMemberList() { t << "\\begin{CompactItemize}" << endl; }
void endMemberList() { t << "\\end{CompactItemize}" << endl; }
void startMemberItem() { t << "\\item " << endl; }
diff --git a/src/logos.cpp b/src/logos.cpp
index 090309a..ac6e782 100644
--- a/src/logos.cpp
+++ b/src/logos.cpp
@@ -14,10 +14,11 @@
*
*/
-#include <qstring.h>
-#include <qfile.h>
#include <stdio.h>
+#include "qtbc.h"
+#include <qfile.h>
+
unsigned char logo_data[] = {
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x76, 0x00, 0x35, 0x00, 0xf7, 0x00,
0x00, 0x31, 0x7b, 0x6b, 0x31, 0x7b, 0x73, 0x31, 0x84, 0x7b, 0x31, 0x84,
@@ -492,7 +493,7 @@ unsigned int search_len = 2010;
void writeLogo(const char *dir)
{
- QString fileName=(QString)dir+"/doxygen.gif";
+ QCString fileName=(QCString)dir+"/doxygen.gif";
QFile f(fileName);
if (f.open(IO_WriteOnly))
f.writeBlock((char *)logo_data,logo_len);
@@ -505,7 +506,7 @@ void writeLogo(const char *dir)
void writeSearchButton(const char *dir)
{
- QString fileName=(QString)dir+"/search.gif";
+ QCString fileName=(QCString)dir+"/search.gif";
QFile f(fileName);
if (f.open(IO_WriteOnly))
f.writeBlock((char *)search_data,search_len);
diff --git a/src/mangen.cpp b/src/mangen.cpp
index d1bc4c6..056bc90 100644
--- a/src/mangen.cpp
+++ b/src/mangen.cpp
@@ -14,8 +14,10 @@
*
*/
-#include <qdir.h>
#include <stdlib.h>
+
+#include "qtbc.h"
+#include <qdir.h>
#include "message.h"
#include "mangen.h"
#include "config.h"
@@ -24,7 +26,7 @@
ManGenerator::ManGenerator() : OutputGenerator()
{
- dir=manOutputDir+"/man3";
+ dir=Config::manOutputDir+"/man3";
firstCol=TRUE;
paragraph=FALSE;
col=0;
@@ -37,7 +39,7 @@ ManGenerator::~ManGenerator()
void ManGenerator::append(const OutputGenerator *g)
{
- QString r=g->getContents();
+ QCString r=g->getContents();
if (upperCase)
t << r.upper();
else
@@ -52,23 +54,23 @@ void ManGenerator::append(const OutputGenerator *g)
void ManGenerator::init()
{
- QDir d(manOutputDir);
- if (!d.exists() && !d.mkdir(manOutputDir))
+ QDir d(Config::manOutputDir);
+ if (!d.exists() && !d.mkdir(Config::manOutputDir))
{
- err("Could not create output directory %s\n",manOutputDir.data());
+ err("Could not create output directory %s\n",Config::manOutputDir.data());
exit(1);
}
- d.setPath(manOutputDir+"/man3");
- if (!d.exists() && !d.mkdir(manOutputDir+"/man3"))
+ d.setPath(Config::manOutputDir+"/man3");
+ if (!d.exists() && !d.mkdir(Config::manOutputDir+"/man3"))
{
- err("Could not create output directory %s/man3\n",manOutputDir.data());
+ err("Could not create output directory %s/man3\n",Config::manOutputDir.data());
exit(1);
}
}
void ManGenerator::startFile(const char *name,const char *,bool)
{
- QString fileName=name;
+ QCString fileName=name;
if (fileName.left(6)=="class_")
{
fileName=fileName.right(fileName.length()-6);
@@ -78,7 +80,8 @@ void ManGenerator::startFile(const char *name,const char *,bool)
{
fileName=fileName.left(i);
}
- if (fileName.right(2)!=manExtension) fileName+=manExtension;
+ if (convertToQCString(fileName.right(2))!=Config::manExtension)
+ fileName+=Config::manExtension;
startPlainFile(fileName);
firstCol=TRUE;
}
@@ -95,10 +98,10 @@ void ManGenerator::writeDoxyAnchor(const char *, const char *,const char *)
void ManGenerator::endTitleHead(const char *name)
{
t << ".TH " << name << " 3 \"" << dateToString(FALSE) << "\" \"";
- if (projectName.isEmpty())
+ if (Config::projectName.isEmpty())
t << "Doxygen";
else
- t << projectName;
+ t << Config::projectName;
t << "\" \\\" -*- nroff -*-" << endl;
t << ".ad l" << endl;
t << ".nh" << endl;
diff --git a/src/mangen.h b/src/mangen.h
index bcc9034..03a6a39 100644
--- a/src/mangen.h
+++ b/src/mangen.h
@@ -82,6 +82,8 @@ class ManGenerator : public OutputGenerator
void startMemberHeader();
void endMemberHeader();
void insertMemberAlign() {}
+ void startMemberSubtitle() {}
+ void endMemberSubtitle() {}
void writeListItem();
void startMemberList() { t << "\n.in +1c"; firstCol=FALSE; }
void endMemberList() { t << "\n.in -1c"; firstCol=FALSE; }
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index bd440c3..1321692 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -58,6 +58,7 @@ MemberDef::MemberDef(const char *t,const char *na,const char *a,const char *e,
enumFields=0;
enumScope=0;
enumDeclList=0;
+ scopeTAL=0;
type=substituteClassNames(t);
args=substituteClassNames(a);
if (type.isNull()) decl=name()+args; else decl=type+" "+name()+args;
@@ -107,7 +108,6 @@ MemberDef::MemberDef(const char *t,const char *na,const char *a,const char *e,
{
argList=0;
}
-
}
MemberDef::~MemberDef()
@@ -180,7 +180,7 @@ void MemberDef::writeExample(OutputList &ol)
}
#endif
-QString MemberDef::getOutputFileBase() const
+QCString MemberDef::getOutputFileBase() const
{
if (classDef)
{
@@ -202,3 +202,50 @@ QString MemberDef::getOutputFileBase() const
" container!\n",name().data());
return "dummy";
}
+
+void MemberDef::setScopeTemplateArguments(ArgumentList *tal)
+{
+ // copy function arguments (if any)
+ if (tal)
+ {
+ scopeTAL = new ArgumentList;
+ scopeTAL->setAutoDelete(TRUE);
+ ArgumentListIterator tali(*tal);
+ Argument *a;
+ for (;(a=tali.current());++tali)
+ {
+ scopeTAL->append(new Argument(*a));
+ }
+ scopeTAL->constSpecifier = tal->constSpecifier;
+ scopeTAL->volatileSpecifier = tal->volatileSpecifier;
+ scopeTAL->pureSpecifier = tal->pureSpecifier;
+ }
+}
+
+QCString MemberDef::getScopeTemplateNameString()
+{
+ QCString result;
+ if (!scopeTAL || scopeTAL->count()==0) return result;
+ result="<";
+ Argument *a=scopeTAL->first();
+ while (a)
+ {
+ if (a->name.length()>0) // add template argument name
+ {
+ result+=a->name;
+ }
+ else // extract name from type
+ {
+ int i=a->type.length()-1;
+ while (i>=0 && isId(a->type.at(i))) i--;
+ if (i>0)
+ {
+ result+=a->type.right(a->type.length()-i-1);
+ }
+ }
+ a=scopeTAL->next();
+ if (a) result+=", ";
+ }
+ result+=">";
+ return result;
+}
diff --git a/src/memberdef.h b/src/memberdef.h
index 67a9aa9..4c1893f 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -17,7 +17,7 @@
#ifndef MEMBERDEF_H
#define MEMBERDEF_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qlist.h>
#include <qdict.h>
@@ -55,13 +55,14 @@ class MemberDef : public Definition
const ArgumentList *al);
~MemberDef();
- QString getOutputFileBase() const;
+ QCString getOutputFileBase() const;
const char *declaration() const { return decl; }
const char *definition() const { return def; }
const char *typeString() const { return type; }
const char *argsString() const { return args; }
const char *excpString() const { return exception; }
const char *anchor() const { return ref; }
+ QCString bodyCode() const { return body; }
ClassDef *memberClass() { return classDef; }
Protection protection() const { return prot; }
Specifier virtualness() const { return virt; }
@@ -74,17 +75,25 @@ class MemberDef : public Definition
void setFileDec(FileDef *fd) { fileDec=fd; }
void setAnchor(const char *a) { ref=a; }
void setProtection(Protection p) { prot=p; }
+ void setBody(const QCString &b) { body=b; }
FileDef *getFileDef() { return fileDef; }
FileDef *getFileDec() { return fileDec; }
void setMemberClass(ClassDef *cd) { classDef=cd; }
bool isRelated() const { return related; }
bool isStatic() const { return stat; }
+ bool hasDocumentation() // overrides hasDocumentation in definition.h
+ { return !documentation().isNull() ||
+ !briefDescription().isNull() ||
+ !body.isEmpty() ||
+ Config::extractAllFlag;
+ }
+
bool detailsAreVisible() const
- { return !documentation().isEmpty() ||
+ { return !documentation().isEmpty() || !body.isEmpty() ||
(mtype==Enumeration && docEnumValues) ||
(mtype==EnumValue && !briefDescription().isEmpty()) ||
(!briefDescription().isEmpty() &&
- !briefMemDescFlag && repeatBriefFlag);
+ !Config::briefMemDescFlag && Config::repeatBriefFlag);
}
// relation to other members
@@ -138,7 +147,14 @@ class MemberDef : public Definition
// argument related members
ArgumentList *argumentList() const { return argList; }
+ void setArgumentList(ArgumentList *al)
+ { if (argList) delete argList;
+ argList = al;
+ }
ArgumentList *templateArguments() const { return tArgList; }
+ void setScopeTemplateArguments(ArgumentList *t);
+ ArgumentList *scopeTemplateArguments() const { return scopeTAL; }
+ QCString getScopeTemplateNameString();
// namespace related members
NamespaceDef *getNamespace() { return nspace; }
@@ -158,20 +174,21 @@ class MemberDef : public Definition
MemberList *enumFields; // enumeration fields
OutputList *enumDeclList; // stored piece of documentation for enumeration.
NamespaceDef *nspace; // the namespace this member is in.
- QString type; // return type
- QString args; // function arguments/variable array specifiers
- QString exception; // exceptions that can be thrown
- QString decl; // member declaration in class
- QString declFile; // file where the declaration was found
+ QCString type; // return type
+ QCString args; // function arguments/variable array specifiers
+ QCString exception; // exceptions that can be thrown
+ QCString body; // function body code
+ QCString decl; // member declaration in class
+ QCString declFile; // file where the declaration was found
int declLine; // line where the declaration was found
- QString def; // member definition in code (fully qualified name)
- QString defFile; // file where the definition was found
+ QCString def; // member definition in code (fully qualified name)
+ QCString defFile; // file where the definition was found
int defLine; // line where the definition was found
- QString ref; // HTML anchor name
+ QCString ref; // HTML anchor name
Specifier virt; // normal/virtual/pure virtual
Protection prot; // protection type [Public/Protected/Private]
bool related; // is this a member that is only related to a class
- QString external; // anchor of a member if extracted from a tag file
+ QCString external; // anchor of a member if extracted from a tag file
bool stat; // is it a static function?
MemberType mtype; // returns the kind of member
bool eUsed; // is the enumerate already placed in a list
@@ -179,6 +196,7 @@ class MemberDef : public Definition
bool docEnumValues; // is an enum with documented enum values.
ArgumentList *argList; // argument list of this member
ArgumentList *tArgList; // template argument list of function template
+ ArgumentList *scopeTAL; // template argument list of class template
// disable copying of member defs
MemberDef(const MemberDef &);
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index e9fa8b0..99ad00a 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -40,10 +40,10 @@ void MemberList::countDecMembers()
MemberDef *md=first();
while (md)
{
- if ((!hideMemberFlag || md->hasDocumentation()) &&
- (!hideMemberFlag || !md->documentation().isEmpty() ||
- briefMemDescFlag || repeatBriefFlag
- ) || extractAllFlag ||
+ if ((!Config::hideMemberFlag || md->hasDocumentation()) &&
+ (!Config::hideMemberFlag || !md->documentation().isEmpty() ||
+ Config::briefMemDescFlag || Config::repeatBriefFlag
+ ) || Config::extractAllFlag ||
(md->isEnumerate() &&
md->hasDocumentedEnumValues()
)
@@ -59,7 +59,7 @@ void MemberList::countDecMembers()
case MemberDef::EnumValue: enumValCnt++; break;
case MemberDef::Typedef: typeCnt++; break;
case MemberDef::Prototype: protoCnt++; break;
- case MemberDef::Define: if (extractAllFlag || md->argsString() || md->hasDocumentation() )
+ case MemberDef::Define: if (Config::extractAllFlag || md->argsString() || md->hasDocumentation() )
defCnt++;
break;
case MemberDef::Friend: friendCnt++; break;
@@ -73,18 +73,11 @@ void MemberList::countDecMembers()
void MemberList::countDocMembers()
{
- varCnt=funcCnt=enumCnt=enumValCnt=typeCnt=protoCnt=defCnt=friendCnt;
+ varCnt=funcCnt=enumCnt=enumValCnt=typeCnt=protoCnt=defCnt=friendCnt=0;
MemberDef *md=first();
while (md)
{
- //if (extractAllFlag || /*md->hasDocumentation()*/
- // !md->documentation().isEmpty() ||
- // (!md->briefDescription().isEmpty() &&
- // !briefMemDescFlag &&
- // repeatBriefFlag
- // )
- // )
- if (extractAllFlag || md->detailsAreVisible())
+ if (Config::extractAllFlag || md->detailsAreVisible())
{
QRegExp r("@[0-9]+");
int dummy;
diff --git a/src/membername.h b/src/membername.h
index 4754fa7..c485dc8 100644
--- a/src/membername.h
+++ b/src/membername.h
@@ -29,7 +29,7 @@ class MemberName : public QList<MemberDef>
int compareItems(GCI item1,GCI item2);
private:
- QString name;
+ QCString name;
};
class MemberNameIterator : public QListIterator<MemberDef>
@@ -62,8 +62,8 @@ struct MemberInfo
MemberDef *memberDef;
Protection prot;
Specifier virt;
- QString scopePath;
- QString ambiguityResolutionScope;
+ QCString scopePath;
+ QCString ambiguityResolutionScope;
};
class MemberNameInfo : public QList<MemberInfo>
@@ -74,7 +74,7 @@ class MemberNameInfo : public QList<MemberInfo>
const char *memberName() const { return name; }
int compareItems(GCI item1,GCI item2);
private:
- QString name;
+ QCString name;
};
class MemberNameInfoIterator : public QListIterator<MemberInfo>
diff --git a/src/message.cpp b/src/message.cpp
index 9f98107..c7b2a34 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -20,7 +20,7 @@
void msg(const char *fmt, ...)
{
- if (!quietFlag)
+ if (!Config::quietFlag)
{
va_list args;
va_start(args, fmt);
@@ -31,7 +31,7 @@ void msg(const char *fmt, ...)
void warn(const char *fmt, ...)
{
- if (warningFlag)
+ if (Config::warningFlag)
{
va_list args;
va_start(args, fmt);
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index bde86c6..2574563 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -14,6 +14,7 @@
*
*/
+#include "qtbc.h"
#include "namespacedef.h"
#include "outputlist.h"
#include "util.h"
@@ -60,14 +61,14 @@ void NamespaceDef::computeAnchors()
void NamespaceDef::writeDocumentation(OutputList &ol)
{
- QString pageTitle=name()+" Namespace Reference";
+ QCString pageTitle=name()+" Namespace Reference";
startFile(ol,fileName,pageTitle);
startTitle(ol);
//ol.docify(pageTitle);
parseText(ol,theTranslator->trNamespaceReference(name()));
endTitle(ol,name());
- if (genTagFile.length()>0) tagFile << "%" << name() << ":\n";
+ if (Config::genTagFile.length()>0) tagFile << "%" << name() << ":\n";
OutputList briefOutput(&ol);
if (briefDescription())
@@ -103,7 +104,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startMemberList();
found=TRUE;
}
- QString clName=cd->name().copy();
+ QCString clName=cd->name().copy();
if (clName.left(name().length()+2)==name()+"::")
{
clName = clName.right(clName.length()-name().length()-2);
@@ -225,7 +226,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader();
parseText(ol,theTranslator->trAuthor());
ol.endGroupHeader();
- parseText(ol,theTranslator->trGeneratedAutomatically(projectName));
+ parseText(ol,theTranslator->trGeneratedAutomatically(Config::projectName));
ol.enableAll();
endFile(ol);
}
diff --git a/src/namespacedef.h b/src/namespacedef.h
index f888f43..ca25700 100644
--- a/src/namespacedef.h
+++ b/src/namespacedef.h
@@ -17,7 +17,7 @@
#ifndef NAMESPACEDEF_H
#define NAMESPACEDEF_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qstrlist.h>
#include <qdict.h>
#include "definition.h"
@@ -33,8 +33,8 @@ class NamespaceDef : public Definition
public:
NamespaceDef(const char *name,const char *ref=0);
~NamespaceDef();
- //QString namespaceFile() const { return fileName; }
- QString getOutputFileBase() const { return fileName; }
+ //QCString namespaceFile() const { return fileName; }
+ QCString getOutputFileBase() const { return fileName; }
void insertUsedFile(const char *fname);
void writeDocumentation(OutputList &ol);
void insertClass(ClassDef *cd);
@@ -42,10 +42,20 @@ class NamespaceDef : public Definition
void computeAnchors();
int countMembers();
const char *getReference() { return reference; }
+ bool isVisible()
+ {
+ return !getReference() && hasDocumentation() &&
+ !name().isEmpty() && name().at(0)!='@';
+ }
+ bool isVisibleExt()
+ {
+ return (getReference() || hasDocumentation()) &&
+ !name().isEmpty() && name().at(0)!='@';
+ }
private:
- QString reference;
- QString fileName;
+ QCString reference;
+ QCString fileName;
QStrList files;
ClassList *classList;
MemberList *memList;
diff --git a/src/outputgen.cpp b/src/outputgen.cpp
index ca07302..3496aad 100644
--- a/src/outputgen.cpp
+++ b/src/outputgen.cpp
@@ -15,8 +15,9 @@
*/
#include <stdlib.h>
+
+#include "qtbc.h"
#include "outputgen.h"
-#include <qstring.h>
#include "message.h"
OutputGenerator::OutputGenerator()
@@ -38,7 +39,7 @@ OutputGenerator::~OutputGenerator()
void OutputGenerator::startPlainFile(const char *name)
{
//printf("startPlainFile(%s)\n",name);
- QString fileName=dir+"/"+name;
+ QCString fileName=dir+"/"+name;
file = new QFile(fileName);
if (!file)
{
@@ -66,9 +67,9 @@ void OutputGenerator::endPlainFile()
t.setDevice(&b);
}
-QString OutputGenerator::getContents() const
+QCString OutputGenerator::getContents() const
{
- QString s;
+ QCString s;
s.resize(a.size()+1);
memcpy(s.data(),a.data(),a.size());
s.at(a.size())='\0';
diff --git a/src/outputgen.h b/src/outputgen.h
index 5b9f981..7411d5c 100644
--- a/src/outputgen.h
+++ b/src/outputgen.h
@@ -17,7 +17,7 @@
#ifndef OUTPUTGEN_H
#define OUTPUTGEN_H
-#include <qstring.h>
+#include "qtbc.h"
#include <qtstream.h>
#include <qbuffer.h>
#include <qfile.h>
@@ -88,6 +88,8 @@ class OutputGenerator
virtual void endMemberSections() = 0;
virtual void startMemberHeader() = 0;
virtual void endMemberHeader() = 0;
+ virtual void startMemberSubtitle() = 0;
+ virtual void endMemberSubtitle() = 0;
virtual void startMemberList() = 0;
virtual void endMemberList() = 0;
virtual void startMemberItem() = 0;
@@ -168,7 +170,7 @@ class OutputGenerator
b.open(IO_WriteOnly); t.setDevice(&b); }
void startPlainFile(const char *name);
void endPlainFile();
- QString getContents() const;
+ QCString getContents() const;
bool isEnabled() const { return active; }
protected:
QTextStream fs;
@@ -176,7 +178,7 @@ class OutputGenerator
QBuffer b;
QTextStream t;
QFile *file;
- QString dir;
+ QCString dir;
bool active;
private:
diff --git a/src/outputlist.h b/src/outputlist.h
index 6f73271..8f66f63 100644
--- a/src/outputlist.h
+++ b/src/outputlist.h
@@ -17,8 +17,8 @@
#ifndef OUTPUTLIST_H
#define OUTPUTLIST_H
+#include "qtbc.h"
#include <qlist.h>
-#include <qstring.h>
#include "index.h" // for IndexSections
#include "outputgen.h"
@@ -137,6 +137,10 @@ class OutputList
{ forall(&OutputGenerator::startMemberHeader); }
void endMemberHeader()
{ forall(&OutputGenerator::endMemberHeader); }
+ void startMemberSubtitle()
+ { forall(&OutputGenerator::startMemberSubtitle); }
+ void endMemberSubtitle()
+ { forall(&OutputGenerator::endMemberSubtitle); }
void startMemberList()
{ forall(&OutputGenerator::startMemberList); }
void endMemberList()
diff --git a/src/pre.h b/src/pre.h
index 5028929..31badb1 100644
--- a/src/pre.h
+++ b/src/pre.h
@@ -17,23 +17,10 @@
#ifndef PRE_H
#define PRE_H
+#include "qtbc.h"
#include <stdio.h>
-#include <qstring.h>
#include <qfile.h>
-#if 0
-class Define
-{
- public:
- Define(const char *n) { name=n; }
- ~Define();
-
- private:
- QString name;
- QStrList args;
-};
-#endif
-
void initPreprocessor();
void addSearchDir(const char *dir);
void preprocessFile(const char *fileName,BufStr &output);
diff --git a/src/pre.l b/src/pre.l
index bc74cf1..6f5193a 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -25,8 +25,8 @@
#include <assert.h>
#include <ctype.h>
+#include "qtbc.h"
#include <qarray.h>
-#include <qstring.h>
#include <qstack.h>
#include <qfile.h>
#include <qstrlist.h>
@@ -55,7 +55,7 @@ struct FileState
int lineNr;
FILE *filePtr;
YY_BUFFER_STATE bufState;
- QString fileName;
+ QCString fileName;
};
/* -----------------------------------------------------------------
@@ -64,30 +64,30 @@ struct FileState
*/
static int yyLineNr = 1;
-static QString yyFileName;
+static QCString yyFileName;
static int ifcount = 0;
static QStrList *pathList = 0;
static QStack<FileState> includeStack;
static QDict<int> *argDict;
-static int defArgs = 0;
-static QString defName;
-static QString defText;
-static QString defArgsStr;
+static int defArgs = -1;
+static QCString defName;
+static QCString defText;
+static QCString defArgsStr;
static bool defVarArgs;
static int level;
static int lastCContext;
static int lastCPPContext;
static QArray<int> levelGuard;
-static QString guardExpr;
+static QCString guardExpr;
static BufStr *outputBuf;
-//static DefineCache *fileDefineCache;
static int roundCount;
-//static const Define *expandDefine;
static bool quoteArg;
static DefineDict *fileDefineDict;
static DefineDict *expandedDict;
static int findDefArgContext;
+static QCString lastGuardName;
+
static void incrLevel()
{
@@ -142,14 +142,14 @@ static FILE *findFile(const char *fileName)
char *s=pathList->first();
while (s)
{
- QString absName=(QString)s+"/"+fileName;
+ QCString absName=(QCString)s+"/"+fileName;
QFileInfo fi(absName);
if (fi.exists())
{
FILE *f;
- if (!inputFilter.isEmpty())
+ if (!Config::inputFilter.isEmpty())
{
- QString cmd = inputFilter+" "+absName;
+ QCString cmd = Config::inputFilter+" "+absName;
f=popen(cmd,"r");
if (!f) warn("Warning: could not execute filter %s\n",cmd.data());
}
@@ -171,14 +171,14 @@ static FILE *findFile(const char *fileName)
}
-static int getNextChar(const QString &expr,QString *rest,uint &pos);
-static int getCurrentChar(const QString &expr,QString *rest,uint pos);
-static void unputChar(const QString &expr,QString *rest,uint &pos,char c);
-static void expandExpression(QString &expr,QString *rest,int pos);
+static int getNextChar(const QCString &expr,QCString *rest,uint &pos);
+static int getCurrentChar(const QCString &expr,QCString *rest,uint pos);
+static void unputChar(const QCString &expr,QCString *rest,uint &pos,char c);
+static void expandExpression(QCString &expr,QCString *rest,int pos);
-static QString stringize(const QString &s)
+static QCString stringize(const QCString &s)
{
- QString result;
+ QCString result;
uint i=0;
bool inString=FALSE;
bool inChar=FALSE;
@@ -254,7 +254,7 @@ static QString stringize(const QString &s)
* marker (@-) then this is removed (before the concatenated macro name
* may be expanded again.
*/
-static void processConcatOperators(QString &expr)
+static void processConcatOperators(QCString &expr)
{
QRegExp r("[ \\t\\n]*##[ \\t\\n]*");
int l,n,i=0;
@@ -286,7 +286,7 @@ static void processConcatOperators(QString &expr)
* The replacement string will be returned in \a result and the
* length of the (unexpanded) argument list is stored in \a len.
*/
-static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &len,const Define *def,QString &result)
+static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result)
{
//printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),level);
//bool replaced=FALSE;
@@ -312,101 +312,113 @@ static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &
//while (j<expr.length() && expr.at(j)!='(') j++;
//j++; // skip opening paren
- QDict<QString> argTable; // list of arguments
+ QDict<QCString> argTable; // list of arguments
argTable.setAutoDelete(TRUE);
- QString arg;
+ QCString arg;
int argCount=0;
bool done=FALSE;
+
// FASE 1: read the macro arguments
- while ((argCount<def->nargs || def->varArgs) &&
- ((cc=getNextChar(expr,rest,j))!=EOF) && !done
- )
+ if (def->nargs==0)
+ {
+ while ((cc=getNextChar(expr,rest,j))!=EOF)
+ {
+ char c = (char)cc;
+ if (c==')') break;
+ }
+ }
+ else
{
- char c=(char)cc;
- if (c=='(') // argument is a function => search for matching )
+ while ((argCount<def->nargs || def->varArgs) &&
+ ((cc=getNextChar(expr,rest,j))!=EOF) && !done
+ )
{
- int level=1;
- arg+=c;
- char term='\0';
- while ((cc=getNextChar(expr,rest,j))!=EOF)
+ char c=(char)cc;
+ if (c=='(') // argument is a function => search for matching )
{
- char c=(char)cc;
- if (c=='\'' || c=='\"') // skip ('s and )'s inside strings
+ int level=1;
+ arg+=c;
+ char term='\0';
+ while ((cc=getNextChar(expr,rest,j))!=EOF)
{
- if (term!='\0')
- {
- if (c==term && expr.at(j-2)!='\\') term='\0';
- }
- else
- {
- term=c;
+ char c=(char)cc;
+ if (c=='\'' || c=='\"') // skip ('s and )'s inside strings
+ {
+ if (term!='\0')
+ {
+ if (c==term && expr.at(j-2)!='\\') term='\0';
+ }
+ else
+ {
+ term=c;
+ }
+ }
+ if (term=='\0' && c==')')
+ {
+ level--;
+ arg+=c;
+ if (level==0) break;
}
+ else if (term=='\0' && c=='(')
+ {
+ level++;
+ arg+=c;
+ }
+ else
+ arg+=c;
}
- if (term=='\0' && c==')')
+ }
+ else if (c==')' || c==',') // last or next argument found
+ {
+ if (c==',' && argCount==def->nargs-1 && def->varArgs)
{
- level--;
- arg+=c;
- if (level==0) break;
+ arg=arg.stripWhiteSpace();
+ arg+=',';
}
- else if (term=='\0' && c=='(')
+ else
{
- level++;
- arg+=c;
+ QCString argKey;
+ argKey.sprintf("@%d",argCount++); // key name
+ arg=arg.stripWhiteSpace();
+ // add argument to the lookup table
+ argTable.insert(argKey, new QCString(arg));
+ arg.resize(0);
+ if (c==')') // end of the argument list
+ {
+ done=TRUE;
+ }
}
- else
- arg+=c;
- }
- }
- else if (c==')' || c==',') // last or next argument found
- {
- if (c==',' && argCount==def->nargs-1 && def->varArgs)
- {
- arg=arg.stripWhiteSpace();
- arg+=',';
- }
- else
+ }
+ else if (c=='\"') // append literal strings
{
- QString argKey;
- argKey.sprintf("@%d",argCount++); // key name
- arg=arg.stripWhiteSpace();
- // add argument to the lookup table
- argTable.insert(argKey, new QString(arg));
- arg.resize(0);
- if (c==')') // end of the argument list
+ arg+=c;
+ char pc=c;
+ bool found=FALSE;
+ while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
{
- done=TRUE;
+ found = pc!='\\' && cc=='"';
+ c=(char)cc;
+ pc=c;
+ arg+=c;
}
}
- }
- else if (c=='\"') // append literal strings
- {
- arg+=c;
- char pc=c;
- bool found=FALSE;
- while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
+ else if (c=='\'') // append literal characters
{
- found = pc!='\\' && cc=='"';
- c=(char)cc;
- pc=c;
arg+=c;
- }
- }
- else if (c=='\'') // append literal characters
- {
- arg+=c;
- char pc=c;
- bool found=FALSE;
- while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
+ char pc=c;
+ bool found=FALSE;
+ while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
+ {
+ found = pc!='\\' && cc=='\'';
+ c=(char)cc;
+ pc=c;
+ arg+=c;
+ }
+ }
+ else // append other characters
{
- found = pc!='\\' && cc=='\'';
- c=(char)cc;
- pc=c;
arg+=c;
}
- }
- else // append other characters
- {
- arg+=c;
}
}
@@ -416,8 +428,8 @@ static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &
{
uint k=0;
// substitution of all formal arguments
- QString resExpr;
- const QString d=def->definition.stripWhiteSpace();
+ QCString resExpr;
+ const QCString d=def->definition.stripWhiteSpace();
bool inString=FALSE;
while (k<d.length())
{
@@ -435,8 +447,8 @@ static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &
}
else // argument marker => read the argument number
{
- QString key="@";
- QString *subst=0;
+ QCString key="@";
+ QCString *subst=0;
bool hash=FALSE;
int l=k-1;
// search for ## backward
@@ -457,7 +469,7 @@ static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &
//printf("request key %s result %s\n",key.data(),args[key]->data());
if (key.length()>1 && (subst=argTable[key]))
{
- QString substArg=*subst;
+ QCString substArg=*subst;
// only if no ## operator is before or after the argument
// marker we do macro expansion.
if (!hash) expandExpression(substArg,0,0);
@@ -506,7 +518,7 @@ static bool replaceFunctionMacro(const QString &expr,QString *rest,int pos,int &
* The position of the identifier is returned (or -1 if nothing is found)
* and \a l is its length. Any quoted strings are skipping during the search.
*/
-static int getNextId(const QString &expr,int p,int *l)
+static int getNextId(const QCString &expr,int p,int *l)
{
int n;
while (p<(int)expr.length())
@@ -541,11 +553,11 @@ static int getNextId(const QString &expr,int p,int *l)
* If \a expandAll is \c TRUE then all macros in the expression are
* expanded, otherwise only the first is expanded.
*/
-static void expandExpression(QString &expr,QString *rest,int pos)
+static void expandExpression(QCString &expr,QCString *rest,int pos)
{
//printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0);
- QString macroName;
- QString expMacro;
+ QCString macroName;
+ QCString expMacro;
int i=pos,l,p,len;
while ((p=getNextId(expr,i,&l))!=-1) // search for an macro name
{
@@ -558,7 +570,7 @@ static void expandExpression(QString &expr,QString *rest,int pos)
{
Define *def=isDefined(macroName);
//printf("name is not an expanded macro def=%s\n",def ? def->name.data() : 0);
- if (def && def->nargs==0) // simple macro
+ if (def && def->nargs==-1) // simple macro
{
// substitute the definition of the macro
expMacro=def->definition.stripWhiteSpace();
@@ -566,7 +578,7 @@ static void expandExpression(QString &expr,QString *rest,int pos)
len=l;
//printf("simple macro expansion=`%s'->`%s'\n",macroName.data(),expMacro.data());
}
- else if (def && def->nargs>0) // function macro
+ else if (def && def->nargs>=0) // function macro
{
replaced=replaceFunctionMacro(expr,rest,p+l,len,def,expMacro);
len+=l;
@@ -575,8 +587,8 @@ static void expandExpression(QString &expr,QString *rest,int pos)
if (replaced) // expand the macro and rescan the expression
{
//printf("replacing `%s'->`%s'\n",expr.mid(p,len).data(),expMacro.data());
- QString resultExpr=expMacro;
- QString restExpr=expr.right(expr.length()-len-p);
+ QCString resultExpr=expMacro;
+ QCString restExpr=expr.right(expr.length()-len-p);
processConcatOperators(resultExpr);
expandedDict->insert(macroName,def);
expandExpression(resultExpr,&restExpr,0);
@@ -612,13 +624,13 @@ static void expandExpression(QString &expr,QString *rest,int pos)
* \par assumption:
* \a s only contains pairs of @@'s.
*/
-QString removeIdsAndMarkers(const char *s)
+QCString removeIdsAndMarkers(const char *s)
{
//printf("removeIdsAndMarkers(%s)\n",s);
const char *p=s;
char c;
bool inNum=FALSE;
- QString result;
+ QCString result;
if (p)
{
while ((c=*p))
@@ -659,11 +671,11 @@ QString removeIdsAndMarkers(const char *s)
* \par assumption:
* \a s only contains pairs of @@'s
*/
-QString removeMarkers(const char *s)
+QCString removeMarkers(const char *s)
{
const char *p=s;
char c;
- QString result;
+ QCString result;
if (p)
{
while ((c=*p))
@@ -690,9 +702,9 @@ QString removeMarkers(const char *s)
* If needed the function may read additional characters from the input.
*/
-bool computeExpression(const QString &expr)
+bool computeExpression(const QCString &expr)
{
- QString e=expr;
+ QCString e=expr;
expandExpression(e,0,0);
e = removeIdsAndMarkers(e);
if (e.length()==0) return FALSE;
@@ -704,9 +716,9 @@ bool computeExpression(const QString &expr)
* If needed the function may read additional characters from the input
*/
-QString expandMacro(const QString &name)
+QCString expandMacro(const QCString &name)
{
- QString n=name;
+ QCString n=name;
expandExpression(n,0,0);
n=removeMarkers(n);
//printf("expandMacro `%s'->`%s'\n",name.data(),n.data());
@@ -761,9 +773,9 @@ static void outputArray(const char *a,int len)
if (includeStack.isEmpty()) outputBuf->addArray(a,len);
}
-static void readIncludeFile(const QString &inc)
+static void readIncludeFile(const QCString &inc)
{
- if (!searchIncludeFlag) return; // do not read include files
+ if (!Config::searchIncludeFlag) return; // do not read include files
uint i=0;
// find the start of the include file name
while (i<inc.length() &&
@@ -775,10 +787,10 @@ static void readIncludeFile(const QString &inc)
inc.at(i)!='"' && inc.at(i)!='>') i++;
if (s<inc.length() && i>s) // valid include file name found
{
- QString incFileName=inc.mid(s,i-s).stripWhiteSpace();
+ QCString incFileName=inc.mid(s,i-s).stripWhiteSpace();
FILE *f;
- QString oldFileName=yyFileName.copy();
+ QCString oldFileName=yyFileName.copy();
if ((f=findFile(incFileName))) // see if the include file can be found
{
#if SHOW_INCLUDES
@@ -815,6 +827,8 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
B [ \t]
BN [ \t\r\n]
+%option noyywrap
+
%x Start
%x Command
%x SkipCommand
@@ -822,7 +836,7 @@ BN [ \t\r\n]
%x CopyLine
%x Include
%x IncludeID
-%x DefineName
+%x DefName
%x DefineArg
%x DefineText
%x SkipCPPBlock
@@ -871,16 +885,27 @@ BN [ \t\r\n]
}
*/
<CopyLine>{ID}/{BN}*"(" {
+ Define *def;
+ //printf("Search for define %s\n",yytext);
if (includeStack.isEmpty() &&
- macroExpansionFlag &&
+ Config::macroExpansionFlag &&
/* (expandDefine=fileDefineCache->findDefine(yyFileName,yytext)) */
- fileDefineDict->find(yytext)
+ (def=fileDefineDict->find(yytext))
)
{
+ //printf("Found it!\n");
roundCount=0;
defArgsStr=yytext;
- findDefArgContext = CopyLine;
- BEGIN(FindDefineArgs);
+ if (def->nargs==-1) // no function macro
+ {
+ QCString result = expandMacro(defArgsStr);
+ outputArray(result,result.length());
+ }
+ else // zero or more arguments
+ {
+ findDefArgContext = CopyLine;
+ BEGIN(FindDefineArgs);
+ }
}
else
{
@@ -889,14 +914,16 @@ BN [ \t\r\n]
}
<CopyLine>{ID} {
Define *def=0;
+ //printf("Search for define %s\n",yytext);
if (includeStack.isEmpty() &&
- macroExpansionFlag &&
+ Config::macroExpansionFlag &&
(def=fileDefineDict->find(yytext)) &&
- def->nargs==0
+ def->nargs==-1
)
{
- QString name=yytext;
- QString result=expandMacro(name);
+ //printf("Found it!\n");
+ QCString name=yytext;
+ QCString result=expandMacro(name);
outputArray(result,result.length());
}
else
@@ -921,7 +948,7 @@ BN [ \t\r\n]
roundCount--;
if (roundCount==0)
{
- QString result=expandMacro(defArgsStr);
+ QCString result=expandMacro(defArgsStr);
if (findDefArgContext==CopyLine)
{
outputArray(result,result.length());
@@ -964,15 +991,15 @@ BN [ \t\r\n]
defArgsStr+=*yytext;
}
<Command>"include"{B}*/{ID} {
- if (macroExpansionFlag)
+ if (Config::macroExpansionFlag)
BEGIN(IncludeID);
}
<Command>"include"{B}*[<"] {
BEGIN(Include);
}
<Command>"define"{B}+ {
- //printf("!!!DefineName\n");
- BEGIN(DefineName);
+ //printf("!!!DefName\n");
+ BEGIN(DefName);
}
<Command>"ifdef"/{B}*"(" {
incrLevel();
@@ -1094,6 +1121,7 @@ BN [ \t\r\n]
guardExpr+=" 1L ";
else
guardExpr+=" 0L ";
+ lastGuardName=yytext;
BEGIN(Guard);
}
<DefinedExpr2>{ID} {
@@ -1101,6 +1129,7 @@ BN [ \t\r\n]
guardExpr+=" 1L ";
else
guardExpr+=" 0L ";
+ lastGuardName.resize(0);
}
<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
ifcount=0;
@@ -1133,11 +1162,12 @@ BN [ \t\r\n]
if (!otherCaseDone())
{
guardExpr.resize(0);
+ lastGuardName.resize(0);
BEGIN(Guard);
}
else
{
- BEGIN(Start);
+ BEGIN(SkipCPPBlock);
}
}
}
@@ -1184,9 +1214,9 @@ BN [ \t\r\n]
BEGIN(Start);
}
<Include>[^\">\n]+[\">] {
- QString incName=yytext;
+ QCString incName=yytext;
//int l=incName.length();
- //QString incFileName=incName.left(l-1);
+ //QCString incFileName=incName.left(l-1);
//if (fileDefineCache->fileCached(incFileName))
//{
// printf("file already cached!\n");
@@ -1197,7 +1227,7 @@ BN [ \t\r\n]
BEGIN(Start);
}
-<DefineName>{ID}/"(" {
+<DefName>{ID}/"(" {
//printf("Define() `%s'\n",yytext);
argDict = new QDict<int>(31);
argDict->setAutoDelete(TRUE);
@@ -1208,33 +1238,80 @@ BN [ \t\r\n]
defVarArgs = FALSE;
BEGIN(DefineArg);
}
-<DefineName>{ID}/{B}* {
+<DefName>{ID}/{B}* {
//printf("Define `%s'\n",yytext);
argDict = 0;
- defArgs = 0;
+ defArgs = -1;
defArgsStr.resize(0);
defText.resize(0);
defName = yytext;
defVarArgs = FALSE;
- QString tmp=(QString)"#define "+defName+defArgsStr;
+ QCString tmp=(QCString)"#define "+defName+defArgsStr;
outputArray(tmp.data(),tmp.length());
quoteArg=FALSE;
BEGIN(DefineText);
}
+<DefName>{ID}/{B}*"\n" {
+ argDict = 0;
+ defArgs = -1;
+ defName = yytext;
+ defArgsStr.resize(0);
+ defText.resize(0);
+ defVarArgs = FALSE;
+ if ( defName!=lastGuardName )
+ { // define may appear in the output
+ QCString tmp=(QCString)"#define "+defName+defArgsStr;
+ outputArray(tmp.data(),tmp.length());
+ quoteArg=FALSE;
+ BEGIN(DefineText);
+ }
+ else // define is a guard => hide
+ {
+ //printf("Found a guard %s\n",yytext);
+ Define *def=0;
+ //if (includeStack.isEmpty())
+ //{
+ // addDefine();
+ //}
+ if (!Config::onlyPredefinedFlag && (def=fileDefineDict->find(defName))==0)
+ {
+ fileDefineDict->insert(defName,newDefine());
+ }
+ else if (def)// name already exists
+ {
+ if (def->undef) // undefined name
+ {
+ def->undef = FALSE;
+ def->name = defName;
+ def->definition = defText.stripWhiteSpace();
+ def->nargs = defArgs;
+ def->fileName = yyFileName;
+ def->lineNr = yyLineNr;
+ }
+ else
+ {
+ //printf("Error: define %s is defined more than once!\n",defName.data());
+ }
+ }
+ outputChar('\n');
+ lastGuardName.resize(0);
+ BEGIN(Start);
+ }
+ }
<DefineArg>","{B}* { defArgsStr+=yytext; }
<DefineArg>"("{B}* { defArgsStr+=yytext; }
<DefineArg>")"{B}* {
defArgsStr+=yytext;
- QString tmp=(QString)"#define "+defName+defArgsStr;
+ QCString tmp=(QCString)"#define "+defName+defArgsStr;
outputArray(tmp.data(),tmp.length());
quoteArg=FALSE;
BEGIN(DefineText);
}
<DefineArg>{ID}("..."?) {
//printf("Define addArg(%s)\n",yytext);
- QString argName=yytext;
+ QCString argName=yytext;
defVarArgs = yytext[yyleng-1]=='.';
- if (defVarArgs)
+ if (defVarArgs) // strip ellipsis
argName=argName.left(argName.length()-3);
defArgsStr+=yytext;
argDict->insert(argName,new int(defArgs));
@@ -1301,14 +1378,6 @@ BN [ \t\r\n]
quoteArg=TRUE;
}
<DefineText>{ID} {
- //bool quote=FALSE;
- //char *p=yytext;
- //if (p[0]=='#')
- //{
- // p++;
- // quote=TRUE;
- // defText+="\"";
- //}
if (quoteArg)
{
defText+="\"";
@@ -1320,7 +1389,7 @@ BN [ \t\r\n]
{
if (!quoteArg) defText+=' ';
defText+='@';
- QString numStr;
+ QCString numStr;
numStr.setNum(*n);
defText+=numStr;
if (!quoteArg) defText+=' ';
@@ -1348,16 +1417,14 @@ BN [ \t\r\n]
outputChar('\n');
Define *def=0;
//printf("Define name=`%s' text=`%s'\n",defName.data(),defText.data());
- if (includeStack.isEmpty()) addDefine();
- if (!onlyPredefinedFlag && (def=fileDefineDict->find(defName))==0)
+ if (includeStack.isEmpty())
+ {
+ addDefine();
+ }
+ if (!Config::onlyPredefinedFlag && (def=fileDefineDict->find(defName))==0)
{
fileDefineDict->insert(defName,newDefine());
}
- //if ((def=fileDefineCache->findDefine(yyFileName,defName))==0)
- //{
- // printf("define is not found\n");
- // fileDefineCache->insertDefine(yyFileName,defName,newDefine());
- //}
else if (def)// name already exists
{
//printf("define found\n");
@@ -1377,6 +1444,7 @@ BN [ \t\r\n]
}
delete argDict;
yyLineNr++;
+ lastGuardName.resize(0);
BEGIN(Start);
}
<DefineText>{B}* { defText += ' '; }
@@ -1411,7 +1479,7 @@ BN [ \t\r\n]
{
FileState *fs=includeStack.pop();
//fileDefineCache->merge(yyFileName,fs->fileName);
- if (inputFilter.isEmpty())
+ if (Config::inputFilter.isEmpty())
fclose(fs->filePtr);
else
pclose(fs->filePtr);
@@ -1447,7 +1515,7 @@ BN [ \t\r\n]
/*@ ----------------------------------------------------------------------------
*/
-static int getNextChar(const QString &expr,QString *rest,uint &pos)
+static int getNextChar(const QCString &expr,QCString *rest,uint &pos)
{
//printf("getNextChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos);
if (pos<expr.length())
@@ -1470,7 +1538,7 @@ static int getNextChar(const QString &expr,QString *rest,uint &pos)
}
}
-static int getCurrentChar(const QString &expr,QString *rest,uint pos)
+static int getCurrentChar(const QCString &expr,QCString *rest,uint pos)
{
//printf("getCurrentChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos);
if (pos<expr.length())
@@ -1492,7 +1560,7 @@ static int getCurrentChar(const QString &expr,QString *rest,uint pos)
}
}
-static void unputChar(const QString &expr,QString *rest,uint &pos,char c)
+static void unputChar(const QCString &expr,QCString *rest,uint &pos,char c)
{
//printf("unputChar(%s,%s,%d,%c)\n",expr.data(),rest ? rest->data() : 0,pos,c);
if (pos<expr.length())
@@ -1554,37 +1622,92 @@ void preprocessFile(const char *fileName,BufStr &output)
expandedDict->clear();
// add predefined macros
- char *defStr = predefined.first();
+ char *defStr = Config::predefined.first();
while (defStr)
{
- QString ds = defStr;
- int i;
- if ((i=ds.find('='))==-1)
+ QCString ds = defStr;
+ int i_equals=ds.find('=');
+ int i_obrace=ds.find('(');
+ int i_cbrace=ds.find(')');
+
+ if (i_obrace==0) continue; // no define name
+
+ if (i_obrace<i_equals && i_cbrace<i_equals &&
+ i_obrace!=-1 && i_cbrace!=-1 &&
+ i_obrace<i_cbrace
+ ) // predefined function macro definition
{
- if (ds.length()>0)
- {
- Define *def = new Define;
- def->name = ds;
- def->definition = "1";
- def->nargs = 0;
- fileDefineDict->insert(ds,def);
+ QRegExp reId("[a-z_A-Z][a-z_A-Z0-9]*"); // regexp matching an id
+ QDict<int> argDict(17);
+ argDict.setAutoDelete(TRUE);
+ int i=i_obrace+1,p,l,count=0;
+ // gather the formal arguments in a dictionary
+ while (i<i_cbrace && (p=reId.match(ds,i,&l)))
+ {
+ argDict.insert(ds.mid(p,l),new int(count++));
+ i=p+l;
+ }
+ // strip definition part
+ QCString tmp=ds.right(ds.length()-i_equals-1);
+ QCString definition;
+ i=0;
+ // substitute all occurrences of formal arguments by their
+ // corresponding markers
+ while ((p=reId.match(tmp,i,&l))!=-1)
+ {
+ if (p>i) definition+=tmp.mid(i,p-i);
+ int *argIndex;
+ if ((argIndex=argDict[tmp.mid(p,l)])!=0)
+ {
+ QCString marker;
+ marker.sprintf(" @%d ",*argIndex);
+ definition+=marker;
+ }
+ else
+ {
+ definition+=tmp.mid(p,l);
+ }
+ i=p+l;
}
+ if (i<(int)tmp.length()) definition+=tmp.mid(i,tmp.length()-i);
+
+ // add define definition to the dictionary of defines for this file
+ Define *def = new Define;
+ def->name = ds.left(i_obrace);
+ def->definition = definition;
+ def->nargs = count;
+ fileDefineDict->insert(def->name,def);
+
+ //printf("#define `%s' `%s' #nargs=%d\n",
+ // def->name.data(),def->definition.data(),def->nargs);
}
- else
+ else if ((i_obrace==-1 || i_obrace>i_equals) &&
+ (i_cbrace==-1 || i_cbrace>i_equals) &&
+ ds.length()>0 && (int)ds.length()>i_equals
+ ) // predefined non-function macro definition
{
- if (i>0 && (int)ds.length()>i)
+ Define *def = new Define;
+ if (i_equals==-1) // simple define without argument
+ {
+ def->name = ds;
+ def->definition = "1"; // substitute occurrences by 1 (true)
+ }
+ else // simple define with argument
{
- Define *def = new Define;
- def->name = ds.left(i);
- def->definition = ds.right(ds.length()-i-1);
- def->nargs = 0;
- fileDefineDict->insert(ds.left(i),def);
- }
+ def->name = ds.left(i_equals);
+ def->definition = ds.right(ds.length()-i_equals-1);
+ }
+ def->nargs = -1;
+ fileDefineDict->insert(def->name,def);
+
+ //printf("#define `%s' `%s' #nargs=%d\n",
+ // def->name.data(),def->definition.data(),def->nargs);
}
- defStr=predefined.next();
+
+ defStr=Config::predefined.next();
}
- if (inputFilter.isEmpty())
+ if (Config::inputFilter.isEmpty())
{
preYYin = fopen(fileName,"r");
if (!preYYin)
@@ -1595,7 +1718,7 @@ void preprocessFile(const char *fileName,BufStr &output)
}
else
{
- QString cmd = inputFilter+" "+fileName;
+ QCString cmd = Config::inputFilter+" "+fileName;
preYYin = popen(cmd,"r");
if (!preYYin)
{
@@ -1605,10 +1728,15 @@ void preprocessFile(const char *fileName,BufStr &output)
}
yyLineNr = 1;
level = 0;
+ ifcount = 0;
yyFileName = fileName;
BEGIN( Start );
+
+ lastGuardName.resize(0);
+ guardExpr.resize(0);
+
preYYlex();
- if (inputFilter.isEmpty())
+ if (Config::inputFilter.isEmpty())
fclose(preYYin);
else
pclose(preYYin);
@@ -1629,8 +1757,7 @@ void preprocessFile(const char *fileName,BufStr &output)
#endif
}
-
extern "C" { // some bogus code to keep the compiler happy
- int preYYwrap() { return 1 ; }
+// int preYYwrap() { return 1 ; }
void preYYdummy() { yy_flex_realloc(0,0); }
}
diff --git a/src/qtbc.h b/src/qtbc.h
new file mode 100644
index 0000000..2049fdd
--- /dev/null
+++ b/src/qtbc.h
@@ -0,0 +1,42 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ */
+
+#ifndef QTBC_H
+#define QTBC_H
+
+/*! This file contains some hacks to make Doxygen work with
+ * Qt version 2.00 and Qt version 1.xx
+ */
+
+#include <qglobal.h>
+
+#if QT_VERSION >= 200
+
+#define GCI QCollection::Item
+
+#include <qcstring.h>
+#include <qstring.h>
+inline QCString convertToQCString(const QString &s) { return s.local8Bit(); }
+
+#else /* QT_VERSION < 200 */
+
+#include <qstring.h>
+#define QCString QString
+inline QCString convertToQCString(const QCString &s) { return s; }
+
+#endif
+
+#endif
diff --git a/src/scanner.h b/src/scanner.h
index acebd5f..1e6bad7 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -17,9 +17,9 @@
#ifndef SCANNER_H
#define SCANNER_H
+#include "qtbc.h"
#include <stdio.h>
#include <qlist.h>
-#include <qstring.h>
#include "entry.h"
#include "code.h"
@@ -28,8 +28,8 @@ class OutputList;
extern void parseMain(Entry *);
extern void parseDoc(OutputList &ol,const char *clName, const char *memName,
- const QString &docString);
-extern void parseExample(OutputList &ol,const QString &docString,
+ const QCString &docString);
+extern void parseExample(OutputList &ol,const QCString &docString,
const char *fileName);
-extern void parseText(OutputList &ol,const QString &txtString);
+extern void parseText(OutputList &ol,const QCString &txtString);
#endif
diff --git a/src/scanner.l b/src/scanner.l
index 9737ff1..9c7b477 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -25,8 +25,8 @@
#include <assert.h>
#include <ctype.h>
+#include "qtbc.h"
#include <qarray.h>
-#include <qstring.h>
#include <qstack.h>
#include <qregexp.h>
@@ -51,14 +51,14 @@
* statics
*/
static bool insideArgumentList;
-static QString className;
-static QString memberName;
-static QString refName;
+static QCString className;
+static QCString memberName;
+static QCString refName;
static OutputList * outDoc;
-static QString code;
-static QString linkRef;
-static QString linkText;
-static QString codeBlock;
+static QCString code;
+static QCString linkRef;
+static QCString linkText;
+static QCString codeBlock;
static const char * inputString;
static int inputPosition;
static int lastContext;
@@ -78,6 +78,7 @@ static int lastGroupContext;
static int lastFormulaContext;
static int lastAnchorContext;
static int nextDefContext;
+static int overloadContext;
static Protection protection;
static Protection baseProt;
static int bracketCount = 0 ;
@@ -87,6 +88,8 @@ static int ifCount = 0 ;
static Entry* current_root = 0 ;
static Entry* global_root = 0 ;
static Entry* current = 0 ;
+static Entry* previous = 0 ;
+static Entry* tempEntry = 0 ;
static int yyLineNr = 0 ;
static int anonCount = 0 ;
static char yyFileName[2048] ;
@@ -97,10 +100,10 @@ static bool removeSlashes;
static Specifier virt;
static Specifier baseVirt;
static bool exampleDoc;
-static QString exampleName;
-static QString htmlUrl,htmlText;
-static QString currentIncludeFile;
-static QString msType,msName,msArgs;
+static QCString exampleName;
+static QCString htmlUrl,htmlText;
+static QCString currentIncludeFile;
+static QCString msType,msName,msArgs;
static int includeFileOffset = 0;
static int includeFileLength = 0;
static bool firstLine;
@@ -119,16 +122,16 @@ static bool firstSeeArg;
static bool javaDocSee;
static char afterDocTerminator;
static int tmpDocType;
-static QString sectionLabel;
-static QString sectionTitle;
+static QCString sectionLabel;
+static QCString sectionTitle;
static SectionInfo::SectionType
sectionType;
-static QString funcPtrType;
-static QString templateStr;
-static QString baseName;
-static QString *specName;
-static QString formulaText;
-static QString sectionRef;
+static QCString funcPtrType;
+static QCString templateStr;
+static QCString baseName;
+static QCString *specName;
+static QCString formulaText;
+static QCString sectionRef;
// state variable for reading the argument list of a function
static int argRoundCount;
@@ -136,7 +139,7 @@ static int argSharpCount;
static int currentArgumentContext;
static int lastCopyArgStringContext;
static int lastCopyArgContext;
-static QString *copyArgString;
+static QCString *copyArgString;
@@ -404,9 +407,9 @@ static void verbIncludeFile(OutputList &ol,const char *name)
}
-static QString stripQuotes(const char *s)
+static QCString stripQuotes(const char *s)
{
- QString name;
+ QCString name;
if (s==0 || *s==0) return name;
name=s;
if (name.at(0)=='"' && name.at(name.length()-1)=='"')
@@ -416,9 +419,9 @@ static QString stripQuotes(const char *s)
return name;
}
-static QString stripKnownExtensions(const char *text)
+static QCString stripKnownExtensions(const char *text)
{
- QString result=text;
+ QCString result=text;
if (result.right(4)==".tex") result=result.left(result.length()-4);
else if (result.right(5)==".html") result=result.left(result.length()-5);
//printf("%s stripKnowExtensions(%s)\n",result.data(),text);
@@ -430,7 +433,7 @@ static void skipLine(OutputList &ol,const char *key)
bool found=FALSE;
while (!found)
{
- QString s;
+ QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
@@ -451,7 +454,7 @@ static void skipUntil(const char *key)
bool found=FALSE;
while (!found)
{
- QString s;
+ QCString s;
int i=includeFileOffset;
char c;
while ( i<includeFileLength &&
@@ -470,7 +473,7 @@ static void skipUntil(const char *key)
static void showLine(OutputList &ol,const char *key)
{
- QString s;
+ QCString s;
char c;
bool found=FALSE;
while (!found)
@@ -494,7 +497,7 @@ static void showUntil(OutputList &ol,const char *key)
bool found=FALSE;
while (!found)
{
- QString s;
+ QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
@@ -537,8 +540,9 @@ static void addSection()
if (sectionDict[sectionLabel]==0)
{
SectionInfo *si=new SectionInfo(sectionLabel,sectionTitle,sectionType);
+ //printf("Adding section addr=%p label=`%s' sectionTitle=`%s' fileName=%s\n",si,sectionLabel.data(),sectionTitle.data(),si->fileName.data());
sectionDict.insert(sectionLabel,si);
- current->anchors->append(new QString(sectionLabel));
+ current->anchors->append(new QCString(sectionLabel));
}
else
{
@@ -548,10 +552,10 @@ static void addSection()
// Adds a formula text to the list/dictionary of formulas if it was
// not already added. Returns the label of the formula.
-static QString addFormula()
+static QCString addFormula()
{
- QString formLabel;
- QString fText=formulaText.simplifyWhiteSpace();
+ QCString formLabel;
+ QCString fText=formulaText.simplifyWhiteSpace();
Formula *f=0;
if ((f=formulaDict[fText])==0)
{
@@ -568,8 +572,17 @@ static QString addFormula()
return formLabel;
}
-/* -----------------------------------------------------------------
- */
+static bool nameIsOperator(QCString &name)
+{
+ return name.right(8)=="operator" &&
+ (name.length()==8 || !isId(name.at(name.length()-9)));
+}
+
+/* ----------------------------------------------------------------- */
+
+static void addToBody(const char *text);
+static void addToBodyCond(const char *text);
+/* ----------------------------------------------------------------- */
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
@@ -641,6 +654,8 @@ TT [tT][tT]
UL [uU][lL]
VAR [vV][aA][rR]
+%option noyywrap
+
%x Define
%x DefineArg
%x DefineEnd
@@ -664,13 +679,15 @@ VAR [vV][aA][rR]
%x NameSpaceDocArg1
%x SkipCurly
%x SkipCurlyCpp
+%x SkipCurlyEndDoc
%x SkipString
%x SkipInits
%x SkipCPP
%x SkipCPPBlock
%x SkipComment
%x SkipCxxComment
-%x SkipBlock
+%x SkipCurlyBlock
+%x SkipRoundBlock
%x SkipCode
%x Sharp
%x SkipSharp
@@ -688,6 +705,7 @@ VAR [vV][aA][rR]
%x ClassDocFunc
%x ClassDocFuncPtr
%x ClassDocFuncQual
+%x ClassDocFuncSkipLine
%x ClassDocFuncExc
%x ClassDocDefine
%x ClassDocRelates
@@ -818,7 +836,7 @@ VAR [vV][aA][rR]
<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); }
<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); }
<DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" {
- QString envvar=&yytext[2];
+ QCString envvar=&yytext[2];
envvar=envvar.left(envvar.length()-1);
outDoc->docify(getenv(envvar));
}
@@ -879,7 +897,7 @@ VAR [vV][aA][rR]
outDoc->codify(c);
}
<DocScan>("\\"|"@")"internal"/{BN} {
- if (!internalDocsFlag)
+ if (!Config::internalDocsFlag)
{
outDoc->newParagraph();
scanString(theTranslator->trForInternalUseOnly()+"\n");
@@ -921,7 +939,7 @@ VAR [vV][aA][rR]
Formula *formula=formulaNameDict[yytext];
if (formula)
{
- QString formName;
+ QCString formName;
formName.sprintf("form-%d.gif",formula->getId());
outDoc->writeFormula(formName,formula->getFormulaText());
}
@@ -952,7 +970,7 @@ VAR [vV][aA][rR]
inParBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
- outDoc->docify(((QString)yytext).stripWhiteSpace());
+ outDoc->docify(((QCString)yytext).stripWhiteSpace());
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
@@ -1137,7 +1155,7 @@ VAR [vV][aA][rR]
BEGIN(DocScan);
}
<DocScan>"\\section "{ID}"\n" {
- QString secName=&yytext[9]; // skip "\section "
+ QCString secName=&yytext[9]; // skip "\section "
secName=secName.left(secName.length()-1); // remove \n
//printf("SectionName %s found\n",secName.data());
SectionInfo *sec;
@@ -1149,7 +1167,7 @@ VAR [vV][aA][rR]
}
}
<DocScan>"\\anchor "{ID}"\n" {
- QString secName=&yytext[8];
+ QCString secName=&yytext[8];
secName=secName.left(secName.length()-1);
SectionInfo *sec;
if ((sec=sectionDict[secName]))
@@ -1164,11 +1182,11 @@ VAR [vV][aA][rR]
BEGIN(DocRefItem);
}
<DocRefName>{ID} {
- QString ref=yytext;
+ QCString ref=yytext;
SectionInfo *sec;
if ((sec=sectionDict[ref]))
{
- QString text;
+ QCString text;
if (sec->title.isEmpty())
text=sec->label;
else
@@ -1179,6 +1197,7 @@ VAR [vV][aA][rR]
}
else
{
+ //printf(" ref sec=%p sec->fileName=%s\n",sec,sec->fileName.data());
outDoc->writeSectionRef(sec->fileName,sec->label,text);
}
}
@@ -1198,7 +1217,7 @@ VAR [vV][aA][rR]
}
<DocRefArg>[^\"\n]+[\n\"] {
yytext[yyleng-1]='\0';
- QString text=substitute(yytext,"\\\\","\\");
+ QCString text=substitute(yytext,"\\\\","\\");
SectionInfo *sec;
if ((sec=sectionDict[sectionRef]))
{
@@ -1250,13 +1269,13 @@ VAR [vV][aA][rR]
<DocScan>{SCOPEMASK}(("()")?) {
generateRef(*outDoc,className,yytext,inSeeBlock);
}
-<DocScan>({SCOPEMASK}"::")?"operator"[^(\r\n.,]*"("[a-z_A-Z,\<\> \t\*\&]*")" {
- QString oName=yytext;
+<DocScan>({SCOPEMASK}"::")?"operator()("[a-z_A-Z,\<\> \t\*\&]*")" {
+ QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
}
-<DocScan>({SCOPEMASK}"::")?"operator()("[a-z_A-Z,\<\> \t\*\&]*")" {
- QString oName=yytext;
+<DocScan>({SCOPEMASK}"::")?"operator"[^(\r\n.,]*"("[a-z_A-Z,\<\> \t\*\&]*")" {
+ QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
}
@@ -1532,9 +1551,28 @@ VAR [vV][aA][rR]
<DocCode,DocEmphasis,DocBold,DocScan,Text>. {
outDoc->writeChar(*yytext);
}
-<NextSemi>"{" { BEGIN(SkipBlock); }
-<SkipBlock>"{" { ++bracketCount ; }
-<SkipBlock>"}" { if( bracketCount )
+<NextSemi>"{" {
+ bracketCount=0;
+ BEGIN(SkipCurlyBlock);
+ }
+<NextSemi>"(" {
+ roundCount=0;
+ BEGIN(SkipRoundBlock);
+ }
+<SkipRoundBlock>"(" {
+ ++roundCount;
+ }
+<SkipRoundBlock>")" {
+ if (roundCount )
+ --roundCount ;
+ else
+ BEGIN( NextSemi ) ;
+ }
+<SkipCurlyBlock>"{" {
+ ++bracketCount ;
+ }
+<SkipCurlyBlock>"}" {
+ if( bracketCount )
--bracketCount ;
else
BEGIN( NextSemi ) ;
@@ -1653,7 +1691,7 @@ VAR [vV][aA][rR]
BEGIN( ClassName );
}
<FindMembers>{B}*(("typedef"{BN}+)?)"class"{BN}+ {
- isTypedef=((QString)yytext).find("typedef")!=-1;
+ isTypedef=((QCString)yytext).find("typedef")!=-1;
current->section = Entry::CLASS_SEC ;
addType( current ) ;
current->type += " class" ;
@@ -1663,7 +1701,7 @@ VAR [vV][aA][rR]
BEGIN( ClassName ) ;
}
<FindMembers>{B}*(("typedef"{BN}+)?)"struct"{BN}+ {
- isTypedef=((QString)yytext).find("typedef")!=-1;
+ isTypedef=((QCString)yytext).find("typedef")!=-1;
current->section = Entry::STRUCT_SEC ;
addType( current ) ;
current->type += " struct" ;
@@ -1673,7 +1711,7 @@ VAR [vV][aA][rR]
BEGIN( ClassName ) ;
}
<FindMembers>{B}*(("typedef"{BN}+)?)"union"{BN}+ {
- isTypedef=((QString)yytext).find("typedef")!=-1;
+ isTypedef=((QCString)yytext).find("typedef")!=-1;
current->section = Entry::UNION_SEC ;
addType( current ) ;
current->type += " union" ;
@@ -1683,7 +1721,7 @@ VAR [vV][aA][rR]
BEGIN( ClassName ) ;
}
<FindMembers>{B}*(("typedef"{BN}+)?)"enum"{BN}+ {
- isTypedef=((QString)yytext).find("typedef")!=-1;
+ isTypedef=((QCString)yytext).find("typedef")!=-1;
current->section = Entry::ENUM_SEC ;
addType( current ) ;
current->type += " enum" ;
@@ -1751,7 +1789,7 @@ VAR [vV][aA][rR]
<FindMembers>"using"{BN}+ { lineCount(); BEGIN(Using); }
<Using>";" { BEGIN(FindMembers); }
<FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl
- QString n=yytext;
+ QCString n=yytext;
addType( current );
current->name=n.left(n.length()-2);
}
@@ -1761,7 +1799,7 @@ VAR [vV][aA][rR]
addType( current );
current->name=yytext;
current->name=current->name.stripWhiteSpace();
- if (current->name.right(8)=="operator")
+ if (nameIsOperator(current->name))
BEGIN( Operator );
else
BEGIN( EndTemplate );
@@ -1813,7 +1851,7 @@ VAR [vV][aA][rR]
{
current->name += yytext;
}
- QString tmp=yytext;
+ QCString tmp=yytext;
if (tmp.right(8)=="operator")
BEGIN( Operator );
else
@@ -1868,7 +1906,7 @@ VAR [vV][aA][rR]
<DefineEnd>.
<FindMembers>[*&]+ { current->name += yytext ; }
-<FindMembers,MemberSpec,Function,NextSemi>";"{BN}*("/**"|"//!"|"/*!")"<" {
+<FindMembers,MemberSpec,Function,NextSemi>";"{BN}*("/**"|"//!"|"/*!"|"///")"<" {
lineCount();
current->doc.resize(0);
current->brief.resize(0);
@@ -1876,12 +1914,12 @@ VAR [vV][aA][rR]
afterDocTerminator = ';';
if (yytext[yyleng-3]=='/')
BEGIN(AfterDocLine);
- else if (yytext[yyleng-2]=='*')
+ else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag)
BEGIN(AfterDocBrief);
else
BEGIN(AfterDoc);
}
-<MemberSpec,FindFields,FindMembers,NextSemi>","{BN}*("/**"|"//!"|"/*!")"<" {
+<MemberSpec,FindFields,FindMembers,NextSemi>","{BN}*("/**"|"//!"|"/*!"|"///")"<" {
lineCount();
current->doc.resize(0);
current->brief.resize(0);
@@ -1889,12 +1927,12 @@ VAR [vV][aA][rR]
afterDocTerminator = ',';
if (yytext[yyleng-3]=='/')
BEGIN(AfterDocLine);
- else if (yytext[yyleng-2]=='*')
+ else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag)
BEGIN(AfterDocBrief);
else
BEGIN(AfterDoc);
}
-<DefineEnd,FindFields,FindFieldArg>{BN}*("/**"|"//!"|"/*!")"<" {
+<DefineEnd,FindFields,FindFieldArg>{BN}*("/**"|"//!"|"/*!"|"///")"<" {
lineCount();
current->doc.resize(0);
current->brief.resize(0);
@@ -1905,7 +1943,7 @@ VAR [vV][aA][rR]
afterDocTerminator = 0;
if (yytext[yyleng-3]=='/')
BEGIN(AfterDocLine);
- else if (yytext[yyleng-2]=='*')
+ else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag)
BEGIN(AfterDocBrief);
else
BEGIN(AfterDoc);
@@ -1914,8 +1952,10 @@ VAR [vV][aA][rR]
BEGIN(NextSemi);
}
<FindMembers>[:;,] {
- QString oldType = current->type.copy();
- QString oldDocs = current->doc.copy();
+ QCString oldType = current->type.copy();
+ QCString oldDocs = current->doc.copy();
+ if ( *yytext != ':')
+ {
current->type=current->type.simplifyWhiteSpace();
current->args=current->args.simplifyWhiteSpace();
current->name=current->name.stripWhiteSpace();
@@ -1931,9 +1971,12 @@ VAR [vV][aA][rR]
current->sig = sig = FALSE;
current->virt = Normal;
current->stat = gstat;
+ }
// skip expression or bitfield if needed
if ( *yytext == ':')
+ {
BEGIN( NextSemi );
+ }
else
{
if ( *yytext == ',' )
@@ -2004,7 +2047,7 @@ VAR [vV][aA][rR]
current->slot = slot;
}
<FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); }
-<Curly>[^\r\n{}"/]* { current->program += yytext ; }
+<Curly>[^\r\n{}"'/]* { current->program += yytext ; }
<Curly>"//".* { current->program += yytext ; }
<Curly>\"[^\r\n"]*\" { current->program += yytext ; }
<Curly>"/*"{B}* { current->program += yytext ;
@@ -2016,6 +2059,9 @@ VAR [vV][aA][rR]
lastContext = Curly ;
BEGIN( Comment ) ;
}
+<Curly>"'"\\[0-7]{1,3}"'" { current->program += yytext; }
+<Curly>"'"\\."'" { current->program += yytext; }
+<Curly>"'"."'" { current->program += yytext; }
<Curly>"{" { current->program += yytext ;
++bracketCount ;
}
@@ -2026,16 +2072,15 @@ VAR [vV][aA][rR]
}
else
{
- QString &cn = current->name;
- QString &rn = current_root->name;
- //printf("current->name=`%s' current_root->name=`%s'\n",
- // cn.data(),rn.data());
- if (cn && cn[0]!='@' &&
+ QCString &cn = current->name;
+ QCString rn = stripAnnonymousScope(current_root->name);
+ //printf("cn=`%s' rn=`%s'\n",cn.data(),rn.data());
+ if (!cn.isEmpty() && !rn.isEmpty() &&
(current_root->section & Entry::SCOPE_MASK))
{
cn.prepend(rn+"::");
}
- if (isTypedef && cn.length()==0)
+ if (isTypedef && cn.isEmpty())
{
//printf("Typedef Name\n");
BEGIN( TypedefName );
@@ -2150,6 +2195,7 @@ VAR [vV][aA][rR]
<MemberSpecSkip>"{" {
bracketCount=0;
lastCurlyContext = MemberSpecSkip;
+ previous = current;
BEGIN(SkipCurly);
}
<MemberSpecSkip>"," { BEGIN(MemberSpec); }
@@ -2392,8 +2438,8 @@ VAR [vV][aA][rR]
current->name=current->name.simplifyWhiteSpace();
current->type=current->type.simplifyWhiteSpace();
current->args=current->args.simplifyWhiteSpace();
- QString &cn=current->name;
- QString &rn=current_root->name;
+ QCString &cn=current->name;
+ QCString &rn=current_root->name;
//printf("current_root->name=`%s'\n",rn.data());
//printf("Function: `%s' `%s' `%s'\n",current->type.data(),cn.data(),current->args.data());
int i;
@@ -2415,7 +2461,7 @@ VAR [vV][aA][rR]
if (*yytext!=';' || (current_root->section&Entry::SCOPE_MASK) )
{
int tempArg=current->name.find('<');
- QString tempName;
+ QCString tempName;
if (tempArg==-1)
tempName=current->name;
else
@@ -2437,7 +2483,7 @@ VAR [vV][aA][rR]
else // a global function prototype or function variable
{
//printf("Scanner.l: prototype? type=`%s' name=`%s' args=`%s'\n",current->type.data(),current->name.data(),current->args.data());
- QRegExp re("([^)])");
+ QRegExp re("([^)]*)");
if (!current->type.isNull() && current->type.find(re,0)!=-1)
{
//printf("Scanner.l: found function variable!\n");
@@ -2450,6 +2496,7 @@ VAR [vV][aA][rR]
current->proto = TRUE;
}
}
+ previous = current;
current_root->addSubEntry(current);
current = new Entry ;
current->protection = protection;
@@ -2459,46 +2506,127 @@ VAR [vV][aA][rR]
current->slot = slot;
lastCurlyContext = FindMembers;
if( *yytext == '{' )
- BEGIN( SkipCurly ) ;
+ {
+ addToBody(yytext);
+ BEGIN( SkipCurly ) ;
+ }
else if( *yytext == ':' )
- BEGIN( SkipInits ) ;
+ {
+ addToBody(yytext);
+ BEGIN( SkipInits ) ;
+ }
else
- BEGIN( FindMembers ) ;
+ BEGIN( FindMembers ) ;
}
<SkipInits>"{" {
+ addToBody(yytext);
lastCurlyContext = FindMembers;
BEGIN( SkipCurly ) ;
}
-<SkipCurly,SkipCurlyCpp>"{" { ++bracketCount ; }
-<SkipCurly,SkipCurlyCpp>"}" { if( bracketCount )
+<SkipCurly>"{" {
+ addToBody(yytext);
+ ++bracketCount ;
+ }
+<SkipCurly>"}" {
+ addToBody(yytext);
+ if( bracketCount )
--bracketCount ;
else
- //BEGIN( FindMembers ) ;
BEGIN( lastCurlyContext ) ;
}
-<SkipCurly>"'"\\[0-7]{1,3}"'"
-<SkipCurly>"'"\\."'"
-<SkipCurly>"'"."'"
+<SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" {
+ if ( bracketCount )
+ {
+ addToBody(yytext);
+ --bracketCount ;
+ }
+ else
+ {
+ lineCount();
+ tempEntry = current; // temporarily switch to the previous entry
+ current = previous;
+ current->doc.resize(0);
+ current->brief.resize(0);
+ lastAfterDocContext = SkipCurlyEndDoc;
+ afterDocTerminator = '}';
+ if (yytext[yyleng-3]=='/')
+ BEGIN(AfterDocLine);
+ else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag)
+ BEGIN(AfterDocBrief);
+ else
+ BEGIN(AfterDoc);
+ }
+ }
+<SkipCurlyEndDoc>"}" {
+ addToBody("}");
+ current = tempEntry;
+ BEGIN( lastCurlyContext );
+ }
+<SkipCurly>"'"\\[0-7]{1,3}"'" {
+ addToBody(yytext);
+ }
+<SkipCurly>"'"\\."'" {
+ addToBody(yytext);
+ }
+<SkipCurly>"'"."'" {
+ addToBody(yytext);
+ }
<SkipCurly>\" {
+ addToBody(yytext);
lastStringContext=SkipCurly;
BEGIN( SkipString );
}
-<SkipCurly>^{B}*"#" { BEGIN( SkipCurlyCpp ); }
-<SkipCurlyCpp>\n { yyLineNr++;
+<SkipCurly>^{B}*"#" {
+ addToBody(yytext);
+ BEGIN( SkipCurlyCpp );
+ }
+<SkipCurly,SkipInits>\n {
+ yyLineNr++;
+ addToBody(yytext);
+ }
+<SkipCurly,SkipCurlyCpp>. {
+ addToBody(yytext);
+ }
+<SkipCurlyCpp>\n {
+ addToBody(yytext);
+ yyLineNr++;
lastCurlyContext = FindMembers;
BEGIN( SkipCurly );
}
-<SkipCurlyCpp>\\[\r]*"\n"[\r]* { yyLineNr++; }
-<SkipCurlyCpp>"/*"
-<SkipCurlyCpp>"*/"
-<SkipCurlyCpp>"//"
-<SkipString>\\.
-<SkipString>\" { BEGIN( lastStringContext ); }
-<SkipString>"/*"
-<SkipString>"*/"
-<SkipString>"//"
-
+<SkipCurlyCpp>\\[\r]*"\n"[\r]* {
+ addToBody(yytext);
+ yyLineNr++;
+ }
+<SkipInits,SkipCurly,SkipCurlyCpp>"/*" {
+ addToBody(yytext);
+ }
+<SkipInits,SkipCurly,SkipCurlyCpp>"*/" {
+ addToBody(yytext);
+ }
+<SkipInits,SkipCurly,SkipCurlyCpp>"//".* {
+ addToBody(yytext);
+ }
+<SkipInits,SkipCurly,SkipCurlyCpp>. {
+ addToBody(yytext);
+ }
+<SkipString>\\. {
+ addToBodyCond(yytext);
+ }
+<SkipString>\" {
+ addToBodyCond(yytext);
+ BEGIN( lastStringContext );
+ }
+<SkipString>"/*"|"*/"|"//" {
+ addToBodyCond(yytext);
+ }
+<SkipString>\n {
+ yyLineNr++;
+ addToBodyCond(yytext);
+ }
+<SkipString>. {
+ addToBodyCond(yytext);
+ }
<Bases,ClassName>";" {
current->section = Entry::EMPTY_SEC ;
current->type.resize(0) ;
@@ -2507,7 +2635,7 @@ VAR [vV][aA][rR]
current->argList->clear();
BEGIN( FindMembers ) ;
}
-<ClassName>{ID} {
+<ClassName>{SCOPENAME} {
current->name = yytext ;
BEGIN( ClassVar );
}
@@ -2522,7 +2650,7 @@ VAR [vV][aA][rR]
<ClassVar>{ID} {
if (isTypedef)
{
- typedefDict.insert(yytext,new QString(current->name));
+ typedefDict.insert(yytext,new QCString(current->name));
current->type.prepend("typedef ");
}
current->type += ' ' ;
@@ -2638,22 +2766,34 @@ VAR [vV][aA][rR]
}
<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator>("//"{B}*)?"/**"/[^/*] {
removeSlashes=(yytext[1]=='/');
+ lastDocContext = YY_START;
if (current_root->section & Entry::SCOPE_MASK)
current->inside = current_root->name+"::";
- if (YY_START==Curly)
+ if (!Config::autoBriefFlag) // use the Qt style
{
tmpDocType=-1;
- current->doc+="\n\n";
- lastDocContext = Curly;
+ if (YY_START==Curly)
+ current->doc+="\n\n";
+ else
+ current->doc.resize(0);
BEGIN( Doc );
}
- else
- {
- tmpDocType=Doc;
- current->doc.resize(0);
- current->brief.resize(0);
- lastDocContext = YY_START;
- BEGIN( JavaDoc );
+ else // Use the javadoc style
+ {
+ if (YY_START==Curly)
+ {
+ tmpDocType=-1;
+ current->doc+="\n\n";
+ lastDocContext = Curly;
+ BEGIN( Doc );
+ }
+ else
+ {
+ tmpDocType=Doc;
+ current->doc.resize(0);
+ current->brief.resize(0);
+ BEGIN( JavaDoc );
+ }
}
}
<FindMembers,FindFields,MemberSpec,FuncQual,Operator>"//!" {
@@ -2679,7 +2819,7 @@ VAR [vV][aA][rR]
current->args.resize(0);
current->argList->clear();
bracketCount=0;
- BEGIN( SkipBlock );
+ BEGIN( SkipCurlyBlock );
}
<JavaDoc>"@short"{B}+ {
@@ -2728,24 +2868,31 @@ VAR [vV][aA][rR]
current->startLine = yyLineNr;
BEGIN( ClassDocFunc );
}
-<LineDoc,Doc,JavaDoc>{B}*("\\"|"@")"def"{B}* {
+<Doc,JavaDoc>{B}*("\\"|"@")"def"{B}+ {
nextDefContext = YY_START==LineDoc ? DefLineDoc : ClassDoc;
current->section = Entry::DEFINEDOC_SEC;
current->fileName = yyFileName;
current->startLine = yyLineNr;
BEGIN( ClassDocDefine );
}
-<Doc,JavaDoc>{B}*("\\"|"@")"overload"{B}* {
+<LineDoc,Doc,JavaDoc>{B}*("\\"|"@")"overload"{B}* {
+ overloadContext = YY_START;
BEGIN( ClassDocOverload );
}
-<ClassDocOverload>{B}*"\n" {
- QString orgDoc = current->doc;
+<ClassDocOverload>{B}*/"\n" {
+ QCString orgDoc = current->doc;
current->doc = getOverloadDocs();
current->doc += "\n\n";
current->doc += orgDoc;
- yyLineNr++;
- BEGIN( Doc );
+ BEGIN( overloadContext );
}
+<ClassDocOverload>{B}*/"*/" {
+ QCString orgDoc = current->doc;
+ current->doc = getOverloadDocs();
+ current->doc += "\n\n";
+ current->doc += orgDoc;
+ BEGIN( overloadContext );
+ }
<ClassDocOverload>. { unput(*yytext);
current->section = Entry::OVERLOADDOC_SEC;
current->fileName = yyFileName;
@@ -3104,7 +3251,7 @@ VAR [vV][aA][rR]
}
<GroupName>{ID} {
current->groups->append(
- new QString(yytext)
+ new QCString(yytext)
);
}
<GroupName>\n {
@@ -3177,6 +3324,9 @@ VAR [vV][aA][rR]
current->section = Entry::VARIABLEDOC_SEC;
newDocState();
}
+<ClassDocFunc>"operator"{B}*"("{B}*")" {
+ current->name+=yytext;
+ }
<ClassDocFunc>"(" {
current->args+=*yytext;
currentArgumentContext = ClassDocFuncQual;
@@ -3194,6 +3344,9 @@ VAR [vV][aA][rR]
current->name+=')';
BEGIN( ClassDocFunc );
}
+<ClassDocFuncQual>"{" {
+ BEGIN( ClassDocFuncSkipLine);
+ }
<ClassDocFuncQual>{B}*"const"{B}* {
current->args += " const ";
current->argList->constSpecifier=TRUE;
@@ -3221,7 +3374,7 @@ VAR [vV][aA][rR]
<ClassDocFunc,ClassDocFuncQual>. {
current->name += *yytext;
}
-<ClassDocFuncQual>"\n" {
+<ClassDocFuncQual,ClassDocFuncSkipLine>"\n" {
yyLineNr++;
current->name = current->name.stripWhiteSpace();
newDocState();
@@ -3229,6 +3382,7 @@ VAR [vV][aA][rR]
<Doc>. { current->doc += *yytext; }
<DefLineDoc,LineDoc>. { current->brief += *yytext; }
<Doc>\n { yyLineNr++; current->doc += *yytext; }
+<LineDoc>[\n\r]{B}*"//"[!/]
<LineDoc>\n {
yyLineNr++;
BEGIN( lastDocContext );
@@ -3306,6 +3460,20 @@ VAR [vV][aA][rR]
//----------------------------------------------------------------------------
+static void addToBody(const char *text)
+{
+ if (Config::includeSourceFlag)
+ previous->body+=text;
+}
+
+static void addToBodyCond(const char *text)
+{
+ if (Config::includeSourceFlag && lastStringContext==SkipCurly)
+ previous->body+=text;
+}
+
+//----------------------------------------------------------------------------
+
void scanString(const char *s)
{
const char *oldInputString = inputString;
@@ -3414,7 +3582,7 @@ void parseMain(Entry *rt)
//----------------------------------------------------------------------------
-void parseDocument(OutputList &ol,const QString &docString)
+void parseDocument(OutputList &ol,const QCString &docString)
{
//inParamBlock=inSeeBlock=inReturnBlock=FALSE;
curTable = 0;
@@ -3441,7 +3609,7 @@ void parseDocument(OutputList &ol,const QString &docString)
//----------------------------------------------------------------------------
void parseDoc(OutputList &ol,const char *clName,
- const char *memName,const QString &docString)
+ const char *memName,const QCString &docString)
{
initParser();
initParseCodeContext();
@@ -3461,7 +3629,7 @@ void parseDoc(OutputList &ol,const char *clName,
//----------------------------------------------------------------------------
-void parseText(OutputList &ol,const QString &txtString)
+void parseText(OutputList &ol,const QCString &txtString)
{
inputString = txtString;
outDoc = new OutputList(&ol);
@@ -3476,7 +3644,7 @@ void parseText(OutputList &ol,const QString &txtString)
//----------------------------------------------------------------------------
-void parseExample(OutputList &ol,const QString &docString,
+void parseExample(OutputList &ol,const QCString &docString,
const char *fileName)
{
initParser();
@@ -3487,9 +3655,3 @@ void parseExample(OutputList &ol,const QString &docString,
}
//----------------------------------------------------------------------------
-
-extern "C" { // some sillyness to keep the compiler happy
-int scanYYwrap() { return 1 ; }
-void bogus() { yy_flex_realloc(0,0); }
-}
-
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index 241d0a8..50d6556 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -14,6 +14,7 @@
*
*/
+#include "qtbc.h"
#include "searchindex.h"
#include "suffixtree.h"
@@ -44,7 +45,7 @@ bool SearchIndex::addWord(const char *key,const char *word,bool special)
DocRef *dr=0;
if (word && key && strlen(key)>0 && (dr=refDict[key]))
{
- suffixTree->insertWord(((QString)word).lower(),dr->index(),special);
+ suffixTree->insertWord(((QCString)word).lower(),dr->index(),special);
return TRUE;
}
else if (word)
diff --git a/src/searchindex.h b/src/searchindex.h
index 64071fb..f51afa6 100644
--- a/src/searchindex.h
+++ b/src/searchindex.h
@@ -17,8 +17,8 @@
#ifndef _SEARCHINDEX_H
#define _SEARCHINDEX_H
+#include "qtbc.h"
#include <qintdict.h>
-#include <qstring.h>
#include <qlist.h>
#include <qdict.h>
@@ -40,8 +40,8 @@ class DocRef
int offset() const { return o; }
private:
- QString n;
- QString u;
+ QCString n;
+ QCString u;
int i;
int o;
};
diff --git a/src/section.h b/src/section.h
index fc287ae..aa9a674 100644
--- a/src/section.h
+++ b/src/section.h
@@ -18,9 +18,9 @@
#ifndef SECTION_H
#define SECTION_H
+#include "qtbc.h"
#include <qlist.h>
#include <qdict.h>
-#include <qstring.h>
class Definition;
@@ -29,11 +29,11 @@ struct SectionInfo
enum SectionType { Section, Subsection, Anchor };
SectionInfo(const char *l,const char *t,SectionType st)
{ label=l; title=t; type=st; definition=0; }
- QString fileName;
- QString label;
- QString title;
+ QCString label;
+ QCString title;
SectionType type;
Definition *definition;
+ QCString fileName;
};
class SectionList : public QList<SectionInfo>
diff --git a/src/suffixtree.cpp b/src/suffixtree.cpp
index 604531f..8b8ce88 100644
--- a/src/suffixtree.cpp
+++ b/src/suffixtree.cpp
@@ -15,6 +15,8 @@
*/
#include <stdio.h>
+
+#include "qtbc.h"
#include "suffixtree.h"
#define MAXWORDLEN 1024
@@ -112,7 +114,7 @@ int SuffixNode::insert(const char *word,int refId,int inName,int fullWord)
SuffixNode *sn=children->first();
while (sn)
{
- char *lab=sn->label.data();
+ const char *lab=sn->label.data();
char w=word[0],l=lab[0],i=0;
while (w!=0 && l!=0 && w==l) { i++; w=word[i]; l=lab[i]; }
if (w==0 && l==0) // match found
@@ -320,7 +322,7 @@ SuffixTree::~SuffixTree()
void SuffixTree::insertWord(const char *word,int index,bool inName)
{
- QString suffix=word;
+ QCString suffix=word;
uint i;
for (i=2;i<suffix.length()-1;i++)
{
diff --git a/src/suffixtree.h b/src/suffixtree.h
index 381253c..a93d45e 100644
--- a/src/suffixtree.h
+++ b/src/suffixtree.h
@@ -17,9 +17,9 @@
#ifndef SUFFIXTREE_H
#define SUFFIXTREE_H
+#include "qtbc.h"
#include <qlist.h>
#include <qarray.h>
-#include <qstring.h>
#include <qfile.h>
class SuffixNodeList;
@@ -56,7 +56,7 @@ class SuffixNode
private:
SuffixNodeList *children;
QArray<WordRef> references;
- QString label;
+ QCString label;
int branchOffset;
int totalFreq;
};
diff --git a/src/tag.l b/src/tag.l
index 9a6aa02..8e02d92 100644
--- a/src/tag.l
+++ b/src/tag.l
@@ -20,7 +20,8 @@
* includes
*/
#include <stdio.h>
-#include <qstring.h>
+
+#include "qtbc.h"
#include <qfileinf.h>
#include "classdef.h"
@@ -30,18 +31,19 @@
#include "doxygen.h"
#include "util.h"
#include "message.h"
+#include "defargs.h"
#define YY_NO_UNPUT
#define YY_NEVER_INTERACTIVE 1
static int yyLineNr;
-static QString className;
-static QString fileName;
-static QString namespaceName;
-static QString tagName;
-static QString memberName;
-static QString anchorName;
-static QString argString;
+static QCString className;
+static QCString fileName;
+static QCString namespaceName;
+static QCString tagName;
+static QCString memberName;
+static QCString anchorName;
+static QCString argString;
static ClassDef *cd;
static FileDef *fd;
static NamespaceDef *nd;
@@ -105,8 +107,11 @@ static void addMember(const char *name,const char *anchor,const char *args)
MemberNameDict *mnd=0;
MemberNameList *mnl=0;
MemberDef *md;
+ ArgumentList *argList = new ArgumentList;
+ stringToArgumentList(args,argList);
md=new MemberDef(0,name,args,0,Public,Normal,FALSE,FALSE,
- MemberDef::Function,0,0);
+ MemberDef::Function,0,argList);
+ delete argList;
md->setReference(anchor);
if (cd) // member of a class
{
@@ -129,7 +134,7 @@ static void addMember(const char *name,const char *anchor,const char *args)
mnd=&functionNameDict;
mnl=&functionNameList;
}
- MemberName *mn;
+ MemberName *mn = 0;
if ((mn=(*mnd)[memberName]))
{
//printf("mn->inSort()\n");
@@ -156,6 +161,8 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
FILE [a-z_A-Z0-9\.\-\+\:\\\/]+
SCOPE ({ID}"::")*{ID}
+%option noyywrap
+
%x Pass1
%x Pass2
%x AnchorName
@@ -272,6 +279,6 @@ void parseTagFile(const char *fileName)
fclose(f);
}
-extern "C" { // some bogus code to keep the compiler happy
- int tagYYwrap() { return 1 ; }
-}
+//extern "C" { // some bogus code to keep the compiler happy
+// int tagYYwrap() { return 1 ; }
+//}
diff --git a/src/translator.h b/src/translator.h
index 6f69c9b..d5c4f67 100644
--- a/src/translator.h
+++ b/src/translator.h
@@ -17,7 +17,7 @@
#ifndef TRANSLATOR_H
#define TRANSLATOR_H
-#include <qstring.h>
+#include "qtbc.h"
#include "classdef.h"
#include "util.h"
@@ -28,166 +28,164 @@ class Translator
// NOTICE:
// the following functions are now obsolete: these are no longer used and
// will disappear in future versions. You do not have to translate them!
- virtual QString trInherits()
+ virtual QCString trInherits()
{ return "Inherits"; }
- virtual QString trAnd()
+ virtual QCString trAnd()
{ return "and"; }
- virtual QString trInheritedBy()
+ virtual QCString trInheritedBy()
{ return "Inherited By"; }
- virtual QString trReference()
+ virtual QCString trReference()
{ return "Reference"; }
- virtual QString trReimplementedFrom()
+ virtual QCString trReimplementedFrom()
{ return "Reimplemented from"; }
- virtual QString trReimplementedIn()
+ virtual QCString trReimplementedIn()
{ return "Reimplemented in"; }
- virtual QString trIncludeFile()
+ virtual QCString trIncludeFile()
{ return "Include File"; }
- virtual QString trNamespaces()
- { return "Namespace List"; }
// end of obsolete functions
//--------------------------------------------------------------------
- virtual QString latexBabelPackage()
+ virtual QCString latexBabelPackage()
// returns the name of the package that is included by LaTeX
{ return ""; }
- virtual QString trRelatedFunctions()
+ virtual QCString trRelatedFunctions()
// used in the compound documentation before a list of related functions.
{ return "Related Functions"; }
- virtual QString trRelatedSubscript()
+ virtual QCString trRelatedSubscript()
// subscript for the related functions.
{ return "(Note that these are not member functions.)"; }
- virtual QString trDetailedDescription()
+ virtual QCString trDetailedDescription()
// header that is put before the detailed description of files, classes and namespaces.
{ return "Detailed Description"; }
- virtual QString trMemberTypedefDocumentation()
+ virtual QCString trMemberTypedefDocumentation()
// header that is put before the list of typedefs.
{ return "Member Typedef Documentation"; }
- virtual QString trMemberEnumerationDocumentation()
+ virtual QCString trMemberEnumerationDocumentation()
// header that is put before the list of enumerations.
{ return "Member Enumeration Documentation"; }
- virtual QString trMemberFunctionDocumentation()
+ virtual QCString trMemberFunctionDocumentation()
// header that is put before the list of member functions.
{ return "Member Function Documentation"; }
- virtual QString trMemberDataDocumentation()
+ virtual QCString trMemberDataDocumentation()
// header that is put before the list of member attributes.
{ return "Member Data Documentation"; }
- virtual QString trGeneratedFrom(const char *s,bool single)
+ virtual QCString trGeneratedFrom(const char *s,bool single)
{ // here s is one of " Class", " Struct" or " Union"
// single is true implies a single file
- QString result=(QString)"The documentation for this"+s+
+ QCString result=(QCString)"The documentation for this"+s+
" was generated from the following file";
if (single) result+=":"; else result+="s:";
return result;
}
- virtual QString trMore()
+ virtual QCString trMore()
// this is the text of a link put after brief descriptions.
{ return "More..."; }
- virtual QString trListOfAllMembers()
+ virtual QCString trListOfAllMembers()
// put in the class documentation
{ return "List of all members."; }
- virtual QString trMemberList()
+ virtual QCString trMemberList()
// used as the title of the "list of all members" page of a class
{ return "Member List"; }
- virtual QString trThisIsTheListOfAllMembers()
+ virtual QCString trThisIsTheListOfAllMembers()
// this is the first part of a sentence that is followed by a class name
{ return "This is the complete list of members for "; }
- virtual QString trIncludingInheritedMembers()
+ virtual QCString trIncludingInheritedMembers()
// this is the remainder of the sentence after the class name
{ return ", including all inherited members."; }
- virtual QString trGeneratedAutomatically(const char *s)
+ virtual QCString trGeneratedAutomatically(const char *s)
// this is put at the author sections at the bottom of man pages.
// parameter s is name of the project name.
- { QString result="Generated automatically by Doxygen";
- if (s) result+=(QString)" for "+s;
+ { QCString result="Generated automatically by Doxygen";
+ if (s) result+=(QCString)" for "+s;
result+=" from the source code.";
return result;
}
- virtual QString trEnumName()
+ virtual QCString trEnumName()
// put after an enum name in the list of all members
{ return "enum name"; }
- virtual QString trEnumValue()
+ virtual QCString trEnumValue()
// put after an enum value in the list of all members
{ return "enum value"; }
- virtual QString trDefinedIn()
+ virtual QCString trDefinedIn()
// put after an undocumented member in the list of all members
{ return "defined in"; }
- virtual QString trVerbatimText(const char *f)
+ virtual QCString trVerbatimText(const char *f)
// put as in introduction in the verbatim header file of a class.
// parameter f is the name of the include file.
- { return (QString)"This is the verbatim text of the "+f+" include file."; }
+ { return (QCString)"This is the verbatim text of the "+f+" include file."; }
// quick reference sections
- virtual QString trModules()
+ virtual QCString trModules()
// This is put above each page as a link to the list of all groups of
// compounds or files (see the \group command).
{ return "Modules"; }
- virtual QString trClassHierarchy()
+ virtual QCString trClassHierarchy()
// This is put above each page as a link to the class hierarchy
{ return "Class Hierarchy"; }
- virtual QString trCompoundList()
+ virtual QCString trCompoundList()
// This is put above each page as a link to the list of annotated classes
{ return "Compound List"; }
- virtual QString trFileList()
+ virtual QCString trFileList()
// This is put above each page as a link to the list of documented files
{ return "File List"; }
- virtual QString trHeaderFiles()
+ virtual QCString trHeaderFiles()
// This is put above each page as a link to the list of all verbatim headers
{ return "Header Files"; }
- virtual QString trCompoundMembers()
+ virtual QCString trCompoundMembers()
// This is put above each page as a link to all members of compounds.
{ return "Compound Members"; }
- virtual QString trFileMembers()
+ virtual QCString trFileMembers()
// This is put above each page as a link to all members of files.
{ return "File Members"; }
- virtual QString trRelatedPages()
+ virtual QCString trRelatedPages()
// This is put above each page as a link to all related pages.
{ return "Related Pages"; }
- virtual QString trExamples()
+ virtual QCString trExamples()
// This is put above each page as a link to all examples.
{ return "Examples"; }
- virtual QString trSearch()
+ virtual QCString trSearch()
// This is put above each page as a link to the search engine.
{ return "Search"; }
- virtual QString trClassHierarchyDescription()
+ virtual QCString trClassHierarchyDescription()
// This is an introduction to the class hierarchy.
{ return "This inheritance list is sorted roughly, "
"but not completely, alphabetically:";
}
- virtual QString trFileListDescription(bool extractAll)
+ virtual QCString trFileListDescription(bool extractAll)
// This is an introduction to the list with all files.
{
- QString result="Here is a list of all ";
+ QCString result="Here is a list of all ";
if (!extractAll) result+="documented ";
result+="files with brief descriptions:";
return result;
}
- virtual QString trCompoundListDescription()
+ virtual QCString trCompoundListDescription()
// This is an introduction to the annotated compound list
{ return "Here are the classes, structs and "
"unions with brief descriptions:";
}
- virtual QString trCompoundMembersDescription(bool extractAll)
+ virtual QCString trCompoundMembersDescription(bool extractAll)
// This is an introduction to the page with all class members
{
- QString result="Here is a list of all ";
+ QCString result="Here is a list of all ";
if (!extractAll) result+="documented ";
result+="class members with links to ";
if (extractAll)
@@ -196,10 +194,10 @@ class Translator
result+="the classes they belong to:";
return result;
}
- virtual QString trFileMembersDescription(bool extractAll)
+ virtual QCString trFileMembersDescription(bool extractAll)
// This is an introduction to the page with all file members
{
- QString result="Here is a list of all ";
+ QCString result="Here is a list of all ";
if (!extractAll) result+="documented ";
result+="file members with links to ";
if (extractAll)
@@ -208,207 +206,207 @@ class Translator
result+="the files they belong to:";
return result;
}
- virtual QString trHeaderFilesDescription()
+ virtual QCString trHeaderFilesDescription()
// This is an introduction to the page with the list of all header files
{ return "Here are the header files that make up the API:"; }
- virtual QString trExamplesDescription()
+ virtual QCString trExamplesDescription()
// This is an introduction to the page with the list of all examples
{ return "Here is a list of all examples:"; }
- virtual QString trRelatedPagesDescription()
+ virtual QCString trRelatedPagesDescription()
// This is an introduction to the page with the list of related pages
{ return "Here is a list of all related documentation pages:"; }
- virtual QString trModulesDescription()
+ virtual QCString trModulesDescription()
// This is an introduction to the page with the list of class/file groups
{ return "Here is a list of all modules:"; }
- virtual QString trNoDescriptionAvailable()
+ virtual QCString trNoDescriptionAvailable()
// This sentences is used in the annotated class/file lists if no brief
// description is given.
{ return "No description available"; }
// index titles (the project name is prepended for these)
- virtual QString trDocumentation()
+ virtual QCString trDocumentation()
// This is used in HTML as the title of index.html.
{ return "Documentation"; }
- virtual QString trModuleIndex()
+ virtual QCString trModuleIndex()
// This is used in LaTeX as the title of the chapter with the
// index of all groups.
{ return "Module Index"; }
- virtual QString trHierarchicalIndex()
+ virtual QCString trHierarchicalIndex()
// This is used in LaTeX as the title of the chapter with the
// class hierarchy.
{ return "Hierarchical Index"; }
- virtual QString trCompoundIndex()
+ virtual QCString trCompoundIndex()
// This is used in LaTeX as the title of the chapter with the
// annotated compound index
{ return "Compound Index"; }
- virtual QString trFileIndex()
+ virtual QCString trFileIndex()
// This is used in LaTeX as the title of the chapter with the
// list of all files.
{ return "File Index"; }
- virtual QString trModuleDocumentation()
+ virtual QCString trModuleDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all groups.
{ return "Module Documentation"; }
- virtual QString trClassDocumentation()
+ virtual QCString trClassDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all classes, structs and unions.
{ return "Class Documentation"; }
- virtual QString trFileDocumentation()
+ virtual QCString trFileDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all files.
{ return "File Documentation"; }
- virtual QString trExampleDocumentation()
+ virtual QCString trExampleDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all examples.
{ return "Example Documentation"; }
- virtual QString trPageDocumentation()
+ virtual QCString trPageDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all related pages.
{ return "Page Documentation"; }
- virtual QString trReferenceManual()
+ virtual QCString trReferenceManual()
// This is used in LaTeX as the title of the document
{ return "Reference Manual"; }
- virtual QString trDefines()
+ virtual QCString trDefines()
// This is used in the documentation of a file as a header before the
// list of defines
{ return "Defines"; }
- virtual QString trFuncProtos()
+ virtual QCString trFuncProtos()
// This is used in the documentation of a file as a header before the
// list of function prototypes
{ return "Function Prototypes"; }
- virtual QString trTypedefs()
+ virtual QCString trTypedefs()
// This is used in the documentation of a file as a header before the
// list of typedefs
{ return "Typedefs"; }
- virtual QString trEnumerations()
+ virtual QCString trEnumerations()
// This is used in the documentation of a file as a header before the
// list of enumerations
{ return "Enumerations"; }
- virtual QString trFunctions()
+ virtual QCString trFunctions()
// This is used in the documentation of a file as a header before the
// list of (global) functions
{ return "Functions"; }
- virtual QString trVariables()
+ virtual QCString trVariables()
// This is used in the documentation of a file as a header before the
// list of (global) variables
{ return "Variables"; }
- virtual QString trEnumerationValues()
+ virtual QCString trEnumerationValues()
// This is used in the documentation of a file as a header before the
// list of (global) variables
{ return "Enumeration values"; }
- virtual QString trAuthor()
+ virtual QCString trAuthor()
// This is used in man pages as the author section.
{ return "Author"; }
- virtual QString trDefineDocumentation()
+ virtual QCString trDefineDocumentation()
// This is used in the documentation of a file before the list of
// documentation blocks for defines
{ return "Define Documentation"; }
- virtual QString trFunctionPrototypeDocumentation()
+ virtual QCString trFunctionPrototypeDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for function prototypes
{ return "Function Prototype Documentation"; }
- virtual QString trTypedefDocumentation()
+ virtual QCString trTypedefDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for typedefs
{ return "Typedef Documentation"; }
- virtual QString trEnumerationTypeDocumentation()
+ virtual QCString trEnumerationTypeDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for enumeration types
{ return "Enumeration Type Documentation"; }
- virtual QString trEnumerationValueDocumentation()
+ virtual QCString trEnumerationValueDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for enumeration values
{ return "Enumeration Value Documentation"; }
- virtual QString trFunctionDocumentation()
+ virtual QCString trFunctionDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for functions
{ return "Function Documentation"; }
- virtual QString trVariableDocumentation()
+ virtual QCString trVariableDocumentation()
// This is used in the documentation of a file/namespace before the list
// of documentation blocks for variables
{ return "Variable Documentation"; }
- virtual QString trCompounds()
+ virtual QCString trCompounds()
// This is used in the documentation of a file/namespace/group before
// the list of links to documented compounds
{ return "Compounds"; }
- virtual QString trFiles()
+ virtual QCString trFiles()
// This is used in the documentation of a group before the list of
// links to documented files
{ return "Files"; }
- virtual QString trGeneratedAt(const char *date,const char *projName)
+ virtual QCString trGeneratedAt(const char *date,const char *projName)
{
- QString result=(QString)"Generated at "+date;
- if (projName) result+=(QString)" for "+projName;
- result+=(QString)" by";
+ QCString result=(QCString)"Generated at "+date;
+ if (projName) result+=(QCString)" for "+projName;
+ result+=(QCString)" by";
return result;
}
- virtual QString trWrittenBy()
+ virtual QCString trWrittenBy()
{
return "written by";
}
- virtual QString trClassDiagram(const char *clName)
+ virtual QCString trClassDiagram(const char *clName)
// this text is put before a class diagram
{
- return (QString)"Class diagram for "+clName;
+ return (QCString)"Class diagram for "+clName;
}
- virtual QString trForInternalUseOnly()
+ virtual QCString trForInternalUseOnly()
// this text is generated when the \internal command is used.
{ return "For internal use only."; }
- virtual QString trReimplementedForInternalReasons()
+ virtual QCString trReimplementedForInternalReasons()
// this text is generated when the \reimp command is used.
{ return "Reimplemented for internal reasons; the API is not affected."; }
- virtual QString trWarning()
+ virtual QCString trWarning()
// this text is generated when the \warning command is used.
{ return "Warning"; }
- virtual QString trBugsAndLimitations()
+ virtual QCString trBugsAndLimitations()
// this text is generated when the \bug command is used.
{ return "Bugs and limitations"; }
- virtual QString trVersion()
+ virtual QCString trVersion()
// this text is generated when the \version command is used.
{ return "Version"; }
- virtual QString trDate()
+ virtual QCString trDate()
// this text is generated when the \date command is used.
{ return "Date"; }
- virtual QString trAuthors()
+ virtual QCString trAuthors()
// this text is generated when the \author command is used.
{ return "Author(s)"; }
- virtual QString trReturns()
+ virtual QCString trReturns()
// this text is generated when the \return command is used.
{ return "Returns"; }
- virtual QString trSeeAlso()
+ virtual QCString trSeeAlso()
// this text is generated when the \sa command is used.
{ return "See also"; }
- virtual QString trParameters()
+ virtual QCString trParameters()
// this text is generated when the \param command is used.
{ return "Parameters"; }
- virtual QString trExceptions()
+ virtual QCString trExceptions()
// this text is generated when the \exception command is used.
{ return "Exceptions"; }
- virtual QString trGeneratedBy()
+ virtual QCString trGeneratedBy()
// this text is used in the title page of a LaTeX document.
{ return "Generated by"; }
// new since 0.49-990307
- virtual QString trNamespaceList()
+ virtual QCString trNamespaceList()
// used as the title of page containing all the index of all namespaces.
{ return "Namespace List"; }
- virtual QString trNamespaceListDescription(bool extractAll)
+ virtual QCString trNamespaceListDescription(bool extractAll)
// used as an introduction to the namespace list
{
- QString result="Here is a list of all ";
+ QCString result="Here is a list of all ";
if (!extractAll) result+="documented ";
result+="namespaces with brief descriptions:";
return result;
}
- virtual QString trFriends()
+ virtual QCString trFriends()
// used in the class documentation as a header before the list of all
// friends of a class
{ return "Friends"; }
@@ -417,7 +415,7 @@ class Translator
// new since 0.49-990405
//////////////////////////////////////////////////////////////////////////
- virtual QString trRelatedFunctionDocumentation()
+ virtual QCString trRelatedFunctionDocumentation()
// used in the class documentation as a header before the list of all
// related classes
{ return "Friends And Related Function Documentation"; }
@@ -426,11 +424,11 @@ class Translator
// new since 0.49-990425
//////////////////////////////////////////////////////////////////////////
- virtual QString trCompoundReference(const char *clName,
+ virtual QCString trCompoundReference(const char *clName,
ClassDef::CompoundType compType)
// used as the title of the HTML page of a class/struct/union
{
- QString result=(QString)clName+" ";
+ QCString result=(QCString)clName+" ";
switch(compType)
{
case ClassDef::Class: result+=" Class"; break;
@@ -440,49 +438,49 @@ class Translator
result+=" Reference";
return result;
}
- virtual QString trFileReference(const char *fileName)
+ virtual QCString trFileReference(const char *fileName)
// used as the title of the HTML page of a file
{
- QString result=fileName;
+ QCString result=fileName;
result+=" File Reference";
return result;
}
- virtual QString trNamespaceReference(const char *namespaceName)
+ virtual QCString trNamespaceReference(const char *namespaceName)
// used as the title of the HTML page of a namespace
{
- QString result=namespaceName;
+ QCString result=namespaceName;
result+=" Namespace Reference";
return result;
}
// these are for the member sections of a class, struct or union
- virtual QString trPublicMembers()
+ virtual QCString trPublicMembers()
{ return "Public Members"; }
- virtual QString trPublicSlots()
+ virtual QCString trPublicSlots()
{ return "Public Slots"; }
- virtual QString trSignals()
+ virtual QCString trSignals()
{ return "Signals"; }
- virtual QString trStaticPublicMembers()
+ virtual QCString trStaticPublicMembers()
{ return "Static Public Members"; }
- virtual QString trProtectedMembers()
+ virtual QCString trProtectedMembers()
{ return "Protected Members"; }
- virtual QString trProtectedSlots()
+ virtual QCString trProtectedSlots()
{ return "Protected Slots"; }
- virtual QString trStaticProtectedMembers()
+ virtual QCString trStaticProtectedMembers()
{ return "Static Protected Members"; }
- virtual QString trPrivateMembers()
+ virtual QCString trPrivateMembers()
{ return "Private Members"; }
- virtual QString trPrivateSlots()
+ virtual QCString trPrivateSlots()
{ return "Private Slots"; }
- virtual QString trStaticPrivateMembers()
+ virtual QCString trStaticPrivateMembers()
{ return "Static Private Members"; }
// end of member sections
- virtual QString trWriteList(int numEntries)
+ virtual QCString trWriteList(int numEntries)
{
// this function is used to produce a comma-separated list of items.
// use generateMarker(i) to indicate where item i should be put.
- QString result;
+ QCString result;
int i;
// the inherits list contain `numEntries' classes
for (i=0;i<numEntries;i++)
@@ -502,38 +500,38 @@ class Translator
return result;
}
- virtual QString trInheritsList(int numEntries)
+ virtual QCString trInheritsList(int numEntries)
// used in class documentation to produce a list of base classes,
// if class diagrams are disabled.
{
return "Inherits "+trWriteList(numEntries)+".";
}
- virtual QString trInheritedByList(int numEntries)
+ virtual QCString trInheritedByList(int numEntries)
// used in class documentation to produce a list of super classes,
// if class diagrams are disabled.
{
return "Inherited by "+trWriteList(numEntries)+".";
}
- virtual QString trReimplementedFromList(int numEntries)
+ virtual QCString trReimplementedFromList(int numEntries)
// used in member documentation blocks to produce a list of
// members that are hidden by this one.
{
return "Reimplemented from "+trWriteList(numEntries)+".";
}
- virtual QString trReimplementedInList(int numEntries)
+ virtual QCString trReimplementedInList(int numEntries)
{
// used in member documentation blocks to produce a list of
// all member that overwrite the implementation of this member.
return "Reimplemented in "+trWriteList(numEntries)+".";
}
- virtual QString trNamespaceMembers()
+ virtual QCString trNamespaceMembers()
// This is put above each page as a link to all members of namespaces.
{ return "Namespace Members"; }
- virtual QString trNamespaceMemberDescription(bool extractAll)
+ virtual QCString trNamespaceMemberDescription(bool extractAll)
// This is an introduction to the page with all namespace members
{
- QString result="Here is a list of all ";
+ QCString result="Here is a list of all ";
if (!extractAll) result+="documented ";
result+="namespace members with links to ";
if (extractAll)
@@ -542,14 +540,23 @@ class Translator
result+="the namespaces they belong to:";
return result;
}
- virtual QString trNamespaceIndex()
+ virtual QCString trNamespaceIndex()
// This is used in LaTeX as the title of the chapter with the
// index of all namespaces.
{ return "Namespace Index"; }
- virtual QString trNamespaceDocumentation()
+ virtual QCString trNamespaceDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all namespaces.
{ return "Namespace Documentation"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990522
+//////////////////////////////////////////////////////////////////////////
+
+ // This is used in the documentation before the list of all
+ // namespaces in a file.
+ virtual QCString trNamespaces()
+ { return "Namespaces"; }
};
#endif
diff --git a/src/translator_cz.h b/src/translator_cz.h
index 9a0656e..a867de8 100644
--- a/src/translator_cz.h
+++ b/src/translator_cz.h
@@ -17,7 +17,7 @@
#ifndef TRANSLATOR_CZ_H
#define TRANSLATOR_CZ_H
-#include <qstring.h>
+#include "translator.h"
// The translation from English to Czech by Vlastimil Havran.
// In the cases where are more translations possible I hope
@@ -29,247 +29,247 @@
class TranslatorCzech : public Translator
{
public:
- QString latexBabelPackage()
+ QCString latexBabelPackage()
{ return "czech"; }
- QString trInherits()
+ QCString trInherits()
{ return "Dedi"; }
- QString trAnd()
+ QCString trAnd()
{ return "a"; }
- QString trInheritedBy()
+ QCString trInheritedBy()
{ return "Je Potomkem"; }
- QString trRelatedFunctions()
+ QCString trRelatedFunctions()
{ return "Pribuzne Metody"; }
- QString trRelatedSubscript()
+ QCString trRelatedSubscript()
{ return "(Tyto funkce nejsou metody.)"; }
- QString trDetailedDescription()
+ QCString trDetailedDescription()
{ return "Podrobna Dokumentace"; }
- QString trMemberTypedefDocumentation()
+ QCString trMemberTypedefDocumentation()
{ return "Dokumentace pro Deklaraci Typu (typedef) ve Tride";}
- QString trMemberEnumerationDocumentation()
+ QCString trMemberEnumerationDocumentation()
{ return "Dokumentace Vyctovych Typu"; }
- QString trEnumerationValueDocumentation()
+ QCString trEnumerationValueDocumentation()
{ return "Dokumentace Hodnot Vyctovych Typu"; }
- QString trMemberFunctionDocumentation()
+ QCString trMemberFunctionDocumentation()
{ return "Dokumentace Metod"; }
- QString trMemberDataDocumentation()
+ QCString trMemberDataDocumentation()
{ return "Dokumentace Datovych Slozek Tridy"; }
- QString trGeneratedFrom(const char *s,bool single)
+ QCString trGeneratedFrom(const char *s,bool single)
{
- QString result=(QString)"Dokumentace pro tento"+s+
+ QCString result=(QCString)"Dokumentace pro tento"+s+
" byla generovana z nasledujiciho souboru";
if (single) result+=":"; else result+="s:";
return result;
}
- QString trMore()
+ QCString trMore()
{ return "Detaily"; }
- QString trReference()
+ QCString trReference()
{ return "Reference"; }
- QString trListOfAllMembers()
+ QCString trListOfAllMembers()
{ return "Seznam vsech datovych slozek a metod tridy."; }
- QString trMemberList()
+ QCString trMemberList()
{ return "Seznam datovych polozek a metod tridy"; }
- QString trThisIsTheListOfAllMembers()
+ QCString trThisIsTheListOfAllMembers()
{ return "Toto je uplny seznam datovych slozek a metod tridy pro"; }
- QString trIncludingInheritedMembers()
+ QCString trIncludingInheritedMembers()
{ return "zahrnuje vsechny nasledujici zdedene datove slozky a metody."; }
- QString trGeneratedAutomatically(const char *s)
- { QString result="Automaticky vygenerovany pomoci programu Doxygen";
- if (s) result+=(QString)" pro "+s;
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result="Automaticky vygenerovany pomoci programu Doxygen";
+ if (s) result+=(QCString)" pro "+s;
result+=" ze zdrojoveho souboru.";
return result;
}
- QString trEnumName()
+ QCString trEnumName()
{ return "pojmenovani vyctoveho typu"; }
- QString trEnumValue()
+ QCString trEnumValue()
{ return "hodnota vyctoveho typu"; }
- QString trDefinedIn()
+ QCString trDefinedIn()
{ return "definovany v"; }
- QString trIncludeFile()
+ QCString trIncludeFile()
{ return "Vklada soubor"; }
- QString trVerbatimText(const char *f)
- { return (QString)"Toto je presny text z vlozeneho souboru "+f+""; }
- QString trModules()
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Toto je presny text z vlozeneho souboru "+f+""; }
+ QCString trModules()
{ return "Moduly"; }
- QString trClassHierarchy()
+ QCString trClassHierarchy()
{ return "Hierarchie trid"; }
- QString trCompoundList()
+ QCString trCompoundList()
{ return "Seznam objektovych typu"; }
- QString trFileList()
+ QCString trFileList()
{ return "Seznam souboru"; }
- QString trHeaderFiles()
+ QCString trHeaderFiles()
{ return "Hlavickove soubory"; }
- QString trCompoundMembers()
+ QCString trCompoundMembers()
{ return "Datove slozky a metody objektovych typu"; }
- QString trFileMembers()
+ QCString trFileMembers()
{ return "Globalni deklarace"; }
- QString trRelatedPages()
+ QCString trRelatedPages()
{ return "Souvisejici stranky"; }
- QString trExamples()
+ QCString trExamples()
{ return "Priklady:"; }
- QString trSearch()
+ QCString trSearch()
{ return "Hledej"; }
- QString trClassHierarchyDescription()
+ QCString trClassHierarchyDescription()
{ return "Tento seznam dedicnych zavislosti je temer setriden"
" podle abecedy:";
}
- QString trFileListDescription(bool extractAll)
+ QCString trFileListDescription(bool extractAll)
{
- QString result="A toto je seznam vsech ";
+ QCString result="A toto je seznam vsech ";
if (!extractAll) result+="dokumentovanych ";
result+="souboru s kratkymi popisy:";
return result;
}
- QString trCompoundListDescription()
+ QCString trCompoundListDescription()
{ return "Zde jsou tridy, struktury a "
"unie s kratkymi popisy:";
}
- QString trCompoundMembersDescription(bool extractAll)
+ QCString trCompoundMembersDescription(bool extractAll)
{
- QString result="Zde je seznam vsech ";
+ QCString result="Zde je seznam vsech ";
if (!extractAll) result+="dokumentovanych ";
result+="clenu tridy (metod a datovych slozek) s odkazy na ";
if (extractAll) result+="dokumentaci tridy pro kazdo polozku:";
else result+="tridy, kam patri:";
return result;
}
- QString trFileMembersDescription(bool extractAll)
+ QCString trFileMembersDescription(bool extractAll)
{
- QString result="Zde je seznam vsech ";
+ QCString result="Zde je seznam vsech ";
if (!extractAll) result+="zdokumentovanych ";
result+="globalnich deklaraci s odkazy ";
if (extractAll) result+="na dokumentaci k souboru pro kazdou deklaraci:";
else result+="na soubory, kde jsou umisteny:";
return result;
}
- QString trHeaderFilesDescription()
+ QCString trHeaderFilesDescription()
{return "Zde jsou hlavickove soubory ktere tvori programove"
" rozhrani aplikace(API):";
}
- QString trExamplesDescription()
+ QCString trExamplesDescription()
{ return "Zde je seznam vsech prikladu:"; }
- QString trRelatedPagesDescription()
+ QCString trRelatedPagesDescription()
{ return "Zde je seznam vsech souvisejicich stranek dokumentace:"; }
- QString trModulesDescription()
+ QCString trModulesDescription()
{ return "Zde je seznam vsech modulu:"; }
- QString trNoDescriptionAvailable()
+ QCString trNoDescriptionAvailable()
{ return "Zadny popis neni k dispozici."; }
- QString trDocumentation()
+ QCString trDocumentation()
{ return "Dokumentace"; }
- QString trModuleIndex()
+ QCString trModuleIndex()
{ return "Index modulu"; }
- QString trHierarchicalIndex()
+ QCString trHierarchicalIndex()
{ return "Index Hierarchie"; }
- QString trCompoundIndex()
+ QCString trCompoundIndex()
{ return "Index objektovych typu"; }
- QString trFileIndex()
+ QCString trFileIndex()
{ return "Index souboru"; }
- QString trModuleDocumentation()
+ QCString trModuleDocumentation()
{ return "Dokumentace modulu"; }
- QString trClassDocumentation()
+ QCString trClassDocumentation()
{ return "Dokumentace tridy"; }
- QString trFileDocumentation()
+ QCString trFileDocumentation()
{ return "Dokumentace souboru"; }
- QString trExampleDocumentation()
+ QCString trExampleDocumentation()
{ return "Dokumentace prikladu"; }
- QString trPageDocumentation()
+ QCString trPageDocumentation()
{ return "Dokumentace stranek"; }
- QString trReferenceManual()
+ QCString trReferenceManual()
{ return "Referencni manual"; }
- QString trDefines()
+ QCString trDefines()
{ return "Definice"; }
- QString trFuncProtos()
+ QCString trFuncProtos()
{ return "Prototypy funkci"; }
- QString trTypedefs()
+ QCString trTypedefs()
{ return "Deklarace datovych typu(typedefs)"; }
- QString trEnumerations()
+ QCString trEnumerations()
{ return "Vyctove typy (enumerations)"; }
- QString trFunctions()
+ QCString trFunctions()
{ return "Funkce"; }
- QString trVariables()
+ QCString trVariables()
{ return "Promenne"; }
- QString trEnumerationValues()
+ QCString trEnumerationValues()
{ return "Hodnoty vyctovych typu"; }
- QString trReimplementedFrom()
+ QCString trReimplementedFrom()
{ return "Je znovu implementovan z"; }
- QString trReimplementedIn()
+ QCString trReimplementedIn()
{ return "Je znovu implementovan v"; }
- QString trAuthor()
+ QCString trAuthor()
{ return "Autor"; }
- QString trDefineDocumentation()
+ QCString trDefineDocumentation()
{ return "Dokumentace definic pomoci maker"; }
- QString trFunctionPrototypeDocumentation()
+ QCString trFunctionPrototypeDocumentation()
{ return "Dokumentace prototypu funkci"; }
- QString trTypedefDocumentation()
+ QCString trTypedefDocumentation()
{ return "Dokumentace deklaraci datovych typu(typedefs)"; }
- QString trEnumerationTypeDocumentation()
+ QCString trEnumerationTypeDocumentation()
{ return "Dokumentace vyctovych typu"; }
- QString trFunctionDocumentation()
+ QCString trFunctionDocumentation()
{ return "Dokumentace funkci"; }
- QString trVariableDocumentation()
+ QCString trVariableDocumentation()
{ return "Dokumentace promennych"; }
- QString trCompounds()
+ QCString trCompounds()
{ return "Polozky objektovych typu"; }
- QString trFiles()
+ QCString trFiles()
{ return "Soubory:"; }
- QString trGeneratedAt(const char *date,const char *projName)
+ QCString trGeneratedAt(const char *date,const char *projName)
{
- QString result=(QString)"Gegenerovany v "+date;
- if (projName) result+=(QString)" pro "+projName;
- result+=(QString)" ";
+ QCString result=(QCString)"Gegenerovany v "+date;
+ if (projName) result+=(QCString)" pro "+projName;
+ result+=(QCString)" ";
return result;
}
- QString trWrittenBy()
+ QCString trWrittenBy()
{
return "napsany ";
}
- QString trClassDiagram(const char *clName)
+ QCString trClassDiagram(const char *clName)
{
- return (QString)"Diagram trid pro "+clName;
+ return (QCString)"Diagram trid pro "+clName;
}
- QString trForInternalUseOnly()
+ QCString trForInternalUseOnly()
{ return "Jen pro interni pouziti."; }
- QString trReimplementedForInternalReasons()
+ QCString trReimplementedForInternalReasons()
{
return "Znovu implementovany z internich duvodu; programove rozhrani"
" aplikace(API) neni zmeneno.";
}
- QString trWarning()
+ QCString trWarning()
{ return "Upozorneni"; }
- QString trBugsAndLimitations()
+ QCString trBugsAndLimitations()
{ return "Chyby a omezeni"; }
- QString trVersion()
+ QCString trVersion()
{ return "Verze"; }
- QString trDate()
+ QCString trDate()
{ return "Datum"; }
- QString trAuthors()
+ QCString trAuthors()
{ return "Autor(i)"; }
- QString trReturns()
+ QCString trReturns()
{ return "ma navratovou hodnotu"; }
- QString trSeeAlso()
+ QCString trSeeAlso()
{ return "Podivej se take na"; }
- QString trParameters()
+ QCString trParameters()
{ return "Parametry"; }
- QString trExceptions()
+ QCString trExceptions()
{ return "Vyjimky"; }
- QString trGeneratedBy()
+ QCString trGeneratedBy()
{ return "Gegenerovan podle"; }
// new since 0.49-990307
- QString trNamespaces()
+ QCString trNamespaces()
{ return "Prostory jmen"; }
- QString trNamespaceList()
+ QCString trNamespaceList()
{ return "Seznam prostoru jmen"; }
- QString trNamespaceListDescription(bool extractAll)
+ QCString trNamespaceListDescription(bool extractAll)
{
- QString result="Zde jsou vsechny ";
+ QCString result="Zde jsou vsechny ";
if (!extractAll) result+="dokumentovane ";
result+="prostory jem s kratkymi popisy:";
return result;
}
- QString trFriends()
+ QCString trFriends()
{ return "Spratelene tridy, funkce a metody"; }
};
diff --git a/src/translator_de.h b/src/translator_de.h
new file mode 100644
index 0000000..8cf43b6
--- /dev/null
+++ b/src/translator_de.h
@@ -0,0 +1,559 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ * The translation into German was provided by
+ * Jens Breitenstein (Jens.Breitenstein@tlc.de)
+ */
+
+#ifndef TRANSLATOR_DE_H
+#define TRANSLATOR_DE_H
+
+#include "translator.h"
+
+class TranslatorGerman : public Translator
+{
+ public:
+ //--------------------------------------------------------------------
+ // NOTICE:
+ // the following functions are now obsolete: these are no longer used and
+ // will disappear in future versions. You do not have to translate them!
+ QCString trInherits()
+ { return "Abgeleitet von "; }
+ QCString trAnd()
+ { return "und"; }
+ QCString trInheritedBy()
+ { return "Basisklasse f&uuml;r"; }
+ QCString trReference()
+ { return "Verweis"; }
+ QCString trReimplementedFrom()
+ { return "Implementiert von"; }
+ QCString trReimplementedIn()
+ { return "erneute Implementation in"; }
+ QCString trIncludeFile()
+ { return "Include-Datei"; }
+ QCString trNamespaces()
+ { return "Namensbereiche"; }
+ // end of obsolete functions
+ //--------------------------------------------------------------------
+
+ QCString latexBabelPackage()
+ // returns the name of the package that is included by LaTeX
+ { return "deutsch"; }
+
+ QCString trRelatedFunctions()
+ // used in the compound documentation before a list of related functions.
+ { return "Verwandte Funktionen"; }
+
+ QCString trRelatedSubscript()
+ // subscript for the related functions.
+ { return "(Es handelt sich hierbei nicht um Elementfunktionen.)"; }
+
+ QCString trDetailedDescription()
+ // header that is put before the detailed description of files, classes and namespaces.
+ { return "Ausf&uuml;hrliche Beschreibung"; }
+
+ QCString trMemberTypedefDocumentation()
+ // header that is put before the list of typedefs.
+ { return "Dokumentation der benutzerdefinierten Datentypen"; }
+
+ QCString trMemberEnumerationDocumentation()
+ // header that is put before the list of enumerations.
+ { return "Dokumentation der Aufz&auml;hlungstypen"; }
+
+ QCString trMemberFunctionDocumentation()
+ // header that is put before the list of member functions.
+ { return "Dokumentation der Elementfunktionen"; }
+
+ QCString trMemberDataDocumentation()
+ // header that is put before the list of member attributes.
+ { return "Dokumentation der Datenelemente"; }
+
+ QCString trGeneratedFrom(const char *s,bool single)
+ { // here s is one of " Class", " Struct" or " Union"
+ // single is true implies a single file
+ QCString result=(QCString)"Die Dokumentation f&uuml;r diese"+s+
+ " wurde aus ";
+ if (single)
+ result+="folgender Datei erzeugt:";
+ else
+ result+="folgenden Dateien erzeugt:";
+
+ return result;
+ }
+
+ QCString trMore()
+ // this is the text of a link put after brief descriptions.
+ { return "Mehr..."; }
+
+ QCString trListOfAllMembers()
+ // put in the class documentation
+ { return "Aufstellung aller Elemente"; }
+
+ QCString trMemberList()
+ // used as the title of the "list of all members" page of a class
+ { return "Elementverzeichnis"; }
+
+ QCString trThisIsTheListOfAllMembers()
+ // this is the first part of a sentence that is followed by a class name
+ { return "Vollst&auml;ndige Aufstellung aller Elemente f&uuml;r"; }
+
+ QCString trIncludingInheritedMembers()
+ // this is the remainder of the sentence after the class name
+ { return "einschlie&suml;lich aller geerbten Elemente."; }
+
+ QCString trGeneratedAutomatically(const char *s)
+ // this is put at the author sections at the bottom of man pages.
+ // parameter s is name of the project name.
+ { QCString result="Automatisch erzeugt von Doxygen";
+ if (s) result+=(QCString)" f&uuml;r "+s;
+ result+=" aus dem Quellcode.";
+ return result;
+ }
+
+ QCString trEnumName()
+ // put after an enum name in the list of all members
+ { return "enum Bezeichner"; }
+
+ QCString trEnumValue()
+ // put after an enum value in the list of all members
+ { return "enum Wert"; }
+
+ QCString trDefinedIn()
+ // put after an undocumented member in the list of all members
+ { return "Definiert in"; }
+
+ QCString trVerbatimText(const char *f)
+ // put as in introduction in the verbatim header file of a class.
+ // parameter f is the name of the include file.
+ { return (QCString)"Dieses ist der unver&auml;nderte Text aus der "
+ "Include-Datei "+f+"."; }
+
+ // quick reference sections
+ QCString trModules()
+ // This is put above each page as a link to the list of all groups of
+ // compounds or files (see the \group command).
+ { return "Module"; }
+ QCString trClassHierarchy()
+ // This is put above each page as a link to the class hierarchy
+ { return "Klassenhierarchie"; }
+ QCString trCompoundList()
+ // This is put above each page as a link to the list of annotated classes
+ { return "&Uuml;bersicht"; }
+ QCString trFileList()
+ // This is put above each page as a link to the list of documented files
+ { return "Auflistung der Dateien"; }
+ QCString trHeaderFiles()
+ // This is put above each page as a link to the list of all verbatim headers
+ { return "Auflistung der Header-Dateien"; }
+ QCString trCompoundMembers()
+ // This is put above each page as a link to all members of compounds.
+ { return "Element&uuml;bersicht"; }
+ QCString trFileMembers()
+ // This is put above each page as a link to all members of files.
+ { return "Datei-Elemente"; }
+ QCString trRelatedPages()
+ // This is put above each page as a link to all related pages.
+ { return "Zus&auml;tzliche Informationen"; }
+ QCString trExamples()
+ // This is put above each page as a link to all examples.
+ { return "Beispiele"; }
+ QCString trSearch()
+ // This is put above each page as a link to the search engine.
+ { return "Suchen"; }
+
+ QCString trClassHierarchyDescription()
+ // This is an introduction to the class hierarchy.
+ { return "Die Liste der Ableitungen ist -mit Einschr&auml;nkungen- "
+ "alphabetisch sortiert:";
+ }
+ QCString trFileListDescription(bool extractAll)
+ // This is an introduction to the list with all files.
+ {
+ QCString result="Hier folgt die Aufz&auml;hlung aller ";
+ if (!extractAll) result+="dokumentierten ";
+ result+="Dateien mit einer Kurzbeschreibung:";
+ return result;
+ }
+ QCString trCompoundListDescription()
+ // This is an introduction to the annotated compound list
+ { return "Hier folgt die Aufz&auml;hlung aller Klassen, Strukturen "
+ "und Varianten mit einer Kurzbeschreibung:";
+ }
+ QCString trCompoundMembersDescription(bool extractAll)
+ // This is an introduction to the page with all class members
+ {
+ QCString result="Hier folgt die Aufz&auml;hlung aller ";
+ if (!extractAll) result+="dokumentierten ";
+ result+="Klassenelemente mit Verweisen auf ";
+ if (extractAll) result+="die Klassendokumentation zu jedem Element:";
+ else result+="die zugeh&ouml;rigen Klassen:";
+ return result;
+ }
+ QCString trFileMembersDescription(bool extractAll)
+ // This is an introduction to the page with all file members
+ {
+ QCString result="Hier folgt die Aufz&auml;hlung aller ";
+ if (!extractAll) result+="dokumentierter ";
+ result+="Dateielemente mit Verweisen auf ";
+ if (extractAll) result+="die Dateidokumentation zu jedem Element:";
+ else result+="die zugeh&ouml;rigen Dateien:";
+ return result;
+ }
+ QCString trHeaderFilesDescription()
+ // This is an introduction to the page with the list of all header files
+ { return "Hier folgen die Headerdateien, welche die API definieren:"; }
+ QCString trExamplesDescription()
+ // This is an introduction to the page with the list of all examples
+ { return "Hier folgt eine Liste mit allen Beispielen:"; }
+ QCString trRelatedPagesDescription()
+ // This is an introduction to the page with the list of related pages
+ { return "Hier folgt eine Liste mit zusammengeh&ouml;rigen Themengebieten:"; }
+ QCString trModulesDescription()
+ // This is an introduction to the page with the list of class/file groups
+ { return "Hier folgt die Aufz&auml;hlung aller Module:"; }
+ QCString trNoDescriptionAvailable()
+ // This sentences is used in the annotated class/file lists if no brief
+ // description is given.
+ { return "Keine Beschreibung verf&uuml;gbar"; }
+
+ // index titles (the project name is prepended for these)
+ QCString trDocumentation()
+ // This is used in HTML as the title of index.html.
+ { return "Dokumentation"; }
+ QCString trModuleIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // index of all groups.
+ { return "Modul-Verzeichnis"; }
+ QCString trHierarchicalIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // class hierarchy.
+ { return "Hierarchie-Verzeichnis"; }
+ QCString trCompoundIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // annotated compound index
+ { return "Compound-Verzeichnis"; }
+ QCString trFileIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // list of all files.
+ { return "Datei-Verzeichnis"; }
+ QCString trModuleDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all groups.
+ { return "Modul-Dokumentation"; }
+ QCString trClassDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all classes, structs and unions.
+ { return "Klassen-Dokumentation"; }
+ QCString trFileDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all files.
+ { return "Datei-Dokumentation"; }
+ QCString trExampleDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all examples.
+ { return "Dokumentation der Beispiele"; }
+ QCString trPageDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all related pages.
+ { return "Seitenbeschreibung"; }
+ QCString trReferenceManual()
+ // This is used in LaTeX as the title of the document
+ { return "Nachschlagewerk"; }
+
+ QCString trDefines()
+ // This is used in the documentation of a file as a header before the
+ // list of defines
+ { return "Makrodefinitionen"; }
+ QCString trFuncProtos()
+ // This is used in the documentation of a file as a header before the
+ // list of function prototypes
+ { return "Funktionsprototypen"; }
+ QCString trTypedefs()
+ // This is used in the documentation of a file as a header before the
+ // list of typedefs
+ { return "Typendefinitionen"; }
+ QCString trEnumerations()
+ // This is used in the documentation of a file as a header before the
+ // list of enumerations
+ { return "Aufz&auml;hlungen"; }
+ QCString trFunctions()
+ // This is used in the documentation of a file as a header before the
+ // list of (global) functions
+ { return "Funktionen"; }
+ QCString trVariables()
+ // This is used in the documentation of a file as a header before the
+ // list of (global) variables
+ { return "Variablen"; }
+ QCString trEnumerationValues()
+ // This is used in the documentation of a file as a header before the
+ // list of (global) variables
+ { return "Aufz&auml;hlungswerte"; }
+
+ QCString trAuthor()
+ // This is used in man pages as the author section.
+ { return "Autor"; }
+
+ QCString trDefineDocumentation()
+ // This is used in the documentation of a file before the list of
+ // documentation blocks for defines
+ { return "Makro-Dokumentation"; }
+ QCString trFunctionPrototypeDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for function prototypes
+ { return "Funktionsprototypen Dokumentation"; }
+ QCString trTypedefDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for typedefs
+ { return "Dokumentation der benutzerdefinerten Typen"; }
+ QCString trEnumerationTypeDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for enumeration types
+ { return "Dokumentation der Aufz&auml;hlungstypen"; }
+ QCString trEnumerationValueDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for enumeration values
+ { return "Dokumentation des Wertebereiches der Aufz&auml;hlungstypen"; }
+ QCString trFunctionDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for functions
+ { return "Dokumentation der Funktionen"; }
+ QCString trVariableDocumentation()
+ // This is used in the documentation of a file/namespace before the list
+ // of documentation blocks for variables
+ { return "Variablen-Dokumentation"; }
+ QCString trCompounds()
+ // This is used in the documentation of a file/namespace/group before
+ // the list of links to documented compounds
+ { return "&Uuml;bersicht"; }
+ QCString trFiles()
+ // This is used in the documentation of a group before the list of
+ // links to documented files
+ { return "Dateien"; }
+
+ QCString trGeneratedAt(const char *date,const char *projName)
+ {
+ QCString result=(QCString)"Erzeugt am "+date;
+ if (projName) result+=(QCString)" f&uuml;r "+projName;
+ result+=(QCString)" von";
+ return result;
+ }
+ QCString trWrittenBy()
+ {
+ return "geschrieben von";
+ }
+
+ QCString trClassDiagram(const char *clName)
+ // this text is put before a class diagram
+ {
+ return (QCString)"Klassendiagramm f&uuml;r "+clName;
+ }
+
+ QCString trForInternalUseOnly()
+ // this text is generated when the \internal command is used.
+ { return "Nur f&uuml;r den internen Gebrauch."; }
+ QCString trReimplementedForInternalReasons()
+ // this text is generated when the \reimp command is used.
+ { return "Aufgrund interner Gr&uuml;nde neu implementiert; "
+ "Das API wird davon nicht ber&uuml;hrt.";
+ }
+ QCString trWarning()
+ // this text is generated when the \warning command is used.
+ { return "Warnung"; }
+ QCString trBugsAndLimitations()
+ // this text is generated when the \bug command is used.
+ { return "Fehler und Einschr&auml;nkungen"; }
+ QCString trVersion()
+ // this text is generated when the \version command is used.
+ { return "Version"; }
+ QCString trDate()
+ // this text is generated when the \date command is used.
+ { return "Datum"; }
+ QCString trAuthors()
+ // this text is generated when the \author command is used.
+ { return "Autor(en)"; }
+ QCString trReturns()
+ // this text is generated when the \return command is used.
+ { return "R&uuml;ckgabe"; }
+ QCString trSeeAlso()
+ // this text is generated when the \sa command is used.
+ { return "Siehe auch"; }
+ QCString trParameters()
+ // this text is generated when the \param command is used.
+ { return "Parameter"; }
+ QCString trExceptions()
+ // this text is generated when the \exception command is used.
+ { return "Ausnahmebehandlung"; }
+ QCString trGeneratedBy()
+ // this text is used in the title page of a LaTeX document.
+ { return "Erzeugt von"; }
+
+ // new since 0.49-990307
+
+ QCString trNamespaceList()
+ // used as the title of page containing all the index of all namespaces.
+ { return ""; }
+ QCString trNamespaceListDescription(bool extractAll)
+ // used as an introduction to the namespace list
+ {
+ QCString result="Lister aller ";
+ if (!extractAll) result+="dokumentierter ";
+ result+="Namensbereiche mit Kurzbeschreibung:";
+ return result;
+ }
+ QCString trFriends()
+ // used in the class documentation as a header before the list of all
+ // friends of a class
+ { return "Freundbeziehungen"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990405
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trRelatedFunctionDocumentation()
+ // used in the class documentation as a header before the list of all
+ // related classes
+ { return "Freundbeziehungen und Funktionsdokumentation"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990425
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trCompoundReference(const char *clName,
+ ClassDef::CompoundType compType)
+ // used as the title of the HTML page of a class/struct/union
+ {
+ QCString result=(QCString)clName+" ";
+ switch(compType)
+ {
+ case ClassDef::Class: result+=" Klassen"; break;
+ case ClassDef::Struct: result+=" Strukturen"; break;
+ case ClassDef::Union: result+=" Varianten"; break;
+ }
+ result+="referenz";
+ return result;
+ }
+ QCString trFileReference(const char *fileName)
+ // used as the title of the HTML page of a file
+ {
+ QCString result=fileName;
+ result+=" Dateireferenz";
+ return result;
+ }
+ QCString trNamespaceReference(const char *namespaceName)
+ // used as the title of the HTML page of a namespace
+ {
+ QCString result=namespaceName;
+ result+=" Namensbereichsreferenz";
+ return result;
+ }
+
+ // these are for the member sections of a class, struct or union
+ QCString trPublicMembers()
+ { return "&Ouml;ffentliche Datenelemente"; }
+ QCString trPublicSlots()
+ { return "&Ouml;ffentliche Slots"; }
+ QCString trSignals()
+ { return "Signale"; }
+ QCString trStaticPublicMembers()
+ { return "&Ouml;ffentliche, statische Datenelemente"; }
+ QCString trProtectedMembers()
+ { return "Gesch&uuml;tzte Datenelemente"; }
+ QCString trProtectedSlots()
+ { return "Gesch&uuml;tzte Slots"; }
+ QCString trStaticProtectedMembers()
+ { return "Gesch&uuml;tzte, statische Datenelemente"; }
+ QCString trPrivateMembers()
+ { return "Private Datenelemente"; }
+ QCString trPrivateSlots()
+ { return "Private Slots"; }
+ QCString trStaticPrivateMembers()
+ { return "Private, statische Datenelemente"; }
+ // end of member sections
+
+ QCString trWriteList(int numEntries)
+ {
+ // this function is used to produce a comma-separated list of items.
+ // use generateMarker(i) to indicate where item i should be put.
+ QCString result;
+ int i;
+ // the inherits list contain `numEntries' classes
+ for (i=0;i<numEntries;i++)
+ {
+ // use generateMarker to generate placeholders for the class links!
+ result+=generateMarker(i); // generate marker for entry i in the list
+ // (order is left to right)
+
+ if (i!=numEntries-1) // not the last entry, so we need a separator
+ {
+ if (i<numEntries-2) // not the fore last entry
+ result+=", ";
+ else // the fore last entry
+ result+=", und ";
+ }
+ }
+ return result;
+ }
+
+ QCString trInheritsList(int numEntries)
+ // used in class documentation to produce a list of base classes,
+ // if class diagrams are disabled.
+ {
+ return "Abgeleitet von "+trWriteList(numEntries)+".";
+ }
+ QCString trInheritedByList(int numEntries)
+ // used in class documentation to produce a list of super classes,
+ // if class diagrams are disabled.
+ {
+ return "Basisklasse f&uuml;r "+trWriteList(numEntries)+".";
+ }
+ QCString trReimplementedFromList(int numEntries)
+ // used in member documentation blocks to produce a list of
+ // members that are hidden by this one.
+ {
+ return "Implementiert von "+trWriteList(numEntries)+".";
+ }
+ QCString trReimplementedInList(int numEntries)
+ {
+ // used in member documentation blocks to produce a list of
+ // all member that overwrite the implementation of this member.
+ return "Erneute Implementation in "+trWriteList(numEntries)+".";
+ }
+
+ QCString trNamespaceMembers()
+ // This is put above each page as a link to all members of namespaces.
+ { return "Elemente eines Namensbereiches"; }
+ QCString trNamespaceMemberDescription(bool extractAll)
+ // This is an introduction to the page with all namespace members
+ {
+ QCString result="Hier folgt die Aufz&auml;hlung aller ";
+ if (!extractAll) result+="dokumentierter ";
+ result+="Namensbereichselemente mit Verweisen auf ";
+ if (extractAll)
+ result+="die Namensbereichsdokumentation f&uuml;r jedes Element:";
+ else
+ result+="die zugeh&ouml;rigen Dateien:";
+ return result;
+ }
+ QCString trNamespaceIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // index of all namespaces.
+ { return "Verzeichnis der Namensbereiche"; }
+ QCString trNamespaceDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all namespaces.
+ { return "Dokumentation der Namensbereiche"; }
+};
+
+#endif
+
diff --git a/src/translator_es.h b/src/translator_es.h
new file mode 100644
index 0000000..9fcda7b
--- /dev/null
+++ b/src/translator_es.h
@@ -0,0 +1,405 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ */
+
+
+/**
+ * translator_es.h modifief by Francisco Oltra
+ * Some notes:
+ * - Computer related use of the spanish language differs from
+ * country to country, so some words might not sound so good
+ * to some people (but it does to me, *grin* ). A good example
+ * is the spanish for File: i use "Archivo", others may prefer
+ * "Fichero".
+ * - Some words were not translated for understandability, since
+ * we are talking about a computer program here!
+ * - Some of the functions are called in some order coherent with
+ * the english grammar, this results in some ugly constructs.
+ */
+
+#ifndef TRANSLATOR_ES_H
+#define TRANSLATOR_ES_H
+
+#include "translator.h"
+
+class TranslatorSpanish : public Translator
+{
+ public:
+ QCString latexBabelPackage()
+ { return "spanish"; }
+ QCString trRelatedFunctions()
+ { return "Funciones Relacionadas"; }
+ QCString trRelatedSubscript()
+ { return "(Note que estos no son funciones miembro.)"; }
+ QCString trDetailedDescription()
+ { return "Descripción Detallada"; }
+ QCString trMemberTypedefDocumentation()
+ { return "Documentación de Miembros Typedef"; }
+ QCString trMemberEnumerationDocumentation()
+ { return "Documentación de Miembros de Enumeración"; }
+ QCString trEnumerationValueDocumentation()
+ { return "Documentación de los Valores de Enumeración"; }
+ QCString trMemberFunctionDocumentation()
+ { return "Documentación de Funciones Miembro"; }
+ QCString trMemberDataDocumentation()
+ { return "Documentación de Datos Miembro"; }
+ QCString trGeneratedFrom(const char *s,bool single)
+ {
+ QCString result=(QCString)"La documentación para esta"+s+
+ " fue generada del siguiente archivo";
+ if (single) result+=":"; else result+="s:";
+ return result;
+ }
+ QCString trMore()
+ { return "Más..."; }
+ QCString trListOfAllMembers()
+ { return "Lista de todos los miembros."; }
+ QCString trMemberList()
+ { return "Lista de Miembros"; }
+ QCString trThisIsTheListOfAllMembers()
+ { return "Esta es la lista completa de miembros para "; }
+ QCString trIncludingInheritedMembers()
+ { return ", incluyendo todos los miembros heredados."; }
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result="Generado automáticamente por Doxygen";
+ if (s) result+=(QCString)" para "+s;
+ result+=" desde el código fuente.";
+ return result;
+ }
+ QCString trEnumName()
+ { return "nombre de enum"; }
+ QCString trEnumValue()
+ { return "valor de enum"; }
+ QCString trDefinedIn()
+ { return "definido en"; }
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Esto es texto verbatim del archivo incluído "+f+"."; }
+ QCString trModules()
+ { return "Modulos"; }
+ QCString trClassHierarchy()
+ { return "Jerarquía de la clase"; }
+ QCString trCompoundList()
+ { return "Lista de Tipos Compuestos"; }
+ QCString trFileList()
+ { return "Lista de Archivos"; }
+ QCString trHeaderFiles()
+ { return "Archivos de Cabecera"; }
+ QCString trCompoundMembers()
+ { return "Miembros de Compuestos"; }
+ QCString trFileMembers()
+ { return "Miembros de los Archivos"; }
+ QCString trRelatedPages()
+ { return "Páginas Relacionadas"; }
+ QCString trExamples()
+ { return "Ejemplos"; }
+ QCString trSearch()
+ { return "Buscar"; }
+ QCString trClassHierarchyDescription()
+ { return "Esta lista de herencia está ordenada alfabéticamente, "
+ "pero no completamente:";
+ }
+ QCString trFileListDescription(bool extractAll)
+ {
+ QCString result="Esta es una lista de todos ";
+ result+="los archivos ";
+ if (!extractAll) result+="documentados ";
+ result+="con breves descripciones:";
+ return result;
+ }
+ QCString trCompoundListDescription()
+ { return "Aquí estan las clases, estructuras y "
+ "uniones con descripciones breves:";
+ }
+ QCString trCompoundMembersDescription(bool extractAll)
+ {
+ QCString result="Esta es una lista de todos ";
+ result+="miembros de clases ";
+ if (!extractAll) result+="documentados ";
+ result+="con enlaces a ";
+ if (extractAll) result+="la documentación de clase para cada miembro:";
+ else result+="las clases a que pertenecen:";
+ return result;
+ }
+ QCString trFileMembersDescription(bool extractAll)
+ {
+ QCString result="Esta es una lista de todos los miembros de los archivos ";
+ if (!extractAll) result+="documentados ";
+ result+="con enlaces a ";
+ if (extractAll) result+="la documentación de archivo para cada miembro:";
+ else result+="los archivos a que pertenecen:";
+ return result;
+ }
+ QCString trHeaderFilesDescription()
+ { return "Aquí estan los archivos de cabecera que forman el API:"; }
+ QCString trExamplesDescription()
+ { return "Esta es la lista de todos los ejemplos:"; }
+ QCString trRelatedPagesDescription()
+ { return "Esta es una lista de todos las páginas con documentación relacionada:"; }
+ QCString trModulesDescription()
+ { return "Esta es una lista con todos los modulos:"; }
+ QCString trNoDescriptionAvailable()
+ { return "No existe descripción disponible"; }
+
+ QCString trDocumentation()
+ { return "Documentación"; }
+ QCString trModuleIndex()
+ { return "Índice de Modulos"; }
+ QCString trHierarchicalIndex()
+ { return "Índice Jerárquico"; }
+ QCString trCompoundIndex()
+ { return "Índice de Tipos Compuestos"; }
+ QCString trFileIndex()
+ { return "Índice de Archivos"; }
+ QCString trModuleDocumentation()
+ { return "Documentación de los Modulos"; }
+ QCString trClassDocumentation()
+ { return "Documentación de las clases"; }
+ QCString trFileDocumentation()
+ { return "Documentación de los Archivos"; }
+ QCString trExampleDocumentation()
+ { return "Documentación de los Ejemplos"; }
+ QCString trPageDocumentation()
+ { return "Documentación de las Páginas Relacionadas"; }
+ QCString trReferenceManual()
+ { return "Manual de Referencia"; }
+
+ QCString trDefines()
+ { return "Definiciones"; }
+ QCString trFuncProtos()
+ { return "Prototipo de Funciones"; }
+ QCString trTypedefs()
+ { return "Typedefs"; }
+ QCString trEnumerations()
+ { return "Enumeraciones"; }
+ QCString trFunctions()
+ { return "Funciones"; }
+ QCString trVariables()
+ { return "Variables"; }
+ QCString trEnumerationValues()
+ { return "Valores de Enumeraciones"; }
+ QCString trAuthor()
+ { return "Autor"; }
+ QCString trDefineDocumentation()
+ { return "Documentación de las Definiciones"; }
+ QCString trFunctionPrototypeDocumentation()
+ { return "Documentación de los Prototipos de Funciones"; }
+ QCString trTypedefDocumentation()
+ { return "Documentación de Typedefs"; }
+ QCString trEnumerationTypeDocumentation()
+ { return "Documentación de Enumeración de tipos"; }
+ QCString trFunctionDocumentation()
+ { return "Documentación de Funciones"; }
+ QCString trVariableDocumentation()
+ { return "Documentación de Variables"; }
+ QCString trCompounds()
+ { return "Tipos Compuestos"; }
+ QCString trFiles()
+ { return "Archivos"; }
+ QCString trGeneratedAt(const char *date,const char *projName)
+ {
+ QCString result=(QCString)"Generado el "+date;
+ if (projName) result+=(QCString)" para "+projName;
+ result+=(QCString)" por";
+ return result;
+ }
+ QCString trWrittenBy()
+ {
+ return "escrito por";
+ }
+ QCString trClassDiagram(const char *clName)
+ {
+ return (QCString)"Diagrama de clases para "+clName;
+ }
+
+ QCString trForInternalUseOnly()
+ { return "Para uso interno solamente."; }
+ QCString trReimplementedForInternalReasons()
+ { return "Reimplementado por razones internas; el API no se ve afectado.";
+ }
+ QCString trWarning()
+ { return "Atención"; }
+ QCString trBugsAndLimitations()
+ { return "Bugs y Limitaciones"; }
+ QCString trVersion()
+ { return "Versión"; }
+ QCString trDate()
+ { return "Fecha"; }
+ QCString trAuthors()
+ { return "Autor(es)"; }
+ QCString trReturns()
+ { return "Devuelve"; }
+ QCString trSeeAlso()
+ { return "Ver también"; }
+ QCString trParameters()
+ { return "Parámetros"; }
+ QCString trExceptions()
+ { return "Excepciones"; }
+ QCString trGeneratedBy()
+ { return "Generado por"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990307
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trNamespaceList()
+ { return "Lista de Namespaces"; }
+ QCString trNamespaceListDescription(bool extractAll)
+ {
+ QCString result="Esta es una lista de los namespaces ";
+ if (!extractAll) result+="documentados ";
+ result+="con descripciones breves:";
+ return result;
+ }
+ QCString trFriends()
+ { return "Clases Amigas"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990405
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trRelatedFunctionDocumentation()
+ { return "Documentación de Clases Amigas y Funciones Relacionadas"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990425
+//////////////////////////////////////////////////////////////////////////
+
+ virtual QCString trCompoundReference(const char *clName,
+ ClassDef::CompoundType compType)
+ // used as the title of the HTML page of a class/struct/union
+ {
+ QCString result=(QCString)clName+" ";
+ switch(compType)
+ {
+ case ClassDef::Class: result+=" Clase"; break;
+ case ClassDef::Struct: result+=" Estructura"; break;
+ case ClassDef::Union: result+=" Unión"; break;
+ }
+ result+=" Referencia";
+ return result;
+ }
+ virtual QCString trFileReference(const char *fileName)
+ // used as the title of the HTML page of a file
+ {
+ QCString result=fileName;
+ result+=" Referencia de Archivos";
+ return result;
+ }
+ virtual QCString trNamespaceReference(const char *namespaceName)
+ // used as the title of the HTML page of a namespace
+ {
+ QCString result=namespaceName;
+ result+=" Referencia de Namespace";
+ return result;
+ }
+
+ // these are for the member sections of a class, struct or union
+ virtual QCString trPublicMembers()
+ { return "Miembros Públicos"; }
+ virtual QCString trPublicSlots()
+ { return "Slots Públicos"; }
+ virtual QCString trSignals()
+ { return "Señales"; }
+ virtual QCString trStaticPublicMembers()
+ { return "Miembros Estáticos Públicos"; }
+ virtual QCString trProtectedMembers()
+ { return "Miembros Protegidos"; }
+ virtual QCString trProtectedSlots()
+ { return "Slots Protegidos"; }
+ virtual QCString trStaticProtectedMembers()
+ { return "Miembros Protegidos Estáticos"; }
+ virtual QCString trPrivateMembers()
+ { return "Miembros Privados"; }
+ virtual QCString trPrivateSlots()
+ { return "Slots Privados"; }
+ virtual QCString trStaticPrivateMembers()
+ { return "Miembros Estáticos Privados"; }
+ // end of member sections
+
+ virtual QCString trWriteList(int numEntries)
+ {
+ // this function is used to produce a comma-separated list of items.
+ // use generateMarker(i) to indicate where item i should be put.
+ QCString result;
+ int i;
+ // the inherits list contain `numEntries' classes
+ for (i=0;i<numEntries;i++)
+ {
+ // use generateMarker to generate placeholders for the class links!
+ result+=generateMarker(i); // generate marker for entry i in the list
+ // (order is left to right)
+
+ if (i!=numEntries-1) // not the last entry, so we need a separator
+ {
+ if (i<numEntries-2) // not the fore last entry
+ result+=", ";
+ else // the fore last entry
+ result+=" y ";
+ }
+ }
+ return result;
+ }
+
+ virtual QCString trInheritsList(int numEntries)
+ // used in class documentation to produce a list of base classes,
+ // if class diagrams are disabled.
+ {
+ return "Hereda a "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trInheritedByList(int numEntries)
+ // used in class documentation to produce a list of super classes,
+ // if class diagrams are disabled.
+ {
+ return "Heredado por "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trReimplementedFromList(int numEntries)
+ // used in member documentation blocks to produce a list of
+ // members that are hidden by this one.
+ {
+ return "Reimplementado por "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trReimplementedInList(int numEntries)
+ {
+ // used in member documentation blocks to produce a list of
+ // all member that overwrite the implementation of this member.
+ return "Reimplementado en "+trWriteList(numEntries)+".";
+ }
+
+ virtual QCString trNamespaceMembers()
+ // This is put above each page as a link to all members of namespaces.
+ { return "Miembros del Namespace"; }
+ virtual QCString trNamespaceMemberDescription(bool extractAll)
+ // This is an introduction to the page with all namespace members
+ {
+ QCString result="Esta es una lista de todos los miembros de namespace ";
+ if (!extractAll) result+="documentados ";
+ result+="con enlaces a ";
+ if (extractAll)
+ result+="a la documentación de namespaces para cada miembro:";
+ else
+ result+="los namespaces a los que pertenecen:";
+ return result;
+ }
+ virtual QCString trNamespaceIndex()
+ // This is used in LaTeX as the title of the chapter with the
+ // index of all namespaces.
+ { return "Índice de Namespaces"; }
+ virtual QCString trNamespaceDocumentation()
+ // This is used in LaTeX as the title of the chapter containing
+ // the documentation of all namespaces.
+ { return "Documentación de Namespaces"; }
+};
+
+#endif
diff --git a/src/translator_fr.h b/src/translator_fr.h
index 319f156..8214221 100644
--- a/src/translator_fr.h
+++ b/src/translator_fr.h
@@ -12,122 +12,124 @@
*
* All output generated with Doxygen is not covered by this license.
*
+ * The translation into French was provided by
+ * Christophe Bordeux (bordeux@lig.di.epfl.ch)
*/
#ifndef TRANSLATOR_FR_H
#define TRANSLATOR_FR_H
-#include <qstring.h>
+#include "translator.h"
class TranslatorFrench : public Translator
{
public:
- QString latexBabelPackage()
+ QCString latexBabelPackage()
{ return "french"; }
- QString trInherits()
+ QCString trInherits()
{ return "Hérite de"; }
- QString trAnd()
+ QCString trAnd()
{ return "et"; }
- QString trInheritedBy()
+ QCString trInheritedBy()
{ return "Dérivée par"; }
- QString trRelatedFunctions()
+ QCString trRelatedFunctions()
{ return "Fonctions associées"; }
- QString trRelatedSubscript()
+ QCString trRelatedSubscript()
{ return "(Noter que ces fonctions ne sont pas des méthodes de la classe)"; }
- QString trDetailedDescription()
+ QCString trDetailedDescription()
{ return "Description détaillée"; }
- QString trMemberTypedefDocumentation()
+ QCString trMemberTypedefDocumentation()
{ return "Documentation des types imbriqués"; }
- QString trMemberEnumerationDocumentation()
+ QCString trMemberEnumerationDocumentation()
{ return "Documentation des énumérations imbriqués"; }
- QString trMemberFunctionDocumentation()
+ QCString trMemberFunctionDocumentation()
{ return "Documentation des méthodes"; }
- QString trMemberDataDocumentation()
+ QCString trMemberDataDocumentation()
{ return "Documentation des données imbriqués"; }
- QString trGeneratedFrom(const char *s,bool single)
+ QCString trGeneratedFrom(const char *s,bool single)
{
- QString result=(QString)"La documentation pour cette"+s+
+ QCString result=(QCString)"La documentation pour cette"+s+
" a été générée à partir ";
if (single) result+="du fichier suivant:";
else result+="des fichiers suivants:";
return result;
}
- QString trMore()
+ QCString trMore()
{ return "Plus de détails..."; }
- QString trReference()
+ QCString trReference()
{ return "Référence"; }
- QString trListOfAllMembers()
+ QCString trListOfAllMembers()
{ return "Liste de tous les membres"; }
- QString trMemberList()
+ QCString trMemberList()
{ return "Liste des membres"; }
- QString trThisIsTheListOfAllMembers()
+ QCString trThisIsTheListOfAllMembers()
{ return "Ceci est la liste complète des membres de"; }
- QString trIncludingInheritedMembers()
+ QCString trIncludingInheritedMembers()
{ return "y compris des membres des classes héritées."; }
- QString trGeneratedAutomatically(const char *s)
- { QString result="Généré automatiquement par Doxygen";
- if (s) result+=(QString)" pour "+s;
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result="Généré automatiquement par Doxygen";
+ if (s) result+=(QCString)" pour "+s;
result+=" à partir du code source.";
return result;
}
- QString trEnumName()
+ QCString trEnumName()
{ return "énumération"; }
- QString trEnumValue()
+ QCString trEnumValue()
{ return "élément d'une énumération"; }
- QString trDefinedIn()
+ QCString trDefinedIn()
{ return "défini dans"; }
- QString trIncludeFile()
+ QCString trIncludeFile()
{ return "Fichier inclu"; }
- QString trVerbatimText(const char *f)
- { return (QString)"Ce texte provient du fichier inclu "+f+"."; }
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Ce texte provient du fichier inclu "+f+"."; }
- QString trModules()
+ QCString trModules()
{ return "Modules"; }
- QString trClassHierarchy()
+ QCString trClassHierarchy()
{ return "Hiérarchie des classes"; }
- QString trCompoundList()
+ QCString trCompoundList()
{ return "Liste des composants"; }
- QString trFileList()
+ QCString trFileList()
{ return "Liste des fichiers"; }
- QString trHeaderFiles()
+ QCString trHeaderFiles()
{ return "Fichiers d'entête"; }
- QString trCompoundMembers()
+ QCString trCompoundMembers()
{ return "Composants"; }
- QString trFileMembers()
+ QCString trFileMembers()
{ return "Déclarations"; }
- QString trRelatedPages()
+ QCString trRelatedPages()
{ return "Pages associées"; }
- QString trExamples()
+ QCString trExamples()
{ return "Exemples"; }
- QString trSearch()
+ QCString trSearch()
{ return "Recherche"; }
- QString trClassHierarchyDescription()
+ QCString trClassHierarchyDescription()
{ return "Cette liste d'héritage est, autant que possible, "
"classée par ordre alphabétique"; }
- QString trFileListDescription(bool extractAll)
+ QCString trFileListDescription(bool extractAll)
{
- QString result="Liste de tous les fichiers ";
+ QCString result="Liste de tous les fichiers ";
if (!extractAll) result+="documentés ";
result+="avec une brève description :";
return result;
}
- QString trCompoundListDescription()
+ QCString trCompoundListDescription()
{ return "Liste des classes, des strutures et des unions "
"avec une brève description :";
}
- QString trCompoundMembersDescription(bool extractAll)
+ QCString trCompoundMembersDescription(bool extractAll)
{
- QString result="Liste de tous les membres de classe ";
+ QCString result="Liste de tous les membres de classe ";
if (!extractAll) result+="documentés ";
result+="avec les liens vers ";
if (extractAll) result+="la documentation de la classe correspondante :";
else result+="les classes auxquelles ils appartiennent :";
return result;
}
- QString trFileMembersDescription(bool extractAll)
+ QCString trFileMembersDescription(bool extractAll)
{
- QString result="Liste de toutes les déclarations";
+ QCString result="Liste de toutes les déclarations";
if (!extractAll) result+="documentées ";
result+="avec liens sur ";
if (extractAll) result+="la documentation du fichier correspondant "
@@ -135,140 +137,140 @@ class TranslatorFrench : public Translator
else result+="les fichiers dans lesquels elles sont définies :";
return result;
}
- QString trHeaderFilesDescription()
+ QCString trHeaderFilesDescription()
{ return "Liste de tous les fichiers d'entête constituant "
"l'interface de programmation :"; }
- QString trExamplesDescription()
+ QCString trExamplesDescription()
{ return "Liste de tous les exemples :"; }
- QString trRelatedPagesDescription()
+ QCString trRelatedPagesDescription()
{ return "Liste de toutes les pages de documentation associées :"; }
- QString trModulesDescription()
+ QCString trModulesDescription()
{ return "Liste de tous les modules"; }
- QString trNoDescriptionAvailable()
+ QCString trNoDescriptionAvailable()
{ return "Aucune description n'est disponible"; }
- QString trDocumentation()
+ QCString trDocumentation()
{ return "Documentation"; }
- QString trModuleIndex()
+ QCString trModuleIndex()
{ return "Index des modules"; }
- QString trHierarchicalIndex()
+ QCString trHierarchicalIndex()
{ return "Index hiérarchique"; }
- QString trCompoundIndex()
+ QCString trCompoundIndex()
{ return "Index des composants"; }
- QString trFileIndex()
+ QCString trFileIndex()
{ return "Index des fichiers"; }
- QString trModuleDocumentation()
+ QCString trModuleDocumentation()
{ return "Documentation du module"; }
- QString trClassDocumentation()
+ QCString trClassDocumentation()
{ return "Documentation de la classe"; }
- QString trFileDocumentation()
+ QCString trFileDocumentation()
{ return "Documentation du fichier"; }
- QString trExampleDocumentation()
+ QCString trExampleDocumentation()
{ return "Documentation de l'exemple"; }
- QString trPageDocumentation()
+ QCString trPageDocumentation()
{ return "Documentation de la page"; }
- QString trReferenceManual()
+ QCString trReferenceManual()
{ return "Manuel de référence"; }
- QString trDefines()
+ QCString trDefines()
{ return "Définitions des macros"; }
- QString trFuncProtos()
+ QCString trFuncProtos()
{ return "Prototypes des fonctions"; }
- QString trTypedefs()
+ QCString trTypedefs()
{ return "Définitions des types"; }
- QString trEnumerations()
+ QCString trEnumerations()
{ return "Enumérations"; }
- QString trFunctions()
+ QCString trFunctions()
{ return "Fonctions"; }
- QString trVariables()
+ QCString trVariables()
{ return "Variables"; }
- QString trEnumerationValues()
+ QCString trEnumerationValues()
{ return "Eléments énumérés"; }
- QString trReimplementedFrom()
+ QCString trReimplementedFrom()
{ return "Redéfini à partir de"; }
- QString trReimplementedIn()
+ QCString trReimplementedIn()
{ return "Redéfini dans"; }
- QString trAuthor()
+ QCString trAuthor()
{ return "Auteur"; }
- QString trDefineDocumentation()
+ QCString trDefineDocumentation()
{ return "Documentation de la macro"; }
- QString trFunctionPrototypeDocumentation()
+ QCString trFunctionPrototypeDocumentation()
{ return "Documentation du prototype de la fonction"; }
- QString trTypedefDocumentation()
+ QCString trTypedefDocumentation()
{ return "Documentation du type"; }
- QString trEnumerationTypeDocumentation()
+ QCString trEnumerationTypeDocumentation()
{ return "Documentation du type de l'énumeration"; }
- QString trEnumerationValueDocumentation()
+ QCString trEnumerationValueDocumentation()
{ return "Documentation de l'élément de l'énumeration"; }
- QString trFunctionDocumentation()
+ QCString trFunctionDocumentation()
{ return "Documentation de la fonction"; }
- QString trVariableDocumentation()
+ QCString trVariableDocumentation()
{ return "Documentation de la variable"; }
- QString trCompounds()
+ QCString trCompounds()
{ return "Composants"; }
- QString trFiles()
+ QCString trFiles()
{ return "Fichiers"; }
- QString trGeneratedAt(const char *date,const char *projName)
+ QCString trGeneratedAt(const char *date,const char *projName)
{
- QString result=(QString)"Généré le "+date;
- if (projName) result+=(QString)" pour "+projName;
- result+=(QString)" par ";
+ QCString result=(QCString)"Généré le "+date;
+ if (projName) result+=(QCString)" pour "+projName;
+ result+=(QCString)" par ";
return result;
}
- QString trWrittenBy()
+ QCString trWrittenBy()
{
return "écrit par";
}
- QString trClassDiagram(const char *clName)
+ QCString trClassDiagram(const char *clName)
{
- return (QString)"Graphe d'héritage de la classe "+clName;
+ return (QCString)"Graphe d'héritage de la classe "+clName;
}
- QString trForInternalUseOnly()
+ QCString trForInternalUseOnly()
{ return "A usage interne uniquement."; }
- QString trReimplementedForInternalReasons()
+ QCString trReimplementedForInternalReasons()
{ return "Redéfini pour des raisons internes; "
"l'interface n'est pas modifiée";
}
- QString trWarning()
+ QCString trWarning()
{ return "Avertissement"; }
- QString trBugsAndLimitations()
+ QCString trBugsAndLimitations()
{ return "Bogues et limitations"; }
- QString trVersion()
+ QCString trVersion()
{ return "Version"; }
- QString trDate()
+ QCString trDate()
{ return "Date"; }
- QString trAuthors()
+ QCString trAuthors()
{ return "Auteur(s)"; }
- QString trReturns()
+ QCString trReturns()
{ return "Renvoie"; }
- QString trSeeAlso()
+ QCString trSeeAlso()
{ return "Voir également"; }
- QString trParameters()
+ QCString trParameters()
{ return "Paramètres"; }
- QString trExceptions()
+ QCString trExceptions()
{ return "Exceptions"; }
- QString trGeneratedBy()
+ QCString trGeneratedBy()
{ return "Généré par"; }
// new since 0.49-990307
- virtual QString trNamespaces()
+ virtual QCString trNamespaces()
{ return "Namespaces"; }
- virtual QString trNamespaceList()
+ virtual QCString trNamespaceList()
{ return "Liste des Namespaces"; }
- virtual QString trNamespaceListDescription(bool extractAll)
+ virtual QCString trNamespaceListDescription(bool extractAll)
{
- QString result="Liste de tous les namespaces ";
+ QCString result="Liste de tous les namespaces ";
if (!extractAll) result+="documentés ";
result+="avec une brève description :";
return result;
}
- virtual QString trFriends()
+ virtual QCString trFriends()
{ return "Friends"; }
// new since 0.49-990405
- virtual QString trRelatedFunctionDocumentation()
+ virtual QCString trRelatedFunctionDocumentation()
{ return "Documentation des fonctions amies et associées"; }
};
diff --git a/src/translator_it.h b/src/translator_it.h
index 316f43a..e2f76dc 100644
--- a/src/translator_it.h
+++ b/src/translator_it.h
@@ -4,6 +4,9 @@
*
* Copyright (C) 1997-1999 by Dimitri van Heesch.
*
+ * Initial Italian Translation by Ahmed Aldo Faisal
+ * Revised and completed by Alessandro Falappa (June 1999)
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
@@ -17,250 +20,360 @@
#ifndef TRANSLATOR_IT_H
#define TRANSLATOR_IT_H
-#include <qstring.h>
+#include "translator.h"
class TranslatorItalian : public Translator
{
public:
- QString latexBabelPackage()
+ QCString latexBabelPackage()
{ return "italian"; }
- QString trInherits()
+ QCString trInherits()
{ return "eredita"; }
- QString trAnd()
+ QCString trAnd()
{ return "e"; }
- QString trInheritedBy()
- { return "Ereditato da"; }
- QString trRelatedFunctions()
- { return "Funzioni relative"; }
- QString trRelatedSubscript()
- { return "(Nota che questo no sono funzioni membro)"; }
- QString trDetailedDescription()
+ QCString trInheritedBy()
+ //{ return "Ereditato da"; }
+ { return "Ereditate da"; }
+ QCString trRelatedFunctions()
+ //{ return "Funzioni relative"; }
+ { return "Funzioni collegate"; }
+ QCString trRelatedSubscript()
+ //{ return "(Nota che questo no sono funzioni membro)"; }
+ { return "(Attenzione, queste non sono funzioni membro)"; }
+ QCString trDetailedDescription()
{ return "Descrizione dettagliata"; }
- QString trMemberTypedefDocumentation()
- { return "Documentazione dei membri Typedef"; }
- QString trMemberEnumerationDocumentation()
- { return "Documentazione dei membri enumerati"; }
- QString trEnumerationValueDocumentation()
- { return "Documentazione dei tipi enumerati"; }
- QString trMemberFunctionDocumentation()
+ QCString trMemberTypedefDocumentation()
+ //{ return "Documentazione dei membri Typedef"; }
+ { return "Documentazione delle ridefinizioni dei tipi (typedef)"; }
+ QCString trMemberEnumerationDocumentation()
+ //{ return "Documentazione dei membri enumerati"; }
+ { return "Documentazione dei tipi enumerati (enum)"; }
+ QCString trEnumerationValueDocumentation()
+ { return "Documentazione dei valori dei tipi enumerati"; }
+ QCString trMemberFunctionDocumentation()
{ return "Documentazione delle funzioni membro"; }
- QString trMemberDataDocumentation()
+ QCString trMemberDataDocumentation()
{ return "Documentazione dei dati membro"; }
- QString trGeneratedFrom(const char *s,bool single)
+ QCString trGeneratedFrom(const char *s,bool single)
{
- QString result=(QString)"La documentazione di questa "+s+
- " e stata generata dal seguente file";
- if (single) result+=":"; else result+=":";
+ QCString result=(QCString)"La documentazione di questa "+s+
+ " è stata generata a partire";
+ if (single) result+=" dal seguente file:";
+ else result+=" dai seguenti files:";
return result;
}
- QString trMore()
+ QCString trMore()
{ return "Continua..."; }
- QString trReference()
+ QCString trReference()
{ return "Riferimento"; }
- QString trListOfAllMembers()
- { return "Lista di tuti i memberi."; }
- QString trMemberList()
- { return "Lista membri"; }
- QString trThisIsTheListOfAllMembers()
- { return "Questa e la lista completa di tutti i membri"; }
- QString trIncludingInheritedMembers()
- { return "includendo tutti i membri ereditati."; }
- QString trGeneratedAutomatically(const char *s)
- { QString result="Generato automaticalmenta da Doxygen";
- if (s) result+=(QString)" per "+s;
- result+=" dall codice.";
+ QCString trListOfAllMembers()
+ { return "Lista di tutti i membri."; }
+ QCString trMemberList()
+ { return "Lista dei membri"; }
+ QCString trThisIsTheListOfAllMembers()
+ { return "Questa è la lista completa di tutti i membri di "; }
+ QCString trIncludingInheritedMembers()
+ { return ", includendo tutti i membri ereditati."; }
+ QCString trGeneratedAutomatically(const char *s)
+ {
+ QCString result="Generato automaticamente da Doxygen";
+ if (s) result+=(QCString)" per "+s;
+ result+=" a partire dal codice sorgente.";
return result;
}
- QString trEnumName()
- { return "nome dell enum"; }
- QString trEnumValue()
- { return "valore dell enum"; }
- QString trDefinedIn()
+ QCString trEnumName()
+ { return "nome di tipo enumerato"; }
+ QCString trEnumValue()
+ { return "valore di tipo enumerato"; }
+ QCString trDefinedIn()
{ return "definito in"; }
- QString trIncludeFile()
+ QCString trIncludeFile()
{ return "Include il file"; }
- QString trVerbatimText(const char *f)
- { return (QString)"Questo e il contenuto verbatim dell file "+f+"."; }
- QString trModules()
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Questo è il contenuto integrale dell file "+f+"."; }
+ QCString trModules()
{ return "Moduli"; }
- QString trClassHierarchy()
- { return "gerarchia delle classi"; }
- QString trCompoundList()
- { return "Lista dei tipi composti"; }
- QString trFileList()
- { return "Lista dei file"; }
- QString trHeaderFiles()
- { return "List dei fei file header"; }
- QString trCompoundMembers()
- { return "Membri composti"; }
- QString trFileMembers()
- { return "Membri dell file"; }
- QString trRelatedPages()
- { return "Relativo a pagina"; }
- QString trExamples()
- { return "Esempio"; }
- QString trSearch()
- { return "Ricerca"; }
- QString trClassHierarchyDescription()
- { return "Qua sono la lista delle classi, structs e unions"
- "gesorte:";
+ QCString trClassHierarchy()
+ { return "Gerarchia delle classi"; }
+ QCString trCompoundList()
+ { return "Lista dei composti"; }
+ QCString trFileList()
+ { return "Lista dei files"; }
+ QCString trHeaderFiles()
+ { return "Lista dei file header"; }
+ QCString trCompoundMembers()
+ { return "Membri dei composti"; }
+ QCString trFileMembers()
+ { return "Membri dei files"; }
+ QCString trRelatedPages()
+ { return "Pagine collegate"; }
+ QCString trExamples()
+ { return "Esempi"; }
+ QCString trSearch()
+ { return "Cerca"; }
+ QCString trClassHierarchyDescription()
+ {
+ return "Questa lista di ereditarietà è ordinata "
+ "approssimativamente, ma non completamente, in ordine alfabetico:";
}
- QString trFileListDescription(bool extractAll)
+ QCString trFileListDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
- if (!extractAll) result+="gedocumenteerde ";
- result+="files, elk met een korte beschrijving:";
+ QCString result="Questa è una lista ";
+ if (!extractAll) result+="dei files documentati ";
+ else result+="di tutti i files ";
+ result+="con una loro breve descrizione:";
return result;
}
- QString trCompoundListDescription()
- { return "Hieronder volgen de klassen, structs en "
- "unions met voor elk een korte beschrijving:";
+ QCString trCompoundListDescription()
+ { return "Queste sono le classi, structs e "
+ "unions con una loro breve descrizione:";
}
- QString trCompoundMembersDescription(bool extractAll)
+ QCString trCompoundMembersDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
- if (!extractAll) result+="gedocumenteerde ";
- result+="klasse members met links naar ";
- if (extractAll) result+="de klasse Documentazione voor elke member:";
- else result+="de klassen waartoe ze behoren:";
+ QCString result="Questa è una lista ";
+ if (!extractAll) result+="dei membri documentati, ";
+ else result+="di tutti i membri ";
+ result+="con collegamenti ";
+ if (extractAll) result+="alla documentazione della classe di ciascun membro:";
+ else result+="alla documentazione delle classi a cui appartengono:";
return result;
}
- QString trFileMembersDescription(bool extractAll)
+ QCString trFileMembersDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
- if (!extractAll) result+="gedocumenteerde ";
- result+="file members met links naar ";
- if (extractAll) result+="de file Documentazione voor elke member:";
- else result+="de files waartoe ze behoren:";
+ QCString result="Questa è una lista ";
+ if (!extractAll) result+="dei membri dei files documentati, ";
+ else result+="di tutti i membri dei files ";
+ result+="con collegamenti ";
+ if (extractAll) result+="alla documentazione del file di ciascun membro:";
+ else result+="alla documentazione dei files a cui appartengono:";
return result;
}
- QString trHeaderFilesDescription()
- { return "Hieronder volgen de header files die de API vormen:"; }
- QString trExamplesDescription()
- { return "Hieronder volgt de lijst met alle voorbeelden:"; }
- QString trRelatedPagesDescription()
- { return "Hieronder volgt de lijst met alle pagina's die gerelateerde Documentazione bevatten:"; }
- QString trModulesDescription()
- { return "Hieronder volgt de lijst met alle modules:"; }
- QString trNoDescriptionAvailable()
- { return "Geen korte beschrijving beschikbaar"; }
+ QCString trHeaderFilesDescription()
+ { return "Questi sono gli header files che compongono l'API:"; }
+ QCString trExamplesDescription()
+ { return "Questa è la lista di tutti gli esempi:"; }
+ QCString trRelatedPagesDescription()
+ { return "Questa è la lista di tutte le pagine di documentazione collegate fra loro:"; }
+ QCString trModulesDescription()
+ { return "Questa è la lista di tutti i moduli:"; }
+ QCString trNoDescriptionAvailable()
+ { return "Descrizione non disponibile"; }
- QString trDocumentation()
+ QCString trDocumentation()
{ return "Documentazione"; }
- QString trModuleIndex()
- { return "Module Index"; }
- QString trHierarchicalIndex()
- { return "Hi&euml;rarchische Index"; }
- QString trCompoundIndex()
- { return "Compound Index"; }
- QString trFileIndex()
- { return "File Index"; }
- QString trModuleDocumentation()
- { return "Module Documentazione"; }
- QString trClassDocumentation()
- { return "Klasse Documentazione"; }
- QString trFileDocumentation()
- { return "File Documentazione"; }
- QString trExampleDocumentation()
- { return "Documentazione di voorbeelden"; }
- QString trPageDocumentation()
- { return "Documentazione di gerelateerde pagina's"; }
- QString trReferenceManual()
- { return "Naslagwerk"; }
+ QCString trModuleIndex()
+ { return "Indice dei moduli"; }
+ QCString trHierarchicalIndex()
+ { return "Indice della gerarchia"; }
+ QCString trCompoundIndex()
+ { return "Indice dei composti"; }
+ QCString trFileIndex()
+ { return "Indice dei files"; }
+ QCString trModuleDocumentation()
+ { return "Documentazione dei moduli"; }
+ QCString trClassDocumentation()
+ { return "Documentazione delle classi"; }
+ QCString trFileDocumentation()
+ { return "Documentazione dei files"; }
+ QCString trExampleDocumentation()
+ { return "Documentazione degli esempi"; }
+ QCString trPageDocumentation()
+ { return "Documentazione delle pagine"; }
+ QCString trReferenceManual()
+ { return "Manuale di riferimento"; }
- QString trDefines()
- { return "Defines"; }
- QString trFuncProtos()
- { return "Functie Prototypes"; }
- QString trTypedefs()
+ QCString trDefines()
+ { return "Definizioni"; }
+ QCString trFuncProtos()
+ { return "Prototipi delle funzioni"; }
+ QCString trTypedefs()
{ return "Typedefs"; }
- QString trEnumerations()
- { return "Enumeraties"; }
- QString trFunctions()
- { return "Functies"; }
- QString trVariables()
- { return "Variabelen"; }
- QString trEnumerationValues()
- { return "Enumeratie waarden"; }
- QString trReimplementedFrom()
- { return "Nieuwe implementatie di"; }
- QString trReimplementedIn()
- { return "Opnieuw ge&iuml;mplementeerd in"; }
- QString trAuthor()
- { return "auteur"; }
- QString trDefineDocumentation()
- { return "Lista "; }
- QString trFunctionPrototypeDocumentation()
- { return "Documentazione di functie Prototypes"; }
- QString trTypedefDocumentation()
- { return "Documentazione di typedefs"; }
- QString trEnumerationTypeDocumentation()
- { return "Documentazione di enumeratie types"; }
- QString trFunctionDocumentation()
- { return "Documentazione di functies"; }
- QString trVariableDocumentation()
- { return "Lista variabelen"; }
- QString trCompounds()
- { return "Compounds"; }
- QString trFiles()
+ QCString trEnumerations()
+ { return "Tipi enumerati"; }
+ QCString trFunctions()
+ { return "Funzioni"; }
+ QCString trVariables()
+ { return "Variabili"; }
+ QCString trEnumerationValues()
+ { return "Valori dei tipi enumerati"; }
+ QCString trReimplementedFrom()
+ { return "Nuova implementazione di"; }
+ QCString trReimplementedIn()
+ { return "Reimplementato in"; }
+ QCString trAuthor()
+ { return "Autore"; }
+ QCString trDefineDocumentation()
+ { return "Documentazione delle definizioni"; }
+ QCString trFunctionPrototypeDocumentation()
+ { return "Documentazione dei prototipi delle funzioni"; }
+ QCString trTypedefDocumentation()
+ { return "Documentazione dei typedefs"; }
+ QCString trEnumerationTypeDocumentation()
+ { return "Documentazione dei tipi enumerati"; }
+ QCString trFunctionDocumentation()
+ { return "Documentazione delle funzioni"; }
+ QCString trVariableDocumentation()
+ { return "Documentazione delle variabili"; }
+ QCString trCompounds()
+ { return "Composti"; }
+ QCString trFiles()
{ return "Files"; }
- QString trGeneratedAt(const char *date,const char *projName)
+ QCString trGeneratedAt(const char *date,const char *projName)
{
- QString result=(QString)"Gegenereerd op "+date;
- if (projName) result+=(QString)" voor "+projName;
- result+=(QString)" door";
+ QCString result=(QCString)"Generato il "+date;
+ if (projName) result+=(QCString)" per "+projName;
+ result+=(QCString)" da";
return result;
}
- QString trWrittenBy()
+ QCString trWrittenBy()
{
- return "geschreven door";
+ return "scritto da";
}
- QString trClassDiagram(const char *clName)
+ QCString trClassDiagram(const char *clName)
{
- return (QString)"Klasse diagram voor "+clName;
+ return (QCString)"Diagramma delle classi per "+clName;
}
- QString trForInternalUseOnly()
- { return "Alleen voor intern gebruik."; }
- QString trReimplementedForInternalReasons()
- { return "Om interne rederene opnieuwd ge&iuml;mplemented; "
- "de API wordt er niet door be&iuml;nvloed.";
+ QCString trForInternalUseOnly()
+ { return "Solo per uso interno."; }
+ QCString trReimplementedForInternalReasons()
+ { return "Reimplementato per motivi interni; "
+ "l'API non è stata modificata.";
}
- QString trWarning()
- { return "Waarschuwing"; }
- QString trBugsAndLimitations()
- { return "Fouten en beperkingen"; }
- QString trVersion()
- { return "Versie"; }
- QString trDate()
- { return "Datum"; }
- QString trAuthors()
- { return "Auteur(s)"; }
- QString trReturns()
- { return "Retourneerd"; }
- QString trSeeAlso()
- { return "Zie ook"; }
- QString trParameters()
- { return "Parameters"; }
- QString trExceptions()
- { return "Excepties"; }
- QString trGeneratedBy()
- { return "Gegenereerd door"; }
+ QCString trWarning()
+ { return "Attenzione"; }
+ QCString trBugsAndLimitations()
+ { return "Bugs e limitazioni"; }
+ QCString trVersion()
+ { return "Versione"; }
+ QCString trDate()
+ { return "Data"; }
+ QCString trAuthors()
+ { return "Autore(i)"; }
+ QCString trReturns()
+ { return "Restituisce"; }
+ QCString trSeeAlso()
+ { return "Vedi anche"; }
+ QCString trParameters()
+ { return "Parametri"; }
+ QCString trExceptions()
+ { return "Eccezioni"; }
+ QCString trGeneratedBy()
+ { return "Generato da"; }
- // new since 0.49-990307
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990307
+//////////////////////////////////////////////////////////////////////////
- QString trNamespaces()
+ QCString trNamespaces()
{ return "Namespaces"; }
- QString trNamespaceList()
- { return "Namespace Lijst"; }
- QString trNamespaceListDescription(bool extractAll)
+ QCString trNamespaceList()
+ { return "Lista dei namespaces"; }
+ QCString trNamespaceListDescription(bool extractAll)
{
- QString result="Hier is een lijst met alle ";
- if (!extractAll) result+="gedocumenteerde ";
- result+="namespaces met voor elk een korte beschrijving:";
+ QCString result="Questa è la lista ";
+ if (!extractAll) result+="dei namespaces documentati, ";
+ else result+="di tutti i namespaces ";
+ result+="con una loro breve descrizione:";
return result;
}
- QString trFriends()
+ QCString trFriends()
{ return "Friends"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990405
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trRelatedFunctionDocumentation()
+ { return "Documentazione dei friends e delle funzioni collegate"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990425
+//////////////////////////////////////////////////////////////////////////
+
+ QCString trCompoundReference(const char *clName,
+ ClassDef::CompoundType compType)
+ {
+ QCString result="Riferimenti per la";
+ switch(compType)
+ {
+ case ClassDef::Class: result+=" classe"; break;
+ case ClassDef::Struct: result+=" struct"; break;
+ case ClassDef::Union: result+=" union"; break;
+ }
+ result+=" "+(QCString)clName;
+ return result;
+ }
+ QCString trFileReference(const char *fileName)
+ {
+ QCString result="Riferimenti per il file ";
+ result+=(QCString)fileName;
+ return result;
+ }
+ QCString trNamespaceReference(const char *namespaceName)
+ {
+ QCString result="Riferimenti per il namespace ";
+ result+=(QCString)namespaceName;
+ return result;
+ }
+
+ // these are for the member sections of a class, struct or union
+ QCString trPublicMembers()
+ { return "Membri pubblici"; }
+ QCString trPublicSlots()
+ { return "Slots pubblici"; }
+ QCString trSignals()
+ { return "Signals"; }
+ QCString trStaticPublicMembers()
+ { return "Membri pubblici statici"; }
+ QCString trProtectedMembers()
+ { return "Membri protetti"; }
+ QCString trProtectedSlots()
+ { return "Slots protetti"; }
+ QCString trStaticProtectedMembers()
+ { return "Membri protetti statici"; }
+ QCString trPrivateMembers()
+ { return "Membri privati"; }
+ QCString trPrivateSlots()
+ { return "Slots privati"; }
+ QCString trStaticPrivateMembers()
+ { return "Membri privati statici"; }
+
+
+ QCString trInheritsList(int numEntries)
+ {
+ return "Eredita da "+trWriteList(numEntries)+".";
+ }
+ QCString trInheritedByList(int numEntries)
+ {
+ return "Base per "+trWriteList(numEntries)+".";
+ }
+ QCString trReimplementedFromList(int numEntries)
+ {
+ return "Reimplementa "+trWriteList(numEntries)+".";
+ }
+ QCString trReimplementedInList(int numEntries)
+ {
+ return "Reimplementata in "+trWriteList(numEntries)+".";
+ }
+
+ QCString trNamespaceMembers()
+ { return "Membri dei namespaces"; }
+ QCString trNamespaceMemberDescription(bool extractAll)
+ {
+ QCString result="Questa è la lista ";
+ if (!extractAll) result+="dei membri dei namespaces documentati, ";
+ else result+="di tutti i membri dei namespaces ";
+ result+="con collegamenti ";
+ if (extractAll)
+ result+="alla documentazione del namespace per ciascun membro:";
+ else
+ result+="ai namespaces a cui appartengono:";
+ return result;
+ }
+ QCString trNamespaceIndex()
+ { return "Indice dei namespaces"; }
+ QCString trNamespaceDocumentation()
+ { return "Documentazione dei namespaces"; }
};
#endif
diff --git a/src/translator_jp.h b/src/translator_jp.h
new file mode 100644
index 0000000..a2e2bfd
--- /dev/null
+++ b/src/translator_jp.h
@@ -0,0 +1,268 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-1999 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * All output generated with Doxygen is not covered by this license.
+ *
+ */
+
+#ifndef TRANSLATOR_JP_H
+#define TRANSLATOR_JP_H
+
+#include "translator.h"
+
+class TranslatorJapanese : public Translator
+{
+ public:
+ QCString latexBabelPackage()
+ { return "a4j"; }
+ QCString trInherits()
+ { return "·Ñ¾µ"; }
+ QCString trAnd()
+ { return "¤È"; }
+ QCString trInheritedBy()
+ { return "¼¡¤Ë·Ñ¾µ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£"; }
+ QCString trRelatedFunctions()
+ { return "´ØÏ¢¤¹¤ë´Ø¿ô"; }
+ QCString trRelatedSubscript()
+ { return "¡Ê¤³¤ì¤é¤Ï¥á¥ó¥Ð´Ø¿ô¤Ç¤Ê¤¤¤³¤È¤ËÃí°Õ¡Ë"; }
+ QCString trDetailedDescription()
+ { return "²òÀâ"; }
+ QCString trMemberTypedefDocumentation()
+ { return "¥á¥ó¥Ð·¿ÄêµÁ¤Î²òÀâ"; }
+ QCString trMemberEnumerationDocumentation()
+ { return "¥á¥ó¥ÐÎóµó·¿¤Î²òÀâ"; }
+ QCString trEnumerationValueDocumentation()
+ { return "Îóµó·¿ÃͤβòÀâ"; }
+ QCString trMemberFunctionDocumentation()
+ { return "¥á¥ó¥Ð´Ø¿ô¤Î²òÀâ"; }
+ QCString trMemberDataDocumentation()
+ { return "¥á¥ó¥Ð¥Ç¡¼¥¿¤Î²òÀâ"; }
+ QCString trGeneratedFrom(const char *s,bool)
+ {
+ QCString result=(QCString)"¤³¤Î"+s+
+ "¤ËÂФ¹¤ë¥É¥­¥å¥á¥ó¥È¤Ï°Ê²¼¤Î¥Õ¥¡¥¤¥ë¤«¤éÀ¸À®¤µ¤ì¤Þ¤·¤¿¡£";
+ return result;
+ }
+ QCString trMore()
+ { return "¤è¤ê¾Ü¤·¤¯..."; }
+ QCString trReference()
+ { return "¥ê¥Õ¥¡¥ì¥ó¥¹"; }
+ QCString trListOfAllMembers()
+ { return "¤¹¤Ù¤Æ¤Î¥á¥ó¥Ð¥ê¥¹¥È"; }
+ QCString trMemberList()
+ { return "¥á¥ó¥Ð¥ê¥¹¥È"; }
+ QCString trThisIsTheListOfAllMembers()
+ { return "¤³¤ì¤Ï¼¡¤ÎÁ´¥á¥ó¥Ð¥ê¥¹¥È¤Ç¤¹¡£"; }
+ QCString trIncludingInheritedMembers()
+ { return "·Ñ¾µ¥á¥ó¥Ð¤¹¤Ù¤Æ¤ò´Þ¤ó¤Ç¡£"; }
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result;
+ if (s) result=(QCString)s+"¤ËÂФ·¤Æ";
+ result+="¥½¡¼¥¹¥³¡¼¥É¤«¤é Doxygen ¤¬¼«Æ°Åª¤ËÀ¸À®¤·¤Þ¤·¤¿¡£";
+ return result;
+ }
+ QCString trEnumName()
+ { return "enum ·¿"; }
+ QCString trEnumValue()
+ { return "enum ÃÍ"; }
+ QCString trDefinedIn()
+ { return "¼¡¤ÇÄêµÁ¤µ¤ì¤Þ¤·¤¿¡£"; }
+ QCString trIncludeFile()
+ { return "¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë"; }
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"¤³¤ì¤Ï¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë"+f+
+ "¤Î Verbatim ¥Æ¥­¥¹¥È¤Ç¤¹¡£"; }
+ QCString trModules()
+ { return "¥â¥¸¥å¡¼¥ë"; }
+ QCString trClassHierarchy()
+ { return "¥¯¥é¥¹³¬ÁØ"; }
+ QCString trCompoundList()
+ { return "¥Ç¡¼¥¿¹½Â¤¥ê¥¹¥È"; }
+ QCString trFileList()
+ { return "¥Õ¥¡¥¤¥ë¥ê¥¹¥È"; }
+ QCString trHeaderFiles()
+ { return "¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë"; }
+ QCString trCompoundMembers()
+ { return "¥Ç¡¼¥¿¹½Â¤¥á¥ó¥Ð"; }
+ QCString trFileMembers()
+ { return "¥Õ¥¡¥¤¥ë¥á¥ó¥Ð"; }
+ QCString trRelatedPages()
+ { return "´ØÏ¢¥Ú¡¼¥¸"; }
+ QCString trExamples()
+ { return "Îã"; }
+ QCString trSearch()
+ { return "¸¡º÷"; }
+ QCString trClassHierarchyDescription()
+ { return "¤³¤Î·Ñ¾µ¥ê¥¹¥È¤Ï¤ª¤ª¤Þ¤«¤Ë¤Ï¥½¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢"
+ "¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¤Ç´°Á´¤Ë¥½¡¼¥È¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£";
+ }
+ QCString trFileListDescription(bool extractAll)
+ {
+ QCString result="¤³¤Î¥ê¥¹¥È¤Ï¡¢";
+ if (!extractAll) result+="¥É¥­¥å¥á¥ó¥È²½¤µ¤ì¡¢";
+ result+="´Ê°×ÀâÌÀ¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤¹¤Ù¤Æ¤Î¥ê¥¹¥È¤Ç¤¹¡£";
+ return result;
+ }
+ QCString trCompoundListDescription()
+ { return "¤³¤ì¤Ï´Ê°×ÀâÌÀ¤ò»ý¤Ä¡¢¥¯¥é¥¹¡¢¹½Â¤ÂΡ¢¶¦ÍÑÂΤΥꥹ¥È¤Ç¤¹¡£";}
+ QCString trCompoundMembersDescription(bool extractAll)
+ {
+ QCString result="¤³¤ì¤Ï";
+ if (!extractAll) result+="¥É¥­¥å¥á¥ó¥È²½¤µ¤ì¤¿";
+ result+="¥¯¥é¥¹¥á¥ó¥Ð¤¹¤Ù¤Æ¤Î¥ê¥¹¥È¤Ç¡¢¤½¤ì¤¾¤ì";
+ if (extractAll) result+="¤¬Â°¤·¤Æ¤¤¤ë¥¯¥é¥¹";
+ result+="¤Î²òÀâ¤Ø¤Î¥ê¥ó¥¯¤¬Ä¥¤é¤ì¤Æ¤¤¤Þ¤¹¡£";
+ return result;
+ }
+ QCString trFileMembersDescription(bool extractAll)
+ {
+ QCString result="¤³¤ì¤Ï";
+ if (!extractAll) result+="¥É¥­¥å¥á¥ó¥È²½¤µ¤ì¤¿";
+ result+="¥Õ¥¡¥¤¥ë¥á¥ó¥Ð¤¹¤Ù¤Æ¤Î¥ê¥¹¥È¤Ç¡¢¤½¤ì¤¾¤ì";
+ if (extractAll) result+="¤¬Â°¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë";
+ result+="¤Î²òÀâ¤Ø¤Î¥ê¥ó¥¯¤¬Ä¥¤é¤ì¤Æ¤¤¤Þ¤¹¡£";
+ return result;
+ }
+ QCString trHeaderFilesDescription()
+ { return "API¤ò¹½À®¤¹¤ë¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Ç¤¹¡£"; }
+ QCString trExamplesDescription()
+ { return "¤¹¤Ù¤Æ¤ÎÎã¤Î¥ê¥¹¥È¤Ç¤¹¡£"; }
+ QCString trRelatedPagesDescription()
+ { return "´ØÏ¢¤¹¤ë¥É¥­¥å¥á¥ó¥È¥Ú¡¼¥¸¤¹¤Ù¤Æ¤Î¥ê¥¹¥È¤Ç¤¹¡£"; }
+ QCString trModulesDescription()
+ { return "¤¹¤Ù¤Æ¤Î¥â¥¸¥å¡¼¥ë¤Î¥ê¥¹¥È¤Ç¤¹¡£"; }
+ QCString trNoDescriptionAvailable()
+ { return "¥É¥­¥å¥á¥ó¥È¤¬µ­½Ò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£"; }
+
+ QCString trDocumentation()
+ { return "¥É¥­¥å¥á¥ó¥È"; }
+ QCString trModuleIndex()
+ { return "¥â¥¸¥å¡¼¥ëº÷°ú"; }
+ QCString trHierarchicalIndex()
+ { return "³¬Áغ÷°ú"; }
+ QCString trCompoundIndex()
+ { return "¥Ç¡¼¥¿¹½Â¤º÷°ú"; }
+ QCString trFileIndex()
+ { return "¥Õ¥¡¥¤¥ëº÷°ú"; }
+ QCString trModuleDocumentation()
+ { return "¥â¥¸¥å¡¼¥ë¤Î²òÀâ"; }
+ QCString trClassDocumentation()
+ { return "¥¯¥é¥¹¤Î²òÀâ"; }
+ QCString trFileDocumentation()
+ { return "¥Õ¥¡¥¤¥ë¤Î²òÀâ"; }
+ QCString trExampleDocumentation()
+ { return "ÎãÂê¤Î²òÀâ"; }
+ QCString trPageDocumentation()
+ { return "¥Ú¡¼¥¸¤Î²òÀâ"; }
+ QCString trReferenceManual()
+ { return "¥ê¥Õ¥¡¥ì¥ó¥¹¥Þ¥Ë¥å¥¢¥ë"; }
+
+ QCString trDefines()
+ { return "¥Þ¥¯¥íÄêµÁ"; }
+ QCString trFuncProtos()
+ { return "´Ø¿ô¥×¥í¥È¥¿¥¤¥×"; }
+ QCString trTypedefs()
+ { return "·¿ÄêµÁ"; }
+ QCString trEnumerations()
+ { return "Îóµó·¿"; }
+ QCString trFunctions()
+ { return "´Ø¿ô"; }
+ QCString trVariables()
+ { return "ÊÑ¿ô"; }
+ QCString trEnumerationValues()
+ { return "Îóµó·¿ÃÍ"; }
+ QCString trReimplementedFrom()
+ { return "¼¡¤òºÆÄêµÁ"; }
+ QCString trReimplementedIn()
+ { return "¼¡¤ÇºÆÄêµÁ"; }
+ QCString trAuthor()
+ { return "ºî¼Ô"; }
+ QCString trDefineDocumentation()
+ { return "¥Þ¥¯¥íÄêµÁ¤Î²òÀâ"; }
+ QCString trFunctionPrototypeDocumentation()
+ { return "´Ø¿ô¥×¥í¥È¥¿¥¤¥×¤Î²òÀâ"; }
+ QCString trTypedefDocumentation()
+ { return "·¿ÄêµÁ¤Î²òÀâ"; }
+ QCString trEnumerationTypeDocumentation()
+ { return "Îóµó·¿¤Î²òÀâ"; }
+ QCString trFunctionDocumentation()
+ { return "´Ø¿ô¤Î²òÀâ"; }
+ QCString trVariableDocumentation()
+ { return "ÊÑ¿ô¤Î²òÀâ"; }
+ QCString trCompounds()
+ { return "¥Ç¡¼¥¿¹½Â¤"; }
+ QCString trFiles()
+ { return "¥Õ¥¡¥¤¥ë"; }
+ QCString trGeneratedAt(const char *date,const char *projName)
+ {
+ QCString result;
+ if (projName) result+=(QCString)projName+"¤ËÂФ·¤Æ";
+ result+=(QCString)date+"¤ËÀ¸À®¤µ¤ì¤Þ¤·¤¿¡£";
+ return result;
+ }
+ QCString trWrittenBy()
+ {
+ return "¤ò³«È¯¤·¤¿¤Î¤Ï";
+ }
+ QCString trClassDiagram(const char *clName)
+ {
+ return (QCString)clName+"¤ËÂФ¹¤ë¥¯¥é¥¹³¬ÁØ¿Þ";
+ }
+ QCString trForInternalUseOnly()
+ { return "ÆâÉô»ÈÍѤΤߡ£"; }
+ QCString trReimplementedForInternalReasons()
+ { return "ÆâÉôŪ¤ÊÍýͳ¤Ë¤è¤êºÆ¼ÂÁõ¤µ¤ì¤Þ¤·¤¿¤¬¡¢API¤Ë¤Ï±Æ¶Á¤·¤Þ¤»¤ó¡£";
+ }
+ QCString trWarning()
+ { return "Ãí°Õ"; }
+ QCString trBugsAndLimitations()
+ { return "¥Ð¥°¤ÈÀ©¸Â"; }
+ QCString trVersion()
+ { return "¥Ð¡¼¥¸¥ç¥ó"; }
+ QCString trDate()
+ { return "ÆüÉÕ"; }
+ QCString trAuthors()
+ { return "ºî¼Ô"; }
+ QCString trReturns()
+ { return "Ìá¤êÃÍ"; }
+ QCString trSeeAlso()
+ { return "»²¾È"; }
+ QCString trParameters()
+ { return "°ú¿ô"; }
+ QCString trExceptions()
+ { return "Îã³°"; }
+ QCString trGeneratedBy()
+ { return ""; }
+
+ // new since 0.49-990307
+
+ QCString trNamespaces()
+ { return "̾Á°¶õ´Ö"; }
+ QCString trNamespaceList()
+ { return "̾Á°¶õ´Ö¥ê¥¹¥È"; }
+ QCString trNamespaceListDescription(bool extractAll)
+ {
+ QCString result="¤³¤Î¥ê¥¹¥È¤Ï¡¢´Ê°×ÀâÌÀ¤ò»ý¤Ä¤¹¤Ù¤Æ¤Î";
+ if (!extractAll) result+="¥É¥­¥å¥á¥ó¥È²½¤µ¤ì¤¿";
+ result+="̾Á°¶õ´Ö¤Î¥ê¥¹¥È¤Ç¤¹¡£";
+ return result;
+ }
+ QCString trFriends()
+ { return "¥Õ¥ì¥ó¥É"; }
+
+ // new since 0.49-990405
+
+ virtual QCString trRelatedFunctionDocumentation()
+ { return "¥Õ¥ì¥ó¥É¤È´ØÏ¢¤¹¤ë´Ø¿ô¤Î²òÀâ"; }
+};
+
+#endif
diff --git a/src/translator_nl.h b/src/translator_nl.h
index c9a96bc..f5ceea9 100644
--- a/src/translator_nl.h
+++ b/src/translator_nl.h
@@ -17,253 +17,253 @@
#ifndef TRANSLATOR_NL_H
#define TRANSLATOR_NL_H
-#include <qstring.h>
+#include "translator.h"
class TranslatorDutch : public Translator
{
public:
- QString latexBabelPackage()
+ QCString latexBabelPackage()
{ return "dutch"; }
- QString trRelatedFunctions()
+ QCString trRelatedFunctions()
{ return "Gerelateerde functies"; }
- QString trRelatedSubscript()
+ QCString trRelatedSubscript()
{ return "(Merk op dat dit geen member functies zijn.)"; }
- QString trDetailedDescription()
+ QCString trDetailedDescription()
{ return "Gedetaileerde Beschrijving"; }
- QString trMemberTypedefDocumentation()
+ QCString trMemberTypedefDocumentation()
{ return "Documentatie van type definitie members"; }
- QString trMemberEnumerationDocumentation()
+ QCString trMemberEnumerationDocumentation()
{ return "Documentatie van enumeratie members"; }
- QString trEnumerationValueDocumentation()
+ QCString trEnumerationValueDocumentation()
{ return "Documentatie van enumeratie waarden"; }
- QString trMemberFunctionDocumentation()
+ QCString trMemberFunctionDocumentation()
{ return "Documentatie van functie members"; }
- QString trMemberDataDocumentation()
+ QCString trMemberDataDocumentation()
{ return "Documentatie van data members"; }
- QString trGeneratedFrom(const char *s,bool single)
+ QCString trGeneratedFrom(const char *s,bool single)
{
- QString result=(QString)"De documentatie voor deze"+s+
+ QCString result=(QCString)"De documentatie voor deze"+s+
" is gegenereerd op grond van de volgende file";
if (single) result+=":"; else result+="s:";
return result;
}
- QString trMore()
+ QCString trMore()
{ return "Meer..."; }
- QString trListOfAllMembers()
+ QCString trListOfAllMembers()
{ return "Lijst van alle members."; }
- QString trMemberList()
+ QCString trMemberList()
{ return "Member Lijst"; }
- QString trThisIsTheListOfAllMembers()
+ QCString trThisIsTheListOfAllMembers()
{ return "Dit is de complete lijst van alle members voor"; }
- QString trIncludingInheritedMembers()
+ QCString trIncludingInheritedMembers()
{ return ", inclusief alle overge&euml;rfde members."; }
- QString trGeneratedAutomatically(const char *s)
- { QString result="Automatisch gegenereerd door Doxygen";
- if (s) result+=(QString)" voor "+s;
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result="Automatisch gegenereerd door Doxygen";
+ if (s) result+=(QCString)" voor "+s;
result+=" uit de programmacode.";
return result;
}
- QString trEnumName()
+ QCString trEnumName()
{ return "enum naam"; }
- QString trEnumValue()
+ QCString trEnumValue()
{ return "enum waarde"; }
- QString trDefinedIn()
+ QCString trDefinedIn()
{ return "gedefinieerd in"; }
- QString trVerbatimText(const char *f)
- { return (QString)"Dit is de letterlijke tekst van de include file "+f+"."; }
- QString trModules()
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Dit is de letterlijke tekst van de include file "+f+"."; }
+ QCString trModules()
{ return "Modules"; }
- QString trClassHierarchy()
+ QCString trClassHierarchy()
{ return "Klasse Hi&euml;rarchie"; }
- QString trCompoundList()
+ QCString trCompoundList()
{ return "Compound Lijst"; }
- QString trFileList()
+ QCString trFileList()
{ return "File Lijst"; }
- QString trHeaderFiles()
+ QCString trHeaderFiles()
{ return "Header Lijst"; }
- QString trCompoundMembers()
+ QCString trCompoundMembers()
{ return "Compound Members"; }
- QString trFileMembers()
+ QCString trFileMembers()
{ return "File members"; }
- QString trRelatedPages()
+ QCString trRelatedPages()
{ return "Gerelateerde pagina's"; }
- QString trExamples()
+ QCString trExamples()
{ return "Voorbeelden"; }
- QString trSearch()
+ QCString trSearch()
{ return "Zoeken"; }
- QString trClassHierarchyDescription()
+ QCString trClassHierarchyDescription()
{ return "Deze inheritance lijst is min of meer alfabetisch "
"gesorteerd:";
}
- QString trFileListDescription(bool extractAll)
+ QCString trFileListDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
+ QCString result="Hieronder volgt de lijst met alle ";
if (!extractAll) result+="gedocumenteerde ";
result+="files, elk met een korte beschrijving:";
return result;
}
- QString trCompoundListDescription()
+ QCString trCompoundListDescription()
{ return "Hieronder volgen de klassen, structs en "
"unions met voor elk een korte beschrijving:";
}
- QString trCompoundMembersDescription(bool extractAll)
+ QCString trCompoundMembersDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
+ QCString result="Hieronder volgt de lijst met alle ";
if (!extractAll) result+="gedocumenteerde ";
result+="klasse members met links naar ";
if (extractAll) result+="de klasse documentatie voor elke member:";
else result+="de klassen waartoe ze behoren:";
return result;
}
- QString trFileMembersDescription(bool extractAll)
+ QCString trFileMembersDescription(bool extractAll)
{
- QString result="Hieronder volgt de lijst met alle ";
+ QCString result="Hieronder volgt de lijst met alle ";
if (!extractAll) result+="gedocumenteerde ";
result+="file members met links naar ";
if (extractAll) result+="de file documentatie voor elke member:";
else result+="de files waartoe ze behoren:";
return result;
}
- QString trHeaderFilesDescription()
+ QCString trHeaderFilesDescription()
{ return "Hieronder volgen de header files die de API vormen:"; }
- QString trExamplesDescription()
+ QCString trExamplesDescription()
{ return "Hieronder volgt de lijst met alle voorbeelden:"; }
- QString trRelatedPagesDescription()
+ QCString trRelatedPagesDescription()
{ return "Hieronder volgt de lijst met alle pagina's die gerelateerde documentatie bevatten:"; }
- QString trModulesDescription()
+ QCString trModulesDescription()
{ return "Hieronder volgt de lijst met alle modules:"; }
- QString trNoDescriptionAvailable()
+ QCString trNoDescriptionAvailable()
{ return "Geen korte beschrijving beschikbaar"; }
- QString trDocumentation()
+ QCString trDocumentation()
{ return "Documentatie"; }
- QString trModuleIndex()
+ QCString trModuleIndex()
{ return "Module Index"; }
- QString trHierarchicalIndex()
+ QCString trHierarchicalIndex()
{ return "Hi&euml;rarchische Index"; }
- QString trCompoundIndex()
+ QCString trCompoundIndex()
{ return "Compound Index"; }
- QString trFileIndex()
+ QCString trFileIndex()
{ return "File Index"; }
- QString trModuleDocumentation()
+ QCString trModuleDocumentation()
{ return "Module Documentatie"; }
- QString trClassDocumentation()
+ QCString trClassDocumentation()
{ return "Klasse Documentatie"; }
- QString trFileDocumentation()
+ QCString trFileDocumentation()
{ return "File Documentatie"; }
- QString trExampleDocumentation()
+ QCString trExampleDocumentation()
{ return "Documentatie van voorbeelden"; }
- QString trPageDocumentation()
+ QCString trPageDocumentation()
{ return "Documentatie van gerelateerde pagina's"; }
- QString trReferenceManual()
+ QCString trReferenceManual()
{ return "Naslagwerk"; }
- QString trDefines()
+ QCString trDefines()
{ return "Defines"; }
- QString trFuncProtos()
+ QCString trFuncProtos()
{ return "Functie Prototypes"; }
- QString trTypedefs()
+ QCString trTypedefs()
{ return "Typedefs"; }
- QString trEnumerations()
+ QCString trEnumerations()
{ return "Enumeraties"; }
- QString trFunctions()
+ QCString trFunctions()
{ return "Functies"; }
- QString trVariables()
+ QCString trVariables()
{ return "Variabelen"; }
- QString trEnumerationValues()
+ QCString trEnumerationValues()
{ return "Enumeratie waarden"; }
- QString trAuthor()
+ QCString trAuthor()
{ return "auteur"; }
- QString trDefineDocumentation()
+ QCString trDefineDocumentation()
{ return "Documentatie van defines"; }
- QString trFunctionPrototypeDocumentation()
+ QCString trFunctionPrototypeDocumentation()
{ return "Documentatie van functie Prototypes"; }
- QString trTypedefDocumentation()
+ QCString trTypedefDocumentation()
{ return "Documentatie van typedefs"; }
- QString trEnumerationTypeDocumentation()
+ QCString trEnumerationTypeDocumentation()
{ return "Documentatie van enumeratie types"; }
- QString trFunctionDocumentation()
+ QCString trFunctionDocumentation()
{ return "Documentatie van functies"; }
- QString trVariableDocumentation()
+ QCString trVariableDocumentation()
{ return "Documentatie van variabelen"; }
- QString trCompounds()
+ QCString trCompounds()
{ return "Compounds"; }
- QString trFiles()
+ QCString trFiles()
{ return "Files"; }
- QString trGeneratedAt(const char *date,const char *projName)
+ QCString trGeneratedAt(const char *date,const char *projName)
{
- QString result=(QString)"Gegenereerd op "+date;
- if (projName) result+=(QString)" voor "+projName;
- result+=(QString)" door";
+ QCString result=(QCString)"Gegenereerd op "+date;
+ if (projName) result+=(QCString)" voor "+projName;
+ result+=(QCString)" door";
return result;
}
- QString trWrittenBy()
+ QCString trWrittenBy()
{
return "geschreven door";
}
- QString trClassDiagram(const char *clName)
+ QCString trClassDiagram(const char *clName)
{
- return (QString)"Klasse diagram voor "+clName;
+ return (QCString)"Klasse diagram voor "+clName;
}
- QString trForInternalUseOnly()
+ QCString trForInternalUseOnly()
{ return "Alleen voor intern gebruik."; }
- QString trReimplementedForInternalReasons()
+ QCString trReimplementedForInternalReasons()
{ return "Om interne rederene opnieuwd ge&iuml;mplemented; "
"de API wordt er niet door be&iuml;nvloed.";
}
- QString trWarning()
+ QCString trWarning()
{ return "Waarschuwing"; }
- QString trBugsAndLimitations()
+ QCString trBugsAndLimitations()
{ return "Fouten en beperkingen"; }
- QString trVersion()
+ QCString trVersion()
{ return "Versie"; }
- QString trDate()
+ QCString trDate()
{ return "Datum"; }
- QString trAuthors()
+ QCString trAuthors()
{ return "Auteur(s)"; }
- QString trReturns()
+ QCString trReturns()
{ return "Retourneerd"; }
- QString trSeeAlso()
+ QCString trSeeAlso()
{ return "Zie ook"; }
- QString trParameters()
+ QCString trParameters()
{ return "Parameters"; }
- QString trExceptions()
+ QCString trExceptions()
{ return "Excepties"; }
- QString trGeneratedBy()
+ QCString trGeneratedBy()
{ return "Gegenereerd door"; }
//////////////////////////////////////////////////////////////////////////
// new since 0.49-990307
//////////////////////////////////////////////////////////////////////////
- QString trNamespaceList()
+ QCString trNamespaceList()
{ return "Namespace Lijst"; }
- QString trNamespaceListDescription(bool extractAll)
+ QCString trNamespaceListDescription(bool extractAll)
{
- QString result="Hier is een lijst met alle ";
+ QCString result="Hier is een lijst met alle ";
if (!extractAll) result+="gedocumenteerde ";
result+="namespaces met voor elk een korte beschrijving:";
return result;
}
- QString trFriends()
+ QCString trFriends()
{ return "Friends"; }
//////////////////////////////////////////////////////////////////////////
// new since 0.49-990405
//////////////////////////////////////////////////////////////////////////
- QString trRelatedFunctionDocumentation()
+ QCString trRelatedFunctionDocumentation()
{ return "Documentatie van friends en gerelateerde functies"; }
//////////////////////////////////////////////////////////////////////////
// new since 0.49-990425
//////////////////////////////////////////////////////////////////////////
- virtual QString trCompoundReference(const char *clName,
+ virtual QCString trCompoundReference(const char *clName,
ClassDef::CompoundType compType)
// used as the title of the HTML page of a class/struct/union
{
- QString result=(QString)clName+" ";
+ QCString result=(QCString)clName+" ";
switch(compType)
{
case ClassDef::Class: result+=" Class"; break;
@@ -273,49 +273,49 @@ class TranslatorDutch : public Translator
result+=" Referentie";
return result;
}
- virtual QString trFileReference(const char *fileName)
+ virtual QCString trFileReference(const char *fileName)
// used as the title of the HTML page of a file
{
- QString result=fileName;
+ QCString result=fileName;
result+=" File Referentie";
return result;
}
- virtual QString trNamespaceReference(const char *namespaceName)
+ virtual QCString trNamespaceReference(const char *namespaceName)
// used as the title of the HTML page of a namespace
{
- QString result=namespaceName;
+ QCString result=namespaceName;
result+=" Namespace Referentie";
return result;
}
// these are for the member sections of a class, struct or union
- virtual QString trPublicMembers()
+ virtual QCString trPublicMembers()
{ return "Public Members"; }
- virtual QString trPublicSlots()
+ virtual QCString trPublicSlots()
{ return "Public Slots"; }
- virtual QString trSignals()
+ virtual QCString trSignals()
{ return "Signals"; }
- virtual QString trStaticPublicMembers()
+ virtual QCString trStaticPublicMembers()
{ return "Static Public Members"; }
- virtual QString trProtectedMembers()
+ virtual QCString trProtectedMembers()
{ return "Protected Members"; }
- virtual QString trProtectedSlots()
+ virtual QCString trProtectedSlots()
{ return "Protected Slots"; }
- virtual QString trStaticProtectedMembers()
+ virtual QCString trStaticProtectedMembers()
{ return "Static Protected Members"; }
- virtual QString trPrivateMembers()
+ virtual QCString trPrivateMembers()
{ return "Private Members"; }
- virtual QString trPrivateSlots()
+ virtual QCString trPrivateSlots()
{ return "Private Slots"; }
- virtual QString trStaticPrivateMembers()
+ virtual QCString trStaticPrivateMembers()
{ return "Static Private Members"; }
// end of member sections
- virtual QString trWriteList(int numEntries)
+ virtual QCString trWriteList(int numEntries)
{
// this function is used to produce a comma-separated list of items.
// use generateMarker(i) to indicate where item i should be put.
- QString result;
+ QCString result;
int i;
// the inherits list contain `numEntries' classes
for (i=0;i<numEntries;i++)
@@ -335,38 +335,38 @@ class TranslatorDutch : public Translator
return result;
}
- virtual QString trInheritsList(int numEntries)
+ virtual QCString trInheritsList(int numEntries)
// used in class documentation to produce a list of base classes,
// if class diagrams are disabled.
{
return "Erft over van "+trWriteList(numEntries)+".";
}
- virtual QString trInheritedByList(int numEntries)
+ virtual QCString trInheritedByList(int numEntries)
// used in class documentation to produce a list of super classes,
// if class diagrams are disabled.
{
return "Wordt overge&euml;rfd door "+trWriteList(numEntries)+".";
}
- virtual QString trReimplementedFromList(int numEntries)
+ virtual QCString trReimplementedFromList(int numEntries)
// used in member documentation blocks to produce a list of
// members that are hidden by this one.
{
return "Nieuwe implementatie van "+trWriteList(numEntries)+".";
}
- virtual QString trReimplementedInList(int numEntries)
+ virtual QCString trReimplementedInList(int numEntries)
{
// used in member documentation blocks to produce a list of
// all member that overwrite the implementation of this member.
return "Opnieuw ge&iuml;mplementeerd in "+trWriteList(numEntries)+".";
}
- virtual QString trNamespaceMembers()
+ virtual QCString trNamespaceMembers()
// This is put above each page as a link to all members of namespaces.
{ return "Namespace Members"; }
- virtual QString trNamespaceMemberDescription(bool extractAll)
+ virtual QCString trNamespaceMemberDescription(bool extractAll)
// This is an introduction to the page with all namespace members
{
- QString result="Hier is een lijst van alle ";
+ QCString result="Hier is een lijst van alle ";
if (!extractAll) result+="gedocumenteerde ";
result+="namespace members met links naar ";
if (extractAll)
@@ -375,11 +375,11 @@ class TranslatorDutch : public Translator
result+="de namespaces waartoe ze behoren:";
return result;
}
- virtual QString trNamespaceIndex()
+ virtual QCString trNamespaceIndex()
// This is used in LaTeX as the title of the chapter with the
// index of all namespaces.
{ return "Namespace Index"; }
- virtual QString trNamespaceDocumentation()
+ virtual QCString trNamespaceDocumentation()
// This is used in LaTeX as the title of the chapter containing
// the documentation of all namespaces.
{ return "Namespace Documentatie"; }
diff --git a/src/translator_se.h b/src/translator_se.h
index 4f24e0f..761d81d 100644
--- a/src/translator_se.h
+++ b/src/translator_se.h
@@ -14,245 +14,484 @@
*
*/
-/*-------------------------------------------------------------------------
+/*
+==================================================================================
Svensk översättning av:
Samuel Hägglund <sahag96@ite.mh.se>
Xet Erixon <xet@xeqt.com>
+==================================================================================
+Uppdateringar.
+1999/04/29
+* Omskrivningar av en hel del ordval, t.ex.
+ ENG INNAN EFTER
+ compound inhängnad sammansatt
+ structs structs strukter
+ unions unions unioner
-Skicka gärna synpunkter.
---------------------------------------------------------------------------*/
+ osv...
+
+* Alla översättnings-strängar returnerar i alla fall en något så när vettig
+ förklaring...
+
+1999/05/27
+* Det verkade som vi glömt en del mellanslag i vissa strängar vilket resulterade
+ i att en del ord blev ihopskrivna.
+
+* Bytt en del ordval igen...
+ ENG INNAN EFTER
+ reference manual Uppslagsbok referensmanual
+
+* Skrivit ihop en del ord som innan hade bindestreck
+* En del nya översättningar är tillagda.
+* Gamla översättningar borttagna
+
+===================================================================================
+Problem!
+ Namespace och slot: har de nån hygglig svensk översättning???
+
+ Skicka gärna synpunkter.
+===================================================================================
+*/
#ifndef TRANSLATOR_SE_H
#define TRANSLATOR_SE_H
-#include <qstring.h>
+#include "translator.h"
class TranslatorSwedish : public Translator
{
public:
- QString latexBabelPackage()
+ QCString latexBabelPackage()
{ return "swedish"; }
- QString trInherits()
- { return "Ärver"; }
- QString trAnd()
- { return "och"; }
- QString trInheritedBy()
- { return "Ärvd av"; }
- QString trRelatedFunctions()
+
+ QCString trRelatedFunctions()
{ return "Besläktade funktioner"; }
- QString trRelatedSubscript()
+
+ QCString trRelatedSubscript()
{ return "(Observera att dessa inte är medlemsfunktioner)"; }
- QString trDetailedDescription()
+
+ QCString trDetailedDescription()
{ return "Detaljerad beskrivning"; }
- QString trMemberTypedefDocumentation()
+
+ QCString trMemberTypedefDocumentation()
{ return "Dokumentation över typdefinierade medlemmar"; }
- QString trMemberEnumerationDocumentation()
+
+ QCString trMemberEnumerationDocumentation()
{ return "Dokumentation över egenuppräknande medlemmar"; }
- QString trMemberFunctionDocumentation()
+
+ QCString trMemberFunctionDocumentation()
{ return "Dokumentation över medlemsfunktioner"; }
- QString trMemberDataDocumentation()
+
+ QCString trMemberDataDocumentation()
{ return "Dokumentation över datamedlemmar"; }
- QString trGeneratedFrom(const char *s,bool single)
+
+ QCString trGeneratedFrom(const char *s,bool single)
{
- QString result=(QString)"Dokumentationen för denna"+s+
+
+ QCString result=(QCString)"Dokumentationen för denna"+s+
" är skapad utifrån följande fil";
if (single) result+=":"; else result+="er:";
return result;
}
- QString trMore()
+ QCString trMore()
{ return "Mer..."; }
- QString trReference()
- { return "Referens"; }
- QString trListOfAllMembers()
+
+ QCString trListOfAllMembers()
{ return "Lista över alla medlemmar."; }
- QString trMemberList()
+
+ QCString trMemberList()
{ return "Medlemslista"; }
- QString trThisIsTheListOfAllMembers()
- { return "Det här är en fullständig lista över medlemmar för"; }
- QString trIncludingInheritedMembers()
- { return "med alla ärvda medlemmar."; }
- QString trGeneratedAutomatically(const char *s)
- { QString result="Automatiskt skapad av Doxygen";
- if (s) result+=(QString)" för "+s;
+
+ QCString trThisIsTheListOfAllMembers()
+ { return "Det här är en fullständig lista över medlemmar för "; }
+
+ QCString trIncludingInheritedMembers()
+ { return " med alla ärvda medlemmar."; }
+
+ QCString trGeneratedAutomatically(const char *s)
+ { QCString result="Automatiskt skapad av Doxygen";
+ if (s) result+=(QCString)" för "+s;
result+=" från källkoden.";
return result;
}
- QString trEnumName()
+
+ QCString trEnumName()
{ return "enum namn"; }
- QString trEnumValue()
+
+ QCString trEnumValue()
{ return "enum värde"; }
- QString trDefinedIn()
- { return "deklarerad i"; }
- QString trIncludeFile()
- { return "Inkluderingsfil"; }
- QString trVerbatimText(const char *f)
- { return (QString)"Detta är den ordagranna texten från inkluderingsfilen"+f; }
- QString trModules()
+
+ QCString trDefinedIn()
+ { return "definierad i"; }
+
+
+ QCString trVerbatimText(const char *f)
+ { return (QCString)"Detta är den ordagranna texten från inkluderingsfilen "+f; }
+
+ QCString trModules()
{ return "Moduler"; }
- QString trClassHierarchy()
+
+ QCString trClassHierarchy()
{ return "Klasshierarki"; }
- QString trCompoundList()
+
+ QCString trCompoundList()
{ return "Sammansatt klasslista"; }
- QString trFileList()
+
+ QCString trFileList()
{ return "Fillista"; }
- QString trHeaderFiles()
+
+ QCString trHeaderFiles()
{ return "Headerfiler"; }
- QString trCompoundMembers()
+
+ QCString trCompoundMembers()
{ return "Sammansatta klassmedlemmar"; }
- QString trFileMembers()
+
+ QCString trFileMembers()
{ return "Filmedlemmar"; }
- QString trRelatedPages()
+
+ QCString trRelatedPages()
{ return "Besläktade sidor"; }
- QString trExamples()
+
+ QCString trExamples()
{ return "Exempel"; }
- QString trSearch()
+
+ QCString trSearch()
{ return "Sök"; }
- QString trClassHierarchyDescription()
+
+ QCString trClassHierarchyDescription()
{ return "Denna lista över arv är grovt, men inte helt, "
"sorterad i alfabetisk ordning:";
}
- QString trFileListDescription(bool extractAll)
+
+ QCString trFileListDescription(bool extractAll)
{
- QString result="Här följer en lista över alla ";
+ QCString result="Här följer en lista över alla ";
if (!extractAll) result+="dokumenterade ";
result+="filer, med en kort beskrivning:";
return result;
}
- QString trCompoundListDescription()
- { return "Här följer klasserna, structerna och "
+
+ QCString trCompoundListDescription()
+ { return "Här följer klasserna, strukterna och "
"unionerna med en kort beskrivning:";
}
- QString trCompoundMembersDescription(bool extractAll)
+
+ QCString trCompoundMembersDescription(bool extractAll)
{
- QString result="Här följer en lista över alla ";
+
+ QCString result="Här följer en lista över alla ";
if (!extractAll) result+="dokumenterade ";
result+="klassmedlemmar med länkar till ";
if (extractAll) result+="klassdokumentationen för varje medlem:";
else result+="klasserna som de tillhör:";
return result;
}
- QString trFileMembersDescription(bool extractAll)
+
+ QCString trFileMembersDescription(bool extractAll)
{
- QString result="Här följer en lista över alla ";
+ QCString result="Här följer en lista över alla ";
if (!extractAll) result+="dokumenterade ";
result+="filmedlemmar med länkar till ";
if (extractAll) result+="dokumentationsfilen för varje medlem:";
else result+="filerna som de tillhör:";
return result;
}
- QString trHeaderFilesDescription()
+
+ QCString trHeaderFilesDescription()
{ return "Här följer headerfilerna som API:n består av:"; }
- QString trExamplesDescription()
+
+ QCString trExamplesDescription()
{ return "Här följer en lista med alla exempel:"; }
- QString trRelatedPagesDescription()
- { return "Här följer en lista över alla relaterade dokumentationssidor:";
-} QString trModulesDescription()
+
+ QCString trRelatedPagesDescription()
+ { return "Här följer en lista över alla besläktade dokumentationssidor:";}
+
+ QCString trModulesDescription()
{ return "Här följer en lista över alla moduler:"; }
- QString trNoDescriptionAvailable()
+
+ QCString trNoDescriptionAvailable()
{ return "Beskrivning saknas"; }
- QString trDocumentation()
+ QCString trDocumentation()
{ return "Dokumentation"; }
- QString trModuleIndex()
- { return "Modul Index"; }
- QString trHierarchicalIndex()
+
+ QCString trModuleIndex()
+ { return "Modulindex"; }
+
+ QCString trHierarchicalIndex()
{ return "Hierarkiskt Index"; }
- QString trCompoundIndex()
+
+ QCString trCompoundIndex()
{ return "Sammansatt Index"; }
- QString trFileIndex()
- { return "Fil Index"; }
- QString trModuleDocumentation()
+
+ QCString trFileIndex()
+ { return "Filindex"; }
+
+ QCString trModuleDocumentation()
{ return "Dokumentation över moduler"; }
- QString trClassDocumentation()
+
+ QCString trClassDocumentation()
{ return "Dokumentation över klasser"; }
- QString trFileDocumentation()
+
+ QCString trFileDocumentation()
{ return "Dokumentation över filer"; }
- QString trExampleDocumentation()
+
+ QCString trExampleDocumentation()
{ return "Dokumentation över exempel"; }
- QString trPageDocumentation()
+
+ QCString trPageDocumentation()
{ return "Dokumentation av sidor"; }
- QString trReferenceManual()
- { return "Uppslagsbok"; }
- QString trDefines()
+ QCString trReferenceManual()
+ { return "Referensmanual"; }
+
+ QCString trDefines()
{ return "Definitioner"; }
- QString trFuncProtos()
+ QCString trFuncProtos()
{ return "Funktionsprototyper"; }
- QString trTypedefs()
+ QCString trTypedefs()
{ return "Typdefinitioner"; }
- QString trEnumerations()
+ QCString trEnumerations()
{ return "Egenuppräknande typer"; }
- QString trFunctions()
+ QCString trFunctions()
{ return "Funktioner"; }
- QString trVariables()
+
+ QCString trVariables()
{ return "Variabler"; }
- QString trEnumerationValues()
- { return "Egenuppräknade värden"; }
- QString trReimplementedFrom()
- { return "Återanvänd från"; }
- QString trReimplementedIn()
- { return "Återanvänd i"; }
- QString trAuthor()
+
+ QCString trEnumerationValues()
+ { return "Egenuppräknade typers värden"; }
+
+ QCString trAuthor()
{ return "Författare"; }
- QString trDefineDocumentation()
+
+ QCString trDefineDocumentation()
{ return "Dokumentation över definitioner"; }
- QString trFunctionPrototypeDocumentation()
+
+ QCString trFunctionPrototypeDocumentation()
{ return "Dokumentation över funktionsprototyper"; }
- QString trTypedefDocumentation()
+
+ QCString trTypedefDocumentation()
{ return "Dokumentation över typdefinitioner"; }
- QString trEnumerationTypeDocumentation()
- { return "Dokumentation över egenuppräknande typer (enum)"; }
- QString trEnumerationValueDocumentation()
+
+ QCString trEnumerationTypeDocumentation()
+ { return "Dokumentation över egenuppräknande typer"; }
+
+ QCString trEnumerationValueDocumentation()
{ return "Dokumentation över egenuppräknande typers värden"; }
- QString trFunctionDocumentation()
+
+ QCString trFunctionDocumentation()
{ return "Dokumentation över funktioner"; }
- QString trVariableDocumentation()
+
+ QCString trVariableDocumentation()
{ return "Dokumentation över variabler"; }
- QString trCompounds()
+
+ QCString trCompounds()
{ return "Sammansättning"; }
- QString trFiles()
+
+ QCString trFiles()
{ return "Filer"; }
- QString trGeneratedAt(const char *date,const char *projName)
- {
- QString result=(QString)"Skapad "+date;
- if (projName) result+=(QString)" för "+projName;
- result+=(QString)" av";
+
+ QCString trGeneratedAt(const char *date,const char *projName)
+ {
+ QCString result=(QCString)"Skapad "+date;
+ if (projName) result+=(QCString)" för "+projName;
+ result+=(QCString)" av";
return result;
}
- QString trWrittenBy()
+
+ QCString trWrittenBy()
{
return "skriven av";
}
- QString trClassDiagram(const char *clName)
+
+ QCString trClassDiagram(const char *clName)
{
- return (QString)"Klass-diagram för "+clName;
+ return (QCString)"Klassdiagram för "+clName;
}
- QString trForInternalUseOnly()
+
+ QCString trForInternalUseOnly()
{ return "Endast för internt bruk."; }
- QString trReimplementedForInternalReasons()
- { return "Omskriven av intern anledning ; "
- "API:n påverkas inte.";
- }
- QString trWarning()
+
+ QCString trReimplementedForInternalReasons()
+ { return "Omskriven av intern anledning ; API:n påverkas inte.";}
+
+ QCString trWarning()
{ return "Varning"; }
- QString trBugsAndLimitations()
+
+ QCString trBugsAndLimitations()
{ return "Fel och begränsningar"; }
- QString trVersion()
+
+ QCString trVersion()
{ return "Version"; }
- QString trDate()
+
+ QCString trDate()
{ return "Datum"; }
- QString trAuthors()
+
+ QCString trAuthors()
{ return "Författare"; }
- QString trReturns()
+
+ QCString trReturns()
{ return "Returnerar"; }
- QString trSeeAlso()
+
+ QCString trSeeAlso()
{ return "Se även"; }
- QString trParameters()
+
+ QCString trParameters()
{ return "Parametrar"; }
- QString trExceptions()
+
+ QCString trExceptions()
{ return "Undantag"; }
- QString trGeneratedBy()
+
+ QCString trGeneratedBy()
{ return "Skapad av"; }
+
+// new since 0.49-990307
+
+ virtual QCString trNamespaceList()
+ { return "Namespacelista"; }
+
+ virtual QCString trNamespaceListDescription(bool extractAll)
+ {
+ QCString result="Här är en lista över alla ";
+ if (!extractAll) result+="dokumenterade ";
+ result+="namespaces med en kort förklaring:";
+ return result;
+ }
+
+ virtual QCString trFriends()
+ { return "Vänner"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990405
+//////////////////////////////////////////////////////////////////////////
+
+ virtual QCString trRelatedFunctionDocumentation()
+ { return "Vänners och besläktade funktioners dokumentation"; }
+
+//////////////////////////////////////////////////////////////////////////
+// new since 0.49-990425
+//////////////////////////////////////////////////////////////////////////
+
+ virtual QCString trCompoundReference(const char *clName,
+ ClassDef::CompoundType compType)
+ {
+ QCString result=(QCString)clName+" ";
+ switch(compType)
+ {
+ case ClassDef::Class: result+=" Klass"; break;
+ case ClassDef::Struct: result+=" Strukt"; break;
+ case ClassDef::Union: result+=" Union"; break;
+ }
+ result+="referens";
+ return result;
+ }
+
+ virtual QCString trFileReference(const char *fileName)
+ {
+ QCString result=fileName;
+ result+=" filreferens";
+ return result;
+ }
+
+ virtual QCString trNamespaceReference(const char *namespaceName)
+ {
+ QCString result=namespaceName;
+ result+=" namespacereferens";
+ return result;
+ }
+
+ virtual QCString trPublicMembers()
+ { return "Publika medlemmar"; }
+ virtual QCString trPublicSlots()
+ { return "Publika slots"; }
+ virtual QCString trSignals()
+ { return "Signaler"; }
+ virtual QCString trStaticPublicMembers()
+ { return "Statiska publika medlemmar"; }
+ virtual QCString trProtectedMembers()
+ { return "Skyddade medlemmar"; }
+ virtual QCString trProtectedSlots()
+ { return "Skyddade slots"; }
+ virtual QCString trStaticProtectedMembers()
+ { return "Statiska skyddade medlemmar"; }
+ virtual QCString trPrivateMembers()
+ { return "Privata medlemmar"; }
+ virtual QCString trPrivateSlots()
+ { return "Privata slots"; }
+ virtual QCString trStaticPrivateMembers()
+ { return "Statiska privata medlemmar"; }
+ // end of member sections
+
+ virtual QCString trWriteList(int numEntries)
+ {
+ // this function is used to produce a comma-separated list of items.
+ // use generateMarker(i) to indicate where item i should be put.
+ QCString result;
+ int i;
+ // the inherits list contain `numEntries' classes
+ for (i=0;i<numEntries;i++)
+ {
+ // use generateMarker to generate placeholders for the class links!
+ result+=generateMarker(i); // generate marker for entry i in the list
+ // (order is left to right)
+
+ if (i!=numEntries-1) // not the last entry, so we need a separator
+ {
+ if (i<numEntries-2) // not the fore last entry
+ result+=", ";
+ else // the fore last entry
+ result+=", och ";
+ }
+ }
+ return result;
+ }
+
+ virtual QCString trInheritsList(int numEntries)
+ // used in class documentation to produce a list of base classes,
+ // if class diagrams are disabled.
+ {
+ return "Ärver "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trInheritedByList(int numEntries)
+ // used in class documentation to produce a list of super classes,
+ // if class diagrams are disabled.
+ {
+ return "Ärvd av "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trReimplementedFromList(int numEntries)
+ // used in member documentation blocks to produce a list of
+ // members that are hidden by this one.
+ {
+ return "Återskapad från "+trWriteList(numEntries)+".";
+ }
+ virtual QCString trReimplementedInList(int numEntries)
+ {
+ // used in member documentation blocks to produce a list of
+ // all member that overwrite the implementation of this member.
+ return "Återskapad i "+trWriteList(numEntries)+".";
+ }
+
+ virtual QCString trNamespaceMembers()
+ { return "Namespacemedlemmar"; }
+ virtual QCString trNamespaceMemberDescription(bool extractAll)
+ {
+ QCString result="Här är en lista över alla ";
+ if (!extractAll) result+="dokumenterade ";
+ result+="namespacemedlemmar med länkar till ";
+ if (extractAll)
+ result+=" namespace-dokumentationen för varje medlem:";
+ else
+ result+="de namespaces de tillhör:";
+ return result;
+ }
+
+ virtual QCString trNamespaceIndex()
+ { return "Namespaceindex"; }
+
+ virtual QCString trNamespaceDocumentation()
+
+{ return "Namespace-dokumentation"; }
};
#endif
diff --git a/src/util.cpp b/src/util.cpp
index 9064b2e..49fdee5 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -15,9 +15,10 @@
*/
#include <stdlib.h>
-#include <qregexp.h>
-#include <qstring.h>
#include <ctype.h>
+
+#include "qtbc.h"
+#include <qregexp.h>
#include "util.h"
#include "message.h"
#include "classdef.h"
@@ -37,9 +38,22 @@ bool isId(char c)
return c=='_' || isalnum(c);
}
-QString generateMarker(int id)
+// strip annonymous part of the scope
+QCString stripAnnonymousScope(const QCString &s)
+{
+ QCString result=s;
+ int i;
+ while (!result.isEmpty() && result.at(0)=='@' && (i=result.find("::"))!=-1)
+ {
+ result=result.right(result.length()-i-2);
+ }
+ return result;
+}
+
+
+QCString generateMarker(int id)
{
- QString result;
+ QCString result;
result.sprintf("@%d\n",id);
return result;
}
@@ -49,7 +63,7 @@ QString generateMarker(int id)
// If anyone knows or uses another extension please let me know :-)
int guessSection(const char *name)
{
- QString n=((QString)name).lower();
+ QCString n=((QCString)name).lower();
if (n.right(2)==".c" ||
n.right(3)==".cc" ||
n.right(4)==".cxx" ||
@@ -66,7 +80,7 @@ int guessSection(const char *name)
}
-//QString resolveDefines(const char *n)
+//QCString resolveDefines(const char *n)
//{
// return n;
// if (n)
@@ -81,9 +95,9 @@ int guessSection(const char *name)
// return 0;
//}
-QString resolveTypedefs(const QString &n)
+QCString resolveTypedefs(const QCString &n)
{
- QString *subst=typedefDict[n];
+ QCString *subst=typedefDict[n];
if (subst && !subst->isNull())
{
return *subst;
@@ -97,7 +111,7 @@ QString resolveTypedefs(const QString &n)
ClassDef *getClass(const char *name)
{
if (!name) return 0;
- //QString key=resolveTypedefs(resolveDefines(name));
+ //QCString key=resolveTypedefs(resolveDefines(name));
//Define *def=defineDict[key];
//if (def && def->nargs==0 && def->definition.length()>0) // normal define
// key=def->definition; // use substitution
@@ -105,10 +119,10 @@ ClassDef *getClass(const char *name)
return classDict[resolveTypedefs(name)];
}
-QString removeRedundantWhiteSpace(const QString &s)
+QCString removeRedundantWhiteSpace(const QCString &s)
{
if (s.length()==0) return s;
- QString result;
+ QCString result;
uint i;
for (i=0;i<s.length();i++)
{
@@ -152,11 +166,11 @@ void writeTemplatePrefix(OutputList &ol,ArgumentList *al)
if (manEnabled) ol.enable(OutputGenerator::Man);
}
-QString addTemplateNames(const QString &s,const QString &n,const QString &t)
+QCString addTemplateNames(const QCString &s,const QCString &n,const QCString &t)
{
//printf("addTemplateNames(%s)\n",s.data());
- QString result;
- QString clRealName=n;
+ QCString result;
+ QCString clRealName=n;
int p=0,i;
if ((i=clRealName.find('<'))!=-1)
{
@@ -183,11 +197,11 @@ QString addTemplateNames(const QString &s,const QString &n,const QString &t)
return result;
}
-static void linkifyText(OutputList &ol,const char *clName,const char *name,const char *text)
+static void linkifyText(OutputList &ol,const char *scName,const char *name,const char *text)
{
- //printf("class %s name %s Text: %s\n",clName,name,text);
+ //printf("scope=`%s' name=`%s' Text: `%s'\n",scName,name,text);
QRegExp regExp("[a-z_A-Z0-9:<>]+");
- QString txtStr=text;
+ QCString txtStr=text;
OutputList result(&ol);
int matchLen;
int index=0;
@@ -199,55 +213,86 @@ static void linkifyText(OutputList &ol,const char *clName,const char *name,const
// add non-word part to the result
result.docify(txtStr.mid(skipIndex,newIndex-skipIndex));
// get word from string
- QString word=txtStr.mid(newIndex,matchLen);
+ QCString word=txtStr.mid(newIndex,matchLen);
ClassDef *cd=0;
FileDef *fd=0;
MemberDef *md=0;
NamespaceDef *nd=0;
+ QCString scopeName=scName;
+ QCString searchName=name;
+ //printf("word=`%s' scopeName=`%s' searchName=`%s'\n",
+ // word.data(),scopeName.data(),searchName.data());
// check if `word' is a documented class name
- if (word.length()>0 && word!=name && word!=clName)
+ if (word.length()>0 &&
+ word.right(searchName.length())!=searchName &&
+ word!=scopeName.right(word.length())
+ )
{
- if ((cd=getClass(word)))
+ //printf("Searching...\n");
+ int scopeOffset=scopeName.length();
+ bool found=FALSE;
+ do // for each scope (starting with full scope and going to empty scope)
{
- // add link to the result
- if (cd->isVisible())
+ QCString fullName = word.copy();
+ if (scopeOffset>0)
{
- result.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,word);
+ fullName.prepend(scopeName.left(scopeOffset)+"::");
}
- else
+ //printf("Trying class %s\n",fullName.data());
+
+ if ((cd=getClass(fullName)))
{
- result.docify(word);
+ // add link to the result
+ if (cd->isVisible())
+ {
+ result.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,word);
+ found=TRUE;
+ }
}
- }
- else if (getDefs(word,clName,0,md,cd,fd,nd) && md->hasDocumentation())
+
+ if (scopeOffset==0)
+ {
+ scopeOffset=-1;
+ }
+ else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1)
+ {
+ scopeOffset=0;
+ }
+ } while (!found && scopeOffset>=0);
+
+ if (!found &&
+ getDefs(scName,word,0,md,cd,fd,nd) &&
+ (md->isTypedef() || md->isEnumerate()) &&
+ md->hasDocumentation()
+ )
{
- if (cd && cd->isVisible() && !md->isFunction()) // word is a member of cd
+ if (cd && cd->isVisible()) // fullName is a member of cd
{
result.writeObjectLink(cd->getReference(),
- cd->getOutputFileBase(),md->anchor(),word);
+ cd->getOutputFileBase(),md->anchor(),word);
+ found=TRUE;
}
else if (nd && nd->hasDocumentation())
{
result.writeObjectLink(nd->getReference(),
- nd->getOutputFileBase(),md->anchor(),word);
+ nd->getOutputFileBase(),md->anchor(),word);
+ found=TRUE;
}
- else if (fd && fd->hasDocumentation()) // word is a global in file fd
+ else if (fd && fd->hasDocumentation()) // fullName is a global in file fd
{
result.writeObjectLink(fd->getReference(),
- fd->getOutputFileBase(),md->anchor(),word);
- }
- else // add word to the result
- {
- result.docify(word);
+ fd->getOutputFileBase(),md->anchor(),word);
+ found=TRUE;
}
}
- else // add word to the result
+
+ if (!found) // add word to the result
{
result.docify(word);
}
}
- else // add word to the result
+ else
{
result.docify(word);
}
@@ -261,13 +306,13 @@ static void linkifyText(OutputList &ol,const char *clName,const char *name,const
}
static void writeDefArgumentList(OutputList &ol,ClassDef *cd,
- const QString &scopeName,MemberDef *md)
+ const QCString &scopeName,MemberDef *md)
{
ArgumentList *argList=md->argumentList();
if (argList==0) return; // member has no function like argument list
ol.docify(" ("); // start argument list
Argument *a=argList->first();
- QString cName;
+ QCString cName;
if (cd && cd->templateArguments())
{
cName=cd->getTemplateNameString();
@@ -278,13 +323,13 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd,
int vp;
if ((vp=a->type.find(re))!=-1) // argument type is a function pointer
{
- QString n=a->type.left(vp);
+ QCString n=a->type.left(vp);
if (cName.length()>0) n=addTemplateNames(n,cd->name(),cName);
linkifyText(ol,scopeName,md->name(),n);
}
else // non-function pointer type
{
- QString n=a->type;
+ QCString n=a->type;
if (cName.length()>0) n=addTemplateNames(n,cd->name(),cName);
linkifyText(ol,scopeName,md->name(),n);
}
@@ -306,7 +351,7 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd,
}
if (a->defval.length()>0) // write the default value
{
- QString n=a->defval;
+ QCString n=a->defval;
if (cName.length()>0) n=addTemplateNames(n,cd->name(),cName);
ol.docify(" = ");
linkifyText(ol,scopeName,md->name(),n);
@@ -327,7 +372,7 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd,
void writeExample(OutputList &ol,ExampleList *el)
{
- QString exampleLine=theTranslator->trWriteList(el->count());
+ QCString exampleLine=theTranslator->trWriteList(el->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
@@ -347,9 +392,9 @@ void writeExample(OutputList &ol,ExampleList *el)
-QString argListToString(ArgumentList *al)
+QCString argListToString(ArgumentList *al)
{
- QString result;
+ QCString result;
if (al==0) return result;
Argument *a=al->first();
result+="(";
@@ -416,7 +461,7 @@ void writeQuickLinks(OutputList &ol,bool compact,bool ext)
{
bool manEnabled = ol.isEnabled(OutputGenerator::Man);
bool texEnabled = ol.isEnabled(OutputGenerator::Latex);
- QString extLink,absPath;
+ QCString extLink,absPath;
if (ext) { extLink="_doc:"; absPath="/"; }
if (manEnabled) ol.disable(OutputGenerator::Man);
if (texEnabled) ol.disable(OutputGenerator::Latex);
@@ -456,7 +501,7 @@ void writeQuickLinks(OutputList &ol,bool compact,bool ext)
parseText(ol,theTranslator->trFileList());
ol.endQuickIndexItem();
}
- if (includeFiles.count()>0 && verbatimHeaderFlag)
+ if (includeFiles.count()>0 && Config::verbatimHeaderFlag)
{
if (!compact) ol.writeListItem();
ol.startQuickIndexItem(extLink,absPath+"headers.html");
@@ -498,7 +543,7 @@ void writeQuickLinks(OutputList &ol,bool compact,bool ext)
parseText(ol,theTranslator->trExamples());
ol.endQuickIndexItem();
}
- if (searchEngineFlag)
+ if (Config::searchEngineFlag)
{
if (!compact) ol.writeListItem();
ol.startQuickIndexItem("_cgi:","");
@@ -521,7 +566,7 @@ void writeQuickLinks(OutputList &ol,bool compact,bool ext)
void startFile(OutputList &ol,const char *name,const char *title,bool external)
{
ol.startFile(name,title,external);
- if (!noIndexFlag) writeQuickLinks(ol,TRUE,external);
+ if (!Config::noIndexFlag) writeQuickLinks(ol,TRUE,external);
}
void endFile(OutputList &ol,bool external)
@@ -531,15 +576,15 @@ void endFile(OutputList &ol,bool external)
if (latexEnabled) ol.disable(OutputGenerator::Latex);
if (manEnabled) ol.disable(OutputGenerator::Man);
ol.writeFooter(0,external); // write the footer
- if (footerFile.length()==0)
+ if (Config::footerFile.length()==0)
{
parseText(ol,theTranslator->trGeneratedAt(
dateToString(TRUE),
- projectName
+ Config::projectName
));
}
ol.writeFooter(1,external); // write the link to the picture
- if (footerFile.length()==0)
+ if (Config::footerFile.length()==0)
{
parseText(ol,theTranslator->trWrittenBy());
}
@@ -555,14 +600,14 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd,
{
int i,l;
bool hasDocs=md->hasDocumentation();
- if ((!hasDocs && hideMemberFlag) ||
- (hideMemberFlag &&
+ if ((!hasDocs && Config::hideMemberFlag) ||
+ (Config::hideMemberFlag &&
md->documentation().isEmpty() &&
- !briefMemDescFlag &&
- !repeatBriefFlag
+ !Config::briefMemDescFlag &&
+ !Config::repeatBriefFlag
)
) return;
- QString type=md->typeString();
+ QCString type=md->typeString();
QRegExp r("@[0-9]+");
if ((i=r.match(type,0,&l))==-1 || !md->enumUsed())
{
@@ -571,22 +616,23 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd,
// strip `friend' keyword from type
if (type.left(7)=="friend ") type=type.right(type.length()-7);
- if (genTagFile.length()>0)
+ if (Config::genTagFile.length()>0)
{
tagFile << md->name() << " " << md->anchor() << " \""
<< md->argsString() << "\"\n";
}
- QString cname;
+ QCString cname;
if (cd) cname=cd->name();
else if (nd) cname=nd->name();
else if (fd) cname=fd->name();
+ ol.startMemberItem();
// If there is no detailed description we need to write the anchor here.
bool detailsVisible = md->detailsAreVisible();
- if (!detailsVisible && !extractAllFlag)
+ if (!detailsVisible && !Config::extractAllFlag)
{
- QString doxyName=md->name().copy();
+ QCString doxyName=md->name().copy();
if (!cname.isEmpty()) doxyName.prepend(cname+"::");
ol.writeDoxyAnchor(cname,md->anchor(),doxyName);
ol.addToIndex(md->name(),cname);
@@ -601,35 +647,37 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd,
ol.addToIndex(cname,md->name());
ol.writeLatexLabel(cname,md->anchor());
}
- ol.startMemberItem();
// write type
if (i!=-1)
{
- QString newType = type.left(i) + " { ... } " +
+ QCString newType = type.left(i) + " { ... } " +
type.right(type.length()-i-l);
type = newType;
- ol.docify(type);
+ //ol.docify(type);
+ linkifyText(ol,cname,md->name(),type);
}
else
{
- ol.docify(type);
+ //ol.docify(type);
+ linkifyText(ol,cname,md->name(),type);
+ }
+ QCString name=md->name().copy();
+ bool htmlOn = ol.isEnabled(OutputGenerator::Html);
+ if (htmlOn && Config::htmlAlignMemberFlag && type.length()>0)
+ {
+ ol.disable(OutputGenerator::Html);
+ }
+ if (!type.isEmpty()) ol.docify(" ");
+ if (htmlOn)
+ {
+ ol.enable(OutputGenerator::Html);
}
- QString name=md->name().copy();
- if (type.length()>0) ol.writeString(" ");
ol.insertMemberAlign();
// write name
- if ( extractAllFlag ||
- (md->briefDescription().isEmpty() || !briefMemDescFlag) &&
- (!md->documentation().isEmpty() ||
- (!md->briefDescription().isEmpty() &&
- !briefMemDescFlag &&
- repeatBriefFlag
- )
- )
- )
+ if (md->hasDocumentation())
{
//printf("writeLink %s->%d\n",name.data(),md->hasDocumentation());
writeLink(ol,cd,nd,fd,md,name);
@@ -643,7 +691,8 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd,
if (md->argsString())
{
ol.writeString(" ");
- ol.docify(md->argsString());
+ //ol.docify(md->argsString());
+ linkifyText(ol,cname,md->name(),md->argsString());
}
if (md->excpString())
@@ -655,22 +704,21 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd,
ol.endMemberItem();
// write brief description
- if (!md->briefDescription().isEmpty() && briefMemDescFlag)
+ if (!md->briefDescription().isEmpty() && Config::briefMemDescFlag)
{
ol.startMemberDescription();
parseDoc(ol,cname,md->name(),md->briefDescription());
- if (!md->documentation().isEmpty())
- {
- ol.disableAllBut(OutputGenerator::Html);
- ol.endEmphasis();
- ol.docify(" ");
- ol.startTextLink(0,md->anchor());
- //ol.writeObjectLink(0,0,md->anchor()," More...");
- parseText(ol,theTranslator->trMore());
- ol.endTextLink();
- ol.startEmphasis();
- ol.enableAll();
- }
+ //if (!md->documentation().isEmpty())
+ //{
+ // ol.disableAllBut(OutputGenerator::Html);
+ // ol.endEmphasis();
+ // ol.docify(" ");
+ // ol.startTextLink(0,md->anchor());
+ // parseText(ol,theTranslator->trMore());
+ // ol.endTextLink();
+ // ol.startEmphasis();
+ // ol.enableAll();
+ //}
ol.endMemberDescription();
ol.newParagraph();
}
@@ -695,7 +743,9 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
}
if (subtitle)
{
+ ol.startMemberSubtitle();
parseText(ol,subtitle);
+ ol.endMemberSubtitle();
}
if (!fd && !nd) ol.startMemberList();
@@ -711,7 +761,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
for ( ; (md=mli.current()); ++mli )
{
if (md->isDefine() &&
- (md->argsString() || md->hasDocumentation() || extractAllFlag)
+ (md->argsString() || md->hasDocumentation() || Config::extractAllFlag)
)
writeMemberDef(ol,cd,nd,fd,md);
}
@@ -763,34 +813,35 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
for ( ; (md=mli.current()) ; ++mli )
{
/*bool hasDocs=md->hasDocumentation();*/
- QString type=md->typeString();
+ QCString type=md->typeString();
type=type.stripWhiteSpace();
- if (md->isEnumerate() /*&& (hasDocs || !hideMemberFlag)*/)
+ if (md->isEnumerate() /*&& (hasDocs || !Config::hideMemberFlag)*/)
{
- if (!hideMemberFlag || // do not hide undocumented members or
+ if (!Config::hideMemberFlag || // do not hide undocumented members or
!md->documentation().isEmpty() || // member has detailed descr. or
md->hasDocumentedEnumValues() || // member has documented enum vales.
- briefMemDescFlag || // brief descr. is shown or
- repeatBriefFlag // brief descr. is repeated.
+ Config::briefMemDescFlag || // brief descr. is shown or
+ Config::repeatBriefFlag // brief descr. is repeated.
)
{
OutputList typeDecl(&ol);
- QString name=md->name().copy();
+ QCString name=md->name().copy();
int i=name.findRev("::");
if (i!=-1) name=name.right(name.length()-i-2); // strip scope
if (name[0]!='@') // not an anonymous enum
{
- if (extractAllFlag ||
- (md->briefDescription().isEmpty() || !briefMemDescFlag) &&
- (!md->documentation().isEmpty() || md->hasDocumentedEnumValues() ||
- (!md->briefDescription().isEmpty() &&
- !briefMemDescFlag &&
- repeatBriefFlag
- )
- )
- )
+ //if (Config::extractAllFlag ||
+ // (md->briefDescription().isEmpty() || !Config::briefMemDescFlag) &&
+ // (!md->documentation().isEmpty() || md->hasDocumentedEnumValues() ||
+ // (!md->briefDescription().isEmpty() &&
+ // !Config::briefMemDescFlag &&
+ // Config::repeatBriefFlag
+ // )
+ // )
+ // )
+ if (md->hasDocumentation() || md->hasDocumentedEnumValues())
{
- if (genTagFile.length()>0)
+ if (Config::genTagFile.length()>0)
tagFile << md->name() << " " << md->anchor()
<< " \"" << md->argsString() << "\"";
writeLink(typeDecl,cd,nd,fd,md,name);
@@ -811,7 +862,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
{
if (fmd->hasDocumentation())
{
- if (genTagFile.length()>0)
+ if (Config::genTagFile.length()>0)
tagFile << fmd->name() << " " << fmd->anchor()
<< " \"" << fmd->argsString() << "\"";
writeLink(typeDecl,cd,nd,fd,fmd,fmd->name());
@@ -834,7 +885,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
{
for ( ; (vmd=vmli.current()) ; ++vmli)
{
- QString vtype=vmd->typeString();
+ QCString vtype=vmd->typeString();
if ((vtype.find(name))!=-1) enumVars++;
}
}
@@ -845,25 +896,25 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
ol.insertMemberAlign();
ol+=typeDecl;
ol.endMemberItem();
- //QString brief=md->briefDescription();
+ //QCString brief=md->briefDescription();
//brief=brief.stripWhiteSpace();
- if (!md->briefDescription().isEmpty() && briefMemDescFlag)
+ if (!md->briefDescription().isEmpty() && Config::briefMemDescFlag)
{
ol.startMemberDescription();
parseDoc(ol,cd?cd->name().data():0,
md->name().data(),md->briefDescription());
- if (!md->documentation().isEmpty() || md->hasDocumentedEnumValues())
- {
- ol.disableAllBut(OutputGenerator::Html);
- ol.endEmphasis();
- ol.docify(" ");
- ol.startTextLink(0,md->anchor());
- //ol.writeObjectLink(0,0,md->anchor()," More...");
- parseText(ol,theTranslator->trMore());
- ol.endTextLink();
- ol.startEmphasis();
- ol.enableAll();
- }
+ //if (!md->documentation().isEmpty() || md->hasDocumentedEnumValues())
+ //{
+ // ol.disableAllBut(OutputGenerator::Html);
+ // ol.endEmphasis();
+ // ol.docify(" ");
+ // ol.startTextLink(0,md->anchor());
+ // //ol.writeObjectLink(0,0,md->anchor()," More...");
+ // parseText(ol,theTranslator->trMore());
+ // ol.endTextLink();
+ // ol.startEmphasis();
+ // ol.enableAll();
+ //}
ol.endMemberDescription();
ol.disable(OutputGenerator::Man);
ol.newParagraph();
@@ -904,7 +955,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
{
if ( md->isFriend())
{
- QString type=md->typeString();
+ QCString type=md->typeString();
//printf("Friend: type=%s name=%s\n",type.data(),md->name().data());
if (md->hasDocumentation() && type!="friend class")
{
@@ -930,7 +981,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name());
ol.endMemberItem();
}
- else if (!hideMemberFlag) // no documentation
+ else if (!Config::hideMemberFlag) // no documentation
{
ol.startMemberItem();
ol.docify("class ");
@@ -971,7 +1022,7 @@ void setAnchors(char id,MemberList *ml)
MemberDef *md=ml->first();
while (md)
{
- QString anchor;
+ QCString anchor;
anchor.sprintf("%c%d",id,count++);
//printf("Member %s anchor %s\n",md->name(),anchor.data());
md->setAnchor(anchor);
@@ -992,21 +1043,21 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
// md->hasDocumentedEnumValues() // one of its values is documented
// ) || // or
// (!md->briefDescription().isEmpty() && // member has brief description and
- // !briefMemDescFlag && // brief description not shown earlier and
- // repeatBriefFlag // brief description should be repeated.
+ // !Config::briefMemDescFlag && // brief description not shown earlier and
+ // Config::repeatBriefFlag // brief description should be repeated.
// );
if (md->memberType()==m && // filter member type
- (extractAllFlag || hasDocs)
+ (Config::extractAllFlag || hasDocs)
)
{
- if (extractAllFlag && !hasDocs)
+ if (Config::extractAllFlag && !hasDocs)
{
ol.disable(OutputGenerator::Latex); // Latex cannot insert a pagebreak
// if there are a lot of empty sections,
// so we disable LaTeX for all empty
- // sections even if extractAllFlag is enabled
+ // sections even if Config::extractAllFlag is enabled
}
- QString cname;
+ QCString cname;
NamespaceDef *nd=md->getNamespace();
ClassDef *cd=md->memberClass();
FileDef *fd=md->getFileDef();
@@ -1014,11 +1065,11 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
else if (nd) cname=nd->name();
else if (fd) cname=fd->name();
// get member name
- QString doxyName=md->name().copy();
- // prepend scope if there is any (TODO: prepend namespace scope as well)
- if (scopeName) doxyName.prepend((QString)scopeName+"::");
+ QCString doxyName=md->name().copy();
+ // prepend scope if there is any
+ if (scopeName) doxyName.prepend((QCString)scopeName+"::");
- QString def = md->definition();
+ QCString def = md->definition();
if (md->isEnumerate()) def.prepend("enum ");
MemberDef *smd;
if (md->isEnumValue() && def[0]=='@') def = def.right(def.length()-2);
@@ -1060,7 +1111,8 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
ol.writeDoxyAnchor(cname,md->anchor(),doxyName);
ArgumentList *al=0;
if (cd && (!md->isRelated() || !md->templateArguments()) &&
- (al=cd->templateArguments())) // class template prefix
+ ((al=md->scopeTemplateArguments()) || (al=cd->templateArguments()))
+ ) // class template prefix
{
writeTemplatePrefix(ol,al);
}
@@ -1070,7 +1122,11 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
{
writeTemplatePrefix(ol,al);
}
- if (cd && cd->templateArguments())
+ if (cd && md->scopeTemplateArguments())
+ {
+ def=addTemplateNames(def,cd->name(),md->getScopeTemplateNameString());
+ }
+ else if (cd && cd->templateArguments())
{
// add template name lists to all occurrences of the class name.
def=addTemplateNames(def,cd->name(),cd->getTemplateNameString());
@@ -1129,8 +1185,8 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
ol.newParagraph();
if (!md->briefDescription().isEmpty() &&
- (repeatBriefFlag ||
- (!briefMemDescFlag && md->documentation().isEmpty())
+ (Config::repeatBriefFlag ||
+ (!Config::briefMemDescFlag && md->documentation().isEmpty())
)
)
{
@@ -1141,6 +1197,12 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
{
parseDoc(ol,scopeName,md->name(),md->documentation()+"\n");
}
+ if (!md->bodyCode().isEmpty())
+ {
+ ol.startCodeFragment();
+ parseCode(ol,scopeName,md->bodyCode(),FALSE,0);
+ ol.endCodeFragment();
+ }
if (md->isEnumerate())
{
@@ -1193,149 +1255,149 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
}
MemberDef *bmd=md->reimplements();
- if (bmd)
+ ClassDef *bcd=0;
+ if (bmd && (bcd=bmd->memberClass()))
{
if (virt!=Normal) // search for virtual member of the deepest base class
{
MemberDef *lastBmd=bmd;
while (lastBmd)
{
- if (lastBmd->virtualness()!=Normal) bmd=lastBmd;
+ ClassDef *lastBcd = lastBmd->memberClass();
+ if (lastBmd->virtualness()!=Normal &&
+ lastBmd->hasDocumentation() &&
+ (lastBmd->protection()!=Private || Config::extractPrivateFlag) &&
+ lastBcd->hasDocumentation() &&
+ (lastBcd->protection()!=Private || Config::extractPrivateFlag)
+ ) { bmd=lastBmd; bcd=lastBcd; }
lastBmd=lastBmd->reimplements();
}
}
// write class that contains a member that is reimplemented by this one
- ClassDef *bcd = bmd->memberClass();
- ol.newParagraph();
- //parseText(ol,theTranslator->trReimplementedFrom());
- //ol.docify(" ");
-
- QString reimplFromLine = theTranslator->trReimplementedFromList(1);
- int markerPos = reimplFromLine.find("@0");
- if (markerPos!=-1) // should always pass this.
+ if (bcd->hasDocumentation() || bcd->isReference())
{
- parseText(ol,reimplFromLine.left(markerPos)); //text left from marker
- if (bmd->hasDocumentation() &&
- (bmd->protection()!=Private || extractPrivateFlag)
- ) // replace marker with link
+ ol.newParagraph();
+
+ QCString reimplFromLine = theTranslator->trReimplementedFromList(1);
+ int markerPos = reimplFromLine.find("@0");
+ if (markerPos!=-1) // should always pass this.
{
- ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- bmd->anchor(),bcd->name());
- if (
- !bcd->isReference() &&
- //(bcd->hasDocumentation() || !hideClassFlag) &&
- //(bcd->protection()!=Private || extractPrivateFlag)
- bcd->isVisible()
- /*&& bmd->detailsAreVisible()*/
- ) ol.writePageRef(bcd->name(),bmd->anchor());
+ parseText(ol,reimplFromLine.left(markerPos)); //text left from marker
+ if (bmd->hasDocumentation() &&
+ (bmd->protection()!=Private || Config::extractPrivateFlag)
+ ) // replace marker with link
+ {
+ ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
+ bmd->anchor(),bcd->name());
+ if (
+ !bcd->isReference() &&
+ //(bcd->hasDocumentation() || !Config::hideClassFlag) &&
+ //(bcd->protection()!=Private || Config::extractPrivateFlag)
+ bcd->isVisible()
+ /*&& bmd->detailsAreVisible()*/
+ ) ol.writePageRef(bcd->name(),bmd->anchor());
+ }
+ else
+ {
+ ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
+ 0,bcd->name());
+ if (
+ !bcd->isReference() &&
+ //(bcd->hasDocumentation() || !Config::hideClassFlag) &&
+ //(bcd->protection()!=Private || Config::extractPrivateFlag)
+ bcd->isVisible()
+ ) ol.writePageRef(bcd->name(),0);
+ }
+ parseText(ol,reimplFromLine.right(
+ reimplFromLine.length()-markerPos-2)); // text right from marker
+
}
else
{
- ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- 0,bcd->name());
- if (
- !bcd->isReference() &&
- //(bcd->hasDocumentation() || !hideClassFlag) &&
- //(bcd->protection()!=Private || extractPrivateFlag)
- bcd->isVisible()
- ) ol.writePageRef(bcd->name(),0);
+ err("Error: translation error: no marker in trReimplementsFromList()\n");
}
- parseText(ol,reimplFromLine.right(
- reimplFromLine.length()-markerPos-2)); // text right from marker
-
- }
- else
- {
- err("Error: translation error: no marker in trReimplementsFromList()\n");
}
//ol.writeString(".");
}
MemberList *bml=md->reimplementedBy();
- int count;
- if (bml && (count=bml->count())>0)
+ if (bml)
{
- // write the list of classes that overwrite this member
- ol.newParagraph();
- //parseText(ol,theTranslator->trReimplementedIn());
- //ol.writeString("Reimplemented in ");
- //ol.docify(" ");
-
- QString reimplInLine =
- theTranslator->trReimplementedInList(bml->count());
- QRegExp marker("@[0-9]+");
- int index=0,newIndex,matchLen;
- // now replace all markers in reimplInLine with links to the classes
- while ((newIndex=marker.match(reimplInLine,index,&matchLen))!=-1)
+ MemberListIterator mli(*bml);
+ MemberDef *bmd=0;
+ uint count=0;
+ ClassDef *bcd=0;
+ for (mli.toFirst();(bmd=mli.current()) && (bcd=bmd->memberClass());++mli)
+ {
+ // count the members that directly inherit from md and for
+ // which the member and class are visible in the docs.
+ if (bmd->hasDocumentation() &&
+ (bmd->protection()!=Private || Config::extractPrivateFlag) &&
+ bcd->hasDocumentation() &&
+ (bcd->protection()!=Private || Config::extractPrivateFlag)
+ ) count++;
+ }
+ if (count>0)
{
- parseText(ol,reimplInLine.mid(index,newIndex-index));
- bool ok;
- uint entryIndex = reimplInLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
- bmd=bml->at(entryIndex);
- if (ok && bmd) // write link for marker
+ mli.toFirst();
+ // write the list of classes that overwrite this member
+ ol.newParagraph();
+ //parseText(ol,theTranslator->trReimplementedIn());
+ //ol.writeString("Reimplemented in ");
+ //ol.docify(" ");
+
+ QCString reimplInLine =
+ theTranslator->trReimplementedInList(count);
+ QRegExp marker("@[0-9]+");
+ int index=0,newIndex,matchLen;
+ // now replace all markers in reimplInLine with links to the classes
+ while ((newIndex=marker.match(reimplInLine,index,&matchLen))!=-1)
{
- ClassDef *bcd = bmd->memberClass();
- if (bmd->hasDocumentation() &&
- (bmd->protection()!=Private || extractPrivateFlag)
- )
+ parseText(ol,reimplInLine.mid(index,newIndex-index));
+ bool ok;
+ uint entryIndex = reimplInLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
+ //bmd=bml->at(entryIndex);
+
+ count=0;
+ // find the entryIndex-th documented entry in the inheritance list.
+ for (mli.toFirst();(bmd=mli.current()) && (bcd=bmd->memberClass());++mli)
{
- ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- bmd->anchor(),bcd->name());
- if (!bcd->isReference() && bcd->isVisible())
- ol.writePageRef(bcd->name(),bmd->anchor());
+ if (bmd->hasDocumentation() &&
+ (bmd->protection()!=Private || Config::extractPrivateFlag) &&
+ bcd->hasDocumentation() &&
+ (bcd->protection()!=Private || Config::extractPrivateFlag)
+ )
+ {
+ if (count==entryIndex) break;
+ count++;
+ }
}
- else
+
+ if (ok && bcd && bmd) // write link for marker
{
+ //if (bmd->hasDocumentation() &&
+ // (bmd->protection()!=Private || Config::extractPrivateFlag)
+ // )
+ //{
ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- 0,bcd->name());
+ bmd->anchor(),bcd->name());
if (!bcd->isReference() && bcd->isVisible())
- ol.writePageRef(bcd->name(),0);
+ ol.writePageRef(bcd->name(),bmd->anchor());
+ //}
+ //else
+ //{
+ // ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
+ // 0,bcd->name());
+ // if (!bcd->isReference() && bcd->isVisible())
+ // ol.writePageRef(bcd->name(),0);
+ //}
}
- }
- index=newIndex+matchLen;
- }
- parseText(ol,reimplInLine.right(reimplInLine.length()-index));
+ ++mli;
+ index=newIndex+matchLen;
+ }
+ parseText(ol,reimplInLine.right(reimplInLine.length()-index));
-#if 0
- bmd=bml->first();
- while (bmd)
- {
- ClassDef *bcd = bmd->memberClass();
- if (bmd->hasDocumentation())
- {
- ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- bmd->anchor(),bcd->name());
- if (
- !bcd->isReference() &&
- //(bcd->hasDocumentation() || !hideClassFlag) &&
- //(bcd->protection()!=Private || extractPrivateFlag)
- bcd->isVisible()
- /*&& bmd->detailsAreVisible()*/
- ) ol.writePageRef(bcd->name(),bmd->anchor());
- }
- else
- {
- ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(),
- 0,bcd->name());
- if (
- !bcd->isReference() &&
- //(bcd->hasDocumentation() || !hideClassFlag) &&
- //(bcd->protection()!=Private || extractPrivateFlag)
- bcd->isVisible()
- ) ol.writePageRef(bcd->name(),0);
- }
- bmd=bml->next();
- if (bmd)
- {
- if (bml->at()==count-1)
- //ol.writeString(" and ");
- parseText(ol," "+theTranslator->trAnd()+" ");
- else
- ol.writeString(", ");
- }
}
- ol.writeString(".");
-#endif
}
// write the list of examples that use this member
if (md->hasExamples())
@@ -1353,7 +1415,7 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
}
ol.endIndent();
// enable LaTeX again
- if (extractAllFlag && !hasDocs) ol.enable(OutputGenerator::Latex);
+ if (Config::extractAllFlag && !hasDocs) ol.enable(OutputGenerator::Latex);
}
}
@@ -1362,7 +1424,7 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName,
//----------------------------------------------------------------------------
// read a file with `name' to a string.
-QString fileToString(const char *name)
+QCString fileToString(const char *name)
{
if (name==0 || name[0]==0) return 0;
QFileInfo fi(name);
@@ -1378,32 +1440,32 @@ QString fileToString(const char *name)
exit(1);
}
int fsize=fi.size();
- QString contents(fsize+1);
+ QCString contents(fsize+1);
f.readBlock(contents.data(),fsize);
contents[fsize]='\0';
f.close();
return contents;
}
-QString dateToString(bool includeTime)
+QCString dateToString(bool includeTime)
{
if (includeTime)
{
- return QDateTime::currentDateTime().toString();
+ return convertToQCString(QDateTime::currentDateTime().toString());
}
else
{
const QDate &d=QDate::currentDate();
- QString result;
+ QCString result;
result.sprintf("%d %s %d",
d.day(),
- d.monthName(d.month()),
+ convertToQCString(d.monthName(d.month())).data(),
d.year());
return result;
}
//QDate date=dt.date();
//QTime time=dt.time();
- //QString dtString;
+ //QCString dtString;
//dtString.sprintf("%02d:%02d, %04d/%02d/%02d",
// time.hour(),time.minute(),date.year(),date.month(),date.day());
//return dtString;
@@ -1440,11 +1502,11 @@ static int minClassDistance(ClassDef *cd,ClassDef *bcd,int level=0)
//}
// strip any template specifiers that follow className in string s
-static QString trimTemplateSpecifiers(const QString &className,const QString &s)
+static QCString trimTemplateSpecifiers(const QCString &className,const QCString &s)
{
// first we resolve any defines
//int i=0,p,l;
- //QString result;
+ //QCString result;
//QRegExp r("[A-Z_a-z][A-Z_a-z0-9]*");
//while ((p=r.match(s,i,&l))!=-1)
//{
@@ -1455,7 +1517,7 @@ static QString trimTemplateSpecifiers(const QString &className,const QString &s)
//if (i<(int)s.length()) result+=s.mid(i,s.length()-i);
// We strip the template arguments following className (if any)
- QString result=s.copy();
+ QCString result=s.copy();
int l=className.length();
if (l>0) // there is a class name
{
@@ -1488,17 +1550,31 @@ static QString trimTemplateSpecifiers(const QString &className,const QString &s)
}
// removes the (one and only) occurrence of name:: from s.
-static QString trimScope(const QString &name,const QString &s)
+static QCString trimScope(const QCString &name,const QCString &s)
{
- int spos=s.find(name+"::");
- if (spos!=-1)
+ int scopeOffset=name.length();
+ QCString result=s;
+ do // for each scope
{
- return s.left(spos)+s.right(s.length()-spos-name.length()-2);
- }
- return s;
+ QCString tmp;
+ QCString scope=name.left(scopeOffset)+"::";
+ //printf("Trying with scope=`%s'\n",scope.data());
+
+ int i,p=0;
+ while ((i=result.find(scope,p))!=-1) // for each occurrence
+ {
+ tmp+=result.mid(p,i-p); // add part before pattern
+ p=i+scope.length();
+ }
+ tmp+=result.right(result.length()-p); // add trailing part
+
+ scopeOffset=name.findRev("::",scopeOffset-1);
+ result = tmp;
+ } while (scopeOffset>0);
+ return result;
}
-static QString trimBaseClassScope(BaseClassList *bcl,const QString &s)
+static QCString trimBaseClassScope(BaseClassList *bcl,const QCString &s)
{
BaseClassListIterator bcli(*bcl);
BaseClassDef *bcd;
@@ -1528,12 +1604,14 @@ static QString trimBaseClassScope(BaseClassList *bcl,const QString &s)
bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl,
const char *cl,const char *ns)
{
- QString className=cl;
- QString namespaceName=ns;
+ QCString className=cl;
+ QCString namespaceName=ns;
+
//printf("matchArguments(%s,%s) className=%s namespaceName=%s\n",
// srcAl ? argListToString(srcAl).data() : "",
// dstAl ? argListToString(dstAl).data() : "",
// cl,ns);
+
if (srcAl==0 || dstAl==0)
{
return srcAl==dstAl; // at least one of the members is not a function
@@ -1544,6 +1622,7 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl,
Argument *a=new Argument;
a->type = "void";
srcAl->append(a);
+ return TRUE;
}
if ( dstAl->count()==0 && srcAl->count()==1 &&
srcAl->getFirst()->type=="void" )
@@ -1555,6 +1634,7 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl,
}
if (srcAl->count() != dstAl->count())
{
+ //printf("Different number of arguments!\n");
return FALSE; // different number of arguments -> no match
}
if (srcAl->constSpecifier != dstAl->constSpecifier)
@@ -1572,15 +1652,15 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl,
Argument *srcA,*dstA;
for (;(srcA=srcAli.current(),dstA=dstAli.current());++srcAli,++dstAli)
{
- QString srcAType=trimTemplateSpecifiers(className,srcA->type);
- QString dstAType=trimTemplateSpecifiers(className,dstA->type);
+ QCString srcAType=trimTemplateSpecifiers(className,srcA->type);
+ QCString dstAType=trimTemplateSpecifiers(className,dstA->type);
if (srcAType!=dstAType) // check if the argument only differs on name
{
- //printf("`%s' <=> `%s'\n",srcAType.data(),dstAType.data());
+ //printf("scope=`%s': `%s' <=> `%s'\n",className.data(),srcAType.data(),dstAType.data());
- QString srcScope;
- QString dstScope;
+ QCString srcScope;
+ QCString dstScope;
// strip redundant scope specifiers
if (!className.isEmpty())
@@ -1778,6 +1858,10 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl)
dstA->type = srcA->type.copy();
dstA->name = dstA->name.copy();
}
+ else if (!srcA->name.isEmpty() && !dstA->name.isEmpty())
+ {
+ srcA->name = dstA->name.copy();
+ }
int i1=srcA->type.find("::"),
i2=dstA->type.find("::"),
j1=srcA->type.length()-i1-2,
@@ -1801,335 +1885,523 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl)
// argListToString(srcAl).data(),argListToString(dstAl).data());
}
-//----------------------------------------------------------------------
-// searches for the class and member definitions corresponding with
-// memberName and className.
-// These classes are returned using `md' and `cd'.
-// returns TRUE if the class and member both could be found
-
-bool getDefs(const QString &memberName,const QString &className,
+/*!
+ * Searches for a member definition given its name `memberName' as a string.
+ * memberName may also include a (partial) scope to indicate the scope
+ * in which the member is located.
+ *
+ * The parameter `scName' is a string representing the name of the scope in
+ * which the link was found.
+ *
+ * In case of a function args contains a string representation of the
+ * argument list. Passing 0 means the member has no arguments.
+ * Passing "()" means any argument list will do, but "()" is preferred.
+ *
+ * The function returns TRUE if the member is known and documented or
+ * FALSE if it is not.
+ * If TRUE is returned parameter `md' contains a pointer to the member
+ * definition. Furthermore exactly one of the parameter `cd', `nd', or `fd'
+ * will be non-zero:
+ * - if `cd' is non zero, the member was found in a class pointed to by cd.
+ * - if `nd' is non zero, the member was found in a namespace pointed to by nd.
+ * - if `fd' is non zero, the member was found in the global namespace of
+ * file fd.
+ */
+bool getDefs(const QCString &scName,const QCString &memberName,
const char *args,
MemberDef *&md, ClassDef *&cd, FileDef *&fd,NamespaceDef *&nd)
{
- //printf("Search for %s::%s %s\n",className.data(),memberName.data(),args);
fd=0, md=0, cd=0, nd=0;
- if (memberName.length()==0) return FALSE;
- MemberName *mn;
- if ((mn=memberNameDict[memberName]) && className.length()>0)
+ if (memberName.length()==0) return FALSE; /* empty name => nothing to link */
+
+ QCString scopeName=scName.copy();
+ //printf("Search for name=%s args=%s in scope=%s\n",
+ // memberName.data(),args,scopeName.data());
+
+ int is,im,pm=0;
+ // strip common part of the scope from the scopeName
+ while ((is=scopeName.findRev("::"))!=-1 &&
+ (im=memberName.find("::",pm))!=-1 &&
+ (scopeName.right(scopeName.length()-is-2)==memberName.mid(pm,im-pm))
+ )
+ {
+ scopeName=scopeName.left(is);
+ pm=im+2;
+ }
+ //printf("result after scope corrections scope=%s name=%s\n",
+ // scopeName.data(),memberName.data());
+
+ QCString mName=memberName;
+ QCString mScope;
+ if ((im=memberName.findRev("::"))!=-1)
+ {
+ mScope=memberName.left(im);
+ mName=memberName.right(memberName.length()-im-2);
+ }
+
+ // handle special the case where both scope name and member scope are equal
+ if (mScope==scopeName) scopeName.resize(0);
+
+ //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data());
+
+ MemberName *mn = memberNameDict[mName];
+ if (mn && scopeName.length()+mScope.length()>0)
{
//printf(" >member name found\n");
- ClassDef *fcd=0;
- //printf("className=%s\n",className.data());
- if ((fcd=getClass(className)) && fcd->hasDocumentation())
- {
- //printf(" >member class found\n");
- MemberDef *mmd=mn->first();
- int mdist=maxInheritanceDepth;
- while (mmd)
+ int scopeOffset=scopeName.length();
+ do
+ {
+ QCString className = scopeName.left(scopeOffset);
+ if (!className.isEmpty() && !mScope.isEmpty())
{
- if ((mmd->protection()!=Private || extractPrivateFlag) &&
- mmd->hasDocumentation()
- /*mmd->detailsAreVisible()*/
- /* && (args==0 || matchArgumentsOld(mmd->argsString(),args)) */
- )
+ className.append("::"+mScope);
+ }
+ else if (!mScope.isEmpty())
+ {
+ className=mScope.copy();
+ }
+ //printf("Trying class scope %s\n",className.data());
+
+ ClassDef *fcd=0;
+ if ((fcd=getClass(className)) && // is it a documented class
+ fcd->isVisibleExt()
+ )
+ {
+ //printf(" Found fcd=%p\n",fcd);
+ MemberDef *mmd=mn->first();
+ int mdist=maxInheritanceDepth;
+ while (mmd)
{
- bool match=TRUE;
- ArgumentList *argList=0;
- if (args)
- {
- match=FALSE;
- argList=new ArgumentList;
- stringToArgumentList(args,argList);
- match=matchArguments(mmd->argumentList(),argList);
- }
- if (match)
+ if ((mmd->protection()!=Private || Config::extractPrivateFlag) &&
+ mmd->hasDocumentation()
+ /*mmd->detailsAreVisible()*/
+ /* && (args==0 || matchArgumentsOld(mmd->argsString(),args)) */
+ )
{
- ClassDef *mcd=mmd->memberClass();
- int m=minClassDistance(fcd,mcd);
- if (m<mdist && mcd->isVisible())
+ bool match=TRUE;
+ ArgumentList *argList=0;
+ if (args)
{
- mdist=m;
- cd=mcd;
- md=mmd;
+ argList=new ArgumentList;
+ stringToArgumentList(args,argList);
+ match=matchArguments(mmd->argumentList(),argList);
+ }
+ if (match)
+ {
+ ClassDef *mcd=mmd->memberClass();
+ int m=minClassDistance(fcd,mcd);
+ if (m<mdist && mcd->isVisible())
+ {
+ mdist=m;
+ cd=mcd;
+ md=mmd;
+ }
+ }
+ if (argList)
+ {
+ delete argList;
}
}
- if (argList)
- {
- delete argList;
- }
+ mmd=mn->next();
}
- mmd=mn->next();
- }
- if (mdist==maxInheritanceDepth && !strcmp(args,"()"))
- // no exact match found, but if args="()" an arbitrary member will do
- {
- //printf(" >Searching for arbitrary member\n");
- mmd=mn->first();
- while (mmd)
+ if (mdist==maxInheritanceDepth && !strcmp(args,"()"))
+ // no exact match found, but if args="()" an arbitrary member will do
{
- if ((mmd->protection()!=Private || extractPrivateFlag) &&
- (
- mmd->hasDocumentation()
- /*mmd->detailsAreVisible()*/
- || mmd->isReference()
- )
- )
+ //printf(" >Searching for arbitrary member\n");
+ mmd=mn->last();
+ while (mmd)
{
- ClassDef *mcd=mmd->memberClass();
- //printf(" >Class %s found\n",mcd->name().data());
- int m=minClassDistance(fcd,mcd);
- if (m<mdist && mcd->isVisible())
+ if ((mmd->protection()!=Private || Config::extractPrivateFlag) &&
+ (
+ mmd->hasDocumentation()
+ /*mmd->detailsAreVisible()*/
+ || mmd->isReference()
+ )
+ )
{
- //printf("Class distance %d\n",m);
- mdist=m;
- cd=mcd;
- md=mmd;
+ ClassDef *mcd=mmd->memberClass();
+ //printf(" >Class %s found\n",mcd->name().data());
+ int m=minClassDistance(fcd,mcd);
+ if (m<mdist && mcd->isVisible())
+ {
+ //printf("Class distance %d\n",m);
+ mdist=m;
+ cd=mcd;
+ md=mmd;
+ }
}
+ mmd=mn->prev();
}
- mmd=mn->next();
}
+ //printf(" >Succes=%d\n",mdist<maxInheritanceDepth);
+ if (mdist<maxInheritanceDepth) return TRUE; /* found match */
+ }
+ /* goto the parent scope */
+
+ if (scopeOffset==0)
+ {
+ scopeOffset=-1;
}
- //printf(" >Succes=%d\n",mdist<maxInheritanceDepth);
- return mdist<maxInheritanceDepth;
- }
+ else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1)
+ {
+ scopeOffset=0;
+ }
+ } while (scopeOffset>=0);
+
+ // unknown or undocumented scope
}
else // maybe an namespace or file member ?
{
- MemberName *mn;
- if ((mn=functionNameDict[memberName])) // name is known
+ //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n",
+ // scopeName.data(),mScope.data(),mName.data());
+ //printf(" >member name found\n");
+ if ((mn=functionNameDict[mName])) // name is known
{
NamespaceDef *fnd=0;
- if (className.length()>0 && (fnd=namespaceDict[className]) &&
- fnd->hasDocumentation())
- { // inside a namespace
- MemberDef *mmd=mn->first();
- while (mmd)
+ int scopeOffset=scopeName.length();
+ do
+ {
+ QCString namespaceName = scopeName.left(scopeOffset);
+ if (!namespaceName.isEmpty() && !mScope.isEmpty())
+ {
+ namespaceName.append("::"+mScope);
+ }
+ else if (!mScope.isEmpty())
{
- if (mmd->getNamespace()==fnd && mmd->hasDocumentation())
- { // namespace is found
- nd=fnd;
- md=mmd;
- return TRUE;
+ namespaceName=mScope.copy();
+ }
+ if (namespaceName.length()>0 &&
+ (fnd=namespaceDict[namespaceName]) &&
+ fnd->isVisibleExt()
+ )
+ {
+ //printf("Function inside existing namespace `%s'\n",namespaceName.data());
+ bool found=FALSE;
+ MemberDef *mmd=mn->first();
+ while (mmd && !found)
+ {
+ //printf("mmd->getNamespace()=%p fnd=%p\n",
+ // mmd->getNamespace(),fnd);
+ if (mmd->getNamespace()==fnd &&
+ (mmd->isReference() || mmd->hasDocumentation())
+ )
+ { // namespace is found
+ bool match=TRUE;
+ ArgumentList *argList=0;
+ if (args)
+ {
+ argList=new ArgumentList;
+ stringToArgumentList(args,argList);
+ match=matchArguments(mmd->argumentList(),argList);
+ }
+ if (match)
+ {
+ nd=fnd;
+ md=mmd;
+ found=TRUE;
+ }
+ if (args)
+ {
+ delete argList;
+ }
+ }
+ mmd=mn->next();
}
- mmd=mn->next();
+ if (!found && !strcmp(args,"()"))
+ // no exact match found, but if args="()" an arbitrary
+ // member will do
+ {
+ MemberDef *mmd=mn->last(); // searching backward will get
+ // the first defined!
+ while (mmd && !found)
+ {
+ if (mmd->getNamespace()==fnd &&
+ (mmd->isReference() || mmd->hasDocumentation())
+ )
+ {
+ nd=fnd;
+ md=mmd;
+ found=TRUE;
+ }
+ mmd=mn->prev();
+ }
+ }
+ if (found) return TRUE;
}
- }
- // maybe a file member (e.g. global function or variable)
- md=mn->first();
- while (md)
- {
- if (/*md->detailsAreVisible()*/ md->hasDocumentation())
+ else // no scope => global function
{
- fd=md->getFileDef();
- if (fd && fd->hasDocumentation())
+ //printf("Function with global scope `%s'\n",namespaceName.data());
+ md=mn->first();
+ while (md)
+ {
+ if (md->isReference() || md->hasDocumentation())
+ {
+ //printf("md->name()=`%s'\n",md->name().data());
+ fd=md->getFileDef();
+ if (fd && (fd->isReference() || fd->hasDocumentation()))
+ {
+ //printf("fd->name()=`%s'\n",fd->name().data());
+ bool match=TRUE;
+ ArgumentList *argList=0;
+ if (args)
+ {
+ argList=new ArgumentList;
+ stringToArgumentList(args,argList);
+ match=matchArguments(md->argumentList(),argList);
+ delete argList;
+ }
+ if (match) return TRUE;
+ }
+ }
+ md=mn->next();
+ }
+ if (!strcmp(args,"()"))
{
- return TRUE;
+ // no exact match found, but if args="()" an arbitrary
+ // member will do
+ md=mn->last();
+ while (md)
+ {
+ if (md->isReference() || md->hasDocumentation())
+ {
+ //printf("md->name()=`%s'\n",md->name().data());
+ fd=md->getFileDef();
+ if (fd && (fd->isReference() || fd->hasDocumentation()))
+ {
+ return TRUE;
+ }
+ }
+ md=mn->prev();
+ }
}
}
- md=mn->next();
- }
+ if (scopeOffset==0)
+ {
+ scopeOffset=-1;
+ }
+ else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1)
+ {
+ scopeOffset=0;
+ }
+ } while (scopeOffset>=0);
+ }
+ else
+ {
+ //printf("Unknown function `%s'\n",mName.data());
}
}
return FALSE;
}
-//----------------------------------------------------------------------
-// Generate a hypertext link to the class with name `clName'.
-// If linkTxt is not null this text is used as the link, otherwise
-// the name of the class will be used. If the class could be found a
-// hypertext link (in HTML) is written, otherwise the text of the link will
-// be written.
-
-void generateClassRef(OutputList &ol,const char *clName,const char *linkTxt)
+/*!
+ * Searches for a scope definition given its name as a string via parameter
+ * `scope'.
+ *
+ * The parameter `docScope' is a string representing the name of the scope in
+ * which the `scope' string was found.
+ *
+ * The function returns TRUE if the scope is known and documented or
+ * FALSE if it is not.
+ * If TRUE is returned exactly one of the parameter `cd', `nd'
+ * will be non-zero:
+ * - if `cd' is non zero, the scope was a class pointed to by cd.
+ * - if `nd' is non zero, the scope was a namespace pointed to by nd.
+ */
+bool getScopeDefs(const char *docScope,const char *scope,
+ ClassDef *&cd, NamespaceDef *&nd)
{
- QString className=clName;
- QString linkText=linkTxt ? linkTxt : (const char *)className;
- if (className.length()==0)
- {
- ol.docify(linkText);
- return;
- }
- ClassDef *cd=0;
- NamespaceDef *nd=0;
- if ((cd=getClass(className)) && cd->isVisible())
- {
- ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,linkText);
- if (!cd->isReference()) ol.writePageRef(cd->name(),0);
- }
- else if ((nd=namespaceDict[className]) && nd->hasDocumentation())
+ cd=0;nd=0;
+
+ QCString scopeName=scope;
+ //printf("getScopeDefs: docScope=`%s' scope=`%s'\n",docScope,scope);
+ if (scopeName.length()==0) return FALSE;
+
+ QCString docScopeName=docScope;
+ int scopeOffset=docScopeName.length();
+
+ do // for each possible docScope (from largest to and including empty)
{
- ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,linkText);
- ol.writePageRef(nd->name(),0);
- }
- else
- ol.docify(linkText);
+ QCString fullName=scopeName.copy();
+ if (scopeOffset>0) fullName.prepend(docScopeName.left(scopeOffset)+"::");
+
+ if ((cd=getClass(fullName)) && cd->isVisibleExt())
+ {
+ return TRUE; // class link written => quit
+ }
+ else if ((nd=namespaceDict[fullName]) && nd->isVisibleExt())
+ {
+ return TRUE; // namespace link written => quit
+ }
+ if (scopeOffset==0)
+ {
+ scopeOffset=-1;
+ }
+ else if ((scopeOffset=docScopeName.findRev("::",scopeOffset-1))==-1)
+ {
+ scopeOffset=0;
+ }
+ } while (scopeOffset>=0);
+
+ return FALSE;
}
-//----------------------------------------------------------------------
-// generate a reference to a class or member.
-// `clName' is the name of the class that contains the documentation
-// string that is returned.
-// `name' is the name of the member or class that we want to link to.
-// `name' may have five formats:
-// 1) "ClassName"
-// 2) "memberName()" one of the (overloaded) function or define
-// with name memberName.
-// 3) "memberName(...)" a specific (overloaded) function or define
-// with name memberName
-// 4) "::memberName a non-function member or define
-// 5) ("ClassName::")+"memberName()"
-// 6) ("ClassName::")+"memberName(...)"
-// 7) ("ClassName::")+"memberName"
-
-void generateRef(OutputList &ol,const char *clName,
+/*!
+ * generate a reference to a class, namespace or member.
+ * `scName' is the name of the scope that contains the documentation
+ * string that is returned.
+ * `name' is the name that we want to link to.
+ * `name' may have five formats:
+ * 1) "ScopeName"
+ * 2) "memberName()" one of the (overloaded) function or define
+ * with name memberName.
+ * 3) "memberName(...)" a specific (overloaded) function or define
+ * with name memberName
+ * 4) "::memberName a non-function member or define
+ * 5) ("ScopeName::")+"memberName()"
+ * 6) ("ScopeName::")+"memberName(...)"
+ * 7) ("ScopeName::")+"memberName"
+ * instead of :: the # symbol may also be used.
+ */
+
+void generateRef(OutputList &ol,const char *scName,
const char *name,bool inSeeBlock,const char *rt)
{
- //printf("generateRef(clName=%s,name=%s,rt=%s)\n",clName,name,rt);
+ //printf("generateRef(scName=%s,name=%s,rt=%s)\n",scName,name,rt);
- // check if we have a plane name
- QString tmpName = substitute(name,"#","::");
- QString linkText = rt;
+ QCString tmpName = substitute(name,"#","::");
+ QCString linkText = rt;
int scopePos=tmpName.findRev("::");
- int bracePos=tmpName.find('(');
- if (scopePos==-1 && bracePos==-1)
+ int bracePos=tmpName.findRev('('); // reverse is needed for operator()(...)
+ if (bracePos==-1) // simple name
{
- if (!inSeeBlock) /* check for class link */
+ ClassDef *cd=0;
+ NamespaceDef *nd=0;
+ if (linkText.isNull()) linkText=tmpName;
+ // check if this is a class or namespace reference
+ if (scName!=tmpName && getScopeDefs(scName,name,cd,nd))
{
- if (linkText.isNull()) linkText=tmpName;
- // check if this is a class reference
- if (clName!=tmpName)
- generateClassRef(ol,name,linkText);
- else
- ol.docify(linkText);
+ if (cd) // scope matches that of a class
+ {
+ ol.writeObjectLink(cd->getReference(),
+ cd->getOutputFileBase(),0,linkText);
+ if (!cd->isReference())
+ ol.writePageRef(cd->name(),0);
+ }
+ else // scope matches that of a namespace
+ {
+ ol.writeObjectLink(nd->getReference(),
+ nd->getOutputFileBase(),0,linkText);
+ if (!nd->getReference())
+ ol.writePageRef(nd->name(),0);
+ }
+ // link has been written, stop now.
return;
}
- else /* check if it is a class, if not continue to search */
+ else if (scName==tmpName || (!inSeeBlock && scopePos==-1)) // nothing to link => output plain text
{
- if (clName!=tmpName && getClass(tmpName)!=0)
- {
- generateClassRef(ol,tmpName,linkText);
- return;
- }
+ ol.docify(linkText);
+ // text has been written, stop now.
+ return;
}
+ // continue search...
+ linkText = rt;
}
// extract scope
- QString scopeContext=clName;
- QString scopeUser;
- if (scopePos>0) scopeUser=tmpName.left(scopePos);
-
+ QCString scopeStr=scName;
+
//printf("scopeContext=%s scopeUser=%s\n",scopeContext.data(),scopeUser.data());
- // extract name
- int startNamePos=scopePos!=-1 ? scopePos+2 : 0;
+ // extract userscope+name
int endNamePos=bracePos!=-1 ? bracePos : tmpName.length();
- QString nameStr=tmpName.mid(startNamePos,endNamePos-startNamePos);
+ QCString nameStr=tmpName.left(endNamePos);
// extract arguments
- QString argsStr;
+ QCString argsStr;
if (bracePos!=-1) argsStr=tmpName.right(tmpName.length()-bracePos);
// create a default link text if none was explicitly given
bool explicitLink=TRUE;
if (linkText.isNull())
{
- if (!scopeUser.isEmpty()) linkText=scopeUser+"::";
- linkText+=nameStr;
+ //if (!scopeUser.isEmpty()) linkText=scopeUser+"::";
+ linkText=nameStr;
+ if (linkText.left(2)=="::") linkText=linkText.right(linkText.length()-2);
explicitLink=FALSE;
}
//printf("scope=`%s' name=`%s' arg=`%s' linkText=`%s'\n",
// scopeStr.data(),nameStr.data(),argsStr.data(),linkText.data());
- //Define *d=0;
MemberDef *md = 0;
ClassDef *cd = 0;
FileDef *fd = 0;
NamespaceDef *nd = 0;
- int scopeOffset=scopeContext.length();
- do
+
+ //printf("Try with scName=`%s' nameStr=`%s' argsStr=`%s'\n",
+ // scopeStr.data(),nameStr.data(),argsStr.data());
+
+ // check if nameStr is a member or global.
+ if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd))
{
- QString totalScope=scopeUser.copy();
- if (scopeOffset>0)
+ //printf("after getDefs nd=%p\n",nd);
+ QCString anchor = (md->isReference() || md->hasDocumentation()) ? md->anchor() : 0;
+ QCString cName,aName;
+ if (cd) // nameStr is a member of cd
{
- if (!totalScope.isEmpty()) totalScope.prepend("::");
- totalScope.prepend(scopeContext.left(scopeOffset));
+ //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(),
+ // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data());
+ ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
+ anchor,linkText.stripWhiteSpace());
+ cName=cd->name();
+ aName=md->anchor();
}
- //printf("Try with totalScope=`%s'\n",totalScope.data());
- // check if nameStr is a member or global.
- if (getDefs(nameStr,totalScope,argsStr,md,cd,fd,nd))
+ else if (nd) // nameStr is a member of nd
{
- QString anchor = md->hasDocumentation() ? md->anchor() : 0;
- QString cName,aName;
- if (cd) // nameStr is a member of cd
- {
- //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(),
- // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data());
- ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
- anchor,linkText.stripWhiteSpace());
- cName=cd->name();
- aName=md->anchor();
- }
- else if (nd) // nameStr is a member of nd
- {
- ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
- anchor,linkText.stripWhiteSpace());
- cName=nd->name();
- aName=md->anchor();
- }
- else if (fd) // nameStr is a global in file fd
- {
- //printf("addFileLink(%s,%s,%s)\n",fd->getOutputFileBase(),anchor.data(),
- // resultName.stripWhiteSpace().data());
- ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),
- anchor,linkText.stripWhiteSpace());
- cName=fd->name();
- aName=md->anchor();
- }
- else // should not be reached
- {
- //printf("add no link fd=cd=0\n");
- ol.docify(linkText);
- }
+ //printf("writing namespace link\n");
+ ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
+ anchor,linkText.stripWhiteSpace());
+ cName=nd->name();
+ aName=md->anchor();
+ }
+ else if (fd) // nameStr is a global in file fd
+ {
+ //printf("addFileLink(%s,%s,%s)\n",fd->getOutputFileBase(),anchor.data(),
+ // resultName.stripWhiteSpace().data());
+ ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),
+ anchor,linkText.stripWhiteSpace());
+ cName=fd->name();
+ aName=md->anchor();
+ }
+ else // should not be reached
+ {
+ //printf("add no link fd=cd=0\n");
+ ol.docify(linkText);
+ }
- // for functions we add the arguments if explicitly specified or else "()"
- if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot()))
- {
- if (argsStr.isNull())
- ol.writeString("()");
- else
- ol.docify(argsStr);
- }
+ // for functions we add the arguments if explicitly specified or else "()"
+ if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot()))
+ {
+ if (argsStr.isNull())
+ ol.writeString("()");
+ else
+ ol.docify(argsStr);
+ }
- // generate the page reference (for LaTeX)
- if (cName.length()>0 || aName.length()>0)
+ // generate the page reference (for LaTeX)
+ if (cName.length()>0 || aName.length()>0)
+ {
+ if (
+ (cd && !cd->isReference() && cd->isVisible()) ||
+ (fd && !fd->isReference()) ||
+ (nd /* TODO: && !nd->isReference() */)
+ )
{
- if (
- (cd && !cd->isReference() && cd->isVisible()) ||
- (fd && !fd->isReference()) ||
- (nd /* TODO: && !nd->isReference() */)
- )
- {
- ol.writePageRef(cName,aName);
- }
+ ol.writePageRef(cName,aName);
}
- return;
}
- // else if (!nameStr.isNull() && (d=defineDict[nameStr]))
- // // check if nameStr is perhaps a define
- // {
- // if (d->hasDocumentation() && d->fileDef)
- // {
- // ol.writeObjectLink(0,d->fileDef->getOutputFileBase(),d->anchor,
- // linkText.stripWhiteSpace());
- // if (!explicitLink) ol.docify(argsStr);
- // }
- // }
- if (scopeOffset==0)
- scopeOffset=-1;
- else if ((scopeOffset=scopeContext.findRev("::",scopeOffset-1))==-1)
- scopeOffset=0;
- } while (scopeOffset>=0);
-
+ return;
+ }
+
// nothing found
if (rt)
ol.docify(rt);
@@ -2150,9 +2422,9 @@ void generateRef(OutputList &ol,const char *clName,
void generateLink(OutputList &ol,const char *clName,
const char *lr,bool inSeeBlock,const char *lt)
{
- QString linkRef=lr;
+ QCString linkRef=lr;
//PageInfo *pi=0;
- //printf("generateLink(%s,%s)\n",lr,lt);
+ //printf("generateLink(%s,%s,%s) inSeeBlock=%d\n",clName,lr,lt,inSeeBlock);
//FileInfo *fi=0;
FileDef *fd;
bool ambig;
@@ -2172,7 +2444,7 @@ void generateLink(OutputList &ol,const char *clName,
void generateFileRef(OutputList &ol,const char *name,const char *text)
{
- QString linkText = text ? text : name;
+ QCString linkText = text ? text : name;
//FileInfo *fi;
FileDef *fd;
bool ambig;
@@ -2186,14 +2458,14 @@ void generateFileRef(OutputList &ol,const char *name,const char *text)
//----------------------------------------------------------------------
-QString substituteClassNames(const QString &s)
+QCString substituteClassNames(const QCString &s)
{
int i=0,l,p;
- QString result;
+ QCString result;
QRegExp r("[a-z_A-Z][a-z_A-Z0-9]*");
while ((p=r.match(s,i,&l))!=-1)
{
- QString *subst;
+ QCString *subst;
if (p>i) result+=s.mid(i,p-i);
if ((subst=substituteDict[s.mid(p,l)]))
{
@@ -2211,14 +2483,14 @@ QString substituteClassNames(const QString &s)
//----------------------------------------------------------------------
-QString convertSlashes(const QString &s,bool dots)
+QCString convertSlashes(const QCString &s,bool dots)
{
- QString result;
+ QCString result;
int i,l=s.length();
for (i=0;i<l;i++)
if (s.at(i)!='/' && (!dots || s.at(i)!='.'))
{
- if (caseSensitiveNames)
+ if (Config::caseSensitiveNames)
{
result+=s[i];
}
@@ -2235,10 +2507,10 @@ QString convertSlashes(const QString &s,bool dots)
//----------------------------------------------------------------------
// substitute all occurences of `src' in `s' by `dst'
-QString substitute(const char *s,const char *src,const char *dst)
+QCString substitute(const char *s,const char *src,const char *dst)
{
- QString input=s;
- QString output;
+ QCString input=s;
+ QCString output;
int i=0,p;
while ((p=input.find(src,i))!=-1)
{
@@ -2255,8 +2527,8 @@ QString substitute(const char *s,const char *src,const char *dst)
FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig)
{
ambig=FALSE;
- QString name=n;
- QString path;
+ QCString name=n;
+ QCString path;
if (name.isNull()) return 0;
int slashPos=QMAX(name.findRev('/'),name.findRev('\\'));
if (slashPos!=-1)
@@ -2298,8 +2570,8 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig)
void showFileDefMatches(const FileNameDict *fnDict,const char *n)
{
- QString name=n;
- QString path;
+ QCString name=n;
+ QCString path;
int slashPos=QMAX(name.findRev('/'),name.findRev('\\'));
if (slashPos!=-1)
{
@@ -2323,10 +2595,10 @@ void showFileDefMatches(const FileNameDict *fnDict,const char *n)
//----------------------------------------------------------------------
-void setFileNameForSections(QList<QString> *anchorList,const char *fileName)
+void setFileNameForSections(QList<QCString> *anchorList,const char *fileName)
{
if (!anchorList) return;
- QString *s=anchorList->first();
+ QCString *s=anchorList->first();
while (s)
{
SectionInfo *si;
diff --git a/src/util.h b/src/util.h
index a6481cc..515a816 100644
--- a/src/util.h
+++ b/src/util.h
@@ -41,46 +41,47 @@ extern void writeMemberDocs(OutputList &ol,
MemberList *ml,const char *scopeName,MemberDef::MemberType m);
extern void setAnchors(char id,MemberList *ml);
//extern int countMemberDocs(MemberList *ml,MemberDef::MemberType m);
-extern QString fileToString(const char *name);
-extern QString dateToString(bool);
+extern QCString fileToString(const char *name);
+extern QCString dateToString(bool);
//extern OutputList linkifyText(const char *clName,const char *name,
// const char *text);
-extern bool getDefs(const QString &memberName,const QString &className,
+extern bool getDefs(const QCString &scopeName,const QCString &memberName,
const char *, MemberDef *&md, ClassDef *&cd,FileDef *&fd,
NamespaceDef *&nd);
extern void generateRef(OutputList &ol,const char *,
const char *,bool inSeeBlock,const char * =0);
extern void generateLink(OutputList &ol,const char *,
const char *,bool inSeeBlock,const char *);
-extern void generateClassRef(OutputList &ol,const char *clName,
- const char *linkTxt=0);
+//extern void generateClassRef(OutputList &ol,const char *clName,
+// const char *linkTxt=0);
extern void generateFileRef(OutputList &ol,const char *,
const char *linkTxt=0);
extern bool matchArguments(ArgumentList *,ArgumentList *,
const char *cl=0,const char *ns=0);
extern void mergeArguments(ArgumentList *,ArgumentList *);
-extern QString substituteClassNames(const QString &s);
-extern QString convertSlashes(const QString &s,bool dots=FALSE);
-extern QString substitute(const char *s,const char *src,const char *dst);
-extern QString resolveDefines(const char *n);
+extern QCString substituteClassNames(const QCString &s);
+extern QCString convertSlashes(const QCString &s,bool dots=FALSE);
+extern QCString substitute(const char *s,const char *src,const char *dst);
+extern QCString resolveDefines(const char *n);
extern ClassDef *getClass(const char *key);
//extern int strcscmp(const char *s1,const char *s2);
extern FileDef *findFileDef(const FileNameDict *fnDict,const char *n,
bool &ambig);
extern void showFileDefMatches(const FileNameDict *fnDict,const char *n);
extern int guessSection(const char *name);
-//extern QString nameToFile(const char *name);
+//extern QCString nameToFile(const char *name);
extern bool isId(char c);
-extern QString removeRedundantWhiteSpace(const QString &s);
+extern QCString removeRedundantWhiteSpace(const QCString &s);
extern void startTitle(OutputList &ol);
extern void endTitle(OutputList &ol,const char *name);
void startFile(OutputList &ol,const char *name,
const char *title,bool external=FALSE);
void endFile(OutputList &ol,bool external=FALSE);
void writeQuickLinks(OutputList &ol,bool compact,bool external=FALSE);
-QString argListToString(ArgumentList *al);
-QString generateMarker(int id);
+QCString argListToString(ArgumentList *al);
+QCString generateMarker(int id);
void writeExample(OutputList &ol,ExampleList *el);
-void setFileNameForSections(QList<QString> *anchorList,const char *fileName);
+void setFileNameForSections(QList<QCString> *anchorList,const char *fileName);
+QCString stripAnnonymousScope(const QCString &s);
#endif
ANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) - unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) -endforeach() - -# Names to try for mpiexec -# Only mpiexec commands are guaranteed to behave as described in the standard, -# mpirun commands are not covered by the standard in any way whatsoever. -# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. -# srun -n X is however a valid command, so it behaves 'like' mpiexec. -set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) - -unset(_MPIEXEC_NAMES) -foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) - list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") -endforeach() -unset(_MPIEXEC_NAMES_BASE) - -function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) - if(DEFINED MPI_${LANG}_COMPILER_FLAGS) - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") - else() - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") - endif() - execute_process( - COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} - OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE WRAPPER_RETURN) - # Some compiler wrappers will yield spurious zero return values, for example - # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared - # library that has invalid or missing version information there would be warning - # messages emitted by ld.so in the compiler output. In either case, we'll treat - # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") - set(WRAPPER_RETURN 255) - endif() - # Ensure that no error output might be passed upwards. - if(NOT WRAPPER_RETURN EQUAL 0) - unset(WRAPPER_OUTPUT) - endif() - set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) - set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) -endfunction() - -function (_MPI_interrogate_compiler lang) - unset(MPI_COMPILE_CMDLINE) - unset(MPI_LINK_CMDLINE) - - unset(MPI_COMPILE_OPTIONS_WORK) - unset(MPI_COMPILE_DEFINITIONS_WORK) - unset(MPI_INCLUDE_DIRS_WORK) - unset(MPI_LINK_FLAGS_WORK) - unset(MPI_LIB_NAMES_WORK) - unset(MPI_LIB_FULLPATHS_WORK) - - # Check whether the -showme:compile option works. This indicates that we have either Open MPI - # or a newer version of LAM/MPI, and implies that -showme:link will also work. - # Open MPI also supports -show, but separates linker and compiler information - _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - - # MPICH and MVAPICH offer -compile-info and -link-info. - # For modern versions, both do the same as -show. However, for old versions, they do differ - # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the - # removed MPI C++ bindings. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - endif() - - # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the - # -showme commands are more specialized. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - # Older versions of LAM/MPI have "-showme". Open MPI also supports this. - # Unknown to MPICH, MVAPICH and Intel MPI. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) - # Cannot interrogate this compiler, so exit. - set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) - return() - endif() - unset(MPI_COMPILER_RETURN) - - # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE - # into MPI_LINK_CMDLINE, if we didn't find the link line. - if (NOT DEFINED MPI_LINK_CMDLINE) - set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") - endif() - - # At this point, we obtained some output from a compiler wrapper that works. - # We'll now try to parse it into variables with meaning to us. - if("${LANG}" STREQUAL "Fortran") - # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting - # out of a symlink command for mpif.h, the actual compiler command and a deletion of the - # created symlink. We need to detect that case, remember the include path and drop the - # symlink/deletion operation to obtain the link/compile lines we'd usually expect. - if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") - get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - endif() - - # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command - # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. - if(UNIX) - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - - # Extract compile options from the compile command line. - string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) - string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") - # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries - # themselves were built with this flag. However, this flag is unrelated to using MPI, and - # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore - # produce inconsistent results with the regularly flags. - # Similarly, aliasing flags do not belong into our flag array. - if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") - list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") - endif() - endforeach() - - # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. - string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) - string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") - endif() - endforeach() - - # Extract include paths from compile command line - string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:incdirs. - if (NOT MPI_ALL_INCLUDE_PATHS) - _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) - if(MPI_INCDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) - string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) - list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") - endforeach() - - # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:libdirs. - if (NOT MPI_ALL_LINK_PATHS) - _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) - if(MPI_LIBDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) - string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") - string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") - get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") - endforeach() - - # Extract linker flags from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) - string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) - # MPI might be marked to build with non-executable stacks but this should not propagate. - if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") - if (MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") - else() - set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") - endif() - endif() - endforeach() - - # Extract the set of libraries to link against from the link command - # line - string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - - if(WIN32) - # A compiler wrapper on Windows will just have the name of the - # library to link on its link line, potentially with a full path - string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - else() - # On UNIX platforms, archive libraries can be given with full path. - string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - endif() - - # An MPI compiler wrapper could have its MPI libraries in the implictly - # linked directories of the compiler itself. - if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") - endif() - - # Determine full path names for all of the libraries that one needs - # to link against in an MPI program - unset(MPI_PLAIN_LIB_NAMES_WORK) - foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${MPI_LINK_DIRECTORIES_WORK} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - - # Deal with the libraries given with full path next - unset(MPI_DIRECT_LIB_NAMES_WORK) - foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) - list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_PATH} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - if(MPI_DIRECT_LIB_NAMES_WORK) - set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") - endif() - - # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to - # link it in that case. -lpthread is covered by the normal library treatment on the other hand. - if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") - list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") - if(MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " -pthread") - else() - set(MPI_LINK_FLAGS_WORK "-pthread") - endif() - endif() - - # If we found MPI, set up all of the appropriate cache entries - if(NOT MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) - endif() - if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) - endif() - if(NOT MPI_${LANG}_LINK_FLAGS) - set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) - endif() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) -endfunction() - -function(_MPI_guess_settings LANG) - set(MPI_GUESS_FOUND FALSE) - # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. - if(WIN32) - # MSMPI - - # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, - # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers - # or import libraries and vice versa. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") - # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed - # Microsoft MPI. - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") - else() - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") - endif() - - find_library(MPI_msmpi_LIBRARY - NAMES msmpi - HINTS ${MPI_MSMPI_LIB_PATH} - DOC "Location of the msmpi library for Microsoft MPI") - mark_as_advanced(MPI_msmpi_LIBRARY) - - if(MPI_msmpi_LIBRARY) - # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way - # MSMPI can be used and therefore that header has to be present. - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) - unset(MPI_MSMPI_INC_DIR) - endif() - - # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, - # thus it might be present or provided by the user. Figuring out which is supported is done later on. - # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. - # Should a user be employing PGI or have built its own set and provided it via cache variables, the - # splitting routine would have located the module files. - - # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran - # we need some extra library to glue Fortran support together: - # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names - # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran - # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit - # has both variants available. - # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is - # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), - # it's passed immediately after the string address. - - # To summarize: - # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention - # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention - # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention - # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention - # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. - - # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas - # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran - # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - - # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). - - # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. - # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and - # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. - if ("${LANG}" STREQUAL "Fortran") - set(MPI_MSMPI_CALLINGCONVS c) - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) - list(APPEND MPI_MSMPI_CALLINGCONVS s) - endif() - foreach(mpistrlenpos IN ITEMS e m) - foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) - find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY - NAMES msmpif${mpistrlenpos}${mpicallingconv} - HINTS "${MPI_MSMPI_LIB_PATH}" - DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") - mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) - endforeach() - endforeach() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - - # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value - # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. - find_path(MPI_mpifptr_INCLUDE_DIR - NAMES "mpifptr.h" - HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" - DOC "Location of the mpifptr.h extra header for Microsoft MPI") - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) - else() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - endif() - mark_as_advanced(MPI_${LANG}_LIB_NAMES) - set(MPI_GUESS_FOUND TRUE) - endif() - endif() - - # At this point there's not many MPIs that we could still consider. - # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. - # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") - set(MPI_MPICH_PREFIX_PATHS - "$ENV{ProgramW6432}/MPICH2/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" - ) - - # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first - find_library(MPI_mpi_LIBRARY - NAMES mpi - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_mpi_LIBRARY) - # If we found mpi.lib, we detect the rest of MPICH2 - if(MPI_mpi_LIBRARY) - set(MPI_MPICH_LIB_NAMES "mpi") - # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. - # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. - if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) - find_library(MPI_cxx_LIBRARY - NAMES cxx - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_cxx_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "cxx") - # For Fortran, MPICH2 provides three different libraries: - # fmpich2.lib which uses uppercase symbols and cdecl, - # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), - # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. - # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also - # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one - # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation - elseif("${LANG}" STREQUAL "Fortran") - find_library(MPI_fmpich2_LIBRARY - NAMES fmpich2 - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2s_LIBRARY - NAMES fmpich2s - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2g_LIBRARY - NAMES fmpich2g - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") - endif() - - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - unset(MPI_MPICH_LIB_NAMES) - - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - # For MPICH2, the include folder would be in ../include relative to the library folder. - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) - if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - unset(MPI_MPICH_ROOT_DIR) - endif() - set(MPI_GUESS_FOUND TRUE) - endif() - unset(MPI_MPICH_PREFIX_PATHS) - endif() - endif() - set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) -endfunction() - -function(_MPI_adjust_compile_definitions LANG) - if("${LANG}" STREQUAL "CXX") - # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ - # bindings in MPI-2. - if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") - # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI - # OMPI_SKIP_MPICXX is being used in Open MPI - # _MPICC_H is being used for IBM Platform MPI - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") - set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - endif() -endfunction() - -macro(_MPI_assemble_libraries LANG) - set(MPI_${LANG}_LIBRARIES "") - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() -endmacro() - -macro(_MPI_assemble_include_dirs LANG) - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") - endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") - endif() - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") - endforeach() - endif() -endmacro() - -function(_MPI_split_include_dirs LANG) - # Backwards compatibility: Search INCLUDE_PATH if given. - if(MPI_${LANG}_INCLUDE_PATH) - list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") - endif() - - # We try to find the headers/modules among those paths (and system paths) - # For C/C++, we just need to have a look for mpi.h. - if("${LANG}" MATCHES "(C|CXX)") - find_path(MPI_${LANG}_HEADER_DIR "mpi.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - mark_as_advanced(MPI_${LANG}_HEADER_DIR) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - # Fortran is more complicated here: An implementation could provide - # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI - # only provides Fortran 77 and - if mpi.f90 is built - potentially - # a Fortran 90 module. - elseif("${LANG}" STREQUAL "Fortran") - find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - find_path(MPI_${LANG}_MODULE_DIR - NAMES "mpi.mod" "mpi_f08.mod" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS - "${MPI_${LANG}_F77_HEADER_DIR}" - "${MPI_${LANG}_MODULE_DIR}" - ) - endif() - mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) - endif() - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) -endfunction() - -macro(_MPI_create_imported_target LANG) - if(NOT TARGET MPI::MPI_${LANG}) - add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) - endif() - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") - if(MPI_${LANG}_LINK_FLAGS) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") - endif() - # If the compiler links MPI implicitly, no libraries will be found as they're contained within - # CMAKE__IMPLICIT_LINK_LIBRARIES already. - if(MPI_${LANG}_LIBRARIES) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") - endif() - # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") -endmacro() - -function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) - set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") - set(SRC_DIR "${CMAKE_ROOT}/Modules/FindMPI") - set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") - unset(MPI_TEST_COMPILE_DEFINITIONS) - if("${LANG}" STREQUAL "Fortran") - if("${MODE}" STREQUAL "F90_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") - elseif("${MODE}" STREQUAL "F08_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") - else() # F77 header - set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") - endif() - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") - elseif("${LANG}" STREQUAL "CXX") - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") - if("${MODE}" STREQUAL "TEST_MPICXX") - set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) - endif() - else() # C - set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") - endif() - if(RUN_BINARY) - try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) - set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) - else() - try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - COPY_FILE "${BIN_FILE}") - endif() -endfunction() - -macro(_MPI_check_lang_works LANG) - # For Fortran we may have by the MPI-3 standard an implementation that provides: - # - the mpi_f08 module - # - *both*, the mpi module and 'mpif.h' - # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. - if( NOT MPI_${LANG}_WORKS ) - if("${LANG}" STREQUAL "Fortran") - set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) - - set(MPI_${LANG}_WORKS FALSE) - - foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) - if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_${mpimethod} TRUE) - else() - set(MPI_${LANG}_HAVE_${mpimethod} FALSE) - endif() - endforeach() - # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. - # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. - unset(MPI_Fortran_INTEGER_LINE) - if(NOT MPI_${LANG}_WORKS) - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) - if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_F77_HEADER TRUE) - endif() - endif() - else() - _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) - # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't - # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. - set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") - endif() - endif() -endmacro() - -# Some systems install various MPI implementations in separate folders in some MPI prefix -# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. -macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) - if(EXISTS "${PREFIX_FOLDER}") - file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") - foreach(_MPI_folder_child IN LISTS _MPI_folder_children) - if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") - list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") - endif() - endforeach() - endif() -endmacro() - -set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) -if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") - # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ - # We enumerate the subfolders and append each as a prefix - MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") - # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. - list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") - # FreeBSD ships mpich under the normal system paths - but available openmpi implementations - # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi/") -endif() - -# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. -# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution -# ships an mpiexec program (mpirun executables are not regulated by the standard). -find_program(MPIEXEC_EXECUTABLE - NAMES ${_MPIEXEC_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${MPI_HINT_DIRS} - DOC "Executable for running MPI programs.") - -# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). -# This gives us a fairly reliable base directory to search for /bin /lib and /include from. -get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) -get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) - -# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to -# launch an MPI process using mpiexec if such a program exists. -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") -set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") -set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") - -# Set the number of processes to the physical processor count -cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) -set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") -unset(_MPIEXEC_NUMPROCS) -mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) - -#============================================================================= -# Backward compatibility input hacks. Propagate the FindMPI hints to C and -# CXX if the respective new versions are not defined. Translate the old -# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. -# -# Once we find the new variables, we translate them back into their old -# equivalents below. -foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - if(MPI_${LANG}_COMPILE_FLAGS) - unset(MPI_${LANG}_COMPILE_OPTIONS) - unset(MPI_${LANG}_COMPILE_DEFINITIONS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") - endif() - endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - - # If a list of libraries was given, we'll split it into new-style cache variables - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - endif() -endforeach() -#============================================================================= - -unset(MPI_VERSION) -unset(MPI_VERSION_MAJOR) -unset(MPI_VERSION_MINOR) - -unset(_MPI_MIN_VERSION) - -# This loop finds the compilers and sends them off for interrogation. -foreach(LANG IN ITEMS C CXX Fortran) - if(CMAKE_${LANG}_COMPILER_LOADED) - if(NOT MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(_MPI_FIND_${LANG} TRUE) - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - if(_MPI_FIND_${LANG}) - if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") - mark_as_advanced(MPI_CXX_SKIP_MPICXX) - endif() - if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) - if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) - # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. - # Cray PrgEnv. - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - - # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. - if(MPI_${LANG}_WORKS) - set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) - endif() - endif() - - # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. - if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) - endif() - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) - endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - else() - set(MPI_PINNED_COMPILER FALSE) - endif() - - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH - DOC "MPI compiler for ${LANG}" - ) - endif() - - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_SKIP_GUESSING TRUE) - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - endif() - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - endif() - - if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - set(MPI_${LANG}_WRAPPER_FOUND TRUE) - elseif(NOT MPI_SKIP_GUESSING) - _MPI_guess_settings(${LANG}) - endif() - endif() - endif() - - _MPI_split_include_dirs(${LANG}) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - endif() - _MPI_adjust_compile_definitions(${LANG}) - # We always create imported targets even if they're empty - _MPI_create_imported_target(${LANG}) - - if(NOT MPI_${LANG}_WORKS) - _MPI_check_lang_works(${LANG}) - endif() - - # Next, we'll initialize the MPI variables that have not been previously set. - set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) - mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS - MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) - - # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported - # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. - if(MPI_${LANG}_WORKS) - if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) - if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) - _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) - if(MPI_RESULT_${LANG}_test_mpi_MPICXX) - set(MPI_MPICXX_FOUND TRUE) - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - endif() - - # At this point, we know the bindings present but not the MPI version or anything else. - if(NOT DEFINED MPI_${LANG}_VERSION) - unset(MPI_${LANG}_VERSION_MAJOR) - unset(MPI_${LANG}_VERSION_MINOR) - endif() - set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) - - # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the - # Fortran parameters, since those depend on the method of consumption. - # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 - # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. - if("${LANG}" STREQUAL "Fortran") - if(MPI_${LANG}_HAVE_F08_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) - elseif(MPI_${LANG}_HAVE_F90_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) - else() - set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) - endif() - - # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION - # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not - # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. - if(NOT DEFINED MPI_${LANG}_VERSION) - _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) - if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) - file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. - # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING - # and might vary between the different methods of consumption. - if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) - foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) - if(MPI_${LANG}_HAVE_${mpimethod}) - set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) - set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) - _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) - if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND - NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") - if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES - ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") - if("${CMAKE_MATCH_1}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) - endif() - if("${CMAKE_MATCH_2}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) - endif() - endif() - endif() - endif() - endforeach() - set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) - endif() - else() - set(MPI_${LANG}_HIGHEST_METHOD normal) - - # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. - if(NOT DEFINED MPI_${LANG}_VERSION) - file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - unset(MPI_BIN_FOLDER) - - # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. - # The one remaining issue is to determine which MPI library is installed. - # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, - # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING - # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). - # It's also worth noting that the installed version string can depend on the language, or on the system the binary - # runs on if MPI is not statically linked. - if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) - _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) - if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND - "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") - string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" - MPI_${LANG}_LIBRARY_VERSION_STRING) - else() - set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") - endif() - endif() - endif() - - set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) - set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) - set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) - - unset(MPI_${LANG}_REQUIRED_VARS) - if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) - foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") - endforeach() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") - if("${LANG}" STREQUAL "Fortran") - # For Fortran we only need one of the module or header directories to have *some* support for MPI. - if(NOT MPI_${LANG}_MODULE_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") - endif() - if(NOT MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") - endif() - else() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") - endforeach() - endif() - # Append the works variable now. If the settings did not work, this will show up properly. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - else() - # If the compiler worked implicitly, use its path as output. - # Should the compiler variable be set, we also require it to work. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") - if(MPI_${LANG}_COMPILER) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - endif() - endif() - find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} - VERSION_VAR MPI_${LANG}_VERSION) - - if(DEFINED MPI_${LANG}_VERSION) - if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) - set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) - endif() - endif() - endif() -endforeach() - -unset(_MPI_REQ_VARS) -foreach(LANG IN ITEMS C CXX Fortran) - if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") - endif() -endforeach() - -if(MPICXX IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") -endif() - -find_package_handle_standard_args(MPI - REQUIRED_VARS ${_MPI_REQ_VARS} - VERSION_VAR ${_MPI_MIN_VERSION} - HANDLE_COMPONENTS) - -#============================================================================= -# More backward compatibility stuff - -# For compatibility reasons, we also define MPIEXEC -set(MPIEXEC "${MPIEXEC_EXECUTABLE}") - -# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. -foreach(LANG IN ITEMS C CXX Fortran) - if(MPI_${LANG}_FOUND) - set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") - unset(MPI_${LANG}_COMPILE_FLAGS) - if(MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_COMPILE_DEFINITIONS) - foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) - string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") - endforeach() - endif() - endif() -endforeach() - -# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. -# This mimics the behavior of the old language-oblivious FindMPI. -set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) -if (MPI_CXX_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_CXX_${var}}) - endforeach() -elseif (MPI_C_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_C_${var}}) - endforeach() -endif() - -# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. -if (MPI_LIBRARIES) - list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) - set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") - unset(MPI_LIBRARY_WORK) -else() - set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") -endif() - -list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) -if (MPI_NUMLIBS GREATER 1) - set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") - list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) - set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") - unset(MPI_EXTRA_LIBRARY_WORK) -else() - set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") -endif() -#============================================================================= - -# unset these vars to cleanup namespace -unset(_MPI_OLD_VARS) -unset(_MPI_PREFIX_PATH) -unset(_MPI_BASE_DIR) -foreach (lang C CXX Fortran) - unset(_MPI_${LANG}_COMPILER_NAMES) -endforeach() - -cmake_policy(POP) -- cgit v0.12 From f190509675e545bdda4e53d561c30f58a5f5ff4a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Nov 2017 13:50:13 -0500 Subject: Remove incorrect link var --- fortran/CMakeLists.txt | 1 - fortran/examples/CMakeLists.txt | 2 -- 2 files changed, 3 deletions(-) diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index 9f7144d..075e1da 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_F90 C CXX Fortran) if (H5_HAVE_PARALLEL) - set (LINK_LIBS ${LINK_LIBS} MPI::MPI_Fortran) if (MPI_Fortran_LINK_FLAGS) set (CMAKE_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 119648f..82cbd5c 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -107,7 +107,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - MPI::MPI_Fortran ) target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (f90_ex_ph5example PROPERTIES @@ -122,7 +121,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example-shared ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - MPI::MPI_Fortran ) target_include_directories (f90_ex_ph5example-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (f90_ex_ph5example-shared PROPERTIES -- cgit v0.12 From 21874ce5c201b2be7305599434a156b9fbbcfc89 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Nov 2017 15:06:46 -0500 Subject: Add back Find module and add support files --- config/cmake_ext_mod/FindMPI.cmake | 1461 ++++++++++++++++++++ .../cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in | 4 + config/cmake_ext_mod/FindMPI/libver_mpi.c | 19 + config/cmake_ext_mod/FindMPI/libver_mpi.f90.in | 7 + config/cmake_ext_mod/FindMPI/mpiver.f90.in | 10 + config/cmake_ext_mod/FindMPI/test_mpi.c | 37 + config/cmake_ext_mod/FindMPI/test_mpi.f90.in | 6 + 7 files changed, 1544 insertions(+) create mode 100644 config/cmake_ext_mod/FindMPI.cmake create mode 100644 config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in create mode 100644 config/cmake_ext_mod/FindMPI/libver_mpi.c create mode 100644 config/cmake_ext_mod/FindMPI/libver_mpi.f90.in create mode 100644 config/cmake_ext_mod/FindMPI/mpiver.f90.in create mode 100644 config/cmake_ext_mod/FindMPI/test_mpi.c create mode 100644 config/cmake_ext_mod/FindMPI/test_mpi.f90.in diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake new file mode 100644 index 0000000..61ab4a4 --- /dev/null +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -0,0 +1,1461 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. + +#.rst: +# FindMPI +# ------- +# +# Find a Message Passing Interface (MPI) implementation. +# +# The Message Passing Interface (MPI) is a library used to write +# high-performance distributed-memory parallel applications, and is +# typically deployed on a cluster. MPI is a standard interface (defined +# by the MPI forum) for which many implementations are available. +# +# Variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``. +# Each of these controls the various MPI languages to search for. +# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the +# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API +# that was removed again in MPI-3. +# +# Depending on the enabled components the following variables will be set: +# +# ``MPI_FOUND`` +# Variable indicating that MPI settings for all requested languages have been found. +# If no components are specified, this is true if MPI settings for all enabled languages +# were detected. Note that the ``MPICXX`` component does not affect this variable. +# ``MPI_VERSION`` +# Minimal version of MPI detected among the requested languages, or all enabled languages +# if no components were specified. +# +# This module will set the following variables per language in your +# project, where ```` is one of C, CXX, or Fortran: +# +# ``MPI__FOUND`` +# Variable indicating the MPI settings for ```` were found and that +# simple MPI test programs compile with the provided settings. +# ``MPI__COMPILER`` +# MPI compiler for ```` if such a program exists. +# ``MPI__COMPILE_OPTIONS`` +# Compilation options for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__COMPILE_DEFINITIONS`` +# Compilation definitions for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__INCLUDE_DIRS`` +# Include path(s) for MPI header. +# ``MPI__LINK_FLAGS`` +# Linker flags for MPI programs. +# ``MPI__LIBRARIES`` +# All libraries to link MPI programs against. +# +# Additionally, the following :prop_tgt:`IMPORTED` targets are defined: +# +# ``MPI::MPI_`` +# Target for using MPI from ````. +# +# The following variables indicating which bindings are present will be defined: +# +# ``MPI_MPICXX_FOUND`` +# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3). +# ``MPI_Fortran_HAVE_F77_HEADER`` +# True if the Fortran 77 header ``mpif.h`` is available. +# ``MPI_Fortran_HAVE_F90_MODULE`` +# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only). +# ``MPI_Fortran_HAVE_F08_MODULE`` +# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only). +# +# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version +# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions. +# +# ``MPI__VERSION_MAJOR`` +# Major version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION_MINOR`` +# Minor version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION`` +# MPI version implemented for ```` by the MPI distribution. +# +# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards +# always have required this binding to work in both C and C++ code. +# +# For running MPI programs, the module sets the following variables +# +# ``MPIEXEC_EXECUTABLE`` +# Executable for running MPI programs, if such exists. +# ``MPIEXEC_NUMPROC_FLAG`` +# Flag to pass to ``mpiexec`` before giving it the number of processors to run on. +# ``MPIEXEC_MAX_NUMPROCS`` +# Number of MPI processors to utilize. Defaults to the number +# of processors detected on the host system. +# ``MPIEXEC_PREFLAGS`` +# Flags to pass to ``mpiexec`` directly before the executable to run. +# ``MPIEXEC_POSTFLAGS`` +# Flags to pass to ``mpiexec`` after other flags. +# +# Variables for locating MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# This module performs a three step search for an MPI implementation: +# +# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a +# compiler wrapper as ``CMAKE__COMPILER`` or if they're on a Cray system. +# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. +# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. +# Currently, only Microsoft MPI and MPICH2 on Windows are supported. +# +# For controlling the second step, the following variables may be set: +# +# ``MPI__COMPILER`` +# Search for the specified compiler wrapper and use it. +# ``MPI__COMPILER_FLAGS`` +# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers +# support linking debug or tracing libraries if a specific flag is passed and this variable +# may be used to obtain them. +# ``MPI_COMPILER_FLAGS`` +# Used to initialize ``MPI__COMPILER_FLAGS`` if no language specific flag has been given. +# Empty by default. +# ``MPI_EXECUTABLE_SUFFIX`` +# A suffix which is appended to all names that are being looked for. For instance you may set this +# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives. +# +# In order to control the guessing step, the following variable may be set: +# +# ``MPI_GUESS_LIBRARY_NAME`` +# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for. +# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available. +# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden. +# +# Each of the search steps may be skipped with the following control variables: +# +# ``MPI_ASSUME_NO_BUILTIN_MPI`` +# If true, the module assumes that the compiler itself does not provide an MPI implementation and +# skips to step 2. +# ``MPI_SKIP_COMPILER_WRAPPER`` +# If true, no compiler wrapper will be searched for. +# ``MPI_SKIP_GUESSING`` +# If true, the guessing step will be skipped. +# +# Additionally, the following control variable is available to change search behavior: +# +# ``MPI_CXX_SKIP_MPICXX`` +# Add some definitions that will disable the MPI-2 C++ bindings. +# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, +# for example MVAPICH or Intel MPI. +# +# If the find procedure fails for a variable ``MPI__WORKS``, then the settings detected by or passed to +# the module did not work and even a simple MPI test program failed to compile. +# +# If all of these parameters were not sufficient to find the right MPI implementation, a user may +# disable the entire autodetection process by specifying both a list of libraries in ``MPI__LIBRARIES`` +# and a list of include directories in ``MPI__ADDITIONAL_INCLUDE_DIRS``. +# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the +# settings in the cache. +# +# Cache variables for MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The variable ``MPI__INCLUDE_DIRS`` will be assembled from the following variables. +# For C and CXX: +# +# ``MPI__HEADER_DIR`` +# Location of the ``mpi.h`` header on disk. +# +# For Fortran: +# +# ``MPI_Fortran_F77_HEADER_DIR`` +# Location of the Fortran 77 header ``mpif.h``, if it exists. +# ``MPI_Fortran_MODULE_DIR`` +# Location of the ``mpi`` or ``mpi_f08`` modules, if available. +# +# For all languages the following variables are additionally considered: +# +# ``MPI__ADDITIONAL_INCLUDE_DIRS`` +# A :ref:`;-list ` of paths needed in addition to the normal include directories. +# ``MPI__INCLUDE_DIR`` +# Path variables for include folders referred to by ````. +# ``MPI__ADDITIONAL_INCLUDE_VARS`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# The variable ``MPI__LIBRARIES`` will be assembled from the following variables: +# +# ``MPI__LIBRARY`` +# The location of a library called ```` for use with MPI. +# ``MPI__LIB_NAMES`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# Usage of mpiexec +# ^^^^^^^^^^^^^^^^ +# +# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically +# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows: +# +# :: +# +# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} +# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS +# +# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to +# pass to the MPI program. +# +# Advanced variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module can perform some advanced feature detections upon explicit request. +# +# **Important notice:** The following checks cannot be performed without *executing* an MPI test program. +# Consider the special considerations for the behavior of :command:`try_run` during cross compilation. +# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. +# You should only enable these detections if you absolutely need the information. +# +# If the following variables are set to true, the respective search will be performed: +# +# ``MPI_DETERMINE_Fortran_CAPABILITIES`` +# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and +# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran__SUBARRAYS`` +# and ``MPI_Fortran__ASYNCPROT``, where ```` is one of ``F77_HEADER``, ``F90_MODULE`` and +# ``F08_MODULE``. +# ``MPI_DETERMINE_LIBRARY_VERSION`` +# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI__LIBRARY_VERSION``. +# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ````. +# Note that the return value is entirely implementation defined. This information might be used to identify +# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor. +# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ +# +# For backward compatibility with older versions of FindMPI, these +# variables are set, but deprecated: +# +# :: +# +# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY +# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS +# MPI_LIBRARIES +# +# In new projects, please use the ``MPI__XXX`` equivalents. +# Additionally, the following variables are deprecated: +# +# ``MPI__COMPILE_FLAGS`` +# Use ``MPI__COMPILE_OPTIONS`` and ``MPI__COMPILE_DEFINITIONS`` instead. +# ``MPI__INCLUDE_PATH`` +# For consumption use ``MPI__INCLUDE_DIRS`` and for specifying folders use ``MPI__ADDITIONAL_INCLUDE_DIRS`` instead. +# ``MPIEXEC`` +# Use ``MPIEXEC_EXECUTABLE`` instead. + +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + +# include this to handle the QUIETLY and REQUIRED arguments +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +include(GetPrerequisites) + +# Generic compiler names +set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) +set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ + mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) +set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r + mpif90 mpif90_r mpf90 mpf90_r + mpif77 mpif77_r mpf77 mpf77_r + mpifc) + +# GNU compiler names +set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) +set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) +set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r + mpig77 mpig77_r mpg77 mpg77_r) + +# Intel MPI compiler names on Windows +if(WIN32) + list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat) + list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat) + list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat) + + # Intel MPI compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat) + + # Intel MPI compiler names for MSMPI + set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat) + set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat) +else() + # Intel compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) +endif() + +# PGI compiler names +set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) +set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) +set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) + +# XLC MPI Compiler names +set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) +set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC + mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) +set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r + mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r + mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r + mpixlf mpixlf_r mpxlf mpxlf_r) + +# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, +# attempt all of them. +# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper +# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI +# controls its settings via the I_MPI_CC environment variables if the generic name is being used. +# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to +# pick up the right settings for it. +foreach (LANG IN ITEMS C CXX Fortran) + set(_MPI_${LANG}_COMPILER_NAMES "") + foreach (id IN ITEMS GNU Intel MSVC PGI XL) + if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + endif() + unset(_MPI_${id}_${LANG}_COMPILER_NAMES) + endforeach() + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) +endforeach() + +# Names to try for mpiexec +# Only mpiexec commands are guaranteed to behave as described in the standard, +# mpirun commands are not covered by the standard in any way whatsoever. +# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. +# srun -n X is however a valid command, so it behaves 'like' mpiexec. +set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) + +unset(_MPIEXEC_NAMES) +foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) + list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") +endforeach() +unset(_MPIEXEC_NAMES_BASE) + +function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) + if(DEFINED MPI_${LANG}_COMPILER_FLAGS) + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") + else() + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") + endif() + execute_process( + COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} + OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE WRAPPER_RETURN) + # Some compiler wrappers will yield spurious zero return values, for example + # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared + # library that has invalid or missing version information there would be warning + # messages emitted by ld.so in the compiler output. In either case, we'll treat + # the output as invalid. + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + set(WRAPPER_RETURN 255) + endif() + # Ensure that no error output might be passed upwards. + if(NOT WRAPPER_RETURN EQUAL 0) + unset(WRAPPER_OUTPUT) + endif() + set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) + set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) +endfunction() + +function (_MPI_interrogate_compiler lang) + unset(MPI_COMPILE_CMDLINE) + unset(MPI_LINK_CMDLINE) + + unset(MPI_COMPILE_OPTIONS_WORK) + unset(MPI_COMPILE_DEFINITIONS_WORK) + unset(MPI_INCLUDE_DIRS_WORK) + unset(MPI_LINK_FLAGS_WORK) + unset(MPI_LIB_NAMES_WORK) + unset(MPI_LIB_FULLPATHS_WORK) + + # Check whether the -showme:compile option works. This indicates that we have either Open MPI + # or a newer version of LAM/MPI, and implies that -showme:link will also work. + # Open MPI also supports -show, but separates linker and compiler information + _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + + # MPICH and MVAPICH offer -compile-info and -link-info. + # For modern versions, both do the same as -show. However, for old versions, they do differ + # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the + # removed MPI C++ bindings. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + endif() + + # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the + # -showme commands are more specialized. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + # Older versions of LAM/MPI have "-showme". Open MPI also supports this. + # Unknown to MPICH, MVAPICH and Intel MPI. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) + # Cannot interrogate this compiler, so exit. + set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) + return() + endif() + unset(MPI_COMPILER_RETURN) + + # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE + # into MPI_LINK_CMDLINE, if we didn't find the link line. + if (NOT DEFINED MPI_LINK_CMDLINE) + set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") + endif() + + # At this point, we obtained some output from a compiler wrapper that works. + # We'll now try to parse it into variables with meaning to us. + if("${LANG}" STREQUAL "Fortran") + # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting + # out of a symlink command for mpif.h, the actual compiler command and a deletion of the + # created symlink. We need to detect that case, remember the include path and drop the + # symlink/deletion operation to obtain the link/compile lines we'd usually expect. + if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") + get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + endif() + + # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command + # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. + if(UNIX) + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + + # Extract compile options from the compile command line. + string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) + string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") + # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries + # themselves were built with this flag. However, this flag is unrelated to using MPI, and + # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore + # produce inconsistent results with the regularly flags. + # Similarly, aliasing flags do not belong into our flag array. + if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") + list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") + endif() + endforeach() + + # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. + string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) + string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") + endif() + endforeach() + + # Extract include paths from compile command line + string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:incdirs. + if (NOT MPI_ALL_INCLUDE_PATHS) + _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) + if(MPI_INCDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) + string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) + list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") + endforeach() + + # Extract linker paths from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:libdirs. + if (NOT MPI_ALL_LINK_PATHS) + _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) + if(MPI_LIBDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) + string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") + string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") + get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") + endforeach() + + # Extract linker flags from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) + string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) + # MPI might be marked to build with non-executable stacks but this should not propagate. + if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") + if (MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") + else() + set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") + endif() + endif() + endforeach() + + # Extract the set of libraries to link against from the link command + # line + string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + + if(WIN32) + # A compiler wrapper on Windows will just have the name of the + # library to link on its link line, potentially with a full path + string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + else() + # On UNIX platforms, archive libraries can be given with full path. + string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + endif() + + # An MPI compiler wrapper could have its MPI libraries in the implictly + # linked directories of the compiler itself. + if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") + endif() + + # Determine full path names for all of the libraries that one needs + # to link against in an MPI program + unset(MPI_PLAIN_LIB_NAMES_WORK) + foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${MPI_LINK_DIRECTORIES_WORK} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + + # Deal with the libraries given with full path next + unset(MPI_DIRECT_LIB_NAMES_WORK) + foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) + list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_PATH} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + if(MPI_DIRECT_LIB_NAMES_WORK) + set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") + endif() + + # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to + # link it in that case. -lpthread is covered by the normal library treatment on the other hand. + if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") + list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") + if(MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " -pthread") + else() + set(MPI_LINK_FLAGS_WORK "-pthread") + endif() + endif() + + # If we found MPI, set up all of the appropriate cache entries + if(NOT MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) + endif() + if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) + endif() + if(NOT MPI_${LANG}_LINK_FLAGS) + set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) + endif() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) +endfunction() + +function(_MPI_guess_settings LANG) + set(MPI_GUESS_FOUND FALSE) + # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. + if(WIN32) + # MSMPI + + # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, + # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers + # or import libraries and vice versa. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") + # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed + # Microsoft MPI. + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") + else() + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") + endif() + + find_library(MPI_msmpi_LIBRARY + NAMES msmpi + HINTS ${MPI_MSMPI_LIB_PATH} + DOC "Location of the msmpi library for Microsoft MPI") + mark_as_advanced(MPI_msmpi_LIBRARY) + + if(MPI_msmpi_LIBRARY) + # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way + # MSMPI can be used and therefore that header has to be present. + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) + unset(MPI_MSMPI_INC_DIR) + endif() + + # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, + # thus it might be present or provided by the user. Figuring out which is supported is done later on. + # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. + # Should a user be employing PGI or have built its own set and provided it via cache variables, the + # splitting routine would have located the module files. + + # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran + # we need some extra library to glue Fortran support together: + # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names + # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran + # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit + # has both variants available. + # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is + # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), + # it's passed immediately after the string address. + + # To summarize: + # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention + # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention + # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention + # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention + # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. + + # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas + # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran + # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - + # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). + + # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. + # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and + # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. + if ("${LANG}" STREQUAL "Fortran") + set(MPI_MSMPI_CALLINGCONVS c) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) + list(APPEND MPI_MSMPI_CALLINGCONVS s) + endif() + foreach(mpistrlenpos IN ITEMS e m) + foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) + find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY + NAMES msmpif${mpistrlenpos}${mpicallingconv} + HINTS "${MPI_MSMPI_LIB_PATH}" + DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") + mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) + endforeach() + endforeach() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + + # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value + # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. + find_path(MPI_mpifptr_INCLUDE_DIR + NAMES "mpifptr.h" + HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" + DOC "Location of the mpifptr.h extra header for Microsoft MPI") + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) + else() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + endif() + mark_as_advanced(MPI_${LANG}_LIB_NAMES) + set(MPI_GUESS_FOUND TRUE) + endif() + endif() + + # At this point there's not many MPIs that we could still consider. + # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. + # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") + set(MPI_MPICH_PREFIX_PATHS + "$ENV{ProgramW6432}/MPICH2/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" + ) + + # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first + find_library(MPI_mpi_LIBRARY + NAMES mpi + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_mpi_LIBRARY) + # If we found mpi.lib, we detect the rest of MPICH2 + if(MPI_mpi_LIBRARY) + set(MPI_MPICH_LIB_NAMES "mpi") + # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. + # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. + if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) + find_library(MPI_cxx_LIBRARY + NAMES cxx + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_cxx_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "cxx") + # For Fortran, MPICH2 provides three different libraries: + # fmpich2.lib which uses uppercase symbols and cdecl, + # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), + # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. + # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also + # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one + # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation + elseif("${LANG}" STREQUAL "Fortran") + find_library(MPI_fmpich2_LIBRARY + NAMES fmpich2 + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2s_LIBRARY + NAMES fmpich2s + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2g_LIBRARY + NAMES fmpich2g + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") + endif() + + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + unset(MPI_MPICH_LIB_NAMES) + + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + # For MPICH2, the include folder would be in ../include relative to the library folder. + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) + if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + unset(MPI_MPICH_ROOT_DIR) + endif() + set(MPI_GUESS_FOUND TRUE) + endif() + unset(MPI_MPICH_PREFIX_PATHS) + endif() + endif() + set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) +endfunction() + +function(_MPI_adjust_compile_definitions LANG) + if("${LANG}" STREQUAL "CXX") + # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ + # bindings in MPI-2. + if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") + # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI + # OMPI_SKIP_MPICXX is being used in Open MPI + # _MPICC_H is being used for IBM Platform MPI + list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") + set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + endif() +endfunction() + +macro(_MPI_assemble_libraries LANG) + set(MPI_${LANG}_LIBRARIES "") + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() +endmacro() + +macro(_MPI_assemble_include_dirs LANG) + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") + endforeach() + endif() +endmacro() + +function(_MPI_split_include_dirs LANG) + # Backwards compatibility: Search INCLUDE_PATH if given. + if(MPI_${LANG}_INCLUDE_PATH) + list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") + endif() + + # We try to find the headers/modules among those paths (and system paths) + # For C/C++, we just need to have a look for mpi.h. + if("${LANG}" MATCHES "(C|CXX)") + find_path(MPI_${LANG}_HEADER_DIR "mpi.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + mark_as_advanced(MPI_${LANG}_HEADER_DIR) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + # Fortran is more complicated here: An implementation could provide + # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI + # only provides Fortran 77 and - if mpi.f90 is built - potentially + # a Fortran 90 module. + elseif("${LANG}" STREQUAL "Fortran") + find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + find_path(MPI_${LANG}_MODULE_DIR + NAMES "mpi.mod" "mpi_f08.mod" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS + "${MPI_${LANG}_F77_HEADER_DIR}" + "${MPI_${LANG}_MODULE_DIR}" + ) + endif() + mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) + endif() + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) +endfunction() + +macro(_MPI_create_imported_target LANG) + if(NOT TARGET MPI::MPI_${LANG}) + add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) + endif() + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") + if(MPI_${LANG}_LINK_FLAGS) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") + endif() + # If the compiler links MPI implicitly, no libraries will be found as they're contained within + # CMAKE__IMPLICIT_LINK_LIBRARIES already. + if(MPI_${LANG}_LIBRARIES) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") + endif() + # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") +endmacro() + +function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) + set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") + set(SRC_DIR "${CMAKE_ROOT}/Modules/FindMPI") + set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") + unset(MPI_TEST_COMPILE_DEFINITIONS) + if("${LANG}" STREQUAL "Fortran") + if("${MODE}" STREQUAL "F90_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") + elseif("${MODE}" STREQUAL "F08_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") + else() # F77 header + set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") + endif() + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") + elseif("${LANG}" STREQUAL "CXX") + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") + if("${MODE}" STREQUAL "TEST_MPICXX") + set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) + endif() + else() # C + set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") + endif() + if(RUN_BINARY) + try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) + set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) + else() + try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + COPY_FILE "${BIN_FILE}") + endif() +endfunction() + +macro(_MPI_check_lang_works LANG) + # For Fortran we may have by the MPI-3 standard an implementation that provides: + # - the mpi_f08 module + # - *both*, the mpi module and 'mpif.h' + # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. + if( NOT MPI_${LANG}_WORKS ) + if("${LANG}" STREQUAL "Fortran") + set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) + + set(MPI_${LANG}_WORKS FALSE) + + foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) + if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_${mpimethod} TRUE) + else() + set(MPI_${LANG}_HAVE_${mpimethod} FALSE) + endif() + endforeach() + # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. + # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. + unset(MPI_Fortran_INTEGER_LINE) + if(NOT MPI_${LANG}_WORKS) + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) + if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_F77_HEADER TRUE) + endif() + endif() + else() + _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) + # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't + # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. + set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") + endif() + endif() +endmacro() + +# Some systems install various MPI implementations in separate folders in some MPI prefix +# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. +macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) + if(EXISTS "${PREFIX_FOLDER}") + file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") + foreach(_MPI_folder_child IN LISTS _MPI_folder_children) + if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") + list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") + endif() + endforeach() + endif() +endmacro() + +set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) +if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") + # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ + # We enumerate the subfolders and append each as a prefix + MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. + list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") + # FreeBSD ships mpich under the normal system paths - but available openmpi implementations + # will be found in /usr/local/mpi/ + MPI_search_mpi_prefix_folder("/usr/local/mpi/") +endif() + +# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. +# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution +# ships an mpiexec program (mpirun executables are not regulated by the standard). +find_program(MPIEXEC_EXECUTABLE + NAMES ${_MPIEXEC_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${MPI_HINT_DIRS} + DOC "Executable for running MPI programs.") + +# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). +# This gives us a fairly reliable base directory to search for /bin /lib and /include from. +get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) +get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) + +# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to +# launch an MPI process using mpiexec if such a program exists. +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") +set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") +set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") + +# Set the number of processes to the physical processor count +cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) +set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") +unset(_MPIEXEC_NUMPROCS) +mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) + +#============================================================================= +# Backward compatibility input hacks. Propagate the FindMPI hints to C and +# CXX if the respective new versions are not defined. Translate the old +# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. +# +# Once we find the new variables, we translate them back into their old +# equivalents below. +foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") + endif() + endforeach() + + # Chop the old compile flags into options and definitions + if(MPI_${LANG}_COMPILE_FLAGS) + unset(MPI_${LANG}_COMPILE_OPTIONS) + unset(MPI_${LANG}_COMPILE_DEFINITIONS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + endif() +endforeach() +#============================================================================= + +unset(MPI_VERSION) +unset(MPI_VERSION_MAJOR) +unset(MPI_VERSION_MINOR) + +unset(_MPI_MIN_VERSION) + +# This loop finds the compilers and sends them off for interrogation. +foreach(LANG IN ITEMS C CXX Fortran) + if(CMAKE_${LANG}_COMPILER_LOADED) + if(NOT MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(_MPI_FIND_${LANG} TRUE) + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + if(_MPI_FIND_${LANG}) + if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") + mark_as_advanced(MPI_CXX_SKIP_MPICXX) + endif() + if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) + # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. + # Cray PrgEnv. + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + + # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. + if(MPI_${LANG}_WORKS) + set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + endif() + endif() + + # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. + if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) + endif() + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + else() + set(MPI_PINNED_COMPILER FALSE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) + endif() + + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + DOC "MPI compiler for ${LANG}" + ) + + if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_SKIP_GUESSING TRUE) + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + endif() + else() + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + endif() + + if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + set(MPI_${LANG}_WRAPPER_FOUND TRUE) + elseif(NOT MPI_SKIP_GUESSING) + _MPI_guess_settings(${LANG}) + endif() + endif() + endif() + + _MPI_split_include_dirs(${LANG}) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + endif() + _MPI_adjust_compile_definitions(${LANG}) + # We always create imported targets even if they're empty + _MPI_create_imported_target(${LANG}) + + if(NOT MPI_${LANG}_WORKS) + _MPI_check_lang_works(${LANG}) + endif() + + # Next, we'll initialize the MPI variables that have not been previously set. + set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS + MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) + + # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported + # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. + if(MPI_${LANG}_WORKS) + if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) + if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) + _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) + if(MPI_RESULT_${LANG}_test_mpi_MPICXX) + set(MPI_MPICXX_FOUND TRUE) + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + endif() + + # At this point, we know the bindings present but not the MPI version or anything else. + if(NOT DEFINED MPI_${LANG}_VERSION) + unset(MPI_${LANG}_VERSION_MAJOR) + unset(MPI_${LANG}_VERSION_MINOR) + endif() + set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) + + # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the + # Fortran parameters, since those depend on the method of consumption. + # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 + # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. + if("${LANG}" STREQUAL "Fortran") + if(MPI_${LANG}_HAVE_F08_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) + elseif(MPI_${LANG}_HAVE_F90_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) + else() + set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) + endif() + + # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION + # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not + # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. + if(NOT DEFINED MPI_${LANG}_VERSION) + _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) + if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) + file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. + # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING + # and might vary between the different methods of consumption. + if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) + foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) + if(MPI_${LANG}_HAVE_${mpimethod}) + set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) + set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) + _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) + if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND + NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") + if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES + ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") + if("${CMAKE_MATCH_1}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) + endif() + if("${CMAKE_MATCH_2}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) + endif() + endif() + endif() + endif() + endforeach() + set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) + endif() + else() + set(MPI_${LANG}_HIGHEST_METHOD normal) + + # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. + if(NOT DEFINED MPI_${LANG}_VERSION) + file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + unset(MPI_BIN_FOLDER) + + # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. + # The one remaining issue is to determine which MPI library is installed. + # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, + # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING + # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). + # It's also worth noting that the installed version string can depend on the language, or on the system the binary + # runs on if MPI is not statically linked. + if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) + _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) + if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND + "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") + string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" + MPI_${LANG}_LIBRARY_VERSION_STRING) + else() + set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") + endif() + endif() + endif() + + set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) + set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) + set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) + + unset(MPI_${LANG}_REQUIRED_VARS) + if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) + foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") + endforeach() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") + if("${LANG}" STREQUAL "Fortran") + # For Fortran we only need one of the module or header directories to have *some* support for MPI. + if(NOT MPI_${LANG}_MODULE_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") + endif() + if(NOT MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") + endif() + else() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") + endforeach() + endif() + # Append the works variable now. If the settings did not work, this will show up properly. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + else() + # If the compiler worked implicitly, use its path as output. + # Should the compiler variable be set, we also require it to work. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") + if(MPI_${LANG}_COMPILER) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + endif() + endif() + find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} + VERSION_VAR MPI_${LANG}_VERSION) + + if(DEFINED MPI_${LANG}_VERSION) + if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) + set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) + endif() + endif() + endif() +endforeach() + +unset(_MPI_REQ_VARS) +foreach(LANG IN ITEMS C CXX Fortran) + if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") + endif() +endforeach() + +if(MPICXX IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") +endif() + +find_package_handle_standard_args(MPI + REQUIRED_VARS ${_MPI_REQ_VARS} + VERSION_VAR ${_MPI_MIN_VERSION} + HANDLE_COMPONENTS) + +#============================================================================= +# More backward compatibility stuff + +# For compatibility reasons, we also define MPIEXEC +set(MPIEXEC "${MPIEXEC_EXECUTABLE}") + +# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. +foreach(LANG IN ITEMS C CXX Fortran) + if(MPI_${LANG}_FOUND) + set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") + unset(MPI_${LANG}_COMPILE_FLAGS) + if(MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_COMPILE_DEFINITIONS) + foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) + string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") + endforeach() + endif() + endif() +endforeach() + +# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. +# This mimics the behavior of the old language-oblivious FindMPI. +set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) +if (MPI_CXX_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_CXX_${var}}) + endforeach() +elseif (MPI_C_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_C_${var}}) + endforeach() +endif() + +# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. +if (MPI_LIBRARIES) + list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) + set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") + unset(MPI_LIBRARY_WORK) +else() + set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") +endif() + +list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) +if (MPI_NUMLIBS GREATER 1) + set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") + list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) + set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") + unset(MPI_EXTRA_LIBRARY_WORK) +else() + set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") +endif() +#============================================================================= + +# unset these vars to cleanup namespace +unset(_MPI_OLD_VARS) +unset(_MPI_PREFIX_PATH) +unset(_MPI_BASE_DIR) +foreach (lang C CXX Fortran) + unset(_MPI_${LANG}_COMPILER_NAMES) +endforeach() + +cmake_policy(POP) diff --git a/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in new file mode 100644 index 0000000..30f912c --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in @@ -0,0 +1,4 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' + end program mpi_ver diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.c b/config/cmake_ext_mod/FindMPI/libver_mpi.c new file mode 100644 index 0000000..be9d19d --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/libver_mpi.c @@ -0,0 +1,19 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +int main(int argc, char* argv[]) +{ + char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; + int mpilibver_len; + MPI_Get_library_version(mpilibver_str, &mpilibver_len); +#ifdef __cplusplus + std::puts(mpilibver_str); +#else + puts(mpilibver_str); +#endif +} diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in new file mode 100644 index 0000000..7938587 --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in @@ -0,0 +1,7 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str + integer(kind=MPI_INTEGER_KIND) :: ierror, reslen + call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) + print *, mpilibver_str + end program mpi_ver diff --git a/config/cmake_ext_mod/FindMPI/mpiver.f90.in b/config/cmake_ext_mod/FindMPI/mpiver.f90.in new file mode 100644 index 0000000..a254523 --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/mpiver.f90.in @@ -0,0 +1,10 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') + character, dimension(17), parameter :: mpiver_str =& + (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & + char(zero + MPI_VERSION), & + '.', & + char(zero + MPI_SUBVERSION), ']' /) + print *, mpiver_str + end program mpi_ver diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.c b/config/cmake_ext_mod/FindMPI/test_mpi.c new file mode 100644 index 0000000..b8a308a --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/test_mpi.c @@ -0,0 +1,37 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +const char mpiver_str[] = { 'I', 'N', + 'F', 'O', + ':', 'M', + 'P', 'I', + '-', 'V', + 'E', 'R', + '[', ('0' + MPI_VERSION), + '.', ('0' + MPI_SUBVERSION), + ']', '\0' }; +#endif + +int main(int argc, char* argv[]) +{ +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +#ifdef __cplusplus + std::puts(mpiver_str); +#else + puts(mpiver_str); +#endif +#endif +#ifdef TEST_MPI_MPICXX + MPI::MPI_Init(&argc, &argv); + MPI::MPI_Finalize(); +#else + MPI_Init(&argc, &argv); + MPI_Finalize(); +#endif +} diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.f90.in b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in new file mode 100644 index 0000000..4d43a04 --- /dev/null +++ b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in @@ -0,0 +1,6 @@ + program hello + @MPI_Fortran_INCLUDE_LINE@ + integer@MPI_Fortran_INTEGER_LINE@ ierror + call MPI_INIT(ierror) + call MPI_FINALIZE(ierror) + end program -- cgit v0.12 From 7222e5f6a3efee53f6747bc66072129b11c529fe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Nov 2017 15:16:37 -0500 Subject: Change to local path --- config/cmake_ext_mod/FindMPI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index 61ab4a4..b67bcae 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -911,7 +911,7 @@ endmacro() function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") - set(SRC_DIR "${CMAKE_ROOT}/Modules/FindMPI") + set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/Modules/FindMPI") set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") unset(MPI_TEST_COMPILE_DEFINITIONS) if("${LANG}" STREQUAL "Fortran") -- cgit v0.12 From 3de5fa266216fd67999e0ddfcbaad12d4a6d9175 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Nov 2017 15:24:35 -0500 Subject: Correct path --- config/cmake_ext_mod/FindMPI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index b67bcae..8084472 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -911,7 +911,7 @@ endmacro() function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") - set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/Modules/FindMPI") + set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI") set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") unset(MPI_TEST_COMPILE_DEFINITIONS) if("${LANG}" STREQUAL "Fortran") -- cgit v0.12 From a862d195c35730bdef924a776531e2879678a7a6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Nov 2017 16:11:03 -0500 Subject: Correct path --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20ff228..2ec2b2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -630,8 +630,8 @@ if (HDF5_ENABLE_PARALLEL) # and once set, they are cached as false and not regenerated set (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" ) # Used by Fortran + MPI - CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) - CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) + CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) + CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) else () message (STATUS "Parallel libraries not found") endif () -- cgit v0.12 From 03be1267190d2c83379e2ed09d0b86acd3b23388 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 2 Nov 2017 10:07:58 -0500 Subject: HDFFV-10321 change note added. --- release_docs/RELEASE.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b66355e..54867af 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -170,6 +170,17 @@ Bug Fixes since HDF5-1.10.1 release Configuration ------------- + - cmake MPI + + CMake implementation for MPI was problematic and would create incorrect + MPI library references in the hdf5 libraries. + + Reworked the CMake MPI code to properly create CMake targets.Also merged + the latest CMake FindMPI.cmake changes to the local copy. This is necessary + until HDF changes the CMake minimum to 3.9 or greater. + + (ADB - 2017/11/02, HDFFV-10321) + - cmake Too many commands for POST_BUILD step caused command line to be -- cgit v0.12 From 0fe3dc9b278ad7392502ddce438be97eb3e692e2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 2 Nov 2017 10:25:22 -0500 Subject: HDFFV-10321 Correct fortran link var --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ec2b2d..f21f8b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -877,6 +877,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for endif () include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) + set (LINK_Fortran_LIBS ${LINK_LIBS}) + set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS}) if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) @@ -886,8 +888,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for # Parallel IO usage requires MPI to be Linked and Included if (H5_HAVE_PARALLEL) - set (LINK_Fortran_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES}) - set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_Fortran_LIBRARIES}) + set (LINK_Fortran_LIBS ${LINK_Fortran_LIBS} ${MPI_Fortran_LIBRARIES}) + set (LINK_Fortran_SHARED_LIBS ${LINK_Fortran_SHARED_LIBS} ${MPI_Fortran_LIBRARIES}) if (MPI_Fortran_LINK_FLAGS) set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () -- cgit v0.12 From ede110390a615520daff36885012b0210a4c8cdc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 2 Nov 2017 10:34:40 -0500 Subject: New cmake MPI files --- MANIFEST | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MANIFEST b/MANIFEST index c325e64..4270479 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3107,6 +3107,12 @@ ./config/cmake_ext_mod/NSIS.template.in ./config/cmake_ext_mod/runTest.cmake ./config/cmake_ext_mod/version.plist.in +./config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in +./config/cmake_ext_mod/FindMPI/libver_mpi.c +./config/cmake_ext_mod/FindMPI/libver_mpi.f90.in +./config/cmake_ext_mod/FindMPI/mpiver.f90.in +./config/cmake_ext_mod/FindMPI/test_mpi.c +./config/cmake_ext_mod/FindMPI/test_mpi.f90.in # CMake-specific User Files ./config/cmake/UserMacros/Windows_MT.cmake -- cgit v0.12 From 47f4db394bc488d4311a6e1bf833c90abf3247b9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 2 Nov 2017 10:54:43 -0500 Subject: Add missing dir reference --- fortran/examples/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 82cbd5c..426df7e 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -81,7 +81,7 @@ foreach (example ${F2003_examples}) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) -- cgit v0.12 From 0d2fd7ae0cd19c2eb040a4ad733b50c7652639cc Mon Sep 17 00:00:00 2001 From: Richard Warren Date: Thu, 2 Nov 2017 12:33:08 -0400 Subject: Make a fix to allow CMake testing which does not use relative directories. --- hl/tools/h5watch/CMakeLists.txt | 2 +- testpar/t_pread.c | 46 +++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index fde40e3..6b8d5f2 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT (HDF5_HL_TOOLS_H5WATCH) # Define Sources #----------------------------------------------------------------------------- set (H5WATCH_SOURCES - ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch + ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch.c ) #-- Add h5watch program diff --git a/testpar/t_pread.c b/testpar/t_pread.c index b5a84f2..a527503 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -55,6 +55,9 @@ fools.\n"; static int generate_test_file(MPI_Comm comm, int mpi_rank, int group); static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group); +static char *test_argv0 = NULL; +extern char *dirname(char *path); /* Avoids additional includes */ + /*------------------------------------------------------------------------- * Function: generate_test_file @@ -392,9 +395,29 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) if ( pass ) { char cmd[256]; - - HDsprintf(cmd, "../tools/src/h5jam/h5jam -i %s -u %s -o %s", - data_filename, prolog_filename, reloc_data_filename); + char exe_path[256]; + char *relative_path = "../tools/src/h5jam"; + char *exe_dirname = relative_path; + + /* We're checking for the existance of the h5jam utility + * With Cmake testing, all binaries are in the same directory + * e.g. the same location where this executable is found. + * We've copied the argv[0] argument and check to see + * if h5jam is co-located here. Otherwise, the autotools + * put things into directories, hence the relative path. + */ + if (test_argv0 != NULL) { + HDstrncpy(exe_path, test_argv0, sizeof(exe_path)); + if ( (exe_dirname = (char *)dirname(exe_path)) != NULL) { + HDsprintf(cmd, "%s/h5jam", exe_dirname); + if ( HDaccess(cmd, F_OK) != 0) + exe_dirname = relative_path; + } + } + HDsprintf(cmd, "%s/h5jam -i %s -u %s -o %s", + exe_dirname, + data_filename, + prolog_filename, reloc_data_filename); if ( system(cmd) != 0 ) { pass = FALSE; @@ -680,7 +703,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } /* collect results from other processes. - * Only overwrite the failure message if no preveious error + * Only overwrite the failure message if no previous error * has been detected */ local_failure = ( pass ? 0 : 1 ); @@ -761,6 +784,17 @@ main( int argc, char **argv) int split_size; MPI_Comm group_comm = MPI_COMM_WORLD; + /* I don't believe that argv[0] can ever be NULL. + * It should thus be safe to dup and save as a check + * for cmake testing. Note that in our Cmake builds, + * all executables are located in the same directory. + * We assume (but we'll check) that the h5jam utility + * is in the directory as this executable. If that + * isn't true, then we can use a relative path that + * should be valid for the autotools environment. + */ + test_argv0 = HDstrdup(argv[0]); + if ( (MPI_Init(&argc, &argv)) != MPI_SUCCESS) { HDfprintf(stderr, "FATAL: Unable to initialize MPI\n"); HDexit(EXIT_FAILURE); @@ -785,11 +819,11 @@ main( int argc, char **argv) HDfprintf(stdout, "========================================\n"); } - if ( mpi_size < 4 ) { + if ( mpi_size < 3 ) { if ( mpi_rank == 0 ) { - HDprintf(" Need at least 4 processes. Exiting.\n"); + HDprintf(" Need at least 3 processes. Exiting.\n"); } goto finish; } -- cgit v0.12 From b8cbd11dfb229e79b8a9b22ce45dac3e9a735590 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 2 Nov 2017 14:26:44 -0500 Subject: Fix for Intel 18 Fortran compilation error. HDFFV-10322 --- fortran/src/H5f90global.F90 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index dd2b171..629418a 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -142,10 +142,7 @@ MODULE H5GLOBAL INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: predef_types EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER_KIND(1)) - EQUIVALENCE (predef_types(2), H5T_NATIVE_INTEGER_KIND(2)) - EQUIVALENCE (predef_types(3), H5T_NATIVE_INTEGER_KIND(3)) - EQUIVALENCE (predef_types(4), H5T_NATIVE_INTEGER_KIND(4)) - EQUIVALENCE (predef_types(5), H5T_NATIVE_INTEGER_KIND(5)) + ! EQUIVALENCE predef_types(2:5) are unnecessary and violate the standard EQUIVALENCE (predef_types(6), H5T_NATIVE_INTEGER) EQUIVALENCE (predef_types(7), H5T_NATIVE_REAL) EQUIVALENCE (predef_types(8), H5T_NATIVE_DOUBLE) -- cgit v0.12 From df03ecb01d721863f79c86969c56c77d3a846ab2 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 3 Nov 2017 09:10:26 -0500 Subject: HDFFV-10322 --- release_docs/RELEASE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 54867af..ca65d7f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -197,7 +197,8 @@ Bug Fixes since HDF5-1.10.1 release Fortran -------- - - + - Fixed compilation errors when using Intel 18 Fortran compilers + (MSB - 2017/11/3, HDFFV-10322) Tools ----- -- cgit v0.12 From 275fabe6319783b672b6d6e54c1cf68796012224 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 6 Nov 2017 09:28:28 -0600 Subject: Correct issue number --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ca65d7f..a7465e5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -225,7 +225,7 @@ Bug Fixes since HDF5-1.10.1 release Added another parameter to the 'UD=' option to set the flag by default to '0' or H5Z_FLAG_MANDATORY, the other choice is '1' or H5Z_FLAG_OPTIONAL. - (ADB - 2017/08/31, HDFFV-10276) + (ADB - 2017/08/31, HDFFV-10269) - h5ls -- cgit v0.12 From e8239b2de56158d9124972ad1ed74aec76aaee25 Mon Sep 17 00:00:00 2001 From: lrknox Date: Mon, 6 Nov 2017 16:26:03 -0600 Subject: Add check for realtimeOutput environment variable set containing characters to indicate test output should be piped through tee to chklog files in order to send output to stdout as tests run instead of waiting to cat chklog file to stdout when each set of tests is completed. This should stop buildbot from timing out when a test set doesn't complete in less than 20 minutes. --- config/conclude.am | 84 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/config/conclude.am b/config/conclude.am index 55b805a..97aef27 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -16,27 +16,25 @@ ## Textually included at the end of most HDF5 Makefiles.am. ## Contains build rules. -# Automake needs to be taught how to build lib, dyn, progs and tests targets. +# Automake needs to be taught how to build lib, progs and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and # EXTRA_TEST variables are supplied to allow the user to force targets to # be built at certain times. LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB) -DYN = $(dyn_LTLIBRARIES) PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TESTS = $(TEST_PROG) $(TEST_SCRIPT) $(EXTRA_TEST) -dyndir=$(libdir) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = +REALTIMEOUTPUT = $(realtimeOutput) # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. -build-dyn: $(DYN) build-lib: $(LIB) build-progs: $(LIB) $(PROGS) build-tests: $(LIB) $(PROGS) $(chk_TESTS) @@ -44,7 +42,7 @@ build-tests: $(LIB) $(PROGS) $(chk_TESTS) # General rule for recursive building targets. # BUILT_SOURCES contain targets that need to be built before anything else # in the directory (e.g., for Fortran type detection) -lib dyn progs tests check-s check-p :: $(BUILT_SOURCES) +lib progs tests check-s check-p :: $(BUILT_SOURCES) @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; @for d in X $(SUBDIRS); do \ if test $$d != X && test $$d != .; then \ @@ -127,28 +125,62 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ echo "No need to test $${tname} again."; \ else \ - echo "============================" > $${log}; \ - if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ - else \ - echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - srcdir="$(srcdir)" \ - $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $(@:.chkexe_=.chkexe) || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "============================" |& tee $${log}; \ + else \ + echo "============================" > $${log}; \ + fi; \ + if test "X$(FORTRAN_API)" = "Xyes"; then \ + echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" |& tee -a $${log}; \ + else \ + echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + fi; \ + elif test "X$(CXX_API)" = "Xyes"; then \ + echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" |& tee -a $${log};\ + else \ + echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ + fi; \ + else \ + echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" |& tee -a $${log}; \ + else \ + echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + fi; \ + fi; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "============================" |& tee -a $${log}; \ + else \ + echo "============================" >> $${log}; \ + fi; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + srcdir="$(srcdir)" \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) |& tee -a $${log} 2>&1 \ + && touch $(@:.chkexe_=.chkexe) || \ + (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ + (cat $${log} && false) || exit 1; \ + else \ + srcdir="$(srcdir)" \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + && touch $(@:.chkexe_=.chkexe) || \ + (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ + (cat $${log} && false) || exit 1; \ + fi; \ echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ + if test -n "$(REALTIMEOUTPUT)"; then \ + echo "Finished testing $${tname} $(TEST_FLAGS)" |& tee -a $${log}; \ + echo "============================" |& tee -a $${log}; \ + else \ + echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ + echo "============================" >> $${log}; \ + fi; \ + if test -z "$(REALTIMEOUTPUT)"; then \ + cat $${log}; \ + fi; \ fi; \ fi -- cgit v0.12 From d0e32b545c41dcc36a69ab146b54b55e7ac9dc07 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 7 Nov 2017 17:56:27 -0800 Subject: Split internal H5R functionality into H5Rint.c. --- MANIFEST | 1 + src/CMakeLists.txt | 1 + src/H5Oprivate.h | 4 +- src/H5R.c | 765 +++------------------------------------------------- src/H5Rdeprec.c | 118 ++++----- src/H5Rint.c | 767 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Rmodule.h | 11 +- src/H5Rpkg.h | 14 +- src/H5Rprivate.h | 34 ++- src/H5Rpublic.h | 73 ++--- src/H5Sprivate.h | 4 +- src/H5Tprivate.h | 4 +- src/H5Zprivate.h | 7 +- src/Makefile.am | 2 +- 14 files changed, 951 insertions(+), 854 deletions(-) create mode 100644 src/H5Rint.c diff --git a/MANIFEST b/MANIFEST index 4270479..753d33d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -810,6 +810,7 @@ ./src/H5PLextern.h ./src/H5R.c ./src/H5Rdeprec.c +./src/H5Rint.c ./src/H5Rmodule.h ./src/H5Rpkg.h ./src/H5Rprivate.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4be86a9..7ee423b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -532,6 +532,7 @@ IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" ) set (H5R_SOURCES ${HDF5_SRC_DIR}/H5R.c ${HDF5_SRC_DIR}/H5Rdeprec.c + ${HDF5_SRC_DIR}/H5Rint.c ) set (H5R_HDRS ${HDF5_SRC_DIR}/H5Rpkg.h diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 563f8fa..314ee04 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -24,6 +24,9 @@ #ifndef _H5Oprivate_H #define _H5Oprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5O_t H5O_t; + /* Include the public header file for this API */ #include "H5Opublic.h" /* Object header functions */ @@ -44,7 +47,6 @@ /* Forward references of package typedefs */ typedef struct H5O_msg_class_t H5O_msg_class_t; typedef struct H5O_mesg_t H5O_mesg_t; -typedef struct H5O_t H5O_t; /* Values used to create the shared message & attribute heaps */ /* (Note that these parameters have been tuned so that the resulting heap ID diff --git a/src/H5R.c b/src/H5R.c index b000183..8b42b35 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -21,16 +21,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Rpkg.h" /* References */ -#include "H5Sprivate.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Rpkg.h" /* References */ +#include "H5Sprivate.h" /* Dataspaces */ /****************/ @@ -47,20 +44,11 @@ /* Local Prototypes */ /********************/ -static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id); -static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref); -static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, - H5R_type_t ref_type, const void *_ref, char *name, size_t size); - /*********************/ /* Package Variables */ /*********************/ -/* Package initialization variable */ -hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ @@ -71,274 +59,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ -/* Reference ID class */ -static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ - H5I_REFERENCE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - NULL /* Callback routine for closing objects of this class */ -}}; - -/* Flag indicating "top" of interface has been initialized */ -static hbool_t H5R_top_package_initialize_s = FALSE; - - - -/*-------------------------------------------------------------------------- -NAME - H5R__init_package -- Initialize interface-specific information -USAGE - herr_t H5R__init_package() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - ---------------------------------------------------------------------------*/ -herr_t -H5R__init_package(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Initialize the atom group for the file IDs */ - if(H5I_register_type(H5I_REFERENCE_CLS) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface") - - /* Mark "top" of interface as initialized, too */ - H5R_top_package_initialize_s = TRUE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__init_package() */ - - -/*-------------------------------------------------------------------------- - NAME - H5R_top_term_package - PURPOSE - Terminate various H5R objects - USAGE - void H5R_top_term_package() - RETURNS - void - DESCRIPTION - Release IDs for the atom group, deferring full interface shutdown - until later (in H5R_term_package). - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int -H5R_top_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5R_top_package_initialize_s) { - if(H5I_nmembers(H5I_REFERENCE) > 0) { - (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); - n++; /*H5I*/ - } /* end if */ - - /* Mark closed */ - if(0 == n) - H5R_top_package_initialize_s = FALSE; - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5R_top_term_package() */ - - -/*-------------------------------------------------------------------------- - NAME - H5R_term_package - PURPOSE - Terminate various H5R objects - USAGE - void H5R_term_package() - RETURNS - void - DESCRIPTION - Release the atom group and any other resources allocated. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - - Finishes shutting down the interface, after H5R_top_term_package() - is called - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int -H5R_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5_PKG_INIT_VAR) { - /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_REFERENCE)); - HDassert(FALSE == H5R_top_package_initialize_s); - - /* Destroy the reference id group */ - n += (H5I_dec_type_ref(H5I_REFERENCE) > 0); - - /* Mark closed */ - if(0 == n) - H5_PKG_INIT_VAR = FALSE; - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5R_term_package() */ - - -/*-------------------------------------------------------------------------- - NAME - H5R_create - PURPOSE - Creates a particular kind of reference for the user - USAGE - herr_t H5R_create(ref, loc, name, ref_type, space) - void *ref; OUT: Reference created - H5G_loc_t *loc; IN: File location used to locate object pointed to - const char *name; IN: Name of object at location LOC_ID of object - pointed to - H5R_type_t ref_type; IN: Type of reference to create - H5S_t *space; IN: Dataspace ID with selection, used for Dataset - Region references. - - RETURNS - Non-negative on success/Negative on failure - DESCRIPTION - Creates a particular type of reference specified with REF_TYPE, in the - space pointed to by REF. The LOC_ID and NAME are used to locate the object - pointed to and the SPACE_ID is used to choose the region pointed to (for - Dataset Region references). - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id) -{ - H5G_loc_t obj_loc; /* Group hier. location of object */ - H5G_name_t path; /* Object group hier. path */ - H5O_loc_t oloc; /* Object object location */ - hbool_t obj_found = FALSE; /* Object location found */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(_ref); - HDassert(loc); - HDassert(name); - HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); - - /* Set up object location to fill in */ - obj_loc.oloc = &oloc; - obj_loc.path = &path; - H5G_loc_reset(&obj_loc); - - /* Find the object */ - if(H5G_loc_find(loc, name, &obj_loc, H5P_DEFAULT, dxpl_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found") - obj_found = TRUE; - - switch(ref_type) { - case H5R_OBJECT: - { - hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */ - - *ref = obj_loc.oloc->addr; - break; - } - - case H5R_DATASET_REGION: - { - H5HG_t hobjid; /* Heap object ID */ - hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */ - hssize_t buf_size; /* Size of buffer needed to serialize selection */ - uint8_t *p; /* Pointer to OID to store */ - uint8_t *buf; /* Buffer to store serialized selection in */ - unsigned heapid_found; /* Flag for non-zero heap ID found */ - unsigned u; /* local index */ - - /* Set up information for dataset region */ - - /* Return any previous heap block to the free list if we are garbage collecting */ - if(H5F_GC_REF(loc->oloc->file)) { - /* Check for an existing heap ID in the reference */ - for(u = 0, heapid_found = 0, p = (uint8_t *)ref; u < H5R_DSET_REG_REF_BUF_SIZE; u++) - if(p[u] != 0) { - heapid_found = 1; - break; - } /* end if */ - - if(heapid_found != 0) { -/* Return heap block to free list */ - } /* end if */ - } /* end if */ - - /* Zero the heap ID out, may leak heap space if user is re-using reference and doesn't have garbage collection on */ - HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); - - /* Get the amount of space required to serialize the selection */ - if((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") - - /* Increase buffer size to allow for the dataset OID */ - buf_size += (hssize_t)sizeof(haddr_t); - - /* Allocate the space to store the serialized information */ - H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); - if(NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Serialize information for dataset OID into heap buffer */ - p = (uint8_t *)buf; - H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); - - /* Serialize the selection into heap buffer */ - if(H5S_SELECT_SERIALIZE(space, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") - - /* Save the serialized buffer for later */ - H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); - if(H5HG_insert(loc->oloc->file, dxpl_id, (size_t)buf_size, buf, &hobjid) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection") - - /* Serialize the heap ID and index for storage in the file */ - p = (uint8_t *)ref; - H5F_addr_encode(loc->oloc->file, &p, hobjid.addr); - UINT32ENCODE(p, hobjid.idx); - - /* Free the buffer we serialized data in */ - H5MM_xfree(buf); - break; - } - - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } /* end switch */ - -done: - if(obj_found) - H5G_loc_free(&obj_loc); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_create() */ - /*-------------------------------------------------------------------------- NAME @@ -378,23 +98,23 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); /* Check args */ - if(ref == NULL) + if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) + if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") - if(space_id == (-1) && ref_type == H5R_DATASET_REGION) + if (space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) + if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Create reference */ - if((ret_value = H5R_create(ref, &loc, name, ref_type, space, H5AC_ind_read_dxpl_id)) < 0) + if ((ret_value = H5R_create(ref, &loc, name, ref_type, space, H5AC_ind_read_dxpl_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference") done: @@ -404,166 +124,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5R_dereference - PURPOSE - Opens the HDF5 object referenced. - USAGE - hid_t H5R_dereference(ref) - H5F_t *file; IN: File the object being dereferenced is within - H5R_type_t ref_type; IN: Type of reference - void *ref; IN: Reference to open. - - RETURNS - Valid ID on success, Negative on failure - DESCRIPTION - Given a reference to some object, open that object and return an ID for - that object. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Currently only set up to work with references to datasets - EXAMPLES - REVISION LOG - Raymond Lu - 13 July 2011 - I added the OAPL_ID parameter for the object being referenced. It only - supports dataset access property list currently. - - M. Scot Breitenfeld - 3 March 2015 - Added a check for undefined reference pointer. ---------------------------------------------------------------------------*/ -hid_t -H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref) -{ - H5O_loc_t oloc; /* Object location */ - H5G_name_t path; /* Path of object */ - H5G_loc_t loc; /* Group location */ - unsigned rc; /* Reference count of object */ - H5O_type_t obj_type; /* Type of object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(_ref); - HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); - HDassert(file); - - /* Initialize the object location */ - H5O_loc_reset(&oloc); - oloc.file = file; - - switch(ref_type) { - case H5R_OBJECT: - oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ - if(!H5F_addr_defined(oloc.addr) || oloc.addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") - break; - - case H5R_DATASET_REGION: - { - H5HG_t hobjid; /* Heap object ID */ - uint8_t *buf; /* Buffer to store serialized selection in */ - const uint8_t *p; /* Pointer to OID to store */ - - /* Get the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); - UINT32DECODE(p, hobjid.idx); - - if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") - - /* Get the dataset region from the heap (allocate inside routine) */ - if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL))) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") - - /* Get the object oid for the dataset */ - p = buf; - H5F_addr_decode(oloc.file, &p, &(oloc.addr)); - - /* Free the buffer allocated in H5HG_read() */ - H5MM_xfree(buf); - } /* end case */ - break; - - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } /* end switch */ - - /* Get the # of links for object, and its type */ - /* (To check to make certain that this object hasn't been deleted since the reference was created) */ - if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, &obj_type) < 0 || 0 == rc) - HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") - - /* Construct a group location for opening the object */ - H5G_name_reset(&path); - loc.oloc = &oloc; - loc.path = &path; - - /* Open the object */ - switch(obj_type) { - case H5O_TYPE_GROUP: - { - H5G_t *group; /* Pointer to group to open */ - - if(NULL == (group = H5G_open(&loc, dxpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found") - - /* Create an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, group, app_ref)) < 0) { - H5G_close(group); - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group") - } /* end if */ - } /* end case */ - break; - - case H5O_TYPE_NAMED_DATATYPE: - { - H5T_t *type; /* Pointer to datatype to open */ - - if(NULL == (type = H5T_open(&loc, dxpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found") - - /* Create an atom for the datatype */ - if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) { - H5T_close(type); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register datatype") - } /* end if */ - } /* end case */ - break; - - case H5O_TYPE_DATASET: - { - H5D_t *dset; /* Pointer to dataset to open */ - - /* Open the dataset */ - if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") - - /* Create an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) { - H5D_close(dset); - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset") - } /* end if */ - } /* end case */ - break; - - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced") - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_dereference() */ - - -/*-------------------------------------------------------------------------- - NAME H5Rdereference2 PURPOSE Opens the HDF5 object referenced. @@ -601,24 +161,24 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) + if (H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(oapl_id < 0) + if (oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(_ref == NULL) + if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0) + if (H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the file pointer from the entry */ file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, oapl_id, dxpl_id, ref_type, _ref, TRUE)) < 0) + if ((ret_value = H5R_dereference(file, oapl_id, dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") done: @@ -628,75 +188,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5R_get_region - PURPOSE - Retrieves a dataspace with the region pointed to selected. - USAGE - H5S_t *H5R_get_region(file, ref_type, ref) - H5F_t *file; IN: File the object being dereferenced is within - void *ref; IN: Reference to open. - - RETURNS - Pointer to the dataspace on success, NULL on failure - DESCRIPTION - Given a reference to some object, creates a copy of the dataset pointed - to's dataspace and defines a selection in the copy which is the region - pointed to. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static H5S_t * -H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref) -{ - H5O_loc_t oloc; /* Object location */ - const uint8_t *p; /* Pointer to OID to store */ - H5HG_t hobjid; /* Heap object ID */ - uint8_t *buf = NULL; /* Buffer to store serialized selection in */ - H5S_t *ret_value; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(_ref); - HDassert(file); - - /* Initialize the object location */ - H5O_loc_reset(&oloc); - oloc.file = file; - - /* Get the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); - UINT32DECODE(p, hobjid.idx); - - /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information") - - /* Get the object oid for the dataset */ - p = buf; - H5F_addr_decode(oloc.file, &p, &(oloc.addr)); - - /* Open and copy the dataset's dataspace */ - if((ret_value = H5S_read(&oloc, dxpl_id)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found") - - /* Unserialize the selection */ - if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection") - -done: - /* Free the buffer allocated in H5HG_read() */ - if(buf) - H5MM_xfree(buf); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_get_region() */ - - -/*-------------------------------------------------------------------------- - NAME H5Rget_region PURPOSE Retrieves a dataspace with the region pointed to selected. @@ -729,19 +220,19 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if(H5G_loc(id, &loc) < 0) + if (H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(ref_type != H5R_DATASET_REGION) + if (ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(ref == NULL) + if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the dataspace with the correct region selected */ - if((space = H5R_get_region(loc.oloc->file, H5AC_ind_read_dxpl_id, ref)) == NULL) + if ((space = H5R_get_region(loc.oloc->file, H5AC_ind_read_dxpl_id, ref)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") /* Atomize */ - if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: @@ -751,92 +242,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5R_get_obj_type - PURPOSE - Retrieves the type of object that an object reference points to - USAGE - H5O_type_t H5R_get_obj_type(file, ref_type, ref) - H5F_t *file; IN: File the object being dereferenced is within - H5R_type_t ref_type; IN: Type of reference to query - void *ref; IN: Reference to query. - - RETURNS - Success: An object type defined in H5Gpublic.h - Failure: H5G_UNKNOWN - DESCRIPTION - Given a reference to some object, this function returns the type of object - pointed to. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type) -{ - H5O_loc_t oloc; /* Object location */ - unsigned rc; /* Reference count of object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(file); - HDassert(_ref); - - /* Initialize the symbol table entry */ - H5O_loc_reset(&oloc); - oloc.file = file; - - switch(ref_type) { - case H5R_OBJECT: - /* Get the object oid */ - oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ - break; - - case H5R_DATASET_REGION: - { - H5HG_t hobjid; /* Heap object ID */ - const uint8_t *p; /* Pointer to reference to decode */ - uint8_t *buf; /* Buffer to store serialized selection in */ - - /* Get the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); - UINT32DECODE(p, hobjid.idx); - - /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") - - /* Get the object oid for the dataset */ - p = buf; - H5F_addr_decode(oloc.file, &p, &(oloc.addr)); - - /* Free the buffer allocated in H5HG_read() */ - H5MM_xfree(buf); - } /* end case */ - break; - - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } /* end switch */ - - /* Get the # of links for object, and its type */ - /* (To check to make certain that this object hasn't been deleted since the reference was created) */ - if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, obj_type) < 0 || 0 == rc) - HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_get_obj_type() */ - - -/*-------------------------------------------------------------------------- - NAME H5Rget_obj_type2 PURPOSE Retrieves the type of object that an object reference points to @@ -869,16 +274,16 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if(H5G_loc(id, &loc) < 0) + if (H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(ref == NULL) + if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") + if (H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, obj_type) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") done: FUNC_LEAVE_API(ret_value) @@ -887,106 +292,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5R_get_name - PURPOSE - Internal routine to determine a name for the object referenced - USAGE - ssize_t H5R_get_name(f, dxpl_id, ref_type, ref, name, size) - H5F_t *f; IN: Pointer to the file that the reference is pointing - into - hid_t lapl_id; IN: LAPL to use for operation - hid_t dxpl_id; IN: DXPL to use for operation - hid_t id; IN: Location ID given for reference - H5R_type_t ref_type; IN: Type of reference - void *ref; IN: Reference to query. - char *name; OUT: Buffer to place name of object referenced - size_t size; IN: Size of name buffer - - RETURNS - Non-negative length of the path on success, Negative on failure - DESCRIPTION - Given a reference to some object, determine a path to the object - referenced in the file. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - This may not be the only path to that object. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static ssize_t -H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, - const void *_ref, char *name, size_t size) -{ - hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ - H5O_loc_t oloc; /* Object location describing object for reference */ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(f); - HDassert(_ref); - - /* Initialize the object location */ - H5O_loc_reset(&oloc); - oloc.file = f; - - /* Get address for reference */ - switch(ref_type) { - case H5R_OBJECT: - oloc.addr = *(const hobj_ref_t *)_ref; - break; - - case H5R_DATASET_REGION: - { - H5HG_t hobjid; /* Heap object ID */ - uint8_t *buf; /* Buffer to store serialized selection in */ - const uint8_t *p; /* Pointer to OID to store */ - - /* Get the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); - UINT32DECODE(p, hobjid.idx); - - /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") - - /* Get the object oid for the dataset */ - p = buf; - H5F_addr_decode(oloc.file, &p, &(oloc.addr)); - - /* Free the buffer allocated in H5HG_read() */ - H5MM_xfree(buf); - } /* end case */ - break; - - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } /* end switch */ - - /* Retrieve file ID for name search */ - if((file_id = H5I_get_file_id(id, FALSE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID") - - /* Get name, length, etc. */ - if((ret_value = H5G_get_name_by_addr(file_id, lapl_id, dxpl_id, &oloc, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name") - -done: - /* Close file ID used for search */ - if(file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_get_name() */ - - -/*-------------------------------------------------------------------------- - NAME H5Rget_name PURPOSE Determines a name for the object referenced @@ -1030,18 +335,18 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if(H5G_loc(id, &loc) < 0) + if (H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(_ref == NULL) + if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the file pointer from the entry */ file = loc.oloc->file; /* Get name */ - if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_read_dxpl_id, id, ref_type, _ref, name, size)) < 0) + if ((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_read_dxpl_id, id, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 109bbb4..699f8df 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Rdeprec.c - * September 13 2007 - * Quincey Koziol + * Created: H5Rdeprec.c * - * Purpose: Deprecated functions from the H5R interface. These + * Purpose: Deprecated functions from the H5R interface. These * functions are here for compatibility purposes and may be * removed in the future. Applications should switch to the * newer APIs. @@ -35,13 +33,16 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Rpkg.h" /* References */ -#include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */ +/* Public headers needed by this file */ +#include "H5Ppublic.h" /* Property lists */ + +/* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Rpkg.h" /* References */ /****************/ @@ -81,29 +82,22 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS -/*-------------------------------------------------------------------------- - NAME - H5Rget_obj_type1 - PURPOSE - Retrieves the type of object that an object reference points to - USAGE - H5G_obj_t H5Rget_obj_type1(id, ref_type, ref) - hid_t id; IN: Dataset reference object is in or location ID of - object that the dataset is located within. - H5R_type_t ref_type; IN: Type of reference to query - void *ref; IN: Reference to query. - - RETURNS - Success: An object type defined in H5Gpublic.h - Failure: H5G_UNKNOWN - DESCRIPTION - Given a reference to some object, this function returns the type of object - pointed to. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5Rget_obj_type1 + * + * Purpose: Retrieves the type of the object that an object points to. + * + * Parameters: + * id IN: Dataset reference object is in or location ID of + * object that the dataset is located within + * ref_type IN: Type of reference to query + * ref IN: Reference to query + * + * Return: Success: An object type (as defined in H5Gpublic.h) + * Failure: H5G_UNKNOWN + * + *------------------------------------------------------------------------- + */ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { @@ -115,16 +109,16 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("Go", "iRt*x", id, ref_type, ref); /* Check args */ - if(H5G_loc(id, &loc) < 0) + if (H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type") - if(ref == NULL) + if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + if (H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, &obj_type) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -134,28 +128,22 @@ done: } /* end H5Rget_obj_type1() */ -/*-------------------------------------------------------------------------- - NAME - H5Rdereference1 - PURPOSE - Opens the HDF5 object referenced. - USAGE - hid_t H5Rdereference1(ref) - hid_t id; IN: Dataset reference object is in or location ID of - object that the dataset is located within. - H5R_type_t ref_type; IN: Type of reference to create - void *ref; IN: Reference to open. - - RETURNS - Valid ID on success, Negative on failure - DESCRIPTION - Given a reference to some object, open that object and return an ID for - that object. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5Rdereference1 + * + * Purpose: Opens the HDF5 object referenced. + * + * Parameters: + * id IN: Dataset reference object is in or location ID of + * object that the dataset is located within + * ref_type IN: Type of reference to create + * ref IN: Reference to open + * + * Return: Success: Valid HDF5 ID + * Failure: Negative + * + *------------------------------------------------------------------------- + */ hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) { @@ -167,18 +155,18 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) + if (H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if(_ref == NULL) + if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the file pointer from the entry */ file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, ref_type, _ref, TRUE)) < 0) + if ((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object") done: diff --git a/src/H5Rint.c b/src/H5Rint.c new file mode 100644 index 0000000..716a573 --- /dev/null +++ b/src/H5Rint.c @@ -0,0 +1,767 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Rmodule.h" /* This source code file is part of the H5R module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Rpkg.h" /* References */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ + + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Reference ID class + * + * NOTE: H5I_REFERENCE is not used by the library and has been deprecated + * with a tentative removal version of 1.12.0. (DER, July 2017) + */ +static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ + H5I_REFERENCE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + NULL /* Callback routine for closing objects of this class */ +}}; + +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5R_top_package_initialize_s = FALSE; + + +/*-------------------------------------------------------------------------- +NAME + H5R__init_package -- Initialize interface-specific information +USAGE + herr_t H5R__init_package() + +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. + +--------------------------------------------------------------------------*/ +herr_t +H5R__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Initialize the atom group for the file IDs */ + if (H5I_register_type(H5I_REFERENCE_CLS) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface") + + /* Mark "top" of interface as initialized, too */ + H5R_top_package_initialize_s = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R__init_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_top_term_package + PURPOSE + Terminate various H5R objects + USAGE + void H5R_top_term_package() + RETURNS + void + DESCRIPTION + Release IDs for the atom group, deferring full interface shutdown + until later (in H5R_term_package). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5R_top_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5R_top_package_initialize_s) { + if (H5I_nmembers(H5I_REFERENCE) > 0) { + (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); + n++; + } + + /* Mark closed */ + if (0 == n) + H5R_top_package_initialize_s = FALSE; + } + + FUNC_LEAVE_NOAPI(n) +} /* end H5R_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_term_package + PURPOSE + Terminate various H5R objects + USAGE + void H5R_term_package() + RETURNS + void + DESCRIPTION + Release the atom group and any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5R_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5R_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_REFERENCE)); + HDassert(FALSE == H5R_top_package_initialize_s); + + /* Destroy the reference id group */ + n += (H5I_dec_type_ref(H5I_REFERENCE) > 0); + + /* Mark closed */ + if (0 == n) + H5_PKG_INIT_VAR = FALSE; + } + + FUNC_LEAVE_NOAPI(n) +} /* end H5R_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_create + PURPOSE + Creates a particular kind of reference for the user + USAGE + herr_t H5R_create(ref, loc, name, ref_type, space) + void *ref; OUT: Reference created + H5G_loc_t *loc; IN: File location used to locate object pointed to + const char *name; IN: Name of object at location LOC_ID of object + pointed to + H5R_type_t ref_type; IN: Type of reference to create + H5S_t *space; IN: Dataspace ID with selection, used for Dataset + Region references. + + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Creates a particular type of reference specified with REF_TYPE, in the + space pointed to by REF. The LOC_ID and NAME are used to locate the object + pointed to and the SPACE_ID is used to choose the region pointed to (for + Dataset Region references). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id) +{ + H5G_loc_t obj_loc; /* Group hier. location of object */ + H5G_name_t path; /* Object group hier. path */ + H5O_loc_t oloc; /* Object object location */ + hbool_t obj_found = FALSE; /* Object location found */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(_ref); + HDassert(loc); + HDassert(name); + HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); + + /* Set up object location to fill in */ + obj_loc.oloc = &oloc; + obj_loc.path = &path; + H5G_loc_reset(&obj_loc); + + /* Find the object */ + if (H5G_loc_find(loc, name, &obj_loc, H5P_DEFAULT, dxpl_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found") + obj_found = TRUE; + + switch (ref_type) { + case H5R_OBJECT: + { + hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */ + + *ref = obj_loc.oloc->addr; + break; + } + + case H5R_DATASET_REGION: + { + H5HG_t hobjid; /* Heap object ID */ + hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */ + hssize_t buf_size; /* Size of buffer needed to serialize selection */ + uint8_t *p; /* Pointer to OID to store */ + uint8_t *buf; /* Buffer to store serialized selection in */ + unsigned heapid_found; /* Flag for non-zero heap ID found */ + unsigned u; /* local index */ + + /* Set up information for dataset region */ + + /* Return any previous heap block to the free list if we are + * garbage collecting + */ + if (H5F_GC_REF(loc->oloc->file)) { + /* Check for an existing heap ID in the reference */ + for (u = 0, heapid_found = 0, p = (uint8_t *)ref; u < H5R_DSET_REG_REF_BUF_SIZE; u++) + if (p[u] != 0) { + heapid_found = 1; + break; + } + + if (heapid_found != 0) { + /* Return heap block to free list */ + } + } + + /* Zero the heap ID out, may leak heap space if user is re-using + * reference and doesn't have garbage collection turned on + */ + HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); + + /* Get the amount of space required to serialize the selection */ + if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") + + /* Increase buffer size to allow for the dataset OID */ + buf_size += (hssize_t)sizeof(haddr_t); + + /* Allocate the space to store the serialized information */ + H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); + if (NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Serialize information for dataset OID into heap buffer */ + p = (uint8_t *)buf; + H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); + + /* Serialize the selection into heap buffer */ + if (H5S_SELECT_SERIALIZE(space, &p) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") + + /* Save the serialized buffer for later */ + H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); + if (H5HG_insert(loc->oloc->file, dxpl_id, (size_t)buf_size, buf, &hobjid) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection") + + /* Serialize the heap ID and index for storage in the file */ + p = (uint8_t *)ref; + H5F_addr_encode(loc->oloc->file, &p, hobjid.addr); + UINT32ENCODE(p, hobjid.idx); + + /* Free the buffer we serialized data in */ + H5MM_xfree(buf); + break; + } /* end case H5R_DATASET_REGION */ + + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + HDassert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + } /* end switch */ + +done: + if (obj_found) + H5G_loc_free(&obj_loc); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R_create() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_dereference + PURPOSE + Opens the HDF5 object referenced. + USAGE + hid_t H5R_dereference(ref) + H5F_t *file; IN: File the object being dereferenced is within + H5R_type_t ref_type; IN: Type of reference + void *ref; IN: Reference to open. + + RETURNS + Valid ID on success, Negative on failure + DESCRIPTION + Given a reference to some object, open that object and return an ID for + that object. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Currently only set up to work with references to datasets + EXAMPLES + REVISION LOG + Raymond Lu + 13 July 2011 + I added the OAPL_ID parameter for the object being referenced. It only + supports dataset access property list currently. + + M. Scot Breitenfeld + 3 March 2015 + Added a check for undefined reference pointer. +--------------------------------------------------------------------------*/ +hid_t +H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref) +{ + H5O_loc_t oloc; /* Object location */ + H5G_name_t path; /* Path of object */ + H5G_loc_t loc; /* Group location */ + unsigned rc; /* Reference count of object */ + H5O_type_t obj_type; /* Type of object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(_ref); + HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); + HDassert(file); + + /* Initialize the object location */ + H5O_loc_reset(&oloc); + oloc.file = file; + + switch (ref_type) { + case H5R_OBJECT: + { + oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ + if (!H5F_addr_defined(oloc.addr) || oloc.addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") + break; + } + + case H5R_DATASET_REGION: + { + H5HG_t hobjid; /* Heap object ID */ + uint8_t *buf; /* Buffer to store serialized selection in */ + const uint8_t *p; /* Pointer to OID to store */ + + /* Get the heap ID for the dataset region */ + p = (const uint8_t *)_ref; + H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); + UINT32DECODE(p, hobjid.idx); + + if (!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") + + /* Get the dataset region from the heap (allocate inside routine) */ + if (NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL))) + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") + + /* Get the object oid for the dataset */ + p = buf; + H5F_addr_decode(oloc.file, &p, &(oloc.addr)); + + /* Free the buffer allocated in H5HG_read() */ + H5MM_xfree(buf); + break; + } /* end case H5R_DATASET_REGION */ + + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + HDassert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + } /* end switch */ + + /* Get the # of links for object, and its type + * (To check to make certain that this object hasn't been deleted + * since the reference was created) + */ + if (H5O_get_rc_and_type(&oloc, dxpl_id, &rc, &obj_type) < 0 || 0 == rc) + HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") + + /* Construct a group location for opening the object */ + H5G_name_reset(&path); + loc.oloc = &oloc; + loc.path = &path; + + /* Open the object */ + switch (obj_type) { + case H5O_TYPE_GROUP: + { + H5G_t *group; /* Pointer to group to open */ + + if (NULL == (group = H5G_open(&loc, dxpl_id))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found") + + /* Create an atom for the group */ + if ((ret_value = H5I_register(H5I_GROUP, group, app_ref)) < 0) { + H5G_close(group); + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group") + } + + break; + } + + case H5O_TYPE_NAMED_DATATYPE: + { + H5T_t *type; /* Pointer to datatype to open */ + + if (NULL == (type = H5T_open(&loc, dxpl_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found") + + /* Create an atom for the datatype */ + if ((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) { + H5T_close(type); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register datatype") + } + + break; + } + + case H5O_TYPE_DATASET: + { + H5D_t *dset; /* Pointer to dataset to open */ + + /* Open the dataset */ + if (NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") + + /* Create an atom for the dataset */ + if ((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) { + H5D_close(dset); + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset") + } + + break; + } + + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R_dereference() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_get_region + PURPOSE + Retrieves a dataspace with the region pointed to selected. + USAGE + H5S_t *H5R_get_region(file, ref_type, ref) + H5F_t *file; IN: File the object being dereferenced is within + void *ref; IN: Reference to open. + + RETURNS + Pointer to the dataspace on success, NULL on failure + DESCRIPTION + Given a reference to some object, creates a copy of the dataset pointed + to's dataspace and defines a selection in the copy which is the region + pointed to. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +H5S_t * +H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref) +{ + H5O_loc_t oloc; /* Object location */ + const uint8_t *p; /* Pointer to OID to store */ + H5HG_t hobjid; /* Heap object ID */ + uint8_t *buf = NULL; /* Buffer to store serialized selection in */ + H5S_t *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(_ref); + HDassert(file); + + /* Initialize the object location */ + H5O_loc_reset(&oloc); + oloc.file = file; + + /* Get the heap ID for the dataset region */ + p = (const uint8_t *)_ref; + H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); + UINT32DECODE(p, hobjid.idx); + + /* Get the dataset region from the heap (allocate inside routine) */ + if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information") + + /* Get the object oid for the dataset */ + p = buf; + H5F_addr_decode(oloc.file, &p, &(oloc.addr)); + + /* Open and copy the dataset's dataspace */ + if ((ret_value = H5S_read(&oloc, dxpl_id)) == NULL) + HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found") + + /* Unserialize the selection */ + if (H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection") + +done: + /* Free the buffer allocated in H5HG_read() */ + if (buf) + H5MM_xfree(buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R_get_region() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_get_obj_type + PURPOSE + Retrieves the type of object that an object reference points to + USAGE + H5O_type_t H5R_get_obj_type(file, ref_type, ref) + H5F_t *file; IN: File the object being dereferenced is within + H5R_type_t ref_type; IN: Type of reference to query + void *ref; IN: Reference to query. + + RETURNS + Success: An object type defined in H5Gpublic.h + Failure: H5G_UNKNOWN + DESCRIPTION + Given a reference to some object, this function returns the type of object + pointed to. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, + const void *_ref, H5O_type_t *obj_type) +{ + H5O_loc_t oloc; /* Object location */ + unsigned rc; /* Reference count of object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + HDassert(_ref); + + /* Initialize the symbol table entry */ + H5O_loc_reset(&oloc); + oloc.file = file; + + switch (ref_type) { + case H5R_OBJECT: + { + /* Get the object oid */ + oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ + break; + } + + case H5R_DATASET_REGION: + { + H5HG_t hobjid; /* Heap object ID */ + const uint8_t *p; /* Pointer to reference to decode */ + uint8_t *buf; /* Buffer to store serialized selection in */ + + /* Get the heap ID for the dataset region */ + p = (const uint8_t *)_ref; + H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); + UINT32DECODE(p, hobjid.idx); + + /* Get the dataset region from the heap (allocate inside routine) */ + if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") + + /* Get the object oid for the dataset */ + p = buf; + H5F_addr_decode(oloc.file, &p, &(oloc.addr)); + + /* Free the buffer allocated in H5HG_read() */ + H5MM_xfree(buf); + + break; + } + + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + HDassert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + } /* end switch */ + + /* Get the # of links for object, and its type */ + /* (To check to make certain that this object hasn't been deleted since the reference was created) */ + if (H5O_get_rc_and_type(&oloc, dxpl_id, &rc, obj_type) < 0 || 0 == rc) + HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R_get_obj_type() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_get_name + PURPOSE + Internal routine to determine a name for the object referenced + USAGE + ssize_t H5R_get_name(f, dxpl_id, ref_type, ref, name, size) + H5F_t *f; IN: Pointer to the file that the reference is pointing + into + hid_t lapl_id; IN: LAPL to use for operation + hid_t dxpl_id; IN: DXPL to use for operation + hid_t id; IN: Location ID given for reference + H5R_type_t ref_type; IN: Type of reference + void *ref; IN: Reference to query. + char *name; OUT: Buffer to place name of object referenced + size_t size; IN: Size of name buffer + + RETURNS + Non-negative length of the path on success, Negative on failure + DESCRIPTION + Given a reference to some object, determine a path to the object + referenced in the file. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This may not be the only path to that object. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +ssize_t +H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, + const void *_ref, char *name, size_t size) +{ + hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ + H5O_loc_t oloc; /* Object location describing object for reference */ + ssize_t ret_value = -1; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(f); + HDassert(_ref); + + /* Initialize the object location */ + H5O_loc_reset(&oloc); + oloc.file = f; + + /* Get address for reference */ + switch (ref_type) { + case H5R_OBJECT: + { + oloc.addr = *(const hobj_ref_t *)_ref; + break; + } + + case H5R_DATASET_REGION: + { + H5HG_t hobjid; /* Heap object ID */ + uint8_t *buf; /* Buffer to store serialized selection in */ + const uint8_t *p; /* Pointer to OID to store */ + + /* Get the heap ID for the dataset region */ + p = (const uint8_t *)_ref; + H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); + UINT32DECODE(p, hobjid.idx); + + /* Get the dataset region from the heap (allocate inside routine) */ + if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") + + /* Get the object oid for the dataset */ + p = buf; + H5F_addr_decode(oloc.file, &p, &(oloc.addr)); + + /* Free the buffer allocated in H5HG_read() */ + H5MM_xfree(buf); + + break; + } + + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + HDassert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + } /* end switch */ + + /* Retrieve file ID for name search */ + if ((file_id = H5I_get_file_id(id, FALSE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID") + + /* Get name, length, etc. */ + if ((ret_value = H5G_get_name_by_addr(file_id, lapl_id, dxpl_id, &oloc, name, size)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name") + +done: + /* Close file ID used for search */ + if (file_id > 0 && H5I_dec_ref(file_id) < 0) + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R_get_name() */ + diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h index 2eaf050..678a668 100644 --- a/src/H5Rmodule.h +++ b/src/H5Rmodule.h @@ -10,13 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5R package. Including this header means that the source file - * is part of the H5R package. +/* Purpose: This file contains declarations which define macros for the + * H5R package. Including this header means that the source file + * is part of the H5R package. */ #ifndef _H5Rmodule_H #define _H5Rmodule_H @@ -31,4 +27,3 @@ #endif /* _H5Rmodule_H */ - diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 6d5036b..129f944 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Quincey Koziol - * Thursday, September 13, 2007 - * - * Purpose: This file contains declarations which are visible +/* Purpose: This file contains declarations which are visible * only within the H5R package. Source files outside the * H5R package should include H5Rprivate.h instead. */ @@ -30,7 +26,6 @@ #include "H5Rprivate.h" /* Other private headers needed by this file */ -#include "H5Fprivate.h" /* File access */ /**************************/ /* Package Private Macros */ @@ -51,12 +46,5 @@ /* Package Private Prototypes */ /******************************/ -/* General functions */ -H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type); -H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type, - const void *_ref, hbool_t app_ref); - - #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 7efa225..35e63d2 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -20,10 +20,40 @@ #include "H5Rpublic.h" /* Private headers needed by this file */ +#include "H5Fprivate.h" /* Files */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ -/* Internal data structures */ -/* Private functions */ +/**************************/ +/* Library Private Macros */ +/**************************/ + + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/******************************/ +/* Library Private Prototypes */ +/******************************/ + +H5_DLL herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name, + H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id); +H5_DLL H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref); +H5_DLL ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, + H5R_type_t ref_type, const void *_ref, char *name, size_t size); +H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, + const void *_ref, H5O_type_t *obj_type); +H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type, + const void *_ref, hbool_t app_ref); #endif /* _H5Rprivate_H */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 446b7cd..598bafd 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -22,40 +22,59 @@ #include "H5Gpublic.h" #include "H5Ipublic.h" -/* - * Reference types allowed. - */ -typedef enum { - H5R_BADTYPE = (-1), /*invalid Reference Type */ - H5R_OBJECT, /*Object reference */ - H5R_DATASET_REGION, /*Dataset Region Reference */ - H5R_MAXTYPE /*highest type (Invalid as true type) */ -} H5R_type_t; +/*****************/ +/* Public Macros */ +/*****************/ /* Note! Be careful with the sizes of the references because they should really * depend on the run-time values in the file. Unfortunately, the arrays need - * to be defined at compile-time, so we have to go with the worst case sizes for - * them. -QAK + * to be defined at compile-time, so we have to go with the worst case sizes + * for them. -QAK + */ +#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t) + +/* 4 is used instead of sizeof(int) to permit portability between the Crays + * and other machines (the heap ID is always encoded as an int32 anyway). + */ +#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4) + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Reference types */ +typedef enum H5R_type_t { + H5R_BADTYPE = (-1), /* Invalid Reference Type */ + H5R_OBJECT, /* Object reference */ + H5R_DATASET_REGION, /* Dataset Region Reference */ + H5R_MAXTYPE /* Highest type (Invalid as true type) */ +} H5R_type_t; + +/* Object reference structure for user's code + * This needs to be large enough to store largest haddr_t on a worst case + * machine (8 bytes currently). + */ +typedef haddr_t hobj_ref_t; + +/* Dataset Region reference structure for user's code + * (Buffer to store heap ID and index) + * This needs to be large enough to store largest haddr_t in a worst case + * machine (8 bytes currently) plus an int */ -#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t) -/* Object reference structure for user's code */ -typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */ +typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE]; -#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t)+4) -/* 4 is used instead of sizeof(int) to permit portability between - the Crays and other machines (the heap ID is always encoded as an int32 anyway) -*/ -/* Dataset Region reference structure for user's code */ -typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];/* Buffer to store heap ID and index */ -/* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) plus an int */ +/********************/ +/* Public Variables */ +/********************/ -/* Publicly visible data structures */ +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { #endif -/* Functions in H5R.c */ H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref); @@ -63,7 +82,7 @@ H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, - char *name/*out*/, size_t size); + char *name /*out*/, size_t size); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -71,12 +90,6 @@ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, */ #ifndef H5_NO_DEPRECATED_SYMBOLS -/* Macros */ - - -/* Typedefs */ - - /* Function prototypes */ H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref); H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref); diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 8934726..f125035 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -17,6 +17,9 @@ #ifndef _H5Sprivate_H #define _H5Sprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5S_t H5S_t; + /* Include package's public header */ #include "H5Spublic.h" @@ -44,7 +47,6 @@ #define H5S_GET_SEQ_LIST_SORTED 0x0001 /* Forward references of package typedefs */ -typedef struct H5S_t H5S_t; typedef struct H5S_extent_t H5S_extent_t; typedef struct H5S_pnt_node_t H5S_pnt_node_t; typedef struct H5S_hyper_span_t H5S_hyper_span_t; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index f2da62e..17cdc49 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -17,6 +17,9 @@ #ifndef _H5Tprivate_H #define _H5Tprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5T_t H5T_t; + /* Get package's public header */ #include "H5Tpublic.h" @@ -45,7 +48,6 @@ #endif /* H5T_MODULE */ /* Forward references of package typedefs (declared in H5Tpkg.h) */ -typedef struct H5T_t H5T_t; typedef struct H5T_stats_t H5T_stats_t; typedef struct H5T_path_t H5T_path_t; diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index fe182ad..26e35a7 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -18,6 +18,9 @@ #ifndef _H5Zprivate_H #define _H5Zprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5Z_filter_info_t H5Z_filter_info_t; + /* Include package's public header */ #include "H5Zpublic.h" @@ -49,7 +52,7 @@ /****************************/ /* Structure to store information about each filter's parameters */ -typedef struct H5Z_filter_info_t { +struct H5Z_filter_info_t { H5Z_filter_t id; /*filter identification number */ unsigned flags; /*defn and invocation flags */ char _name[H5Z_COMMON_NAME_LEN]; /*internal filter name */ @@ -57,7 +60,7 @@ typedef struct H5Z_filter_info_t { size_t cd_nelmts; /*number of elements in cd_values[] */ unsigned _cd_values[H5Z_COMMON_CD_VALUES]; /*internal client data values */ unsigned *cd_values; /*client data values */ -} H5Z_filter_info_t; +}; /*****************************/ /* Library-private Variables */ diff --git a/src/Makefile.am b/src/Makefile.am index 9a64717..ad29e2a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,7 +98,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5PB.c \ H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \ - H5R.c H5Rdeprec.c \ + H5R.c H5Rint.c H5Rdeprec.c \ H5UC.c \ H5RS.c \ H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \ -- cgit v0.12 From de0076b5ba9869c07056d28318965cf362299162 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Nov 2017 09:05:26 -0600 Subject: Remove tabs --- src/H5Dint.c | 860 ++++++++++++++++++++++++----------------------------------- 1 file changed, 344 insertions(+), 516 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index bdedd1e..b6c0341 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,14 +21,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -54,18 +54,18 @@ typedef struct { /* General stuff */ static herr_t H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, - hbool_t vl_type); + hbool_t vl_type); static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, - const H5T_t *type); + const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, - hid_t dapl_id); + hid_t dapl_id); static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, - char **extfile_prefix); + char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, - hsize_t old_dim[]); + hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); /*********************/ @@ -109,9 +109,9 @@ static H5D_shared_t H5D_def_dset; /* Dataset ID class */ static const H5I_class_t H5I_DATASET_CLS[1] = {{ - H5I_DATASET, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ + H5I_DATASET, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */ }}; @@ -121,17 +121,13 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- - * Function: H5D_init + * Function: H5D_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 4, 2000 + * Return: Success: non-negative * + * Failure: negative *------------------------------------------------------------------------- */ herr_t @@ -149,7 +145,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5D__init_package -- Initialize interface-specific information + H5D__init_package -- Initialize interface-specific information USAGE herr_t H5D__init_package() @@ -211,28 +207,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_top_term_package - * - * Purpose: Close the "top" of the interface, releasing IDs, etc. - * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. + * Function: H5D_top_term_package * - * Programmer: Quincey Koziol - * Sunday, September 13, 2015 + * Purpose: Close the "top" of the interface, releasing IDs, etc. * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. *------------------------------------------------------------------------- */ int H5D_top_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5D_top_package_initialize_s) { - if(H5I_nmembers(H5I_DATASET) > 0) { + if(H5I_nmembers(H5I_DATASET) > 0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open * objects in the file. Using the H5FO code means that dataset @@ -255,9 +247,9 @@ H5D_top_term_package(void) * * QAK - 5/13/03 */ - (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); + (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ /* Mark closed */ if(0 == n) @@ -269,26 +261,22 @@ H5D_top_term_package(void) /*------------------------------------------------------------------------- - * Function: H5D_term_package - * - * Purpose: Terminate this interface. + * Function: H5D_term_package * - * Note: Finishes shutting down the interface, after - * H5D_top_term_package() is called + * Purpose: Terminate this interface. * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Note: Finishes shutting down the interface, after + * H5D_top_term_package() is called * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. *------------------------------------------------------------------------- */ int H5D_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -440,17 +428,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__create_named - * - * Purpose: Internal routine to create a new dataset. + * Function: H5D__create_named * - * Return: Success: Non-NULL, pointer to new dataset object. + * Purpose: Internal routine to create a new dataset. * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Return: Success: Non-NULL, pointer to new dataset object. * + * Failure: NULL *------------------------------------------------------------------------- */ H5D_t * @@ -460,7 +444,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5D_obj_create_t dcrt_info; /* Information for dataset creation */ - H5D_t *ret_value = NULL; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -505,11 +489,7 @@ done: * * Return: * Success: Non-negative - * * Failture: Negative - * - * Programmer: Raymond Lu - * *------------------------------------------------------------------------- */ herr_t @@ -557,7 +537,7 @@ H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id *allocation = H5D_SPACE_STATUS_NOT_ALLOCATED; else if(space_allocated == full_size) *allocation = H5D_SPACE_STATUS_ALLOCATED; - else + else *allocation = H5D_SPACE_STATUS_PART_ALLOCATED; } /* end if */ else { @@ -575,17 +555,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__new - * - * Purpose: Creates a new, empty dataset structure + * Function: H5D__new * - * Return: Success: Pointer to a new dataset descriptor. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Creates a new, empty dataset structure * + * Return: Success: Pointer to a new dataset descriptor. + * Failure: NULL *------------------------------------------------------------------------- */ static H5D_shared_t * @@ -636,26 +611,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_type + * Function: H5D__init_type * - * Purpose: Copy a datatype for a dataset's use, performing all the + * Purpose: Copy a datatype for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, June 24, 2004 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { - htri_t relocatable; /* Flag whether the type is relocatable */ - htri_t immutable; /* Flag whether the type is immutable */ - hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */ - herr_t ret_value = SUCCEED; /* Return value */ + htri_t relocatable; /* Flag whether the type is relocatable */ + htri_t immutable; /* Flag whether the type is immutable */ + hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -681,8 +652,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype") - /* Convert a datatype (if committed) to a transient type if the committed datatype's file - location is different from the file location where the dataset will be created */ + /* Convert a datatype (if committed) to a transient type if the committed datatype's file + location is different from the file location where the dataset will be created */ if(H5T_convert_committed_datatype(dset->shared->type, file) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info") @@ -696,8 +667,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") /* Get a datatype ID for the dataset's datatype */ - if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") + if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") } /* end if */ /* Not a custom datatype, just use it directly */ else { @@ -715,16 +686,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__cache_dataspace_info - * - * Purpose: Cache dataspace info for a dataset - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5D__cache_dataspace_info * - * Programmer: Quincey Koziol - * Wednesday, November 19, 2014 + * Purpose: Cache dataspace info for a dataset * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -759,17 +726,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_space + * Function: H5D__init_space * - * Purpose: Copy a dataspace for a dataset's use, performing all the + * Purpose: Copy a dataspace for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, July 24, 2007 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -811,16 +774,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__update_oh_info - * - * Purpose: Create and fill object header for dataset - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5D__update_oh_info * - * Programmer: Bill Wendling - * Thursday, October 31, 2002 + * Purpose: Create and fill object header for dataset * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -831,9 +790,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) H5O_loc_t *oloc = NULL; /* Dataset's object location */ H5O_layout_t *layout; /* Dataset's layout information */ H5T_t *type; /* Dataset's datatype */ - H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ - H5D_fill_value_t fill_status; /* Fill value status */ - hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */ + H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ + H5D_fill_value_t fill_status; /* Fill value status */ + hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -875,10 +834,12 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") - fill_prop->fill_defined = TRUE; - } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) { - fill_prop->fill_defined = FALSE; - } else + fill_prop->fill_defined = TRUE; + } + else if(fill_status == H5D_FILL_VALUE_UNDEFINED) { + fill_prop->fill_defined = FALSE; + } + else HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined") /* Check for invalid fill & allocation time setting */ @@ -961,17 +922,17 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) { uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */ - unsigned bogus_id; /* "bogus" ID */ + unsigned bogus_id; /* "bogus" ID */ - /* Retrieve "bogus" message ID */ + /* Retrieve "bogus" message ID */ if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") /* Retrieve "bogus" message flags */ if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options") /* Add a "bogus" message (for error testing). */ - if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0) + if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message") } /* end if */ } @@ -1010,9 +971,6 @@ done: * should be used. * * Return: SUCCEED/FAIL - * - * Programmer: Steffen Kiess - * October 16, 2015 *-------------------------------------------------------------------------- */ static herr_t @@ -1025,7 +983,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix size_t extfile_prefix_len; /* length of expanded prefix */ H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - + FUNC_ENTER_NOAPI_NOINIT @@ -1064,7 +1022,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix extpath_len = HDstrlen(extpath); prefix_len = HDstrlen(prefix); extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - + if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); @@ -1081,32 +1039,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__create - * - * Purpose: Creates a new dataset with name NAME in file F and associates - * with it a datatype TYPE for each element as stored in the - * file, dimensionality information or dataspace SPACE, and - * other miscellaneous properties CREATE_PARMS. All arguments - * are deep-copied before being associated with the new dataset, - * so the caller is free to subsequently modify them without - * affecting the dataset. - * - * Return: Success: Pointer to a new dataset - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * + * Function: H5D__create + * + * Purpose: Creates a new dataset with name NAME in file F and associates + * with it a datatype TYPE for each element as stored in the + * file, dimensionality information or dataspace SPACE, and + * other miscellaneous properties CREATE_PARMS. All arguments + * are deep-copied before being associated with the new dataset, + * so the caller is free to subsequently modify them without + * affecting the dataset. + * + * Return: Success: Pointer to a new dataset + * Failure: NULL *------------------------------------------------------------------------- */ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id) { - const H5T_t *type; /* Datatype for dataset */ - H5D_t *new_dset = NULL; - H5P_genplist_t *dc_plist = NULL; /* New Property list */ + const H5T_t *type; /* Datatype for dataset */ + H5D_t *new_dset = NULL; + H5P_genplist_t *dc_plist = NULL; /* New Property list */ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */ @@ -1114,7 +1067,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */ hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */ H5G_loc_t dset_loc; /* Dataset location */ - H5D_t *ret_value = NULL; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1218,24 +1171,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Set the latest version of the layout, pline & fill messages, if requested */ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) { /* Set the latest version for the I/O pipeline message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) - if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) + if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") /* Set the latest version for the fill message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) - /* Set the latest version for the fill value message */ - if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) + /* Set the latest version for the fill value message */ + if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") /* Set the latest version for the layout message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) - /* Set the latest version for the layout message */ - if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) + /* Set the latest version for the layout message */ + if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") } /* end if */ else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) { - /* Use latest indexing type for layout message version >= 4 */ + /* Use latest indexing type for layout message version >= 4 */ if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing") } /* end if */ @@ -1261,7 +1214,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Set up append flush parameters for the dataset */ if(H5D__append_flush_setup(new_dset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) @@ -1329,10 +1282,6 @@ done: * * Return: Success: Ptr to a new dataset. * Failure: NULL - * - * Programmer: Neil Fortner - * Friday, March 6, 2015 - * *------------------------------------------------------------------------- */ H5D_t * @@ -1387,17 +1336,13 @@ done: /* *------------------------------------------------------------------------- - * Function: H5D_open + * Function: H5D_open * - * Purpose: Checks if dataset is already open, or opens a dataset for + * Purpose: Checks if dataset is already open, or opens a dataset for * access. * - * Return: Success: Dataset ID - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Friday, December 20, 2002 - * + * Return: Success: Dataset ID + * Failure: FAIL *------------------------------------------------------------------------- */ H5D_t * @@ -1509,19 +1454,15 @@ done: /* *------------------------------------------------------------------------- - * Function: H5D__flush_append_setup - * - * Purpose: Set the append flush parameters for a dataset - * - * Return: Non-negative on success/Negative on failure + * Function: H5D__flush_append_setup * - * Programmer: Vailin Choi - * Wednesday, January 8, 2014 + * Purpose: Set the append flush parameters for a dataset * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t -H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) +H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) { herr_t ret_value = SUCCEED; /* return value */ @@ -1538,47 +1479,47 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) if(dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) { H5P_genplist_t *dapl; /* data access property list object pointer */ - /* Get dataset access property list */ - if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID"); + /* Get dataset access property list */ + if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID"); - /* Check if append flush property exists */ - if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) { + /* Check if append flush property exists */ + if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) { H5D_append_flush_t info; - /* Get append flush property */ - if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info") - if(info.ndims > 0) { - hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */ - hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */ - int rank; /* dataspace # of dimensions */ - unsigned u; /* local index variable */ - - /* Get dataset rank */ - if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - if(info.ndims != (unsigned)rank) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank") - - /* Validate boundary sizes */ - for(u = 0; u < info.ndims; u++) - if(info.boundary[u] != 0) /* when a non-zero boundary is set */ - /* the dimension is extendible? */ - if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u]) - break; + /* Get append flush property */ + if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info") + if(info.ndims > 0) { + hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */ + hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */ + int rank; /* dataspace # of dimensions */ + unsigned u; /* local index variable */ + + /* Get dataset rank */ + if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + if(info.ndims != (unsigned)rank) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank") + + /* Validate boundary sizes */ + for(u = 0; u < info.ndims; u++) + if(info.boundary[u] != 0) /* when a non-zero boundary is set */ + /* the dimension is extendible? */ + if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u]) + break; /* At least one boundary dimension is not extendible */ - if(u != info.ndims) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid") + if(u != info.ndims) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid") /* Copy append flush settings */ - dset->shared->append_flush.ndims = info.ndims; - dset->shared->append_flush.func = info.func; - dset->shared->append_flush.udata = info.udata; - HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); - } /* end if */ - } /* end if */ + dset->shared->append_flush.ndims = info.ndims; + dset->shared->append_flush.func = info.func; + dset->shared->append_flush.udata = info.udata; + HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); + } /* end if */ + } /* end if */ } /* end if */ done: @@ -1587,15 +1528,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__open_oid - * - * Purpose: Opens a dataset for access. - * - * Return: Dataset pointer on success, NULL on failure + * Function: H5D__open_oid * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Opens a dataset for access. * + * Return: Dataset pointer on success, NULL on failure *------------------------------------------------------------------------- */ static herr_t @@ -1605,8 +1542,8 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */ unsigned alloc_time_state; /* Allocation time state */ htri_t msg_exists; /* Whether a particular type of message exists */ - hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -1652,7 +1589,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) /* Set up flush append property */ if(H5D__append_flush_setup(dataset, dapl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") /* Point at dataset's copy, to cache it for later */ fill_prop = &dataset->shared->dcpl_cache.fill; @@ -1665,7 +1602,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") } /* end if */ else { - /* For backward compatibility, try to retrieve the old fill value message */ + /* For backward compatibility, try to retrieve the old fill value message */ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") if(msg_exists) { @@ -1740,7 +1677,7 @@ done: if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") if(dataset->shared) { - if(layout_init) + if(layout_init) if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") if(dataset->shared->space && H5S_close(dataset->shared->space) < 0) @@ -1763,17 +1700,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_close - * - * Purpose: Insures that all data has been saved to the file, closes the - * dataset object header, and frees all resources used by the - * descriptor. + * Function: H5D_close * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Purpose: Insures that all data has been saved to the file, closes the + * dataset object header, and frees all resources used by the + * descriptor. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1896,7 +1829,7 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") if(corked) - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") /* @@ -1920,9 +1853,9 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { - if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") } /* end if */ @@ -1969,23 +1902,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_mult_refresh_close - * - * Purpose: Closing down the needed information when the dataset has - * multiple opens. (From H5O_refresh_metadata_close()) + * Function: H5D_mult_refresh_close * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi - * 12/24/15 + * Purpose: Closing down the needed information when the dataset has + * multiple opens. (From H5O_refresh_metadata_close()) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id) { - H5D_t *dataset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dataset; /* Dataset to refresh */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2051,16 +1980,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_mult_refresh_reopen - * - * Purpose: Re-initialize the needed info when the dataset has multiple - * opens. (From H5O_refresh_metadata_reopen()) + * Function: H5D_mult_refresh_reopen * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi - * 12/24/15 + * Purpose: Re-initialize the needed info when the dataset has multiple + * opens. (From H5O_refresh_metadata_reopen()) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2075,25 +2000,25 @@ H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id) HDassert(dataset->shared->fo_count > 0); if(dataset->shared->fo_count > 1) { - /* Release dataspace info */ - if(H5S_close(dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - - /* Re-load dataspace info */ - if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") - - /* Cache the dataset's dataspace info */ - if(H5D__cache_dataspace_info(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") - - /* Release layout info */ - if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") - - /* Re-load layout message info */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + /* Release dataspace info */ + if(H5S_close(dataset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + + /* Re-load dataspace info */ + if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + + /* Cache the dataset's dataspace info */ + if(H5D__cache_dataspace_info(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + + /* Release layout info */ + if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") + + /* Re-load layout message info */ + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") } /* end if */ done: @@ -2102,16 +2027,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_oloc - * - * Purpose: Returns a pointer to the object location for a dataset. - * - * Return: Success: Ptr to location - * Failure: NULL + * Function: H5D_oloc * - * Programmer: Robb Matzke - * Friday, April 24, 1998 + * Purpose: Returns a pointer to the object location for a dataset. * + * Return: Success: Ptr to location + * Failure: NULL *------------------------------------------------------------------------- */ H5O_loc_t * @@ -2125,16 +2046,12 @@ H5D_oloc(H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_nameof + * Function: H5D_nameof * - * Purpose: Returns a pointer to the group hier. path for a dataset. - * - * Return: Success: Ptr to entry - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 + * Purpose: Returns a pointer to the group hier. path for a dataset. * + * Return: Success: Ptr to entry + * Failure: NULL *------------------------------------------------------------------------- */ H5G_name_t * @@ -2148,17 +2065,13 @@ H5D_nameof(H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_typeof - * - * Purpose: Returns a pointer to the dataset's datatype. The datatype - * is not copied. - * - * Return: Success: Ptr to the dataset's datatype, uncopied. - * Failure: NULL + * Function: H5D_typeof * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Purpose: Returns a pointer to the dataset's datatype. The datatype + * is not copied. * + * Return: Success: Ptr to the dataset's datatype, uncopied. + * Failure: NULL *------------------------------------------------------------------------- */ H5T_t * @@ -2176,15 +2089,11 @@ H5D_typeof(const H5D_t *dset) /*------------------------------------------------------------------------- - * Function: H5D__alloc_storage + * Function: H5D__alloc_storage * - * Purpose: Allocate storage for the raw data of a dataset. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Friday, January 16, 1998 + * Purpose: Allocate storage for the raw data of a dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2192,11 +2101,11 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]) { const H5D_t *dset = io_info->dset; /* The dataset object */ - H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ - H5O_layout_t *layout; /* The dataset's layout information */ - hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ - hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ + H5O_layout_t *layout; /* The dataset's layout information */ + hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ + hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2246,19 +2155,18 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, } /* end if */ /* If space allocation is set to 'early' and we are extending - * the dataset, indicate that space should be allocated, so the + * the dataset, indicate that space should be allocated, so the * index gets expanded. -QAK */ - if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY - && time_alloc == H5D_ALLOC_EXTEND) - must_init_space = TRUE; + if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY && time_alloc == H5D_ALLOC_EXTEND) + must_init_space = TRUE; break; case H5D_COMPACT: /* Check if space is already allocated */ if(NULL == layout->storage.u.compact.buf) { - /* Reserve space in layout header message for the entire array. - * Starting from the 1.8.7 release, we allow dataspace to have + /* Reserve space in layout header message for the entire array. + * Starting from the 1.8.7 release, we allow dataspace to have * zero dimension size. So the storage size can be zero. * SLU 2011/4/4 */ if(layout->storage.u.compact.size > 0) { @@ -2270,7 +2178,8 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, /* Indicate that we should initialize storage space */ must_init_space = TRUE; - } else { + } + else { layout->storage.u.compact.dirty = FALSE; must_init_space = FALSE; } @@ -2312,7 +2221,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") } /* end if */ else { - H5D_fill_value_t fill_status; /* The fill value status */ + H5D_fill_value_t fill_status; /* The fill value status */ /* Check the dataset's fill-value status */ if(H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0) @@ -2346,24 +2255,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_storage + * Function: H5D__init_storage * - * Purpose: Initialize the data for a new dataset. If a selection is - * defined for SPACE then initialize only that part of the - * dataset. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, October 5, 1998 + * Purpose: Initialize the data for a new dataset. If a selection is + * defined for SPACE then initialize only that part of the + * dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) { const H5D_t *dset = io_info->dset; /* dataset pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2422,22 +2327,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size - * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. + * Function: H5D__get_storage_size * - * Return: Non-negative on success, negative on failure - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Purpose: Determines how much space has been reserved to store the raw + * data of a dataset. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) @@ -2481,24 +2382,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_offset - * - * Purpose: Private function for H5D__get_offset. Returns the address - * of dataset in file. - * - * Return: Success: the address of dataset - * - * Failure: HADDR_UNDEF + * Function: H5D__get_offset * - * Programmer: Raymond Lu - * November 6, 2002 + * Purpose: Private function for H5D__get_offset. Returns the address + * of dataset in file. * + * Return: Success: the address of dataset + * Failure: HADDR_UNDEF *------------------------------------------------------------------------- */ haddr_t H5D__get_offset(const H5D_t *dset) { - haddr_t ret_value = HADDR_UNDEF; + haddr_t ret_value = HADDR_UNDEF; FUNC_ENTER_PACKAGE @@ -2530,18 +2426,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_vlen_reclaim + * Function: H5D_vlen_reclaim * - * Purpose: Frees the buffers allocated for storing variable-length data - * in memory. Only frees the VL data in the selection defined in the - * dataspace. The dataset transfer property list is required to find the - * correct allocation/free methods for the VL data in the buffer. - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, November 22, 2005 + * Purpose: Frees the buffers allocated for storing variable-length data + * in memory. Only frees the VL data in the selection defined in the + * dataspace. The dataset transfer property list is required to find the + * correct allocation/free methods for the VL data in the buffer. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2551,7 +2443,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf) H5S_sel_iter_op_t dset_op; /* Operator for iteration */ H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */ - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2581,18 +2473,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size_alloc - * - * Purpose: This routine makes certain there is enough space in the temporary - * buffer for the new data to read in. All the VL data read in is actually - * placed in this buffer, overwriting the previous data. Needless to say, - * this data is not actually usable. - * - * Return: Non-negative on success, negative on failure + * Function: H5D__vlen_get_buf_size_alloc * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 + * Purpose: This routine makes certain there is enough space in the temporary + * buffer for the new data to read in. All the VL data read in is actually + * placed in this buffer, overwriting the previous data. Needless to say, + * this data is not actually usable. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ void * @@ -2615,14 +2503,14 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size + * Function: H5D__vlen_get_buf_size * - * Purpose: This routine checks the number of bytes required to store a single - * element from a dataset in memory, creating a selection with just the - * single element selected to read in the element and using a custom memory - * allocator for any VL data encountered. - * The *size value is modified according to how many bytes are - * required to store the element in memory. + * Purpose: This routine checks the number of bytes required to store a single + * element from a dataset in memory, creating a selection with just the + * single element selected to read in the element and using a custom memory + * allocator for any VL data encountered. + * The *size value is modified according to how many bytes are + * required to store the element in memory. * * Implementation: This routine actually performs the read with a custom * memory manager which basically just counts the bytes requested and @@ -2632,11 +2520,7 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * Kinda kludgy, but easier than the other method of trying to figure out * the sizes without actually reading the data in... - QAK * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 - * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2673,15 +2557,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__check_filters - * - * Purpose: Check if the filters have be initialized for the dataset - * - * Return: Non-negative on success/Negative on failure + * Function: H5D__check_filters * - * Programmer: Quincey Koziol - * Thursday, October 11, 2007 + * Purpose: Check if the filters have be initialized for the dataset * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2727,16 +2607,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__set_extent + * Function: H5D__set_extent * - * Purpose: Based on H5D_extend, allows change to a lower dimension, - * calls H5S_set_extent and H5D__chunk_prune_by_extent instead - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Purpose: Based on H5D_extend, allows change to a lower dimension, + * calls H5S_set_extent and H5D__chunk_prune_by_extent instead * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2810,7 +2686,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) dset->shared->cache.chunk.scaled_dims[u] > dset->shared->cache.chunk.nslots)) update_chunks = TRUE; - if( !(scaled_power2up = H5VM_power2up(scaled)) ) + if(!(scaled_power2up = H5VM_power2up(scaled))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Check if the number of bits required to encode the scaled size value changed */ @@ -2899,7 +2775,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) && (dset->shared->dcpl_cache.pline.nused > 0)) if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks") - } /* end if */ + } /* end if */ /* Mark the dataspace as dirty, for later writing to the file */ if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) @@ -2912,16 +2788,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_sieve_buf + * Function: H5D__flush_sieve_buf * - * Purpose: Flush any dataset sieve buffer info cached in memory - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * July 27, 2009 + * Purpose: Flush any dataset sieve buffer info cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2953,16 +2825,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_real - * - * Purpose: Flush any dataset information cached in memory - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5D__flush_real * - * Programmer: Quincey Koziol - * December 6, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2990,29 +2858,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__format_convert + * Function: H5D__format_convert * - * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree - * For compact/contiguous: downgrade layout version to 3 - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Vailin Choi - * Feb 2015 + * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree + * For compact/contiguous: downgrade layout version to 3 * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) { - H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ - H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ + H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ + H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ H5O_layout_t *newlayout = NULL; /* The new layout */ hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */ - hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */ + hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */ hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -3062,7 +2926,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) if((new_idx_info.storage->ops->create)(&new_idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") - /* Iterate over the chunks in the current index and insert the chunk addresses + /* Iterate over the chunks in the current index and insert the chunk addresses * into the version 1 B-tree chunk index */ if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) @@ -3105,7 +2969,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) case H5D_NLAYOUTS: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - default: + default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") } /* end switch */ @@ -3147,16 +3011,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__mark - * - * Purpose: Mark some aspect of a dataset as dirty + * Function: H5D__mark * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * July 4, 2008 + * Purpose: Mark some aspect of a dataset as dirty * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -3212,24 +3072,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_cb - * - * Purpose: Flush any dataset information cached in memory + * Function: H5D__flush_cb * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 8, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ static int H5D__flush_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata) { - H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */ + H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */ H5D_flush_ud_t *udata = (H5D_flush_ud_t *)_udata; /* User data for callback */ - int ret_value = H5_ITER_CONT; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -3249,23 +3105,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_flush - * - * Purpose: Flush any dataset information cached in memory + * Function: H5D_flush * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Ray Lu - * August 14, 2002 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id) { - H5D_flush_ud_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_flush_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3286,19 +3138,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_create_plist - * - * Purpose: Private function for H5Dget_create_plist - * - * Return: Success: ID for a copy of the dataset creation - * property list. The template should be - * released by calling H5P_close(). + * Function: H5D_get_create_plist * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Purpose: Private function for H5Dget_create_plist * + * Return: Success: ID for a copy of the dataset creation + * property list. The template should be + * released by calling H5P_close(). + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -3309,8 +3156,8 @@ H5D_get_create_plist(H5D_t *dset) H5O_layout_t copied_layout; /* Layout to tweak */ H5O_fill_t copied_fill; /* Fill value to tweak */ H5O_efl_t copied_efl; /* External file list to tweak */ - hid_t new_dcpl_id = FAIL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t new_dcpl_id = FAIL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3351,7 +3198,7 @@ H5D_get_create_plist(H5D_t *dset) /* Reset index info, if the chunk ops are set */ if(copied_layout.storage.u.chunk.ops) - /* Reset address and pointer of the array struct for the chunked storage index */ + /* Reset address and pointer of the array struct for the chunked storage index */ if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") @@ -3468,18 +3315,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_access_plist - * - * Purpose: Returns a copy of the dataset access property list. - * - * Return: Success: ID for a copy of the dataset access - * property list. - * - * Failure: FAIL + * Function: H5D_get_access_plist * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns a copy of the dataset access property list. * + * Return: Success: ID for a copy of the dataset access + * property list. + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -3537,24 +3379,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_space - * - * Purpose: Returns and ID for the dataspace of the dataset. - * - * Return: Success: ID for dataspace - * - * Failure: FAIL + * Function: H5D_get_space * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns and ID for the dataspace of the dataset. * + * Return: Success: ID for dataspace + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5D_get_space(H5D_t *dset) { - H5S_t *space = NULL; - hid_t ret_value = H5I_INVALID_HID; + H5S_t *space = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT @@ -3582,24 +3419,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_type + * Function: H5D_get_type * - * Purpose: Returns and ID for the datatype of the dataset. - * - * Return: Success: ID for datatype - * - * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns and ID for the datatype of the dataset. * + * Return: Success: ID for datatype + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5D_get_type(H5D_t *dset) { - H5T_t *dt = NULL; - hid_t ret_value = FAIL; + H5T_t *dt = NULL; + hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT @@ -3633,15 +3465,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__refresh + * Function: H5D__refresh * - * Purpose: Refreshes all buffers associated with a dataset. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * November 2015 + * Purpose: Refreshes all buffers associated with a dataset. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3668,7 +3496,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id) if(H5D__virtual_refresh_source_dsets(dset, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets") } /* end if */ - + /* Refresh dataset object */ if((H5O_refresh_metadata(dset_id, dset->oloc, dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset") -- cgit v0.12 From 218845c603e1bdbae92fb4ec4483781b0b889a47 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Nov 2017 09:57:15 -0600 Subject: Remove tabs --- src/H5Dpkg.h | 136 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 097fab7..beb1089 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, April 14, 2003 + * Programmer: Quincey Koziol + * Monday, April 14, 2003 * - * Purpose: This file contains declarations which are visible only within - * the H5D package. Source files outside the H5D package should - * include H5Dprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5D package. Source files outside the H5D package should + * include H5Dprivate.h instead. */ #if !(defined H5D_FRIEND || defined H5D_MODULE) #error "Do not include this file outside the H5D package!" @@ -30,12 +30,12 @@ #include "H5Dprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5B2private.h" /* v2 B-trees */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5SLprivate.h" /* Skip lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5SLprivate.h" /* Skip lists */ +#include "H5Tprivate.h" /* Datatypes */ /**************************/ /* Package Private Macros */ @@ -70,22 +70,22 @@ /* See H5O_layout_chunk_t */ /* Fixed array creation values */ -#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */ -#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ +#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */ +#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ /* Extensible array creation values */ -#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */ -#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */ -#define H5D_EARRAY_IDX_BLK_ELMTS 4 -#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4 -#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16 -#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ +#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */ +#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */ +#define H5D_EARRAY_IDX_BLK_ELMTS 4 +#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4 +#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16 +#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ /* v2 B-tree creation values for raw meta_size */ -#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */ -#define H5D_BT2_NODE_SIZE 2048 -#define H5D_BT2_SPLIT_PERC 100 -#define H5D_BT2_MERGE_PERC 40 +#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */ +#define H5D_BT2_NODE_SIZE 2048 +#define H5D_BT2_SPLIT_PERC 100 +#define H5D_BT2_MERGE_PERC 40 /****************************/ @@ -97,23 +97,23 @@ typedef struct H5D_type_info_t { /* Initial values */ const H5T_t *mem_type; /* Pointer to memory datatype */ const H5T_t *dset_type; /* Pointer to dataset datatype */ - H5T_path_t *tpath; /* Datatype conversion path */ + H5T_path_t *tpath; /* Datatype conversion path */ hid_t src_type_id; /* Source datatype ID */ hid_t dst_type_id; /* Destination datatype ID */ /* Computed/derived values */ - size_t src_type_size; /* Size of source type */ - size_t dst_type_size; /* Size of destination type */ - size_t max_type_size; /* Size of largest source/destination type */ - hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */ - hbool_t is_xform_noop; /* Whether the data transform is a NOOP */ + size_t src_type_size; /* Size of source type */ + size_t dst_type_size; /* Size of destination type */ + size_t max_type_size; /* Size of largest source/destination type */ + hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */ + hbool_t is_xform_noop; /* Whether the data transform is a NOOP */ const H5T_subset_info_t *cmpd_subset; /* Info related to the compound subset conversion functions */ - H5T_bkg_t need_bkg; /* Type of background buf needed */ - size_t request_nelmts; /* Requested strip mine */ - uint8_t *tconv_buf; /* Datatype conv buffer */ - hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */ - uint8_t *bkg_buf; /* Background buffer */ - hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ + H5T_bkg_t need_bkg; /* Type of background buf needed */ + size_t request_nelmts; /* Requested strip mine */ + uint8_t *tconv_buf; /* Datatype conv buffer */ + hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */ + uint8_t *bkg_buf; /* Background buffer */ + hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; /* Forward declaration of structs used below */ @@ -191,13 +191,13 @@ typedef struct { } H5D_chunk_storage_t; typedef struct { - void *buf; /* Buffer for compact dataset */ + void *buf; /* Buffer for compact dataset */ hbool_t *dirty; /* Pointer to dirty flag to mark */ } H5D_compact_storage_t; typedef union H5D_storage_t { H5D_contig_storage_t contig; /* Contiguous information for dataset */ - H5D_chunk_storage_t chunk; /* Chunk information for dataset */ + H5D_chunk_storage_t chunk; /* Chunk information for dataset */ H5D_compact_storage_t compact; /* Compact information for dataset */ H5O_efl_t efl; /* External file list information for dataset */ } H5D_storage_t; @@ -261,10 +261,10 @@ typedef struct H5D_chk_idx_info_t { * The chunk's file address, filter mask and size on disk are not key values. */ typedef struct H5D_chunk_rec_t { - hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ - uint32_t nbytes; /* Size of stored data */ - uint32_t filter_mask; /* Excluded filters */ - haddr_t chunk_addr; /* Address of chunk in file */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ + uint32_t nbytes; /* Size of stored data */ + uint32_t filter_mask; /* Excluded filters */ + haddr_t chunk_addr; /* Address of chunk in file */ } H5D_chunk_rec_t; /* @@ -273,9 +273,9 @@ typedef struct H5D_chunk_rec_t { * to which the index points. */ typedef struct H5D_chunk_common_ud_t { - const H5O_layout_chunk_t *layout; /* Chunk layout description */ - const H5O_storage_chunk_t *storage; /* Chunk storage description */ - const hsize_t *scaled; /* Scaled coordinates for a chunk */ + const H5O_layout_chunk_t *layout; /* Chunk layout description */ + const H5O_storage_chunk_t *storage; /* Chunk storage description */ + const hsize_t *scaled; /* Scaled coordinates for a chunk */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -286,7 +286,7 @@ typedef struct H5D_chunk_ud_t { /* Upward */ unsigned idx_hint; /* Index of chunk in cache, if present */ H5F_block_t chunk_block; /* Offset/length of chunk in file */ - unsigned filter_mask; /* Excluded filters */ + unsigned filter_mask; /* Excluded filters */ hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */ hsize_t chunk_idx; /* Chunk index for EA, FA indexing */ } H5D_chunk_ud_t; @@ -386,11 +386,11 @@ typedef struct H5D_chunk_map_t { /* Cached information about a particular chunk */ typedef struct H5D_chunk_cached_t { hbool_t valid; /*whether cache info is valid*/ - hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/ - haddr_t addr; /*file address of chunk */ - uint32_t nbytes; /*size of stored data */ - hsize_t chunk_idx; /*index of chunk in dataset */ - unsigned filter_mask; /*excluded filters */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/ + haddr_t addr; /*file address of chunk */ + uint32_t nbytes; /*size of stored data */ + hsize_t chunk_idx; /*index of chunk in dataset */ + unsigned filter_mask; /*excluded filters */ } H5D_chunk_cached_t; /****************************/ @@ -407,23 +407,23 @@ typedef struct H5D_virtual_held_file_t { struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */ typedef struct H5D_rdcc_t { struct { - unsigned ninits; /* Number of chunk creations */ - unsigned nhits; /* Number of cache hits */ - unsigned nmisses;/* Number of cache misses */ - unsigned nflushes;/* Number of cache flushes */ + unsigned ninits; /* Number of chunk creations */ + unsigned nhits; /* Number of cache hits */ + unsigned nmisses; /* Number of cache misses */ + unsigned nflushes; /* Number of cache flushes */ } stats; - size_t nbytes_max; /* Maximum cached raw data in bytes */ - size_t nslots; /* Number of chunk slots allocated */ - double w0; /* Chunk preemption policy */ - struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */ - struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */ + size_t nbytes_max; /* Maximum cached raw data in bytes */ + size_t nslots; /* Number of chunk slots allocated */ + double w0; /* Chunk preemption policy */ + struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */ + struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */ struct H5D_rdcc_ent_t *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table (slot). The head entry is a sentinel (does not refer to an actual chunk). */ - size_t nbytes_used; /* Current cached raw data in bytes */ - int nused; /* Number of chunk slots in use */ + size_t nbytes_used; /* Current cached raw data in bytes */ + int nused; /* Number of chunk slots in use */ H5D_chunk_cached_t last; /* Cached copy of last chunk information */ struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ - H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ - H5S_t *single_space; /* Dataspace for single element I/O on chunks */ + H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ + H5S_t *single_space; /* Dataspace for single element I/O on chunks */ H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ /* Cached information about scaled dataspace dimensions */ @@ -459,10 +459,10 @@ typedef struct H5D_shared_t { hbool_t checked_filters;/* TRUE if dataset passes can_apply check */ /* Cached dataspace info */ - unsigned ndims; /* The dataset's dataspace rank */ - hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */ - hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */ - hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */ + unsigned ndims; /* The dataset's dataspace rank */ + hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */ + hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */ + hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */ /* Buffered/cached information for types of raw data storage*/ struct { @@ -474,7 +474,7 @@ typedef struct H5D_shared_t { H5D_rdcc_t chunk; /* Information about chunked data */ } cache; - H5D_append_flush_t append_flush; /* Append flush property information */ + H5D_append_flush_t append_flush; /* Append flush property information */ char *extfile_prefix; /* expanded external file prefix */ } H5D_shared_t; @@ -689,7 +689,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *store); -H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, +H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsize_t *offset, uint32_t data_size, const void *buf); H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hid_t dxpl_id, hsize_t *offset, uint32_t *filters, void *buf); -- cgit v0.12 From 480fc373a07e4b9a3aefd51f82accbc9411146b3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Nov 2017 09:59:58 -0600 Subject: Remove tabs --- src/H5Dprivate.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 5d565bb..fb994d8 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -21,10 +21,10 @@ #include "H5Dpublic.h" /* Private headers needed by this file */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Zprivate.h" /* Data filters */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Zprivate.h" /* Data filters */ /**************************/ @@ -33,18 +33,18 @@ /* * Feature: Define H5D_DEBUG on the compiler command line if you want to - * debug dataset I/O. NDEBUG must not be defined in order for this - * to have any effect. + * debug dataset I/O. NDEBUG must not be defined in order for this + * to have any effect. */ #ifdef NDEBUG # undef H5D_DEBUG #endif /* ======== Dataset creation property names ======== */ -#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */ -#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */ +#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */ +#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */ #define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */ -#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ +#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ /* ======== Dataset access property names ======== */ #define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ @@ -75,11 +75,11 @@ #define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio" #define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME "actual_chunk_opt_mode" #define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode" -#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */ +#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ #define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /* Collective chunk instrumentation properties */ @@ -152,10 +152,10 @@ typedef struct H5D_copy_file_ud_t { /* Structure for dataset append flush property (H5Pset_append_flush) */ typedef struct H5D_append_flush_t { - unsigned ndims; /* The # of dimensions for "boundary" */ - hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */ - H5D_append_cb_t func; /* The callback function */ - void *udata; /* User data */ + unsigned ndims; /* The # of dimensions for "boundary" */ + hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */ + H5D_append_cb_t func; /* The callback function */ + void *udata; /* User data */ } H5D_append_flush_t; -- cgit v0.12 From 5717239a98f61dab289ce7c79d7768dc59755e3a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Nov 2017 11:11:22 -0600 Subject: Remove tabs --- src/H5F.c | 694 ++++++++++++++++++++------------------------------ src/H5Fint.c | 787 +++++++++++++++++++++++---------------------------------- src/H5Fquery.c | 625 ++++++++++++++++----------------------------- 3 files changed, 809 insertions(+), 1297 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 39eca13..4b40248 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */ }}; @@ -113,27 +113,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. - * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; zero - * otherwise. - * - * Failure: Never fails. - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * Failure: Never fails. *------------------------------------------------------------------------- */ int H5F_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -141,7 +136,7 @@ H5F_term_package(void) if(H5I_nmembers(H5I_FILE) > 0) { (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ else { /* Make certain we've cleaned up all the shared file objects */ H5F_sfile_assert_num(0); @@ -160,18 +155,14 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist - * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. - * - * Return: Success: template ID + * Function: H5Fget_create_plist * - * Failure: FAIL - * - * Programmer: Unknown + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. * + * Return: Success: template ID + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -200,24 +191,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Wednesday, February 18, 1998 - * + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -243,23 +229,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count - * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Function: H5Fget_obj_count * - * Return: Non-negative on success; negative on failure. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 + * Purpose: Public function returning the number of opened object IDs + * (files, datasets, groups and datatypes) in the same file. * + * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_count(hid_t file_id, unsigned types) { H5F_t *f = NULL; /* File to query */ - size_t obj_count = 0; /* Number of opened objects */ + size_t obj_count = 0; /* Number of opened objects */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -284,21 +266,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids - * - * Purpose: Public function to return a list of opened object IDs. - * - * Return: Non-negative on success; negative on failure. + * Function: H5Fget_object_ids * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * - * Modification: - * Raymond Lu - * 24 September 2008 - * Changed the return value to ssize_t and MAX_OBJTS to size_t to - * accommadate potential large number of objects. + * Purpose: Public function to return a list of opened object IDs. * + * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t @@ -339,10 +311,6 @@ done: * * Return: Success: non-negative value. * Failure: negative. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -372,23 +340,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. * - * Return: Success: TRUE/FALSE - * - * Failure: Negative - * - * Programmer: Unknown - * - * Modifications: - * Robb Matzke, 1999-08-02 - * Rewritten to use the virtual file layer. + * Return: Success: TRUE/FALSE + * Failure: Negative *------------------------------------------------------------------------- */ htri_t @@ -414,38 +375,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fcreate - * - * Purpose: This is the primary function for creating HDF5 files . The - * flags parameter determines whether an existing file will be - * overwritten or not. All newly created files are opened for - * both reading and writing. All flags may be combined with the - * bit-wise OR operator (`|') to change the behavior of the file - * create call. - * - * The more complex behaviors of a file's creation and access - * are controlled through the file-creation and file-access - * property lists. The value of H5P_DEFAULT for a template - * value indicates that the library should use the default - * values for the appropriate template. - * - * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for - * the list of file creation and file access properties. - * - * Return: Success: A file ID - * - * Failure: FAIL - * - * Programmer: Unknown - * + * Function: H5Fcreate + * + * Purpose: This is the primary function for creating HDF5 files . The + * flags parameter determines whether an existing file will be + * overwritten or not. All newly created files are opened for + * both reading and writing. All flags may be combined with the + * bit-wise OR operator (`|') to change the behavior of the file + * create call. + * + * The more complex behaviors of a file's creation and access + * are controlled through the file-creation and file-access + * property lists. The value of H5P_DEFAULT for a template + * value indicates that the library should use the default + * values for the appropriate template. + * + * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for + * the list of file creation and file access properties. + * + * Return: Success: A file ID + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ - hid_t ret_value; /*return value */ + H5F_t *new_file = NULL; /*file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -479,7 +436,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * reading and writing. */ if (0==(flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))) - flags |= H5F_ACC_EXCL; /*default*/ + flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* @@ -504,51 +461,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fopen + * Function: H5Fopen * - * Purpose: This is the primary function for accessing existing HDF5 - * files. The FLAGS argument determines whether writing to an - * existing file will be allowed or not. All flags may be - * combined with the bit-wise OR operator (`|') to change the - * behavior of the file open call. The more complex behaviors - * of a file's access are controlled through the file-access - * property list. + * Purpose: This is the primary function for accessing existing HDF5 + * files. The FLAGS argument determines whether writing to an + * existing file will be allowed or not. All flags may be + * combined with the bit-wise OR operator (`|') to change the + * behavior of the file open call. The more complex behaviors + * of a file's access are controlled through the file-access + * property list. * - * See Also: H5Fpublic.h for a list of possible values for FLAGS. + * See Also: H5Fpublic.h for a list of possible values for FLAGS. * - * Return: Success: A file ID - * - * Failure: FAIL - * - * Programmer: Unknown + * Return: Success: A file ID + * Failure: FAIL * * Modifications: - * Robb Matzke, 1997-07-18 - * File struct creation and destruction is through H5F_new() and - * H5F__dest(). Reading the root symbol table entry is done with - * H5G_decode(). - * - * Robb Matzke, 1997-09-23 - * Most of the work is now done by H5F_open() since H5Fcreate() - * and H5Fopen() originally contained almost identical code. - * - * Robb Matzke, 1998-02-18 - * Added better error checking for the flags and the file access - * property list. It used to be possible to make the library - * dump core by passing an object ID that was not a file access - * property list. - * - * Robb Matzke, 1999-08-02 - * The file access property list is passed to the H5F_open() as - * object IDs. + * Robb Matzke, 1997-07-18 + * File struct creation and destruction is through H5F_new() and + * H5F__dest(). Reading the root symbol table entry is done with + * H5G_decode(). + * + * Robb Matzke, 1997-09-23 + * Most of the work is now done by H5F_open() since H5Fcreate() + * and H5Fopen() originally contained almost identical code. + * + * Robb Matzke, 1998-02-18 + * Added better error checking for the flags and the file access + * property list. It used to be possible to make the library + * dump core by passing an object ID that was not a file access + * property list. + * + * Robb Matzke, 1999-08-02 + * The file access property list is passed to the H5F_open() as + * object IDs. *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ - hid_t ret_value; /*return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -591,25 +545,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fflush - * - * Purpose: Flushes all outstanding buffers of a file to disk but does - * not remove them from the cache. The OBJECT_ID can be a file, - * dataset, group, attribute, or named data type. + * Function: H5Fflush * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, August 6, 1998 + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5Fflush(hid_t object_id, H5F_scope_t scope) { - H5F_t *f = NULL; /* File to flush */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f = NULL; /* File to flush */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); @@ -622,7 +572,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) case H5I_GROUP: { - H5G_t *grp; + H5G_t *grp; if(NULL == (grp = (H5G_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") @@ -632,7 +582,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) case H5I_DATATYPE: { - H5T_t *type; + H5T_t *type; if(NULL == (type = (H5T_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") @@ -642,7 +592,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) case H5I_DATASET: { - H5D_t *dset; + H5D_t *dset; if(NULL == (dset = (H5D_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") @@ -652,7 +602,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) case H5I_ATTR: { - H5A_t *attr; + H5A_t *attr; if(NULL == (attr = (H5A_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") @@ -685,7 +635,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) /* Flush the file */ /* - * Nothing to do if the file is read only. This determination is + * Nothing to do if the file is read only. This determination is * made at the shared open(2) flags level, implying that opening a * file twice, once for read-only and once for read-write, and then * calling H5Fflush() with the read-only handle, still causes data @@ -711,24 +661,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fclose + * Function: H5Fclose * - * Purpose: This function closes the file specified by FILE_ID by - * flushing all data to storage, and terminating access to the - * file through FILE_ID. If objects (e.g., datasets, groups, - * etc.) are open in the file then the underlying storage is not - * closed until those objects are closed; however, all data for - * the file and the open objects is flushed. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Saturday, February 20, 1999 - * - * Modifications: + * Purpose: This function closes the file specified by FILE_ID by + * flushing all data to storage, and terminating access to the + * file through FILE_ID. If objects (e.g., datasets, groups, + * etc.) are open in the file then the underlying storage is not + * closed until those objects are closed; however, all data for + * the file and the open objects is flushed. * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -736,7 +679,7 @@ H5Fclose(hid_t file_id) { H5F_t *f = NULL; int nref; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -772,29 +715,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Freopen - * - * Purpose: Reopen a file. The new file handle which is returned points - * to the same file as the specified file handle. Both handles - * share caches and other information. The only difference - * between the handles is that the new handle is not mounted - * anywhere and no files are mounted on it. + * Function: H5Freopen * - * Return: Success: New file ID - * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Friday, October 16, 1998 + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. * + * Return: Success: New file ID + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Freopen(hid_t file_id) { - H5F_t *old_file = NULL; - H5F_t *new_file = NULL; - hid_t ret_value; + H5F_t *old_file = NULL; + H5F_t *new_file = NULL; + hid_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", file_id); @@ -828,16 +766,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_intent - * - * Purpose: Public API to retrieve the file's 'intent' flags passed - * during H5Fopen() + * Function: H5Fget_intent * - * Return: Non-negative on success/negative on failure - * - * Programmer: James Laird - * August 23, 2006 + * Purpose: Public API to retrieve the file's 'intent' flags passed + * during H5Fopen() * + * Return: Non-negative on success/negative on failure *------------------------------------------------------------------------- */ herr_t @@ -850,7 +784,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) /* If no intent flags were passed in, exit quietly */ if(intent_flags) { - H5F_t * file; /* Pointer to file structure */ + H5F_t *file; /* Pointer to file structure */ /* Get the internal file structure */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -888,18 +822,13 @@ done: * * Return: Success: Amount of free space for type * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Oct 6, 2003 - * *------------------------------------------------------------------------- */ hssize_t H5Fget_freespace(hid_t file_id) { H5F_t *file; /* File object for file ID */ - hsize_t tot_space; /* Amount of free space in the file */ + hsize_t tot_space; /* Amount of free space in the file */ hssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -925,15 +854,10 @@ done: * * Purpose: Retrieves the file size of the HDF5 file. This function * is called after an existing file is opened in order - * to learn the true size of the underlying file. + * to learn the true size of the underlying file. * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: David Pitt - * david.pitt@bigpond.com - * Apr 27, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -972,42 +896,38 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_file_image * - * Purpose: If a buffer is provided (via the buf_ptr argument) and is - * big enough (size in buf_len argument), load *buf_ptr with - * an image of the open file whose ID is provided in the - * file_id parameter, and return the number of bytes copied - * to the buffer. + * Purpose: If a buffer is provided (via the buf_ptr argument) and is + * big enough (size in buf_len argument), load *buf_ptr with + * an image of the open file whose ID is provided in the + * file_id parameter, and return the number of bytes copied + * to the buffer. * - * If the buffer exists, but is too small to contain an image - * of the indicated file, return a negative number. + * If the buffer exists, but is too small to contain an image + * of the indicated file, return a negative number. * - * Finally, if no buffer is provided, return the size of the - * buffer needed. This value is simply the eoa of the target - * file. + * Finally, if no buffer is provided, return the size of the + * buffer needed. This value is simply the eoa of the target + * file. * - * Note that any user block is skipped. + * Note that any user block is skipped. * - * Also note that the function may not be used on files - * opened with either the split/multi file driver or the - * family file driver. + * Also note that the function may not be used on files + * opened with either the split/multi file driver or the + * family file driver. * - * In the former case, the sparse address space makes the - * get file image operation impractical, due to the size of - * the image typically required. + * In the former case, the sparse address space makes the + * get file image operation impractical, due to the size of + * the image typically required. * - * In the case of the family file driver, the problem is - * the driver message in the super block, which will prevent - * the image being opened with any driver other than the - * family file driver -- which negates the purpose of the - * operation. This can be fixed, but no resources for - * this now. + * In the case of the family file driver, the problem is + * the driver message in the super block, which will prevent + * the image being opened with any driver other than the + * family file driver -- which negates the purpose of the + * operation. This can be fixed, but no resources for + * this now. * * Return: Success: Bytes copied / number of bytes needed. * Failure: negative value - * - * Programmer: John Mainzer - * 11/15/11 - * *------------------------------------------------------------------------- */ ssize_t @@ -1033,21 +953,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mdc_config + * Function: H5Fget_mdc_config * - * Purpose: Retrieves the current automatic cache resize configuration - * from the metadata cache, and return it in *config_ptr. + * Purpose: Retrieves the current automatic cache resize configuration + * from the metadata cache, and return it in *config_ptr. * - * Note that the version field of *config_Ptr must be correctly - * filled in by the caller. This allows us to adapt for - * obsolete versions of the structure. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1078,15 +994,11 @@ done: * Function: H5Fset_mdc_config * * Purpose: Sets the current metadata cache automatic resize - * configuration, using the contents of the instance of - * H5AC_cache_config_t pointed to by config_ptr. + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1115,16 +1027,12 @@ done: * Function: H5Fget_mdc_hit_rate * * Purpose: Retrieves the current hit rate from the metadata cache. - * This rate is the overall hit rate since the last time - * the hit rate statistics were reset either manually or - * automatically. + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1156,17 +1064,13 @@ done: * Function: H5Fget_mdc_size * * Purpose: Retrieves the maximum size, minimum clean size, current - * size, and current number of entries from the metadata - * cache associated with the specified file. If any of - * the ptr parameters are NULL, the associated datum is - * not returned. + * size, and current number of entries from the metadata + * cache associated with the specified file. If any of + * the ptr parameters are NULL, the associated datum is + * not returned. * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1202,20 +1106,16 @@ done: * Function: H5Freset_mdc_hit_rate_stats * * Purpose: Reset the hit rate statistic whose current value can - * be obtained via the H5Fget_mdc_hit_rate() call. Note - * that this statistic will also be reset once per epoch - * by the automatic cache resize code if it is enabled. + * be obtained via the H5Fget_mdc_hit_rate() call. Note + * that this statistic will also be reset once per epoch + * by the automatic cache resize code if it is enabled. * - * It is probably a bad idea to call this function unless - * you are controlling cache size from your program instead - * of using our cache size control code. + * It is probably a bad idea to call this function unless + * you are controlling cache size from your program instead + * of using our cache size control code. * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1251,15 +1151,11 @@ done: * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) * is unchanged and the function returns a negative value. * - * Note: This routine returns the name that was used to open the file, - * not the actual name after resolving symlinks, etc. + * Note: This routine returns the name that was used to open the file, + * not the actual name after resolving symlinks, etc. * * Return: Success: The length of the file name * Failure: Negative - * - * Programmer: Raymond Lu - * June 29, 2004 - * *------------------------------------------------------------------------- */ ssize_t @@ -1309,17 +1205,13 @@ done: * Function: H5Fget_info2 * * Purpose: Gets general information about the file, including: - * 1. Get storage size for superblock extension if there is one. + * 1. Get storage size for superblock extension if there is one. * 2. Get the amount of btree and heap storage for entries * in the SOHM table if there is one. - * 3. The amount of free space tracked in the file. + * 3. The amount of free space tracked in the file. * * Return: Success: non-negative on success * Failure: Negative - * - * Programmer: Vailin Choi - * July 11, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1386,18 +1278,15 @@ done: * * Return: Success: non-negative on success * Failure: Negative - * - * Programmer: Vailin Choi; October 2013 - * *------------------------------------------------------------------------- */ herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { - H5F_t *file; /* File object for file ID */ - unsigned i, j; /* Local index variable */ - size_t tot_size; /* Size of each retries[i] */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ + unsigned i, j; /* Local index variable */ + size_t tot_size; /* Size of each retries[i] */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, info); @@ -1417,8 +1306,8 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HDmemset(info->retries, 0, sizeof(info->retries)); /* Return if there are no bins -- no retries */ - if(!info->nbins) - HGOTO_DONE(SUCCEED); + if(!info->nbins) + HGOTO_DONE(SUCCEED); /* Calculate size for each retries[i] */ tot_size = info->nbins * sizeof(uint32_t); @@ -1477,18 +1366,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_free_sections - * - * Purpose: To get free-space section information for free-space manager with - * TYPE that is associated with file FILE_ID. - * If SECT_INFO is null, this routine returns the total # of free-space - * sections. - * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative + * Function: H5Fget_free_sections * - * Programmer: Vailin Choi; July 1st, 2009 + * Purpose: To get free-space section information for free-space manager with + * TYPE that is associated with file FILE_ID. + * If SECT_INFO is null, this routine returns the total # of free-space + * sections. * + * Return: Success: non-negative, the total # of free space sections + * Failure: negative *------------------------------------------------------------------------- */ ssize_t @@ -1525,9 +1411,6 @@ done: * * Return: Success: non-negative * Failure: negative - * - * Programmer: Neil Fortner; December 30, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -1554,37 +1437,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fstart_swmr_write - * - * Purpose: To enable SWMR writing mode for the file - * 1) Refresh opened objects: part 1 - * 2) Flush & reset accumulator - * 3) Mark the file in SWMR writing mode - * 4) Set metadata read attempts and retries info - * 5) Disable accumulator - * 6) Evict all cache entries except the superblock - * 7) Refresh opened objects (part 2) - * 8) Unlock the file - * - * Pre-conditions: - * 1) The file being opened has v3 superblock - * 2) The file is opened with H5F_ACC_RDWR - * 3) The file is not already marked for SWMR writing - * 4) Current implementaion for opened objects: - * --only allow datasets and groups without attributes - * --disallow named datatype with/without attributes - * --disallow opened attributes attached to objects - * NOTE: Currently, only opened groups and datasets are allowed - * when enabling SWMR via H5Fstart_swmr_write(). - * Will later implement a different approach-- - * set up flush dependency/proxy even for file opened without - * SWMR to resolve issues with opened objects. - * - * Return: Non-negative on success/negative on failure - * - * Programmer: - * Vailin Choi; Feb 2014 - * + * Function: H5Fstart_swmr_write + * + * Purpose: To enable SWMR writing mode for the file + * 1) Refresh opened objects: part 1 + * 2) Flush & reset accumulator + * 3) Mark the file in SWMR writing mode + * 4) Set metadata read attempts and retries info + * 5) Disable accumulator + * 6) Evict all cache entries except the superblock + * 7) Refresh opened objects (part 2) + * 8) Unlock the file + * + * Pre-conditions: + * 1) The file being opened has v3 superblock + * 2) The file is opened with H5F_ACC_RDWR + * 3) The file is not already marked for SWMR writing + * 4) Current implementaion for opened objects: + * --only allow datasets and groups without attributes + * --disallow named datatype with/without attributes + * --disallow opened attributes attached to objects + * NOTE: Currently, only opened groups and datasets are allowed + * when enabling SWMR via H5Fstart_swmr_write(). + * Will later implement a different approach-- + * set up flush dependency/proxy even for file opened without + * SWMR to resolve issues with opened objects. + * + * Return: Non-negative on success/negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1593,16 +1472,16 @@ H5Fstart_swmr_write(hid_t file_id) hbool_t ci_load = FALSE; /* whether MDC ci load requested */ hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *file = NULL; /* File info */ - size_t grp_dset_count=0; /* # of open objects: groups & datasets */ - size_t nt_attr_count=0; /* # of opened named datatypes + opened attributes */ - hid_t *obj_ids=NULL; /* List of ids */ - H5G_loc_t *obj_glocs=NULL; /* Group location of the object */ - H5O_loc_t *obj_olocs=NULL; /* Object location */ - H5G_name_t *obj_paths=NULL; /* Group hierarchy path */ - size_t u; /* Local index variable */ - hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ + size_t grp_dset_count=0; /* # of open objects: groups & datasets */ + size_t nt_attr_count=0; /* # of opened named datatypes + opened attributes */ + hid_t *obj_ids=NULL; /* List of ids */ + H5G_loc_t *obj_glocs=NULL; /* Group location of the object */ + H5O_loc_t *obj_olocs=NULL; /* Object location */ + H5G_name_t *obj_paths=NULL; /* Group hierarchy path */ + size_t u; /* Local index variable */ + hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ H5F_io_info2_t fio_info; /* I/O info for operation */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1651,18 +1530,18 @@ H5Fstart_swmr_write(hid_t file_id) if(grp_dset_count) { /* Allocate space for group and object locations */ - if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t") - if((obj_glocs = (H5G_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_loc_t") - if((obj_olocs = (H5O_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5O_loc_t") - if((obj_paths = (H5G_name_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_name_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_name_t") + if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t") + if((obj_glocs = (H5G_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_loc_t") + if((obj_olocs = (H5O_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5O_loc_t") + if((obj_paths = (H5G_name_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_name_t))) == NULL) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_name_t") /* Get the list of opened object ids (groups & datasets) */ - if(H5F_get_obj_ids(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") + if(H5F_get_obj_ids(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") /* Refresh opened objects (groups, datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { @@ -1790,14 +1669,13 @@ done: * - Logging must have been set up via the fapl. * * Return: Non-negative on success/Negative on errors - * *------------------------------------------------------------------------- */ herr_t H5Fstart_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1823,14 +1701,13 @@ done: * - Logging must have been set up via the fapl. * * Return: Non-negative on success/Negative on errors - * *------------------------------------------------------------------------- */ herr_t H5Fstop_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1856,15 +1733,14 @@ done: * log messages are being recorded at this time. * * Return: Non-negative on success/Negative on errors - * *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging); @@ -1888,9 +1764,6 @@ done: * Purpose: Enable switching the "latest format" flag while a file is open. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, September 21, 2015 *------------------------------------------------------------------------- */ herr_t @@ -1924,17 +1797,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fformat_convert_super (Internal) + * Function: H5Fformat_convert_super (Internal) * - * Purpose: Downgrade the superblock version to v2 and - * downgrade persistent file space to non-persistent - * for 1.8 library. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi - * Jan 2016 + * Purpose: Downgrade the superblock version to v2 and + * downgrade persistent file space to non-persistent + * for 1.8 library. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1946,8 +1815,8 @@ H5Fformat_convert(hid_t fid) H5TRACE1("e", "i", fid); if(H5I_FILE == H5I_get_type(fid)) { - H5F_t *f; /* File to flush */ - hbool_t mark_dirty = FALSE; + H5F_t *f; /* File to flush */ + hbool_t mark_dirty = FALSE; /* Get file object */ if(NULL == (f = (H5F_t *)H5I_object(fid))) @@ -1961,9 +1830,9 @@ H5Fformat_convert(hid_t fid) /* Check for persistent freespace manager, which needs to be downgraded */ if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && - f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && - f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && - f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) { + f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && + f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && + f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) { /* Check to remove free-space manager info message from superblock extension */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) if(H5F_super_ext_remove_msg(f, H5AC_ind_read_dxpl_id, H5O_FSINFO_ID) < 0) @@ -2004,9 +1873,6 @@ done: * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -2040,9 +1906,6 @@ done: * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -2084,9 +1947,6 @@ done: * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Vailin Choi; March 2017 - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Fint.c b/src/H5Fint.c index 7371c46..a48e41c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -100,26 +100,19 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_get_access_plist + * Function: H5F_get_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Wednesday, May 25, 2005 - * - * Modifications: - * + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -129,9 +122,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5P_genplist_t *old_plist; /* Old property list */ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ - unsigned efc_size = 0; - hbool_t latest_format = FALSE; /* Always use the latest format? */ - hid_t ret_value = SUCCEED; /* Return value */ + unsigned efc_size = 0; + hbool_t latest_format = FALSE; /* Always use the latest format? */ + hid_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -142,7 +135,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -222,16 +215,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_get_obj_count + * Function: H5F_get_obj_count * - * Purpose: Private function return the number of opened object IDs - * (files, datasets, groups, datatypes) in the same file. + * Purpose: Private function return the number of opened object IDs + * (files, datasets, groups, datatypes) in the same file. * * Return: SUCCEED on success, FAIL on failure. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -259,10 +248,6 @@ done: * Purpose: Private function to return a list of opened object IDs. * * Return: Non-negative on success; can't fail. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -285,16 +270,13 @@ done: /*--------------------------------------------------------------------------- - * Function: H5F_get_objects + * Function: H5F_get_objects * - * Purpose: This function is called by H5F_get_obj_count or - * H5F_get_obj_ids to get number of object IDs and/or a - * list of opened object IDs (in return value). - * Return: Non-negative on success; Can't fail. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 + * Purpose: This function is called by H5F_get_obj_count or + * H5F_get_obj_ids to get number of object IDs and/or a + * list of opened object IDs (in return value). * + * Return: Non-negative on success; Can't fail. *--------------------------------------------------------------------------- */ herr_t @@ -313,7 +295,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ olist.obj_id_list = (max_nobjs==0 ? NULL : obj_id_list); olist.obj_id_count = &obj_id_count; olist.list_index = 0; - olist.max_nobjs = max_nobjs; + olist.max_nobjs = max_nobjs; /* Determine if we are searching for local or global objects */ if(types & H5F_OBJ_LOCAL) { @@ -337,37 +319,37 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ * or the caller wants to get the list of IDs and the list isn't full, * search through dataset IDs to count number of datasets, and put their * IDs on the object list */ - if(!olist.max_nobjs || (olist.max_nobjs && olist.list_indexobj_type == H5I_FILE) { if((olist->file_info.local && - (!olist->file_info.ptr.file || (olist->file_info.ptr.file && (H5F_t*)obj_ptr == olist->file_info.ptr.file) )) - || (!olist->file_info.local && - ( !olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared) ))) { + (!olist->file_info.ptr.file || + (olist->file_info.ptr.file && (H5F_t*)obj_ptr == olist->file_info.ptr.file))) || + (!olist->file_info.local && + (!olist->file_info.ptr.shared || + (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ + } /* end if */ } /* end if */ else { /* either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ - switch(olist->obj_type) { - case H5I_ATTR: - oloc = H5A_oloc((H5A_t *)obj_ptr); - break; - - case H5I_GROUP: - oloc = H5G_oloc((H5G_t *)obj_ptr); - break; - - case H5I_DATASET: - oloc = H5D_oloc((H5D_t *)obj_ptr); - break; - - case H5I_DATATYPE: - if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) - oloc = H5T_oloc((H5T_t*)obj_ptr); - else - oloc = NULL; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: + switch(olist->obj_type) { + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj_ptr); + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj_ptr); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj_ptr); + break; + + case H5I_DATATYPE: + if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) + oloc = H5T_oloc((H5T_t*)obj_ptr); + else + oloc = NULL; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object") - } /* end switch */ + } /* end switch */ if((olist->file_info.local && - ( (!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) - || (!olist->file_info.ptr.file && olist->obj_type != H5I_DATATYPE) - || (oloc && oloc->file == olist->file_info.ptr.file))) - || (!olist->file_info.local && - ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) - || (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) - || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { + ((!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) || + (!olist->file_info.ptr.file && olist->obj_type != H5I_DATATYPE) || + (oloc && oloc->file == olist->file_info.ptr.file))) || + (!olist->file_info.local && + ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) || + (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || + (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ + } /* end if */ } /* end else */ if(add_obj) { /* Add the object's ID to the ID list, if appropriate */ if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; - olist->list_index++; - } /* end if */ + olist->list_index++; + } /* end if */ /* Increment the number of open objects */ - if(olist->obj_id_count) + if(olist->obj_id_count) (*olist->obj_id_count)++; /* Check if we've filled up the array. Return H5_ITER_STOP only if * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is - * preset to H5_ITER_CONT) because H5I_iterate needs the return value of + * preset to H5_ITER_CONT) because H5I_iterate needs the return value of * H5_ITER_CONT to continue the iteration. */ if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ @@ -501,35 +481,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__is_hdf5 - * - * Purpose: Check the file signature to detect an HDF5 file. - * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. - * - * Return: Success: TRUE/FALSE + * Function: H5F__is_hdf5 * - * Failure: Negative + * Purpose: Check the file signature to detect an HDF5 file. * - * Programmer: Unknown + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. * + * Return: Success: TRUE/FALSE + * * Failure: Negative *------------------------------------------------------------------------- */ htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id) { - H5FD_t *file = NULL; /* Low-level file struct */ - H5FD_io_info_t fdio_info; /* File driver I/O info */ - haddr_t sig_addr; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + H5FD_io_info_t fdio_info; /* File driver I/O info */ + haddr_t sig_addr; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") /* Set up the file driver info */ fdio_info.file = file; @@ -554,31 +530,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_new - * - * Purpose: Creates a new file object and initializes it. The - * H5Fopen and H5Fcreate functions then fill in various - * fields. If SHARED is a non-null pointer then the shared info - * to which it points has the reference count incremented. - * Otherwise a new, empty shared info struct is created and - * initialized with the specified file access property list. - * - * Errors: - * - * Return: Success: Ptr to a new file struct. + * Function: H5F_new * - * Failure: NULL - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 18 1997 + * Purpose: Creates a new file object and initializes it. The + * H5Fopen and H5Fcreate functions then fill in various fields. + * If SHARED is a non-null pointer then the shared info + * to which it points has the reference count incremented. + * Otherwise a new, empty shared info struct is created and + * initialized with the specified file access property list. * + * Return: Success: Ptr to a new file struct. + * Failure: NULL *------------------------------------------------------------------------- */ H5F_t * H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { - H5F_t *f = NULL, *ret_value = NULL; + H5F_t *f = NULL, *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -592,8 +560,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t } /* end if */ else { H5P_genplist_t *plist; /* Property list */ - unsigned efc_size; /* External file cache size */ - hbool_t latest_format; /* Always use the latest format? */ + unsigned efc_size; /* External file cache size */ + hbool_t latest_format; /* Always use the latest format? */ size_t u; /* Local index variable */ HDassert(lf != NULL); @@ -650,7 +618,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space page size") HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); - /* Temporary for multi/split drivers: fail file creation + /* Temporary for multi/split drivers: fail file creation when persisting free-space or using paged aggregation strategy */ if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE || f->shared->fs_persist) @@ -826,25 +794,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__dest - * - * Purpose: Destroys a file structure. This function flushes the cache - * but doesn't do any other cleanup other than freeing memory - * for the file struct. The shared info for the file is freed - * only when its reference count reaches zero. + * Function: H5F__dest * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 18 1997 + * Purpose: Destroys a file structure. This function flushes the cache + * but doesn't do any other cleanup other than freeing memory + * for the file struct. The shared info for the file is freed + * only when its reference count reaches zero. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -866,7 +829,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)") /* Notify the metadata cache that the file is about to be closed. - * This allows the cache to set up for creating a metadata cache + * This allows the cache to set up for creating a metadata cache * image if this has been requested. */ if(H5AC_prep_for_file_close(f, meta_dxpl_id) < 0) @@ -883,7 +846,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)") /* With the shutdown modifications, the contents of the metadata cache - * should be clean at this point, with the possible exception of the + * should be clean at this point, with the possible exception of the * the superblock and superblock extension. * * Verify this. @@ -909,10 +872,10 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) /* Release objects that depend on the superblock being initialized */ if(f->shared->sblock) { /* Shutdown file free space manager(s) */ - /* (We should release the free space information now (before - * truncating the file and before the metadata cache is shut - * down) since the free space manager is holding some data - * structures in memory and also because releasing free space + /* (We should release the free space information now (before + * truncating the file and before the metadata cache is shut + * down) since the free space manager is holding some data + * structures in memory and also because releasing free space * can shrink the file's 'eoa' value) * * Update 11/1/16: @@ -938,7 +901,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) * free space manager may dirty some data structures again. */ if(flush) { - /* Clear status_flags */ + /* Clear status_flags */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS); f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS); @@ -947,8 +910,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") - /* Release any space allocated to space aggregators, - * so that the eoa value corresponds to the end of the + /* Release any space allocated to space aggregators, + * so that the eoa value corresponds to the end of the * space written to in the file. * * At most, this should change the superblock or the @@ -967,11 +930,11 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) * extension should be dirty. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); - } /* end if */ + } /* end if */ } /* end if */ /* if it exists, unpin the driver information block cache entry, - * since we're about to destroy the cache + * since we're about to destroy the cache */ if(f->shared->drvinfo) if(H5AC_unpin_entry(f->shared->drvinfo) < 0) @@ -991,7 +954,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) * Verify this. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); - + /* Remove shared file struct from list of open files */ if(H5F_sfile_remove(f->shared) < 0) /* Push error, but keep going*/ @@ -1067,7 +1030,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) /* Destroy shared file struct */ f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); - } else if(f->shared->nrefs > 0) { + } + else if(f->shared->nrefs > 0) { /* * There are other references to the shared part of the file. * Only decrement the reference count. @@ -1089,42 +1053,42 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) /*------------------------------------------------------------------------- - * Function: H5F_open + * Function: H5F_open * - * Purpose: Opens (or creates) a file. This function understands the - * following flags which are similar in nature to the Posix - * open(2) flags. + * Purpose: Opens (or creates) a file. This function understands the + * following flags which are similar in nature to the Posix + * open(2) flags. * - * H5F_ACC_RDWR: Open with read/write access. If the file is - * currently open for read-only access then it - * will be reopened. Absence of this flag - * implies read-only access. + * H5F_ACC_RDWR: Open with read/write access. If the file is + * currently open for read-only access then it + * will be reopened. Absence of this flag + * implies read-only access. * - * H5F_ACC_CREAT: Create a new file if it doesn't exist yet. - * The permissions are 0666 bit-wise AND with - * the current umask. H5F_ACC_WRITE must also - * be specified. + * H5F_ACC_CREAT: Create a new file if it doesn't exist yet. + * The permissions are 0666 bit-wise AND with + * the current umask. H5F_ACC_WRITE must also + * be specified. * - * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the - * file already exists. + * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the + * file already exists. * - * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock - * is written. This operation will fail if the - * file is already open. + * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock + * is written. This operation will fail if the + * file is already open. * - * Unlinking the file name from the group directed graph while - * the file is opened causes the file to continue to exist but - * one will not be able to upgrade the file from read-only - * access to read-write access by reopening it. Disk resources - * for the file are released when all handles to the file are - * closed. NOTE: This paragraph probably only applies to Unix; - * deleting the file name in other OS's has undefined results. + * Unlinking the file name from the group directed graph while + * the file is opened causes the file to continue to exist but + * one will not be able to upgrade the file from read-only + * access to read-write access by reopening it. Disk resources + * for the file are released when all handles to the file are + * closed. NOTE: This paragraph probably only applies to Unix; + * deleting the file name in other OS's has undefined results. * - * The CREATE_PARMS argument is optional. A null pointer will - * cause the default file creation parameters to be used. + * The CREATE_PARMS argument is optional. A null pointer will + * cause the default file creation parameters to be used. * - * The ACCESS_PARMS argument is optional. A null pointer will - * cause the default file access parameters to be used. + * The ACCESS_PARMS argument is optional. A null pointer will + * cause the default file access parameters to be used. * * The following two tables show results of file opens for single and concurrent access: * @@ -1157,12 +1121,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) * s: the open succeeds with flags combination from both the first and second opens * * - * Return: Success: A new file pointer. - * Failure: NULL - * - * Programmer: Robb Matzke - * Tuesday, September 23, 1997 - * + * Return: Success: A new file pointer. + * Failure: NULL *------------------------------------------------------------------------- */ H5F_t * @@ -1181,7 +1141,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, unsigned page_buf_min_meta_perc; unsigned page_buf_min_raw_perc; hbool_t set_flag = FALSE; /*set the status_flags in the superblock */ - hbool_t clear = FALSE; /*clear the status_flags */ + hbool_t clear = FALSE; /*clear the status_flags */ hbool_t evict_on_close; /* evict on close value from plist */ H5F_t *ret_value = NULL; /*actual return value */ char *lock_env_var = NULL;/*env var pointer */ @@ -1210,7 +1170,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, if(lock_env_var && !HDstrcmp(lock_env_var, "FALSE")) use_file_locking = FALSE; else - use_file_locking = TRUE; + use_file_locking = TRUE; /* * Opening a file is a two step process. First we try to open the @@ -1299,8 +1259,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Place an advisory lock on the file */ if(use_file_locking) if(H5FD_lock(lf, (hbool_t)((flags & H5F_ACC_RDWR) ? TRUE : FALSE)) < 0) { - /* Locking failed - Closing will remove the lock */ - if(H5FD_close(lf) < 0) + /* Locking failed - Closing will remove the lock */ + if(H5FD_close(lf) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to lock the file") } /* end if */ @@ -1311,7 +1271,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, * returned is NULL, H5FD_close() will never be called via H5F_dest() * so we have to close lf here before heading to the error handling. */ - if(H5FD_close(lf) < 0) + if(H5FD_close(lf) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure") } /* end if */ @@ -1475,7 +1435,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension") /* Remove the file lock for SWMR_WRITE */ - if(use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) { + if(use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) { if(H5FD_unlock(file->shared->lf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file") } /* end if */ @@ -1483,11 +1443,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, else { /* H5F_ACC_RDONLY: check consistency of status_flags */ /* Skip check of status_flags for file with < superblock version 3 */ if(file->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) { - if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) { - if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS && + if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) { + if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS && !(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) - || - (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && + || + (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is not already open for SWMR writing") } /* end if */ @@ -1511,16 +1471,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_flush_phase1 - * - * Purpose: First phase of flushing cached data. + * Function: H5F_flush_phase1 * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@lbl.gov - * Jan 1 2017 + * Purpose: First phase of flushing cached data. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1553,16 +1508,11 @@ H5F__flush_phase1(H5F_t *f, hid_t meta_dxpl_id) /*------------------------------------------------------------------------- - * Function: H5F__flush_phase2 - * - * Purpose: Second phase of flushing cached data. - * - * Return: Non-negative on success/Negative on failure + * Function: H5F__flush_phase2 * - * Programmer: Quincey Koziol - * koziol@lbl.gov - * Jan 1 2017 + * Purpose: Second phase of flushing cached data. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1620,16 +1570,11 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi /*------------------------------------------------------------------------- - * Function: H5F__flush + * Function: H5F__flush * - * Purpose: Flushes cached data. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 29 1997 + * Purpose: Flushes cached data. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1657,33 +1602,29 @@ H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F_close - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called two ways: from the API it gets called - * by H5Fclose->H5I_dec_ref->H5F_close when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F_close() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * This function is also called directly from H5O_close() when - * the last object header is closed for the file and the file - * has a pending close. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, September 23, 1997 - * + * Function: H5F_close + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called two ways: from the API it gets called + * by H5Fclose->H5I_dec_ref->H5F_close when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F_close() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * This function is also called directly from H5O_close() when + * the last object header is closed for the file and the file + * has a pending close. + * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5F_close(H5F_t *f) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1722,18 +1663,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_try_close + * Function: H5F_try_close * - * Purpose: Attempts to close a file due to one of several actions: + * Purpose: Attempts to close a file due to one of several actions: * - The reference count on the file ID dropped to zero * - The last open object was closed in the file * - The file was unmounted * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1741,7 +1678,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) { unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1772,12 +1709,12 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* * Close file according to close degree: * - * H5F_CLOSE_WEAK: if there are still objects open, wait until - * they are all closed. - * H5F_CLOSE_SEMI: if there are still objects open, return fail; - * otherwise, close file. - * H5F_CLOSE_STRONG: if there are still objects open, close them - * first, then close file. + * H5F_CLOSE_WEAK: if there are still objects open, wait until + * they are all closed. + * H5F_CLOSE_SEMI: if there are still objects open, return fail; + * otherwise, close file. + * H5F_CLOSE_STRONG: if there are still objects open, close them + * first, then close file. */ switch(f->shared->fc_degree) { case H5F_CLOSE_WEAK: @@ -1899,16 +1836,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_get_id - * - * Purpose: Get the file ID, incrementing it, or "resurrecting" it as - * appropriate. - * - * Return: Non-negative on success/Negative on failure + * Function: H5F_get_id * - * Programmer: Raymond Lu - * Oct 29, 2003 + * Purpose: Get the file ID, incrementing it, or "resurrecting" it as + * appropriate. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ hid_t @@ -1923,8 +1856,9 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) if(file->file_id == -1) { /* Get an atom for the file */ if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") - } else { + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") + } + else { /* Increment reference count on atom. */ if(H5I_inc_ref(file->file_id, app_ref) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") @@ -1938,18 +1872,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_incr_nopen_objs - * - * Purpose: Increment the number of open objects for a file. - * - * Return: Success: The number of open objects, after the increment + * Function: H5F_incr_nopen_objs * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Increment the number of open objects for a file. * + * Return: Success: The number of open objects, after the increment + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -1965,18 +1893,12 @@ H5F_incr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_decr_nopen_objs - * - * Purpose: Decrement the number of open objects for a file. - * - * Return: Success: The number of open objects, after the decrement - * - * Failure: (can't happen) + * Function: H5F_decr_nopen_objs * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Decrement the number of open objects for a file. * + * Return: Success: The number of open objects, after the decrement + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -1992,18 +1914,14 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name + * Function: H5F_build_actual_name * - * Purpose: Retrieve the name of a file, after following symlinks, etc. + * Purpose: Retrieve the name of a file, after following symlinks, etc. * - * Note: Currently only working for "POSIX I/O compatible" VFDs - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * November 25, 2009 + * Note: Currently only working for "POSIX I/O compatible" VFDs * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -2118,17 +2036,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_addr_encode_len - * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Function: H5F_addr_encode_len * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * + * Return: void *------------------------------------------------------------------------- */ void @@ -2143,15 +2057,15 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) HDassert(pp && *pp); if(H5F_addr_defined(addr)) { - for(u = 0; u < addr_len; u++) { - *(*pp)++ = (uint8_t)(addr & 0xff); - addr >>= 8; - } /* end for */ - HDassert("overflow" && 0 == addr); + for(u = 0; u < addr_len; u++) { + *(*pp)++ = (uint8_t)(addr & 0xff); + addr >>= 8; + } /* end for */ + HDassert("overflow" && 0 == addr); } /* end if */ else { - for(u = 0; u < addr_len; u++) - *(*pp)++ = 0xff; + for(u = 0; u < addr_len; u++) + *(*pp)++ = 0xff; } /* end else */ FUNC_LEAVE_NOAPI_VOID @@ -2159,17 +2073,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_encode - * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. - * - * Return: void + * Function: H5F_addr_encode * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * + * Return: void *------------------------------------------------------------------------- */ void @@ -2187,27 +2097,23 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_decode_len + * Function: H5F_addr_decode_len * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * If the value read is all 1's then the address is returned + * with an undefined value. * + * Return: void *------------------------------------------------------------------------- */ void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) { - hbool_t all_zero = TRUE; /* True if address was all zeroes */ - unsigned u; /* Local index variable */ + hbool_t all_zero = TRUE; /* True if address was all zeroes */ + unsigned u; /* Local index variable */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2221,27 +2127,27 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr /* Decode bytes from address */ for(u = 0; u < addr_len; u++) { - uint8_t c; /* Local decoded byte */ + uint8_t c; /* Local decoded byte */ /* Get decoded byte (and advance pointer) */ - c = *(*pp)++; + c = *(*pp)++; /* Check for non-undefined address byte value */ - if(c != 0xff) + if(c != 0xff) all_zero = FALSE; - if(u < sizeof(*addr_p)) { - haddr_t tmp = c; /* Local copy of address, for casting */ + if(u < sizeof(*addr_p)) { + haddr_t tmp = c; /* Local copy of address, for casting */ /* Shift decoded byte to correct position */ - tmp <<= (u * 8); /*use tmp to get casting right */ + tmp <<= (u * 8); /*use tmp to get casting right */ /* Merge into already decoded bytes */ - *addr_p |= tmp; - } /* end if */ + *addr_p |= tmp; + } /* end if */ else if(!all_zero) - HDassert(0 == **pp); /*overflow */ + HDassert(0 == **pp); /*overflow */ } /* end for */ /* If 'all_zero' is still TRUE, the address was entirely composed of '0xff' @@ -2255,20 +2161,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr /*------------------------------------------------------------------------- - * Function: H5F_addr_decode + * Function: H5F_addr_decode * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * If the value read is all 1's then the address is returned + * with an undefined value. * + * Return: void *------------------------------------------------------------------------- */ void @@ -2292,10 +2194,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/19/11 - * *------------------------------------------------------------------------- */ herr_t @@ -2322,10 +2220,6 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/20/11 - * *------------------------------------------------------------------------- */ herr_t @@ -2351,10 +2245,6 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/20/11 - * *------------------------------------------------------------------------- */ herr_t @@ -2380,10 +2270,6 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/20/11 - * *------------------------------------------------------------------------- */ herr_t @@ -2409,10 +2295,6 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/20/11 - * *------------------------------------------------------------------------- */ herr_t @@ -2438,10 +2320,6 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) * * Return: Success: Bytes copied / number of bytes needed. * Failure: negative value - * - * Programmer: John Mainzer - * 11/15/11 - * *------------------------------------------------------------------------- */ ssize_t @@ -2482,20 +2360,20 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i if(HDstrcmp(fd_ptr->cls->name, "multi") == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.") - /* While the family file driver is conceptually fully compatible + /* While the family file driver is conceptually fully compatible * with the get file image operation, it sets a file driver message * in the super block that prevents the image being opened with any * driver other than the family file driver. Needless to say, this * rather defeats the purpose of the get file image operation. * - * While this problem is quire solvable, the required time and + * While this problem is quire solvable, the required time and * resources are lacking at present. Hence, for now, we don't - * allow the get file image operation to be perfomed on files + * allow the get file image operation to be perfomed on files * opened with the family file driver. * - * Observe that the following test only looks at the top level + * Observe that the following test only looks at the top level * driver, and fails if there is some other driver sitting on to - * of the family file driver. + * of the family file driver. * * I don't think this can happen at present, but that may change * in the future. @@ -2514,7 +2392,7 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i /* test to see if a buffer was provided -- if not, we are done */ if(buf_ptr != NULL) { H5FD_io_info_t fdio_info; /* File driver I/O info */ - size_t space_needed; /* size of file image */ + size_t space_needed; /* size of file image */ hsize_t tmp; size_t tmp_size; @@ -2545,34 +2423,31 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i HDmemset((uint8_t *)(buf_ptr) + tmp, 0, tmp_size); } /* end if */ - + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_file_image() */ /*------------------------------------------------------------------------- - * Function: H5F_track_metadata_read_retries - * - * Purpose: To track the # of a "retries" (log10) for a metadata item. - * This routine should be used only when: - * "retries" > 0 - * f->shared->read_attempts > 1 (does not have retry when 1) - * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) + * Function: H5F_track_metadata_read_retries * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Vailin Choi; October 2013 + * Purpose: To track the # of a "retries" (log10) for a metadata item. + * This routine should be used only when: + * "retries" > 0 + * f->shared->read_attempts > 1 (does not have retry when 1) + * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries) { - unsigned log_ind; /* Index to the array of retries based on log10 of retries */ - double tmp; /* Temporary value, to keep compiler quiet */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned log_ind; /* Index to the array of retries based on log10 of retries */ + double tmp; /* Temporary value, to keep compiler quiet */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2603,23 +2478,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_set_retries - * - * Purpose: To initialize data structures for read retries: - * --zero out "retries" - * --set up "retries_nbins" based on read_attempts - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5F_set_retries * - * Programmer: Vailin Choi; November 2013 + * Purpose: To initialize data structures for read retries: + * --zero out "retries" + * --set up "retries_nbins" based on read_attempts * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5F_set_retries(H5F_t *f) { - double tmp; /* Temporary variable */ + double tmp; /* Temporary variable */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2649,9 +2521,6 @@ H5F_set_retries(H5F_t *f) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Vailin Choi; October 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -2675,15 +2544,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__set_base_addr + * Function: H5F__set_base_addr * - * Purpose: Quick and dirty routine to set the file's 'base_addr' value - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 19, 2013 + * Purpose: Quick and dirty routine to set the file's 'base_addr' value * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2698,7 +2563,7 @@ H5F__set_base_addr(const H5F_t *f, haddr_t addr) /* Dispatch to driver */ if(H5FD_set_base_addr(f->shared->lf, addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2706,15 +2571,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__set_eoa - * - * Purpose: Quick and dirty routine to set the file's 'eoa' value + * Function: H5F__set_eoa * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 19, 2013 + * Purpose: Quick and dirty routine to set the file's 'eoa' value * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2729,7 +2590,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) /* Dispatch to driver */ if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2737,15 +2598,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__set_paged_aggr - * - * Purpose: Quick and dirty routine to set the file's paged_aggr mode + * Function: H5F__set_paged_aggr * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * June 19, 2015 + * Purpose: Quick and dirty routine to set the file's paged_aggr mode * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2776,10 +2633,6 @@ done: * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 2/10/16 - * *------------------------------------------------------------------------- */ void @@ -2805,10 +2658,6 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) * * Return: Success: SUCCEED * Failure: FAIL - * - * Programmer: Quincey Koziol - * 4/26/16 - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 41cf4d2..cc2399b 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -26,16 +26,16 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ /****************/ @@ -75,17 +75,13 @@ /*------------------------------------------------------------------------- - * Function: H5F_get_intent + * Function: H5F_get_intent * - * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: 'intent' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'intent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -101,16 +97,12 @@ H5F_get_intent(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_open_name - * - * Purpose: Retrieve the name used to open a file. - * - * Return: Success: The name of the file. - * Failure: ? (should not happen) + * Function: H5F_get_open_name * - * Programmer: Neil Fortner - * December 15 2008 + * Purpose: Retrieve the name used to open a file. * + * Return: Success: The name of the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ char * @@ -127,16 +119,12 @@ H5F_get_open_name(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_actual_name + * Function: H5F_get_actual_name * - * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc. - * - * Return: Success: The name of the file. - * Failure: ? (should not happen) - * - * Programmer: Quincey Koziol - * November 25 2009 + * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc. * + * Return: Success: The name of the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ char * @@ -153,16 +141,13 @@ H5F_get_actual_name(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_extpath - * - * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location - * when searching the target file. + * Function: H5F_get_extpath * - * Return: 'extpath' on success/abort on failure (shouldn't fail) - * - * Programmer: Vailin Choi, April 2, 2008 + * Purpose: Retrieve the file's 'extpath' flags + * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location + * when searching the target file. * + * Return: 'extpath' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ char * @@ -179,14 +164,11 @@ H5F_get_extpath(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_shared - * - * Purpose: Retrieve the file's 'shared' pointer + * Function: H5F_get_shared * - * Return: 'shared' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'shared' pointer * + * Return: 'shared' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ H5F_file_t * @@ -202,14 +184,11 @@ H5F_get_shared(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_same_shared - * - * Purpose: Determine if two files have the same shared file pointer + * Function: H5F_same_shared * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 19, 2011 + * Purpose: Determine if two files have the same shared file pointer * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -228,14 +207,11 @@ H5F_same_shared(const H5F_t *f1, const H5F_t *f2) /*------------------------------------------------------------------------- - * Function: H5F_get_nopen_objs - * - * Purpose: Retrieve the file's 'nopen_objs' value - * - * Return: 'nopen_objs' on success/abort on failure (shouldn't fail) + * Function: H5F_get_nopen_objs * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nopen_objs' value * + * Return: 'nopen_objs' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -251,14 +227,11 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_get_file_id * - * Purpose: Retrieve the file's 'file_id' value - * - * Return: 'file_id' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'file_id' value * + * Return: 'file_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t @@ -274,14 +247,11 @@ H5F_get_file_id(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_parent - * - * Purpose: Retrieve the file's 'parent' pointer - * - * Return: 'parent' on success/abort on failure (shouldn't fail) + * Function: H5F_get_parent * - * Programmer: Quincey Koziol, July 19, 2011 + * Purpose: Retrieve the file's 'parent' pointer * + * Return: 'parent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ H5F_t * @@ -297,14 +267,11 @@ H5F_get_parent(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_nmounts + * Function: H5F_get_nmounts * - * Purpose: Retrieve the file's 'nmounts' value - * - * Return: 'nmounts' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nmounts' value * + * Return: 'nmounts' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -320,14 +287,11 @@ H5F_get_nmounts(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_read_attempts - * - * Purpose: Retrieve the file's 'read_attempts' value + * Function: H5F_get_read_attempts * - * Return: '# of read attempts' on success/abort on failure (shouldn't fail) - * - * Programmer: Vaili Choi; Sept 2013 + * Purpose: Retrieve the file's 'read_attempts' value * + * Return: '# of read attempts' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -343,18 +307,12 @@ H5F_get_read_attempts(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_fcpl - * - * Purpose: Retrieve the value of a file's FCPL. - * - * Return: Success: The FCPL for the file. + * Function: H5F_get_fcpl * - * Failure: ? (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 25 2005 + * Purpose: Retrieve the value of a file's FCPL. * + * Return: Success: The FCPL for the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ hid_t @@ -371,17 +329,13 @@ H5F_get_fcpl(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_sizeof_addr - * - * Purpose: Quick and dirty routine to retrieve the size of the file's size_t - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail) + * Function: H5F_sizeof_addr * - * Programmer: Quincey Koziol - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the size of the file's size_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ uint8_t @@ -398,17 +352,13 @@ H5F_sizeof_addr(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_sizeof_size + * Function: H5F_sizeof_size * - * Purpose: Quick and dirty routine to retrieve the size of the file's off_t - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: 'sizeof_size' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the size of the file's off_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'sizeof_size' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ uint8_t @@ -425,14 +375,11 @@ H5F_sizeof_size(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_addr - * - * Purpose: Retrieve the file's 'sohm_addr' value - * - * Return: 'sohm_addr' on success/abort on failure (shouldn't fail) + * Function: H5F_get_sohm_addr * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_addr' value * + * Return: 'sohm_addr' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ haddr_t @@ -449,14 +396,11 @@ H5F_get_sohm_addr(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_vers + * Function: H5F_get_sohm_vers * - * Purpose: Retrieve the file's 'sohm_vers' value - * - * Return: 'sohm_vers' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_vers' value * + * Return: 'sohm_vers' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -473,14 +417,11 @@ H5F_get_sohm_vers(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_nindexes - * - * Purpose: Retrieve the file's 'sohm_nindexes' value + * Function: H5F_get_sohm_nindexes * - * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_nindexes' value * + * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -497,21 +438,15 @@ H5F_get_sohm_nindexes(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_sym_leaf_k + * Function: H5F_sym_leaf_k * - * Purpose: Replaced a macro to retrieve the symbol table leaf size, - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the symbol table leaf size, + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the symbol table leaf size is + * Return: Success: Non-negative, and the symbol table leaf size is * returned. - * - * Failure: Negative (should not happen) - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Oct 14 2001 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ unsigned @@ -529,21 +464,15 @@ H5F_sym_leaf_k(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_Kvalue + * Function: H5F_Kvalue * - * Purpose: Replaced a macro to retrieve a B-tree key value for a certain - * type, now that the generic properties are being used to store - * the B-tree values. + * Purpose: Replaced a macro to retrieve a B-tree key value for a certain + * type, now that the generic properties are being used to store + * the B-tree values. * - * Return: Success: Non-negative, and the B-tree key value is + * Return: Success: Non-negative, and the B-tree key value is * returned. - * - * Failure: Negative (should not happen) - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Oct 14 2001 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ unsigned @@ -562,14 +491,11 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type) /*------------------------------------------------------------------------- - * Function: H5F_get_nrefs + * Function: H5F_get_nrefs * - * Purpose: Retrieve the file's 'nrefs' value - * - * Return: 'nrefs' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nrefs' value * + * Return: 'nrefs' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -586,21 +512,15 @@ H5F_get_nrefs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_rdcc_nslots + * Function: H5F_rdcc_nslots * - * Purpose: Replaced a macro to retrieve the raw data cache number of slots, - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the raw data cache number of slots, + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the raw data cache number of + * Return: Success: Non-negative, and the raw data cache number of * of slots is returned. - * - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 1 2004 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ size_t @@ -617,21 +537,15 @@ H5F_rdcc_nslots(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_rdcc_nbytes + * Function: H5F_rdcc_nbytes * - * Purpose: Replaced a macro to retrieve the raw data cache number of bytes, - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the raw data cache number of bytes, + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the raw data cache number of + * Return: Success: Non-negative, and the raw data cache number of * of bytes is returned. - * - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 1 2004 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ size_t @@ -648,21 +562,15 @@ H5F_rdcc_nbytes(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_rdcc_w0 + * Function: H5F_rdcc_w0 * - * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the raw data cache 'w0' value + * Return: Success: Non-negative, and the raw data cache 'w0' value * is returned. - * - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 2 2004 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ double @@ -679,17 +587,13 @@ H5F_rdcc_w0(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_base_addr - * - * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: Non-negative on success/Negative on failure + * Function: H5F_get_base_addr * - * Programmer: Raymond Lu - * December 20, 2002 + * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ haddr_t @@ -707,21 +611,15 @@ H5F_get_base_addr(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_grp_btree_shared + * Function: H5F_grp_btree_shared * - * Purpose: Replaced a macro to retrieve the shared B-tree node info - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the shared B-tree node info + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-void, and the shared B-tree node info + * Return: Success: Non-void, and the shared B-tree node info * is returned. - * - * Failure: void (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 5 2004 - * + * Failure: void (should not happen) *------------------------------------------------------------------------- */ H5UC_t * @@ -738,21 +636,15 @@ H5F_grp_btree_shared(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_sieve_buf_size + * Function: H5F_sieve_buf_size * - * Purpose: Replaced a macro to retrieve the dataset sieve buffer size - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the dataset sieve buffer size + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-void, and the dataset sieve buffer size + * Return: Success: Non-void, and the dataset sieve buffer size * is returned. - * - * Failure: void (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 8 2005 - * + * Failure: void (should not happen) *------------------------------------------------------------------------- */ size_t @@ -769,21 +661,15 @@ H5F_sieve_buf_size(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_gc_ref + * Function: H5F_gc_ref * - * Purpose: Replaced a macro to retrieve the "garbage collect - * references flag" now that the generic properties are being used - * to store the values. + * Purpose: Replaced a macro to retrieve the "garbage collect + * references flag" now that the generic properties are being used + * to store the values. * - * Return: Success: The "garbage collect references flag" + * Return: Success: The "garbage collect references flag" * is returned. - * - * Failure: (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 8 2005 - * + * Failure: (should not happen) *------------------------------------------------------------------------- */ unsigned @@ -800,18 +686,12 @@ H5F_gc_ref(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_use_latest_flags - * - * Purpose: Retrieve the 'latest version support' for the file. - * - * Return: Success: Non-negative, the requested 'version support' + * Function: H5F_use_latest_flags * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 5 2007 + * Purpose: Retrieve the 'latest version support' for the file. * + * Return: Success: Non-negative, the requested 'version support' + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -828,18 +708,12 @@ H5F_use_latest_flags(const H5F_t *f, unsigned fl) /*------------------------------------------------------------------------- - * Function: H5F_get_fc_degree - * - * Purpose: Retrieve the 'file close degree' for the file. - * - * Return: Success: Non-negative, the 'file close degree' + * Function: H5F_get_fc_degree * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 5 2007 + * Purpose: Retrieve the 'file close degree' for the file. * + * Return: Success: Non-negative, the 'file close degree' + * Failure: (can't happen) *------------------------------------------------------------------------- */ H5F_close_degree_t @@ -864,10 +738,6 @@ H5F_get_fc_degree(const H5F_t *f) * Return: Success: Flag indicating whether the evict-on-close * property was set for the file. * Failure: (can't happen) - * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ hbool_t @@ -884,18 +754,12 @@ H5F_get_evict_on_close(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_store_msg_crt_idx - * - * Purpose: Retrieve the 'store message creation index' flag for the file. + * Function: H5F_store_msg_crt_idx * - * Return: Success: Non-negative, the 'store message creation index' flag - * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Retrieve the 'store message creation index' flag for the file. * + * Return: Success: Non-negative, the 'store message creation index' flag + * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t @@ -912,17 +776,12 @@ H5F_store_msg_crt_idx(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_has_feature - * - * Purpose: Check if a file has a particular feature enabled + * Function: H5F_has_feature * - * Return: Success: Non-negative - TRUE or FALSE - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 31 2004 + * Purpose: Check if a file has a particular feature enabled * + * Return: Success: Non-negative - TRUE or FALSE + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ hbool_t @@ -939,17 +798,13 @@ H5F_has_feature(const H5F_t *f, unsigned feature) /*------------------------------------------------------------------------- - * Function: H5F_get_driver_id - * - * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: 'driver_id' on success/abort on failure (shouldn't fail) + * Function: H5F_get_driver_id * - * Programmer: Quincey Koziol - * October 10, 2000 + * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'driver_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t @@ -967,23 +822,19 @@ H5F_get_driver_id(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_fileno + * Function: H5F_get_fileno * - * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * March 27, 2002 + * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -994,7 +845,7 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum) /* Retrieve the file's serial number */ if(H5FD_get_fileno(f->shared->lf, filenum) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno") + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1002,21 +853,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_get_eoa - * - * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value + * Function: H5F_get_eoa * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * June 1, 2004 + * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) { - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -1025,7 +872,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1040,10 +887,6 @@ done: * * Return: Success: Non-negative. * Failure: negative. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1067,18 +910,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_is_tmp_addr - * - * Purpose: Quick and dirty routine to determine if an address is in - * the 'temporary' file space. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_is_tmp_addr * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol - * June 11, 2009 + * Purpose: Quick and dirty routine to determine if an address is in + * the 'temporary' file space. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -1095,18 +934,14 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_use_tmp_space - * - * Purpose: Quick and dirty routine to determine if using temporary - * file space is allowed for this file. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) + * Function: H5F_use_tmp_space * - * Programmer: Quincey Koziol - * July 1, 2009 + * Purpose: Quick and dirty routine to determine if using temporary + * file space is allowed for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -1124,17 +959,12 @@ H5F_use_tmp_space(const H5F_t *f) #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5F_coll_md_read + * Function: H5F_coll_md_read * - * Purpose: Retrieve the 'collective metadata reads' flag for the file. - * - * Return: Success: Non-negative, the 'collective metadata reads' flag - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 10 2016 + * Purpose: Retrieve the 'collective metadata reads' flag for the file. * + * Return: Success: Non-negative, the 'collective metadata reads' flag + * Failure: (can't happen) *------------------------------------------------------------------------- */ H5P_coll_md_read_flag_t @@ -1151,18 +981,14 @@ H5F_coll_md_read(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_use_mdc_logging - * - * Purpose: Quick and dirty routine to determine if using MDC logging - * is enabled for this file. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) + * Function: H5F_use_mdc_logging * - * Programmer: Quincey Koziol - * June 5, 2016 + * Purpose: Quick and dirty routine to determine if using MDC logging + * is enabled for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -1179,18 +1005,14 @@ H5F_use_mdc_logging(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_start_mdc_log_on_access + * Function: H5F_start_mdc_log_on_access * - * Purpose: Quick and dirty routine to determine if we should start MDC - * logging on access for this file. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol - * June 5, 2016 + * Purpose: Quick and dirty routine to determine if we should start MDC + * logging on access for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -1207,18 +1029,14 @@ H5F_start_mdc_log_on_access(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_mdc_log_location - * - * Purpose: Quick and dirty routine to retrieve the MDC log location - * for this file. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_mdc_log_location * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol - * June 5, 2016 + * Purpose: Quick and dirty routine to retrieve the MDC log location + * for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ char * @@ -1235,16 +1053,12 @@ H5F_mdc_log_location(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_alignment - * - * Purpose: Retrieve the 'alignment' for the file. - * - * Return: Success: Non-negative, the 'alignment' - * - * Failure: (can't happen) + * Function: H5F_get_alignment * - * Programmer: Vailin Choi; Dec 2012 + * Purpose: Retrieve the 'alignment' for the file. * + * Return: Success: Non-negative, the 'alignment' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hsize_t @@ -1261,16 +1075,12 @@ H5F_get_alignment(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_threshold - * - * Purpose: Retrieve the 'threshold' for alignment in the file. - * - * Return: Success: Non-negative, the 'threshold' - * - * Failure: (can't happen) + * Function: H5F_get_threshold * - * Programmer: Vailin Choi; Dec 2012 + * Purpose: Retrieve the 'threshold' for alignment in the file. * + * Return: Success: Non-negative, the 'threshold' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hsize_t @@ -1287,16 +1097,12 @@ H5F_get_threshold(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_pgend_meta_thres + * Function: H5F_get_pgend_meta_thres * - * Purpose: Retrieve the 'page end meta threshold size' for the file. - * - * Return: Success: Non-negative, the 'pgend_meta_thres' - * - * Failure: (can't happen) - * - * Programmer: Vailin Choi; Dec 2012 + * Purpose: Retrieve the 'page end meta threshold size' for the file. * + * Return: Success: Non-negative, the 'pgend_meta_thres' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hsize_t @@ -1313,13 +1119,12 @@ H5F_get_pgend_meta_thres(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_point_of_no_return + * Function: H5F_get_point_of_no_return * - * Purpose: Retrieve the 'point of no return' value for the file. - * - * Return: Success: Non-negative, the 'point_of_no_return' - * Failure: (can't happen) + * Purpose: Retrieve the 'point of no return' value for the file. * + * Return: Success: Non-negative, the 'point_of_no_return' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t @@ -1336,13 +1141,12 @@ H5F_get_point_of_no_return(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_first_alloc_dealloc - * - * Purpose: Retrieve the 'first alloc / dealloc' value for the file. + * Function: H5F_get_first_alloc_dealloc * - * Return: Success: Non-negative, the 'first_alloc_dealloc' - * Failure: (can't happen) + * Purpose: Retrieve the 'first alloc / dealloc' value for the file. * + * Return: Success: Non-negative, the 'first_alloc_dealloc' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t @@ -1359,13 +1163,12 @@ H5F_get_first_alloc_dealloc(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_eoa_pre_fsm_fsalloc - * - * Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file. + * Function: H5F_get_eoa_pre_fsm_fsalloc * - * Return: Success: Non-negative, the 'EOA pre-FSM fsalloc' - * Failure: (can't happen) + * Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file. * + * Return: Success: Non-negative, the 'EOA pre-FSM fsalloc' + * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t -- cgit v0.12 From 62124efa7e805bf34b54911e142f488a59867dd2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Nov 2017 11:25:09 -0600 Subject: Remove tabs --- src/H5Pdapl.c | 278 +++++++++++++++++++++----------------------------------- src/H5Ppublic.h | 82 ++++++++--------- 2 files changed, 144 insertions(+), 216 deletions(-) diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 3b0a8c5..494de3e 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdapl.c + * Created: H5Pdapl.c * October 27, 2008 * Neil Fortner * - * Purpose: Dataset access property list class routines + * Purpose: Dataset access property list class routines * *------------------------------------------------------------------------- */ @@ -32,13 +32,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -72,8 +72,8 @@ #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t /* Definition for append flush */ -#define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t) -#define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL} +#define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t) +#define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL} /* Definitions for external file prefix */ #define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *) #define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */ @@ -130,21 +130,21 @@ static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* va /* Dataset access property list class library initialization object */ const H5P_libclass_t H5P_CLS_DACC[1] = {{ - "dataset access", /* Class name for debugging */ + "dataset access", /* Class name for debugging */ H5P_TYPE_DATASET_ACCESS, /* Class type */ - &H5P_CLS_LINK_ACCESS_g, /* Parent class */ - &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class */ - &H5P_CLS_DATASET_ACCESS_ID_g, /* Pointer to class ID */ - &H5P_LST_DATASET_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P__dacc_reg_prop, /* Default property registration routine */ - - NULL, /* Class creation callback */ - NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ - NULL, /* Class copy callback info */ - NULL, /* Class close callback */ - NULL /* Class close callback info */ + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class */ + &H5P_CLS_DATASET_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_DATASET_ACCESS_ID_g, /* Pointer to default property list ID */ + H5P__dacc_reg_prop, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ }}; @@ -158,8 +158,8 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /*******************/ /* Property value defaults */ -static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */ -static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ +static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */ +static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ /*------------------------------------------------------------------------- @@ -169,9 +169,6 @@ static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default * properties * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * October 27, 2008 *------------------------------------------------------------------------- */ static herr_t @@ -187,17 +184,17 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, + if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -215,12 +212,12 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, + if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external file prefix */ - if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -237,7 +234,6 @@ done: * for a property list * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -263,7 +259,6 @@ H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * from a property list * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -290,7 +285,6 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * encoded. * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -341,8 +335,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) * property in the dataset access property list is * decoded. * - * Return: SUCCEED/FAIL - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -393,7 +386,6 @@ done: * Purpose: Frees memory used to store the external file prefix string * * Return: SUCCEED (Can't fail) - * *------------------------------------------------------------------------- */ static herr_t @@ -416,7 +408,6 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Purpose: Creates a copy of the external file prefix string * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -440,7 +431,6 @@ H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * compared. * * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. - * *------------------------------------------------------------------------- */ static int @@ -470,7 +460,6 @@ done: * Purpose: Frees memory used to store the external file prefix string * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -487,33 +476,27 @@ H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /*------------------------------------------------------------------------- - * Function: H5Pset_chunk_cache - * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk cache. - * Once set, these values will override the values in the file access - * property list. Each of thhese values can be individually unset - * (or not set at all) by passing the macros: - * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT, - * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or - * H5D_CHUNK_CACHE_W0_DEFAULT - * as appropriate. - * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Monday, October 27, 2008 - * - * Modifications: - * + * Function: H5Pset_chunk_cache + * + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk cache. + * Once set, these values will override the values in the file access + * property list. Each of thhese values can be individually unset + * (or not set at all) by passing the macros: + * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT, + * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or + * H5D_CHUNK_CACHE_W0_DEFAULT + * as appropriate. + * + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. + * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -548,23 +531,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_chunk_cache - * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. If these properties have - * not been set on this property list, the default values for a - * file access property list are returned. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Pget_chunk_cache * - * Programmer: Neil Fortner - * Monday, October 27, 2008 - * - * Modifications: + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. If these properties have + * not been set on this property list, the default values for a + * file access property list are returned. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -625,10 +602,6 @@ done: * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Wednesday, January 23, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -684,10 +657,6 @@ H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Wednesday, January 23, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -735,10 +704,6 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Wednesday, January 23, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -794,10 +759,6 @@ H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Wednesday, January 23, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -849,10 +810,6 @@ H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) * view defines the extent. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * May 4, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -887,13 +844,9 @@ done: * Purpose: Takes the access property list for the virtual dataset, * dapl_id, and gets the flag, view, set by the * H5Pset_virtual_view call. The possible values of view are - * H5D_VDS_FIRST_MISSING or H5D_VDS_LAST_AVAIALBLE. + * H5D_VDS_FIRST_MISSING or H5D_VDS_LAST_AVAIALBLE. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * May 4, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -927,10 +880,6 @@ done: * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Tuesday, May 5, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -964,10 +913,6 @@ H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size) * * Return: Success: Non-negative * Failure: Negative - * - * Programmer: Neil Fortner - * Tuesday, May 5, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1011,10 +956,6 @@ H5P__dacc_vds_view_dec(const void **_pp, void *_value) * the VDS fill value setting. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * May 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1053,10 +994,6 @@ done: * value for gap_size is 0. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * May 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1083,30 +1020,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_append_flush - * - * Purpose: Sets the boundary, callback function, and user data in the - * property list. - * "ndims": number of array elements for boundary - * "boundary": used to determine whether the current dimension hits - * a boundary; if so, invoke the callback function and - * flush the dataset. - * "func": the callback function to invoke when the boundary is hit - * "udata": the user data to pass as parameter with the callback function - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi; Dec 2013 - * + * Function: H5Pset_append_flush + * + * Purpose: Sets the boundary, callback function, and user data in the + * property list. + * "ndims": number of array elements for boundary + * "boundary": used to determine whether the current dimension hits + * a boundary; if so, invoke the callback function and + * flush the dataset. + * "func": the callback function to invoke when the boundary is hit + * "udata": the user data to pass as parameter with the callback function + * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D_append_cb_t func, void *udata) { - H5P_genplist_t *plist; /* Property list pointer */ - H5D_append_flush_t info; /* Property for append flush parameters */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + H5D_append_flush_t info; /* Property for append flush parameters */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIu*hx*x", plist_id, ndims, boundary, func, udata); @@ -1123,7 +1057,7 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D * This is almost certainly an error as the user data will not be used. */ if(!func && udata) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") - + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") @@ -1151,18 +1085,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_append_flush() - * - * Purpose: Retrieves the boundary, callback function and user data set in - * property list. - * Note that the # of boundary sizes to retrieve will not exceed - * the parameter "ndims" and the ndims set previously via - * H5Pset_append_flush(). - * - * Return: Non-negative on success/Negative on failure + * Function: H5Pget_append_flush() * - * Programmer: Vailin Choi; Dec 2013 + * Purpose: Retrieves the boundary, callback function and user data set in + * property list. + * Note that the # of boundary sizes to retrieve will not exceed + * the parameter "ndims" and the ndims set previously via + * H5Pset_append_flush(). * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1170,7 +1101,7 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe { H5P_genplist_t *plist; /* property list pointer */ H5D_append_flush_t info; - unsigned u; /* local index variable */ + unsigned u; /* local index variable */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -1186,15 +1117,15 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe /* Assign return values */ if(boundary) { - HDmemset(boundary, 0, ndims * sizeof(hsize_t)); - if(info.ndims > 0) - for(u = 0; u < info.ndims && u < ndims; u++) - boundary[u] = info.boundary[u]; + HDmemset(boundary, 0, ndims * sizeof(hsize_t)); + if(info.ndims > 0) + for(u = 0; u < info.ndims && u < ndims; u++) + boundary[u] = info.boundary[u]; } /* end if */ if(func) - *func = info.func; + *func = info.func; if(udata) - *udata = info.udata; + *udata = info.udata; done: FUNC_LEAVE_API(ret_value) @@ -1215,8 +1146,7 @@ done: * This property can be overwritten by the environment variable * HDF5_EXTFILE_PREFIX. * - * Return: Non-negative on success/Negative on failure - * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1242,24 +1172,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_efile_prefix - * - * Purpose: Gets the prefix to be used for any external files. - * - * If the pointer is not NULL, it points to a user-allocated - * buffer. + * Function: H5Pget_efile_prefix * - * Return: Non-negative on success/Negative on failure + * Purpose: Gets the prefix to be used for any external files. + * If the pointer is not NULL, it points to a user-allocated + * buffer. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ ssize_t H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) { H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Library's copy of the prefix */ - size_t len; /* Length of prefix string */ - ssize_t ret_value; /* Return value */ + char *my_prefix; /* Library's copy of the prefix */ + size_t len; /* Length of prefix string */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "i*sz", plist_id, prefix, size); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 854b1ef..493a322 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -50,43 +50,43 @@ * The library's property list classes */ -#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_ID_g) -#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_ID_g) -#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_ID_g) -#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_ID_g) -#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_ID_g) -#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_ID_g) -#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_ID_g) -#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_ID_g) -#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_ID_g) -#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g) -#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g) -#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) -#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) -#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) -#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) -#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) -#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) -#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) +#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_ID_g) +#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_ID_g) +#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_ID_g) +#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_ID_g) +#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_ID_g) +#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_ID_g) +#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_ID_g) +#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_ID_g) +#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_ID_g) +#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g) +#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g) +#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) +#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) +#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) +#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) +#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) +#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) /* * The library's default property lists */ -#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g) -#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g) -#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g) -#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g) -#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g) -#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_ID_g) -#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_ID_g) -#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g) -#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) -#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) -#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) -#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) -#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) -#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) -#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) +#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g) +#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g) +#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g) +#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g) +#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g) +#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_ID_g) +#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_ID_g) +#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g) +#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) +#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) +#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) +#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) +#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) +#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) /* Common creation order flags (for links in groups and attributes on objects) */ #define H5P_CRT_ORDER_TRACKED 0x0001 @@ -140,9 +140,9 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t { typedef enum H5D_mpio_actual_io_mode_t { /* The following four values are conveniently defined as a bit field so that * we can switch from the default to indpendent or collective and then to - * mixed without having to check the original value. - * - * NO_COLLECTIVE means that either collective I/O wasn't requested or that + * mixed without having to check the original value. + * + * NO_COLLECTIVE means that either collective I/O wasn't requested or that * no I/O took place. * * CHUNK_INDEPENDENT means that collective I/O was requested, but the @@ -155,7 +155,7 @@ typedef enum H5D_mpio_actual_io_mode_t { /* The contiguous case is separate from the bit field. */ H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4 -} H5D_mpio_actual_io_mode_t; +} H5D_mpio_actual_io_mode_t; /* Broken collective IO property */ typedef enum H5D_mpio_no_collective_cause_t { @@ -326,7 +326,7 @@ H5_DLL herr_t H5Pget_cache(hid_t plist_id, H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t * config_ptr); H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, - H5AC_cache_config_t * config_ptr); /* out */ + H5AC_cache_config_t * config_ptr); /* out */ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref/*out*/); H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); @@ -402,12 +402,12 @@ H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/); H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status); H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t - alloc_time); + alloc_time); H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t - *alloc_time/*out*/); + *alloc_time/*out*/); H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time); H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t - *fill_time/*out*/); + *fill_time/*out*/); /* Dataset access property list (DAPL) routines */ H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, -- cgit v0.12 From 00ade113c5fe7d48571a36091970328dcca68f50 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 8 Nov 2017 17:52:44 -0800 Subject: Plugin test rework Cleanup of plugin test code. Renames many files. Prep for VOL branch merge. --- MANIFEST | 12 +- configure.ac | 8 +- test/CMakeLists.txt | 92 +-- test/CMakeTests.cmake | 12 +- test/Makefile.am | 49 +- test/dynlib1.c | 95 --- test/dynlib2.c | 92 --- test/dynlib3.c | 103 --- test/dynlib4.c | 102 --- test/filter_plugin.c | 1511 +++++++++++++++++++++++++++++++++++++++ test/filter_plugin1_dsets.c | 93 +++ test/filter_plugin2_dsets.c | 88 +++ test/filter_plugin3_dsets.c | 119 +++ test/filter_plugin4_groups.c | 106 +++ test/plugin.c | 1217 ------------------------------- test/test_filter_plugin.sh.in | 113 +++ test/test_plugin.sh.in | 113 --- tools/test/h5diff/Makefile.am | 3 - tools/test/h5dump/Makefile.am | 3 - tools/test/h5ls/Makefile.am | 3 - tools/test/h5repack/Makefile.am | 5 - 21 files changed, 2111 insertions(+), 1828 deletions(-) delete mode 100644 test/dynlib1.c delete mode 100644 test/dynlib2.c delete mode 100644 test/dynlib3.c delete mode 100644 test/dynlib4.c create mode 100644 test/filter_plugin.c create mode 100644 test/filter_plugin1_dsets.c create mode 100644 test/filter_plugin2_dsets.c create mode 100644 test/filter_plugin3_dsets.c create mode 100644 test/filter_plugin4_groups.c delete mode 100644 test/plugin.c create mode 100644 test/test_filter_plugin.sh.in delete mode 100644 test/test_plugin.sh.in diff --git a/MANIFEST b/MANIFEST index 4270479..230bf1f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -936,10 +936,6 @@ ./test/dt_arith.c ./test/dtypes.c ./test/dtransform.c -./test/dynlib1.c -./test/dynlib2.c -./test/dynlib3.c -./test/dynlib4.c ./test/earray.c ./test/efc.c ./test/enc_dec_plist.c @@ -967,6 +963,11 @@ ./test/fill_old.h5 ./test/fillval.c ./test/filter_fail.c +./test/filter_plugin.c +./test/filter_plugin1_dsets.c +./test/filter_plugin2_dsets.c +./test/filter_plugin3_dsets.c +./test/filter_plugin4_groups.c ./test/flush1.c ./test/flush2.c ./test/flushrefresh.c @@ -1030,7 +1031,6 @@ ./test/page_buffer.c ./test/paged_nopersist.h5 ./test/paged_persist.h5 -./test/plugin.c ./test/reserved.c ./test/pool.c ./test/set_extent.c @@ -1065,12 +1065,12 @@ ./test/testerror.sh.in ./test/testlinks_env.sh.in ./test/test_filenotclosed.sh.in +./test/test_filter_plugin.sh.in ./test/testflushrefresh.sh.in ./test/testframe.c ./test/testhdf5.c ./test/testhdf5.h ./test/testlibinfo.sh.in -./test/test_plugin.sh.in ./test/test_usecases.sh.in ./test/testmeta.c ./test/testswmr.sh.in diff --git a/configure.ac b/configure.ac index 3dbd95c..d8f3873 100644 --- a/configure.ac +++ b/configure.ac @@ -3369,17 +3369,17 @@ AC_CONFIG_FILES([src/libhdf5.settings Makefile src/Makefile test/Makefile + test/H5srcdir_str.h test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh - test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh - test/test_filenotclosed.sh test/testswmr.sh - test/test_plugin.sh - test/test_usecases.sh test/testvdsswmr.sh + test/test_filenotclosed.sh + test/test_filter_plugin.sh + test/test_usecases.sh testpar/Makefile tools/Makefile tools/lib/Makefile diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8522c1d..0a2afbf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -70,73 +70,73 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- -# If plugin library tests can be tested +# If filter plugin tests can be tested #----------------------------------------------------------------------------- # make plugins dir - file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir1") - file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2") + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1") + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2") #----------------------------------------------------------------------------- - # Define Plugin Test Sources + # Define Filter Plugin Test Sources #----------------------------------------------------------------------------- - set (TEST_PLUGIN_LIBS - dynlib1 - dynlib3 + set (FILTER_PLUGINS_FOR_DIR1 + filter_plugin1_dsets + filter_plugin3_dsets ) - set (TEST2_PLUGIN_LIBS - dynlib2 - dynlib4 + set (FILTER_PLUGINS_FOR_DIR2 + filter_plugin2_dsets + filter_plugin4_groups ) - foreach (test_lib ${TEST_PLUGIN_LIBS}) - set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") - set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") - set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) + foreach (plugin_name ${FILTER_PLUGINS_FOR_DIR1}) + set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}") + set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}") + set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) - add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) - TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) - set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) + TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- - # Copy plugin library to a plugins folder + # Copy the filter plugin to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} + TARGET ${HDF5_TEST_PLUGIN_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/testdir1/$" + "$" + "${CMAKE_BINARY_DIR}/filter_plugin_dir1/$" ) endforeach () - foreach (test_lib ${TEST2_PLUGIN_LIBS}) - set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") - set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") - set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) + foreach ( plugin_name ${FILTER_PLUGINS_FOR_DIR2}) + set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}") + set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}") + set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) - add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) - TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) - set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) + TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- - # Copy plugin library to a plugins folder + # Copy the filter plugin to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} + TARGET ${HDF5_TEST_PLUGIN_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/testdir2/$" + "$" + "${CMAKE_BINARY_DIR}/filter_plugin_dir2/$" ) endforeach () @@ -411,17 +411,17 @@ endif () ### P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) - add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c) - TARGET_NAMING (plugin SHARED) - TARGET_C_PROPERTIES (plugin SHARED " " " ") - target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET}) - set_target_properties (plugin PROPERTIES FOLDER test) + add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) + TARGET_NAMING (filter_plugin SHARED) + TARGET_C_PROPERTIES (filter_plugin SHARED " " " ") + target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) + set_target_properties (filter_plugin PROPERTIES FOLDER test) else () - add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c) - TARGET_NAMING (plugin STATIC) - TARGET_C_PROPERTIES (plugin STATIC " " " ") - target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET}) - set_target_properties (plugin PROPERTIES FOLDER test) + add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) + TARGET_NAMING (filter_plugin STATIC) + TARGET_C_PROPERTIES (filter_plugin STATIC " " " ") + target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) + set_target_properties (filter_plugin PROPERTIES FOLDER test) endif () ############################################################################## diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 61ac3d2..973d389 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1,4 +1,4 @@ -# + # Copyright by The HDF Group. # All rights reserved. # @@ -520,7 +520,7 @@ set (test_CLEANFILES multi_file-r.h5 multi_file-s.h5 core_file - plugin.h5 + filter_plugin.h5 new_move_a.h5 new_move_b.h5 ntypes.h5 @@ -1013,7 +1013,7 @@ if (BUILD_SHARED_LIBS) endif () ############################################################################## -### P L U G I N T E S T S +### F I L T E R P L U G I N T E S T S ############################################################################## if (WIN32) set (CMAKE_SEP "\;") @@ -1023,9 +1023,9 @@ else () set (BIN_REL_PATH "../") endif () -add_test (NAME H5PLUGIN-plugin COMMAND $) -set_tests_properties (H5PLUGIN-plugin PROPERTIES - ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" +add_test (NAME H5PLUGIN-filter_plugin COMMAND $) +set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} ) diff --git a/test/Makefile.am b/test/Makefile.am index ba2d79b..4f192ac 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -26,11 +26,12 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # testlibinfo.sh: # testcheck_version.sh: tcheck_version # testlinks_env.sh: links_env -# test_filenotclosed.sh: filenotclosed.c # testflushrefresh.sh: flushrefresh -# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* +# test_filenotclosed.sh: filenotclosed.c +# test_filter_plugin.sh: filter_plugin.c +# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\ testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_filenotclosed$(EXEEXT) \ @@ -40,8 +41,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_ swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \ vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) if HAVE_SHARED_CONDITIONAL - TEST_SCRIPT += test_plugin.sh - SCRIPT_DEPEND += plugin$(EXEEXT) + TEST_SCRIPT += test_filter_plugin.sh + SCRIPT_DEPEND += filter_plugin$(EXEEXT) endif check_SCRIPTS = $(TEST_SCRIPT) @@ -81,7 +82,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer if HAVE_SHARED_CONDITIONAL - check_PROGRAMS+= plugin + check_PROGRAMS+= filter_plugin endif # These programs generate test files for the tests. They don't need to be @@ -102,29 +103,17 @@ endif if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. - # The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c. - # Build them as shared libraries if configure is enabled for shared library. - noinst_LTLIBRARIES=libh5test.la libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la - libdynlib1_la_SOURCES=dynlib1.c - libdynlib2_la_SOURCES=dynlib2.c - libdynlib3_la_SOURCES=dynlib3.c - libdynlib4_la_SOURCES=dynlib4.c - libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - - libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_libdynlib1_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlib1_la_LINK) $(am_libdynlib1_la_rpath) $(libdynlib1_la_OBJECTS) $(libdynlib1_la_LIBADD) - - libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlib2_la_LINK) $(am_libdynlib2_la_rpath) $(libdynlib2_la_OBJECTS) $(libdynlib2_la_LIBADD) - - libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlib3_la_LINK) $(am_libdynlib3_la_rpath) $(libdynlib3_la_OBJECTS) $(libdynlib3_la_LIBADD) - - libdynlib4.la: $(libdynlib4_la_OBJECTS) $(libdynlib4_la_DEPENDENCIES) $(EXTRA_libdynlib4_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlib4_la_LINK) $(am_libdynlib4_la_rpath) $(libdynlib4_la_OBJECTS) $(libdynlib4_la_LIBADD) + # The filter_plugin* libraries are for use in filter_plugin.c. + # Build them as shared libraries if that option was enabled in configure. + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la + libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c + libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c + libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c + libfilter_plugin4_groups_la_SOURCES=filter_plugin4_groups.c + libfilter_plugin1_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin2_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin3_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin4_groups_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere else # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la @@ -185,7 +174,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \ family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \ - multi_file-[rs].h5 core_file plugin.h5 \ + multi_file-[rs].h5 core_file filter_plugin.h5 \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \ @@ -215,7 +204,7 @@ use_append_mchunks_SOURCES=use_append_mchunks.c use_common.c use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c # Temporary files. -DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh \ +DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \ testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh include $(top_srcdir)/config/conclude.am diff --git a/test/dynlib1.c b/test/dynlib1.c deleted file mode 100644 index e9137fb..0000000 --- a/test/dynlib1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) - */ - -#include -#include -#include "H5PLextern.h" - -#define H5Z_FILTER_DYNLIB1 257 - -static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ -}}; - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib1 - * - * Purpose: A dynlib1 filter method that adds on and subtract from - * the original value with another value. It will be built - * as a shared library. plugin.c test will load and use - * this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * 29 March 2013 - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr = (int *)*buf; /* Pointer to the data values */ - size_t buf_left = *buf_size; /* Amount of data buffer left to process */ - int add_on = 0; - - /* Check for the correct number of parameters */ - if(cd_nelmts == 0) - return(0); - - /* Check that permanent parameters are set correctly */ - if(cd_values[0] > 9) - return(0); - - add_on = (int)cd_values[0]; - - if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Substract the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ -= add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end if */ - else { /*write*/ - /* Add the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ += add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* end H5Z_filter_dynlib1() */ - diff --git a/test/dynlib2.c b/test/dynlib2.c deleted file mode 100644 index 2574d4d..0000000 --- a/test/dynlib2.c +++ /dev/null @@ -1,92 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) - */ - -#include -#include -#include "H5PLextern.h" - -#define H5Z_FILTER_DYNLIB2 258 -#define MULTIPLIER 3 - -static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB2[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB2, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib2", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ -}}; - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib2 - * - * Purpose: A dynlib2 filter method that multiplies the original value - * during write and divide the original value during read. It - * will be built as a shared library. plugin.c test will load - * and use this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * 29 March 2013 - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr = (int *)*buf; /* Pointer to the data values */ - size_t buf_left = *buf_size; /* Amount of data buffer left to process */ - - /* Check for the correct number of parameters */ - if(cd_nelmts > 0) - return(0); - - /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; - - if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Divide the original value with MULTIPLIER */ - while(buf_left > 0) { - *int_ptr++ /= MULTIPLIER; - buf_left -= sizeof(int); - } /* end while */ - } /* end if */ - else { /*write*/ - /* Multiply the original value with MULTIPLIER */ - while(buf_left > 0) { - *int_ptr++ *= MULTIPLIER; - buf_left -= sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* end H5Z_filter_dynlib2() */ - diff --git a/test/dynlib3.c b/test/dynlib3.c deleted file mode 100644 index 8871321..0000000 --- a/test/dynlib3.c +++ /dev/null @@ -1,103 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu - * 1 April 2013 - * - * Purpose: Tests the plugin module (H5PL) - */ - -#include -#include -#include -#include "H5PLextern.h" - -#define H5Z_FILTER_DYNLIB3 259 -#define SUFFIX_LEN 8 -#define GROUP_SUFFIX ".h5group" - -static size_t H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB3[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB3, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib3", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib3, /* The actual filter function */ -}}; - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB3;} - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib3 - * - * Purpose: A dynlib3 filter method that is used to test groups. It - * appends the suffix ".h5group" to each group name during - * write and takes it out during read. - * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * 1 April 2013 - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - size_t ret_value; /* Return value */ - - /* Check for the correct number of parameters */ - if(cd_nelmts > 0) - return(0); - - /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; - - if(flags & H5Z_FLAG_REVERSE) { /*read*/ - ret_value = *buf_size = nbytes - SUFFIX_LEN; - } /* end if */ - else { /*write*/ - void *outbuf = NULL; /* Pointer to new buffer */ - unsigned char *dst; /* Temporary pointer to destination buffer */ - - dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0)); - - /* Copy raw data */ - memcpy((void*)dst, (void*)(*buf), nbytes); - - /* Append suffix to raw data for storage */ - dst += nbytes; - memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN); - - /* Free input buffer */ - H5free_memory(*buf); - - /* Set return values */ - *buf_size = nbytes + SUFFIX_LEN; - *buf = outbuf; - outbuf = NULL; - ret_value = *buf_size; - } /* end else */ - - return ret_value; -} /* H5Z_filter_dynlib3() */ - diff --git a/test/dynlib4.c b/test/dynlib4.c deleted file mode 100644 index 06d90ff..0000000 --- a/test/dynlib4.c +++ /dev/null @@ -1,102 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Purpose: Tests the plugin module (H5PL) - */ - -#include -#include -#include "H5PLextern.h" - -#define H5Z_FILTER_DYNLIB4 260 - -#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str) - -static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB4[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB4, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib4", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */ -}}; - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;} - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib4 - * - * Purpose: A dynlib4 filter method that adds on and subtract from - * the original value with another value. It will be built - * as a shared library. plugin.c test will load and use - * this filter library. Designed to call a HDF function. - * - * Return: Success: Data chunk size - * - * Failure: 0 - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr = (int *)*buf; /* Pointer to the data values */ - size_t buf_left = *buf_size; /* Amount of data buffer left to process */ - int add_on = 0; - unsigned ver_info[3]; - - /* Check for the library version */ - if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) { - PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion"); - return(0); - } - /* Check for the correct number of parameters */ - if(cd_nelmts == 0) - return(0); - - /* Check that permanent parameters are set correctly */ - if(cd_values[0] > 9) - return(0); - - if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) { - PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match"); - return(0); - } - - add_on = (int)cd_values[0]; - - if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Substract the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ -= add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end if */ - else { /*write*/ - /* Add the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ += add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* end H5Z_filter_dynlib4() */ - diff --git a/test/filter_plugin.c b/test/filter_plugin.c new file mode 100644 index 0000000..8b7e0e4 --- /dev/null +++ b/test/filter_plugin.c @@ -0,0 +1,1511 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* + * Purpose: Tests the plugin module (H5PL) + */ + +#include "h5test.h" +#include "H5srcdir.h" + +/* + * This file needs to access private datatypes from the H5Z and H5PL package. + */ +#define H5PL_FRIEND +#include "H5PLpkg.h" +#define H5Z_FRIEND +#include "H5Zpkg.h" + +/* Filters IDs for test filter plugins */ +#define FILTER1_ID 257 +#define FILTER2_ID 258 +#define FILTER3_ID 259 +#define FILTER4_ID 260 + +const char *FILENAME[] = { + "filter_plugin", + NULL +}; +#define FILENAME_BUF_SIZE 1024 + +/* Dataset names */ +#define DSET_DEFLATE_NAME "deflate dset" +#define DSET_FILTER1_NAME "filter 1 dset" +#define DSET_FILTER2_NAME "filter 2 dset" +#define DSET_FILTER3_NAME "filter 3 dset" + +/* Array sizes used throughout the test */ +#define DSET_DIM1 100 +#define DSET_DIM2 200 +#define CHUNK_DIM1 2 +#define CHUNK_DIM2 25 +#define HYPERSLAB_OFFSET1 7 +#define HYPERSLAB_OFFSET2 30 +#define HYPERSLAB_SIZE1 4 +#define HYPERSLAB_SIZE2 50 + +/* Global size arrays */ +const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ +const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */ +const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */ +const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ + +/* Limit random number within 20000 */ +#define RANDOM_LIMIT 20000 + +/* Things used in the groups + filter plugins test */ +#define N_SUBGROUPS 1000 +#define SUBGROUP_PREFIX "subgroup_" +#define TOP_LEVEL_GROUP_NAME "top-level group" + +/* Global arrays in which to save data */ +int **orig_deflate_g = NULL; +int **orig_dynlib1_g = NULL; +int **orig_dynlib2_g = NULL; +int **orig_dynlib4_g = NULL; + + + +/*------------------------------------------------------------------------- + * Function: free_2D_array + * + * Purpose: Free up a dynamic 2D pseudo array and set the pointer to NULL + * Designed to be callable in error conditions so NULLs are okay + * + * Return: SUCCEED (always) + * + *------------------------------------------------------------------------- + */ +static herr_t +free_2D_array(int ***arr) { + + if (arr && *arr && (*arr)[0]) + HDfree((*arr)[0]); + if (arr && *arr) + HDfree(*arr); + *arr = NULL; + + return SUCCEED; +} /* end free_2D_array() */ + + +/*------------------------------------------------------------------------- + * Function: allocate_and_init_2D_array + * + * Purpose: Initialize an array as a pseudo 2D array and copy in some + * initial values. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +allocate_and_init_2D_array(int ***arr, const hsize_t *sizes, int **initial_values) { + + size_t r, c; /* Data rows and columns */ + size_t i; /* Iterator */ + size_t n_bytes; /* # of bytes to copy */ + + r = (size_t)sizes[0]; + c = (size_t)sizes[1]; + + /* Allocate and set up pseudo-2D array */ + if (NULL == (*arr = (int **)HDcalloc(r, sizeof(int *)))) + TEST_ERROR; + if (NULL == ((*arr)[0] = (int *)HDcalloc(r * c, sizeof(int)))) + TEST_ERROR; + for (i = 0; i < r; i++) + (*arr)[i] = (**arr + c * i); + + /* Copy over the data elements */ + if (initial_values) { + n_bytes = r * c * sizeof(int); + HDmemcpy((*arr)[0], initial_values[0], n_bytes); + } + + return SUCCEED; +error: + free_2D_array(arr); + + return FAIL; +} /* end allocate_and_init_2D_array() */ + + +/*------------------------------------------------------------------------- + * Function: compare_2D_arrays + * + * Purpose: Compare two pseudo 2D arrays + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_t *are_same) { + hsize_t i, j; /* index variables */ + + *are_same = TRUE; + + /* Check all the array values. This could optionally emit any + * bad data, but it's not clear how that would help debugging. + */ + for (i = 0; i < sizes[0]; i++) + for (j = 0; j < sizes[1]; j++) + if (dset1[i][j] != dset2[i][j]) { + *are_same = FALSE; + return SUCCEED; + } + + return SUCCEED; + +} /* end compare_2D_arrays() */ + + +/*------------------------------------------------------------------------- + * Function: ensure_filter_works + * + * Purpose: Tests writing entire data and partial data with filters + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +ensure_filter_works(hid_t fid, const char *name, hid_t dcpl_id) +{ + hid_t did = -1; /* Dataset ID */ + hid_t dxpl_id = -1; /* Dataset xfer property list ID */ + hid_t write_dxpl_id = -1; /* Dataset xfer property list ID for writing */ + hid_t sid = -1; /* Dataspace ID */ + void *tconv_buf = NULL; /* Temporary conversion buffer */ + int **orig = NULL; /* Data written to the dataset */ + int **read = NULL; /* Data read from the dataset */ + size_t r, c; /* Data rows and columns */ + size_t hs_r, hs_c, hs_offr, hs_offc; /* Hypserslab sizes and offsets */ + size_t i, j; /* Local index variables */ + int n = 0; /* Value written to point array */ + hbool_t are_same; /* Output from dataset compare function */ + int ***save_array = NULL; /* (Global) array where the final data go */ + + /* initialize */ + r = (size_t)sizes_g[0]; + c = (size_t)sizes_g[1]; + + /* Create the data space */ + if ((sid = H5Screate_simple(2, sizes_g, NULL)) < 0) + TEST_ERROR; + + /* Allocate memory for the data buffers + * We're using the hacky way of doing 2D arrays that uses a + * single data buffer but which allows normal 2D access. + */ + if (allocate_and_init_2D_array(&orig, sizes_g, NULL) < 0) + TEST_ERROR; + if (allocate_and_init_2D_array(&read, sizes_g, NULL) < 0) + TEST_ERROR; + + /* Create a small conversion buffer to test strip mining. We + * might as well test all we can! + */ + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + TEST_ERROR; + if (NULL == (tconv_buf = HDcalloc((size_t)1000, sizeof(char)))) + TEST_ERROR; + if (H5Pset_buffer(dxpl_id, (size_t)1000, tconv_buf, NULL) < 0) + TEST_ERROR; + if ((write_dxpl_id = H5Pcopy(dxpl_id)) < 0) + TEST_ERROR; + + TESTING(" filters (setup)"); + + /* Check if all the filters are available */ + if (H5Pall_filters_avail(dcpl_id) != TRUE) + TEST_ERROR; + + /* Create the dataset */ + if ((did = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 1: Read uninitialized data. It should be zero. + *---------------------------------------------------------------------- + */ + TESTING(" filters (uninitialized read)"); + + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0) + TEST_ERROR; + + /* The input buffer was calloc'd and has not been initialized yet */ + if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0) + TEST_ERROR; + if (FALSE == are_same) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 2: Test filters by setting up a chunked dataset and writing + * to it. + *---------------------------------------------------------------------- + */ + TESTING(" filters (write)"); + + n = 0; + for (i = 0; i < r; i++) + for (j = 0; j < c; j++) + orig[i][j] = n++; + + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl_id, *orig) < 0) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 3: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" filters (read)"); + + /* Read the dataset back */ + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0) + TEST_ERROR; + if (FALSE == are_same) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 4: Write new data over the top of the old data. The new data is + * random thus not very compressible, and will cause the chunks to move + * around as they grow. We only change values for the left half of the + * dataset although we rewrite the whole thing. + *---------------------------------------------------------------------- + */ + TESTING(" filters (modify)"); + + for (i = 0; i < r; i++) + for (j = 0; j < c / 2; j++) + orig[i][j] = (int)HDrandom() % RANDOM_LIMIT; + + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl_id, *orig) < 0) + TEST_ERROR; + + /* Read the dataset back and check it */ + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0) + TEST_ERROR; + if (FALSE == are_same) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 5: Close the dataset and then open it and read it again. This + * insures that the filters message is picked up properly from the + * object header. + *---------------------------------------------------------------------- + */ + TESTING(" filters (re-open)"); + + if (H5Dclose(did) < 0) + TEST_ERROR; + if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0) + TEST_ERROR; + if (FALSE == are_same) + TEST_ERROR; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 6: Test partial I/O by writing to and then reading from a + * hyperslab of the dataset. The hyperslab does not line up on chunk + * boundaries (we know that case already works from above tests). + *---------------------------------------------------------------------- + */ + TESTING(" filters (partial I/O)"); + + hs_r = (size_t)hs_sizes_g[0]; + hs_c = (size_t)hs_sizes_g[1]; + hs_offr = (size_t)hs_offsets_g[0]; + hs_offc = (size_t)hs_offsets_g[1]; + for (i = 0; i < hs_r; i++) + for (j = 0; j < hs_c; j++) + orig[hs_offr + i][hs_offc + j] = (int)HDrandom() % RANDOM_LIMIT; + + if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offsets_g, NULL, hs_sizes_g, NULL) < 0) + TEST_ERROR; + + /* Use the "read" DXPL because partial I/O on corrupted data test + * needs to ignore errors during writing + */ + if (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, *orig) < 0) + TEST_ERROR; + + if (H5Dread(did, H5T_NATIVE_INT, sid, sid, dxpl_id, *read) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0) + TEST_ERROR; + if (FALSE == are_same) + TEST_ERROR; + + PASSED(); + + /* Save the data written to the file for later comparison when the file + * is reopened for read test. + */ + if (!HDstrcmp(name, DSET_DEFLATE_NAME)) + save_array = &orig_deflate_g; + else if (!HDstrcmp(name, DSET_FILTER1_NAME)) + save_array = &orig_dynlib1_g; + else if (!HDstrcmp(name, DSET_FILTER2_NAME)) + save_array = &orig_dynlib2_g; + else if (!HDstrcmp(name, DSET_FILTER3_NAME)) + save_array = &orig_dynlib4_g; + else + TEST_ERROR; + if (allocate_and_init_2D_array(save_array, sizes_g, orig) < 0) + TEST_ERROR; + + /* Clean up and exit */ + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Pclose(dxpl_id) < 0) + TEST_ERROR; + if (H5Pclose(write_dxpl_id) < 0) + TEST_ERROR; + + free_2D_array(&orig); + free_2D_array(&read); + + HDfree(tconv_buf); + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dxpl_id); + H5Pclose(write_dxpl_id); + } H5E_END_TRY + + /* NULLs are okay here */ + free_2D_array(&orig); + free_2D_array(&read); + + if (tconv_buf) + HDfree(tconv_buf); + + return FAIL; +} /* end ensure_filter_works() */ + + +/*------------------------------------------------------------------------- + * Function: test_dataset_write_with_filters + * + * Purpose: Tests creating datasets and writing data with dynamically loaded filters + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_dataset_write_with_filters(hid_t fid) +{ + hid_t dcpl_id = -1; /* Dataset creation property list ID */ + unsigned int compress_level; /* Deflate compression level */ + unsigned int filter1_data; /* Data used by filter 1 */ + unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */ + + /*---------------------------------------------------------- + * STEP 1: Test deflation by itself. + *---------------------------------------------------------- + */ + HDputs("Testing dataset writes with deflate filter"); +#ifdef H5_HAVE_FILTER_DEFLATE + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) + TEST_ERROR; + compress_level = 6; + if (H5Pset_deflate(dcpl_id, compress_level) < 0) + TEST_ERROR; + + /* Ensure the filter works */ + if (ensure_filter_works(fid, DSET_DEFLATE_NAME, dcpl_id) < 0) + TEST_ERROR; + + /* Clean up objects used for this test */ + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; +#else /* H5_HAVE_FILTER_DEFLATE */ + SKIPPED(); + HDputs(" Deflate filter not enabled"); +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /*---------------------------------------------------------- + * STEP 2: Test filter plugin 1 by itself. + *---------------------------------------------------------- + */ + HDputs(" dataset writes with filter plugin 1"); + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) + TEST_ERROR; + + /* Set up the filter, passing in the amount the filter will add and subtract + * from each data element. Note that this value has an arbitrary max of 9. + */ + filter1_data = 9; + if (H5Pset_filter(dcpl_id, FILTER1_ID, H5Z_FLAG_MANDATORY, (size_t)1, &filter1_data) < 0) + TEST_ERROR; + + /* Ensure the filter works */ + if (ensure_filter_works(fid, DSET_FILTER1_NAME, dcpl_id) < 0) + TEST_ERROR; + + /* Clean up objects used for this test */ + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* Unregister the dynamic filter for testing purpose. The next time when this test is run for + * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries + * for this filter. + */ + if (H5Zunregister(FILTER1_ID) < 0) + TEST_ERROR; + + /*---------------------------------------------------------- + * STEP 3: Test filter plugin 2 by itself. + *---------------------------------------------------------- + */ + HDputs(" dataset writes with filter plugin 2"); + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) + TEST_ERROR; + if (H5Pset_filter(dcpl_id, FILTER2_ID, H5Z_FLAG_MANDATORY, 0, NULL) < 0) + TEST_ERROR; + + /* Ensure the filter works */ + if (ensure_filter_works(fid, DSET_FILTER2_NAME, dcpl_id) < 0) + TEST_ERROR; + + /* Clean up objects used for this test */ + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* Unregister the dynamic filter for testing purpose. The next time when this test is run for + * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries + * for this filter. + */ + if (H5Zunregister(FILTER2_ID) < 0) + TEST_ERROR; + + /*---------------------------------------------------------- + * STEP 4: Test filter plugin 3 by itself. + * (This filter plugin makes HDF5 API calls) + *---------------------------------------------------------- + */ + HDputs(" dataset writes with filter plugin 3"); + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) + TEST_ERROR; + + /* Set the add/subtract value for the filter */ + libver_values[0] = 9; + + /* Get the library bounds and add to the filter data */ + if (H5get_libversion(&libver_values[1], &libver_values[2], &libver_values[3]) < 0) + TEST_ERROR; + if (H5Pset_filter(dcpl_id, FILTER3_ID, H5Z_FLAG_MANDATORY, (size_t)4, libver_values) < 0) + TEST_ERROR; + + /* Ensure the filter works */ + if (ensure_filter_works(fid, DSET_FILTER3_NAME, dcpl_id) < 0) + TEST_ERROR; + + /* Clean up objects used for this test */ + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* Unregister the dynamic filter for testing purpose. The next time when this test is run for + * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries + * for this filter. + */ + if (H5Zunregister(FILTER3_ID) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + H5Pclose(dcpl_id); + } H5E_END_TRY + + return FAIL; +} /* end test_dataset_write_with_filters() */ + + +/*------------------------------------------------------------------------- + * Function: test_read_data + * + * Purpose: Tests reading data and compares values + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_read_data(hid_t did, int *origin_data) +{ + int **check = NULL; + int *data_p = origin_data; + size_t i, j; /* Local index variables */ + + if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0) + TEST_ERROR; + + /* Read the dataset back */ + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < sizes_g[0]; i++) + for(j = 0; j < sizes_g[1]; j++) { + if(*data_p != check[i][j]) + TEST_ERROR + data_p++; + } + + free_2D_array(&check); + + PASSED(); + + return SUCCEED; + +error: + free_2D_array(&check); + + return FAIL; +} /* end test_read_data() */ + + + +/*------------------------------------------------------------------------- + * Function: test_dataset_read_with_filters + * + * Purpose: Tests reading datasets created with dynamically-loaded + * filter plugins. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_dataset_read_with_filters(hid_t fid) +{ + hid_t did = -1; /* Dataset ID */ + + /*---------------------------------------------------------- + * STEP 1: Test deflation by itself. + *---------------------------------------------------------- + */ + TESTING("dataset read I/O with deflate filter"); + +#ifdef H5_HAVE_FILTER_DEFLATE + if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE) + TEST_ERROR; + + if ((did = H5Dopen2(fid, DSET_DEFLATE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (test_read_data(did, orig_deflate_g[0]) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + +#else /* H5_HAVE_FILTER_DEFLATE */ + SKIPPED(); + HDputs(" Deflate filter not enabled"); +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /*---------------------------------------------------------- + * STEP 2: Test filter plugin 1 by itself. + *---------------------------------------------------------- + */ + TESTING(" dataset reads with filter plugin 1"); + + if ((did = H5Dopen2(fid, DSET_FILTER1_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (test_read_data(did, orig_dynlib1_g[0]) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + + /*---------------------------------------------------------- + * STEP 3: Test filter plugin 2 by itself. + *---------------------------------------------------------- + */ + TESTING(" dataset reads with filter plugin 2"); + + if ((did = H5Dopen2(fid, DSET_FILTER2_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (test_read_data(did, orig_dynlib2_g[0]) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + + /*---------------------------------------------------------- + * STEP 4: Test filter plugin 3 by itself. + *---------------------------------------------------------- + */ + TESTING(" dataset reads with filter plugin 3"); + + if ((did = H5Dopen2(fid, DSET_FILTER3_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (test_read_data(did, orig_dynlib4_g[0]) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + H5Dclose(did); + } H5E_END_TRY + + return FAIL; +} /* end test_dataset_read_with_filters() */ + + +/*------------------------------------------------------------------------- + * Function: ensure_data_read_fails + * + * Purpose: Tests not reading data + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +ensure_data_read_fails(hid_t did) +{ + int **check = NULL; + herr_t ret = FAIL; + + if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0) + TEST_ERROR; + + /* Read the dataset back (should fail) */ + H5E_BEGIN_TRY { + ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check); + } H5E_END_TRY + if(ret >= 0) + TEST_ERROR; + + free_2D_array(&check); + + PASSED(); + + return SUCCEED; + +error: + free_2D_array(&check); + return FAIL; +} /* end ensure_data_read_fails() */ + + +/*------------------------------------------------------------------------- + * Function: test_no_read_when_plugins_disabled + * + * Purpose: Ensures we can't read data from a dataset that requires a + * filter located in a plugin. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_no_read_when_plugins_disabled(hid_t fid) +{ + hid_t did = -1; /* Dataset ID */ + unsigned plugin_flags; /* Plugin access flags */ + + TESTING("filter plugin 1 with filter plugins disabled"); + + /* Get the existing plugin flags */ + if (H5PLget_loading_state(&plugin_flags) < 0) + TEST_ERROR; + + /* Disable filter plugins and use the new flags */ + plugin_flags &= (unsigned)(~H5PL_FILTER_PLUGIN); + if (H5PLset_loading_state(plugin_flags) < 0) + TEST_ERROR; + + /* Open a dataset that requires a filter plugin to read the data */ + if ((did = H5Dopen2(fid, DSET_FILTER1_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Make sure we can't read the data */ + if (ensure_data_read_fails(did) < 0) + TEST_ERROR; + + /* Close down */ + if (H5Dclose(did) < 0) + TEST_ERROR; + + /* Re-enable filter plugins */ + plugin_flags |= (unsigned)H5PL_FILTER_PLUGIN; + if (H5PLset_loading_state(plugin_flags) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + plugin_flags |= (unsigned)H5PL_FILTER_PLUGIN; + H5PLset_loading_state(plugin_flags); + H5Dclose(did); + } H5E_END_TRY + + return FAIL; +} /* end test_no_read_when_plugins_disabled() */ + + +/*------------------------------------------------------------------------- + * Function: test_creating_groups_using_plugins + * + * Purpose: Tests creating group with dynamically loaded filters + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_creating_groups_using_plugins(hid_t fid) +{ + hid_t gcpl_id = -1; + hid_t gid = -1; + hid_t sub_gid = -1; + int i; + char subgroup_name[256]; + + TESTING("creating groups with filter plugin 4"); + + if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + TEST_ERROR; + + /* Use a filter plugin for creating groups */ + if (H5Pset_filter(gcpl_id, FILTER4_ID, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) + TEST_ERROR; + + /* Create a group using this filter */ + if ((gid = H5Gcreate2(fid, TOP_LEVEL_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create multiple groups under the top-level group */ + for (i = 0; i < N_SUBGROUPS; i++) { + char *sp = subgroup_name; + + sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX); + HDsprintf(sp, "%d", i); + + if ((sub_gid = H5Gcreate2(gid, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Gclose(sub_gid) < 0) + TEST_ERROR; + } + + /* Close everything */ + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Pclose(gcpl_id) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + H5Gclose(sub_gid); + H5Gclose(gid); + H5Pclose(gcpl_id); + } H5E_END_TRY + + return FAIL; +} /* end test_creating_groups_using_plugins() */ + + +/*------------------------------------------------------------------------- + * Function: test_opening_groups_using_plugins + * + * Purpose: Tests opening group with dynamically loaded filters + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_opening_groups_using_plugins(hid_t fid) +{ + hid_t gid = -1; + hid_t sub_gid = -1; + int i; + char subgroup_name[256]; + + TESTING("opening groups with filter plugin 4"); + + /* Open the top group */ + if ((gid = H5Gopen2(fid, TOP_LEVEL_GROUP_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Open all the sub-groups under the top-level group */ + for (i = 0; i < N_SUBGROUPS; i++) { + char *sp = subgroup_name; + + sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX); + HDsprintf(sp, "%d", i); + + if ((sub_gid = H5Gopen2(gid, subgroup_name, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Gclose(sub_gid) < 0) + TEST_ERROR; + } + + /* Close the top-level group */ + if (H5Gclose(gid) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + /* Clean up objects used for this test */ + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Gclose(sub_gid); + } H5E_END_TRY + + return FAIL; +} /* end test_opening_groups_using_plugins() */ + + + +/*------------------------------------------------------------------------- + * Function: test_path_api_calls + * + * Purpose: Tests the H5PL API calls that manipulate the plugin search + * paths. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_path_api_calls(void) +{ + unsigned int n_starting_paths; + unsigned int u; + unsigned int n_paths; + herr_t ret; + ssize_t path_len = -1; + char path[256]; + char temp_name[256]; + + HDputs("Testing access to the filter path table"); + + if (H5Zfilter_avail(FILTER1_ID) != TRUE) + TEST_ERROR; + + /* Set the number of paths to create for this test. + * + * This should be set high enough to ensure that at least one array + * expansion will take place. See H5PLpath.c for details. + */ + n_starting_paths = 42; + + /* Check that initialization is correct */ + TESTING(" initialize"); + + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != 2) + TEST_ERROR; + + PASSED(); + + /****************/ + /* H5PLremove() */ + /****************/ + + /* Remove all the current paths */ + TESTING(" remove"); + + /* Get the current size */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + + /* Remove all existing paths */ + for (u = n_paths; u > 0; u--) + if (H5PLremove(u-1) < 0) { + HDfprintf(stderr," at %u: %s\n", u, path); + TEST_ERROR; + } + + /* Verify the table is empty */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths > 0) + TEST_ERROR; + + PASSED(); + + + TESTING(" remove (index 0 in empty table)"); + + /* Try to remove index zero in an empty list (SHOULD FAIL) */ + H5E_BEGIN_TRY { + ret = H5PLremove(0); + } H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + + PASSED(); + + + /****************/ + /* H5PLappend() */ + /****************/ + + TESTING(" append"); + + /* Add a bunch of paths to the path table */ + for (u = 0; u < n_starting_paths; u++) { + HDsprintf(path, "a_path_%u", u); + if (H5PLappend(path) < 0) { + HDfprintf(stderr," at %u: %s\n", u, path); + TEST_ERROR; + } + } + + PASSED(); + + + /**********************/ + /* H5PLremove() again */ + /**********************/ + + TESTING(" remove (index too high)"); + + /* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */ + H5E_BEGIN_TRY { + ret = H5PLremove(n_starting_paths); + } H5E_END_TRY + + if (ret >= 0) + TEST_ERROR + + PASSED(); + + + /*************/ + /* H5PLget() */ + /*************/ + + TESTING(" get (path name)"); + + /* Get the path length by passing in NULL */ + if ((path_len = H5PLget(0, NULL, 0)) <= 0) { + HDfprintf(stderr," get path 0 length failed\n"); + TEST_ERROR; + } + if (path_len != 8) + TEST_ERROR; + + /* Get the path */ + if ((path_len = H5PLget(0, path, 256)) <= 0) { + HDfprintf(stderr," get 0 len: %u : %s\n", path_len, path); + TEST_ERROR; + } + if (HDstrcmp(path, "a_path_0") != 0) { + HDfprintf(stderr," get 0: %s\n", path); + TEST_ERROR; + } + + PASSED(); + + + TESTING(" get (high and low indices)"); + + /* Get path at index 1 */ + if ((path_len = H5PLget(1, path, 256)) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_1") != 0) { + HDfprintf(stderr," get 1: %s\n", path); + TEST_ERROR; + } + + /* Get path at the last index */ + if ((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0) + TEST_ERROR; + HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1); + if (HDstrcmp(path, temp_name) != 0) { + HDfprintf(stderr," get %u: %s\n", n_starting_paths - 1, path); + TEST_ERROR; + } + + PASSED(); + + + TESTING(" get (index too high)"); + + /* Get path at the last + 1 index (SHOULD FAIL) */ + H5E_BEGIN_TRY { + path_len = H5PLget(n_starting_paths, NULL, 0); + } H5E_END_TRY + if (path_len > 0) + TEST_ERROR; + + PASSED(); + + + /*****************/ + /* H5PLprepend() */ + /*****************/ + + /* We'll remove a path at an arbitrary index and then + * prepend a new path. + */ + + TESTING(" remove (arbitrary index 1)"); + + /* Remove one path */ + if (H5PLremove(8) < 0) + TEST_ERROR; + + /* Verify that the entries were moved */ + if ((path_len = H5PLget(8, path, 256)) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_9") != 0) { + HDfprintf(stderr," get 8: %s\n", path); + TEST_ERROR; + } + + /* Verify the table shrank */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != n_starting_paths - 1) + TEST_ERROR; + + PASSED(); + + + TESTING(" prepend"); + + /* Prepend one path */ + HDsprintf(path, "a_path_%d", n_starting_paths + 1); + if (H5PLprepend(path) < 0) { + HDfprintf(stderr," prepend %u: %s\n", n_starting_paths + 1, path); + TEST_ERROR; + } + + /* Verify the table increased */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != n_starting_paths) + TEST_ERROR; + + /* Verify that the entries were moved */ + if (H5PLget(8, path, 256) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_7") != 0) { + HDfprintf(stderr," get 8: %s\n", path); + TEST_ERROR; + } + + /* Verify that the path was inserted at index zero */ + if (H5PLget(0, path, 256) <= 0) + TEST_ERROR; + HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1); + if (HDstrcmp(path, temp_name) != 0) { + HDfprintf(stderr," get 0: %s\n", path); + TEST_ERROR; + } + + PASSED(); + + + /*****************/ + /* H5PLreplace() */ + /*****************/ + + TESTING(" replace"); + + /* Replace one path at index 1 */ + HDsprintf(path, "a_path_%u", n_starting_paths + 4); + if (H5PLreplace(path, 1) < 0) { + HDfprintf(stderr," replace 1: %s\n", path); + TEST_ERROR; + } + + /* Verify the table size remained the same */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != n_starting_paths) + TEST_ERROR; + + /* Verify that the entries were not moved by + * inspecting the paths at indices +/- 1. + */ + + /* Check path at index 0 */ + if (H5PLget(0, path, 256) <= 0) + TEST_ERROR; + HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1); + if (HDstrcmp(path, temp_name) != 0) { + HDfprintf(stderr," get 0: %s\n", path); + TEST_ERROR; + } + + /* Check path at index 2 */ + if (H5PLget(2, path, 256) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_1") != 0) { + HDfprintf(stderr," get 2: %s\n", path); + TEST_ERROR; + } + + PASSED(); + + + /****************/ + /* H5PLinsert() */ + /****************/ + + /* We'll remove a path at an arbitrary index and then + * insert a new path. + */ + + TESTING(" remove (arbitrary index 2)"); + + /* Remove one path */ + if (H5PLremove(4) < 0) + TEST_ERROR; + + /* Verify that the entries were moved */ + if (H5PLget(4, path, 256) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_4") != 0) { + HDfprintf(stderr," get 4: %s\n", path); + TEST_ERROR; + } + + /* Verify the table size */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != n_starting_paths - 1) + TEST_ERROR; + PASSED(); + + + TESTING(" insert"); + + /* Insert one path at index 3*/ + HDsprintf(path, "a_path_%d", n_starting_paths + 5); + if (H5PLinsert(path, 3) < 0) { + HDfprintf(stderr," insert 3: %s\n", path); + TEST_ERROR; + } + + /* Verify that the entries were moved */ + if (H5PLget(4, path, 256) <= 0) + TEST_ERROR; + if (HDstrcmp(path, "a_path_2") != 0) { + HDfprintf(stderr," get 4: %s\n", path); + TEST_ERROR; + } + + /* Verify the table size increased */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths != n_starting_paths) + TEST_ERROR; + + PASSED(); + + + /****************/ + /* H5PLremove() */ + /****************/ + + /* Remove all the current paths */ + TESTING(" remove (all)"); + + /* Get the current size */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + + /* Remove all existing paths */ + for (u = n_paths; u > 0; u--) + if (H5PLremove(u-1) < 0) { + HDfprintf(stderr," at %u: %s\n", u, path); + TEST_ERROR; + } + + /* Verify the table is empty */ + if (H5PLsize(&n_paths) < 0) + TEST_ERROR; + if (n_paths > 0) + TEST_ERROR; + + PASSED(); + + + return SUCCEED; + +error: + return FAIL; +} /* end test_path_api_calls() */ + + +/*------------------------------------------------------------------------- + * Function: disable_chunk_cache + * + * Purpose: Turns the chunk cache off + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +disable_chunk_cache(hid_t fapl_id) { + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; + + if (H5Pget_cache(fapl_id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) + TEST_ERROR; + rdcc_nbytes = 0; + if (H5Pset_cache(fapl_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) + TEST_ERROR; + + return SUCCEED; +error: + return FAIL; +} /* end disable_chunk_cache() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the plugin module (H5PL) + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t fid = -1; + hid_t old_ff_fapl_id = -1; + hid_t new_ff_fapl_id = -1; + unsigned new_format; + int nerrors = 0; + + /* Testing setup */ + h5_reset(); + + /*******************************************************************/ + /* ENSURE THAT WRITING TO DATASETS AND CREATING GROUPS WORKS */ + /*******************************************************************/ + + /* Get a VFD-dependent filename */ + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; + + /* Turn off the chunk cache, so all the chunks are immediately written to disk */ + if (disable_chunk_cache(old_ff_fapl_id) < 0) + TEST_ERROR; + + /* Copy the file access property list and set the latest file format on it */ + if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0) + TEST_ERROR; + if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Fix up the filename for the VFD */ + h5_fixname(FILENAME[0], old_ff_fapl_id, filename, sizeof(filename)); + + /* Test with old & new format groups */ + for (new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl_id; + + /* Set the FAPL for the type of format */ + if (new_format) { + HDputs("\nTesting with new file format:"); + my_fapl_id = new_ff_fapl_id; + } + else { + HDputs("Testing with old file format:"); + my_fapl_id = old_ff_fapl_id; + } + + /* Create the file for this test */ + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl_id)) < 0) + TEST_ERROR; + + /* Test creating datasets and writing to them using plugin filters */ + nerrors += (test_dataset_write_with_filters(fid) < 0 ? 1 : 0); + + /* Test creating groups using dynamically-loaded plugin filters */ + nerrors += (test_creating_groups_using_plugins(fid) < 0 ? 1 : 0); + + if (H5Fclose(fid) < 0) + TEST_ERROR; + } /* end for */ + + /* Close FAPLs */ + if (H5Pclose(old_ff_fapl_id) < 0) + TEST_ERROR; + if (H5Pclose(new_ff_fapl_id) < 0) + TEST_ERROR; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + /*******************************************************************/ + /* ENSURE THAT READING FROM DATASETS AND OPENING GROUPS WORKS */ + /*******************************************************************/ + + HDputs("\nTesting reading data with with dynamic plugin filters:"); + + /* Close the library so that all loaded plugin libraries are unloaded */ + h5_reset(); + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; + + /* Reopen the file for testing data reading */ + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0) + TEST_ERROR; + + /* Read the data with filters */ + nerrors += (test_dataset_read_with_filters(fid) < 0 ? 1 : 0); + + /* Test creating groups using dynamically-loaded plugin filters */ + nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + /*******************************************************************/ + /* ENSURE THAT DISABLING FILTER PLUGINS VIA THE FILTER FLAGS WORKS */ + /*******************************************************************/ + + /* Close the library so that all loaded plugin libraries are unloaded */ + h5_reset(); + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; + + /* Reopen the file for testing data reading */ + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0) + TEST_ERROR; + + /* When filters are disabled, make sure we can't read data from a + * dataset that requires a filter plugin. + */ + nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0); + + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /************************************/ + /* TEST THE FILTER PLUGIN API CALLS */ + /************************************/ + + /* Test the APIs for access to the filter plugin path table */ + nerrors += (test_path_api_calls() < 0 ? 1 : 0); + + /*********************/ + /* CLEAN UP AND EXIT */ + /*********************/ + + /* Free up saved arrays */ + free_2D_array(&orig_deflate_g); + free_2D_array(&orig_dynlib1_g); + free_2D_array(&orig_dynlib2_g); + free_2D_array(&orig_dynlib4_g); + + if (nerrors) + TEST_ERROR; + + HDprintf("All plugin tests passed.\n"); + h5_cleanup(FILENAME, old_ff_fapl_id); + + HDexit(EXIT_SUCCESS); + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Pclose(old_ff_fapl_id); + H5Pclose(new_ff_fapl_id); + } H5E_END_TRY + + /* Free up saved arrays (NULLs okay) */ + free_2D_array(&orig_deflate_g); + free_2D_array(&orig_dynlib1_g); + free_2D_array(&orig_dynlib2_g); + free_2D_array(&orig_dynlib4_g); + + nerrors = MAX(1, nerrors); + HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); + HDexit(EXIT_FAILURE); +} /* end main() */ + diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c new file mode 100644 index 0000000..b74e086 --- /dev/null +++ b/test/filter_plugin1_dsets.c @@ -0,0 +1,93 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test dataset filter plugin for the filter_pluging.c test. + */ + + +#include +#include + +#include "H5PLextern.h" + +#define FILTER1_ID 257 + +static size_t add_sub_value(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* Filter class struct */ +const H5Z_class2_t FILTER_INFO[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER1_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)add_sub_value, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return FILTER_INFO;} + + +/*------------------------------------------------------------------------- + * Function: add_sub_value + * + * Purpose: On write: + * Adds a caller-supplied value to the element + * On read: + * Subtracts a caller-supplied value from the element + * + * Return: Success: Data chunk size in bytes + * Failure: 0 + * + *------------------------------------------------------------------------- + */ +static size_t +add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, + size_t nbytes, size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + int value = 0; /* Data value to add/subtract */ + + /* Check for the correct number of parameters */ + if (0 == cd_nelmts) + return 0; + + /* Check that permanent parameters are set correctly */ + if (cd_values[0] > 9) + return 0; + + value = (int)cd_values[0]; + + if (flags & H5Z_FLAG_REVERSE) { + /* READ - Substract the given value from all the data values */ + while (buf_left > 0) { + *int_ptr++ -= value; + buf_left -= sizeof(int); + } + } + else { + /* WRITE - Add the given value to all the data values */ + while (buf_left > 0) { + *int_ptr++ += value; + buf_left -= sizeof(int); + } + } + + return nbytes; + +} /* end add_sub_value() */ + diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c new file mode 100644 index 0000000..6a79148 --- /dev/null +++ b/test/filter_plugin2_dsets.c @@ -0,0 +1,88 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test dataset filter plugin for the filter_pluging.c test. + */ + +#include +#include + +#include "H5PLextern.h" + +#define FILTER2_ID 258 +#define MULTIPLIER 3 + +static size_t mult_div_value(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* Filter class struct */ +const H5Z_class2_t FILTER_INFO[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER2_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)mult_div_value, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return FILTER_INFO;} + + +/*------------------------------------------------------------------------- + * Function: mult_div_value + * + * Purpose: On write: + * Multiplies an element by a constant value. + * On read: + * Divides an element by a constant value. + * + * Return: Success: Data chunk size in bytes + * Failure: 0 + * + *------------------------------------------------------------------------- + */ +static size_t +mult_div_value(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if (cd_nelmts > 0) + return 0; + + /* Assignment to eliminate unused parameter warning */ + cd_values = cd_values; + + if (flags & H5Z_FLAG_REVERSE) { + /* READ - Divide the original value by MULTIPLIER */ + while (buf_left > 0) { + *int_ptr++ /= MULTIPLIER; + buf_left -= sizeof(int); + } + } + else { + /* WRITE - Multiply the original value by MULTIPLIER */ + while (buf_left > 0) { + *int_ptr++ *= MULTIPLIER; + buf_left -= sizeof(int); + } + } + + return nbytes; +} /* end mult_div_value() */ + diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c new file mode 100644 index 0000000..b43020f --- /dev/null +++ b/test/filter_plugin3_dsets.c @@ -0,0 +1,119 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test dataset filter plugin for the filter_pluging.c test. + * This filter makes an HDF5 API call to ensure that works correctly. + */ + +#include +#include + +#include "H5PLextern.h" + +#define FILTER3_ID 259 + +#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str) + +static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* Filter class struct */ +const H5Z_class2_t FILTER_INFO[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER3_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 3", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return FILTER_INFO;} + + +/*------------------------------------------------------------------------- + * Function: add_sub_value_hdf5 + * + * Purpose: On write: + * Adds a caller-supplied value to the element + * On read: + * Subtracts a caller-supplied value from the element + * + * NOTE: This filter is identical to filter #1 only it makes + * an HDF5 library call to ensure doing that doesn't + * cause problems. + * + * Return: Success: Data chunk size in bytes + * Failure: 0 + * + *------------------------------------------------------------------------- + */ +static size_t +add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, + size_t nbytes, size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + int value = 0; /* Data value to add/subtract */ + unsigned majnum = 0; /* Output data from the HDF5 library call */ + unsigned minnum = 0; + unsigned relnum = 0; + + /* Check for the library version. + * We don't do anything with this information - it's just to ensure that + * HDF5 library calls work properly from inside filter plugins. + */ + if (H5get_libversion(&majnum, &minnum, &relnum) < 0) { + PUSH_ERR("filter plugin 3", H5E_CALLBACK, "H5get_libversion"); + return 0; + } + + /* Check for the correct number of parameters */ + if (cd_nelmts == 0) + return 0; + + /* Check that permanent parameters are set correctly */ + if (cd_values[0] > 9) + return 0; + + /* Ensure that the version numbers match what was passed in. + * Again, this is trivial work, just to ensure that the library calls are + * working properly. + */ + if (majnum != cd_values[1] || minnum != cd_values[2]) { + PUSH_ERR("filter plugin 3", H5E_CALLBACK, "library versions do not match"); + return 0; + } + + value = (int)cd_values[0]; + + if (flags & H5Z_FLAG_REVERSE) { + /* READ - Substract the given value from all the data values */ + while (buf_left > 0) { + *int_ptr++ -= value; + buf_left -= sizeof(int); + } + } + else { + /* WRITE - Add the given value to all the data values */ + while (buf_left > 0) { + *int_ptr++ += value; + buf_left -= sizeof(int); + } + } + + return nbytes; +} /* end add_sub_value_hdf5() */ + diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c new file mode 100644 index 0000000..88ea20d --- /dev/null +++ b/test/filter_plugin4_groups.c @@ -0,0 +1,106 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test group filter plugin for the filter_pluging.c test. + */ + +#include +#include +#include + +#include "H5PLextern.h" + +#define FILTER4_ID 260 +#define SUFFIX_LEN 8 +#define GROUP_SUFFIX ".h5group" + +static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* Filter class struct */ +const H5Z_class2_t FILTER_INFO[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER4_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)append_to_group_name, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return FILTER_INFO;} + + +/*------------------------------------------------------------------------- + * Function: append_to_group_name + * + * Purpose: On write: + * Appends the suffix ".h5group" to the group name + * On read: + * Removes the ".h5group" suffix from the group name + * + * Return: Success: Data size in bytes + * Failure: 0 + * + *------------------------------------------------------------------------- + */ +static size_t +append_to_group_name(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) +{ + size_t new_name_size = 0; /* Return value */ + + /* Check for the correct number of parameters */ + if (cd_nelmts > 0) + return 0; + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if (flags & H5Z_FLAG_REVERSE) { + /* READ - Remove the suffix from the group name */ + new_name_size = *buf_size = nbytes - SUFFIX_LEN; + } + else { + /* WRITE - Append the suffix to the group name */ + void *outbuf = NULL; /* Pointer to new buffer */ + unsigned char *dst = NULL; /* Temporary pointer to destination buffer */ + + /* Get memory for the new, larger string buffer using the + * library's memory allocator. + */ + if (NULL == (dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0)))) + return 0; + + /* Copy raw data */ + memcpy((void *)dst, (const void *)(*buf), nbytes); + + /* Append suffix to raw data for storage */ + dst += nbytes; + memcpy((void *)dst, (const void *)GROUP_SUFFIX, SUFFIX_LEN); + + /* Free the passed-in buffer using the library's allocator */ + H5free_memory(*buf); + + /* Set return values */ + *buf_size = nbytes + SUFFIX_LEN; + *buf = outbuf; + outbuf = NULL; + new_name_size = *buf_size; + } + + return new_name_size; +} /* append_to_group_name() */ + diff --git a/test/plugin.c b/test/plugin.c deleted file mode 100644 index ea199f6..0000000 --- a/test/plugin.c +++ /dev/null @@ -1,1217 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Purpose: Tests the plugin module (H5PL) - */ - -#include "h5test.h" -#include "H5srcdir.h" - -/* - * This file needs to access private datatypes from the H5Z and H5PL package. - */ -#define H5PL_FRIEND -#include "H5PLpkg.h" -#define H5Z_FRIEND -#include "H5Zpkg.h" - -/* Filters for HDF5 internal test */ -#define H5Z_FILTER_DYNLIB1 257 -#define H5Z_FILTER_DYNLIB2 258 -#define H5Z_FILTER_DYNLIB3 259 -#define H5Z_FILTER_DYNLIB4 260 - -const char *FILENAME[] = { - "plugin", - NULL -}; -#define FILENAME_BUF_SIZE 1024 - -/* Dataset names for testing filters */ -#define DSET_DEFLATE_NAME "deflate" -#define DSET_DYNLIB1_NAME "dynlib1" -#define DSET_DYNLIB2_NAME "dynlib2" -#define DSET_DYNLIB4_NAME "dynlib4" - -/* Parameters for internal filter test */ -#define FILTER_CHUNK_DIM1 2 -#define FILTER_CHUNK_DIM2 25 -#define FILTER_HS_OFFSET1 7 -#define FILTER_HS_OFFSET2 30 -#define FILTER_HS_SIZE1 4 -#define FILTER_HS_SIZE2 50 - -/* Shared global arrays */ -#define DSET_DIM1 100 -#define DSET_DIM2 200 - -/* Limit random number within 20000 */ -#define RANDOM_LIMIT 20000 - -#define GROUP_ITERATION 1000 - -int points_deflate[DSET_DIM1][DSET_DIM2], - points_dynlib1[DSET_DIM1][DSET_DIM2], - points_dynlib2[DSET_DIM1][DSET_DIM2], - points_dynlib4[DSET_DIM1][DSET_DIM2], - points_bzip2[DSET_DIM1][DSET_DIM2]; - - -/*------------------------------------------------------------------------- - * Function: test_filter_internal - * - * Purpose: Tests writing entire data and partial data with filters - * - * Return: Success: 0 - * Failure: -1 - *------------------------------------------------------------------------- - */ -static herr_t -test_filter_internal(hid_t fid, const char *name, hid_t dcpl) -{ - herr_t ret_value = -1; - hid_t dataset = -1; /* Dataset ID */ - hid_t dxpl = -1; /* Dataset xfer property list ID */ - hid_t write_dxpl = -1; /* Dataset xfer property list ID for writing */ - hid_t sid = -1; /* Dataspace ID */ - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ - const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ - const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ - void *tconv_buf = NULL; /* Temporary conversion buffer */ - int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; - size_t i, j; /* Local index variables */ - int n = 0; - - /* Create the data space */ - if((sid = H5Screate_simple(2, size, NULL)) < 0) TEST_ERROR - - /* - * Create a small conversion buffer to test strip mining. We - * might as well test all we can! - */ - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR - tconv_buf = HDmalloc((size_t)1000); - if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) TEST_ERROR - if((write_dxpl = H5Pcopy(dxpl)) < 0) TEST_ERROR; - - TESTING(" filters (setup)"); - - /* Check if all the filters are available */ - if(H5Pall_filters_avail(dcpl) != TRUE) { - H5_FAILED(); - HDprintf(" Line %d: Incorrect filter availability\n", __LINE__); - TEST_ERROR - } /* end if */ - - /* Create the dataset */ - if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR - - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 1: Read uninitialized data. It should be zero. - *---------------------------------------------------------------------- - */ - TESTING(" filters (uninitialized read)"); - - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR; - - for(i=0; i<(size_t)size[0]; i++) - for(j=0; j<(size_t)size[1]; j++) - if(0 != check[i][j]) { - H5_FAILED(); - HDprintf(" Read a non-zero value.\n"); - HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); - TEST_ERROR - } /* end if */ - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 2: Test filters by setting up a chunked dataset and writing - * to it. - *---------------------------------------------------------------------- - */ - TESTING(" filters (write)"); - - n = 0; - for(i=0; i= 0) - TEST_ERROR - - PASSED(); - ret_value = 0; - -error: - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: test_noread_with_filters - * - * Purpose: Tests reading dataset created with dynamically loaded filters disabled - * - * Return: Success: 0 - * Failure: -1 - *------------------------------------------------------------------------- - */ -static herr_t -test_noread_with_filters(hid_t file) -{ - herr_t ret_value = -1; - hid_t dset = -1; /* Dataset ID */ - unsigned plugin_state; /* status of plugins */ - - TESTING("DYNLIB1 filter with plugins disabled"); - - /* disable filter plugin */ - if(H5PLget_loading_state(&plugin_state) < 0) TEST_ERROR - - plugin_state = plugin_state & (unsigned)(~H5PL_FILTER_PLUGIN); - - if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR - - if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR - - if(test_noread_data(dset) < 0) TEST_ERROR - - if(H5Dclose(dset) < 0) TEST_ERROR - - ret_value = 0; - -error: - /* re-enable filter plugin */ - plugin_state = plugin_state | H5PL_FILTER_PLUGIN; - H5PLset_loading_state(plugin_state); - - /* Clean up objects used for this test */ - H5E_BEGIN_TRY { - H5Dclose(dset); - } H5E_END_TRY - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: test_filters_for_groups - * - * Purpose: Tests creating group with dynamically loaded filters - * - * Return: Success: 0 - * Failure: -1 - *------------------------------------------------------------------------- - */ -static herr_t -test_filters_for_groups(hid_t file) -{ - herr_t ret_value = -1; - hid_t gcpl = -1; - hid_t gid = -1; - hid_t group = -1; - int i; - char gname[256]; - - TESTING("DYNLIB3 filter for group"); - - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - - /* Use DYNLIB3 for creating groups */ - if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) TEST_ERROR - - /* Create a group using this filter */ - if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create multiple groups under "group1" */ - for(i=0; i < GROUP_ITERATION; i++) { - HDsprintf(gname, "group_%d", i); - if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group) < 0) TEST_ERROR - } - - /* Close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Clean up objects used for this test */ - if(H5Pclose(gcpl) < 0) TEST_ERROR - - PASSED(); - - ret_value = 0; - -error: - /* Clean up objects used for this test */ - H5E_BEGIN_TRY { - H5Gclose(group); - H5Gclose(gid); - H5Pclose(gcpl); - } H5E_END_TRY - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: test_groups_with_filters - * - * Purpose: Tests opening group with dynamically loaded filters - * - * Return: Success: 0 - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static herr_t -test_groups_with_filters(hid_t file) -{ - herr_t ret_value = -1; - hid_t gid = -1; - hid_t group = -1; - int i; - char gname[256]; - - TESTING("opening groups with DYNLIB3 filter"); - - /* Open the top group */ - if((gid = H5Gopen2(file, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create multiple groups under "group1" */ - for(i=0; i < GROUP_ITERATION; i++) { - HDsprintf(gname, "group_%d", i); - if((group = H5Gopen2(gid, gname, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group) < 0) TEST_ERROR - } - - /* Close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR - - PASSED(); - - ret_value = 0; - -error: - /* Clean up objects used for this test */ - H5E_BEGIN_TRY { - H5Gclose(group); - H5Gclose(gid); - } H5E_END_TRY - - return ret_value; -} - - -/*------------------------------------------------------------------------- - * Function: test_path_api_calls - * - * Purpose: Tests the H5PL API calls that manipulate the plugin search - * paths. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -test_path_api_calls(void) -{ - unsigned int n_starting_paths; - unsigned int u; - unsigned int n_paths; - herr_t ret; - ssize_t path_len = -1; - char path[256]; - char temp_name[256]; - - HDputs("Testing access to the filter path table"); - - if(H5Zfilter_avail(H5Z_FILTER_DYNLIB1) != TRUE) - TEST_ERROR - - /* Set the number of paths to create for this test. - * - * This should be set high enough to ensure that at least one array - * expansion will take place. See H5PLpath.c for details. - */ - n_starting_paths = 42; - - /* Check that initialization is correct */ - TESTING(" initialize"); - - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != 2) - TEST_ERROR - - PASSED(); - - /****************/ - /* H5PLremove() */ - /****************/ - - /* Remove all the current paths */ - TESTING(" remove"); - - /* Get the current size */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - - /* Remove all existing paths */ - for(u = n_paths; u > 0; u--) - if(H5PLremove(u-1) < 0) { - HDfprintf(stderr," at %u: %s\n", u, path); - TEST_ERROR - } - - /* Verify the table is empty */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths > 0) - TEST_ERROR - - PASSED(); - - - TESTING(" remove (index 0 in empty table)"); - - /* Try to remove index zero in an empty list (SHOULD FAIL) */ - H5E_BEGIN_TRY { - ret = H5PLremove(0); - } H5E_END_TRY - if(ret >= 0) - TEST_ERROR - - PASSED(); - - - /****************/ - /* H5PLappend() */ - /****************/ - - TESTING(" append"); - - /* Add a bunch of paths to the path table */ - for(u = 0; u < n_starting_paths; u++) { - HDsprintf(path, "a_path_%u", u); - if(H5PLappend(path) < 0) { - HDfprintf(stderr," at %u: %s\n", u, path); - TEST_ERROR - } - } - - PASSED(); - - - /**********************/ - /* H5PLremove() again */ - /**********************/ - - TESTING(" remove (index too high)"); - - /* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */ - H5E_BEGIN_TRY { - ret = H5PLremove(n_starting_paths); - } H5E_END_TRY - - if(ret >= 0) - TEST_ERROR - - PASSED(); - - - /*************/ - /* H5PLget() */ - /*************/ - - TESTING(" get (path name)"); - - /* Get the path length by passing in NULL */ - if((path_len = H5PLget(0, NULL, 0)) <= 0) { - HDfprintf(stderr," get path 0 length failed\n"); - TEST_ERROR - } - if(path_len != 8) - TEST_ERROR - - /* Get the path */ - if((path_len = H5PLget(0, path, 256)) <= 0) { - HDfprintf(stderr," get 0 len: %u : %s\n", path_len, path); - TEST_ERROR - } - if(HDstrcmp(path, "a_path_0") != 0) { - HDfprintf(stderr," get 0: %s\n", path); - TEST_ERROR - } - - PASSED(); - - - TESTING(" get (high and low indices)"); - - /* Get path at index 1 */ - if((path_len = H5PLget(1, path, 256)) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_1") != 0) { - HDfprintf(stderr," get 1: %s\n", path); - TEST_ERROR - } - - /* Get path at the last index */ - if((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0) - TEST_ERROR - HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1); - if(HDstrcmp(path, temp_name) != 0) { - HDfprintf(stderr," get %u: %s\n", n_starting_paths - 1, path); - TEST_ERROR - } - - PASSED(); - - - TESTING(" get (index too high)"); - - /* Get path at the last + 1 index (SHOULD FAIL) */ - H5E_BEGIN_TRY { - path_len = H5PLget(n_starting_paths, NULL, 0); - } H5E_END_TRY - if(path_len > 0) - TEST_ERROR - - PASSED(); - - - /*****************/ - /* H5PLprepend() */ - /*****************/ - - /* We'll remove a path at an arbitrary index and then - * prepend a new path. - */ - - TESTING(" remove (arbitrary index 1)"); - - /* Remove one path */ - if(H5PLremove(8) < 0) - TEST_ERROR - - /* Verify that the entries were moved */ - if((path_len = H5PLget(8, path, 256)) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_9") != 0) { - HDfprintf(stderr," get 8: %s\n", path); - TEST_ERROR - } - - /* Verify the table shrank */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != n_starting_paths - 1) - TEST_ERROR - - PASSED(); - - - TESTING(" prepend"); - - /* Prepend one path */ - HDsprintf(path, "a_path_%d", n_starting_paths + 1); - if(H5PLprepend(path) < 0) { - HDfprintf(stderr," prepend %u: %s\n", n_starting_paths + 1, path); - TEST_ERROR - } - - /* Verify the table increased */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != n_starting_paths) - TEST_ERROR - - /* Verify that the entries were moved */ - if(H5PLget(8, path, 256) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_7") != 0) { - HDfprintf(stderr," get 8: %s\n", path); - TEST_ERROR - } - - /* Verify that the path was inserted at index zero */ - if(H5PLget(0, path, 256) <= 0) - TEST_ERROR - HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1); - if(HDstrcmp(path, temp_name) != 0) { - HDfprintf(stderr," get 0: %s\n", path); - TEST_ERROR - } - - PASSED(); - - - /*****************/ - /* H5PLreplace() */ - /*****************/ - - TESTING(" replace"); - - /* Replace one path at index 1 */ - HDsprintf(path, "a_path_%u", n_starting_paths + 4); - if(H5PLreplace(path, 1) < 0) { - HDfprintf(stderr," replace 1: %s\n", path); - TEST_ERROR - } - - /* Verify the table size remained the same */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != n_starting_paths) - TEST_ERROR - - /* Verify that the entries were not moved by - * inspecting the paths at indices +/- 1. - */ - - /* Check path at index 0 */ - if(H5PLget(0, path, 256) <= 0) - TEST_ERROR - HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1); - if(HDstrcmp(path, temp_name) != 0) { - HDfprintf(stderr," get 0: %s\n", path); - TEST_ERROR - } - - /* Check path at index 2 */ - if(H5PLget(2, path, 256) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_1") != 0) { - HDfprintf(stderr," get 2: %s\n", path); - TEST_ERROR - } - - PASSED(); - - - /****************/ - /* H5PLinsert() */ - /****************/ - - /* We'll remove a path at an arbitrary index and then - * insert a new path. - */ - - TESTING(" remove (arbitrary index 2)"); - - /* Remove one path */ - if(H5PLremove(4) < 0) - TEST_ERROR - - /* Verify that the entries were moved */ - if(H5PLget(4, path, 256) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_4") != 0) { - HDfprintf(stderr," get 4: %s\n", path); - TEST_ERROR - } - - /* Verify the table size */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != n_starting_paths - 1) - TEST_ERROR - PASSED(); - - - TESTING(" insert"); - - /* Insert one path at index 3*/ - HDsprintf(path, "a_path_%d", n_starting_paths + 5); - if(H5PLinsert(path, 3) < 0) { - HDfprintf(stderr," insert 3: %s\n", path); - TEST_ERROR - } - - /* Verify that the entries were moved */ - if(H5PLget(4, path, 256) <= 0) - TEST_ERROR - if(HDstrcmp(path, "a_path_2") != 0) { - HDfprintf(stderr," get 4: %s\n", path); - TEST_ERROR - } - - /* Verify the table size increased */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths != n_starting_paths) - TEST_ERROR - - PASSED(); - - - /****************/ - /* H5PLremove() */ - /****************/ - - /* Remove all the current paths */ - TESTING(" remove (all)"); - - /* Get the current size */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - - /* Remove all existing paths */ - for(u = n_paths; u > 0; u--) - if(H5PLremove(u-1) < 0) { - HDfprintf(stderr," at %u: %s\n", u, path); - TEST_ERROR - } - - /* Verify the table is empty */ - if(H5PLsize(&n_paths) < 0) - TEST_ERROR - if(n_paths > 0) - TEST_ERROR - - PASSED(); - - - return SUCCEED; - -error: - return FAIL; -} /* end test_path_api_calls() */ - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests the plugin module (H5PL) - * - * Return: EXIT_SUCCESS/EXIT_FAILURE - * - *------------------------------------------------------------------------- - */ -int -main(void) -{ - char filename[FILENAME_BUF_SIZE]; - hid_t file = -1; - hid_t fapl = -1; - hid_t fapl2 = -1; - unsigned new_format; - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - int nerrors = 0; - - /* Testing setup */ - h5_reset(); - - if ((fapl = h5_fileaccess()) < 0) - TEST_ERROR - - /* Turn off the chunk cache, so all the chunks are immediately written to disk */ - if (H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - TEST_ERROR - rdcc_nbytes = 0; - if (H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - TEST_ERROR - - /* Copy the file access property list */ - if ((fapl2 = H5Pcopy(fapl)) < 0) - TEST_ERROR - - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - TEST_ERROR - - h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); - - /* Test with old & new format groups */ - for (new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; - - /* Set the FAPL for the type of format */ - if (new_format) { - HDputs("\nTesting with new file format:"); - my_fapl = fapl2; - } - else { - HDputs("Testing with old file format:"); - my_fapl = fapl; - } - - /* Create the file for this test */ - if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - - /* Test dynamically loaded filters for chunked dataset */ - nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0); - - /* Test dynamically loaded filters for groups */ - nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0); - - if (H5Fclose(file) < 0) - TEST_ERROR - } /* end for */ - - /* Close FAPL */ - if (H5Pclose(fapl2) < 0) - TEST_ERROR - if (H5Pclose(fapl) < 0) - TEST_ERROR - - /* Restore the default error handler (set in h5_reset()) */ - h5_restore_err(); - - HDputs("\nTesting reading data with with dynamic plugin filters:"); - - /* Close the library so that all loaded plugin libraries are unloaded */ - h5_reset(); - if ((fapl = h5_fileaccess()) < 0) - TEST_ERROR - - /* Reopen the file for testing data reading */ - if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - - /* Read the data with filters */ - nerrors += (test_read_with_filters(file) < 0 ? 1 : 0); - - /* Open the groups with filters */ - nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); - - /* Restore the default error handler (set in h5_reset()) */ - h5_restore_err(); - - /* Close the library so that all loaded plugin libraries are unloaded */ - h5_reset(); - if ((fapl = h5_fileaccess()) < 0) - TEST_ERROR - - /* Reopen the file for testing data reading */ - if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - - /* Read the data with disabled filters */ - nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0); - - if (H5Fclose(file) < 0) - TEST_ERROR - - /* Test the APIs for access to the filter plugin path table */ - nerrors += (test_path_api_calls() < 0 ? 1 : 0); - - if (nerrors) - TEST_ERROR - - HDprintf("All plugin tests passed.\n"); - h5_cleanup(FILENAME, fapl); - - HDexit(EXIT_SUCCESS); - -error: - nerrors = MAX(1, nerrors); - HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - HDexit(EXIT_FAILURE); -} /* end main() */ - diff --git a/test/test_filter_plugin.sh.in b/test/test_filter_plugin.sh.in new file mode 100644 index 0000000..0a45c0f --- /dev/null +++ b/test/test_filter_plugin.sh.in @@ -0,0 +1,113 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine if backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +nerrors=0 +verbose=yes +exit_code=$EXIT_SUCCESS + +TEST_NAME=filter_plugin +TEST_BIN=`pwd`/$TEST_NAME +FROM_DIR=`pwd`/.libs +case $(uname) in + CYGWIN* ) + PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*" + PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*" + ;; + *) + PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*" + PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*" + ;; +esac +PLUGIN_DIR1=filter_plugin_dir1 +PLUGIN_DIR2=filter_plugin_dir2 +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +RM="rm -rf" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Main Body +# Create test directories if necessary. +test -d $PLUGIN_DIR1 || mkdir -p $PLUGIN_DIR1 +if [ $? != 0 ]; then + echo "Failed to create filter plugin test directory ($PLUGIN_DIR1)" + exit $EXIT_FAILURE +fi + +test -d $PLUGIN_DIR2 || mkdir -p $PLUGIN_DIR2 +if [ $? != 0 ]; then + echo "Failed to create filter plugin test directory ($PLUGIN_DIR2)" + exit $EXIT_FAILURE +fi + +# Copy plugins for the tests. +$CP $PLUGINS_FOR_DIR1 $PLUGIN_DIR1 +if [ $? != 0 ]; then + echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory." + exit $EXIT_FAILURE +fi + +$CP $PLUGINS_FOR_DIR2 $PLUGIN_DIR2 +if [ $? != 0 ]; then + echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_DIR1}:${PLUGIN_DIR2}" + +# Run the test +$ENVCMD $TEST_BIN +if [ $? != 0 ]; then + nerrors=`expr $nerrors + 1` +fi + +############################################ +# HDFFV-9655 test for relative path disabled +# setup filter plugin path relative to test +# actual executable is in the .libs folder +#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_DIR1}:@/../${PLUGIN_DIR2}" +# +# Run the test +#$ENVCMD $TEST_BIN +#if [ $? != 0 ]; then +# nerrors=`expr $nerrors + 1` +#fi +############################################# + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All filter plugin tests passed." + exit_code=$EXIT_SUCCESS +fi + +# Clean up temporary files/directories and leave +$RM $PLUGIN_DIR1 $PLUGIN_DIR2 + +exit $exit_code diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in deleted file mode 100644 index c90a978..0000000 --- a/test/test_plugin.sh.in +++ /dev/null @@ -1,113 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -srcdir=@srcdir@ -TOP_BUILDDIR=@top_builddir@ - -# Determine backward compatibility options enabled -DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -nerrors=0 -verbose=yes -exit_code=$EXIT_SUCCESS - -TEST_NAME=plugin -TEST_BIN=`pwd`/$TEST_NAME -FROM_DIR=`pwd`/.libs -case $(uname) in - CYGWIN* ) - PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*" - PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*" - ;; - *) - PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*" - PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*" - ;; -esac -PLUGIN_LIBDIR1=testdir1 -PLUGIN_LIBDIR2=testdir2 -CP="cp -p" # Use -p to preserve mode,ownership,timestamps -RM="rm -rf" - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Main Body -# Create test directories if not exists yet. -test -d $PLUGIN_LIBDIR1 || mkdir -p $PLUGIN_LIBDIR1 -if [ $? != 0 ]; then - echo "Failed to create test directory($PLUGIN_LIBDIR1)" - exit $EXIT_FAILURE -fi - -test -d $PLUGIN_LIBDIR2 || mkdir -p $PLUGIN_LIBDIR2 -if [ $? != 0 ]; then - echo "Failed to create test directory($PLUGIN_LIBDIR2)" - exit $EXIT_FAILURE -fi - -# copy plugin library for test -$CP $PLUGIN_LIB1 $PLUGIN_LIBDIR1 -if [ $? != 0 ]; then - echo "Failed to copy plugin library ($PLUGIN_LIB1) for test." - exit $EXIT_FAILURE -fi - -$CP $PLUGIN_LIB2 $PLUGIN_LIBDIR2 -if [ $? != 0 ]; then - echo "Failed to copy plugin library ($PLUGIN_LIB2) for test." - exit $EXIT_FAILURE -fi - -# setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR1}:${PLUGIN_LIBDIR2}" - -# Run the test -$ENVCMD $TEST_BIN -if [ $? != 0 ]; then - nerrors=`expr $nerrors + 1` -fi - -############################################ -# HDFFV-9655 test for relative path disabled -# setup plugin path relative to test -# actual executable is in the .libs folder -#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_LIBDIR1}:@/../${PLUGIN_LIBDIR2}" -# -# Run the test -#$ENVCMD $TEST_BIN -#if [ $? != 0 ]; then -# nerrors=`expr $nerrors + 1` -#fi -############################################# - -# print results -if test $nerrors -ne 0 ; then - echo "$nerrors errors encountered" - exit_code=$EXIT_FAILURE -else - echo "All Plugin API tests passed." - exit_code=$EXIT_SUCCESS -fi - -# Clean up temporary files/directories and leave -$RM $PLUGIN_LIBDIR1 $PLUGIN_LIBDIR2 - -exit $exit_code diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am index d2b5ebb..4d43a2a 100644 --- a/tools/test/h5diff/Makefile.am +++ b/tools/test/h5diff/Makefile.am @@ -53,9 +53,6 @@ if HAVE_SHARED_CONDITIONAL noinst_LTLIBRARIES=libdynlibdiff.la libdynlibdiff_la_SOURCES=dynlib_diff.c libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - - libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlibdiff_la_LINK) $(am_libdynlibdiff_la_rpath) $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_LIBADD) endif # Temporary files. *.h5 are generated by h5diff. They should diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am index 1454987..be21119 100644 --- a/tools/test/h5dump/Makefile.am +++ b/tools/test/h5dump/Makefile.am @@ -42,9 +42,6 @@ if HAVE_SHARED_CONDITIONAL noinst_LTLIBRARIES=libdynlibdump.la libdynlibdump_la_SOURCES=dynlib_dump.c libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - - libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlibdump_la_LINK) $(am_libdynlibdump_la_rpath) $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_LIBADD) endif # Temporary files. *.h5 are generated by h5dumpgentest. They should diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am index ec8b8c3..a49c2e8 100644 --- a/tools/test/h5ls/Makefile.am +++ b/tools/test/h5ls/Makefile.am @@ -39,9 +39,6 @@ if HAVE_SHARED_CONDITIONAL noinst_LTLIBRARIES=libdynlibls.la libdynlibls_la_SOURCES=dynlib_ls.c libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - - libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD) endif diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am index d4dc843..fbe88bd 100644 --- a/tools/test/h5repack/Makefile.am +++ b/tools/test/h5repack/Makefile.am @@ -50,11 +50,6 @@ if HAVE_SHARED_CONDITIONAL libdynlibvers_la_SOURCES=dynlib_vrpk.c libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - - libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlibadd_la_LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD) - libdynlibvers.la: $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_DEPENDENCIES) $(EXTRA_libdynlibvers_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdynlibvers_la_LINK) $(am_libdynlibvers_la_rpath) $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_LIBADD) endif -- cgit v0.12 From 3e4f6138b60d8363c377e453d63f875775ec907a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Nov 2017 13:56:58 -0800 Subject: Removed asserts from H5MM calls that conflict with stated behavior and added a test to ensure that this doesn't happen in the future. --- src/H5MM.c | 8 +------- test/tmisc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index ee3b28f..866dfbe 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -268,8 +268,6 @@ H5MM_malloc(size_t size) { void *ret_value = NULL; - HDassert(size); - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -357,8 +355,6 @@ H5MM_calloc(size_t size) { void *ret_value = NULL; - HDassert(size); - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -407,8 +403,6 @@ H5MM_realloc(void *mem, size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(mem || size); - if(NULL == mem && 0 == size) /* Not defined in the standard, return NULL */ ret_value = NULL; @@ -454,7 +448,7 @@ H5MM_realloc(void *mem, size_t size) * NULL is an acceptable value for the input string. * * Return: Success: Pointer to a new string (NULL if s is NULL). - * Failure: abort() + * Failure: NULL * * Programmer: Robb Matzke * Jul 10 1997 diff --git a/test/tmisc.c b/test/tmisc.c index 102325a..6da4589 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -30,6 +30,7 @@ #include "testhdf5.h" #include "H5srcdir.h" #include "H5Dpkg.h" /* Datasets */ +#include "H5MMprivate.h" /* Memory */ /* Definitions for misc. test #1 */ #define MISC1_FILE "tmisc1.h5" @@ -5526,6 +5527,64 @@ test_misc33(void) } /* end test_misc33() */ +/**************************************************************** +** +** test_misc34(): Ensure zero-size memory allocations work +** +****************************************************************/ +static void +test_misc34(void) +{ + void *mem = NULL; /* allocated buffer */ + char *dup = NULL; /* 'duplicated' string */ + size_t sz = 0; /* buffer size */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing O and NULL behavior in H5MM API calls")); + + /* H5MM_xfree(): Ensure that passing NULL is allowed and returns NULL */ + mem = H5MM_xfree(mem); + CHECK_PTR_NULL(mem, "H5MM_xfree"); + + /* H5MM_malloc(): Ensure that size 0 returns NULL */ + mem = H5MM_malloc(sz); + CHECK_PTR_NULL(mem, "H5MM_malloc"); + mem = H5MM_xfree(mem); + + /* H5MM_calloc(): Ensure that size 0 returns NULL */ + mem = H5MM_calloc(sz); + CHECK_PTR_NULL(mem, "H5MM_calloc"); + mem = H5MM_xfree(mem); + + /* H5MM_realloc(): Check behavior: + * + * H5MM_realloc(NULL, size) <==> H5MM_malloc(size) + * H5MM_realloc(ptr, 0) <==> H5MM_xfree(ptr) + * H5MM_realloc(NULL, 0) <==> NULL + */ + mem = H5MM_xfree(mem); + + sz = 1024; + mem = H5MM_realloc(mem, sz); + CHECK_PTR(mem, "H5MM_realloc (case 1)"); + /* Don't free mem here! */ + + sz = 0; + mem = H5MM_realloc(mem, sz); + CHECK_PTR_NULL(mem, "H5MM_realloc (case 2)"); + mem = H5MM_xfree(mem); + + mem = H5MM_realloc(mem, sz); + CHECK_PTR_NULL(mem, "H5MM_realloc (case 3)"); + mem = H5MM_xfree(mem); + + /* H5MM_xstrdup(): Ensure NULL returns NULL */ + dup = H5MM_xstrdup((const char *)mem); + CHECK_PTR_NULL(dup, "H5MM_xstrdup"); + dup = (char *)H5MM_xfree((void *)dup); + +} /* end test_misc34() */ + /**************************************************************** ** @@ -5575,6 +5634,7 @@ test_misc(void) test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ test_misc32(); /* Test filter memory allocation functions */ test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ + test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ } /* test_misc() */ @@ -5632,5 +5692,5 @@ cleanup_misc(void) HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); HDremove(MISC31_FILE); -} +} /* end cleanup_misc() */ -- cgit v0.12 From 0b846cee58af147e92a3ba7db45497fd9eaa09b4 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Nov 2017 20:04:12 -0800 Subject: Cleaned up misc warnings in src and test. --- src/H5Dchunk.c | 2 +- src/H5Dcompact.c | 2 +- src/H5Dcontig.c | 2 +- src/H5FSint.c | 3 +-- src/H5Gnode.c | 6 +++--- test/filenotclosed.c | 6 +++--- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index af6599a..0d7fcc9 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5720,7 +5720,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ unsigned idx; /* Index of chunk in cache, if present */ unsigned u; /* Counter */ - H5D_shared_t *shared_fo = udata->cpy_info->shared_fo; + H5D_shared_t *shared_fo = (H5D_shared_t *)udata->cpy_info->shared_fo; /* See if the written chunk is in the chunk cache */ if(shared_fo && shared_fo->cache.chunk.nslots > 0) { diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 041d28f..43e7754 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -431,7 +431,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds void *bkg = NULL; /* Temporary buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ - H5D_shared_t *shared_fo = cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */ + H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */ H5O_storage_compact_t *storage_src = _storage_src; /* Pointer to storage_src */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 86de017..aab4901 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1363,7 +1363,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, hsize_t buf_dim[1] = {0}; /* Dimension for buffer */ hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */ hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */ - H5D_shared_t *shared_fo = cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */ + H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */ hbool_t try_sieve = FALSE; /* Try to get data from the sieve buffer */ haddr_t sieve_start = HADDR_UNDEF; /* Start location of sieve buffer */ haddr_t sieve_end = HADDR_UNDEF; /* End locations of sieve buffer */ diff --git a/src/H5FSint.c b/src/H5FSint.c index 4297291..264950d 100644 --- a/src/H5FSint.c +++ b/src/H5FSint.c @@ -96,10 +96,9 @@ H5FS_init(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR /* FUNC_ENTER() does all the work */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS_init() */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 76e2c4b..b335624 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -640,7 +640,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, while(lt < rt) { idx = (int)((lt + rt) / 2); if((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") /* Check if symbol is already present */ if(0 == (cmp = HDstrcmp(udata->common.name, s))) @@ -802,8 +802,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, const char *s; /* Pointer to string in local heap */ idx = (lt + rt) / 2; - if((s = H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name") + if((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") cmp = HDstrcmp(udata->common.name, s); if(cmp < 0) rt = idx; diff --git a/test/filenotclosed.c b/test/filenotclosed.c index d1f468a..2c5c8dc 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -19,8 +19,8 @@ #include "h5test.h" -#define FILENAME "filenotclosed" -#define DATASET "dset" +#define FILENAME "filenotclosed" +#define DATASET_NAME "dset" /*------------------------------------------------------------------------- * Function: catch_signal @@ -114,7 +114,7 @@ main(void) TEST_ERROR /* Create the dataset */ - if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Write to the dataset */ -- cgit v0.12 From 576b9c5f5f955aa64814de2ec9f0493656e82f53 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 10 Nov 2017 16:37:40 -0600 Subject: Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case. --- src/H5Oalloc.c | 15 ++++----- test/tattr.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 7 deletions(-) diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 3512d3e..478d950 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -2434,16 +2434,17 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) oh->nmesgs++; /* Initialize new null message to make the chunk large enough */ - oh->mesg[oh->nmesgs].type = H5O_MSG_NULL; - oh->mesg[oh->nmesgs].dirty = TRUE; - oh->mesg[oh->nmesgs].native = NULL; - oh->mesg[oh->nmesgs].raw = old_image + new_size + sizeof_msghdr - sizeof_chksum; - oh->mesg[oh->nmesgs].raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size), + curr_msg = &oh->mesg[oh->nmesgs - 1]; + curr_msg->type = H5O_MSG_NULL; + curr_msg->dirty = TRUE; + curr_msg->native = NULL; + curr_msg->raw = old_image + new_size + sizeof_msghdr - sizeof_chksum; + curr_msg->raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size), sizeof_msghdr) - sizeof_msghdr; - oh->mesg[oh->nmesgs].chunkno = chunkno; + curr_msg->chunkno = chunkno; /* update the new chunk size */ - new_size += oh->mesg[oh->nmesgs].raw_size + sizeof_msghdr; + new_size += curr_msg->raw_size + sizeof_msghdr; } /* end if */ /* Check for changing the chunk #0 data size enough to need adjusting the flags */ diff --git a/test/tattr.c b/test/tattr.c index 3b0c90e..5b00edc 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -10578,6 +10578,102 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) /**************************************************************** ** +** test_attr_bug9(): Test basic H5A (attribute) code. +** (Really tests object header code). +** Tests adding several large attributes to an object until +** they convert to dense storage. The total size of all +** attributes is larger than 64K, causing the internal +** object header code to, after merging the deleted +** messages in to a NULL message, shrink the object header +** chunk. Do this twice: once with only attributes in the +** object header chunk and once with a (small) soft link in +** the chunk as well. In both cases, the shrunk chunk will +** initally be too small and a new NULL message must be +** created. +** +****************************************************************/ +static void +test_attr_bug9(hid_t fcpl, hid_t fapl) +{ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hsize_t dims[1] = {32768}; /* Attribute dimensions */ + int create_link; /* Whether to create a soft link */ + unsigned max_compact; /* Setting from fcpl */ + unsigned min_dense; /* Setting from fcpl */ + char aname[11]; /* Attribute name */ + unsigned i; /* Local index variable */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n")); + + /* Create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Obtain attribute phase change settings */ + ret = H5Pget_attr_phase_change(fcpl, &max_compact, &min_dense); + CHECK(ret, FAIL, "H5Pget_attr_phase_change"); + + /* Run with and without the soft link */ + for(create_link = 0; create_link < 2; create_link++) { + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create second group */ + gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + /* Close second group */ + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + /* Open root group */ + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); + + /* Create enough attributes to cause a change to dense storage */ + for(i = 0; i < max_compact + 1; i++) { + /* Create attribute */ + snprintf(aname, sizeof(aname), "%u", i); + aid = H5Acreate2(gid, aname, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid, FAIL, "H5Acreate2"); + + /* Close attribute */ + ret = H5Aclose(aid); + CHECK(ret, FAIL, "H5Aclose"); + + /* Create enough soft links that exactly one goes into chunk 1 if + * requested */ + if(i == 0 && create_link) { + ret = H5Lcreate_soft("b", gid, "a", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + ret = H5Lcreate_soft("d", gid, "c", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + ret = H5Lcreate_soft("f", gid, "e", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + } /* end if */ + } /* end for */ + + /* Close IDs */ + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } /* end for */ + + /* Close dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_attr_bug9() */ + +/**************************************************************** +** ** test_attr(): Main H5A (attribute) testing routine. ** ****************************************************************/ @@ -10724,6 +10820,7 @@ test_attr(void) test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */ test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */ test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ + test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ } /* end for */ } /* end if */ else { @@ -10752,6 +10849,7 @@ test_attr(void) * header format and in fact fails if used with the old format, due * to the attributes being larger than 64K */ test_attr_bug8(fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ + test_attr_bug9(fcpl, my_fapl); /* Test large attributes converting to dense storage */ } /* end else */ } /* end for */ -- cgit v0.12 From 3a5e15819163e6e7c3de72a9ed8517ff200b02a7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 12 Nov 2017 21:14:01 -0800 Subject: Fixed the problems with LDFLAGS and AM_LDFLAGS in filter plugins. --- test/Makefile.am | 8 ++++---- tools/test/h5diff/Makefile.am | 2 +- tools/test/h5dump/Makefile.am | 2 +- tools/test/h5ls/Makefile.am | 2 +- tools/test/h5repack/Makefile.am | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 4f192ac..efdc1ca 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -110,10 +110,10 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c libfilter_plugin4_groups_la_SOURCES=filter_plugin4_groups.c - libfilter_plugin1_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libfilter_plugin2_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libfilter_plugin3_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libfilter_plugin4_groups_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin1_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin2_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin3_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + libfilter_plugin4_groups_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere else # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am index 4d43a2a..a2ce9c4 100644 --- a/tools/test/h5diff/Makefile.am +++ b/tools/test/h5diff/Makefile.am @@ -52,7 +52,7 @@ if HAVE_SHARED_CONDITIONAL # Build it as shared library if configure is enabled for shared library. noinst_LTLIBRARIES=libdynlibdiff.la libdynlibdiff_la_SOURCES=dynlib_diff.c - libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libdynlibdiff_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere endif # Temporary files. *.h5 are generated by h5diff. They should diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am index be21119..a7a2bcb 100644 --- a/tools/test/h5dump/Makefile.am +++ b/tools/test/h5dump/Makefile.am @@ -41,7 +41,7 @@ if HAVE_SHARED_CONDITIONAL # Build it as shared library if configure is enabled for shared library. noinst_LTLIBRARIES=libdynlibdump.la libdynlibdump_la_SOURCES=dynlib_dump.c - libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libdynlibdump_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere endif # Temporary files. *.h5 are generated by h5dumpgentest. They should diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am index a49c2e8..f5ec0f7 100644 --- a/tools/test/h5ls/Makefile.am +++ b/tools/test/h5ls/Makefile.am @@ -38,7 +38,7 @@ if HAVE_SHARED_CONDITIONAL # Build it as shared library if configure is enabled for shared library. noinst_LTLIBRARIES=libdynlibls.la libdynlibls_la_SOURCES=dynlib_ls.c - libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libdynlibls_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere endif diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am index fbe88bd..ce7cad4 100644 --- a/tools/test/h5repack/Makefile.am +++ b/tools/test/h5repack/Makefile.am @@ -48,8 +48,8 @@ if HAVE_SHARED_CONDITIONAL noinst_LTLIBRARIES=libdynlibadd.la libdynlibvers.la libdynlibadd_la_SOURCES=dynlib_rpk.c libdynlibvers_la_SOURCES=dynlib_vrpk.c - libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere - libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere + libdynlibadd_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + libdynlibvers_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere endif -- cgit v0.12 From a25366cc980695cebe40c2d471bfe5166dcb28a2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 12 Nov 2017 23:22:39 -0800 Subject: Fixed that annoying ar warning about -u being ignored. --- config/linux-gnulibc1 | 5 +++++ configure.ac | 2 ++ src/libhdf5.settings.in | 1 + 3 files changed, 8 insertions(+) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 39225e7..c32f64e 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -30,6 +30,11 @@ if test -z "$CC"; then fi fi +# Set flags for gnu ar (apparently via libtool, so AR_FLAGS, not ARFLAGS) +# If you don't do this, you will get warnings about the 'u' in +# automake's default 'cru' args. +AR_FLAGS=crD + # Figure out GNU C compiler flags . $srcdir/config/gnu-flags diff --git a/configure.ac b/configure.ac index d8f3873..50893f7 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ AC_CONFIG_COMMANDS([pubconf], [ AC_CANONICAL_HOST AC_SUBST([CPPFLAGS]) AC_SUBST([JNIFLAGS]) +AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) @@ -139,6 +140,7 @@ JNIFLAGS="${JNIFLAGS}" JAVACFLAGS="${JAVACFLAGS}" JAVAFLAGS="${JAVAFLAGS}" LDFLAGS="${LDFLAGS}" +AR_FLAGS="${AR_FLAGS}" ## Configure may need to alter any of the *FLAGS variables in order for ## various checks to work correctly. Save the user's value here so it diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 8017594..51b24dc 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -28,6 +28,7 @@ Linking Options: AM_LDFLAGS: @AM_LDFLAGS@ Extra libraries: