added Win32 support

This commit is contained in:
Aaron Blakely 2024-02-13 01:22:10 -06:00
parent f96b0e7695
commit 2f3fa2af69
278 changed files with 99233 additions and 419 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

18
.gitignore vendored Normal file → Executable file
View File

@ -1,3 +1,21 @@
xbot
build
Debug
_UpgradeReport_Files
Release
mods/test
*.so
*.dll
*.lib
*.obj
*.exp
*.exe
*.ncb
*.sln.old
*.suo
*.suo.old
*.vcproj.*
*.vcxproj.*

16
Makefile Normal file → Executable file
View File

@ -6,7 +6,10 @@ OBJ=./build
OBJECTS=$(OBJ)/*.o
EXEC=xbot
.PHONY: mods
#MODS_DIR := $(filter-out $(wildcard mods/*.so), $(wildcard mods/*))
MODS_DIR := $(filter-out $(wildcard mods/*.so) $(wildcard mods/*.dll) $(wildcard mods/*.bat) $(wildcard mods/*.obj) $(wildcard mods/*.lib) $(wildcard mods/*.exp), $(wildcard mods/*))
.PHONY: mods $(MODS_DIR)
main:
@rm -rf build
@ -20,10 +23,11 @@ main:
$(CC) -o $(EXEC) $(OBJECTS) $(BINFLAGS)
@echo "All Done!"
mods:
$(MAKE) -C mods/hello
$(MAKE) -C mods/autojoin
$(MAKE) -C mods/uptime
mods: $(MODS_DIR)
$(MODS_DIR):
$(MAKE) -C $@
clean:
@rm -rf build $(EXEC)
@rm -rf build $(EXEC)
@rm -rf mods/*.so

0
README.md Normal file → Executable file
View File

21
UpgradeLog.XML Executable file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="xbot">
</Property><Property Name="Solution File" Value="V:\Dev\xbot\xbot.sln">
</Property><Property Name="User Options File" Value="V:\Dev\xbot\xbot.suo">
</Property><Property Name="Date" Value="Tuesday, February 13, 2024">
</Property><Property Name="Time" Value="0:30 AM">
</Property></Properties><Event ErrorLevel="0" Project="" Source="xbot.sln" Description="File successfully backed up as V:\Dev\xbot\xbot.sln.old">
</Event><Event ErrorLevel="0" Project="" Source="xbot.suo" Description="File successfully backed up as V:\Dev\xbot\xbot.suo.old">
</Event><Event ErrorLevel="0" Project="xbot" Source="xbot.vcproj" Description="Converting project file 'V:\Dev\xbot\xbot.vcproj'.">
</Event><Event ErrorLevel="1" Project="xbot" Source="xbot.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
</Event><Event ErrorLevel="1" Project="xbot" Source="xbot.vcproj" Description="Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.">
</Event><Event ErrorLevel="1" Project="xbot" Source="xbot.vcproj" Description="Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.">
</Event><Event ErrorLevel="0" Project="xbot" Source="xbot.vcproj" Description="Done converting to new project file 'V:\Dev\xbot\xbot.vcxproj'.">
</Event><Event ErrorLevel="3" Project="xbot" Source="xbot.vcproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="xbot-mods" Source="xbot-mods\xbot-mods.vcproj" Description="Converting project file 'V:\Dev\xbot\xbot-mods\xbot-mods.vcproj'.">
</Event><Event ErrorLevel="1" Project="xbot-mods" Source="xbot-mods\xbot-mods.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="xbot-mods" Source="xbot-mods\xbot-mods.vcproj" Description="Done converting to new project file 'V:\Dev\xbot\xbot-mods\xbot-mods.vcxproj'.">
</Event><Event ErrorLevel="3" Project="xbot-mods" Source="xbot-mods\xbot-mods.vcproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="" Source="xbot.sln" Description="Solution converted successfully">
</Event><Event ErrorLevel="3" Project="" Source="xbot.sln" Description="Converted">
</Event></UpgradeLog>

92
compile_commands.json Executable file
View File

@ -0,0 +1,92 @@
[
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/config.o",
"./src/config.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/config.c",
"output": "/home/aaron/projects/xbot/build/config.o"
},
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/main.o",
"./src/main.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/main.c",
"output": "/home/aaron/projects/xbot/build/main.o"
},
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/irc.o",
"./src/irc.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/irc.c",
"output": "/home/aaron/projects/xbot/build/irc.o"
},
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/util.o",
"./src/util.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/util.c",
"output": "/home/aaron/projects/xbot/build/util.o"
},
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/events.o",
"./src/events.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/events.c",
"output": "/home/aaron/projects/xbot/build/events.o"
},
{
"arguments": [
"/usr/bin/gcc",
"-g",
"-std=gnu99",
"-c",
"-I./lib",
"-o",
"./build/module.o",
"./src/module.c"
],
"directory": "/home/aaron/projects/xbot",
"file": "/home/aaron/projects/xbot/src/module.c",
"output": "/home/aaron/projects/xbot/build/module.o"
}
]

View File

@ -0,0 +1,7 @@
Mark Lindner - Lead developer & maintainer.
Daniel Marjamäki - Enhancements & bugfixes.
Andrew Tytula - Windows port.
Glenn Herteg - Enhancements, bugfixes, documentation corrections.
Matt Renaud - Enhancements & bugfixes.
JoseLuis Tallon - Enhancements & bugfixes

View File

@ -0,0 +1,510 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
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 Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
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 other code 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.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
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, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) 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.
d) 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.
e) 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 materials to be 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 with
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 Lesser 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
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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!

821
include/libconfig-1.7.3/ChangeLog Executable file
View File

@ -0,0 +1,821 @@
----- version 1.7.3 ------
2021-06-19 Mark Lindner <markl@avalon>
* lib/libconfig.c - Fixed double-free of config->filenames;
fixed implementation of config_setting_lookup() to correctly return
NULL instead of the passed-in setting if the specified path was not
found
* configure.ac, lib/Makefile.am - bump version numbers
2021-04-28 Mark Lindner <markl@avalon>
* lib/CMakeLists.txt - misc. fixes
2021-04-22 Mark Lindner <markl@avalon>
* Makefile.am, configure.ac - Added --disable-tests configure option
2021-01-09 Mark Lindner <markl@avalon>
* lib/CMakeLists.txt - misc. fixes
2020-11-12 Mark Lindner <markl@avalon>
* contrib/ls-config/README.md - typo corrections
2020-10-03 Mark Lindner <markl@avalon>
* *.vcxproj, *.sln - Updated for building x64 configuration.
2020-07-02 Mark Lindner <markl@avalon>
* lib/libconfig.h++, doc/libconfig.texi - added isString() convenience
method
2019-12-18 Mark Lindner <markl@avalon>
* lib/libconfig.c, lib/libconfig.h, lib/libconfig.h++,
tests/testdata/override_setting.cfg, tests/tests.c,
doc/libconfig.texi - Added new ALLOW_OVERRIDES option.
2019-12-17 Mark Lindner <markl@avalon>
* CMakeLists.txt, tests/CMakeList.txt - various fixes
* lib/libconfig.c, lib/scanctx.c, lib/scanner.h, lib/scanner.l,
lib/strvec.c, lib/strvec.h, lib/util.c, lib/util.h - prefix more
internal functions with 'libconfig_'
* lib/scanner.c, lib/scanner.h - regenerated
2019-12-14 Mark Lindner <markl@avalon>
* lib/grammar.y, lib/scanner.l, lib/libconfig.c, lib/parsectx.h,
lib/scanctx.h, lib/scanctx.c, lib/strbuf.c, lib/strbuf.h,
lib/strvec.c, lib/strvec.h - prefix all internal functions with
'libconfig_'
* lib/grammar.c, lib/grammar.h, lib/scanner.c, lib/scanner.h - regenerated
* lib/wincompat.h - Fix #define for snprintf for Visual Studio 2013
* lib/libconfig.h++, lib/libconfigcpp.c++ - Use noexcept in C++17
----- version 1.7.2 ------
2019-01-05 Mark Lindner <markl@avalon>
* lib/libconfig.c - fixed slow leak in config_destroy()
* <multiple> - miscellaenous build file fixes
----- version 1.7.1 ------
2017-11-15 Mark Lindner <markl@avalon>
* lib/wincompat.c, lib/wincompat.h - added fsync() implementation for
Windows
* lib/libconfig.c, lib/libconfig.h - added CONFIG_OPTION_FSYNC
* lib/libconfigcpp.c++, lib/libconfig.h++ - added Config::OptionFsync
* doc/libconfig.texi - Documentation updates
2017-11-14 Mark Lindner <markl@avalon>
* lib/strbuf.c - bugfix in strbuf_append_char()
----- version 1.7 ------
2017-10-24 Mark Lindner <markl@avalon>
* INSTALL - Added information about installing from a git snapshot
* configure.ac - Bumped version to 1.7
* doc/libconfig.texi - Updated documentation, added new chapter on
libconfig bindings/implementations for other languages
* examples/c/Makefile.am, examples/c/example4.c, examples/c/example4.cfg,
examples/c/cfg_includes/*.cfg - New example program
* lib/Makefile.am - bumped library version to 11:0:0; added new source
files
* lib/grammar.c, lib/grammar.y, lib/scanner.c, lib/scanner.h - regenerated
* lib/grammar.y - allow optional trailing comma in lists and arrays
* *.vcproj - updated with new source files, library dependency
* lib/libconfig.c, lib/libconfig.h - various code cleanup;
reworked options API; moved some value parsing logic into lib/util.c
and lib/util.h; added new option
CONFIG_OPTION_ALLOW_SCIENTIFIC_NOTATION; bugfix to disallow adding a
group or a list to an array; changed default float precision from 2 to 6;
fixed conversion between int and int64 types; added config_clear();
added support for include functions; added config_set_hook() and
config_get_hook()
* lib/libconfigcpp.c++, lib/libconfig.h++ - moved Option enum from Setting
to Config; added OptionAllowScientificNotation; added clear();
reworked options API; added evaluateIncludePath(); fixed casting to
unsigned int (don't clip negative values to 0)
* lib/parsectx.c, lib/parsectx.h - code cleanup
* lib/scanctx.c, lib/scanctx.h - added support for include functions;
code cleanup; removed non-portable directory reading code;
* lib/scanner.l - added support for include functions; moved some parsing
code to lib/util.c and lib/util.h; code cleanup
* lib/strbuf.c, lib/strbuf.h - added strbuf_append_char(); code cleanup
* lib/strvec.c, lib/strvec.h - new functions for managing arrays of
string pointers (for filename lists)
* lib/util.c, lib/util.h - value parsing and formatting code and memory
management macros and functions extracted from other files
* lib/wincompat.h - new macros for testing relative paths; replaced
INT32_MAX/INT32_MIN with INT_MAX/INT_MIN.
* tests/tests.c - fixed test failures and improper testing of int type
conversions
----- version 1.6 ------
2015-12-31 Jose Luis Tallon <jltallon@adv-solutions.net>
* Added include_dir feature (support for Debian-style conf.d/
includes) (pull request #36)
* Added octal_ints feature (support for integer expressed in octal,
useful for permissions and masks in UNIX-like systems (pull req #42)
* Fixed "Removing a setting removes all siblings" (issue #41)
Props random85
* Allow specifying the number of decimals wanted when outputting
Based upon a suggestion by zhaopingsun (issue #31)
* Make libconfig usable from CMake (pull request/issue #28)
Props thfi
* Documentation fixes
- Copyright and examples
- Included TeX patch from Debian (fixes FTBS with TeXlive)
* Resync Debian packaging
includes updated packages for GCC5 transition
2015-10-14 Thomas Fischer <fischer@unix-ag.uni-kl.de>
* configure, configure.ac, debian/libconfig++9-dev.install,
debian/libconfig9-dev.install, lib/Makefile.am, lib/Makefile.in,
lib/libconfig++Config.cmake.in, lib/libconfigConfig.cmake.in,
libconfig.spec.in - locating libconfig in CMake-based projects
2015-08-14 Mark Lindner <markl@neuromancer>
* lib/wincompat.h - Fixed Windows portability issue
* lib/libconfig.h++ - added missing operator[](std::string&).
----- version 1.5 ------
2015-05-16 Mark Lindner <markl@neuromancer>
* lib/libconfig.c - Don't fclose() a null pointer.
2014-09-19 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/wincompat.h - check if file being opened is a
directory
* lib/libconfig.c, lib/libconfig.h, lib/libconfig.h++,
doc/libconfig.texi - added config_set_options(),
config_get_options(), setOptions(), getOptions().
2014-05-25 Mark Lindner <markl@neuromancer>
* lib/libconfig.c++, lib/libconfig.h++ - added patches from Matt
Renaud (added iterators, removed throws() specifications); added
Setting.lookup(); code cleanup; added patch from Yuri Dyachenko
(made exception constructors public)
* lib/libconfig.c, lib/libconfig.h - renamed
config_setting_lookup_from() to config_setting_lookup() and
documented it; patch from Alexander Klauer (floating point precision
loss)
* doc/libconfig.texi - documented new APIs, bumped version
* lib/scanner.c, lib/scanner.h, lib/scanner.l, libconfig.c -
scanner code cleanup; and regenerated with flex 2.5.39
* lib/grammar.c, lib/grammar.h, lib/grammar.y - parser code cleanup;
and regenerated with bison 3.0.2
* README, ChangeLog - version updates
2014-01-21 Mark Lindner <markl@neuromancer>
* lib/libconfig.c - bugfix; capture root filename
* tests/Makefile.am - fix for out-of-source builds
* ac_config.h.in, aclocal.m4 - updated to newer autotools
----- version 1.4.9 ------
2012-09-28 Mark Lindner <markl@neuromancer>
* lib/libconfigcpp.c++ - Fixed compiler warnings in constructor
initializers
* tinytest/tiytest.c, tinytest/tinytest.h - added tt_file_exists();
added alternate implementations of some test macros since MSVC does
not support C99 fully; added comparators for text files (ignoring
line endings)
* tests/tests.c - use tt_file_exists() rather than access(); alias
snprintf to _snprintf for MSVC; compare files as text files rather
than as binary files
* lib/scanner.l - fixed parsing issue when backslash in string is
followed by invalid escape character; reported by Jimmy Scott
* lib/scanner.c - regenerated
* lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am,
doc/libconfig.texi, configure.ac - bump version numbers
* aclocal.m4, ac_config.h - regenerated
* m4/*, aux-build/*, libtool - updated to newer
2011-12-30 Mark Lindner <markl@neuromancer>
* debian/control - updates from Jonathan McCrohan
----- version 1.4.8 ------
2011-08-04 Mark Lindner <markl@neuromancer>
* tests/Makefile.am - marked 'libconfig_tests' as non-installable
* lib/scanner.l, lib/grammar.y - grammar changes to make trailing
semicolons optional (and to allow commas as an alternative)
* lib/libconfig.c - bugfixes for lack of auto-conversion handling in
the config_lookup*() functions (reported by Feng Yu), and some
fixes for compiler warnings
* lib/Makefile.am - bump .so version
* configure.ac - bump version, add '-Wno-unused-parameter' compiler
switch to disable "unused parameter" warnings
* doc/libconfig.texi - documentation updates; added a chapter that
calls attention to the bundled example programs
* lib/libconfig.h, lib/libconfig.h++ - bump versions
----- version 1.4.7 ------
2011-03-11 Mark Lindner <markl@neuromancer>
* doc/libconfig.texi - fixed typo; updated docs
* TODO - updated list
* lib/libconfig.c, lib/libconfig.h, lib/libconfigcpp.c++,
lib/libconfig.h++ - added config{get,set}_default_format(),
Config::{get,set}DefaultFormat()
2011-03-10 Mark Lindner <markl@neuromancer>
* lib/libconfig.c - fixed memory leak when encountering a parse error
in an @include'd file
* lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am, configure.ac,
doc/libconfig.texi - bump versions
----- version 1.4.6 ------
2010-09-10 Mark Lindner <markl@neuromancer>
* doc/libconfig.texi - documentation updates
* lib/libconfig.c, lib/libconfigcpp.c++, lib/libconfig.h,
lib/libconfig.h++, lib/wincompat.h, lib/scanctx.c - added support
for specifying an include directory
* m4/* - added local m4 directory
* contrib/* - added user-contributed files
2010-09-07 Mark Lindner <markl@neuromancer>
* lib/scanner.l - bugfix for parse error when there is a missing
newline at the end of the file
* lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am - bump version
* tinytest/* - added a simple unit testing framework
* tests/* - added preliminary unit tests
* configure.ac, ac_config.h, ac_config.h.in, Makefile.am,
lib/Makefile.am, libtool, doc/libconfig.texi - bump versions/dates
* lib/grammar.h, lib/grammar.c - regenerated with newer version of
Bison
* lib/libconfig.c - bugfix: explicitly set starting line number to 1
when parsing from strings; otherwise line numbers reported in parse
errors are undefined
----- version 1.4.5 ------
2010-05-04 Mark Lindner <markl@neuromancer>
* lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am - bumped version
numbers; removed #include for <map> and added one for <exception>
* lib/libconfigcpp.c++ - bugfix: properly handle TypeInt64 in add() and
assertType()
* aux-build/*, ac_config.h, configure.ac, ac_config.h.in, libtool -
regenerated with newer autotools
* libconfig.c - added declaration of libconfig_yylex_init_extra() to
eliminate compiler warning
* scanner.l - added #define YY_NO_INPUT to prevent compiler warning
* libconfig.texi - Added example code for operator=()
----- version 1.4.4 ------
2010-04-12 Mark Lindner <markl@neuromancer>
* lib/Makefile.am - fixed shared library version info
* lib/libconfig.h++ - added Setting::c_str() method
* configure.ac, ac_config.h, libconfig.spec, lib/libconfig.h,
lib/libconfig.h++ - bump versions
* lib/wincompat.h - fixed MinGW build error
* doc/libconfig.texi - doc updates
* README - added MinGW info
----- version 1.4.3 ------
2010-02-13 Mark Lindner <markl@neuromancer>
* lib/scanner.l - bugfix for matching @include with preceding
whitespace
----- version 1.4.2 ------
2010-01-19 Mark Lindner <markl@neuromancer>
* lib/libconfigcpp.c++, lib/libconfig.h++ - bugfix for crash; added
copy constructor for ParseException (from Frederic Heitzmann)
* lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am,
ac_config.h, libconfig.spec, configure.ac - bump versions
2010-01-09 Mark Lindner <markl@neuromancer>
* lib/libconfigcpp.c++ - bugfix in ParseException constructor (from
Ilya Dogolazky)
* debian/* - more cleanup, and added debug rules (from Ilya Dogolazky)
----- version 1.4.1 ------
2009-12-31 Mark Lindner <markl@neuromancer>
* lib/libconfig.c - bugfix for crash; removed unnecessary buffer delete
in __config_read()
* examples/c/Makefile.am, examples/c++/Makefile.am - fixed build issue
* configure.ac, Makefile.am - Added `--disable-examples' configure
option
* configure.ac, lib/Makefile.am, libconfig.spec, ac_config.h - bumped
version numbers
----- version 1.4 ------
2009-10-24 Mark Lindner <markl@neuromancer>
* grammar.y, scanner.l - properly report @include errors
* exmaples/example4.cpp - new example added
2009-10-14 Mark Lindner <markl@neuromancer>
* debian/* - more fixes; from Klaus Schneider-Zapp
* libconfig.c - when writing strings, escape only control characters
with \x
----- version 1.4b4 ------
2009-09-09 Mark Lindner <markl@neuromancer>
* lib/Makefile.am - fixed MinGW build issues
----- version 1.4b3 ------
2009-09-04 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/scanner.l, lib/grammar.y - fixed all memory
leaks reported by Valgrind; removed an unncessary strdup()/free().
2009-09-01 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/libconfig.h, lib/libconfigcpp.c++,
lib/libconfig.h++ - added config_error_type() and fixed a segfault
when throwing a ParseException.
* doc/libconfig.texi - doc updates
----- version 1.4b2 ------
2009-08-29 Mark Lindner <markl@neuromancer>
* examples/* - added new example programs to replace the less
practical ones in samples/
2009-08-25 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/libconfig.h, lib/libconfigcpp.c++,
lib/libconfig.h++ - added config_set_tab_width(),
config_get_tab_width() and Config::setTabWidth(),
Config::getTabWidth().
* doc/libconfig.texi - doc updates
----- version 1.4b1 ------
2009-08-21 Mark Lindner <markl@neuromancer>
* lib/libconfig.h++, lib/libconfigcpp.c++ - broke the public
dependency on libconfig.h; updated VC++ projects on Windows so that
the C++ DLL no longer exports any of the C API functions
* debian/* - updated for version 1.4
* lib/libconfig.c - fixed an isprint() assertion on Windows
2009-08-20 Mark Lindner <markl@neuromancer>
* lib/parsectx.c, lib/parsectx.h, lib/scanctx.c, lib/scanctx.h,
lib/strbuf.c, lib/strbuf.h - code refactoring to reduce library size
lib/Makefile.am - fixed 'make install' error
----- version 1.4b ------
2009-08-16 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/libconfig.h, lib/scanctx.c, lib/scanctx.h,
lib/grammar.y, lib/grammar.c, lib/grammar.h - added
config_read_string(); added config_setting_source_file() and
management of list of input file names; added #ifdef guard for
DllMain() function so that it's not included for static library
builds
* lib/libconfigcpp.c++, lib/libconfig.h++ - added filename to
ParseException; bugfix in Setting::setFormat(); made what() methods
of exceptions public; added Setting::getSourceFile(),
Config::readString().
* doc/libconfig.texi - documentation updates
* lib/Makefile.am - bump .so version
* ac_config.h, configure.ac, libtool - bump version
2009-07-19 Mark Lindner <markl@neuromancer>
* lib/libconfig.c, lib/libconfig.h, lib/libconfigcpp.c++,
lib/libconfig.h++ - added config_read_string() and
Config::readString() functions (contributed by Matthias Weisser).
2009-07-02 Mark Lindner <markl@neuromancer>
* lib/parsectx.c, lib/parsectx.h, lib/scanctx.c, lib/scanctx.h,
lib/scanner.l, lib/grammar.y, lib/private.h, lib/Makefile.am,
lib/libconfig.c, lib/libconfig.h - replaced ugly C code in scanner.l
for processing strings with a new <STRING> scanner state and
associated rules; added support for hex character literals (\xNN) in
strings; refactored scanner and parser context into separate source
files; added preliminary support for include files ("@include"
directive).
2009-05-27 Mark Lindner <markl@neuromancer>
* ltmain.sh, ac_config.h, ac_config.h.in, configure.ac, libconfig.spec,
libtool - upgraded to newer versions of autotools
* grammar.y, grammar.h, grammar.c, libconfigcpp.c++, libconfig.h++,
libconfig.c, libconfig.h - added LIBCONFIG_VER_* macros, changed API
to replace 'long' and 'unsigned long' with 'int' and 'unsigned int'
to resolve a portability problem; added 'const' to declarations of
getLine() and getError() methods on ParseException
* <multiple> - directory structure reorg
----- version 1.3.2 ------
2009-02-18 Mark Lindner <markl@neuromancer>
* libconfig.vcproj, libconfig++.vcproj - #define _STDLIB_H to
eliminate 'inconsistent dll linkage' warnings for free & malloc
2009-02-17 Mark Lindner <markl@neuromancer>
* libconfig.c, libconfig.h - added config_setting_lookup*() functions;
modified config_lookup_*() functions to have more consistent API
(return status, and accept value-result param)
* debian/* - updates and cleanup (from Klaus Schneider-Zapp)
* libconfig.spec, Makefile.am, ac_config.h - update version number
* doc/libconfig.texi - documentation updates
* samples/c/sample1.c - patch from Rodolfo Giometti
* samples/c/stub.c - fixed relative to API changes
2008-12-06 Mark Lindner <markl@neuromancer>
* libconfig.c - fix memory leak in config_setting_remove_elem();
reported by Timi Tuohenmaa
* configure.ac - fix incorrect processing of --enable-cxx option;
reported by Thomas Gazzola
2008-09-11 Mark Lindner <markl@neuromancer>
* debian/libconfigduo2.postinst - fix typo in test stmt
----- version 1.3.1 ------
2008-09-07 Mark Lindner <markl@neuromancer>
* scanner.l, wincompat.h - workarounds for problems with parsing and
formatting of 64-bit integers on MinGW
* scanner.c - regenerated
2008-09-05 Mark Lindner <markl@neuromancer>
* libconfig.spec - updated for 1.3.1
* Makefile.am - fix version
* scanner.l - add fromhex() function, since strtoull() seems broken
on MinGW
2008-08-25 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++, libconfig.h++ - derive exceptions from
std::exception
2008-08-10 Mark Lindner <markl@neuromancer>
* wincompat.h - fix MinGW build issue
* configure.ac, ac_config.h, Makefile.am - bump version
* doc/libconfig.texi - doc updates
* libconfigcpp.c++, libconfig.h++ - include path information in
setting exceptions
* libconfig.c - force "C" locale for parsing & formatting
----- version 1.3 ------
2008-04-07 Mark Lindner <markl@neuromancer>
* libconfig.spec - updated for 1.3
2008-04-03 Mark Lindner <markl@neuromancer>
* scanner.l, grammar.y, libconfig.c, libconfig.h, wincompat.h -
fix/add comment headers, add C90 portability fixes from
Chris Pickett (C-style comments, renamed 'index' to 'idx' to
resolve name clash)
* scanner.c, grammar.c - regenerated
* configure.ac - enable more gcc warnings
* libconfigcpp.c++, libconfig.h++ - added getPath(), fixed impl of
isRoot(), add portability fixes from Chris Pickett (renamed 'index'
to 'idx' to resolve name clash), moved exception constructors into
source file; changed SettingExistsException to SettingNameException
to be more broad in scope
* Makefile.am - add wincompat.h to sources; add missing debian files
to EXTRA_DIST
* test.cfg - added example 64-bit integer settings
* samples/* - expanded some examples
* doc/libconfig.texi - documentation updates
* Makefile.am, *msvc7* - added (generated) VS2003 projects/solution
2008-03-22 Mark Lindner <markl@neuromancer>
* debian/* - updates from Klaus Schneider
2008-03-22 Mark Lindner <markl@neuromancer>
* scanner.l, grammar.y, libconfig.h++, libconfig.c, libconfig.h,
wincompat.h, libconfigcpp.c++, grammar.c, scanner.c, grammar.h -
add support for 64-bit integer values
* libconfig.texi - documentation updates
* Makefile.am, ac_config.h, configure.ac, libtool - bump version
* libconfig.h - add config_setting_parent(), config_setting_is_root()
* libconfigcpp.c++, libconfig.h++ - add isRoot(), getParent() to
Setting
2008-03-15 Mark Lindner <markl@neuromancer>
* scanner.l - made 'true' and 'false' tokens completely
case-insensitive
* libconfigcpp.cc, libconfig.hh - added alias files for Windows
* libconfig.c, libconfig.h - modified __config_write_value() to write
out floating point values in a more human-readable form; added name
validation; added config_setting_remove_elem() and
config_setting_index()
* libconfigcpp.c++, libconfig.h++ - added remove(unsigned int) and
getIndex() to Setting
* libconfig.texi - documentation updates
----- version 1.2.1 ------
2007-12-21 Mark Lindner <markl@neuromancer>
* libconfig.c - source cleanup
* config.guess, config.sub, ltmain.sh, libtool - updated to newer
* configure.ac, Makefile.am, ac_config.h.in, ac_config.h
- MinGW-related fixes
----- version 1.2 ------
2007-10-15 Mark Lindner <markl@neuromancer>
* libconfig.h++, libconfigcpp.c++ - renamed "SettingFormat" to
"Setting::Format" to reduce namespace pollution
2007-10-13 Mark Lindner <markl@neuromancer>
* scanner.l - updated regexp for float to allow for values which have
an exponent but no decimal point
* grammar.y - capture input line number when parsing settings
* libconfig.c, libconfig.h - added config_setting_is*() macros;
added config_setting_source_line(); added line member to
config_setting_t struct
* libconfig.c++, libconfig.h++ - renamed "SettingType" enum to
Setting::Type to reduce namespace pollution; added getSourceLine()
* samples/* - various updates
* debian/changelog - added entry
* ac_config.h, configure.ac, libtool, Makefile.am - new version #
* TODO - updates
* doc/libconfig.texi - documentation updates
2007-10-12 Mark Lindner <markl@neuromancer>
* libconfig.c, libconfig.h - added config_set_auto_convert(),
config_get_auto_convert(), and number auto-conversion logic
* libconfigcpp.c++, libconfig.h++ - add setAutoConvert(),
getAutoConvert(), lookupValue() that takes std::string&,
corrected return values of assignment operators
* debian/rules - made file executable
* debian/libconfigduo-dev.install - add pkgconfig files to list
2007-09-22 Mark Lindner <markl@neuromancer>
* libconfig.c, libconfig.h - change 'type' and 'format' members of
config_setting_t to short, thereby saving 4 bytes
2007-09-22 Mark Lindner <markl@neuromancer>
* doc/libconfig.texi - add @direntry to fix install-info warnings
* libconfig.spec.in, Makefile.am, configure.ac - added RPM support
(from Deneys S. Maartens)
2007-09-18 Mark Lindner <markl@neuromancer>
* libconfig.h - remove DLL_EXPORT; add LIBCONFIG_STATIC to fix
static linking on Windows
2007-09-18 Deneys S. Maartens <dsm@tlabs.ac.za>
* samples/c/Makefile.am, samples/c++/Makefile.am - Add
AM_CPPFLAGS to fix distcheck build failure
* Makefile.am - expand wildcards in EXTRA_DIST to fix distcheck
build failure
----- version 1.1.3 ------
2007-08-03 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++ - bugfix in unsigned cast operators (incorrect value
clipping logic)
* debian/control - made some corrections
----- version 1.1.2 ------
2007-07-01 Mark Lindner <markl@neuromancer>
* debian/* added debian package files from Klaus Schneider
* libconfig.h++ - added new predicate is<type>() functions
* libconfig.h - fix comments
* doc/libconfig.texi - documentation updates
* ac_config.h, configure.ac, Makefile.am - new version #
----- version 1.1.1 ------
2007-06-15 Mark Lindner <markl@neuromancer>
* scanner.l - bugfix in string parsing
* test.cfg - added test case
----- version 1.1 ------
2007-04-18 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++ - bugfix in add(SettingType)
* stubcpp.cpp - add more ad-hoc tests
2007-04-05 Mark Lindner <markl@neuromancer>
* scanner.l - Add string concatenation patch from Glenn Herteg.
Add \f as a whitespace character.
* grammar.y - add mode directive emacs
* libconfigcpp.c++, libconfig.h++ - add exists() and lookupValue()
methods; add Setting::operator std::string()
* libconfig.texi - documentation updates
----- version 1.0.1 ------
2006-11-26 Mark Lindner <markl@neuromancer>
* samples/c/Makefile.am, samples/c++/Makefile.am - fix linker error
* libconfig.texi - documentation update
----- version 1.0 ------
2006-10-19 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++ - bugfix in add() for lists
2006-10-11 Mark Lindner <markl@neuromancer>
* scanner.l - allow asterisk in setting names (submitted by
James McCann)
* libconfig.texi - documentation updates
* configure.ac, Makefile.am, samples/Makefile.am - add --disable-cxx
configure option; conditionally build/install C++ components
2006-10-01 Mark Lindner <markl@neuromancer>
* <multiple> - samples cleanup
2006-09-14 Mark Lindner <markl@neuromancer>
* libconfig.c - Change %.8f to %e for double values in
__config_write_value(). Submitted by Filipe Maia.
2006-08-31 Mark Lindner <markl@neuromancer>
* Makefile.am - changed bin_PROGRAMS to noinst_PROGRAMS; the stub
programs are for testing and should not be installed.
2006-08-26 Mark Lindner <markl@neuromancer>
* libconfig.texi - documentation corrections & updates
* stub.c, stubcpp.c++ - check return value of fopen(); fix compiler
warnings
* configure.ac, Makefile.am - add -Wall to CFLAGS only for gcc;
add test.cfg to EXTRA_DIST
* grammar.y, libconfigcpp.c++ - fix compiler warnings
* libconfig.c - use CONFIG_TRUE & CONFIG_FALSE rather than 1 & 0
for success/failure return values.
----- version 0.9 ------
2006-07-29 Mark Lindner <markl@neuromancer>
* <multiple> - major grammar redesign: groups are now values instead of
distinct syntax constructs; this allows groups to be elements of
lists
* libconfig.texi - documentation updates; added new chapter containing
the BNF grammar
* test.cfg - modified to reflect new syntax and to demonstrate lists
2006-06-23 Mark Lindner <markl@neuromancer>
* <multiple> - added support for lists (collections of
heterogeneous values of any type)
* libconfig.c - pretty-printing fixes in config_write()
2006-06-08 Mark Lindner <markl@neuromancer>
* libconfig.h++ - added private copy constructor & assignment operator
(from Josef Meile)
* ligconfigcpp.c++, libconfig.h++ - added cast operators for unsigned
int and unsigned long (from Scott Frazer)
* <multiple> - add support for value formats; the only non-default
format currently supported is hexadecimal format for integer values
(based on patch from Scott Frazer)
2006-04-15 Mark Lindner <markl@neuromancer>
* <multiple> - added pkg-config support
2006-03-31 mlindner <markl@neuromancer>
* <multiple> - cleaned up config.tab.h mess (this file was obsolete,
and superseded by grammar.h ... problem identified by Scott Frazer)
2006-03-30 mlindner <mlindner@chimera>
* grammar.y - fixed includes for windows (missing decl of malloc/free)
* libconfig.c - fixed several signed/unsigned warnings
* doc/libconfig.texi - documentation updates, formatting fix
* scanner.l - allow lowercase 'true' and 'false' in addition to
'TRUE' and 'FALSE'
2006-03-27 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++ - added missing break statements in switch (from
Lukas Zweifel)
* libconfig.c - don't strdup() a NULL string (from Lukas Zweifel)
* grammar.c, grammar.h - regenerated with bison 2.1
2006-03-20 Mark Lindner <markl@neuromancer>
* scanner.l - added '%option nounistd' and regenerated with newest
version of flex; Windows doesn't have unistd.h.
2006-03-17 Mark Lindner <markl@neuromancer>
* grammar.y - bugfix; error & abort parsing if duplicate setting name
encountered (previously caused a crash ... reported by Tobias Witek)
* scanner.l - bugfix; multi-line C-style comments were causing line
number counting to be thrown off, because the newlines were being
"eaten"
* <multiple> - various fixes to support building of DLLs on Windows.
2005-11-26 Mark Lindner <markl@neuromancer>
* grammar.y, scanner.l - always strdup() yytext, and free the memory
in the grammar rules.
2005-11-22 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++, libconfig.h++, libconfig.c, libconfig.h -
Added Daniel's enhancements: methods & functions for reading/writing
files, fixes for various memory leaks, etc.
* samples/* - Added Daniel's example code.
* docs/libconfig.texi - Updated documentation
2005-09-28 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++, libconfig.h++, libconfig.c, libconfig.h
Enhanced API to support modification of a configuration.
* libconfig.texi - updated manual
2005-06-02 Mark Lindner <markl@neuromancer>
* libconfigcpp.c++, libconfig.h++ - Added getName() method;
fixed operator[](int) to work with groups; this allows iteration over
a group's child settings. Added a missing break statement (bugfix
submitted by Pablo Barrera Gonzalez). Added operator int() and
operator float() to Setting; note that these may cause loss of
precision since the actual values are stored internally as long
and double, respectively.
* libconfig.h - added config_setting_name() macro
* libconfig.c - maintain two lists of children at each node; a sorted
list and an unsorted list (to preserve the order of the settings as
they appear in the file).
* scanner.l - fixed scanner rule for comments. '#' no longer has to
be in column 0 to be recognized as a comment. Added support for C
and C++ style comments.

255
include/libconfig-1.7.3/INSTALL Executable file
View File

@ -0,0 +1,255 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Installation from Cloned Git Repository
=======================================
If you obtained the package by cloning the git repository, there are some
additional steps required to build the package, as the generated 'configure'
script and other supporting build files are not included in the repository.
You must have the GNU autotools installed:
- autoconf (version 2.69 or newer recommended)
- automake (version 1.15 or newer recommended)
- libtool (version 2.4.6 or newer recommended)
If you plan to modify the source code, you may also need the following:
- GNU Bison (verison 3.0.4 or newer required)
- flex (version 2.6.4 or newer required)
Generate the 'configure' script and other necessary build files by running
'autoreconf' in the toplevel libconfig directory.
Then, follow the basic installation instructions below.
Basic Installation
==================
These are generic installation instructions when building from a released
distribution tarball.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -0,0 +1,49 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib
if BUILDDOC
SUBDIRS += doc
endif
if BUILDEXAMPLES
SUBDIRS += examples
endif
if BUILDTESTS
SUBDIRS += tinytest tests
endif
.PHONY: dist-rpm
dist-rpm: distcheck
rpmbuild -ta $(distdir).tar.gz
EXTRA_DIST = \
m4/*.m4 \
*.sln \
test.cfg \
TODO \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/docs \
debian/libconfig++9-dev.install \
debian/libconfig++9.install \
debian/libconfig9-dev.docs \
debian/libconfig9-dev.install \
debian/libconfig9.info \
debian/libconfig9.install \
debian/rules \
debian/shlibs \
debian/watch \
libconfig.spec \
contrib
dist-hook:
rm -rf `find $(distdir)/contrib -name .svn`
test:
cd tests && ./libconfig_tests

View File

@ -0,0 +1,876 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@BUILDDOC_TRUE@am__append_1 = doc
@BUILDEXAMPLES_TRUE@am__append_2 = examples
@BUILDTESTS_TRUE@am__append_3 = tinytest tests
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/aux-build/mkinstalldirs
CONFIG_HEADER = ac_config.h
CONFIG_CLEAN_FILES = libconfig.spec
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)ac_config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = lib doc examples tinytest tests
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ac_config.h.in \
$(srcdir)/libconfig.spec.in $(top_srcdir)/aux-build/compile \
$(top_srcdir)/aux-build/config.guess \
$(top_srcdir)/aux-build/config.sub \
$(top_srcdir)/aux-build/install-sh \
$(top_srcdir)/aux-build/ltmain.sh \
$(top_srcdir)/aux-build/missing \
$(top_srcdir)/aux-build/mkinstalldirs AUTHORS COPYING.LIB \
ChangeLog INSTALL NEWS README TODO aux-build/compile \
aux-build/config.guess aux-build/config.rpath \
aux-build/config.sub aux-build/depcomp aux-build/install-sh \
aux-build/ltmain.sh aux-build/missing aux-build/mkinstalldirs \
aux-build/texinfo.tex aux-build/ylwrap
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib $(am__append_1) $(am__append_2) $(am__append_3)
EXTRA_DIST = \
m4/*.m4 \
*.sln \
test.cfg \
TODO \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/docs \
debian/libconfig++9-dev.install \
debian/libconfig++9.install \
debian/libconfig9-dev.docs \
debian/libconfig9-dev.install \
debian/libconfig9.info \
debian/libconfig9.install \
debian/rules \
debian/shlibs \
debian/watch \
libconfig.spec \
contrib
all: ac_config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
ac_config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/ac_config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status ac_config.h
$(srcdir)/ac_config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f ac_config.h stamp-h1
libconfig.spec: $(top_builddir)/config.status $(srcdir)/libconfig.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile ac_config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) all install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
.PHONY: dist-rpm
dist-rpm: distcheck
rpmbuild -ta $(distdir).tar.gz
dist-hook:
rm -rf `find $(distdir)/contrib -name .svn`
test:
cd tests && ./libconfig_tests
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

0
include/libconfig-1.7.3/NEWS Executable file
View File

78
include/libconfig-1.7.3/README Executable file
View File

@ -0,0 +1,78 @@
To produce a PDF manual, issue the command "make pdf" after running
`./configure'.
-*-
If you do not wish to build the C++ components, use:
./configure --disable-cxx
-*-
The `examples' subdirectory contains some examples of using libconfig
from C and C++.
-*-
Flex and Bison are not required in order to build this
package. However, you will need them, if you modify the .l or .y files. See
the list of required build tool versions below.
-*-
To successfully compile using MinGW (with gcc 4.4.0 or later), it may
be necessary to modify the file "mingw32\4.4.0\libstdc++.la", changing line 11
from:
library_names='libstdc++.dll.a'
to:
library_names='libstdc++.a'
(See http://trac.osgeo.org/geos/ticket/282 for more information).
-*-
To cross-compile for Android:
1) Create a standalone toolchain using the 'make-standalone-toolchain.sh'
script included with the Android NDK. For example:
$ /pkg/android-ndk-r9d/build/tools/make-standalone-toolchain.sh \
--platform=android-19 \
--install-dir=/pkg/android-toolchain-19 \
--system=linux-x86_64 \
--arch=arm
2) Add the standalone toolchain's bin directory to the front of the path:
$ export PATH=/pkg/android-toolchain-19/bin:$PATH
3) Configure libconfig for cross-compilation:
$ ./configure --host=arm-linux-androideabi \
--with-sysroot=/pkg/android-toolchain-19/sysroot
4) Build libconfig
$ make
-*-
Build tools dependencies. (These are only required if you are a maintainer.)
Autoconf 2.69
Automake 1.14.1
Bison 3.0.2
Flex 2.5.39
Libtool 2.4.2
-*-
Libconfig may be found on github at https://github.com/hyperrealm/libconfig
For some reason, we need to symlink /pkg/android-toolchain-19/sysroot/pkg -> /pkg

39
include/libconfig-1.7.3/TODO Executable file
View File

@ -0,0 +1,39 @@
TO-DOs:
These are features that have been requested, and have been considered,
but are not yet implemented, because I'm undecided about how or whether they
should be implemented, and/or because they are difficult and/or time-consuming
to implement.
Also, some of these features tend to push libconfig toward becoming a
general-purpose structured-data storage mechanism, which is really not the
intended purpose of this library. I think something like sqlite is better
suited for that sort of thing.
* Add support for copying settings from one configuration to another. Need a
recursive function to copy a setting and call itself on all child settings.
* Add a += operator, so that additional elements can be appended to a list or
array. The issue with this is defining a consistent syntax. For example:
x = ( 1, 2, 3 );
x += ( 4, 5 );
Should this result in ( 1, 2, 3, 4, 5 ), or ( 1, 2, 3, ( 4, 5 ))? I believe
it should be the latter. However, only the former makes sense for arrays.
* Add the ability to insert/delete elements at any position in a list or
array. A simple implementation would be expensive (shift all the elements
by one for every insert/delete), and a more efficient implementation would
add a lot of complexity to the library.
* Add limited support for preserving comments.
* Add support for unicode strings? A bit problematic, since flex doesn't
support unicode input, AFAICT. But maybe supply convenience functions to
convert between parsed UTF-8 strings and std::wstring.

View File

@ -0,0 +1,116 @@
/* ac_config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `freelocale' function. */
#undef HAVE_FREELOCALE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `newlocale' function. */
#undef HAVE_NEWLOCALE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if you have the <xlocale.h> header file. */
#undef HAVE_XLOCALE_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Configured target name. */
#undef TARGET
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const

1175
include/libconfig-1.7.3/aclocal.m4 vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1568
include/libconfig-1.7.3/aux-build/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,666 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2007 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | cygwin* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix4* | aix5*)
library_names_spec='$libname$shrext'
;;
amigaos*)
library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd1*)
;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
esac
;;
gnu*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1793
include/libconfig-1.7.3/aux-build/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -0,0 +1,162 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because '.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -0,0 +1,139 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
estatus=1
fi
case $estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,247 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
scriptversion=2013-01-12.17; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
get_dirname ()
{
case $1 in
*/*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
# Otherwise, we want the empty string (not ".").
esac
}
# guard FILE
# ----------
# The CPP macro used to guard inclusion of FILE.
guard ()
{
printf '%s\n' "$1" \
| sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \
-e 's/__*/_/g'
}
# quote_for_sed [STRING]
# ----------------------
# Return STRING (or stdin) quoted to be used as a sed pattern.
quote_for_sed ()
{
case $# in
0) cat;;
1) printf '%s\n' "$1";;
esac \
| sed -e 's|[][\\.*]|\\&|g'
}
case "$1" in
'')
echo "$0: No files given. Try '$0 --help' for more information." 1>&2
exit 1
;;
--basedir)
basedir=$2
shift 2
;;
-h|--h*)
cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
Wrapper for lex/yacc invocations, renaming files as desired.
INPUT is the input file
OUTPUT is one file PROG generates
DESIRED is the file we actually want instead of OUTPUT
PROGRAM is program to run
ARGS are passed to PROG
Any number of OUTPUT,DESIRED pairs may be used.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "ylwrap $scriptversion"
exit $?
;;
esac
# The input.
input=$1
shift
# We'll later need for a correct munging of "#line" directives.
input_sub_rx=`get_dirname "$input" | quote_for_sed`
case $input in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
input=`pwd`/$input
;;
esac
input_rx=`get_dirname "$input" | quote_for_sed`
# Since DOS filename conventions don't allow two dots,
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot=false
if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot=true
fi
# The parser itself, the first file, is the destination of the .y.c
# rule in the Makefile.
parser=$1
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
# instance, we rename #include "y.tab.h" into #include "parse.h"
# during the conversion from y.tab.c to parse.c.
sed_fix_filenames=
# Also rename header guards, as Bison 2.7 for instance uses its header
# guard in its implementation file.
sed_fix_header_guards=
while test $# -ne 0; do
if test x"$1" = x"--"; then
shift
break
fi
from=$1
# Handle y_tab.c and y_tab.h output by DOS
if $y_tab_nodot; then
case $from in
"y.tab.c") from=y_tab.c;;
"y.tab.h") from=y_tab.h;;
esac
fi
shift
to=$1
shift
sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
done
# The program to run.
prog=$1
shift
# Make any relative path in $prog absolute.
case $prog in
[\\/]* | ?:[\\/]*) ;;
*[\\/]*) prog=`pwd`/$prog ;;
esac
dirname=ylwrap$$
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
mkdir $dirname || exit 1
cd $dirname
case $# in
0) "$prog" "$input" ;;
*) "$prog" "$@" "$input" ;;
esac
ret=$?
if test $ret -eq 0; then
for from in *
do
to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
if test -f "$from"; then
# If $2 is an absolute path name, then just use that,
# otherwise prepend '../'.
case $to in
[\\/]* | ?:[\\/]*) target=$to;;
*) target=../$to;;
esac
# Do not overwrite unchanged header files to avoid useless
# recompilations. Always update the parser itself: it is the
# destination of the .y.c rule in the Makefile. Divert the
# output of all other files to a temporary file so we can
# compare them to existing versions.
if test $from != $parser; then
realtarget=$target
target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
fi
# Munge "#line" or "#" directives. Don't let the resulting
# debug information point at an absolute srcdir. Use the real
# output file name, not yy.lex.c for instance. Adjust the
# include guards too.
sed -e "/^#/!b" \
-e "s|$input_rx|$input_sub_rx|" \
-e "$sed_fix_filenames" \
-e "$sed_fix_header_guards" \
"$from" >"$target" || ret=$?
# Check whether files must be updated.
if test "$from" != "$parser"; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$to is unchanged"
rm -f "$target"
else
echo "updating $to"
mv -f "$target" "$realtarget"
fi
fi
else
# A missing file is only an error for the parser. This is a
# blatant hack to let us support using "yacc -d". If -d is not
# specified, don't fail when the header file is "missing".
if test "$from" = "$parser"; then
ret=1
fi
fi
done
fi
# Remove the directory.
cd ..
rm -rf $dirname
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

19626
include/libconfig-1.7.3/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(libconfig, 1.7.3, hyperrealm@gmail.com, libconfig,
[https://hyperrealm.github.io/libconfig/])
AC_CONFIG_AUX_DIR([aux-build])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(ac_config.h)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_MSG_NOTICE([libconfig - made with pride in Colorado])
sleep 3
AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
# Enable GNU extensions.
AC_GNU_SOURCE
LT_INIT()
dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AM_PROG_LEX
if test Z"$LEX" != Zflex; then
cat <<EOF
*******************************************************************
You do not seem to have flex. While flex is not required to build
libconfig, you may need it to regenerate the lexer if you change
the scanner.l file.
*******************************************************************
EOF
fi
AC_PROG_YACC
if test Z"$YACC" != "Zbison -y"; then
cat <<EOF
*******************************************************************
You do not seem to have bison. While bison is not required to build
libconfig, you may need it to regenerate the parser if you change
the grammar.y file.
*******************************************************************
EOF
fi
AC_MSG_CHECKING([for compiler switch to enable full C/C++ warnings]);
dnl Checks for libraries
dnl Enable warnings, if we can determine an appropriate switch...
case "${CC}" in
gcc)
warn_c_sw="-Wall -Wshadow -Wextra -Wdeclaration-after-statement -Wno-unused-parameter"
warn_cxx_sw="-Wall -Wshadow -Wextra -Wno-unused-parameter";;
*)
warn_cxx_sw=""
warn_c_sw="";;
esac
if test -n "${warn_c_sw}";
then
CFLAGS="${CFLAGS} ${warn_c_sw}";
CXXFLAGS="${CXXFLAGS} ${warn_cxx_sw}";
AC_MSG_RESULT([${warn_c_sw}, ${warn_cxx_sw}])
else
AC_MSG_RESULT([(cannot determine)])
fi;
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h stdint.h xlocale.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl Checks for functions
AC_CHECK_FUNCS([newlocale uselocale freelocale])
dnl Package options
docxx=yes
AC_ARG_ENABLE(cxx,
AS_HELP_STRING([--disable-cxx], [Disable building of the C++ library]),
[if test "$enableval" = "no"; then docxx="no"; fi],
[
docxx=yes
]
)
AM_CONDITIONAL(BUILDCXX, test x$docxx = xyes)
dodoc=yes
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc], [Disable building of the documentation]),
[if test "$enableval" = "no"; then dodoc="no"; fi],
[
dodoc=yes
]
)
AM_CONDITIONAL(BUILDDOC, test x$dodoc = xyes)
doexamples=yes
AC_ARG_ENABLE(examples,
AS_HELP_STRING([--disable-examples], [Disable building of the example programs]),
[if test "$enableval" = "no"; then doexamples="no"; fi],
[
doexamples=yes
]
)
AM_CONDITIONAL(BUILDEXAMPLES, test x$doexamples = xyes)
dotests=yes
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests], [Disable building of the tests]),
[if test "$enableval" = "no"; then dotests="no"; fi],
[
dotests=yes
]
)
AM_CONDITIONAL(BUILDTESTS, test x$dotests = xyes)
dnl Check for MinGW. Workaround for libtool's DLL_EXPORT stupidity.
case "$target" in
*-*-cygwin* | *-*-mingw*)
gnuwin=yes;;
esac
AM_CONDITIONAL(GNU_WIN, test x$gnuwin = xyes)
dnl Checks for library functions.
AC_OUTPUT(
Makefile
lib/Makefile
lib/libconfig.pc
lib/libconfig++.pc
lib/libconfigConfig.cmake
lib/libconfig++Config.cmake
doc/Makefile
examples/Makefile
examples/c/Makefile
examples/c++/Makefile
tinytest/Makefile
tests/Makefile
libconfig.spec
)

View File

@ -0,0 +1,3 @@
These files are not maintained by me; they are user
contributions. They are not guaranteed to work with this release of
libconfig.

View File

@ -0,0 +1,60 @@
# Method Chained libconfig #
**Exception free + header only + method chained + config files**
Provides reading the configuration and defining the configuration specification at once.
### Features ###
* default values
* limits (min/max)
* mandatory/optional values
* help text output for expected config format on specification violation
* capturing and outputting expected configuration specification/defaults
While it is possible to write a config file with this extension using the configuration specification capturing feature, it is not intended to be used as a full fledged config writer.
### Example ###
```C++
#include <libconfig_chained.h>
using namespace std;
using namespace libconfig;
int main(int argc, char **argv)
{
Config cfg;
cfg.readFile("example.cfg");
ChainedSetting cs(cfg.getRoot());
string name = cs["name"].defaultValue("<name>").isMandatory();
string abstract = cs["abstract"].defaultValue("<unknown>");
double longitude = cs["longitude"].min(-180.0).max(180.0).isMandatory();
double latitude = cs["latitude"].min(-90.0).max(90.0).isMandatory();
if (cs.isAnyMandatorySettingMissing())
{
cerr << "Cannot proceed until all mandatory settings are set." << endl;
}
}
```
Console Output:
```sh
'longitude' setting is out of valid bounds (max: 180). Value was: 1200.35
Missing 'latitude' setting in configuration file.
Cannot proceed until all mandatory settings are set.
```
---
### How to integrate into your project ###
1. Link the libconfig++.[lib/la/a] library as usual (see standard use of libconfig++).
* Replace any includes of libconfig.h++ by libconfig_chained.h.
* Use method chained candy as displayed above.
---
Create an issue for any questions or suggestions. Alternatively email me at github [at) hemofektik.de

View File

@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/")
project (ChainedLibconfigExample)
file(GLOB SOURCES *.cpp *.h ../*.h ../*.md)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else()
find_package(libconfig)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
include_directories(
${CMAKE_SOURCE_DIR}/../../../lib/
)
if(MSVC)
link_libraries (
${CMAKE_SOURCE_DIR}/../../../Debug/libconfig++.lib
)
else()
link_libraries (
${LIBCONFIG_LIBRARY}
)
endif()
add_executable (
ChainedLibconfigExample
# WIN32 # Only if you don't want the DOS prompt to appear in the background in Windows
# MACOSX_BUNDLE
${SOURCES} # We could've listed the source files here directly instead of using a variable to store them
#${INCLUDES}
)

View File

@ -0,0 +1,7 @@
@echo off
rmdir sln /S/Q
mkdir sln
cd sln
cmake -G "Visual Studio 15 2017" ..
pause

View File

@ -0,0 +1,43 @@
### Running the examples ###
Expected Console Output:
```C++
<<< Example 1 >>>
'longitude' setting is out of valid bounds (max: 180). Value was: 1200.35
Missing 'latitude' setting in configuration file.
Cannot proceed until all mandatory settings are set.
<<< Example 2 >>>
TITLE AUTHOR PRICE QTY
Treasure Island Robert Louis Stevenson $ 29.99 5
Snow Crash Neal Stephenson $ 9.99 8
<<< Example 3 >>>
'longitude' setting is out of valid bounds (max: 180). Value was: 1200.35
Missing 'latitude' setting in configuration file.
Cannot proceed until all mandatory settings are set.
Expected Config Layout:
// -- begin --
name = "<name>";
abstract = "<unknown>";
longitude = 0.0;
latitude = 0.0;
inventory =
{
movies = ( );
books = (
{
title = "bookXYZ";
} );
};
// --- end ---
```

View File

@ -0,0 +1,52 @@
// An example configuration file that stores information about a store.
// Basic store information:
name = "Books, Movies & More";
longitude = 1200.345678;
// Store inventory:
inventory =
{
books = ( { title = "Treasure Island";
author = "Robert Louis Stevenson";
price = 29.99;
qty = 5; },
{ title = "Snow Crash";
author = "Neal Stephenson";
price = 9.99;
qty = 8; },
{ title = "Das Kapital";
price = 0.0;
qty = 100000; }
);
movies = ( { title = "Brazil";
media = "DVD";
price = 19.99;
qty = 11; },
{ title = "The City of Lost Children";
media = "DVD";
price = 18.99;
qty = 5; },
{ title = "Memento";
media = "Blu-Ray";
price = 24.99;
qty = 20;
},
{ title = "Howard the Duck"; }
);
};
// Store hours:
hours =
{
mon = { open = 9; close = 18; };
tue = { open = 9; close = 18; };
wed = { open = 9; close = 18; };
thu = { open = 9; close = 18; };
fri = { open = 9; close = 20; };
sat = { open = 9; close = 20; };
sun = { open = 11; close = 16; };
};
lost_bag = ( 1234.5678, "Napkin", [1, 2, 3] );

View File

@ -0,0 +1,52 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
libconfig chained - Extension for reading the configuration and defining
the configuration specification at once.
Copyright (C) 2016 Richard Schubert
This file is part of libconfig contributions.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "../libconfig_chained.h"
using namespace std;
using namespace libconfig;
// This example reads basic information from config file
// and reacts on missing mandatory values.
void example1(Config& cfg)
{
ChainedSetting cs(cfg.getRoot());
string name = cs["name"].defaultValue("<name>").isMandatory();
string abstract = cs["abstract"].defaultValue("<unknown>");
double longitude = cs["longitude"].min(-180.0).max(180.0).isMandatory();
double latitude = cs["latitude"].min(-90.0).max(90.0).isMandatory();
if (cs.isAnyMandatorySettingMissing())
{
cerr << "Cannot proceed until all mandatory settings are set." << endl;
return;
}
// from here on all read config values are valid
}

View File

@ -0,0 +1,71 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
libconfig chained - Extension for reading the configuration and defining
the configuration specification at once.
Copyright (C) 2016 Richard Schubert
This file is part of libconfig contributions.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "../libconfig_chained.h"
using namespace std;
using namespace libconfig;
// This example reads complex types from config file using method chains.
void example2(Config& cfg)
{
ChainedSetting cs(cfg.getRoot());
auto books = cs["inventory"]["books"];
if (!books.exists())
{
cerr << "No book section available." << endl;
return;
}
cout << setw(30) << left << "TITLE" << " "
<< setw(30) << left << "AUTHOR" << " "
<< setw(6) << left << "PRICE" << " "
<< "QTY"
<< endl;
const int count = books.getLength();
for(int i = 0; i < count; ++i)
{
auto book = books[i];
string title = book["title"];
string author = book["author"];
double price = book["price"].min(0.0);
int qty = book["qty"].min(0);
// Only output the record if all of the expected fields are present.
if(book.isAnySettingMissing()) continue;
cout << setw(30) << left << title << " "
<< setw(30) << left << author << " "
<< '$' << setw(6) << right << price << " "
<< qty
<< endl;
}
}

View File

@ -0,0 +1,66 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
libconfig chained - Extension for reading the configuration and defining
the configuration specification at once.
Copyright (C) 2016 Richard Schubert
This file is part of libconfig contributions.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "../libconfig_chained.h"
using namespace std;
using namespace libconfig;
// This example reads basic information from config file
// and prints out the expected configuration specification.
void example3(Config& cfg)
{
ChainedSetting cs(cfg.getRoot());
Config tmpCfgSpec;
tmpCfgSpec.setOptions(Config::OptionOpenBraceOnSeparateLine | Config::OptionSemicolonSeparators);
tmpCfgSpec.setTabWidth(3);
cs.captureExpectedSpecification(&tmpCfgSpec);
string name = cs["name"].defaultValue("<name>").isMandatory();
string abstract = cs["abstract"].defaultValue("<unknown>");
double longitude = cs["longitude"].min(-180.0).max(180.0).isMandatory();
double latitude = cs["latitude"].min(-90.0).max(90.0).isMandatory();
ChainedSetting movie0 = cs["inventory"]["movies"][0];
string book0tile = cs["inventory"]["books"][0]["title"].defaultValue("bookXYZ");
if (cs.isAnyMandatorySettingMissing())
{
cerr << "Cannot proceed until all mandatory settings are set." << endl << endl;
auto cfgSpec = cs.getCapturedSpecification("tmpCfgSpec.cfg");
cerr << "Expected Config Layout: " << endl << endl;
cerr << "// -- begin --" << endl;
cerr << cfgSpec;
cerr << "// --- end ---" << endl << endl;
return;
}
// from here on all read config values are valid
}

View File

@ -0,0 +1,69 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
libconfig chained - Extension for reading the configuration and defining
the configuration specification at once.
Copyright (C) 2016 Richard Schubert
This file is part of libconfig contributions.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <libconfig.h++>
using namespace std;
using namespace libconfig;
// This is the main entry point for all examples.
// The examples will be called consecutively.
void example1(Config& cfg);
void example2(Config& cfg);
void example3(Config& cfg);
int main(int argc, char **argv)
{
Config cfg;
// Read the file. If there is an error, report it and exit.
try
{
cfg.readFile("../example.cfg");
}
catch(const FileIOException&)
{
std::cerr << "I/O error while reading file. " << std::endl;
return(EXIT_FAILURE);
}
catch(const ParseException& pex)
{
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
<< " - " << pex.getError() << std::endl;
return(EXIT_FAILURE);
}
cout << endl << endl << "<<< Example 1 >>>" << endl << endl;
example1(cfg);
cout << endl << endl << "<<< Example 2 >>>" << endl << endl;
example2(cfg);
cout << endl << endl << "<<< Example 3 >>>" << endl << endl;
example3(cfg);
return(EXIT_SUCCESS);
}

View File

@ -0,0 +1,542 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
libconfig chained - Extension for reading the configuration and defining
the configuration specification at once.
Copyright (C) 2016 Richard Schubert
This file is part of libconfig contributions.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
#pragma once
#ifndef _CHAINED_LIBCONFIG_H_
#define _CHAINED_LIBCONFIG_H_
#include <libconfig.h++>
#include <cassert>
#include <fstream>
#include <sstream>
#include <iostream>
namespace libconfig
{
class ChainedSetting
{
struct Variant
{
private:
bool isSet;
Setting::Type type;
bool value_bool;
int64_t value_int;
double value_float;
std::string value_string;
public:
Variant()
: isSet(false)
, type(Setting::TypeNone)
{
}
Variant(bool value)
{
value_bool = value;
isSet = true;
type = Setting::TypeBoolean;
}
Variant(int32_t value)
{
value_int = value;
isSet = true;
type = Setting::TypeInt;
}
Variant(int64_t value)
{
value_int = value;
isSet = true;
type = Setting::TypeInt64;
}
Variant(double value)
{
value_float = value;
isSet = true;
type = Setting::TypeFloat;
}
Variant(std::string& value)
{
value_string = value;
isSet = true;
type = Setting::TypeString;
}
Variant(const char* value)
{
value_string = value;
isSet = true;
type = Setting::TypeString;
}
operator bool() const { return value_bool; }
operator int() const { return (int)value_int; }
operator unsigned int() const { return (unsigned int)value_int; }
operator long() const { return (long)value_int; }
operator unsigned long() const { return (unsigned long)value_int; }
operator long long() const { return (long long)value_int; }
operator unsigned long long() const { return (unsigned long long)value_int; }
operator double() const { return value_float; }
operator float() const { return (float)value_float; }
operator std::string() const { return value_string; }
const bool IsSet() const
{
return isSet;
}
const Setting::Type GetType() const
{
return type;
}
};
public:
// Starting point for method chained libconfig.
// Pass a custom ostream to intercept any error messages (useful for Applications with UI).
ChainedSetting(Setting& setting, std::ostream& err = std::cerr)
: name(setting.isRoot() ? "<root>" : (setting.getName() ? setting.getName() : ""))
, index(setting.getIndex())
, parent(NULL)
, setting(&setting)
, err(err)
, isSettingMandatory(false)
, anySettingIsMissing(false)
, anyMandatorySettingIsMissing(false)
, capturedSpecification(NULL)
, capturedSetting(NULL)
{
}
// Starts capturing any configuration readings into the temporary config object.
void captureExpectedSpecification(Config* temporaryConfigSpecification)
{
capturedSpecification = temporaryConfigSpecification;
capturedSetting = &capturedSpecification->getRoot();
}
// Returns the captured configuration specification,
// premised captureExpectedSpecification() was called earlier.
// The path parameter is needed to write the configuration
// to disk before it can be read into a usable string.
std::string getCapturedSpecification(const std::string& tempFilePath)
{
try
{
capturedSpecification->writeFile(tempFilePath.c_str());
}
catch (const FileIOException&)
{
err << "I/O error while writing temporary setting file: " << tempFilePath << std::endl;
return "";
}
std::ifstream t(tempFilePath);
if (!t.is_open())
{
err << "I/O error while reading temporary setting file: " << tempFilePath << std::endl;
return "";
}
std::stringstream buffer;
buffer << t.rdbuf();
capturedSpecification = NULL;
return buffer.str();
}
// Defines the default value for this setting if missing from config file.
template<typename T>
ChainedSetting& defaultValue(T defaultValue)
{
defaultVal = defaultValue;
return *this;
}
// Defines the inclusive minimum value for this setting.
// A lesser value set in a configuration file will be clamped to this limit.
template<typename T>
ChainedSetting& min(T min)
{
minVal = min;
return *this;
}
// Defines the inclusive maximum value for this setting.
// A greater value set in a configuration file will be clamped to this limit.
template<typename T>
ChainedSetting& max(T max)
{
maxVal = max;
return *this;
}
// Defines this setting to be mandatory.
// Any mandatory value missing in the configuration file will raise an error.
// Use isAnyMandatorySettingMissing() to check for any violations.
ChainedSetting& isMandatory()
{
isSettingMandatory = true;
if (parent) parent->isMandatory();
return *this;
}
template<typename T>
operator T()
{
auto requestedType = GetRequestedType<T>();
CheckType(defaultVal, requestedType);
CheckType(minVal, requestedType);
CheckType(maxVal, requestedType);
CaptureSetting<T>(requestedType);
if (!setting)
{
if (isSettingMandatory)
{
AlertMandatorySettingMissing<T>();
}
PropagateAnySettingIsMissing();
return GetDefaultValue<T>();
}
try
{
T value = *setting;
if (minVal.IsSet())
{
T min = minVal;
if (value < min)
{
err << "'" << setting->getPath() << "' setting is out of valid bounds (min: " << min << "). Value was: " << value << std::endl;
value = min;
}
}
if (maxVal.IsSet())
{
T max = maxVal;
if (value > max)
{
err << "'" << setting->getPath() << "' setting is out of valid bounds (max: " << max << "). Value was: " << value << std::endl;
value = max;
}
}
return value;
}
catch (const SettingTypeException& tex)
{
err << "'" << tex.getPath() << "' setting is of wrong type." << std::endl;
}
return GetDefaultValue<T>();
}
ChainedSetting operator[](const char *name)
{
CaptureSetting<Setting>(Setting::TypeGroup);
if (!setting)
{
return ChainedSetting(name, this);
}
if(setting->exists(name))
{
return ChainedSetting((*setting)[name], this);
}
else
{
return ChainedSetting(name, this);
}
}
inline ChainedSetting operator[](const std::string &name)
{
return(operator[](name.c_str()));
}
ChainedSetting operator[](int index)
{
// This could also be an TypeArray but we cannot be sure here.
// By using TypeList we ensure it will always work.
CaptureSetting<Setting>(Setting::TypeList);
if (!setting)
{
return ChainedSetting(index, this);
}
if (index >= 0 && index < setting->getLength())
{
return ChainedSetting((*setting)[index], this);
}
else
{
return ChainedSetting(index, this);
}
}
int getLength() const
{
return setting ? setting->getLength() : 0;
}
Setting::Type getType() const
{
return setting ? setting->getType() : Setting::TypeNone;
}
// Indicates whether this setting is present in the read configuration file.
bool exists() const
{
return setting != NULL;
}
bool isAnyMandatorySettingMissing() const
{
return anyMandatorySettingIsMissing;
}
bool isAnySettingMissing() const
{
return anySettingIsMissing;
}
void clearAnySettingMissingFlag()
{
anySettingIsMissing = false;
}
private:
ChainedSetting(Setting& setting, ChainedSetting* parent)
: name(setting.isRoot() ? "<root>" : (setting.getName() ? setting.getName() : ""))
, index(setting.getIndex())
, parent(parent)
, setting(&setting)
, err(parent->err)
, isSettingMandatory(false)
, anySettingIsMissing(false)
, anyMandatorySettingIsMissing(false)
, capturedSpecification(NULL)
, capturedSetting(NULL)
{
}
ChainedSetting(const std::string& name, ChainedSetting* parent)
: name(name)
, index(-1)
, parent(parent)
, setting(NULL)
, err(parent->err)
, isSettingMandatory(false)
, anySettingIsMissing(true)
, anyMandatorySettingIsMissing(false)
, capturedSpecification(NULL)
, capturedSetting(NULL)
{
}
ChainedSetting(int index, ChainedSetting* parent)
: name("")
, index(index)
, parent(parent)
, setting(NULL)
, err(parent->err)
, isSettingMandatory(false)
, anySettingIsMissing(true)
, anyMandatorySettingIsMissing(false)
, capturedSpecification(NULL)
, capturedSetting(NULL)
{
}
template<typename T>
void ConditionalSetCapturedDefaultValue()
{
*capturedSetting = GetDefaultValue<T>();
}
template<typename T>
void CaptureSetting(Setting::Type type)
{
if (!capturedSetting && parent && parent->capturedSetting)
{
if (name.length() > 0)
{
if (!parent->capturedSetting->exists(name))
{
capturedSetting = &parent->capturedSetting->add(name, type);
}
else
{
capturedSetting = &(*parent->capturedSetting)[name.c_str()];
}
}
else
{
if (index < parent->capturedSetting->getLength())
{
capturedSetting = &(*parent->capturedSetting)[0];
}
else
{
assert(index == parent->capturedSetting->getLength()); // you requested an index while omitting at least one of its previous siblings
capturedSetting = &parent->capturedSetting->add(type);
}
}
ConditionalSetCapturedDefaultValue<T>();
}
}
std::string GetPath() const
{
if (setting)
{
return setting->getPath();
}
std::string path = (name.length() > 0) ? name : "[" + std::to_string(index) + "]";
if (parent)
{
auto parentPath = parent->GetPath();
return (parentPath.length() > 0) ? (parentPath + ((name.length() == 0) ? "" : ".") + path) : path;
}
return path;
}
void PropagateAnySettingIsMissing()
{
anySettingIsMissing = true;
if (parent)
{
parent->PropagateAnySettingIsMissing();
}
}
void PropagateAnyMandatorySettingIsMissing()
{
anyMandatorySettingIsMissing = true;
if (parent)
{
parent->PropagateAnyMandatorySettingIsMissing();
}
}
template<typename T>
void AlertMandatorySettingMissing()
{
PropagateAnyMandatorySettingIsMissing();
err << "Missing '" << GetPath() << "' setting in configuration file." << std::endl;
}
template<typename T>
T GetUnsetDefaultValue() const
{
return (T)0;
}
template<typename T>
T GetDefaultValue() const
{
if (defaultVal.IsSet())
{
return (T)defaultVal;
}
return GetUnsetDefaultValue<T>();
}
template<typename T>
Setting::Type GetRequestedType() const
{
// TODO @ Hemofektik: Check whether the outcommented line is still needed. static_assert(false) is checked on compile time and, well, asserts :)
// static_assert(false, "should never happen, unless you requested an unsupported type");
return Setting::TypeNone;
}
void CheckType(const Variant& variant, Setting::Type expectedType) const
{
if (!variant.IsSet()) return;
if(expectedType != variant.GetType())
{
assert(false); // fix your code to match the whole chain of this setting to one single type!
err << "'" << GetPath() << "' setting limits or default value is of incompatible type." << std::endl;
}
}
std::string name;
int index;
ChainedSetting* parent;
Setting* setting;
std::ostream& err;
Variant defaultVal;
Variant minVal;
Variant maxVal;
bool isSettingMandatory;
bool anySettingIsMissing;
bool anyMandatorySettingIsMissing;
Config* capturedSpecification;
Setting* capturedSetting;
};
template<>
inline
void ChainedSetting::ConditionalSetCapturedDefaultValue<Setting>() { }
template<>
inline
std::string ChainedSetting::GetUnsetDefaultValue() const
{
return "";
}
template<> inline Setting::Type ChainedSetting::GetRequestedType<int8_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<uint8_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<int16_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<uint16_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<int32_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<uint32_t>() const { return Setting::TypeInt; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<int64_t>() const { return Setting::TypeInt64; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<uint64_t>() const { return Setting::TypeInt64; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<float>() const { return Setting::TypeFloat; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<double>() const { return Setting::TypeFloat; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<std::string>() const { return Setting::TypeString; }
template<> inline Setting::Type ChainedSetting::GetRequestedType<bool>() const { return Setting::TypeBoolean; }
}
#endif

View File

@ -0,0 +1,5 @@
#!/bin/bash
mkdir release
cd release
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release ..

View File

@ -0,0 +1,4 @@
#!/bin/bash
cd release
make

View File

@ -0,0 +1,36 @@
SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_C_COMPILER_ARG1 "")
SET(CMAKE_C_COMPILER_ID "GNU")
SET(CMAKE_C_PLATFORM_ID "Linux")
SET(CMAKE_AR "/usr/bin/ar")
SET(CMAKE_RANLIB "/usr/bin/ranlib")
SET(CMAKE_COMPILER_IS_GNUCC 1)
SET(CMAKE_C_COMPILER_LOADED 1)
SET(CMAKE_COMPILER_IS_MINGW )
SET(CMAKE_COMPILER_IS_CYGWIN )
IF(CMAKE_COMPILER_IS_CYGWIN)
SET(CYGWIN 1)
SET(UNIX 1)
ENDIF(CMAKE_COMPILER_IS_CYGWIN)
SET(CMAKE_C_COMPILER_ENV_VAR "CC")
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_C_COMPILER_ID_RUN 1)
SET(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
SET(CMAKE_C_SIZEOF_DATA_PTR "4")
SET(CMAKE_C_COMPILER_ABI "ELF")
IF(CMAKE_C_SIZEOF_DATA_PTR)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
ENDIF(CMAKE_C_SIZEOF_DATA_PTR)
IF(CMAKE_C_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
ENDIF(CMAKE_C_COMPILER_ABI)

View File

@ -0,0 +1,36 @@
SET(CMAKE_CXX_COMPILER "/usr/bin/c++")
SET(CMAKE_CXX_COMPILER_ARG1 "")
SET(CMAKE_CXX_COMPILER_ID "GNU")
SET(CMAKE_CXX_PLATFORM_ID "Linux")
SET(CMAKE_AR "/usr/bin/ar")
SET(CMAKE_RANLIB "/usr/bin/ranlib")
SET(CMAKE_COMPILER_IS_GNUCXX 1)
SET(CMAKE_CXX_COMPILER_LOADED 1)
SET(CMAKE_COMPILER_IS_MINGW )
SET(CMAKE_COMPILER_IS_CYGWIN )
IF(CMAKE_COMPILER_IS_CYGWIN)
SET(CYGWIN 1)
SET(UNIX 1)
ENDIF(CMAKE_COMPILER_IS_CYGWIN)
SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_CXX_COMPILER_ID_RUN 1)
SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm)
SET(CMAKE_CXX_LINKER_PREFERENCE 30)
# Save compiler ABI information.
SET(CMAKE_CXX_SIZEOF_DATA_PTR "4")
SET(CMAKE_CXX_COMPILER_ABI "ELF")
IF(CMAKE_CXX_SIZEOF_DATA_PTR)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
ENDIF(CMAKE_CXX_SIZEOF_DATA_PTR)
IF(CMAKE_CXX_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
ENDIF(CMAKE_CXX_COMPILER_ABI)

View File

@ -0,0 +1,15 @@
SET(CMAKE_SYSTEM "Linux-2.6.31-20-generic-pae")
SET(CMAKE_SYSTEM_NAME "Linux")
SET(CMAKE_SYSTEM_VERSION "2.6.31-20-generic-pae")
SET(CMAKE_SYSTEM_PROCESSOR "i686")
SET(CMAKE_HOST_SYSTEM "Linux-2.6.31-20-generic-pae")
SET(CMAKE_HOST_SYSTEM_NAME "Linux")
SET(CMAKE_HOST_SYSTEM_VERSION "2.6.31-20-generic-pae")
SET(CMAKE_HOST_SYSTEM_PROCESSOR "i686")
SET(CMAKE_CROSSCOMPILING "FALSE")
SET(CMAKE_SYSTEM_LOADED 1)

View File

@ -0,0 +1,182 @@
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
#elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom"
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
#elif defined(__HP_cc)
# define COMPILER_ID "HP"
#elif defined(__DECC)
# define COMPILER_ID "Compaq"
#elif defined(__IBMC__)
# define COMPILER_ID "VisualAge"
#elif defined(__PGI)
# define COMPILER_ID "PGI"
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
SHARC (21000) DSPs */
# define COMPILER_ID "ADSP"
/* IAR Systems compiler for embedded systems.
http://www.iar.com
Not supported yet by CMake
#elif defined(__IAR_SYSTEMS_ICC__)
# define COMPILER_ID "IAR" */
/* sdcc, the small devices C compiler for embedded systems,
http://sdcc.sourceforge.net */
#elif defined(SDCC)
# define COMPILER_ID "SDCC"
#elif defined(_COMPILER_VERSION)
# define COMPILER_ID "MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
# define PLATFORM_ID "IRIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
# define PLATFORM_ID "Haiku"
/* Haiku also defines __BEOS__ so we must
put it prior to the check for __BEOS__
*/
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#else /* unknown platform */
# define PLATFORM_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
void main() {}
#else
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
(void)argv;
return require;
}
#endif

View File

@ -0,0 +1,169 @@
/* This source file must have a .cpp extension so that all C++ compilers
recognize the extension without flags. Borland does not know .cxx for
example. */
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
#if defined(__COMO__)
# define COMPILER_ID "Comeau"
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
#elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom"
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
#elif defined(__HP_aCC)
# define COMPILER_ID "HP"
#elif defined(__DECCXX)
# define COMPILER_ID "Compaq"
#elif defined(__IBMCPP__)
# define COMPILER_ID "VisualAge"
#elif defined(__PGI)
# define COMPILER_ID "PGI"
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
SHARC (21000) DSPs */
# define COMPILER_ID "ADSP"
#elif defined(_COMPILER_VERSION)
# define COMPILER_ID "MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
# define PLATFORM_ID "IRIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
# define PLATFORM_ID "Haiku"
/* Haiku also defines __BEOS__ so we must
put it prior to the check for __BEOS__
*/
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#else /* unknown platform */
# define PLATFORM_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
(void)argv;
return require;
}

View File

@ -0,0 +1,22 @@
#cmake_minimum_required(VERSION 2.8)
PROJECT(libconfig_test_app)
add_subdirectory(src)
#add cmake script files
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_work")
#check if libconfig is present (FindConfig.cmake and FindConfig++.cmake files)
FIND_PACKAGE(Config REQUIRED)
FIND_PACKAGE(Config++ REQUIRED)
#add undelete support
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_work/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_work/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_work/cmake_uninstall.cmake")

View File

@ -0,0 +1,23 @@
FIND_PATH(CONFIG++_INCLUDE_DIR libconfig.h++ /usr/include /usr/local/include)
FIND_LIBRARY(CONFIG++_LIBRARY NAMES config++ PATH /usr/lib /usr/local/lib)
IF (CONFIG++_INCLUDE_DIR AND CONFIG++_LIBRARY)
SET(CONFIG++_FOUND TRUE)
ENDIF ( CONFIG++_INCLUDE_DIR AND CONFIG++_LIBRARY)
IF (CONFIG++_FOUND)
IF (NOT CONFIG++_FIND_QUIETLY)
MESSAGE(STATUS "Found Config++: ${CONFIG++_LIBRARY}")
ENDIF (NOT CONFIG++_FIND_QUIETLY)
ELSE(CONFIG++_FOUND)
IF (Config++_FIND_REQUIRED)
IF(NOT CONFIG++_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Could not find LibConfig++ header file!")
ENDIF(NOT CONFIG++_INCLUDE_DIR)
IF(NOT CONFIG++_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find LibConfig++ library file!")
ENDIF(NOT CONFIG++_LIBRARY)
ENDIF (Config++_FIND_REQUIRED)
ENDIF (CONFIG++_FOUND)

View File

@ -0,0 +1,23 @@
FIND_PATH(CONFIG_INCLUDE_DIR libconfig.h /usr/include /usr/local/include)
FIND_LIBRARY(CONFIG_LIBRARY NAMES config PATH /usr/lib /usr/local/lib)
IF (CONFIG_INCLUDE_DIR AND CONFIG_LIBRARY)
SET(CONFIG_FOUND TRUE)
ENDIF ( CONFIG_INCLUDE_DIR AND CONFIG_LIBRARY)
IF (CONFIG_FOUND)
IF (NOT CONFIG_FIND_QUIETLY)
MESSAGE(STATUS "Found Config: ${CONFIG_LIBRARY}")
ENDIF (NOT CONFIG_FIND_QUIETLY)
ELSE(CONFIG_FOUND)
IF (Config_FIND_REQUIRED)
IF(NOT CONFIG_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Could not find LibConfig header file!")
ENDIF(NOT CONFIG_INCLUDE_DIR)
IF(NOT CONFIG_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find LibConfig library file!")
ENDIF(NOT CONFIG_LIBRARY)
ENDIF (Config_FIND_REQUIRED)
ENDIF (CONFIG_FOUND)

View File

@ -0,0 +1,36 @@
# Copyright 2006-2008 The FLWOR Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)

View File

@ -0,0 +1,6 @@
PROJECT(libconfig_test_app)
ADD_EXECUTABLE(libconfig_test_app main.cpp)
target_link_libraries(libconfig_test_app config++)

View File

@ -0,0 +1,13 @@
#include <iostream>
#include <fstream>
#include <libconfig.h++>
using namespace std;
using namespace libconfig;
int main ( int argc, char **argv )
{
Config cfg;
return (0);
}

View File

@ -0,0 +1,161 @@
void config_setting_copy_simple(config_setting_t * parent, const config_setting_t * src);
void config_setting_copy_elem(config_setting_t * parent, const config_setting_t * src);
void config_setting_copy_aggregate(config_setting_t * parent, const config_setting_t * src);
int config_setting_copy(config_setting_t * parent, const config_setting_t * src);
void config_setting_copy_simple(config_setting_t * parent, const config_setting_t * src)
{
if(config_setting_is_aggregate(src))
{
config_setting_copy_aggregate(parent, src);
}
else
{
config_setting_t * set;
set = config_setting_add(parent, config_setting_name(src), config_setting_type(src));
if(CONFIG_TYPE_INT == config_setting_type(src))
{
config_setting_set_int(set, config_setting_get_int(src));
config_setting_set_format(set, src->format);
}
else if(CONFIG_TYPE_INT64 == config_setting_type(src))
{
config_setting_set_int64(set, config_setting_get_int64(src));
config_setting_set_format(set, src->format);
}
else if(CONFIG_TYPE_FLOAT == config_setting_type(src))
config_setting_set_float(set, config_setting_get_float(src));
else if(CONFIG_TYPE_STRING == config_setting_type(src))
config_setting_set_string(set, config_setting_get_string(src));
else if(CONFIG_TYPE_BOOL == config_setting_type(src))
config_setting_set_bool(set, config_setting_get_bool(src));
}
}
void config_setting_copy_elem(config_setting_t * parent, const config_setting_t * src)
{
config_setting_t * set;
set = NULL;
if(config_setting_is_aggregate(src))
config_setting_copy_aggregate(parent, src);
else if(CONFIG_TYPE_INT == config_setting_type(src))
{
set = config_setting_set_int_elem(parent, -1, config_setting_get_int(src));
config_setting_set_format(set, src->format);
}
else if(CONFIG_TYPE_INT64 == config_setting_type(src))
{
set = config_setting_set_int64_elem(parent, -1, config_setting_get_int64(src));
config_setting_set_format(set, src->format);
}
else if(CONFIG_TYPE_FLOAT == config_setting_type(src))
set = config_setting_set_float_elem(parent, -1, config_setting_get_float(src));
else if(CONFIG_TYPE_STRING == config_setting_type(src))
set = config_setting_set_string_elem(parent, -1, config_setting_get_string(src));
else if(CONFIG_TYPE_BOOL == config_setting_type(src))
set = config_setting_set_bool_elem(parent, -1, config_setting_get_bool(src));
}
void config_setting_copy_aggregate(config_setting_t * parent, const config_setting_t * src)
{
config_setting_t * newAgg;
int i, n;
newAgg = config_setting_add(parent, config_setting_name(src), config_setting_type(src));
n = config_setting_length(src);
for(i = 0; i < n; i++)
{
if(config_setting_is_group(src))
{
config_setting_copy_simple(newAgg, config_setting_get_elem(src, i));
}
else
{
config_setting_copy_elem(newAgg, config_setting_get_elem(src, i));
}
}
}
int config_setting_copy(config_setting_t * parent, const config_setting_t * src)
{
if((!config_setting_is_group(parent)) &&
(!config_setting_is_list(parent)))
return CONFIG_FALSE;
if(config_setting_is_aggregate(src))
{
config_setting_copy_aggregate(parent, src);
}
else
{
config_setting_copy_simple(parent, src);
}
return CONFIG_TRUE;
}
//Some sample code
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
//-----------------------------------------------------------------------------
{
config_t cfgSrc;
config_t cfgSrcCopy;
config_t cfgDst;
config_init(&cfgSrc);
config_init(&cfgSrcCopy);
config_init(&cfgDst);
if(CONFIG_FALSE == config_read_file(&cfgSrc, "/data/menu/cfgSrc.cfg"))
{
fprintf(stderr, "Failed to open cfgSrc.cfg\n");
}
if(CONFIG_FALSE == config_read_file(&cfgDst, "/data/menu/cfgDst.cfg"))
{
fprintf(stderr, "Failed to open cfgDst.cfg\n");
}
/*
printf("Dump cfgSrc.cfg\n");
DumpCfgSetting(config_root_setting(&cfgSrc));
printf("Dump cfgDst.cfg\n");
DumpCfgSetting(config_root_setting(&cfgDst));
*/
config_setting_t * src;
config_setting_t * dst;
dst = config_lookup(&cfgDst, "grp1");
if((0 != (dst = config_lookup(&cfgDst, "grp1"))) &&
(0 != (src = config_lookup(&cfgSrc, "application.window"))))
//(0 != (src = config_lookup(&cfgSrc, "list"))))
{
if(CONFIG_FALSE == config_setting_copy(dst, src))
{
printf("Failed to copy src to dst\n");
}
}
config_setting_copy(config_root_setting(&cfgSrcCopy), config_root_setting(&cfgSrc));
config_write_file(&cfgDst, "/data/menu/cfgDstMod.cfg");
config_write_file(&cfgSrcCopy, "/data/menu/cfgSrcCpy.cfg");
config_write_file(&cfgSrc, "/data/menu/cfgSrcOrig.cfg");
config_destroy(&cfgSrc);
config_destroy(&cfgDst);
return 0;
}

View File

@ -0,0 +1,76 @@
# << Usage >>
# you can feed this README to irb and see the result
# $ irb README
# IMPORTANT NOTICE:
# be careful with big *fixnum* (plain int) values in configs
# int is 32 bit, but ruby fixnum is only 31!
# For example, 2100000000 will be read as -47483648.
require 'rconfig'
c = Config.new
c.read!('test.cfg')
# => IOError
c.read('test.cfg')
# => false
p c['some_var']
# => SettingNotFoundError
# note: Config#lookup is alias for Config#[]
c.append 'fixnum', Config::Fixnum.new(150)
# #<Config::Fixnum...>
f1 = Config::Fixnum.new(1)
c.append 'another_fixnum', f1
f2 = Config::Fixnum.new(256)
c.append 'next_fixnum', f2
p c.size
# => 3
c.delete(f1) # by element
c.delete(0) # by index
c.delete('next_fixnum') # by name
# note: (at now) you cannot delete nested elements by Config#delete
# you can do c['nested.element'].parent.delete(c['nested.element'])
p c.size
# => 0
l = Config::List.new
c.append 'the_list', l
l.append Config::String.new("abcdef")
l << Config::Float.new(3.14)
# note: Config::List#append and Config::Array#append both have
# aliases Config::[Aggregate]#<<
p l.name
# => "the_list"
p l.index
# => 0
p l.root?
# => false
p l.size
# => 3
l[0].format = Config::FORMAT_HEX
p l[1].value
# => 3.14
l[1].value = 2.71828
c.write 'test.cfg'
# you will get test.cfg with following contents:
#
# the_list = ( "abcdef", 2.71828, 0x2A );
#

View File

@ -0,0 +1,17 @@
require 'rubygems'
require 'rubygems/package_task'
spec = Gem::Specification.new do |s|
s.name = "rconfig"
s.version = "1.0.1"
s.author = "Peter Zotov"
s.email = "whitequark@whitequark.ru"
s.platform = Gem::Platform::RUBY
s.summary = "libconfig bindings"
s.files = [ File.join('ext', 'extconf.rb'), File.join('ext', 'rconfig.c') ].to_a
s.extensions = 'ext/extconf.rb'
end
Gem::PackageTask.new(spec) do |pkg|
end

View File

@ -0,0 +1,11 @@
#!/usr/bin/ruby
require "mkmf"
unless pkg_config('libconfig')
puts 'failure: need libconfig'
exit 1
end
have_func('rb_block_call', 'ruby/ruby.h')
create_makefile("rconfig")

View File

@ -0,0 +1,700 @@
#include <ruby.h>
#include <libconfig.h>
static VALUE cConfig, cConfigBaseSetting, cConfigSetting, cConfigAggregate;
static VALUE cConfigFormatDefault, cConfigFormatHex;
static VALUE cConfigFixnum, cConfigBignum, cConfigFloat, cConfigBoolean, cConfigString;
static VALUE cConfigGroup, cConfigList, cConfigArray;
static VALUE rSettingNameRegexp;
static VALUE aConfigSettings, aConfigScalars, aConfigAggregates;
static VALUE eConfigParseError, eSettingNotFoundError, eSettingFormatError, eSettingNameError;
static VALUE rconfig_wrap_value(config_setting_t* setting)
{
switch(config_setting_type(setting)) {
case CONFIG_TYPE_INT:
return LONG2FIX(config_setting_get_int(setting));
case CONFIG_TYPE_INT64:
return rb_ll2inum(config_setting_get_int64(setting));
case CONFIG_TYPE_FLOAT:
return rb_float_new(config_setting_get_float(setting));
case CONFIG_TYPE_STRING:
return rb_str_new2(config_setting_get_string(setting));
case CONFIG_TYPE_BOOL:
return config_setting_get_bool(setting) ? Qtrue : Qfalse;
default:
rb_bug("unknown value type %d", config_setting_type(setting));
}
}
static void rconfig_free_setting(config_setting_t* setting)
{
// dummy
}
static VALUE rconfig_prepare_setting(config_setting_t* setting)
{
VALUE wrapper = Data_Wrap_Struct(rb_cObject, 0, rconfig_free_setting, setting);
config_setting_set_hook(setting, (void*) wrapper);
return wrapper;
}
static void rconfig_destroy_setting(void* hook)
{
if(hook != NULL) {
VALUE wrapper = (VALUE) hook;
rb_iv_set(wrapper, "@setting", Qnil);
}
}
static VALUE rconfig_wrap_setting(config_setting_t* setting)
{
VALUE rbSetting = rconfig_prepare_setting(setting);
switch(config_setting_type(setting)) {
case CONFIG_TYPE_INT:
return rb_funcall(cConfigFixnum, rb_intern("new"), 2, LONG2FIX(config_setting_get_int(setting)), rbSetting);
case CONFIG_TYPE_INT64:
return rb_funcall(cConfigBignum, rb_intern("new"), 2, rb_ll2inum(config_setting_get_int64(setting)), rbSetting);
case CONFIG_TYPE_FLOAT:
return rb_funcall(cConfigFloat, rb_intern("new"), 2, rb_float_new(config_setting_get_float(setting)), rbSetting);
case CONFIG_TYPE_STRING:
return rb_funcall(cConfigString, rb_intern("new"), 2, rb_str_new2(config_setting_get_string(setting)), rbSetting);
case CONFIG_TYPE_BOOL:
return rb_funcall(cConfigBoolean, rb_intern("new"), 2, config_setting_get_bool(setting) ? Qtrue : Qfalse, rbSetting);
case CONFIG_TYPE_ARRAY:
return rb_funcall(cConfigArray, rb_intern("new"), 2, Qnil, rbSetting);
case CONFIG_TYPE_LIST:
return rb_funcall(cConfigList, rb_intern("new"), 1, rbSetting);
case CONFIG_TYPE_GROUP:
return rb_funcall(cConfigGroup, rb_intern("new"), 1, rbSetting);
default:
rb_bug("[r] unknown setting type %d", config_setting_type(setting));
}
}
static void rconfig_update_setting(config_setting_t* setting, VALUE value)
{
switch(config_setting_type(setting)) {
case CONFIG_TYPE_INT:
config_setting_set_int(setting, FIX2LONG(value));
break;
case CONFIG_TYPE_INT64:
if(TYPE(value) == T_BIGNUM)
config_setting_set_int64(setting, rb_big2ll(value));
else // T_FIXNUM
config_setting_set_int64(setting, FIX2INT(value));
break;
case CONFIG_TYPE_FLOAT:
// ruby1.9 check
#if HAVE_RB_BLOCK_CALL
config_setting_set_float(setting, RFLOAT_VALUE(value));
#else
config_setting_set_float(setting, RFLOAT_VALUE(value));
#endif
break;
case CONFIG_TYPE_STRING:
config_setting_set_string(setting, RSTRING_PTR(value));
break;
case CONFIG_TYPE_BOOL:
config_setting_set_bool(setting, value == Qtrue);
break;
default:
rb_bug("[w] unknown setting type %d", config_setting_type(setting));
}
}
static void rconfig_check_setting_type(VALUE object, VALUE value)
{
if(rb_obj_class(object) == cConfigFixnum) {
Check_Type(value, T_FIXNUM);
} else if(rb_obj_class(object) == cConfigBignum) {
if(TYPE(value) != T_BIGNUM && TYPE(value) != T_FIXNUM)
rb_raise(rb_eTypeError, "wrong argument type %s (expected Fixnum or Bignum)", rb_obj_classname(value));
} else if(rb_obj_class(object) == cConfigFloat) {
Check_Type(value, T_FLOAT);
} else if(rb_obj_class(object) == cConfigString) {
Check_Type(value, T_STRING);
} else if(rb_obj_class(object) == cConfigBoolean) {
if(value != Qtrue && value != Qfalse)
rb_raise(rb_eTypeError, "wrong argument type %s (expected boolean)", rb_obj_classname(value));
} else {
rb_raise(rb_eException, "never use Config::Setting itself");
}
}
static int rconfig_do_append(config_setting_t* setting, VALUE target, VALUE name)
{
int type;
if(rb_obj_class(target) == cConfigFixnum)
type = CONFIG_TYPE_INT;
else if(rb_obj_class(target) == cConfigBignum)
type = CONFIG_TYPE_INT64;
else if(rb_obj_class(target) == cConfigFloat)
type = CONFIG_TYPE_FLOAT;
else if(rb_obj_class(target) == cConfigString)
type = CONFIG_TYPE_STRING;
else if(rb_obj_class(target) == cConfigBoolean)
type = CONFIG_TYPE_BOOL;
else if(rb_obj_class(target) == cConfigGroup)
type = CONFIG_TYPE_GROUP;
else if(rb_obj_class(target) == cConfigList)
type = CONFIG_TYPE_LIST;
else if(rb_obj_class(target) == cConfigArray)
type = CONFIG_TYPE_ARRAY;
else
rb_bug("unknown setting class %s", rb_obj_classname(target));
config_setting_t* new_setting;
if(name == Qnil) {
new_setting = config_setting_add(setting, NULL, type);
} else {
Check_Type(name, T_STRING);
new_setting = config_setting_add(setting, RSTRING_PTR(name), type);
}
if(new_setting == NULL)
return 0;
VALUE rbNewSetting = rconfig_prepare_setting(new_setting);
rb_iv_set(target, "@setting", rbNewSetting);
if(rb_ary_includes(aConfigScalars, rb_obj_class(target)) == Qtrue)
rconfig_update_setting(new_setting, rb_iv_get(target, "@value"));
if(rb_ary_includes(aConfigAggregates, rb_obj_class(target)) == Qtrue) {
if(rb_obj_class(target) == cConfigGroup) {
VALUE hash = rb_iv_get(target, "@hash");
VALUE children = rb_funcall(hash, rb_intern("keys"), 0);
int i;
for(i = 0; i < RARRAY_LEN(children); i++) {
VALUE key = RARRAY_PTR(children)[i];
rconfig_do_append(new_setting, rb_hash_aref(hash, key), key);
}
} else {
VALUE children = rb_iv_get(target, "@list");
int i;
for(i = 0; i < RARRAY_LEN(children); i++) {
rconfig_do_append(new_setting, RARRAY_PTR(children)[i], Qnil);
}
}
}
return 1;
}
static VALUE rbConfigBaseSetting_initialize(VALUE self, VALUE setting)
{
if(setting != Qnil)
Check_Type(setting, T_DATA);
rb_iv_set(self, "@setting", setting);
return self;
}
static VALUE rbConfigBaseSetting_name(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return rb_str_new2(config_setting_name(setting));
} else {
return Qnil;
}
}
static VALUE rbConfigBaseSetting_parent(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return rconfig_wrap_setting(config_setting_parent(setting));
} else {
return Qnil;
}
}
static VALUE rbConfigBaseSetting_is_root(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return config_setting_is_root(setting) ? Qtrue : Qfalse;
} else {
return Qnil;
}
}
static VALUE rbConfigBaseSetting_index(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return INT2FIX(config_setting_index(setting));
} else {
return Qnil;
}
}
static VALUE rbConfigBaseSetting_line(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return INT2FIX(config_setting_source_line(setting));
} else {
return Qnil;
}
}
static VALUE rbConfigSetting_initialize(int argc, VALUE* argv, VALUE self)
{
VALUE value, setting;
rb_scan_args(argc, argv, "11", &value, &setting);
rb_call_super(1, &setting);
rconfig_check_setting_type(self, value);
rb_iv_set(self, "@value", value);
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* c_setting = NULL;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, c_setting);
rb_iv_set(self, "@format", INT2FIX(config_setting_get_format(c_setting)));
} else {
rb_iv_set(self, "@format", cConfigFormatDefault);
}
return self;
}
static VALUE rbConfigSetting_get_value(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return rconfig_wrap_value(setting);
} else {
return rb_iv_get(self, "@value");
}
}
static VALUE rbConfigSetting_set_value(VALUE self, VALUE new_value)
{
rconfig_check_setting_type(self, new_value);
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
rconfig_update_setting(setting, new_value);
}
rb_iv_set(self, "@value", new_value);
return new_value;
}
static VALUE rbConfigSetting_get_format(VALUE self)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
return INT2FIX(config_setting_get_format(setting));
} else {
return rb_iv_get(self, "format");
}
}
static VALUE rbConfigSetting_set_format(VALUE self, VALUE new_format)
{
if(rb_iv_get(self, "@setting") != Qnil) {
config_setting_t* setting;
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
if(!config_setting_set_format(setting, FIX2INT(new_format)))
rb_raise(eSettingFormatError, "invalid setting format %d", FIX2INT(new_format));
}
rb_iv_set(self, "@format", new_format);
return new_format;
}
static VALUE rbConfigAggregate_get(VALUE self, VALUE index);
static VALUE rbConfigAggregate_initialize(int argc, VALUE* argv, VALUE self)
{
VALUE setting = Qnil;
if(rb_obj_class(self) == cConfigGroup || rb_obj_class(self) == cConfigList) {
rb_scan_args(argc, argv, "01", &setting);
} else if(rb_obj_class(self) == cConfigArray) {
VALUE type = Qnil;
rb_scan_args(argc, argv, "02", &type, &setting);
if(type != Qnil && rb_ary_includes(aConfigScalars, type) != Qtrue)
rb_raise(rb_eTypeError, "invalid setting array type %s", rb_class2name(type));
rb_iv_set(self, "@type", type);
} else {
rb_raise(rb_eException, "never create Config::Aggregate itself");
}
rb_call_super(1, &setting);
rb_iv_set(self, "@list", rb_ary_new());
if(rb_obj_class(self) == cConfigGroup)
rb_iv_set(self, "@hash", rb_hash_new());
if(setting != Qnil && rb_obj_class(self) == cConfigArray) {
config_setting_t* c_setting;
Data_Get_Struct(setting, config_setting_t, c_setting);
if(config_setting_length(c_setting) > 0)
rb_iv_set(self, "@type", rb_obj_class(rbConfigAggregate_get(self, INT2FIX(0))));
}
return self;
}
static VALUE rbConfigAggregate_size(VALUE self)
{
config_setting_t* setting = NULL;
if(rb_iv_get(self, "@setting") != Qnil)
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
if(setting)
return INT2FIX(config_setting_length(setting));
else
return INT2FIX(RARRAY_LEN(rb_iv_get(self, "@list")));
}
static VALUE rbConfigAggregate_get(VALUE self, VALUE index)
{
config_setting_t* setting = NULL;
if(rb_iv_get(self, "@setting") != Qnil)
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
VALUE rbTarget = Qnil;
if(TYPE(index) == T_STRING && rb_obj_class(self) == cConfigGroup) {
if(setting) {
config_setting_t* target = config_setting_get_member(setting, RSTRING_PTR(index));
if(target)
rbTarget = rconfig_wrap_setting(target);
} else {
rbTarget = rb_hash_aref(rb_iv_get(self, "@hash"), index);
}
} else if(TYPE(index) == T_FIXNUM) {
if(setting) {
config_setting_t* target = config_setting_get_elem(setting, FIX2INT(index));
if(target)
rbTarget = rconfig_wrap_setting(target);
} else {
rbTarget = rb_ary_entry(rb_iv_get(self, "@list"), FIX2INT(index));
}
} else {
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Fixnum)", rb_obj_classname(index));
}
if(rbTarget == Qnil)
if(TYPE(index) == T_STRING)
rb_raise(eSettingNotFoundError, "setting `%s' not found", RSTRING_PTR(index));
else
rb_raise(eSettingNotFoundError, "setting [%d] not found", FIX2INT(index));
return rbTarget;
}
static VALUE rbConfigAggregate_append(VALUE self, VALUE target)
{
config_setting_t* setting = NULL;
if(rb_iv_get(self, "@setting") != Qnil)
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
Check_Type(target, T_OBJECT);
VALUE type = rb_iv_get(self, "@type");
if(rb_obj_class(self) == cConfigArray) {
if(type != Qnil && type != rb_obj_class(target))
rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)", rb_obj_classname(target), rb_class2name(type));
if(type == Qnil && rb_ary_includes(aConfigScalars, rb_obj_class(target)) != Qtrue)
rb_raise(rb_eTypeError, "invalid setting array type %s", rb_obj_classname(target));
}
if(rb_ary_includes(aConfigSettings, rb_obj_class(target)) == Qtrue) {
if(setting)
rconfig_do_append(setting, target, Qnil);
rb_ary_push(rb_iv_get(self, "@list"), target);
} else {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Config::BaseSetting)", rb_obj_classname(target));
}
if(rb_obj_class(self) == cConfigArray && type == Qnil)
rb_iv_set(self, "@type", rb_obj_class(target));
return target;
}
static VALUE rbConfigGroup_append(VALUE self, VALUE name, VALUE target)
{
Check_Type(name, T_STRING);
Check_Type(target, T_OBJECT);
config_setting_t* setting = NULL;
if(rb_iv_get(self, "@setting") != Qnil)
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
if(rb_ary_includes(aConfigSettings, rb_obj_class(target)) == Qtrue) {
if(rb_reg_match(rSettingNameRegexp, name) == Qnil)
rb_raise(eSettingNameError, "setting name `%s' contains invalid characters", RSTRING_PTR(name));
if(setting) {
if(!rconfig_do_append(setting, target, name))
rb_raise(eSettingNameError, "setting `%s' already exists", RSTRING_PTR(name));
} else if(rb_hash_aref(rb_iv_get(self, "@hash"), name) != Qnil) {
rb_raise(eSettingNameError, "setting `%s' already exists", RSTRING_PTR(name));
}
rb_ary_push(rb_iv_get(self, "@list"), target);
rb_hash_aset(rb_iv_get(self, "@hash"), name, target);
} else {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Config::BaseSetting)", rb_obj_classname(target));
}
return target;
}
static VALUE rbConfigAggregate_delete(VALUE self, VALUE target)
{
config_setting_t* setting = NULL;
if(rb_iv_get(self, "@setting") != Qnil)
Data_Get_Struct(rb_iv_get(self, "@setting"), config_setting_t, setting);
VALUE hash = rb_iv_get(self, "@hash"), list = rb_iv_get(self, "@list");
if(TYPE(target) == T_STRING && rb_obj_class(self) == cConfigGroup) {
if(setting)
config_setting_remove(setting, RSTRING_PTR(target));
rb_ary_delete_at(list, rb_hash_aref(hash, target));
rb_hash_delete(hash, target);
} else if(TYPE(target) == T_FIXNUM) {
int index = FIX2INT(target);
if(setting)
config_setting_remove_elem(setting, index);
if(rb_obj_class(self) == cConfigGroup)
rb_hash_delete(hash, rbConfigBaseSetting_name(rb_ary_entry(list, index)));
rb_ary_delete_at(list, index);
} else if(rb_ary_includes(aConfigSettings, rb_obj_class(target)) == Qtrue) {
VALUE name = rbConfigBaseSetting_name(target);
if(setting)
config_setting_remove(setting, RSTRING_PTR(name));
if(rb_obj_class(self) == cConfigGroup)
rb_hash_delete(hash, name);
rb_ary_delete(list, target);
} else {
if(rb_obj_class(self) == cConfigGroup)
rb_raise(rb_eTypeError, "wrong argument type %s (expected String, Fixnum or Config::BaseSetting)", rb_obj_classname(target));
else
rb_raise(rb_eTypeError, "wrong argument type %s (expected Fixnum or Config::BaseSetting)", rb_obj_classname(target));
}
return Qnil;
}
static VALUE rbConfig_initialize(VALUE self)
{
config_t* config = (config_t*) malloc(sizeof(config_t));
config_init(config);
config_set_destructor(config, &rconfig_destroy_setting);
VALUE rbConfig = Data_Wrap_Struct(rb_cObject, 0, config_destroy, config);
rb_iv_set(self, "@config", rbConfig);
return self;
}
static VALUE rbConfig_read_bang(VALUE self, VALUE path)
{
Check_Type(path, T_STRING);
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
if(!config_read_file(config, RSTRING_PTR(path))) {
if(config_error_line(config) == 0)
rb_raise(rb_eIOError, "cannot load config: I/O error");
else
rb_raise(eConfigParseError, "cannot parse config on line %d: `%s'",
config_error_line(config), config_error_text(config));
}
return Qtrue;
}
static VALUE rbConfig_write_bang(VALUE self, VALUE path)
{
Check_Type(path, T_STRING);
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
if(!config_write_file(config, RSTRING_PTR(path)))
rb_raise(rb_eIOError, "cannot save config: I/O error");
return Qtrue;
}
static VALUE rbConfig_read(VALUE self, VALUE path)
{
Check_Type(path, T_STRING);
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
return config_read_file(config, RSTRING_PTR(path)) ? Qtrue : Qfalse;
}
static VALUE rbConfig_write(VALUE self, VALUE path)
{
Check_Type(path, T_STRING);
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
return config_write_file(config, RSTRING_PTR(path)) ? Qtrue : Qfalse;
}
static VALUE rbConfig_root(VALUE self)
{
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
return rconfig_wrap_setting(config_root_setting(config));
}
static VALUE rbConfig_lookup(VALUE self, VALUE handle)
{
if(TYPE(handle) == T_STRING) {
config_t* config;
Data_Get_Struct(rb_iv_get(self, "@config"), config_t, config);
config_setting_t* setting;
setting = config_lookup(config, RSTRING_PTR(handle));
if(setting == NULL)
rb_raise(eSettingNotFoundError, "setting `%s' not found", RSTRING_PTR(handle));
return rconfig_wrap_setting(setting);
} else if(TYPE(handle) == T_FIXNUM) {
return rbConfigAggregate_get(rbConfig_root(self), handle);
} else {
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Fixnum)", rb_obj_classname(handle));
}
}
static VALUE rbConfig_append(VALUE self, VALUE name, VALUE target)
{
return rbConfigGroup_append(rbConfig_root(self), name, target);
}
static VALUE rbConfig_delete(VALUE self, VALUE name)
{
return rbConfigAggregate_delete(rbConfig_root(self), name);
}
static VALUE rbConfig_size(VALUE self)
{
return rbConfigAggregate_size(rbConfig_root(self));
}
void Init_rconfig()
{
cConfig = rb_define_class("Config", rb_cObject);
rb_define_method(cConfig, "initialize", rbConfig_initialize, 0);
rb_define_method(cConfig, "read!", rbConfig_read_bang, 1);
rb_define_method(cConfig, "write!", rbConfig_write_bang, 1);
rb_define_method(cConfig, "read", rbConfig_read, 1);
rb_define_method(cConfig, "write", rbConfig_write, 1);
rb_define_method(cConfig, "root", rbConfig_root, 0);
rb_define_method(cConfig, "lookup", rbConfig_lookup, 1);
rb_define_method(cConfig, "[]", rbConfig_lookup, 1);
rb_define_method(cConfig, "append", rbConfig_append, 2);
rb_define_method(cConfig, "delete", rbConfig_delete, 1);
rb_define_method(cConfig, "size", rbConfig_size, 0);
cConfigBaseSetting = rb_define_class_under(cConfig, "BaseSetting", rb_cObject);
rb_define_method(cConfigBaseSetting, "initialize", rbConfigBaseSetting_initialize, 1);
rb_define_method(cConfigBaseSetting, "name", rbConfigBaseSetting_name, 0);
rb_define_method(cConfigBaseSetting, "parent", rbConfigBaseSetting_parent, 0);
rb_define_method(cConfigBaseSetting, "root?", rbConfigBaseSetting_is_root, 0);
rb_define_method(cConfigBaseSetting, "index", rbConfigBaseSetting_index, 0);
rb_define_method(cConfigBaseSetting, "line", rbConfigBaseSetting_line, 0);
cConfigSetting = rb_define_class_under(cConfig, "Setting", cConfigBaseSetting);
rb_define_method(cConfigSetting, "initialize", rbConfigSetting_initialize, -1);
rb_define_method(cConfigSetting, "value", rbConfigSetting_get_value, 0);
rb_define_method(cConfigSetting, "value=", rbConfigSetting_set_value, 1);
rb_define_method(cConfigSetting, "format", rbConfigSetting_get_format, 0);
rb_define_method(cConfigSetting, "format=", rbConfigSetting_set_format, 1);
cConfigFormatDefault = INT2FIX(CONFIG_FORMAT_DEFAULT);
rb_define_const(cConfig, "FORMAT_DEFAULT", cConfigFormatDefault);
cConfigFormatHex = INT2FIX(CONFIG_FORMAT_HEX);
rb_define_const(cConfig, "FORMAT_HEX", cConfigFormatHex);
cConfigFixnum = rb_define_class_under(cConfig, "Fixnum", cConfigSetting);
cConfigBignum = rb_define_class_under(cConfig, "Bignum", cConfigSetting);
cConfigFloat = rb_define_class_under(cConfig, "Float", cConfigSetting);
cConfigBoolean = rb_define_class_under(cConfig, "Boolean", cConfigSetting);
cConfigString = rb_define_class_under(cConfig, "String", cConfigSetting);
cConfigAggregate = rb_define_class_under(cConfig, "Aggregate", cConfigBaseSetting);
rb_define_method(cConfigAggregate, "initialize", rbConfigAggregate_initialize, -1);
rb_define_method(cConfigAggregate, "size", rbConfigAggregate_size, 0);
rb_define_method(cConfigAggregate, "get", rbConfigAggregate_get, 1);
rb_define_method(cConfigAggregate, "[]", rbConfigAggregate_get, 1);
rb_define_method(cConfigAggregate, "delete", rbConfigAggregate_delete, 1);
cConfigGroup = rb_define_class_under(cConfig, "Group", cConfigAggregate);
rb_define_method(cConfigGroup, "append", rbConfigGroup_append, 2);
cConfigArray = rb_define_class_under(cConfig, "Array", cConfigAggregate);
rb_define_method(cConfigArray, "append", rbConfigAggregate_append, 1);
rb_define_method(cConfigArray, "<<", rbConfigAggregate_append, 1);
cConfigList = rb_define_class_under(cConfig, "List", cConfigAggregate);
rb_define_method(cConfigList, "append", rbConfigAggregate_append, 1);
rb_define_method(cConfigList, "<<", rbConfigAggregate_append, 1);
aConfigScalars = rb_ary_new3(5, cConfigFixnum, cConfigBignum, cConfigFloat, cConfigBoolean, cConfigString);
aConfigAggregates = rb_ary_new3(3, cConfigGroup, cConfigArray, cConfigList);
aConfigSettings = rb_ary_plus(aConfigScalars, aConfigAggregates);
rb_define_const(cConfig, "SCALARS", aConfigScalars);
rb_define_const(cConfig, "AGGREGATES", aConfigAggregates);
rb_define_const(cConfig, "SETTINGS", aConfigSettings);
char* settingNameRegexp = "^[A-Za-z*][A-Za-z\\-_*]*$";
rSettingNameRegexp = rb_reg_new(settingNameRegexp, strlen(settingNameRegexp), 0);
eConfigParseError = rb_define_class("ConfigParseError", rb_eException);
eSettingNotFoundError = rb_define_class("SettingNotFoundError", rb_eException);
eSettingFormatError = rb_define_class("SettingFormatError", rb_eException);
eSettingNameError = rb_define_class("SettingNameError", rb_eException);
}

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Simple program to use libconfig9 configuration files in bash scripts
Copyright (C) 2013 lucas-net-pl
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,21 @@
ls-config
=========
Simple program to use libconfig9 configuration files in bash scripts
You can use libconfig9 files directly by invoking ls-config, or in bash scripts
by sourcing lslib-core and then using simple cfg_* functions. In this case
You must set LS_EXEC to 1 before sourcing lslib-core
Existing error codes available in: doc/ folder.
Sample usage available in: sample/ folder.
Languages:
- english
- polish
We need some help to build packaging for different systems, and with translations
to other languages.
Full changelog available in doc/changelog.txt

View File

@ -0,0 +1,9 @@
The Debian Package ls-config
----------------------------
This package allow to use libconfig9 style configuration files
in bash scripts
Comments regarding the Package
-- Łukasz A. Grabowski <www@lucas.net.pl> Fri, 11 Oct 2013 21:07:07 +0200

View File

@ -0,0 +1,5 @@
ls-config (1.0.3) stable; urgency=low
* Initial Release.
-- Łukasz A. Grabowski <www@lucas.net.pl> Fri, 11 Oct 2013 21:07:07 +0200

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1,17 @@
Source: ls-config
Section: main
Priority: standard
Maintainer: Łukasz A. Grabowski <www@lucas.net.pl>
Build-Depends: debhelper (>= 8.0.0), libconfig9
Standards-Version: 3.9.3
Homepage: http://www.lucas.net.pl
Vcs-Git: https://github.com/lucas-net-pl/ls-config.git
Vcs-Browser: https://github.com/lucas-net-pl/ls-config
Package: ls-config
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Simple program allo use libconfig style conf in bash
This software allo to use libconfig9 style configuration files
in bash scripts by invoke this soft. It contain bash library too,
witch easying this job.

View File

@ -0,0 +1,33 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ls-config
Source: https://github.com/lucas-net-pl/ls-config
Files: *
Copyright: 2013 Łukasz A. Grabowski <www@lucas.net.pl>
License: GPL-2.0+
Files: debian/*
Copyright: 2013 Łukasz A. Grabowski <www@lucas.net.pl>
License: GPL-2.0+
License: GPL-2.0+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -0,0 +1 @@
ls-config_1.0.3_i386.deb main standard

View File

@ -0,0 +1,103 @@
.\"Created with GNOME Manpages Editor
.\"https://github.com/lucas-net-pl/ls-config
.\"Replace <program> with the program name, x with the Section Number
.TH ls-config x "1" "" "Linux User's Manual"
.SH NAME
ls-config \- program to use libconfig9 configuration files in bash scripts
..SH SYNOPSIS
.B ls-config
[\fB\-f\fR \fIFILE\fR]
.RI [ options ]
.br
.SH DESCRIPTION
You can use libcongig9 files directly invoking ls-config.
Remember to call ls-config always with -f parameter,
wich give ls-config inormation wich config file use.
Then this program operate in three based modes:
-g (get) for reading values (default)
-s (set) for store values
-h (help) for display help message
both parameter (-g and -s) nedd to give it variable path
(internal configuration variable path)
.SH OPTIONS
.TP
.BR \-f ", " \-\-file =\fIFILE\fR
Configuration file to handle.
.TP
.BR \-s ", " \-\-set =\fIPATH\fR
Set configuration variable of given path.
.TP
.BR \-d ", " \-\-data =\fIDATA\fR
Configuration variable value (only with -s)
.TP
.BR \-p ", " \-\-type =\fITYPE\fR
Configuration value type
.TP
.BR \-g ", " \-\-get =\fIPATH\fR
Get configuration variable of given path.
.TP
.BR \-n ", " \-\-names
Printout variables names.
.TP
.BR \-t ", " \-\-types
Printout variables types.
.TP
.BR \-v ", " \-\-values
Printout variables values.
.TP
.BR \-i ", " \-\-indexes
Printout variables indexes.
.TP
.BR \-c ", " \-\-count
Printout elements count (only: array, list, group).
.TP
.BR \-b ", " \-\-bool\-string
Printout boolean variables as text.
.TP
.BR \-q ", " \-\-quiet
Quiet output to use in scripts.
.TP
.BR \-h ", " \-\-help
Print this help message.
.TP
Variable \fITYPE\fRs:
group - variables group,
array - array of variables,
list - list of variables,
int - integer number,
int64 - 64bit integer number,
float - float point number,
bool - boolean value,
string - character string.
.SH NOTES
Exiting eerror codes:
0 - exit with no error
1 - Cen't access witch right mode (read or write) configuration file.
2 - (not used),
3 - Variable of given path not found (path not found).
4 - Variable path not given.
5 - Can't remove root element (cused if someone try to unset it)
6 - Can't find parent element
7 - Variable unset failed.
8 - Configuration file write failed.
9 - Variable value not given.
10 - Inconsistent value type (caused if set exisitng variablen and give type another then saved).
11 - Variable set failed.
12 - Incorrect data format.
13 - Variable type not given (in som cases tu set variable, giving his type are necesery).
14 - Inlegal data type (caused if user give type thet not known for libconfig9).
15 - Bad name of variable (curently chcecking only if enpty stringa are given).
16 - Inavlid configuration variable path.
17 - New named configuration variable can be added only to group element.
18 - Prohibited data type (caused when use type then connot be use in given case).

View File

@ -0,0 +1,48 @@
dh_auto_configure
dh_auto_build
dh_auto_test
dh_prep
dh_installdirs
dh_auto_install
dh_install
dh_installdocs
dh_installchangelogs
dh_installexamples
dh_installman
dh_installcatalogs
dh_installcron
dh_installdebconf
dh_installemacsen
dh_installifupdown
dh_installinfo
dh_pysupport
dh_installinit
dh_installmenu
dh_installmime
dh_installmodules
dh_installlogcheck
dh_installlogrotate
dh_installpam
dh_installppp
dh_installudev
dh_installwm
dh_installxfonts
dh_installgsettings
dh_bugfiles
dh_ucf
dh_lintian
dh_gconf
dh_icons
dh_perl
dh_usrlocal
dh_link
dh_compress
dh_fixperms
dh_strip
dh_makeshlibs
dh_shlibdeps
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb

View File

@ -0,0 +1,6 @@
ls-config usr/share/ls/lib/
lslib-core usr/share/ls/lib/
src/locale/* usr/share/locale/
doc/* usr/share/doc/ls-config/
sample/* usr/share/doc/ls-config/sample/
README.md usr/share/doc/ls-config/README.txt

View File

@ -0,0 +1 @@
misc:Depends=

View File

@ -0,0 +1,12 @@
Package: ls-config
Version: 1.0.3
Architecture: i386
Maintainer: Łukasz A. Grabowski <www@lucas.net.pl>
Installed-Size: 27
Section: unknown
Priority: extra
Homepage: http://www.lucas.net.pl
Description: Simple program allo use libconfig style conf in bash
This software allo to use libconfig9 style configuration files
in bash scripts by invoke this soft. It contain bash library too,
witch easying this job.

View File

@ -0,0 +1,2 @@
17ee68fa6924ad7f69ca91bee808281b usr/share/doc/ls-config/changelog.gz
962fc567b180716388e62add5c6bfae5 usr/share/doc/ls-config/copyright

View File

@ -0,0 +1,39 @@
#!/bin/sh
# postinst script for ls-config
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0

View File

@ -0,0 +1,33 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ls-config
Source: https://github.com/lucas-net-pl/ls-config
Files: *
Copyright: 2013 Łukasz A. Grabowski <www@lucas.net.pl>
License: GPL-2.0+
Files: debian/*
Copyright: 2013 Łukasz A. Grabowski <www@lucas.net.pl>
License: GPL-2.0+
License: GPL-2.0+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -0,0 +1 @@
debian/ls-config.1

View File

@ -0,0 +1,68 @@
#!/bin/sh
# postinst script for ls-config
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
config_path() {
local CHK="$(echo ":$PATH:" | grep ":/usr/share/ls/lib:")"
if [ "$CHK" != "" ]; then
return 0;
fi;
local BIFS="$IFS"
IFS=$'\n'
local PR="$(</etc/profile)"
local NF=""
local L
for L in $PR
do
CHK="$(echo "$L" | sed -E 's/^([\ \t]+)//g')"
CHK="${CHK:0:5}"
NF="$NF$IFS$L"
if [ "$CHK" = "PATH=" ]; then
NF="$NF$IFS#Configuration path for ls scripting"
NF="$NF$IFS"
NF="${NF}PATH=\"\$PATH:/usr/share/ls/lib\"$IFS"
fi;
done
NF="$NF$IFS"
IFS="$BIFS"
echo "$NF" > /etc/profile
}
case "$1" in
configure)
if [ ! -e "/etc/ls" ]; then
mkdir -p "/etc/ls/"
config_path
fi;
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@

View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -0,0 +1,75 @@
Instalation:
------------
First of all, You must place ls-config binary and lslib-core bash
script in the same directory (default: /usr/share/ls/lib)
Next in lslib-core header chcange configuration:
PACD tu point to parent directory of paced files
then LIBD must point relative (tu PACD) to directory
whrere script placed
Usage:
------
In You bash script, first of all define LS_EXEC variable,
and set his value to 1. (It protect lslib-core) to run
standalone
Next, source library:
source /usr/share/ls/lib/lslib-core
After thet You can use following function:
Functions:
----------
cfg_g $PATH - this echo variable value of given PATH
and return error code
cfg_t $PATH - this echo variable type of given PATH
and return error code
cfg_c $PATH - this echo cout of variable elements
and return error code
cfg_s $PATH $DATA [$TYPE] - this set variable of given PATH or create new
variable valuse are set to DATA, and if this
create new variable, variable will be type TYPE
cfg_u $PATH - this unset (remove) variable of given PATH
and return error code
cfg_f_g $FILE $PATH - same as cfg_g, but operate on given FILE
cfg_f_t $FILE $PATH - same as cfg_t, but operate on given FILE
cfg_f_c $FILE $PATH - same as cfg_c, but operate on given FILE
cfg_f_s $FILE $PATH $DATA [$TYPE] - same as cfg_s, but operate on given FILE
cfg_f_u $FILE $PATH - same as cfg_u, but operate on given FILE
Configuration files:
--------------------
By default configuration file are placed in /etc/ls/
with the same name as script file name
(used in cfg_g, cfg_t, cfg_c, cfg_s, cfg_u)
But if You need, You can use any location of configuration file
by using cfg_f_* functions, giving configuration file location as
first argument
Detailed configuration file shema are publicated on:
http://www.hyperrealm.com/libconfig/
And his gramar on:
http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files
there are only short describe:
configuration = setting-list | empty
setting-list = setting | setting-list setting
setting = name (":" | "=") value (";" | "," | empty)
value = scalar-value | array | list | group
value-list = value | value-list "," value
scalar-value = boolean | integer | integer64 | hex | hex64 | float | string
scalar-value-list = scalar-value | scalar-value-list "," scalar-value
array = "[" (scalar-value-list | empty) "]"
list = "(" (value-list | empty) ")"
group = "{" (setting-list | empty) "}"
empty =
smaple configuration file and script are available on sample/ directory
config - samble configuration file
script - sample script, then read info variable from config file

View File

@ -0,0 +1,75 @@
Instalation:
------------
First place somewhere ls-config binary, or make it from source
Then if You woud like use it with national translation, then You muas build
it form source and then copy *.mo files according to You system
Usage:
------
Remember to call ls-config always with -f parameter,
wich give ls-config inormation wich config file use.
Then this program operate in three based modes:
-g (get) for reading values (default)
-s (set) for store values
-h (help) for display help message
both parameter (-g and -s) nedd to give it variable path
(internal configuration variable path)
for exapmle read info value from config file:
ls-config -f config -g info
Then You can set this value to another
ls-config -f config -s info -d "Somethint to write"
But when You wand to addn new configutation variable you must
specify his type:
ls-config -f config -s someint -d 10 -p int
You can remove (unset) variable too. This is subfunstion of setting:
ls-config -f config -s someint -u
When reading You cent use following flag:
-v - read only variable valut
-t - read only variable type
-c - read only variable element count (sense only in types: array, list, group)
-i - read only variable index (sense only in type: array, list)
-n - read only variable name
and sometimes usable
-q - to wori in quiet mode usable in scripts.
For example to read variable somevar type, where variable in group foo:
ls-config -f config -g "foo.somevar" -t
For detailed list of parametera (long options available too) run ls-config
in help mode:
ls-config -h
Configuraiton files:
--------------------
Detailed configuration file shema are publicated on:
http://www.hyperrealm.com/libconfig/
And his gramar on:
http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files
there are only short describe:
configuration = setting-list | empty
setting-list = setting | setting-list setting
setting = name (":" | "=") value (";" | "," | empty)
value = scalar-value | array | list | group
value-list = value | value-list "," value
scalar-value = boolean | integer | integer64 | hex | hex64 | float | string
scalar-value-list = scalar-value | scalar-value-list "," scalar-value
array = "[" (scalar-value-list | empty) "]"
list = "(" (value-list | empty) ")"
group = "{" (setting-list | empty) "}"
empty =
smaple configuration file and script are available on sample/ directory
config - samble configuration file
script - sample script, then read info variable from config file

View File

@ -0,0 +1,26 @@
Version 1.0.3
-------------
Fully commented code,
Startin with documentation
bugfixes
- fix some badly returned exit codes
- remove duplicate error messages
- l10n textdomain corrected
- extend sample configuration file to be full representative
- some corrections in sample script (adding directly usaga)
new features
- adding documentation files (api)
Version 1.0.1
-------------
Internaly translated tu englich
Verison 1.0.0
-------------
First publicated and working version

View File

@ -0,0 +1,20 @@
0 - exit with no error
1 - Cen't access witch right mode (read or write) configuration file.
2 - (not used),
3 - Variable of given path not found (path not found).
4 - Variable path not given.
5 - Can't remove root element (cused if someone try to unset it)
6 - Can't find parent element
7 - Variable unset failed.
8 - Configuration file write failed.
9 - Variable value not given.
10 - Inconsistent value type (caused if set exisitng variablen and give type another then saved).
11 - Variable set failed.
12 - Incorrect data format.
13 - Variable type not given (in som cases tu set variable, giving his type are necesery).
14 - Inlegal data type (caused if user give type thet not known for libconfig9).
15 - Bad name of variable (curently chcecking only if enpty stringa are given).
16 - Inavlid configuration variable path.
17 - New named configuration variable can be added only to group element.
18 - Prohibited data type (caused when use type then connot be use in given case).

View File

@ -0,0 +1,199 @@
#!/bin/bash
#title :lslib-core
#description :core library for LS scripts
#author :Łukasz A. Grabowski <www@lucas.net.pl>
#date :20130928
#version :1.0.3
#notes :
#bash_version :4.2.37(1)-release
#copywrite :Copyright (C) 2013 Łukasz A. Grabowski
#license :This program is free software: you can redistribute
# :it and/or modify it under the terms of the GNU General
# :Public License as published by the Free Software
# :Foundation, either version 2 of the License or
# :any later version.
# :
# :This program is distributed in the hope that it will
# :be useful, but WITHOUT ANY WARRANTY; without even the
# :implied warranty of MERCHANTABILITY or FITNESS FOR
# :A PARTICULAR PURPOSE. See the GNU General Public
# :License for more details.
# :
# :You should have received a copy of the GNU General
# :Public License along with this program. If not, see
# :http://www.gnu.org/licenses/.
#=======================================================================
#################
# Configuration #
#################
PACD="/usr/share/ls" #main directory for LS scripts
LIBD="lib" #library dir for LS scripts
#######################
# Predefined and init #
#######################
if [ -z "$LS_EXEC" ]; then
echo "This script are only for inclusion in LS packet scripts. Don't use it itself." 1>&2
exit 1
fi
##############################
# configuration read / write #
##############################
#get configuration
# cfg_g PATH
cfg_g() {
local PTH=""
if [ $# -gt 0 ]; then
local PTH="$1";
fi;
local DAT
local ERR
DAT="$($PACD/$LIBD/ls-config -f "$CFGFN" -qv --get="$PTH")"
ERR=$?
echo "$DAT"
return $ERR
}
#get configuration type
# cfg_t PATH
cfg_t() {
local PTH=""
if [ $# -gt 0 ]; then
local PTH="$1";
fi;
local DAT
local ERR
DAT="$($PACD/$LIBD/ls-config -f "$CFGFN" -qt --get="$PTH")"
ERR=$?
echo "$DAT"
return $ERR
}
#get configuration items count
# cfg_c PATH
cfg_c() {
local PTH=""
if [ $# -gt 0 ]; then
local PTH="$1";
fi;
local DAT
local ERR
DAT="$($PACD/$LIBD/ls-config -f "$CFGFN" -qc --get="$PTH")"
ERR=$?
echo "$DAT"
return $ERR
}
#set configuration
# cfg_s PATH DATA [TYPE=string]
cfg_s() {
local PTH=""
if [ $# -gt 0 ]; then
local PTH="$1";
fi;
local DATA=""
if [ $# -gt 1 ]; then
local DATA="$2";
fi;
local TYPE="string"
if [ $# -gt 2 ]; then
local TYPE="$3";
fi;
local DAT
local ERR
DAT="$($PACD/$LIBD/ls-config -f "$CFGFN" -q --set="$PTH" --data="$DATA" --type="$TYPE")"
ERR=$?
echo "$DAT"
return $ERR
}
#remove configuration
# cfg_u PATH
cfg_u() {
local PTH=""
if [ $# -gt 0 ]; then
local PTH="$1";
fi;
local DAT
local ERR
DAT="$($PACD/$LIBD/ls-config -f "$CFGFN" -q --set="$PTH" --unset)"
ERR=$?
return $ERR
}
cfg_f_g() {
local BCFN="$CFGFN"
local EX
CFGFN="$1"
shift
cfg_g "$@"
EX=$?
CFGFN="$BCFN"
return $EX
}
cfg_f_t() {
local BCFN="$CFGFN"
local EX
CFGFN="$1"
shift
cfg_t "$@"
EX=$?
CFGFN="$BCFN"
return $EX
}
cfg_f_c() {
local BCFN="$CFGFN"
local EX
CFGFN="$1"
shift
cfg_c "$@"
EX=$?
CFGFN="$BCFN"
return $EX
}
cfg_f_s() {
local BCFN="$CFGFN"
local EX
CFGFN="$1"
shift
cfg_s "$@"
EX=$?
CFGFN="$BCFN"
return $EX
}
cfg_f_u() {
local BCFN="$CFGFN"
local EX
CFGFN="$1"
shift
cfg_u "$@"
EX=$?
CFGFN="$BCFN"
return $EX
}
######################
# base variable init #
######################
#package name
SCRFN="$(basename "$0")"
#configuriation directory and file
if [ -z "$CFGD" ]; then
CFGD="/etc/ls"
fi;
CFGFN="$CFGD/$SCRFN"

View File

@ -0,0 +1,7 @@
all:
make -C src
clean:
make -C src clean

View File

@ -0,0 +1,23 @@
grp :
{
value = 10;
name = "sample";
};
lst = (
{
name = "sample";
},
{
comment = "sample secong group";
val = 10.2;
} );
info = "more info about types in libconfig9 documentations";
arr = [ 10, 20, 30 ];
integer = 100;
longint = 100L;
flo = 100.01;
boolean :
{
truevalue = true;
falsevalue = false;
};

View File

@ -0,0 +1,68 @@
#!/bin/bash
#title :script
#description :this script only demonstrate usage of ls-config
#author :Łukasz A. Grabowski <www@lucas.net.pl>
#date :20130928
#version :1.0.3
#notes :This only read one value from configuration file
# :this script MUST be run from subdirectory of dir
# :where ls-config (bin) and lslib-core are stored
# :to place script in other places You must reconfigure paths
#bash_version :4.2.37(1)-release
#copywrite :Copyright (C) 2013 Łukasz A. Grabowski
#license :This program is free software: you can redistribute
# :it and/or modify it under the terms of the GNU General
# :Public License as published by the Free Software
# :Foundation, either version 2 of the License or
# :any later version.
# :
# :This program is distributed in the hope that it will
# :be useful, but WITHOUT ANY WARRANTY; without even the
# :implied warranty of MERCHANTABILITY or FITNESS FOR
# :A PARTICULAR PURPOSE. See the GNU General Public
# :License for more details.
# :
# :You should have received a copy of the GNU General
# :Public License along with this program. If not, see
# :http://www.gnu.org/licenses/.
#=======================================================================
#set app flag
LS_EXEC=1
#set configuration directory
CFGD="./"
#source bash library to manipulate config
source ../lslib-core
#path direcrories onlny for this sample
PACD="../"
LIBD=""
#end path
#read data from configuration file
TEST=$(cfg_f_g "config" "info")
ERR="$?"
#show data
echo "Info value: $TEST"
echo "Reading error: $ERR"
#show other method of reading value:
#output space and info
echo ""
echo "Reading using binary:"
#read data from configuration file
TEST=$(${PACD}ls-config -f config --get="info" -vq)
ERR="$?"
#show data
echo "Info value: $TEST"
echo "Reading error: $ERR"
exit 0;

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More