Removing cfm specific versions of glib & libidl.

Bug #98811 r=macdev
This commit is contained in:
seawood%netscape.com 2003-06-10 18:41:52 +00:00
Родитель 3bee9239aa
Коммит 21e62fa849
160 изменённых файлов: 0 добавлений и 92730 удалений

Просмотреть файл

@ -1,3 +0,0 @@
This directory contains a snapshot of glib 1.2.1 slightly modified for
building on the Macintosh only. When these changes are folded back into
the main distribution of glib, this directory will go away.

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1,25 +0,0 @@
Original Authors
----------------
Peter Mattis <petm@xcf.berkeley.edu>
Spencer Kimball <spencer@xcf.berkeley.edu>
Josh MacDonald <jmacd@xcf.berkeley.edu>
Please do not mail the original authors asking questions about this
version of GLib.
GLib Team
---------
Shawn T. Amundson <amundson@gimp.org>
Jeff Garzik <jgarzik@pobox.com>
Raja R Harinath <harinath@cs.umn.edu>
Tim Janik <timj@gtk.org>
Elliot Lee <sopwith@redhat.com>
Tor Lillqvist <tml@iki.fi>
Paolo Molaro <lupus@debian.org>
Havoc Pennington <hp@pobox.com>
Manish Singh <yosh@gimp.org>
Owen Taylor <otaylor@gtk.org>
Sebastian Wilhelmi <wilhelmi@ira.uka.de>
There are also many others who have contributed patches and fixes;
we thank them, for helping us in advancing GLIB.

Просмотреть файл

@ -1,482 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 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!

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,67 +0,0 @@
Simple install procedure
========================
% gzip -cd glib-1.2.1.tar.gz | tar xvf - # unpack the sources
% cd glib-1.2.1 # change to the toplevel directory
% ./configure # run the `configure' script
% make # build GLIB
[ Become root if necessary ]
% make install # install GLIB
The Nitty-Gritty
================
The 'configure' script can be given a number of options to enable
and disable various features. For a complete list, type:
./configure --help
A few of the more important ones:
* --prefix=PREFIX install architecture-independent files in PREFIX
[ Defaults to /usr/local ]
* --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[ Defaults to the value given to --prefix ]
Options can be given to the compiler and linker by setting
environment variables before running configure. A few of the more
important ones:
CC : The C compiler to use
CPPFLAGS : Flags for the C preprocesser such as -I and -D
CFLAGS : C compiler flags
The most important use of this is to set the
optimization/debugging flags. For instance, to compile with no
debugging information at all, run configure as:
CFLAGS=-O2 ./configure # Bourne compatible shells (sh/bash/zsh)
or,
setenv CFLAGS -O2 ; ./configure # csh and variants
Installation directories
========================
The location of the installed files is determined by the --prefix
and --exec-prefix options given to configure. There are also more
detailed flags to control individual directories. However, the
use of these flags is not tested.
One particular detail to note, is that the architecture-dependent
include file glibconfig.h is installed in:
$exec_pref/lib/glib/include/
if you have a version in $prefix/include, this is out of date
and should be deleted.
A shell script glib-config is created during the configure
process, and installed in the bin/ directory
($exec_prefix/bin). This is used to determine the location of glib
when building applications. If you move glib after installation,
it will be necessary to edit this file.

Просмотреть файл

@ -1,102 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = 1.4
SUBDIRS = . gmodule gthread docs tests
configincludedir = $(pkglibdir)/include
bin_SCRIPTS=glib-config
BUILT_SOURCES=glib-config
glib-config: glib-config.in
INCLUDES = -DG_LOG_DOMAIN=g_log_domain_glib @GLIB_DEBUG_FLAGS@
EXTRA_DIST = \
glib.m4 \
glib.spec.in \
acglib.m4 \
sanity_check \
README.win32 \
glib.def \
makefile.msc \
giowin32.c \
glibconfig.h.win32.in \
config.h.win32
lib_LTLIBRARIES = libglib.la
libglib_la_SOURCES = \
garray.c \
gcache.c \
gcompletion.c \
gdataset.c \
gdate.c \
gerror.c \
ghash.c \
ghook.c \
giochannel.c \
giounix.c \
glist.c \
gmain.c \
gmem.c \
gmessages.c \
gmutex.c \
gnode.c \
gprimes.c \
grel.c \
gscanner.c \
gslist.c \
gstrfuncs.c \
gstring.c \
gtimer.c \
gtree.c \
gutils.c
include_HEADERS = \
glib.h
configinclude_DATA = \
glibconfig.h
configure: configure.in acglib.m4
BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h
glibconfig.h: stamp-gc-h
@:
stamp-gc-h: config.status
CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status
echo timestamp > stamp-gc-h
libglib_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
noinst_PROGRAMS = testglib testgdate testgdateparser
testglib_LDADD = libglib.la
testgdate_LDADD = libglib.la
testgdateparser_LDADD = libglib.la
m4datadir = $(datadir)/aclocal
m4data_DATA = glib.m4
.PHONY: files release sanity snapshot
files:
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
echo $$p; \
done
release:
rm -rf .deps */.deps
cd docs && make glib.html
$(MAKE) distcheck
sanity:
./sanity_check $(VERSION)
snapshot:
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
dist-hook:
cp glib.spec $(distdir)

Просмотреть файл

@ -1,211 +0,0 @@
Overview of Changes in GLib 1.2.1:
* g_realloc() fix for SunOS (please report further problems).
* Continued the never ending fix vendetta regarding getpwuid(),
this time AIX has been the culprit.
* Upgrade to libtool 1.2f
* Miscellaneous other buglets fixed.
What's new in GLib 1.2.0 (since GLib 1.0.x):
* GLib is distributed seperatedly from Gtk+
* Win32 Portability
* Threading support
* GModule mechanism (implemented in an extra library) which wraps dynamic
object code loading facilities in a portable manner
* GIOChannel structure to encapsulate the IPC mechanism
* GQuarks and datasets
* GRelations for n-way mapping of certain data
* An n-way tree implementation
* GDate functionality for calendar date manipulations
* GAllocator type and associated functions
* Added generic callback maintenance functions (ghook)
* Generic functions for TAB completions
* Endian defines (G_*_ENDIAN)
* g_log() mechanism for logging of messages at different log levels
* Generic main-loop mechanism
* New glib-config helper script
* Many more API extensions
Overview of Changes in GLib 1.1.16:
* Allocate smaller pools of memory for glists, gslists, gnodes
* Bug Fixes
Overview of Changes in GLib 1.1.15:
* HPUX 11 thread system detection should now work
* Release the main loop lock around calls to prepare() and
check() so it is not held over user code
* A few Win32 fixups
Overview of Changes in GLib 1.1.14:
* Check for dlsym() in system libraries and -dl
* FreeBSD portability fixes
* Random bug fixes and autoconf/automake changes
Overview of Changes in GLib 1.1.13:
* Removed alloca() based function and macro variants again.
* Improved thread related configure tests.
* GSource destruction fixups.
* Fixed up idle function removal based on user_data pointer.
* Advanced Win32 portability.
* Enforced GSource's check(), prepare() and dispatch() constrains,
loop recursions may only happen from dispatch(), and check() as well
as prepare() are called while the main_loop lock is being held.
* GLib development now requires GNU autoconf 2.13, GNU automake 1.4
and GNU libtool 1.2d.
* Lots of random portability and bug fixes.
Overview of Changes in GLib 1.1.12:
* Added alloca functions/macros: g_strdup_a, g_strconcat3_a, g_alloca,
g_new_a, g_new0_a
* New tests structure. Type 'make check' on your system to run them.
* Avoid unnecessary extra hook referencing in g_hook_list_marshal
Overview of Changes in GLib 1.1.11:
* provide defaults for POLL sysdefs
* g_main_is_running: new function to check whether a main loop has been quitted
* a few other enhancement/fixes
Overview of Changes in GLib 1.1.9:
* Check for pthread_attr_init in all cases, Digital Unix 4 requires this
* For G_LOCK_DECLARE_*, if !G_THREADS_ENABLED, eat trailing semicolon better
* Changed g_main_poll_(add|remove) to g_main_(add|remove)_poll
Overview of Changes in GLib 1.1.8:
* Added threading support
- The ability to specify a set of functions to be used for
locking at runtime.
- Default implementations of locking functions for pthreads,
Solaris threads, and (experimentally) NSPR.
- All static variables should now properly locked.
- Enhancements to the generic main-loop mechanism to be thread-safe.
(It is used for the main-loop in GTK+ as of GTK+-1.1.8)
* Portability fixes.
Overview of Changes in GLib 1.1.7:
* Removed multiple define from glibconfig.h
Overview of Changes in GLib 1.1.6:
* New GDate functionality for calendar date manipulations (g_date_*)
* New GAllocator type and assocated functions
* New functions g_slist_copy and g_list_copy to duplicate a list with all
its data pointers.
* New function g_array_insert_vals and new macro g_array_insert_val to
insert elements at an arbitrary index
* GAllocators used for glist, gslist, gnode node allocations
* Incremental freezing in ghash
* New function g_hook_list_marshal_check to eventually destroy hooks after
they got marshalled
* Revised GIOChannel to provide generic virtual-function based interface
* Added generic main-loop abstraction
* Removed GListAllocator type and its g_*_allocator_*() function variants
* Bug fixes
Overview of Changes in GLib 1.1.5:
* Win32 portability
* GIOChannel structure to encapsulate the IPC mechanism
* Reimplemented endian stuff, using inline asm for x86
* New functions:
- g_strescape: escapes backslashes
- g_path_is_absolute and g_path_skip_root
- g_getenv: expands environment variables that contain references
to other environment variables
- g_scanner_sync_file_offset: rewind the filedescriptor to the current
buffer position and blow the file read ahead buffer
- g_array_remove_index: remove an entry, preserving the order
- g_array_remove_index_fast: remove an entry, order might be distorted
- g_ptr_array_remove: remove an entry, preserving the order
- g_ptr_array_remove_fast: remove an entry, order might be distorted
- g_byte_array_remove_index: wrapper for g_array_remove_index
- g_byte_array_remove_index_fast: wrapper for g_array_remove_index_fast
- g_strncasecmp: modeled closely after g_strcasecmp
- g_list_sort, g_slist_sort: to merge sort GLists and GSLists
* New macros:
- G_DIR_SEPARATOR, G_DIR_SEPARATOR_S: platform-dependant file name
syntax elements
- G_SEARCHPATH_SEPARATOR, G_SEARCHPATH_SEPARATOR_S: platform-dependant
search path syntax conventions
- G_STRUCT_OFFSET, G_STRUCT_MEMBER_P, G_STRUCT_MEMBER: for handling
structure fields through their offsets
* Removed G_ENUM, G_FLAGS, G_NV, and G_SV macros
* Bug fixes
Overview of Changes in GLib 1.1.4:
* Added generic callback maintenance functions (ghook)
* New endian defines (G_*_ENDIAN)
* New string join/split/free routines
* Fixes
Overview of Changes in GLib 1.1.3:
* New GModule mechanism (implemented in an extra library) which wraps dynamic
object code loading facilities in a portable manner.
* glib-config features extra "glib" (old behaviour remains) and "gmodule"
(add libgmodule.so to the --libs output) arguments now. this can also
be specified as fourth argument to the AM_PATH_GLIB() macro.
* Overhaul of the `inline' autoconfiguration stuff, so inlining should be
sufficiently supported on all systems that allow inlining now.
* New g_log() mechanism for logging of messages at different log levels,
associated with certain log domains (define -DG_LOG_DOMAIN for your library).
* New inline functions for bit masks tests.
* GNode macros (and functions) now return the newly allocated node.
* New macro G_VA_COPY() to work around va_list copying oddities on some
platforms. the non-static g_vsprintf() function vanished in favour of
a publically exported g_strdup_vprintf().
People that used the former g_vsprintf() would definitely want to read the
associated ChangeLog entries (grep for printf).
* New utility functions:
g_strndup(), g_on_error_query(), g_on_error_stack_trace(), g_strdup_printf(),
g_strdup_vprintf(), g_printf_string_upper_bound(), g_spaced_primes_closest(),
g_strnfill(), g_memdup().
* Overhaul of the array implementations, this contains some source incompatible
changes. Again, the ChangeLog is much more informative (grep for garray.c).
* The internals of the g_dataset mechanism are now exported through the
new g_datalist_* API (this is also the underlying implementation for the
keyed data of GtkObjects).
* New function g_atexit(), use of the ATEXIT() macro is discouraged.
* Better configure checks for ansi compliance.
* Libtool update to version 1.2b.
* Lotsa bug fixes and cleanups as always ;)
Overview of Changes in GLib 1.1.2:
* Fixed packaging mistake which occured in 1.1.1
* fix 64-bitness in g_prints in glibtest
What is new in GLib 1.1.1:
* An n-way tree implementation is provided now, based on the GNode structure.
* Bugfix for pointer arrays.
What is new in GLib 1.1.0:
* GLib is distributed seperatedly from Gtk+ now and uses a sophisticated
shared library versioning scheme to deal with interface and binary
incompatibilities.
* There is a glib-config helper script installed now.
* Fixups all over the place.
* gboolean is now a gint, not a gchar anymore.
* API extensions for GList and GSList.
* New g_str*() functions for simple string handling.
* GScanner extensions for scope, warning and error handling.
* Minor performance improvements for GMemChunks.
* Implementations of GQuarks and datasets (similar to GtkObjects data
mechansim, but works for generic memory locations).
* More convenience macros for GNU C function arguments.
* Const correction all over the place, including a new pointer type
gconstpointer.
* Generic functions for TAB completions.
* GRelations for n-way mapping of certain data.

Просмотреть файл

@ -1,66 +0,0 @@
General Information
===================
This is GLib version 1.2.1. GLib is a library which includes support
routines for C such as lists, trees, hashes, memory allocation, and
many other things.
The official ftp site is:
ftp://ftp.gtk.org/pub/gtk
The official web site is:
http://www.gtk.org/
A mailing list is located at:
gtk-list@redhat.com
To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
Installation
============
See the file 'INSTALL'
How to report bugs
==================
To report a bug, send mail either to gtk-list, as mentioned
above, or to gtk-bugs@gtk.org. If you send mail to gtk-list, you
must be subscribed yourself.
In the mail include:
* The version of GLib
* Information about your system. For instance:
- What operating system and version
- What version of X
- For Linux, what version of the C library
And anything else you think is relevant.
* How to reproduce the bug.
If you can reproduce it with the testglib program that is built
in the glib/ directory, that will be most convenient. Otherwise,
please include a short test program that exhibits the behavior.
As a last resort, you can also provide a pointer to a larger piece
of software that can be downloaded.
* If the bug was a crash, the exact text that was printed out
when the crash occured.
* Further information such as stack traces may be useful, but
is not necessary.
Patches
=======
Patches can be uploaded to the incoming/ directory on
ftp.gtk.org. Please follow the instructions there, and include
your name and email address in the README file.
If the patch fixes a bug, it is usually a good idea to include
all the information described in "How to Report Bugs".

Просмотреть файл

@ -1,54 +0,0 @@
For more information about the port or GLib, GTk+ and the GIMP to
native Windows, and pre-built binary packages, see
http://www.iki.fi/tml/gimp/win32/ . "Native" means that we use the
Win32 API only, and not any POSIX emulation layer except that provided
by the Microsoft runtime C library. Additionally the pthreads
emulation library is used.
As for now, to build GLib on Win32, you need the Microsoft compiler
and tools. Both the compiler from MSVC 5.0 and MSVC 6.0 have been used
successfully.
Before building you must get the pthreads library for Windows from
http://sourceware.cygnus.com/pthreads-win32/. Edit the location of the
pthreads library and include files in makefile.msc. Also edit the BIN
definition in makefile.msc.
Build with `nmake -f makefile.msc`. Install with `nmake -f
makefile.msc install`.
Support for building using the cygwin tools (without depending on the
cygwin runtime, i.e. "mingw32"), and maybe LCC-Win32 might be added
later. When using the cygwin tools *with* the cygwin runtime the
normal Unix configuration method should work as if on Unix (knock on
wood).
With a little work, it might be possible to use the ./configure
mechanism also with a "mingw32" configuration. I.e. building GLib for
Win32 would use the cygwin tools (and runtime), but the produced
libraries would not depend on the cygwin runtime being present.
The following preprocessor macros are used for conditional compilation
related to Win32:
- WIN32 is defined when compiling for the Win32 platform, regardless
if using the X11 or Win32 windowing API (in the case of GLib, this
dimension isn't significant), regardless whether using a more or
less complete POSIX emulation runtime layer (like Cygwin) or not.
- NATIVE_WIN32 is defined when compiling for Win32, *and* without
any POSIX emulation, other that to the extent provided by the
(Microsoft) C library, or the pthreads-win32 library. For instance,
pathnames use the native Windows syntax.
- _MSC_VER is defined when using the Microsoft compiler.
Currently the Win32 port uses the combination with all three of those
on, but eventually the cygwin compiler and tools will be supported
also, and in that case _MSC_VER wouldn't be defined.
Some of the usage of these macros is probably a bit mixed up, and will
have to be straightened out when actually trying other combinations.
The pthreads for Win32 package that the thread support uses isn't
released yet, and thus threads really should not be relied upon.

Просмотреть файл

@ -1,109 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* acconfig.h
This file is in the public domain.
Descriptive text for the C preprocessor macros that
the distributed Autoconf macros can define.
No software package will use all of them; autoheader copies the ones
your configure.in uses into your configuration header file templates.
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). Although this order
can split up related entries, it makes it easier to check whether
a given entry is in the file.
Leave the following blank line there!! Autoheader needs it. */
/* Other stuff */
#undef ENABLE_MEM_CHECK
#undef ENABLE_MEM_PROFILE
#undef REALLOC_0_WORKS
#undef G_COMPILED_WITH_DEBUGGING
#undef G_THREADS_ENABLED
#undef GLIB_SIZEOF_GMUTEX
#undef GLIB_BYTE_CONTENTS_GMUTEX
#undef HAVE_BROKEN_WCTYPE
#undef HAVE_DOPRNT
#undef HAVE_FLOAT_H
#undef HAVE_GETPWUID_R
#undef HAVE_GETPWUID_R_POSIX
#undef HAVE_LIMITS_H
#undef HAVE_LONG_DOUBLE
#undef HAVE_POLL
#undef HAVE_PTHREAD_COND_TIMEDWAIT_POSIX
#undef HAVE_PTHREAD_GETSPECIFIC_POSIX
#undef HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX
#undef HAVE_PWD_H
#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_POLL_H
#undef HAVE_SYS_SELECT_H
#undef HAVE_SYS_TIME_H
#undef HAVE_SYS_TIMES_H
#undef HAVE_STRERROR
#undef HAVE_STRSIGNAL
#undef HAVE_UNISTD_H
#undef HAVE_VALUES_H
#undef HAVE_WCHAR_H
#undef HAVE_WCTYPE_H
#undef NO_FD_SET
#undef NO_SYS_ERRLIST
#undef NO_SYS_SIGLIST
#undef NO_SYS_SIGLIST_DECL
#undef SIZEOF_CHAR
#undef SIZEOF_SHORT
#undef SIZEOF_LONG
#undef SIZEOF_INT
#undef SIZEOF_VOID_P
#undef G_VA_COPY
#undef G_VA_COPY_AS_ARRAY
#undef G_HAVE___INLINE
#undef G_HAVE___INLINE__
#undef G_HAVE_INLINE
#undef GLIB_MAJOR_VERSION
#undef GLIB_MINOR_VERSION
#undef GLIB_MICRO_VERSION
#undef GLIB_INTERFACE_AGE
#undef GLIB_BINARY_AGE
#undef WIN32
#undef NATIVE_WIN32
#undef G_THREAD_SOURCE
/* #undef PACKAGE */
/* #undef VERSION */
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). */

Просмотреть файл

@ -1,127 +0,0 @@
dnl GLIB_IF_VAR_EQ (ENV_VAR, VALUE [, EQUALS_ACTION] [, ELSE_ACTION])
AC_DEFUN(GLIB_IF_VAR_EQ,[
case "$[$1]" in
"[$2]"[)]
[$3]
;;
*[)]
[$4]
;;
esac
])
dnl GLIB_STR_CONTAINS (SRC_STRING, SUB_STRING [, CONTAINS_ACTION] [, ELSE_ACTION])
AC_DEFUN(GLIB_STR_CONTAINS,[
case "[$1]" in
*"[$2]"*[)]
[$3]
;;
*[)]
[$4]
;;
esac
])
dnl GLIB_ADD_TO_VAR (ENV_VARIABLE, CHECK_STRING, ADD_STRING)
AC_DEFUN(GLIB_ADD_TO_VAR,[
GLIB_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]")
])
dnl GLIB_SIZEOF (INCLUDES, TYPE, ALIAS [, CROSS-SIZE])
AC_DEFUN(GLIB_SIZEOF,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(glib_sizeof_$3, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(glib_cv_sizeof_$3, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(size of $2)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
$1
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($2));
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$4], , , AC_CV_NAME=$4))])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl GLIB_BYTE_CONTENTS (INCLUDES, TYPE, ALIAS, N_BYTES, INITIALIZER)
AC_DEFUN(GLIB_BYTE_CONTENTS,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(glib_byte_contents_$3, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(glib_cv_byte_contents_$3, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(byte contents of $2)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
$1
main()
{
static $2 tv = $5;
char *p = (char*) &tv;
int i;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
for (i = 0; i < $4; i++)
fprintf(f, "%s%d", i?",":"", *(p++));
fprintf(f, "\n");
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl GLIB_SYSDEFS (INCLUDES, DEFS_LIST, OFILE [, PREFIX])
AC_DEFUN(GLIB_SYSDEFS,
[glib_sysdefso="translit($3, [-_a-zA-Z0-9 *], [-_a-zA-Z0-9])"
glib_sysdef_msg=`echo $2 | sed 's/:[[^ ]]*//g'`
if test "x`(echo '\n') 2>/dev/null`" != 'x\n'; then
glib_nl='\\n'
else
glib_nl='\n'
fi
AC_MSG_CHECKING(system definitions for $glib_sysdef_msg)
cat >confrun.c <<_______EOF
#include <stdio.h>
$1
int main (int c, char **v) {
FILE *f = fopen ("$glib_sysdefso", "a");
if (!f) return 1;
_______EOF
for glib_sysdef_input in $2 ; do
glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
echo "#ifdef $glib_sysdef" >>confrun.c
echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_sysdef);" >>confrun.c
echo "#else" >>confrun.c
if test $glib_sysdef != $glib_default; then
echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_default);" >>confrun.c
else
echo " fprintf (f, \"#define GLIB_SYSDEF_%s${glib_nl}\", \"$glib_sysdef\");" >>confrun.c
fi
echo "#endif" >>confrun.c
done
echo "return 0; }" >>confrun.c
AC_TRY_RUN(`cat confrun.c`, AC_MSG_RESULT(done),
[ for glib_sysdef_input in $2 ; do
glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
if test $glib_sysdef != $glib_default; then
glib_default=" $4$glib_default"
else
glib_default=
fi
echo "#define GLIB_SYSDEF_$glib_sysdef$glib_default" >>$glib_sysdefso
done
AC_MSG_RESULT(failed)])
rm -f confrun.c
])

Просмотреть файл

@ -1,625 +0,0 @@
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 35 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
DLLTOOL="$DLLTOOL" AS="$AS" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
*-*-cygwin*)
AC_SYS_LIBTOOL_CYGWIN
;;
esac
# enable the --disable-libtool-lock switch
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock force libtool not to do file locking],
need_locks=$enableval,
need_locks=yes)
if test x"$need_locks" = xno; then
libtool_flags="$libtool_flags --disable-lock"
fi
])
# AC_LIBTOOL_DLOPEN - check for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED,
[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED,
[AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC,
[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC,
[AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL,
[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL,
[AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
/* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])
# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
# by C symbol name from nm.
AC_DEFUN(AC_SYS_NM_PARSE,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_NM])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output])
AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
[# These are sane defaults that work on at least a few old systems.
# {They come from Ultrix. What could be older than Ultrix?!! ;)}
changequote(,)dnl
# Character class describing NM global symbol codes.
ac_symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Transform the above into a raw symbol and a C symbol.
ac_symxfrm='\1 \2\3 \3'
# Transform an extracted symbol line into a proper C declaration
ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
# Define system-specific variables.
case "$host_os" in
aix*)
ac_symcode='[BCDT]'
;;
cygwin* | mingw*)
ac_symcode='[ABCDGISTW]'
;;
hpux*)
ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
;;
irix*)
ac_symcode='[BCDEGRST]'
;;
solaris*)
ac_symcode='[BDT]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
ac_symcode='[ABCDGISTW]'
fi
changequote([,])dnl
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
# Check to see that the pipe works correctly.
ac_pipe_works=no
rm -f conftest.$ac_ext
cat > conftest.$ac_ext <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# Try sorting and uniquifying the output.
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
mv -f "$ac_nlist"T "$ac_nlist"
else
rm -f "$ac_nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define lt_ptr_t void *
#else
# define lt_ptr_t char *
# define const
#endif
/* The mapping between symbol names and symbols. */
const struct {
const char *name;
lt_ptr_t address;
}
changequote(,)dnl
lt_preloaded_symbols[] =
changequote([,])dnl
{
EOF
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
#ifdef __cplusplus
}
#endif
EOF
# Now try linking the two files.
mv conftest.$ac_objext conftestm.$ac_objext
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="conftestm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if AC_TRY_EVAL(ac_link) && test -s conftest; then
ac_pipe_works=yes
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
else
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "$progname: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
# Do not use the global_symbol_pipe unless it works.
if test "$ac_pipe_works" = yes; then
if test x"$ac_symprfx" = x"_"; then
ac_cv_sys_symbol_underscore=yes
else
ac_cv_sys_symbol_underscore=no
fi
break
else
ac_cv_sys_global_symbol_pipe=
fi
done
])
ac_result=yes
if test -z "$ac_cv_sys_global_symbol_pipe"; then
ac_result=no
fi
AC_MSG_RESULT($ac_result)
])
# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
])
# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
# with an underscore?
AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
[AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
AC_MSG_CHECKING([for _ prefix in compiled symbols])
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
])
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM, [
AC_CHECK_LIB(mw, _mwvalidcheckl)
AC_CHECK_LIB(m, cos)
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
case "$enable_ltdl_install" in
no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
"") enable_ltdl_install=yes
ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
esac
])
if test x"$enable_ltdl_install" != x"no"; then
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl

852
xpcom/typelib/xpidl/glib/glib-1.2.1/aclocal.m4 поставляемый
Просмотреть файл

@ -1,852 +0,0 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# serial 35 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
DLLTOOL="$DLLTOOL" AS="$AS" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
*-*-cygwin*)
AC_SYS_LIBTOOL_CYGWIN
;;
esac
# enable the --disable-libtool-lock switch
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock force libtool not to do file locking],
need_locks=$enableval,
need_locks=yes)
if test x"$need_locks" = xno; then
libtool_flags="$libtool_flags --disable-lock"
fi
])
# AC_LIBTOOL_DLOPEN - check for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED,
[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED,
[AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC,
[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC,
[AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL,
[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL,
[AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
/* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])
# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
# by C symbol name from nm.
AC_DEFUN(AC_SYS_NM_PARSE,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_NM])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output])
AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
[# These are sane defaults that work on at least a few old systems.
# {They come from Ultrix. What could be older than Ultrix?!! ;)}
changequote(,)dnl
# Character class describing NM global symbol codes.
ac_symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Transform the above into a raw symbol and a C symbol.
ac_symxfrm='\1 \2\3 \3'
# Transform an extracted symbol line into a proper C declaration
ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
# Define system-specific variables.
case "$host_os" in
aix*)
ac_symcode='[BCDT]'
;;
cygwin* | mingw*)
ac_symcode='[ABCDGISTW]'
;;
hpux*)
ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
;;
irix*)
ac_symcode='[BCDEGRST]'
;;
solaris*)
ac_symcode='[BDT]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
ac_symcode='[ABCDGISTW]'
fi
changequote([,])dnl
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
# Check to see that the pipe works correctly.
ac_pipe_works=no
rm -f conftest.$ac_ext
cat > conftest.$ac_ext <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# Try sorting and uniquifying the output.
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
mv -f "$ac_nlist"T "$ac_nlist"
else
rm -f "$ac_nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define lt_ptr_t void *
#else
# define lt_ptr_t char *
# define const
#endif
/* The mapping between symbol names and symbols. */
const struct {
const char *name;
lt_ptr_t address;
}
changequote(,)dnl
lt_preloaded_symbols[] =
changequote([,])dnl
{
EOF
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
#ifdef __cplusplus
}
#endif
EOF
# Now try linking the two files.
mv conftest.$ac_objext conftestm.$ac_objext
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="conftestm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if AC_TRY_EVAL(ac_link) && test -s conftest; then
ac_pipe_works=yes
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
else
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "$progname: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
# Do not use the global_symbol_pipe unless it works.
if test "$ac_pipe_works" = yes; then
if test x"$ac_symprfx" = x"_"; then
ac_cv_sys_symbol_underscore=yes
else
ac_cv_sys_symbol_underscore=no
fi
break
else
ac_cv_sys_global_symbol_pipe=
fi
done
])
ac_result=yes
if test -z "$ac_cv_sys_global_symbol_pipe"; then
ac_result=no
fi
AC_MSG_RESULT($ac_result)
])
# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
])
# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
# with an underscore?
AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
[AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
AC_MSG_CHECKING([for _ prefix in compiled symbols])
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
])
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM, [
AC_CHECK_LIB(mw, _mwvalidcheckl)
AC_CHECK_LIB(m, cos)
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
case "$enable_ltdl_install" in
no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
"") enable_ltdl_install=yes
ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
esac
])
if test x"$enable_ltdl_install" != x"no"; then
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# serial 1
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
# If the C compiler in not in ANSI C mode by default, try to add an option
# to output variable @code{CC} to make it so. This macro tries various
# options that select ANSI C on some system or another. It considers the
# compiler to be in ANSI C mode if it handles function prototypes correctly.
#
# If you use this macro, you should check after calling it whether the C
# compiler has been set to accept ANSI C; if not, the shell variable
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
# program @code{ansi2knr}, which comes with Ghostscript.
# @end defmac
AC_DEFUN(AM_PROG_CC_STDC,
[AC_REQUIRE([AC_PROG_CC])
AC_BEFORE([$0], [AC_C_INLINE])
AC_BEFORE([$0], [AC_C_CONST])
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
dnl a magic option to avoid problems with ANSI preprocessor commands
dnl like #elif.
dnl FIXME: can't do this because then AC_AIX won't work due to a
dnl circular dependency.
dnl AC_BEFORE([$0], [AC_PROG_CPP])
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
AC_CACHE_VAL(am_cv_prog_cc_stdc,
[am_cv_prog_cc_stdc=no
ac_save_CC="$CC"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
], [
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
],
[am_cv_prog_cc_stdc="$ac_arg"; break])
done
CC="$ac_save_CC"
])
if test -z "$am_cv_prog_cc_stdc"; then
AC_MSG_RESULT([none needed])
else
AC_MSG_RESULT($am_cv_prog_cc_stdc)
fi
case "x$am_cv_prog_cc_stdc" in
x|xno) ;;
*) CC="$CC $am_cv_prog_cc_stdc" ;;
esac
])

Просмотреть файл

@ -1,996 +0,0 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <<EOF >$dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
${CC-cc} $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
arm32:NetBSD:*:*)
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
macppc:NetBSD:*:*)
echo powerpc-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 )
sed 's/^ //' << EOF >$dummy.c
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
rm -f $dummy.c $dummy
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
*9??*:MPE*:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
*9??*:MPE*:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*T3E:*:*:*)
echo t3e-cray-unicosmk${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
if test -x /usr/bin/objformat; then
if test "elf" = "`/usr/bin/objformat`"; then
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0
fi
fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# uname on the ARM produces all sorts of strangeness, and we need to
# filter it out.
case "$UNAME_MACHINE" in
armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
arm* | sa110*) UNAME_MACHINE="arm" ;;
esac
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g
s/.*supported emulations: *//
s/ .*//
p'`
case "$ld_supported_emulations" in
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
esac
if test "${UNAME_MACHINE}" = "alpha" ; then
sed 's/^ //' <<EOF >$dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
LIBC=""
${CC-cc} $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
objdump --private-headers $dummy | \
grep ld.so.1 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >$dummy.c <<EOF
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
#ifdef __MIPSEL__
printf ("%sel-unknown-linux-gnu\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
# If ld does not provide *any* "supported emulations:"
# that means it is gnuoldld.
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
case "${UNAME_MACHINE}" in
i?86)
VENDOR=pc;
;;
*)
VENDOR=unknown;
;;
esac
# Determine whether the default compiler is a.out or elf
cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i?86:UnixWare:*:*)
if /bin/uname -X 2>/dev/null >/dev/null ; then
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
fi
echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
exit 0 ;;
pc:*:*:*)
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
news*:NEWS-OS:*:6*)
echo mips-sony-newsos6
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1

Просмотреть файл

@ -1,161 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have <unistd.h>. */
#undef HAVE_UNISTD_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
#undef ENABLE_MEM_CHECK
#undef ENABLE_MEM_PROFILE
#undef REALLOC_0_WORKS
#undef G_COMPILED_WITH_DEBUGGING
#undef G_THREADS_ENABLED
#undef GLIB_SIZEOF_GMUTEX
#undef GLIB_BYTE_CONTENTS_GMUTEX
#undef HAVE_BROKEN_WCTYPE
#undef HAVE_DOPRNT
#undef HAVE_FLOAT_H
#undef HAVE_GETPWUID_R
#undef HAVE_GETPWUID_R_POSIX
#undef HAVE_LIMITS_H
#undef HAVE_LONG_DOUBLE
#undef HAVE_POLL
#undef HAVE_PTHREAD_COND_TIMEDWAIT_POSIX
#undef HAVE_PTHREAD_GETSPECIFIC_POSIX
#undef HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX
#undef HAVE_PWD_H
#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_POLL_H
#undef HAVE_SYS_SELECT_H
#undef HAVE_SYS_TIME_H
#undef HAVE_SYS_TIMES_H
#undef HAVE_STRERROR
#undef HAVE_STRSIGNAL
#undef HAVE_UNISTD_H
#undef HAVE_VALUES_H
#undef HAVE_WCHAR_H
#undef HAVE_WCTYPE_H
#undef NO_FD_SET
#undef NO_SYS_ERRLIST
#undef NO_SYS_SIGLIST
#undef NO_SYS_SIGLIST_DECL
#undef G_VA_COPY
#undef G_VA_COPY_AS_ARRAY
#undef G_HAVE___INLINE
#undef G_HAVE___INLINE__
#undef G_HAVE_INLINE
#undef GLIB_MAJOR_VERSION
#undef GLIB_MINOR_VERSION
#undef GLIB_MICRO_VERSION
#undef GLIB_INTERFACE_AGE
#undef GLIB_BINARY_AGE
#undef G_THREAD_SOURCE
/* The number of bytes in a char. */
#undef SIZEOF_CHAR
/* The number of bytes in a int. */
#undef SIZEOF_INT
/* The number of bytes in a long. */
#undef SIZEOF_LONG
/* The number of bytes in a long long. */
#undef SIZEOF_LONG_LONG
/* The number of bytes in a short. */
#undef SIZEOF_SHORT
/* The number of bytes in a void *. */
#undef SIZEOF_VOID_P
/* Define if you have the atexit function. */
#undef HAVE_ATEXIT
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the on_exit function. */
#undef HAVE_ON_EXIT
/* Define if you have the poll function. */
#undef HAVE_POLL
/* Define if you have the rand_r function. */
#undef HAVE_RAND_R
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define if you have the w library (-lw). */
#undef HAVE_LIBW

Просмотреть файл

@ -1,139 +0,0 @@
/* config.h.mac. Handcrafted for Metrowerks on Mac OS */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if you have <unistd.h>. */
#define HAVE_UNISTD_H 1
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 1
/* #undef ENABLE_MEM_CHECK */
/* #undef ENABLE_MEM_PROFILE */
#define G_COMPILED_WITH_DEBUGGING "minimum"
/* #undef HAVE_BROKEN_WCTYPE */
/* #undef HAVE_DOPRNT */
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
/* #undef HAVE_LOCALTIME_R */
/* #undef HAVE_LONG_DOUBLE */
/* #undef HAVE_POLL */
/* #undef HAVE_PWD_H */
/* #undef HAVE_SYS_PARAM_H */
/* #undef HAVE_SYS_POLL_H */
/* #undef HAVE_SYS_SELECT_H */
/* #undef HAVE_SYS_TIME_H */
/* #undef HAVE_SYS_TIMES_H */
#define HAVE_STRERROR 1
/* #undef HAVE_STRSIGNAL */
/* #undef HAVE_UNISTD_H */
/* #undef HAVE_VSNPRINTF */
/* #undef HAVE_VALUES_H */
#define HAVE_VPRINTF 1
#define HAVE_WCHAR_H 1
#define HAVE_WCTYPE_H 1
/* #undef NO_FD_SET */
/* #undef NO_SYS_ERRLIST */
#define NO_SYS_SIGLIST 1
/* #undef G_VA_COPY */
/* #undef G_VA_COPY_AS_ARRAY */
#define G_HAVE___INLINE 1
#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 2
#define GLIB_MICRO_VERSION 0
#define GLIB_INTERFACE_AGE 0
#define GLIB_BINARY_AGE 0
#define G_THREAD_SOURCE "gthread-nspr.c"
#define HAVE_PTHREAD_COND_TIMEDWAIT_POSIX 1
#define HAVE_PTHREAD_GETSPECIFIC_POSIX 1
#define HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX 1
/* The number of bytes in a char. */
#define SIZEOF_CHAR 1
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
/* Define if you have the atexit function. */
#define HAVE_ATEXIT 1
/* Define if you have the lstat function. */
/* #undef HAVE_LSTAT */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the on_exit function. */
/* #undef HAVE_ON_EXIT */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP ^*/
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strsignal function. */
/* #undef HAVE_STRSIGNAL */
/* Define if you have the vsnprintf function. */
/* #undef HAVE_VSNPRINTF */
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define if you have the <sys/times.h> header file. */
/* #undef HAVE_SYS_TIMES_H */
/* Define if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Define if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define if you have the w library (-lw). */
/* #undef HAVE_LIBW */

Просмотреть файл

@ -1,139 +0,0 @@
/* config.h.mac. Handcrafted for Metrowerks on Mac OS */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if you have <unistd.h>. */
#define HAVE_UNISTD_H 1
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 1
/* #undef ENABLE_MEM_CHECK */
/* #undef ENABLE_MEM_PROFILE */
#define G_COMPILED_WITH_DEBUGGING "minimum"
/* #undef HAVE_BROKEN_WCTYPE */
/* #undef HAVE_DOPRNT */
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
/* #undef HAVE_LOCALTIME_R */
/* #undef HAVE_LONG_DOUBLE */
/* #undef HAVE_POLL */
/* #undef HAVE_PWD_H */
/* #undef HAVE_SYS_PARAM_H */
/* #undef HAVE_SYS_POLL_H */
/* #undef HAVE_SYS_SELECT_H */
/* #undef HAVE_SYS_TIME_H */
/* #undef HAVE_SYS_TIMES_H */
#define HAVE_STRERROR 1
/* #undef HAVE_STRSIGNAL */
/* #undef HAVE_UNISTD_H */
/* #undef HAVE_VSNPRINTF */
/* #undef HAVE_VALUES_H */
#define HAVE_VPRINTF 1
#define HAVE_WCHAR_H 1
#define HAVE_WCTYPE_H 1
/* #undef NO_FD_SET */
/* #undef NO_SYS_ERRLIST */
#define NO_SYS_SIGLIST 1
/* #undef G_VA_COPY */
/* #undef G_VA_COPY_AS_ARRAY */
#define G_HAVE___INLINE 1
#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 2
#define GLIB_MICRO_VERSION 0
#define GLIB_INTERFACE_AGE 0
#define GLIB_BINARY_AGE 0
#define G_THREAD_SOURCE "gthread-nspr.c"
#define HAVE_PTHREAD_COND_TIMEDWAIT_POSIX 1
#define HAVE_PTHREAD_GETSPECIFIC_POSIX 1
#define HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX 1
/* The number of bytes in a char. */
#define SIZEOF_CHAR 1
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
/* Define if you have the atexit function. */
#define HAVE_ATEXIT 1
/* Define if you have the lstat function. */
/* #undef HAVE_LSTAT */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the on_exit function. */
/* #undef HAVE_ON_EXIT */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP ^*/
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strsignal function. */
/* #undef HAVE_STRSIGNAL */
/* Define if you have the vsnprintf function. */
/* #undef HAVE_VSNPRINTF */
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define if you have the <sys/times.h> header file. */
/* #undef HAVE_SYS_TIMES_H */
/* Define if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Define if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define if you have the w library (-lw). */
/* #undef HAVE_LIBW */

Просмотреть файл

@ -1,139 +0,0 @@
/* config.h.win32. Handcrafted for Microsoft C */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if you have <unistd.h>. */
/* #undef HAVE_UNISTD_H */
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* #undef ENABLE_MEM_CHECK */
/* #undef ENABLE_MEM_PROFILE */
#define G_COMPILED_WITH_DEBUGGING "minimum"
/* #undef HAVE_BROKEN_WCTYPE */
/* #undef HAVE_DOPRNT */
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
/* #undef HAVE_LOCALTIME_R */
/* #undef HAVE_LONG_DOUBLE */
/* #undef HAVE_POLL */
/* #undef HAVE_PWD_H */
/* #undef HAVE_SYS_PARAM_H */
/* #undef HAVE_SYS_POLL_H */
/* #undef HAVE_SYS_SELECT_H */
/* #undef HAVE_SYS_TIME_H */
/* #undef HAVE_SYS_TIMES_H */
#define HAVE_STRERROR 1
/* #undef HAVE_STRSIGNAL */
/* #undef HAVE_UNISTD_H */
/* #undef HAVE_VSNPRINTF */
/* #undef HAVE_VALUES_H */
#define HAVE_VPRINTF 1
#define HAVE_WCHAR_H 1
#define HAVE_WCTYPE_H 1
/* #undef NO_FD_SET */
/* #undef NO_SYS_ERRLIST */
#define NO_SYS_SIGLIST 1
/* #undef G_VA_COPY */
/* #undef G_VA_COPY_AS_ARRAY */
#define G_HAVE___INLINE 1
#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 2
#define GLIB_MICRO_VERSION 0
#define GLIB_INTERFACE_AGE 0
#define GLIB_BINARY_AGE 0
#define G_THREAD_SOURCE "gthread-posix.c"
#define HAVE_PTHREAD_COND_TIMEDWAIT_POSIX 1
#define HAVE_PTHREAD_GETSPECIFIC_POSIX 1
#define HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX 1
/* The number of bytes in a char. */
#define SIZEOF_CHAR 1
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
/* Define if you have the atexit function. */
#define HAVE_ATEXIT 1
/* Define if you have the lstat function. */
/* #undef HAVE_LSTAT */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the on_exit function. */
/* #undef HAVE_ON_EXIT */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP ^*/
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strsignal function. */
/* #undef HAVE_STRSIGNAL */
/* Define if you have the vsnprintf function. */
/* #undef HAVE_VSNPRINTF */
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define if you have the <sys/times.h> header file. */
/* #undef HAVE_SYS_TIMES_H */
/* Define if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Define if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define if you have the w library (-lw). */
/* #undef HAVE_LIBW */

979
xpcom/typelib/xpidl/glib/glib-1.2.1/config.sub поставляемый
Просмотреть файл

@ -1,979 +0,0 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
then
echo Configuration name missing. 1>&2
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
echo "or $0 ALIAS" 1>&2
echo where ALIAS is a recognized configuration type. 1>&2
exit 1
fi
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
| hppa2.0w \
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
| mipstx39 | mipstx39el \
| sparc | sparclet | sparclite | sparc64 | v850)
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[34567]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
| hppa2.0w-* \
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
| sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* \
| mipstx39-* | mipstx39el-* \
| f301-* | armv*-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigaos | amigados)
basic_machine=m68k-cbm
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
os=-mpeix
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
os=-mpeix
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[34567]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[34567]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[34567]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[34567]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netwinder)
basic_machine=armv4l-corel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | nexen)
basic_machine=i586-pc
;;
pentiumpro | p6 | k6 | 6x86)
basic_machine=i686-pc
;;
pentiumii | pentium2)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | k6-* | 6x86-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
| -openstep* | -mpeix* | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-corel)
os=-linux
;;
arm*-semi)
os=-aout
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os

6694
xpcom/typelib/xpidl/glib/glib-1.2.1/configure поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1,17 +0,0 @@
## Process this file with automake to produce Makefile.in
info_TEXINFOS = glib.texi
man_MANS = glib-config.1
EXTRA_DIST = glib-config.1.in \
glib.html \
glib_toc.html
glib.html glib_toc.html:
(cd $(srcdir); texi2html glib.texi)
files:
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
echo $$p; \
done

Просмотреть файл

@ -1,53 +0,0 @@
.TH GLIB 1 "16 December 1998" Version @VERSION@
.SH NAME
glib-config - script to get information about the installed version of GLib
.SH SYNOPSIS
.B glib-config [\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags] [LIBRARIES]
.SH DESCRIPTION
.PP
\fIglib-config\fP is a tool that is used to configure to determine
the compiler and linker flags that should be used to compile
and link programs that use \fIGLib\fP. It is also used internally
to the .m4 macros for GNU autoconf that are included with \fIGLib\fP.
.
.SH OPTIONS
.l
\fIglib-config\fP accepts the following options:
.TP 8
.B LIBRARIES
\fIGLib\fP has three libraries 'glib', 'gmodule' and 'gthread'. If you specify one of
them, only the appropriate things for that library will be printed.
.TP 8
.B \-\-version
Print the currently installed version of \fIGLib\fP on the standard output.
.TP 8
.B \-\-libs
Print the linker flags that are necessary to link a \fIGLib\fP program.
.TP 8
.B \-\-cflags
Print the compiler flags that are necessary to compile a \fIGLib\fP program.
.TP 8
.B \-\-prefix=PREFIX
If specified, use PREFIX instead of the installation prefix that \fIGLib\fP
was built with when computing the output for the \-\-cflags and
\-\-libs options. This option is also used for the exec prefix
if \-\-exec\-prefix was not specified. This option must be specified
before any \-\-libs or \-\-cflags options.
.TP 8
.B \-\-exec\-prefix=PREFIX
If specified, use PREFIX instead of the installation exec prefix that
\fIGLib\fP was built with when computing the output for the \-\-cflags
and \-\-libs options. This option must be specified before any
\-\-libs or \-\-cflags options.
.SH SEE ALSO
.BR gtk-config (1),
.BR gimp (1),
.BR gimptool (1)
.SH COPYRIGHT
Copyright \(co 1998 Owen Taylor
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.

Просмотреть файл

@ -1,812 +0,0 @@
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.54
from glib.texi on 24 Febuary 1999 -->
<TITLE>GLIB</TITLE>
</HEAD>
<BODY>
<H1>GLIB, Useful routines for C programming </H1>
<H2>Version 1.0</H2>
<H2>Feburary 1998</H2>
<ADDRESS>by Gregory McLean</ADDRESS>
<P>
<P><HR><P>
<H1><A NAME="SEC1" HREF="glib_toc.html#TOC1">Copying</A></H1>
<H1><A NAME="SEC2" HREF="glib_toc.html#TOC2">What is GLIB</A></H1>
<H1><A NAME="SEC3" HREF="glib_toc.html#TOC3">Doubly linked lists</A></H1>
<H3><A NAME="SEC4" HREF="glib_toc.html#TOC4">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_alloc</B> <I>(void)</I>
<DD><A NAME="IDX1"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_list_free</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX2"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_list_free_1</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX3"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_append</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX4"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_prepend</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX5"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_insert</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>, gint <VAR>position</VAR>)</I>
<DD><A NAME="IDX6"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_insert_sorted</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>, GCompareFunc <VAR>func</VAR>)</I>
<DD><A NAME="IDX7"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_concat</B> <I>(GList *<VAR>list1</VAR>, GList *<VAR>list2</VAR>)</I>
<DD><A NAME="IDX8"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_remove</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX9"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_remove_link</B> <I>(GList *<VAR>list</VAR>, GList *<VAR>link</VAR>)</I>
<DD><A NAME="IDX10"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_reverse</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX11"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_nth</B> <I>(GList *<VAR>list</VAR>, gint <VAR>n</VAR>)</I>
<DD><A NAME="IDX12"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_find</B> <I>(GList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX13"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_last</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX14"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GList* <B>g_list_first</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX15"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gint <B>g_list_length</B> <I>(GList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX16"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_list_foreach</B> <I>(GList *<VAR>list</VAR>, GFunc <VAR>func</VAR>, gpointer <VAR>user_data</VAR>)</I>
<DD><A NAME="IDX17"></A>
</DL>
</P>
<H1><A NAME="SEC5" HREF="glib_toc.html#TOC5">Signly linked lists</A></H1>
<H3><A NAME="SEC6" HREF="glib_toc.html#TOC6">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_alloc</B> <I>(void)</I>
<DD><A NAME="IDX18"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_slist_free</B> <I>(GSList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX19"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_slist_free_1</B> <I>(GSList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX20"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_append</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX21"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_prepend</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX22"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_insert</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>, gint <VAR>position</VAR>)</I>
<DD><A NAME="IDX23"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_insert_sorted</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>, GCompareFunc <VAR>func</VAR>)</I>
<DD><A NAME="IDX24"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_concat</B> <I>(GSList *<VAR>list1</VAR>, GSList *<VAR>list2</VAR>)</I>
<DD><A NAME="IDX25"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_remove</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX26"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_remove_link</B> <I>(GSList *<VAR>list</VAR>, GSList *<VAR>link</VAR>)</I>
<DD><A NAME="IDX27"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_reverse</B> <I>(GSList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX28"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_nth</B> <I>(GSList *<VAR>list</VAR>, gint <VAR>n</VAR>)</I>
<DD><A NAME="IDX29"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_find</B> <I>(GSList *<VAR>list</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX30"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GSList* <B>g_slist_last</B> <I>(GSList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX31"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gint <B>g_slist_length</B> <I>(GSList *<VAR>list</VAR>)</I>
<DD><A NAME="IDX32"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_slist_foreach</B> <I>(GSList *<VAR>list</VAR>, GFunc <VAR>func</VAR>, gpointer <VAR>user_data</VAR>)</I>
<DD><A NAME="IDX33"></A>
</DL>
</P>
<H1><A NAME="SEC7" HREF="glib_toc.html#TOC7">List allocators</A></H1>
<H3><A NAME="SEC8" HREF="glib_toc.html#TOC8">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GListAllocator* <B>g_list_allocator_new</B> <I>(void)</I>
<DD><A NAME="IDX34"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_list_allocator_free</B> <I>(GListAllocator *<VAR>allocator</VAR>)</I>
<DD><A NAME="IDX35"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GListAllocator* <B>g_slist_set_allocator</B> <I>(GListAllocator *<VAR>allocator</VAR>)</I>
<DD><A NAME="IDX36"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GListAllocator* <B>g_list_set_allocator</B> <I>(GListAllocator *<VAR>allocator</VAR>)</I>
<DD><A NAME="IDX37"></A>
</DL>
</P>
<H1><A NAME="SEC9" HREF="glib_toc.html#TOC9">Hash tables</A></H1>
<H3><A NAME="SEC10" HREF="glib_toc.html#TOC10">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GHashTable* <B>g_hash_table_new</B> <I>(GHashFunc <VAR>hash_func</VAR>, GCompareFunc <VAR>key_compare_func</VAR>)</I>
<DD><A NAME="IDX38"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_destroy</B> <I>(GHashTable *<VAR>hash_table</VAR>)</I>
<DD><A NAME="IDX39"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_insert</B> <I>(GHashTable *<VAR>hash_table</VAR>, gpointer <VAR>key</VAR>, gpointer <VAR>value</VAR>)</I>
<DD><A NAME="IDX40"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_remove</B> <I>(GHashTable *<VAR>hash_table</VAR>, gpointer <VAR>key</VAR>)</I>
<DD><A NAME="IDX41"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_hash_table_lookup</B> <I>(GHashTable *<VAR>hash_table</VAR>, gpointer <VAR>key</VAR>)</I>
<DD><A NAME="IDX42"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_freeze</B> <I>(GHashTable *<VAR>hash_table</VAR>)</I>
<DD><A NAME="IDX43"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_thaw</B> <I>(GHashTable *<VAR>hash_table</VAR>)</I>
<DD><A NAME="IDX44"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_hash_table_foreach</B> <I>(GHashTable *<VAR>hash_table</VAR>, GHFunc <VAR>func</VAR>, gpointer <VAR>user_data</VAR>)</I>
<DD><A NAME="IDX45"></A>
</DL>
</P>
<H1><A NAME="SEC11" HREF="glib_toc.html#TOC11">Cache handling</A></H1>
<H3><A NAME="SEC12" HREF="glib_toc.html#TOC12">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GCache* <B>g_cache_new</B> <I>(GCacheNewFunc <VAR>value_new_func</VAR>, GCacheDestroyFunc <VAR>value_destroy_func</VAR>, GCacheDupFunc <VAR>key_dup_func</VAR>, GCacheDestroyFunc <VAR>key_destroy_func</VAR>, GHashFunc <VAR>hash_key_func</VAR>, GHashFunc <VAR>hash_value_func</VAR>, GCompareFunc <VAR>key_compare_func</VAR>)</I>
<DD><A NAME="IDX46"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_cache_destroy</B> <I>(GCache *<VAR>cache</VAR>)</I>
<DD><A NAME="IDX47"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_cache_insert</B> <I>(GCache *<VAR>cache</VAR>, gpointer <VAR>key</VAR>)</I>
<DD><A NAME="IDX48"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_cache_remove</B> <I>(GCache *<VAR>cache</VAR>, gpointer <VAR>key</VAR>)</I>
<DD><A NAME="IDX49"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_cache_key_foreach</B> <I>(GCache *<VAR>cache</VAR>, GHFunc <VAR>func</VAR>, gpointer <VAR>user_data</VAR>)</I>
<DD><A NAME="IDX50"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_cache_value_foreach</B> <I>(GCache *<VAR>cache</VAR>, GHFunc <VAR>func</VAR>, gpointer <VAR>user_data</VAR>)</I>
<DD><A NAME="IDX51"></A>
</DL>
</P>
<H1><A NAME="SEC13" HREF="glib_toc.html#TOC13">Tree handling</A></H1>
<H3><A NAME="SEC14" HREF="glib_toc.html#TOC14">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GTree* <B>g_tree_new</B> <I>(GCompareFunc <VAR>key_compare_func</VAR>)</I>
<DD><A NAME="IDX52"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_tree_destroy</B> <I>(GTree *<VAR>tree</VAR>)</I>
<DD><A NAME="IDX53"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_tree_remove</B> <I>(GTree *<VAR>tree</VAR>, gpointer <VAR>key</VAR>, gpointer <VAR>value</VAR>)</I>
<DD><A NAME="IDX54"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_tree_lookup</B> <I>(GTree *<VAR>tree</VAR>, gpointer <VAR>key</VAR>)</I>
<DD><A NAME="IDX55"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_tree_traverse</B> <I>(GTree *<VAR>tree</VAR>, GTraverseFunc <VAR>traverse_func</VAR>, GTraverseType <VAR>traverse_type</VAR>, gpointer <VAR>data</VAR></I>
<DD><A NAME="IDX56"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_tree_search</B> <I>(GTree *<VAR>tree</VAR>, GSearchFunc <VAR>search_func</VAR>, gpointer <VAR>data</VAR>)</I>
<DD><A NAME="IDX57"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gint <B>g_tree_height</B> <I>(GTree *<VAR>tree</VAR>)</I>
<DD><A NAME="IDX58"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gint <B>g_tree_nnodes</B> <I>(GTree *<VAR>tree</VAR>)</I>
<DD><A NAME="IDX59"></A>
</DL>
</P>
<H1><A NAME="SEC15" HREF="glib_toc.html#TOC15">Memory handling</A></H1>
<H3><A NAME="SEC16" HREF="glib_toc.html#TOC16">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_malloc</B> <I>(gulong <VAR>size</VAR>)</I>
<DD><A NAME="IDX60"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_malloc0</B> <I>(gulong <VAR>size</VAR>)</I>
<DD><A NAME="IDX61"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_realloc</B> <I>(gpointer <VAR>mem</VAR>, gulong <VAR>size</VAR>)</I>
<DD><A NAME="IDX62"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_profile</B> <I>(void)</I>
<DD><A NAME="IDX63"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_check</B> <I>(gpointer <VAR>mem</VAR>)</I>
<DD><A NAME="IDX64"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> GMemChunk* <B>g_mem_chunk_new</B> <I>(gchar *<VAR>name</VAR>, gint <VAR>atom_size</VAR>, gulong <VAR>area_size</VAR>, gint <VAR>type</VAR>)</I>
<DD><A NAME="IDX65"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_destroy</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>)</I>
<DD><A NAME="IDX66"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gpointer <B>g_mem_chunk_alloc</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>)</I>
<DD><A NAME="IDX67"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_free</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>, gpointer <VAR>mem</VAR>)</I>
<DD><A NAME="IDX68"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_clean</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>)</I>
<DD><A NAME="IDX69"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_reset</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>)</I>
<DD><A NAME="IDX70"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_print</B> <I>(GMemChunk *<VAR>mem_chunk</VAR>)</I>
<DD><A NAME="IDX71"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_mem_chunk_info</B> <I>(void)</I>
<DD><A NAME="IDX72"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_blow_chunks</B> <I>(void)</I>
<DD><A NAME="IDX73"></A>
Not what you might be thinking, <CODE>g_blow_chunks()</CODE> simply compresses all
the chunks. This operation consists of freeing every memory area that should
be freed (but which we haven't gotten around to doing yet).
</DL>
</P>
<H1><A NAME="SEC17" HREF="glib_toc.html#TOC17">Timer functions</A></H1>
<H3><A NAME="SEC18" HREF="glib_toc.html#TOC18">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> GTimer* <B>g_timer_new</B> <I>(void)</I>
<DD><A NAME="IDX74"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_timer_destroy</B> <I>(GTimer *<VAR>timer</VAR>)</I>
<DD><A NAME="IDX75"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_timer_start</B> <I>(GTimer *<VAR>timer</VAR>)</I>
<DD><A NAME="IDX76"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_timer_stop</B> <I>(GTimer *<VAR>timer</VAR>)</I>
<DD><A NAME="IDX77"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_timer_reset</B> <I>(GTimer *<VAR>timer</VAR>)</I>
<DD><A NAME="IDX78"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> gdouble <B>g_timer_elapsed</B> <I>(GTimer *<VAR>timer</VAR>, gulong *<VAR>microseconds</VAR>)</I>
<DD><A NAME="IDX79"></A>
</DL>
</P>
<H1><A NAME="SEC19" HREF="glib_toc.html#TOC19">Output functions</A></H1>
<H3><A NAME="SEC20" HREF="glib_toc.html#TOC20">Functions</A></H3>
<P>
<DL>
<DT><U>Function:</U> void <B>g_error</B> <I>(gchar *<VAR>format</VAR>, ...)</I>
<DD><A NAME="IDX80"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_warning</B> <I>(gchar *<VAR>format</VAR>, ...)</I>
<DD><A NAME="IDX81"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_message</B> <I>(gchar *<VAR>format</VAR>, ...)</I>
<DD><A NAME="IDX82"></A>
</DL>
</P>
<P>
<DL>
<DT><U>Function:</U> void <B>g_print</B> <I>(gchar *<VAR>format</VAR>, ...)</I>
<DD><A NAME="IDX83"></A>
</DL>
</P>
<H1><A NAME="SEC21" HREF="glib_toc.html#TOC21">Utility functions</A></H1>
<H1><A NAME="SEC22" HREF="glib_toc.html#TOC22">Error handling</A></H1>
<H1><A NAME="SEC23" HREF="glib_toc.html#TOC23">String chunks</A></H1>
<H1><A NAME="SEC24" HREF="glib_toc.html#TOC24">String handling</A></H1>
<H1><A NAME="SEC25" HREF="glib_toc.html#TOC25">Resizable arrays</A></H1>
<H1><A NAME="SEC26" HREF="glib_toc.html#TOC26">Flexible lexical scanner</A></H1>
<H1><A NAME="SEC27" HREF="glib_toc.html#TOC27">Other stuff</A></H1>
<H1><A NAME="SEC28" HREF="glib_toc.html#TOC28">Function Index</A></H1>
<P>
<H2>g</H2>
<DIR>
<LI><A HREF="glib.html#IDX73">g_blow_chunks</A>
<LI><A HREF="glib.html#IDX47">g_cache_destroy</A>
<LI><A HREF="glib.html#IDX48">g_cache_insert</A>
<LI><A HREF="glib.html#IDX50">g_cache_key_foreach</A>
<LI><A HREF="glib.html#IDX46">g_cache_new</A>
<LI><A HREF="glib.html#IDX49">g_cache_remove</A>
<LI><A HREF="glib.html#IDX51">g_cache_value_foreach</A>
<LI><A HREF="glib.html#IDX80">g_error</A>
<LI><A HREF="glib.html#IDX39">g_hash_table_destroy</A>
<LI><A HREF="glib.html#IDX45">g_hash_table_foreach</A>
<LI><A HREF="glib.html#IDX43">g_hash_table_freeze</A>
<LI><A HREF="glib.html#IDX40">g_hash_table_insert</A>
<LI><A HREF="glib.html#IDX42">g_hash_table_lookup</A>
<LI><A HREF="glib.html#IDX38">g_hash_table_new</A>
<LI><A HREF="glib.html#IDX41">g_hash_table_remove</A>
<LI><A HREF="glib.html#IDX44">g_hash_table_thaw</A>
<LI><A HREF="glib.html#IDX1">g_list_alloc</A>
<LI><A HREF="glib.html#IDX35">g_list_allocator_free</A>
<LI><A HREF="glib.html#IDX34">g_list_allocator_new</A>
<LI><A HREF="glib.html#IDX4">g_list_append</A>
<LI><A HREF="glib.html#IDX8">g_list_concat</A>
<LI><A HREF="glib.html#IDX13">g_list_find</A>
<LI><A HREF="glib.html#IDX15">g_list_first</A>
<LI><A HREF="glib.html#IDX17">g_list_foreach</A>
<LI><A HREF="glib.html#IDX2">g_list_free</A>
<LI><A HREF="glib.html#IDX3">g_list_free_1</A>
<LI><A HREF="glib.html#IDX6">g_list_insert</A>
<LI><A HREF="glib.html#IDX7">g_list_insert_sorted</A>
<LI><A HREF="glib.html#IDX14">g_list_last</A>
<LI><A HREF="glib.html#IDX16">g_list_length</A>
<LI><A HREF="glib.html#IDX12">g_list_nth</A>
<LI><A HREF="glib.html#IDX5">g_list_prepend</A>
<LI><A HREF="glib.html#IDX9">g_list_remove</A>
<LI><A HREF="glib.html#IDX10">g_list_remove_link</A>
<LI><A HREF="glib.html#IDX11">g_list_reverse</A>
<LI><A HREF="glib.html#IDX37">g_list_set_allocator</A>
<LI><A HREF="glib.html#IDX60">g_malloc</A>
<LI><A HREF="glib.html#IDX61">g_malloc0</A>
<LI><A HREF="glib.html#IDX64">g_mem_check</A>
<LI><A HREF="glib.html#IDX67">g_mem_chunk_alloc</A>
<LI><A HREF="glib.html#IDX69">g_mem_chunk_clean</A>
<LI><A HREF="glib.html#IDX66">g_mem_chunk_destroy</A>
<LI><A HREF="glib.html#IDX68">g_mem_chunk_free</A>
<LI><A HREF="glib.html#IDX72">g_mem_chunk_info</A>
<LI><A HREF="glib.html#IDX65">g_mem_chunk_new</A>
<LI><A HREF="glib.html#IDX71">g_mem_chunk_print</A>
<LI><A HREF="glib.html#IDX70">g_mem_chunk_reset</A>
<LI><A HREF="glib.html#IDX63">g_mem_profile</A>
<LI><A HREF="glib.html#IDX82">g_message</A>
<LI><A HREF="glib.html#IDX83">g_print</A>
<LI><A HREF="glib.html#IDX62">g_realloc</A>
<LI><A HREF="glib.html#IDX18">g_slist_alloc</A>
<LI><A HREF="glib.html#IDX21">g_slist_append</A>
<LI><A HREF="glib.html#IDX25">g_slist_concat</A>
<LI><A HREF="glib.html#IDX30">g_slist_find</A>
<LI><A HREF="glib.html#IDX33">g_slist_foreach</A>
<LI><A HREF="glib.html#IDX19">g_slist_free</A>
<LI><A HREF="glib.html#IDX20">g_slist_free_1</A>
<LI><A HREF="glib.html#IDX23">g_slist_insert</A>
<LI><A HREF="glib.html#IDX24">g_slist_insert_sorted</A>
<LI><A HREF="glib.html#IDX31">g_slist_last</A>
<LI><A HREF="glib.html#IDX32">g_slist_length</A>
<LI><A HREF="glib.html#IDX29">g_slist_nth</A>
<LI><A HREF="glib.html#IDX22">g_slist_prepend</A>
<LI><A HREF="glib.html#IDX26">g_slist_remove</A>
<LI><A HREF="glib.html#IDX27">g_slist_remove_link</A>
<LI><A HREF="glib.html#IDX28">g_slist_reverse</A>
<LI><A HREF="glib.html#IDX36">g_slist_set_allocator</A>
<LI><A HREF="glib.html#IDX75">g_timer_destroy</A>
<LI><A HREF="glib.html#IDX79">g_timer_elapsed</A>
<LI><A HREF="glib.html#IDX74">g_timer_new</A>
<LI><A HREF="glib.html#IDX78">g_timer_reset</A>
<LI><A HREF="glib.html#IDX76">g_timer_start</A>
<LI><A HREF="glib.html#IDX77">g_timer_stop</A>
<LI><A HREF="glib.html#IDX53">g_tree_destroy</A>
<LI><A HREF="glib.html#IDX58">g_tree_height</A>
<LI><A HREF="glib.html#IDX55">g_tree_lookup</A>
<LI><A HREF="glib.html#IDX52">g_tree_new</A>
<LI><A HREF="glib.html#IDX59">g_tree_nnodes</A>
<LI><A HREF="glib.html#IDX54">g_tree_remove</A>
<LI><A HREF="glib.html#IDX57">g_tree_search</A>
<LI><A HREF="glib.html#IDX56">g_tree_traverse</A>
<LI><A HREF="glib.html#IDX81">g_warning</A>
</DIR>
</P>
<H1><A NAME="SEC29" HREF="glib_toc.html#TOC29">Concept Index</A></H1>
<P>
</P>
<P><HR><P>
This document was generated on 24 Febuary 1999 using the
<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
translator version 1.54.</P>
</BODY>
</HTML>

Просмотреть файл

@ -1,512 +0,0 @@
This is Info file glib.info, produced by Makeinfo version 1.68 from the
input file glib.texi.
This file documents GLIB, A library of useful routines for C
programming
Copyright (C) 1998 Gregory A McLean
Permission is granted to make and distributed verbatim copies of this
manual, provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by Gregory McLean.
INFO-DIR-SECTION Library of useful routines for 'C' programing
START-INFO-DIR-ENTRY
* GLIB: (glib). useful routines for 'C' programming
END-INFO-DIR-ENTRY

File: glib.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir)
useful routines for 'C' programming
***********************************
This is edition 1.0 of the GLIB documentation, 3 Feburary 1998.
* Menu:
* Copying:: Your rights.
* Overview:: What is GLIB?
* Doubly linked lists:: Doubly linked lists
* Signly linked lists:: Singly linked lists
* List allocators:: List Allocators
* Hash tables:: Hash tables
* Caches:: Cache handling
* Trees:: Tree handling
* Memory:: Memory handling
* Timers:: Timer functions
* Output:: Output handling
* Utilities:: Utilitiy functions
* Errors:: Error handling
* String Chunks:: String Chunks
* Strings:: String handling
* Resizable arrays:: Resizeable arrays
* GScanner:: Flexible lexical scanner
* Miscellany:: Other stuff
* Function Index:: Index of functions
* Concept Index:: Index of concepts

File: glib.info, Node: Copying, Next: Overview, Prev: Top, Up: Top
Copying
*******

File: glib.info, Node: Overview, Next: Doubly linked lists, Prev: Copying, Up: Top
What is GLIB
************

File: glib.info, Node: Doubly linked lists, Next: Signly linked lists, Prev: Overview, Up: Top
Doubly linked lists
*******************
Functions
---------
- Function: GList* g_list_alloc (void)
- Function: void g_list_free (GList *LIST)
- Function: void g_list_free_1 (GList *LIST)
- Function: GList* g_list_append (GList *LIST, gpointer DATA)
- Function: GList* g_list_prepend (GList *LIST, gpointer DATA)
- Function: GList* g_list_insert (GList *LIST, gpointer DATA, gint
POSITION)
- Function: GList* g_list_insert_sorted (GList *LIST, gpointer DATA,
GCompareFunc FUNC)
- Function: GList* g_list_concat (GList *LIST1, GList *LIST2)
- Function: GList* g_list_remove (GList *LIST, gpointer DATA)
- Function: GList* g_list_remove_link (GList *LIST, GList *LINK)
- Function: GList* g_list_reverse (GList *LIST)
- Function: GList* g_list_nth (GList *LIST, gint N)
- Function: GList* g_list_find (GList *LIST, gpointer DATA)
- Function: GList* g_list_last (GList *LIST)
- Function: GList* g_list_first (GList *LIST)
- Function: gint g_list_length (GList *LIST)
- Function: void g_list_foreach (GList *LIST, GFunc FUNC, gpointer
USER_DATA)

File: glib.info, Node: Signly linked lists, Next: List allocators, Prev: Doubly linked lists, Up: Top
Signly linked lists
*******************
Functions
---------
- Function: GSList* g_slist_alloc (void)
- Function: void g_slist_free (GSList *LIST)
- Function: void g_slist_free_1 (GSList *LIST)
- Function: GSList* g_slist_append (GSList *LIST, gpointer DATA)
- Function: GSList* g_slist_prepend (GSList *LIST, gpointer DATA)
- Function: GSList* g_slist_insert (GSList *LIST, gpointer DATA, gint
POSITION)
- Function: GSList* g_slist_insert_sorted (GSList *LIST, gpointer
DATA, GCompareFunc FUNC)
- Function: GSList* g_slist_concat (GSList *LIST1, GSList *LIST2)
- Function: GSList* g_slist_remove (GSList *LIST, gpointer DATA)
- Function: GSList* g_slist_remove_link (GSList *LIST, GSList *LINK)
- Function: GSList* g_slist_reverse (GSList *LIST)
- Function: GSList* g_slist_nth (GSList *LIST, gint N)
- Function: GSList* g_slist_find (GSList *LIST, gpointer DATA)
- Function: GSList* g_slist_last (GSList *LIST)
- Function: gint g_slist_length (GSList *LIST)
- Function: void g_slist_foreach (GSList *LIST, GFunc FUNC, gpointer
USER_DATA)

File: glib.info, Node: List allocators, Next: Hash tables, Prev: Signly linked lists, Up: Top
List allocators
***************
Functions
---------
- Function: GListAllocator* g_list_allocator_new (void)
- Function: void g_list_allocator_free (GListAllocator *ALLOCATOR)
- Function: GListAllocator* g_slist_set_allocator (GListAllocator
*ALLOCATOR)
- Function: GListAllocator* g_list_set_allocator (GListAllocator
*ALLOCATOR)

File: glib.info, Node: Hash tables, Next: Caches, Prev: List allocators, Up: Top
Hash tables
***********
Functions
---------
- Function: GHashTable* g_hash_table_new (GHashFunc HASH_FUNC,
GCompareFunc KEY_COMPARE_FUNC)
- Function: void g_hash_table_destroy (GHashTable *HASH_TABLE)
- Function: void g_hash_table_insert (GHashTable *HASH_TABLE, gpointer
KEY, gpointer VALUE)
- Function: void g_hash_table_remove (GHashTable *HASH_TABLE, gpointer
KEY)
- Function: gpointer g_hash_table_lookup (GHashTable *HASH_TABLE,
gpointer KEY)
- Function: void g_hash_table_freeze (GHashTable *HASH_TABLE)
- Function: void g_hash_table_thaw (GHashTable *HASH_TABLE)
- Function: void g_hash_table_foreach (GHashTable *HASH_TABLE, GHFunc
FUNC, gpointer USER_DATA)

File: glib.info, Node: Caches, Next: Trees, Prev: Hash tables, Up: Top
Cache handling
**************
Functions
---------
- Function: GCache* g_cache_new (GCacheNewFunc VALUE_NEW_FUNC,
GCacheDestroyFunc VALUE_DESTROY_FUNC, GCacheDupFunc
KEY_DUP_FUNC, GCacheDestroyFunc KEY_DESTROY_FUNC, GHashFunc
HASH_KEY_FUNC, GHashFunc HASH_VALUE_FUNC, GCompareFunc
KEY_COMPARE_FUNC)
- Function: void g_cache_destroy (GCache *CACHE)
- Function: gpointer g_cache_insert (GCache *CACHE, gpointer KEY)
- Function: void g_cache_remove (GCache *CACHE, gpointer KEY)
- Function: void g_cache_key_foreach (GCache *CACHE, GHFunc FUNC,
gpointer USER_DATA)
- Function: void g_cache_value_foreach (GCache *CACHE, GHFunc FUNC,
gpointer USER_DATA)

File: glib.info, Node: Trees, Next: Memory, Prev: Caches, Up: Top
Tree handling
*************
Functions
---------
- Function: GTree* g_tree_new (GCompareFunc KEY_COMPARE_FUNC)
- Function: void g_tree_destroy (GTree *TREE)
- Function: void g_tree_remove (GTree *TREE, gpointer KEY, gpointer
VALUE)
- Function: gpointer g_tree_lookup (GTree *TREE, gpointer KEY)
- Function: void g_tree_traverse (GTree *TREE, GTraverseFunc
TRAVERSE_FUNC, GTraverseType TRAVERSE_TYPE, gpointer DATA
- Function: gpointer g_tree_search (GTree *TREE, GSearchFunc
SEARCH_FUNC, gpointer DATA)
- Function: gint g_tree_height (GTree *TREE)
- Function: gint g_tree_nnodes (GTree *TREE)

File: glib.info, Node: Memory, Next: Timers, Prev: Trees, Up: Top
Memory handling
***************
Functions
---------
- Function: gpointer g_malloc (gulong SIZE)
- Function: gpointer g_malloc0 (gulong SIZE)
- Function: gpointer g_realloc (gpointer MEM, gulong SIZE)
- Function: void g_mem_profile (void)
- Function: void g_mem_check (gpointer MEM)
- Function: GMemChunk* g_mem_chunk_new (gchar *NAME, gint ATOM_SIZE,
gulong AREA_SIZE, gint TYPE)
- Function: void g_mem_chunk_destroy (GMemChunk *MEM_CHUNK)
- Function: gpointer g_mem_chunk_alloc (GMemChunk *MEM_CHUNK)
- Function: void g_mem_chunk_free (GMemChunk *MEM_CHUNK, gpointer MEM)
- Function: void g_mem_chunk_clean (GMemChunk *MEM_CHUNK)
- Function: void g_mem_chunk_reset (GMemChunk *MEM_CHUNK)
- Function: void g_mem_chunk_print (GMemChunk *MEM_CHUNK)
- Function: void g_mem_chunk_info (void)
- Function: void g_blow_chunks (void)
Not what you might be thinking, `g_blow_chunks()' simply
compresses all the chunks. This operation consists of freeing
every memory area that should be freed (but which we haven't
gotten around to doing yet).

File: glib.info, Node: Timers, Next: Output, Prev: Memory, Up: Top
Timer functions
***************
Functions
---------
- Function: GTimer* g_timer_new (void)
- Function: void g_timer_destroy (GTimer *TIMER)
- Function: void g_timer_start (GTimer *TIMER)
- Function: void g_timer_stop (GTimer *TIMER)
- Function: void g_timer_reset (GTimer *TIMER)
- Function: gdouble g_timer_elapsed (GTimer *TIMER, gulong
*MICROSECONDS)

File: glib.info, Node: Output, Next: Utilities, Prev: Timers, Up: Top
Output functions
****************
Functions
---------
- Function: void g_error (gchar *FORMAT, ...)
- Function: void g_warning (gchar *FORMAT, ...)
- Function: void g_message (gchar *FORMAT, ...)
- Function: void g_print (gchar *FORMAT, ...)

File: glib.info, Node: Utilities, Next: Errors, Prev: Output, Up: Top
Utility functions
*****************

File: glib.info, Node: Errors, Next: String Chunks, Prev: Utilities, Up: Top
Error handling
**************

File: glib.info, Node: String Chunks, Next: Strings, Prev: Errors, Up: Top
String chunks
*************

File: glib.info, Node: Strings, Next: Resizable arrays, Prev: String Chunks, Up: Top
String handling
***************

File: glib.info, Node: Resizable arrays, Next: GScanner, Prev: Strings, Up: Top
Resizable arrays
****************

File: glib.info, Node: GScanner, Next: Miscellany, Prev: Resizable arrays, Up: Top
Flexible lexical scanner
************************

File: glib.info, Node: Miscellany, Next: Function Index, Prev: GScanner, Up: Top
Other stuff
***********

File: glib.info, Node: Function Index, Next: Concept Index, Prev: Miscellany, Up: Top
Function Index
**************
* Menu:
* g_blow_chunks: Memory.
* g_cache_destroy: Caches.
* g_cache_insert: Caches.
* g_cache_key_foreach: Caches.
* g_cache_new: Caches.
* g_cache_remove: Caches.
* g_cache_value_foreach: Caches.
* g_error: Output.
* g_hash_table_destroy: Hash tables.
* g_hash_table_foreach: Hash tables.
* g_hash_table_freeze: Hash tables.
* g_hash_table_insert: Hash tables.
* g_hash_table_lookup: Hash tables.
* g_hash_table_new: Hash tables.
* g_hash_table_remove: Hash tables.
* g_hash_table_thaw: Hash tables.
* g_list_alloc: Doubly linked lists.
* g_list_allocator_free: List allocators.
* g_list_allocator_new: List allocators.
* g_list_append: Doubly linked lists.
* g_list_concat: Doubly linked lists.
* g_list_find: Doubly linked lists.
* g_list_first: Doubly linked lists.
* g_list_foreach: Doubly linked lists.
* g_list_free: Doubly linked lists.
* g_list_free_1: Doubly linked lists.
* g_list_insert: Doubly linked lists.
* g_list_insert_sorted: Doubly linked lists.
* g_list_last: Doubly linked lists.
* g_list_length: Doubly linked lists.
* g_list_nth: Doubly linked lists.
* g_list_prepend: Doubly linked lists.
* g_list_remove: Doubly linked lists.
* g_list_remove_link: Doubly linked lists.
* g_list_reverse: Doubly linked lists.
* g_list_set_allocator: List allocators.
* g_malloc: Memory.
* g_malloc0: Memory.
* g_mem_check: Memory.
* g_mem_chunk_alloc: Memory.
* g_mem_chunk_clean: Memory.
* g_mem_chunk_destroy: Memory.
* g_mem_chunk_free: Memory.
* g_mem_chunk_info: Memory.
* g_mem_chunk_new: Memory.
* g_mem_chunk_print: Memory.
* g_mem_chunk_reset: Memory.
* g_mem_profile: Memory.
* g_message: Output.
* g_print: Output.
* g_realloc: Memory.
* g_slist_alloc: Signly linked lists.
* g_slist_append: Signly linked lists.
* g_slist_concat: Signly linked lists.
* g_slist_find: Signly linked lists.
* g_slist_foreach: Signly linked lists.
* g_slist_free: Signly linked lists.
* g_slist_free_1: Signly linked lists.
* g_slist_insert: Signly linked lists.
* g_slist_insert_sorted: Signly linked lists.
* g_slist_last: Signly linked lists.
* g_slist_length: Signly linked lists.
* g_slist_nth: Signly linked lists.
* g_slist_prepend: Signly linked lists.
* g_slist_remove: Signly linked lists.
* g_slist_remove_link: Signly linked lists.
* g_slist_reverse: Signly linked lists.
* g_slist_set_allocator: List allocators.
* g_timer_destroy: Timers.
* g_timer_elapsed: Timers.
* g_timer_new: Timers.
* g_timer_reset: Timers.
* g_timer_start: Timers.
* g_timer_stop: Timers.
* g_tree_destroy: Trees.
* g_tree_height: Trees.
* g_tree_lookup: Trees.
* g_tree_new: Trees.
* g_tree_nnodes: Trees.
* g_tree_remove: Trees.
* g_tree_search: Trees.
* g_tree_traverse: Trees.
* g_warning: Output.

File: glib.info, Node: Concept Index, Prev: Function Index, Up: Top
Concept Index
*************
* Menu:

Tag Table:
Node: Top1037
Node: Copying2229
Node: Overview2320
Node: Doubly linked lists2437
Node: Signly linked lists3645
Node: List allocators4857
Node: Hash tables5318
Node: Caches6141
Node: Trees6942
Node: Memory7655
Node: Timers8823
Node: Output9275
Node: Utilities9604
Node: Errors9718
Node: String Chunks9833
Node: Strings9944
Node: Resizable arrays10069
Node: GScanner10191
Node: Miscellany10332
Node: Function Index10445
Node: Concept Index15143

End Tag Table

Просмотреть файл

@ -1,455 +0,0 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename glib.info
@settitle GLIB
@setchapternewpage odd
@set edition 1.0
@set update-date 3 Feburary 1998
@set update-month Feburary 1998
@c %**end of header
@ifinfo
This file documents GLIB, A library of useful routines for C programming
Copyright (C) 1998 Gregory A McLean
Permission is granted to make and distributed verbatim copies of this
manual, provided the copyright notice and this permission notice are
preserved on all copies.
@ignore
Permission is granted to process this file throught TeX and print the
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Gregory McLean.
@end ifinfo
@titlepage
@title GLIB, Useful routines for C programming
@subtitle Version 1.0
@subtitle @value{update-month}
@author by Gregory McLean
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1998 Gregory McLean
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Gregory McLean.
@end titlepage
@dircategory Library of useful routines for 'C' programing
@direntry
* GLIB: (glib). useful routines for 'C' programming
@end direntry
@node Top, Copying, (dir), (dir)
@top useful routines for 'C' programming
@ifinfo
This is edition @value{edition} of the GLIB documentation,
@w{@value{update-date}}.
@end ifinfo
@menu
* Copying:: Your rights.
* Overview:: What is GLIB?
* Doubly linked lists:: Doubly linked lists
* Signly linked lists:: Singly linked lists
* List allocators:: List Allocators
* Hash tables:: Hash tables
* Caches:: Cache handling
* Trees:: Tree handling
* Memory:: Memory handling
* Timers:: Timer functions
* Output:: Output handling
* Utilities:: Utilitiy functions
* Errors:: Error handling
* String Chunks:: String Chunks
* Strings:: String handling
* Resizable arrays:: Resizeable arrays
* GScanner:: Flexible lexical scanner
* Miscellany:: Other stuff
* Function Index:: Index of functions
* Concept Index:: Index of concepts
@end menu
@node Copying, Overview, Top, Top
@comment node-name, next, previous, up
@chapter Copying
@node Overview, Doubly linked lists, Copying, Top
@comment node-name, next, previous, up
@chapter What is GLIB
@node Doubly linked lists, Signly linked lists, Overview, Top
@comment node-name, next, previous, up
@chapter Doubly linked lists
@subsection Functions
@deftypefun GList* g_list_alloc (void)
@end deftypefun
@deftypefun void g_list_free (GList *@var{list})
@end deftypefun
@deftypefun void g_list_free_1 (GList *@var{list})
@end deftypefun
@deftypefun GList* g_list_append (GList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GList* g_list_prepend (GList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GList* g_list_insert (GList *@var{list}, gpointer @var{data}, gint @var{position})
@end deftypefun
@deftypefun GList* g_list_insert_sorted (GList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
@end deftypefun
@deftypefun GList* g_list_concat (GList *@var{list1}, GList *@var{list2})
@end deftypefun
@deftypefun GList* g_list_remove (GList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GList* g_list_remove_link (GList *@var{list}, GList *@var{link})
@end deftypefun
@deftypefun GList* g_list_reverse (GList *@var{list})
@end deftypefun
@deftypefun GList* g_list_nth (GList *@var{list}, gint @var{n})
@end deftypefun
@deftypefun GList* g_list_find (GList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GList* g_list_last (GList *@var{list})
@end deftypefun
@deftypefun GList* g_list_first (GList *@var{list})
@end deftypefun
@deftypefun gint g_list_length (GList *@var{list})
@end deftypefun
@deftypefun void g_list_foreach (GList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
@end deftypefun
@node Signly linked lists, List allocators, Doubly linked lists, Top
@comment node-name, next, previous, up
@chapter Signly linked lists
@subsection Functions
@deftypefun GSList* g_slist_alloc (void)
@end deftypefun
@deftypefun void g_slist_free (GSList *@var{list})
@end deftypefun
@deftypefun void g_slist_free_1 (GSList *@var{list})
@end deftypefun
@deftypefun GSList* g_slist_append (GSList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GSList* g_slist_prepend (GSList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GSList* g_slist_insert (GSList *@var{list}, gpointer @var{data}, gint @var{position})
@end deftypefun
@deftypefun GSList* g_slist_insert_sorted (GSList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
@end deftypefun
@deftypefun GSList* g_slist_concat (GSList *@var{list1}, GSList *@var{list2})
@end deftypefun
@deftypefun GSList* g_slist_remove (GSList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GSList* g_slist_remove_link (GSList *@var{list}, GSList *@var{link})
@end deftypefun
@deftypefun GSList* g_slist_reverse (GSList *@var{list})
@end deftypefun
@deftypefun GSList* g_slist_nth (GSList *@var{list}, gint @var{n})
@end deftypefun
@deftypefun GSList* g_slist_find (GSList *@var{list}, gpointer @var{data})
@end deftypefun
@deftypefun GSList* g_slist_last (GSList *@var{list})
@end deftypefun
@deftypefun gint g_slist_length (GSList *@var{list})
@end deftypefun
@deftypefun void g_slist_foreach (GSList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
@end deftypefun
@node List allocators, Hash tables, Signly linked lists, Top
@comment node-name, next, previous, up
@chapter List allocators
@subsection Functions
@deftypefun GListAllocator* g_list_allocator_new (void)
@end deftypefun
@deftypefun void g_list_allocator_free (GListAllocator *@var{allocator})
@end deftypefun
@deftypefun GListAllocator* g_slist_set_allocator (GListAllocator *@var{allocator})
@end deftypefun
@deftypefun GListAllocator* g_list_set_allocator (GListAllocator *@var{allocator})
@end deftypefun
@node Hash tables, Caches, List allocators, Top
@comment node-name, next, previous, up
@chapter Hash tables
@subsection Functions
@deftypefun GHashTable* g_hash_table_new (GHashFunc @var{hash_func}, GCompareFunc @var{key_compare_func})
@end deftypefun
@deftypefun void g_hash_table_destroy (GHashTable *@var{hash_table})
@end deftypefun
@deftypefun void g_hash_table_insert (GHashTable *@var{hash_table}, gpointer @var{key}, gpointer @var{value})
@end deftypefun
@deftypefun void g_hash_table_remove (GHashTable *@var{hash_table}, gpointer @var{key})
@end deftypefun
@deftypefun gpointer g_hash_table_lookup (GHashTable *@var{hash_table}, gpointer @var{key})
@end deftypefun
@deftypefun void g_hash_table_freeze (GHashTable *@var{hash_table})
@end deftypefun
@deftypefun void g_hash_table_thaw (GHashTable *@var{hash_table})
@end deftypefun
@deftypefun void g_hash_table_foreach (GHashTable *@var{hash_table}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun
@node Caches, Trees, Hash tables, Top
@comment node-name, next, previous, up
@chapter Cache handling
@subsection Functions
@deftypefun GCache* g_cache_new (GCacheNewFunc @var{value_new_func}, GCacheDestroyFunc @var{value_destroy_func}, GCacheDupFunc @var{key_dup_func}, GCacheDestroyFunc @var{key_destroy_func}, GHashFunc @var{hash_key_func}, GHashFunc @var{hash_value_func}, GCompareFunc @var{key_compare_func})
@end deftypefun
@deftypefun void g_cache_destroy (GCache *@var{cache})
@end deftypefun
@deftypefun gpointer g_cache_insert (GCache *@var{cache}, gpointer @var{key})
@end deftypefun
@deftypefun void g_cache_remove (GCache *@var{cache}, gpointer @var{key})
@end deftypefun
@deftypefun void g_cache_key_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun
@deftypefun void g_cache_value_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun
@node Trees, Memory, Caches, Top
@comment node-name, next, previous, up
@chapter Tree handling
@subsection Functions
@deftypefun GTree* g_tree_new (GCompareFunc @var{key_compare_func})
@end deftypefun
@deftypefun void g_tree_destroy (GTree *@var{tree})
@end deftypefun
@deftypefun void g_tree_remove (GTree *@var{tree}, gpointer @var{key}, gpointer @var{value})
@end deftypefun
@deftypefun gpointer g_tree_lookup (GTree *@var{tree}, gpointer @var{key})
@end deftypefun
@deftypefun void g_tree_traverse (GTree *@var{tree}, GTraverseFunc @var{traverse_func}, GTraverseType @var{traverse_type}, gpointer @var{data}
@end deftypefun
@deftypefun gpointer g_tree_search (GTree *@var{tree}, GSearchFunc @var{search_func}, gpointer @var{data})
@end deftypefun
@deftypefun gint g_tree_height (GTree *@var{tree})
@end deftypefun
@deftypefun gint g_tree_nnodes (GTree *@var{tree})
@end deftypefun
@node Memory, Timers, Trees, Top
@comment node-name, next, previous, up
@chapter Memory handling
@subsection Functions
@deftypefun gpointer g_malloc (gulong @var{size})
@end deftypefun
@deftypefun gpointer g_malloc0 (gulong @var{size})
@end deftypefun
@deftypefun gpointer g_realloc (gpointer @var{mem}, gulong @var{size})
@end deftypefun
@deftypefun void g_mem_profile (void)
@end deftypefun
@deftypefun void g_mem_check (gpointer @var{mem})
@end deftypefun
@deftypefun GMemChunk* g_mem_chunk_new (gchar *@var{name}, gint @var{atom_size}, gulong @var{area_size}, gint @var{type})
@end deftypefun
@deftypefun void g_mem_chunk_destroy (GMemChunk *@var{mem_chunk})
@end deftypefun
@deftypefun gpointer g_mem_chunk_alloc (GMemChunk *@var{mem_chunk})
@end deftypefun
@deftypefun void g_mem_chunk_free (GMemChunk *@var{mem_chunk}, gpointer @var{mem})
@end deftypefun
@deftypefun void g_mem_chunk_clean (GMemChunk *@var{mem_chunk})
@end deftypefun
@deftypefun void g_mem_chunk_reset (GMemChunk *@var{mem_chunk})
@end deftypefun
@deftypefun void g_mem_chunk_print (GMemChunk *@var{mem_chunk})
@end deftypefun
@deftypefun void g_mem_chunk_info (void)
@end deftypefun
@deftypefun void g_blow_chunks (void)
Not what you might be thinking, @code{g_blow_chunks()} simply compresses all
the chunks. This operation consists of freeing every memory area that should
be freed (but which we haven't gotten around to doing yet).
@end deftypefun
@node Timers, Output, Memory, Top
@comment node-name, next, previous, up
@chapter Timer functions
@subsection Functions
@deftypefun GTimer* g_timer_new (void)
@end deftypefun
@deftypefun void g_timer_destroy (GTimer *@var{timer})
@end deftypefun
@deftypefun void g_timer_start (GTimer *@var{timer})
@end deftypefun
@deftypefun void g_timer_stop (GTimer *@var{timer})
@end deftypefun
@deftypefun void g_timer_reset (GTimer *@var{timer})
@end deftypefun
@deftypefun gdouble g_timer_elapsed (GTimer *@var{timer}, gulong *@var{microseconds})
@end deftypefun
@node Output, Utilities, Timers, Top
@comment node-name, next, previous, up
@chapter Output functions
@subsection Functions
@deftypefun void g_error (gchar *@var{format}, @dots{})
@end deftypefun
@deftypefun void g_warning (gchar *@var{format}, @dots{})
@end deftypefun
@deftypefun void g_message (gchar *@var{format}, @dots{})
@end deftypefun
@deftypefun void g_print (gchar *@var{format}, @dots{})
@end deftypefun
@node Utilities, Errors, Output, Top
@comment node-name, next, previous, up
@chapter Utility functions
@node Errors, String Chunks, Utilities, Top
@comment node-name, next, previous, up
@chapter Error handling
@node String Chunks, Strings, Errors, Top
@comment node-name, next, previous, up
@chapter String chunks
@node Strings, Resizable arrays, String Chunks, Top
@comment node-name, next, previous, up
@chapter String handling
@node Resizable arrays, GScanner, Strings, Top
@comment node-name, next, previous, up
@chapter Resizable arrays
@node GScanner, Miscellany, Resizable arrays, Top
@comment node-name, next, previous, up
@chapter Flexible lexical scanner
@node Miscellany, Function Index, GScanner, Top
@comment node-name, next, previous, up
@chapter Other stuff
@node Function Index, Concept Index, Miscellany, Top
@comment node-name, next, previous, up
@unnumbered Function Index
@printindex fn
@node Concept Index, , Function Index, Top
@comment node-name, next, previous, up
@unnumbered Concept Index
@printindex cp
@summarycontents
@contents
@bye

Просмотреть файл

@ -1,89 +0,0 @@
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.54
from glib.texi on 24 Febuary 1999 -->
<TITLE>GLIB - Table of Contents</TITLE>
</HEAD>
<BODY>
<H1>GLIB, Useful routines for C programming </H1>
<H2>Version 1.0</H2>
<H2>Feburary 1998</H2>
<ADDRESS>by Gregory McLean</ADDRESS>
<P>
<P><HR><P>
<UL>
<LI><A NAME="TOC1" HREF="glib.html#SEC1">Copying</A>
<LI><A NAME="TOC2" HREF="glib.html#SEC2">What is GLIB</A>
<LI><A NAME="TOC3" HREF="glib.html#SEC3">Doubly linked lists</A>
<UL>
<UL>
<LI><A NAME="TOC4" HREF="glib.html#SEC4">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC5" HREF="glib.html#SEC5">Signly linked lists</A>
<UL>
<UL>
<LI><A NAME="TOC6" HREF="glib.html#SEC6">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC7" HREF="glib.html#SEC7">List allocators</A>
<UL>
<UL>
<LI><A NAME="TOC8" HREF="glib.html#SEC8">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC9" HREF="glib.html#SEC9">Hash tables</A>
<UL>
<UL>
<LI><A NAME="TOC10" HREF="glib.html#SEC10">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC11" HREF="glib.html#SEC11">Cache handling</A>
<UL>
<UL>
<LI><A NAME="TOC12" HREF="glib.html#SEC12">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC13" HREF="glib.html#SEC13">Tree handling</A>
<UL>
<UL>
<LI><A NAME="TOC14" HREF="glib.html#SEC14">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC15" HREF="glib.html#SEC15">Memory handling</A>
<UL>
<UL>
<LI><A NAME="TOC16" HREF="glib.html#SEC16">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC17" HREF="glib.html#SEC17">Timer functions</A>
<UL>
<UL>
<LI><A NAME="TOC18" HREF="glib.html#SEC18">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC19" HREF="glib.html#SEC19">Output functions</A>
<UL>
<UL>
<LI><A NAME="TOC20" HREF="glib.html#SEC20">Functions</A>
</UL>
</UL>
<LI><A NAME="TOC21" HREF="glib.html#SEC21">Utility functions</A>
<LI><A NAME="TOC22" HREF="glib.html#SEC22">Error handling</A>
<LI><A NAME="TOC23" HREF="glib.html#SEC23">String chunks</A>
<LI><A NAME="TOC24" HREF="glib.html#SEC24">String handling</A>
<LI><A NAME="TOC25" HREF="glib.html#SEC25">Resizable arrays</A>
<LI><A NAME="TOC26" HREF="glib.html#SEC26">Flexible lexical scanner</A>
<LI><A NAME="TOC27" HREF="glib.html#SEC27">Other stuff</A>
<LI><A NAME="TOC28" HREF="glib.html#SEC28">Function Index</A>
<LI><A NAME="TOC29" HREF="glib.html#SEC29">Concept Index</A>
</UL>
<P><HR><P>
This document was generated on 24 Febuary 1999 using the
<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
translator version 1.54.</P>
</BODY>
</HTML>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,489 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <string.h>
#include "glib.h"
#define MIN_ARRAY_SIZE 16
typedef struct _GRealArray GRealArray;
struct _GRealArray
{
guint8 *data;
guint len;
guint alloc;
guint elt_size;
guint zero_terminated : 1;
guint clear : 1;
};
static gint g_nearest_pow (gint num);
static void g_array_maybe_expand (GRealArray *array,
gint len);
static GMemChunk *array_mem_chunk = NULL;
G_LOCK_DEFINE_STATIC (array_mem_chunk);
GArray*
g_array_new (gboolean zero_terminated,
gboolean clear,
guint elt_size)
{
GRealArray *array;
G_LOCK (array_mem_chunk);
if (!array_mem_chunk)
array_mem_chunk = g_mem_chunk_new ("array mem chunk",
sizeof (GRealArray),
1024, G_ALLOC_AND_FREE);
array = g_chunk_new (GRealArray, array_mem_chunk);
G_UNLOCK (array_mem_chunk);
array->data = NULL;
array->len = 0;
array->alloc = 0;
array->zero_terminated = (zero_terminated ? 1 : 0);
array->clear = (clear ? 1 : 0);
array->elt_size = elt_size;
return (GArray*) array;
}
void
g_array_free (GArray *array,
gboolean free_segment)
{
if (free_segment)
g_free (array->data);
G_LOCK (array_mem_chunk);
g_mem_chunk_free (array_mem_chunk, array);
G_UNLOCK (array_mem_chunk);
}
GArray*
g_array_append_vals (GArray *farray,
gconstpointer data,
guint len)
{
GRealArray *array = (GRealArray*) farray;
g_array_maybe_expand (array, len);
memcpy (array->data + array->elt_size * array->len, data, array->elt_size * len);
array->len += len;
return farray;
}
GArray*
g_array_prepend_vals (GArray *farray,
gconstpointer data,
guint len)
{
GRealArray *array = (GRealArray*) farray;
g_array_maybe_expand (array, len);
g_memmove (array->data + array->elt_size * len, array->data, array->elt_size * array->len);
memcpy (array->data, data, len * array->elt_size);
array->len += len;
return farray;
}
GArray*
g_array_insert_vals (GArray *farray,
guint index,
gconstpointer data,
guint len)
{
GRealArray *array = (GRealArray*) farray;
g_array_maybe_expand (array, len);
g_memmove (array->data + array->elt_size * (len + index),
array->data + array->elt_size * index,
array->elt_size * (array->len - index));
memcpy (array->data + array->elt_size * index, data, len * array->elt_size);
array->len += len;
return farray;
}
GArray*
g_array_set_size (GArray *farray,
guint length)
{
GRealArray *array = (GRealArray*) farray;
if (array->len < length)
g_array_maybe_expand (array, length - array->len);
array->len = length;
return farray;
}
GArray*
g_array_remove_index (GArray* farray,
guint index)
{
GRealArray* array = (GRealArray*) farray;
g_return_val_if_fail (array, NULL);
g_return_val_if_fail (index >= 0 && index < array->len, NULL);
if (index != array->len - 1)
g_memmove (array->data + array->elt_size * index,
array->data + array->elt_size * (index + 1),
array->elt_size * (array->len - index - 1));
if (array->zero_terminated)
memset (array->data + array->elt_size * (array->len - 1), 0,
array->elt_size);
array->len -= 1;
return farray;
}
GArray*
g_array_remove_index_fast (GArray* farray,
guint index)
{
GRealArray* array = (GRealArray*) farray;
g_return_val_if_fail (array, NULL);
g_return_val_if_fail (index >= 0 && index < array->len, NULL);
if (index != array->len - 1)
g_memmove (array->data + array->elt_size * index,
array->data + array->elt_size * (array->len - 1),
array->elt_size);
if (array->zero_terminated)
memset (array->data + array->elt_size * (array->len - 1), 0,
array->elt_size);
array->len -= 1;
return farray;
}
static gint
g_nearest_pow (gint num)
{
gint n = 1;
while (n < num)
n <<= 1;
return n;
}
static void
g_array_maybe_expand (GRealArray *array,
gint len)
{
guint want_alloc = (array->len + len + array->zero_terminated) * array->elt_size;
if (want_alloc > array->alloc)
{
guint old_alloc = array->alloc;
array->alloc = g_nearest_pow (want_alloc);
array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE);
array->data = g_realloc (array->data, array->alloc);
if (array->clear || array->zero_terminated)
memset (array->data + old_alloc, 0, array->alloc - old_alloc);
}
}
/* Pointer Array
*/
typedef struct _GRealPtrArray GRealPtrArray;
struct _GRealPtrArray
{
gpointer *pdata;
guint len;
guint alloc;
};
static void g_ptr_array_maybe_expand (GRealPtrArray *array,
gint len);
static GMemChunk *ptr_array_mem_chunk = NULL;
G_LOCK_DEFINE_STATIC (ptr_array_mem_chunk);
GPtrArray*
g_ptr_array_new (void)
{
GRealPtrArray *array;
G_LOCK (ptr_array_mem_chunk);
if (!ptr_array_mem_chunk)
ptr_array_mem_chunk = g_mem_chunk_new ("array mem chunk",
sizeof (GRealPtrArray),
1024, G_ALLOC_AND_FREE);
array = g_chunk_new (GRealPtrArray, ptr_array_mem_chunk);
G_UNLOCK (ptr_array_mem_chunk);
array->pdata = NULL;
array->len = 0;
array->alloc = 0;
return (GPtrArray*) array;
}
void
g_ptr_array_free (GPtrArray *array,
gboolean free_segment)
{
g_return_if_fail (array);
if (free_segment)
g_free (array->pdata);
G_LOCK (ptr_array_mem_chunk);
g_mem_chunk_free (ptr_array_mem_chunk, array);
G_UNLOCK (ptr_array_mem_chunk);
}
static void
g_ptr_array_maybe_expand (GRealPtrArray *array,
gint len)
{
guint old_alloc;
if ((array->len + len) > array->alloc)
{
old_alloc = array->alloc;
array->alloc = g_nearest_pow (array->len + len);
array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE);
if (array->pdata)
array->pdata = g_realloc (array->pdata, sizeof(gpointer) * array->alloc);
else
array->pdata = g_new0 (gpointer, array->alloc);
memset (array->pdata + old_alloc, 0, array->alloc - old_alloc);
}
}
void
g_ptr_array_set_size (GPtrArray *farray,
gint length)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
g_return_if_fail (array);
if (length > array->len)
g_ptr_array_maybe_expand (array, (length - array->len));
array->len = length;
}
gpointer
g_ptr_array_remove_index (GPtrArray* farray,
guint index)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
gpointer result;
g_return_val_if_fail (array, NULL);
g_return_val_if_fail (index >= 0 && index < array->len, NULL);
result = array->pdata[index];
if (index != array->len - 1)
g_memmove (array->pdata + index, array->pdata + index + 1,
sizeof (gpointer) * (array->len - index - 1));
array->pdata[array->len - 1] = NULL;
array->len -= 1;
return result;
}
gpointer
g_ptr_array_remove_index_fast (GPtrArray* farray,
guint index)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
gpointer result;
g_return_val_if_fail (array, NULL);
g_return_val_if_fail (index >= 0 && index < array->len, NULL);
result = array->pdata[index];
if (index != array->len - 1)
array->pdata[index] = array->pdata[array->len - 1];
array->pdata[array->len - 1] = NULL;
array->len -= 1;
return result;
}
gboolean
g_ptr_array_remove (GPtrArray* farray,
gpointer data)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
int i;
g_return_val_if_fail (array, FALSE);
for (i = 0; i < array->len; i += 1)
{
if (array->pdata[i] == data)
{
g_ptr_array_remove_index (farray, i);
return TRUE;
}
}
return FALSE;
}
gboolean
g_ptr_array_remove_fast (GPtrArray* farray,
gpointer data)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
int i;
g_return_val_if_fail (array, FALSE);
for (i = 0; i < array->len; i += 1)
{
if (array->pdata[i] == data)
{
g_ptr_array_remove_index_fast (farray, i);
return TRUE;
}
}
return FALSE;
}
void
g_ptr_array_add (GPtrArray* farray,
gpointer data)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
g_return_if_fail (array);
g_ptr_array_maybe_expand (array, 1);
array->pdata[array->len++] = data;
}
/* Byte arrays
*/
GByteArray* g_byte_array_new (void)
{
return (GByteArray*) g_array_new (FALSE, FALSE, 1);
}
void g_byte_array_free (GByteArray *array,
gboolean free_segment)
{
g_array_free ((GArray*) array, free_segment);
}
GByteArray* g_byte_array_append (GByteArray *array,
const guint8 *data,
guint len)
{
g_array_append_vals ((GArray*) array, (guint8*)data, len);
return array;
}
GByteArray* g_byte_array_prepend (GByteArray *array,
const guint8 *data,
guint len)
{
g_array_prepend_vals ((GArray*) array, (guint8*)data, len);
return array;
}
GByteArray* g_byte_array_set_size (GByteArray *array,
guint length)
{
g_array_set_size ((GArray*) array, length);
return array;
}
GByteArray* g_byte_array_remove_index (GByteArray *array,
guint index)
{
g_array_remove_index((GArray*) array, index);
return array;
}
GByteArray* g_byte_array_remove_index_fast (GByteArray *array,
guint index)
{
g_array_remove_index_fast((GArray*) array, index);
return array;
}

Просмотреть файл

@ -1,228 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
typedef struct _GCacheNode GCacheNode;
typedef struct _GRealCache GRealCache;
struct _GCacheNode
{
/* A reference counted node */
gpointer value;
gint ref_count;
};
struct _GRealCache
{
/* Called to create a value from a key */
GCacheNewFunc value_new_func;
/* Called to destroy a value */
GCacheDestroyFunc value_destroy_func;
/* Called to duplicate a key */
GCacheDupFunc key_dup_func;
/* Called to destroy a key */
GCacheDestroyFunc key_destroy_func;
/* Associates keys with nodes */
GHashTable *key_table;
/* Associates nodes with keys */
GHashTable *value_table;
};
static GCacheNode* g_cache_node_new (gpointer value);
static void g_cache_node_destroy (GCacheNode *node);
static GMemChunk *node_mem_chunk = NULL;
G_LOCK_DEFINE_STATIC (node_mem_chunk);
GCache*
g_cache_new (GCacheNewFunc value_new_func,
GCacheDestroyFunc value_destroy_func,
GCacheDupFunc key_dup_func,
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
GCompareFunc key_compare_func)
{
GRealCache *cache;
g_return_val_if_fail (value_new_func != NULL, NULL);
g_return_val_if_fail (value_destroy_func != NULL, NULL);
g_return_val_if_fail (key_dup_func != NULL, NULL);
g_return_val_if_fail (key_destroy_func != NULL, NULL);
g_return_val_if_fail (hash_key_func != NULL, NULL);
g_return_val_if_fail (hash_value_func != NULL, NULL);
g_return_val_if_fail (key_compare_func != NULL, NULL);
cache = g_new (GRealCache, 1);
cache->value_new_func = value_new_func;
cache->value_destroy_func = value_destroy_func;
cache->key_dup_func = key_dup_func;
cache->key_destroy_func = key_destroy_func;
cache->key_table = g_hash_table_new (hash_key_func, key_compare_func);
cache->value_table = g_hash_table_new (hash_value_func, NULL);
return (GCache*) cache;
}
void
g_cache_destroy (GCache *cache)
{
GRealCache *rcache;
g_return_if_fail (cache != NULL);
rcache = (GRealCache*) cache;
g_hash_table_destroy (rcache->key_table);
g_hash_table_destroy (rcache->value_table);
g_free (rcache);
}
gpointer
g_cache_insert (GCache *cache,
gpointer key)
{
GRealCache *rcache;
GCacheNode *node;
gpointer value;
g_return_val_if_fail (cache != NULL, NULL);
rcache = (GRealCache*) cache;
node = g_hash_table_lookup (rcache->key_table, key);
if (node)
{
node->ref_count += 1;
return node->value;
}
key = (* rcache->key_dup_func) (key);
value = (* rcache->value_new_func) (key);
node = g_cache_node_new (value);
g_hash_table_insert (rcache->key_table, key, node);
g_hash_table_insert (rcache->value_table, value, key);
return node->value;
}
void
g_cache_remove (GCache *cache,
gpointer value)
{
GRealCache *rcache;
GCacheNode *node;
gpointer key;
g_return_if_fail (cache != NULL);
rcache = (GRealCache*) cache;
key = g_hash_table_lookup (rcache->value_table, value);
node = g_hash_table_lookup (rcache->key_table, key);
node->ref_count -= 1;
if (node->ref_count == 0)
{
g_hash_table_remove (rcache->value_table, value);
g_hash_table_remove (rcache->key_table, key);
(* rcache->key_destroy_func) (key);
(* rcache->value_destroy_func) (node->value);
g_cache_node_destroy (node);
}
}
void
g_cache_key_foreach (GCache *cache,
GHFunc func,
gpointer user_data)
{
GRealCache *rcache;
g_return_if_fail (cache != NULL);
g_return_if_fail (func != NULL);
rcache = (GRealCache*) cache;
g_hash_table_foreach (rcache->value_table, func, user_data);
}
void
g_cache_value_foreach (GCache *cache,
GHFunc func,
gpointer user_data)
{
GRealCache *rcache;
g_return_if_fail (cache != NULL);
g_return_if_fail (func != NULL);
rcache = (GRealCache*) cache;
g_hash_table_foreach (rcache->key_table, func, user_data);
}
static GCacheNode*
g_cache_node_new (gpointer value)
{
GCacheNode *node;
G_LOCK (node_mem_chunk);
if (!node_mem_chunk)
node_mem_chunk = g_mem_chunk_new ("cache node mem chunk", sizeof (GCacheNode),
1024, G_ALLOC_AND_FREE);
node = g_chunk_new (GCacheNode, node_mem_chunk);
G_UNLOCK (node_mem_chunk);
node->value = value;
node->ref_count = 1;
return node;
}
static void
g_cache_node_destroy (GCacheNode *node)
{
G_LOCK (node_mem_chunk);
g_mem_chunk_free (node_mem_chunk, node);
G_UNLOCK (node_mem_chunk);
}

Просмотреть файл

@ -1,288 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
#include <string.h>
static void completion_check_cache (GCompletion* cmp,
gchar** new_prefix);
GCompletion*
g_completion_new (GCompletionFunc func)
{
GCompletion* gcomp;
gcomp = g_new (GCompletion, 1);
gcomp->items = NULL;
gcomp->cache = NULL;
gcomp->prefix = NULL;
gcomp->func = func;
return gcomp;
}
void
g_completion_add_items (GCompletion* cmp,
GList* items)
{
GList* it;
g_return_if_fail (cmp != NULL);
g_return_if_fail (items != NULL);
/* optimize adding to cache? */
if (cmp->cache)
{
g_list_free (cmp->cache);
cmp->cache = NULL;
}
if (cmp->prefix)
{
g_free (cmp->prefix);
cmp->prefix = NULL;
}
it = items;
while (it)
{
cmp->items = g_list_prepend (cmp->items, it->data);
it = it->next;
}
}
void
g_completion_remove_items (GCompletion* cmp,
GList* items)
{
GList* it;
g_return_if_fail (cmp != NULL);
g_return_if_fail (items != NULL);
it = items;
while (cmp->items && it)
{
cmp->items = g_list_remove (cmp->items, it->data);
it = it->next;
}
it = items;
while (cmp->cache && it)
{
cmp->cache = g_list_remove(cmp->cache, it->data);
it = it->next;
}
}
void
g_completion_clear_items (GCompletion* cmp)
{
g_return_if_fail (cmp != NULL);
g_list_free (cmp->items);
cmp->items = NULL;
g_list_free (cmp->cache);
cmp->cache = NULL;
g_free (cmp->prefix);
cmp->prefix = NULL;
}
static void
completion_check_cache (GCompletion* cmp,
gchar** new_prefix)
{
register GList* list;
register gint len;
register gint i;
register gint plen;
gchar* postfix=NULL;
gchar* s;
if (!new_prefix)
return;
if (!cmp->cache)
{
*new_prefix = NULL;
return;
}
len = strlen(cmp->prefix);
list = cmp->cache;
s = cmp->func ? cmp->func (list->data) : (gchar*) list->data;
postfix = s + len;
plen = strlen (postfix);
list = list->next;
while (list && plen)
{
s = cmp->func ? cmp->func (list->data) : (gchar*) list->data;
s += len;
for (i = 0; i < plen; ++i)
{
if (postfix[i] != s[i])
break;
}
plen = i;
list = list->next;
}
*new_prefix = g_new0 (gchar, len + plen + 1);
strncpy (*new_prefix, cmp->prefix, len);
strncpy (*new_prefix + len, postfix, plen);
}
GList*
g_completion_complete (GCompletion* cmp,
gchar* prefix,
gchar** new_prefix)
{
gint plen, len;
gint done = 0;
GList* list;
g_return_val_if_fail (cmp != NULL, NULL);
g_return_val_if_fail (prefix != NULL, NULL);
len = strlen (prefix);
if (cmp->prefix && cmp->cache)
{
plen = strlen (cmp->prefix);
if (plen <= len && !strncmp (prefix, cmp->prefix, plen))
{
/* use the cache */
list = cmp->cache;
while (list)
{
if (strncmp (prefix,
cmp->func ? cmp->func (list->data) : (gchar*) list->data,
len))
{
list = g_list_remove_link (cmp->cache, list);
if (list != cmp->cache)
cmp->cache = list;
}
else
list = list->next;
}
done = 1;
}
}
if (!done)
{
/* normal code */
g_list_free (cmp->cache);
cmp->cache = NULL;
list = cmp->items;
while (*prefix && list)
{
if (!strncmp (prefix,
cmp->func ? cmp->func (list->data) : (gchar*) list->data,
len))
cmp->cache = g_list_prepend (cmp->cache, list->data);
list = list->next;
}
}
if (cmp->prefix)
{
g_free (cmp->prefix);
cmp->prefix = NULL;
}
if (cmp->cache)
cmp->prefix = g_strdup (prefix);
completion_check_cache (cmp, new_prefix);
return *prefix ? cmp->cache : cmp->items;
}
void
g_completion_free (GCompletion* cmp)
{
g_return_if_fail (cmp != NULL);
g_completion_clear_items (cmp);
g_free (cmp);
}
#ifdef TEST_COMPLETION
#include <stdio.h>
int
main (int argc,
char* argv[])
{
FILE *file;
gchar buf[1024];
GList *list;
GList *result;
GList *tmp;
GCompletion *cmp;
gint i;
gchar *longp = NULL;
if (argc < 3)
{
g_warning ("Usage: %s filename prefix1 [prefix2 ...]\n", argv[0]);
return 1;
}
file = fopen (argv[1], "r");
if (!file)
{
g_warning ("Cannot open %s\n", argv[1]);
return 1;
}
cmp = g_completion_new (NULL);
list = g_list_alloc ();
while (fgets (buf, 1024, file))
{
list->data = g_strdup (buf);
g_completion_add_items (cmp, list);
}
fclose (file);
for (i = 2; i < argc; ++i)
{
printf ("COMPLETING: %s\n", argv[i]);
result = g_completion_complete (cmp, argv[i], &longp);
g_list_foreach (result, (GFunc) printf, NULL);
printf ("LONG MATCH: %s\n", longp);
g_free (longp);
longp = NULL;
}
g_list_foreach (cmp->items, (GFunc) g_free, NULL);
g_completion_free (cmp);
g_list_free (list);
return 0;
}
#endif

Просмотреть файл

@ -1,601 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gdataset.c: Generic dataset mechanism, similar to GtkObject data.
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe ; FIXME: might still freeze, watch out, not thoroughly
* looked at yet.
*/
#include <string.h>
#include "glib.h"
/* --- defines --- */
#define G_QUARK_BLOCK_SIZE (512)
#define G_DATA_MEM_CHUNK_PREALLOC (128)
#define G_DATA_CACHE_MAX (512)
#define G_DATASET_MEM_CHUNK_PREALLOC (32)
/* --- structures --- */
typedef struct _GDataset GDataset;
struct _GData
{
GData *next;
GQuark id;
gpointer data;
GDestroyNotify destroy_func;
};
struct _GDataset
{
gconstpointer location;
GData *datalist;
};
/* --- prototypes --- */
static inline GDataset* g_dataset_lookup (gconstpointer dataset_location);
static inline void g_datalist_clear_i (GData **datalist);
static void g_dataset_destroy_internal (GDataset *dataset);
static inline void g_data_set_internal (GData **datalist,
GQuark key_id,
gpointer data,
GDestroyNotify destroy_func,
GDataset *dataset);
static void g_data_initialize (void);
static inline GQuark g_quark_new (gchar *string);
/* --- variables --- */
G_LOCK_DEFINE_STATIC (g_dataset_global);
static GHashTable *g_dataset_location_ht = NULL;
static GDataset *g_dataset_cached = NULL; /* should this be
threadspecific? */
static GMemChunk *g_dataset_mem_chunk = NULL;
static GMemChunk *g_data_mem_chunk = NULL;
static GData *g_data_cache = NULL;
static guint g_data_cache_length = 0;
G_LOCK_DEFINE_STATIC (g_quark_global);
static GHashTable *g_quark_ht = NULL;
static gchar **g_quarks = NULL;
static GQuark g_quark_seq_id = 0;
/* --- functions --- */
/* HOLDS: g_dataset_global_lock */
static inline void
g_datalist_clear_i (GData **datalist)
{
register GData *list;
/* unlink *all* items before walking their destructors
*/
list = *datalist;
*datalist = NULL;
while (list)
{
register GData *prev;
prev = list;
list = prev->next;
if (prev->destroy_func)
prev->destroy_func (prev->data);
if (g_data_cache_length < G_DATA_CACHE_MAX)
{
prev->next = g_data_cache;
g_data_cache = prev;
g_data_cache_length++;
}
else
g_mem_chunk_free (g_data_mem_chunk, prev);
}
}
void
g_datalist_clear (GData **datalist)
{
g_return_if_fail (datalist != NULL);
G_LOCK (g_dataset_global);
if (!g_dataset_location_ht)
g_data_initialize ();
while (*datalist)
g_datalist_clear_i (datalist);
G_UNLOCK (g_dataset_global);
}
/* HOLDS: g_dataset_global_lock */
static inline GDataset*
g_dataset_lookup (gconstpointer dataset_location)
{
register GDataset *dataset;
if (g_dataset_cached && g_dataset_cached->location == dataset_location)
return g_dataset_cached;
dataset = g_hash_table_lookup (g_dataset_location_ht, dataset_location);
if (dataset)
g_dataset_cached = dataset;
return dataset;
}
/* HOLDS: g_dataset_global_lock */
static void
g_dataset_destroy_internal (GDataset *dataset)
{
register gconstpointer dataset_location;
dataset_location = dataset->location;
while (dataset)
{
if (!dataset->datalist)
{
if (dataset == g_dataset_cached)
g_dataset_cached = NULL;
g_hash_table_remove (g_dataset_location_ht, dataset_location);
g_mem_chunk_free (g_dataset_mem_chunk, dataset);
break;
}
g_datalist_clear_i (&dataset->datalist);
dataset = g_dataset_lookup (dataset_location);
}
}
void
g_dataset_destroy (gconstpointer dataset_location)
{
g_return_if_fail (dataset_location != NULL);
G_LOCK (g_dataset_global);
if (g_dataset_location_ht)
{
register GDataset *dataset;
dataset = g_dataset_lookup (dataset_location);
if (dataset)
g_dataset_destroy_internal (dataset);
}
G_UNLOCK (g_dataset_global);
}
/* HOLDS: g_dataset_global_lock */
static inline void
g_data_set_internal (GData **datalist,
GQuark key_id,
gpointer data,
GDestroyNotify destroy_func,
GDataset *dataset)
{
register GData *list;
list = *datalist;
if (!data)
{
register GData *prev;
prev = NULL;
while (list)
{
if (list->id == key_id)
{
if (prev)
prev->next = list->next;
else
{
*datalist = list->next;
/* the dataset destruction *must* be done
* prior to invokation of the data destroy function
*/
if (!*datalist && dataset)
g_dataset_destroy_internal (dataset);
}
/* the GData struct *must* already be unlinked
* when invoking the destroy function.
* we use (data==NULL && destroy_func!=NULL) as
* a special hint combination to "steal"
* data without destroy notification
*/
if (list->destroy_func && !destroy_func)
list->destroy_func (list->data);
if (g_data_cache_length < G_DATA_CACHE_MAX)
{
list->next = g_data_cache;
g_data_cache = list;
g_data_cache_length++;
}
else
g_mem_chunk_free (g_data_mem_chunk, list);
return;
}
prev = list;
list = list->next;
}
}
else
{
while (list)
{
if (list->id == key_id)
{
if (!list->destroy_func)
{
list->data = data;
list->destroy_func = destroy_func;
}
else
{
register GDestroyNotify dfunc;
register gpointer ddata;
dfunc = list->destroy_func;
ddata = list->data;
list->data = data;
list->destroy_func = destroy_func;
/* we need to have updated all structures prior to
* invokation of the destroy function
*/
dfunc (ddata);
}
return;
}
list = list->next;
}
if (g_data_cache)
{
list = g_data_cache;
g_data_cache = list->next;
g_data_cache_length--;
}
else
list = g_chunk_new (GData, g_data_mem_chunk);
list->next = *datalist;
list->id = key_id;
list->data = data;
list->destroy_func = destroy_func;
*datalist = list;
}
}
void
g_dataset_id_set_data_full (gconstpointer dataset_location,
GQuark key_id,
gpointer data,
GDestroyNotify destroy_func)
{
register GDataset *dataset;
g_return_if_fail (dataset_location != NULL);
if (!data)
g_return_if_fail (destroy_func == NULL);
if (!key_id)
{
if (data)
g_return_if_fail (key_id > 0);
else
return;
}
G_LOCK (g_dataset_global);
if (!g_dataset_location_ht)
g_data_initialize ();
dataset = g_dataset_lookup (dataset_location);
if (!dataset)
{
dataset = g_chunk_new (GDataset, g_dataset_mem_chunk);
dataset->location = dataset_location;
g_datalist_init (&dataset->datalist);
g_hash_table_insert (g_dataset_location_ht,
(gpointer) dataset->location,
dataset);
}
g_data_set_internal (&dataset->datalist, key_id, data, destroy_func, dataset);
G_UNLOCK (g_dataset_global);
}
void
g_datalist_id_set_data_full (GData **datalist,
GQuark key_id,
gpointer data,
GDestroyNotify destroy_func)
{
g_return_if_fail (datalist != NULL);
if (!data)
g_return_if_fail (destroy_func == NULL);
if (!key_id)
{
if (data)
g_return_if_fail (key_id > 0);
else
return;
}
G_LOCK (g_dataset_global);
if (!g_dataset_location_ht)
g_data_initialize ();
g_data_set_internal (datalist, key_id, data, destroy_func, NULL);
G_UNLOCK (g_dataset_global);
}
void
g_dataset_id_remove_no_notify (gconstpointer dataset_location,
GQuark key_id)
{
g_return_if_fail (dataset_location != NULL);
G_LOCK (g_dataset_global);
if (key_id && g_dataset_location_ht)
{
GDataset *dataset;
dataset = g_dataset_lookup (dataset_location);
if (dataset)
g_data_set_internal (&dataset->datalist, key_id, NULL, (GDestroyNotify) 42, dataset);
}
G_UNLOCK (g_dataset_global);
}
void
g_datalist_id_remove_no_notify (GData **datalist,
GQuark key_id)
{
g_return_if_fail (datalist != NULL);
G_LOCK (g_dataset_global);
if (key_id && g_dataset_location_ht)
g_data_set_internal (datalist, key_id, NULL, (GDestroyNotify) 42, NULL);
G_UNLOCK (g_dataset_global);
}
gpointer
g_dataset_id_get_data (gconstpointer dataset_location,
GQuark key_id)
{
g_return_val_if_fail (dataset_location != NULL, NULL);
G_LOCK (g_dataset_global);
if (key_id && g_dataset_location_ht)
{
register GDataset *dataset;
dataset = g_dataset_lookup (dataset_location);
if (dataset)
{
register GData *list;
for (list = dataset->datalist; list; list = list->next)
if (list->id == key_id)
{
G_UNLOCK (g_dataset_global);
return list->data;
}
}
}
G_UNLOCK (g_dataset_global);
return NULL;
}
gpointer
g_datalist_id_get_data (GData **datalist,
GQuark key_id)
{
g_return_val_if_fail (datalist != NULL, NULL);
if (key_id)
{
register GData *list;
for (list = *datalist; list; list = list->next)
if (list->id == key_id)
return list->data;
}
return NULL;
}
void
g_dataset_foreach (gconstpointer dataset_location,
GDataForeachFunc func,
gpointer user_data)
{
register GDataset *dataset;
g_return_if_fail (dataset_location != NULL);
g_return_if_fail (func != NULL);
G_LOCK (g_dataset_global);
if (g_dataset_location_ht)
{
dataset = g_dataset_lookup (dataset_location);
G_UNLOCK (g_dataset_global);
if (dataset)
{
register GData *list;
for (list = dataset->datalist; list; list = list->next)
func (list->id, list->data, user_data);
}
}
else
{
G_UNLOCK (g_dataset_global);
}
}
void
g_datalist_foreach (GData **datalist,
GDataForeachFunc func,
gpointer user_data)
{
register GData *list;
g_return_if_fail (datalist != NULL);
g_return_if_fail (func != NULL);
for (list = *datalist; list; list = list->next)
func (list->id, list->data, user_data);
}
void
g_datalist_init (GData **datalist)
{
g_return_if_fail (datalist != NULL);
*datalist = NULL;
}
/* HOLDS: g_dataset_global_lock */
static void
g_data_initialize (void)
{
g_return_if_fail (g_dataset_location_ht == NULL);
g_dataset_location_ht = g_hash_table_new (g_direct_hash, NULL);
g_dataset_cached = NULL;
g_dataset_mem_chunk =
g_mem_chunk_new ("GDataset MemChunk",
sizeof (GDataset),
sizeof (GDataset) * G_DATASET_MEM_CHUNK_PREALLOC,
G_ALLOC_AND_FREE);
g_data_mem_chunk =
g_mem_chunk_new ("GData MemChunk",
sizeof (GData),
sizeof (GData) * G_DATA_MEM_CHUNK_PREALLOC,
G_ALLOC_AND_FREE);
}
GQuark
g_quark_try_string (const gchar *string)
{
GQuark quark = 0;
g_return_val_if_fail (string != NULL, 0);
G_LOCK (g_quark_global);
if (g_quark_ht)
quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string));
G_UNLOCK (g_quark_global);
return quark;
}
GQuark
g_quark_from_string (const gchar *string)
{
GQuark quark;
g_return_val_if_fail (string != NULL, 0);
G_LOCK (g_quark_global);
if (g_quark_ht)
quark = (gulong) g_hash_table_lookup (g_quark_ht, string);
else
{
g_quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
quark = 0;
}
if (!quark)
quark = g_quark_new (g_strdup (string));
G_UNLOCK (g_quark_global);
return quark;
}
GQuark
g_quark_from_static_string (const gchar *string)
{
GQuark quark;
g_return_val_if_fail (string != NULL, 0);
G_LOCK (g_quark_global);
if (g_quark_ht)
quark = (gulong) g_hash_table_lookup (g_quark_ht, string);
else
{
g_quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
quark = 0;
}
if (!quark)
quark = g_quark_new ((gchar*) string);
G_UNLOCK (g_quark_global);
return quark;
}
gchar*
g_quark_to_string (GQuark quark)
{
gchar* result = NULL;
G_LOCK (g_quark_global);
if (quark > 0 && quark <= g_quark_seq_id)
result = g_quarks[quark - 1];
G_UNLOCK (g_quark_global);
return result;
}
/* HOLDS: g_quark_global_lock */
static inline GQuark
g_quark_new (gchar *string)
{
GQuark quark;
if (g_quark_seq_id % G_QUARK_BLOCK_SIZE == 0)
g_quarks = g_renew (gchar*, g_quarks, g_quark_seq_id + G_QUARK_BLOCK_SIZE);
g_quarks[g_quark_seq_id] = string;
g_quark_seq_id++;
quark = g_quark_seq_id;
g_hash_table_insert (g_quark_ht, string, GUINT_TO_POINTER (quark));
return quark;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,289 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe ; except for g_on_error_stack_trace, but who wants thread safety
* then
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "glib.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
#ifndef XP_MAC
#include <sys/types.h>
#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
#ifdef STDC_HEADERS
#include <string.h> /* for bzero on BSD systems */
#endif
#ifdef _MSC_VER
#include <process.h> /* For _getpid() */
#endif
#ifndef NO_FD_SET
# define SELECT_MASK fd_set
#else
# ifndef _AIX
typedef long fd_mask;
# endif
# if defined(_IBMR2)
# define SELECT_MASK void
# else
# define SELECT_MASK int
# endif
#endif
static void stack_trace (char **args);
extern volatile gboolean glib_on_error_halt;
volatile gboolean glib_on_error_halt = TRUE;
void
g_on_error_query (const gchar *prg_name)
{
static const gchar *query1 = "[E]xit, [H]alt";
static const gchar *query2 = ", show [S]tack trace";
static const gchar *query3 = " or [P]roceed";
gchar buf[16];
if (!prg_name)
prg_name = g_get_prgname ();
retry:
if (prg_name)
fprintf (stdout,
"%s (pid:%u): %s%s%s: ",
prg_name,
(guint) getpid (),
query1,
query2,
query3);
else
fprintf (stdout,
"(process:%u): %s%s: ",
(guint) getpid (),
query1,
query3);
fflush (stdout);
fgets (buf, 8, stdin);
if ((buf[0] == 'E' || buf[0] == 'e')
&& buf[1] == '\n')
_exit (0);
else if ((buf[0] == 'P' || buf[0] == 'p')
&& buf[1] == '\n')
return;
else if (prg_name
&& (buf[0] == 'S' || buf[0] == 's')
&& buf[1] == '\n')
{
g_on_error_stack_trace (prg_name);
goto retry;
}
else if ((buf[0] == 'H' || buf[0] == 'h')
&& buf[1] == '\n')
{
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
return;
}
else
goto retry;
}
void
g_on_error_stack_trace (const gchar *prg_name)
{
#if !defined(NATIVE_WIN32) && !defined(XP_MAC)
pid_t pid;
gchar buf[16];
gchar *args[4] = { "gdb", NULL, NULL, NULL };
if (!prg_name)
return;
sprintf (buf, "%u", (guint) getpid ());
args[1] = (gchar*) prg_name;
args[2] = buf;
pid = fork ();
if (pid == 0)
{
stack_trace (args);
_exit (0);
}
else if (pid == (pid_t) -1)
{
perror ("unable to fork gdb");
return;
}
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
#else
abort ();
#endif
}
static gboolean stack_trace_done = FALSE;
static void
stack_trace_sigchld (int signum)
{
stack_trace_done = TRUE;
}
static void
stack_trace (char **args)
{
#if !defined(NATIVE_WIN32) && !defined(XP_MAC)
pid_t pid;
int in_fd[2];
int out_fd[2];
SELECT_MASK fdset;
SELECT_MASK readset;
struct timeval tv;
int sel, index, state;
char buffer[256];
char c;
stack_trace_done = FALSE;
signal (SIGCHLD, stack_trace_sigchld);
if ((pipe (in_fd) == -1) || (pipe (out_fd) == -1))
{
perror ("unable to open pipe");
_exit (0);
}
pid = fork ();
if (pid == 0)
{
close (0); dup (in_fd[0]); /* set the stdin to the in pipe */
close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
close (2); dup (out_fd[1]); /* set the stderr to the out pipe */
execvp (args[0], args); /* exec gdb */
perror ("exec failed");
_exit (0);
}
else if (pid == (pid_t) -1)
{
perror ("unable to fork");
_exit (0);
}
FD_ZERO (&fdset);
FD_SET (out_fd[0], &fdset);
write (in_fd[1], "backtrace\n", 10);
write (in_fd[1], "p x = 0\n", 8);
write (in_fd[1], "quit\n", 5);
index = 0;
state = 0;
while (1)
{
readset = fdset;
tv.tv_sec = 1;
tv.tv_usec = 0;
sel = select (FD_SETSIZE, &readset, NULL, NULL, &tv);
if (sel == -1)
break;
if ((sel > 0) && (FD_ISSET (out_fd[0], &readset)))
{
if (read (out_fd[0], &c, 1))
{
switch (state)
{
case 0:
if (c == '#')
{
state = 1;
index = 0;
buffer[index++] = c;
}
break;
case 1:
buffer[index++] = c;
if ((c == '\n') || (c == '\r'))
{
buffer[index] = 0;
fprintf (stdout, "%s", buffer);
state = 0;
index = 0;
}
break;
default:
break;
}
}
}
else if (stack_trace_done)
break;
}
close (in_fd[0]);
close (in_fd[1]);
close (out_fd[0]);
close (out_fd[1]);
_exit (0);
#else
abort ();
#endif
}

Просмотреть файл

@ -1,404 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
#define HASH_TABLE_MIN_SIZE 11
#define HASH_TABLE_MAX_SIZE 13845163
typedef struct _GHashNode GHashNode;
struct _GHashNode
{
gpointer key;
gpointer value;
GHashNode *next;
};
struct _GHashTable
{
gint size;
gint nnodes;
guint frozen;
GHashNode **nodes;
GHashFunc hash_func;
GCompareFunc key_compare_func;
};
static void g_hash_table_resize (GHashTable *hash_table);
static GHashNode** g_hash_table_lookup_node (GHashTable *hash_table,
gconstpointer key);
static GHashNode* g_hash_node_new (gpointer key,
gpointer value);
static void g_hash_node_destroy (GHashNode *hash_node);
static void g_hash_nodes_destroy (GHashNode *hash_node);
G_LOCK_DEFINE_STATIC (g_hash_global);
static GMemChunk *node_mem_chunk = NULL;
static GHashNode *node_free_list = NULL;
GHashTable*
g_hash_table_new (GHashFunc hash_func,
GCompareFunc key_compare_func)
{
GHashTable *hash_table;
guint i;
hash_table = g_new (GHashTable, 1);
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
hash_table->frozen = FALSE;
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
hash_table->key_compare_func = key_compare_func;
hash_table->nodes = g_new (GHashNode*, hash_table->size);
for (i = 0; i < hash_table->size; i++)
hash_table->nodes[i] = NULL;
return hash_table;
}
void
g_hash_table_destroy (GHashTable *hash_table)
{
guint i;
g_return_if_fail (hash_table != NULL);
for (i = 0; i < hash_table->size; i++)
g_hash_nodes_destroy (hash_table->nodes[i]);
g_free (hash_table->nodes);
g_free (hash_table);
}
static inline GHashNode**
g_hash_table_lookup_node (GHashTable *hash_table,
gconstpointer key)
{
GHashNode **node;
node = &hash_table->nodes
[(* hash_table->hash_func) (key) % hash_table->size];
/* Hash table lookup needs to be fast.
* We therefore remove the extra conditional of testing
* whether to call the key_compare_func or not from
* the inner loop.
*/
if (hash_table->key_compare_func)
while (*node && !(*hash_table->key_compare_func) ((*node)->key, key))
node = &(*node)->next;
else
while (*node && (*node)->key != key)
node = &(*node)->next;
return node;
}
gpointer
g_hash_table_lookup (GHashTable *hash_table,
gconstpointer key)
{
GHashNode *node;
g_return_val_if_fail (hash_table != NULL, NULL);
node = *g_hash_table_lookup_node (hash_table, key);
return node ? node->value : NULL;
}
void
g_hash_table_insert (GHashTable *hash_table,
gpointer key,
gpointer value)
{
GHashNode **node;
g_return_if_fail (hash_table != NULL);
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
{
/* do not reset node->key in this place, keeping
* the old key might be intended.
* a g_hash_table_remove/g_hash_table_insert pair
* can be used otherwise.
*
* node->key = key; */
(*node)->value = value;
}
else
{
*node = g_hash_node_new (key, value);
hash_table->nnodes++;
if (!hash_table->frozen)
g_hash_table_resize (hash_table);
}
}
void
g_hash_table_remove (GHashTable *hash_table,
gconstpointer key)
{
GHashNode **node, *dest;
g_return_if_fail (hash_table != NULL);
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
{
dest = *node;
(*node) = dest->next;
g_hash_node_destroy (dest);
hash_table->nnodes--;
if (!hash_table->frozen)
g_hash_table_resize (hash_table);
}
}
gboolean
g_hash_table_lookup_extended (GHashTable *hash_table,
gconstpointer lookup_key,
gpointer *orig_key,
gpointer *value)
{
GHashNode *node;
g_return_val_if_fail (hash_table != NULL, FALSE);
node = *g_hash_table_lookup_node (hash_table, lookup_key);
if (node)
{
if (orig_key)
*orig_key = node->key;
if (value)
*value = node->value;
return TRUE;
}
else
return FALSE;
}
void
g_hash_table_freeze (GHashTable *hash_table)
{
g_return_if_fail (hash_table != NULL);
hash_table->frozen++;
}
void
g_hash_table_thaw (GHashTable *hash_table)
{
g_return_if_fail (hash_table != NULL);
if (hash_table->frozen)
if (!(--hash_table->frozen))
g_hash_table_resize (hash_table);
}
guint
g_hash_table_foreach_remove (GHashTable *hash_table,
GHRFunc func,
gpointer user_data)
{
GHashNode *node, *prev;
guint i;
guint deleted = 0;
g_return_val_if_fail (hash_table != NULL, 0);
g_return_val_if_fail (func != NULL, 0);
for (i = 0; i < hash_table->size; i++)
{
restart:
prev = NULL;
for (node = hash_table->nodes[i]; node; prev = node, node = node->next)
{
if ((* func) (node->key, node->value, user_data))
{
deleted += 1;
hash_table->nnodes -= 1;
if (prev)
{
prev->next = node->next;
g_hash_node_destroy (node);
node = prev;
}
else
{
hash_table->nodes[i] = node->next;
g_hash_node_destroy (node);
goto restart;
}
}
}
}
if (!hash_table->frozen)
g_hash_table_resize (hash_table);
return deleted;
}
void
g_hash_table_foreach (GHashTable *hash_table,
GHFunc func,
gpointer user_data)
{
GHashNode *node;
gint i;
g_return_if_fail (hash_table != NULL);
g_return_if_fail (func != NULL);
for (i = 0; i < hash_table->size; i++)
for (node = hash_table->nodes[i]; node; node = node->next)
(* func) (node->key, node->value, user_data);
}
/* Returns the number of elements contained in the hash table. */
guint
g_hash_table_size (GHashTable *hash_table)
{
g_return_val_if_fail (hash_table != NULL, 0);
return hash_table->nnodes;
}
static void
g_hash_table_resize (GHashTable *hash_table)
{
GHashNode **new_nodes;
GHashNode *node;
GHashNode *next;
gfloat nodes_per_list;
guint hash_val;
gint new_size;
gint i;
nodes_per_list = (gfloat) hash_table->nnodes / (gfloat) hash_table->size;
if ((nodes_per_list > 0.3 || hash_table->size <= HASH_TABLE_MIN_SIZE) &&
(nodes_per_list < 3.0 || hash_table->size >= HASH_TABLE_MAX_SIZE))
return;
new_size = CLAMP(g_spaced_primes_closest (hash_table->nnodes),
HASH_TABLE_MIN_SIZE,
HASH_TABLE_MAX_SIZE);
new_nodes = g_new0 (GHashNode*, new_size);
for (i = 0; i < hash_table->size; i++)
for (node = hash_table->nodes[i]; node; node = next)
{
next = node->next;
hash_val = (* hash_table->hash_func) (node->key) % new_size;
node->next = new_nodes[hash_val];
new_nodes[hash_val] = node;
}
g_free (hash_table->nodes);
hash_table->nodes = new_nodes;
hash_table->size = new_size;
}
static GHashNode*
g_hash_node_new (gpointer key,
gpointer value)
{
GHashNode *hash_node;
G_LOCK (g_hash_global);
if (node_free_list)
{
hash_node = node_free_list;
node_free_list = node_free_list->next;
}
else
{
if (!node_mem_chunk)
node_mem_chunk = g_mem_chunk_new ("hash node mem chunk",
sizeof (GHashNode),
1024, G_ALLOC_ONLY);
hash_node = g_chunk_new (GHashNode, node_mem_chunk);
}
G_UNLOCK (g_hash_global);
hash_node->key = key;
hash_node->value = value;
hash_node->next = NULL;
return hash_node;
}
static void
g_hash_node_destroy (GHashNode *hash_node)
{
G_LOCK (g_hash_global);
hash_node->next = node_free_list;
node_free_list = hash_node;
G_UNLOCK (g_hash_global);
}
static void
g_hash_nodes_destroy (GHashNode *hash_node)
{
if (hash_node)
{
GHashNode *node = hash_node;
while (node->next)
node = node->next;
G_LOCK (g_hash_global);
node->next = node_free_list;
node_free_list = hash_node;
G_UNLOCK (g_hash_global);
}
}

Просмотреть файл

@ -1,633 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* GHook: Callback maintenance functions
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
/* --- defines --- */
#define G_HOOKS_PREALLOC (16)
/* --- functions --- */
void
g_hook_list_init (GHookList *hook_list,
guint hook_size)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_size >= sizeof (GHook));
hook_list->seq_id = 1;
hook_list->hook_size = hook_size;
hook_list->is_setup = TRUE;
hook_list->hooks = NULL;
hook_list->hook_memchunk = g_mem_chunk_new ("GHook Memchunk",
hook_size,
hook_size * G_HOOKS_PREALLOC,
G_ALLOC_AND_FREE);
hook_list->hook_free = NULL;
hook_list->hook_destroy = NULL;
}
void
g_hook_list_clear (GHookList *hook_list)
{
g_return_if_fail (hook_list != NULL);
if (hook_list->is_setup)
{
GHook *hook;
hook_list->is_setup = FALSE;
hook = hook_list->hooks;
if (!hook)
{
g_mem_chunk_destroy (hook_list->hook_memchunk);
hook_list->hook_memchunk = NULL;
}
else
do
{
GHook *tmp;
g_hook_ref (hook_list, hook);
g_hook_destroy_link (hook_list, hook);
tmp = hook->next;
g_hook_unref (hook_list, hook);
hook = tmp;
}
while (hook);
}
}
GHook*
g_hook_alloc (GHookList *hook_list)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (hook_list->is_setup, NULL);
hook = g_chunk_new0 (GHook, hook_list->hook_memchunk);
hook->data = NULL;
hook->next = NULL;
hook->prev = NULL;
hook->flags = G_HOOK_FLAG_ACTIVE;
hook->ref_count = 0;
hook->hook_id = 0;
hook->func = NULL;
hook->destroy = NULL;
return hook;
}
void
g_hook_free (GHookList *hook_list,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
g_return_if_fail (hook != NULL);
g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
if (hook_list->hook_free)
hook_list->hook_free (hook_list, hook);
g_chunk_free (hook, hook_list->hook_memchunk);
}
void
g_hook_destroy_link (GHookList *hook_list,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook != NULL);
if (hook->hook_id)
{
hook->hook_id = 0;
hook->flags &= ~G_HOOK_FLAG_ACTIVE;
if (hook_list->hook_destroy)
{
if (hook_list->hook_destroy != G_HOOK_DEFERRED_DESTROY)
hook_list->hook_destroy (hook_list, hook);
}
else if (hook->destroy)
{
hook->destroy (hook->data);
hook->data = NULL;
hook->func = NULL;
hook->destroy = NULL;
}
g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */
}
}
gboolean
g_hook_destroy (GHookList *hook_list,
guint hook_id)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, FALSE);
g_return_val_if_fail (hook_id > 0, FALSE);
hook = g_hook_get (hook_list, hook_id);
if (hook)
{
g_hook_destroy_link (hook_list, hook);
return TRUE;
}
return FALSE;
}
void
g_hook_unref (GHookList *hook_list,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->hook_memchunk != NULL);
g_return_if_fail (hook != NULL);
g_return_if_fail (hook->ref_count > 0);
hook->ref_count--;
if (!hook->ref_count)
{
g_return_if_fail (hook->hook_id == 0);
g_return_if_fail (!G_HOOK_IN_CALL (hook));
if (hook->prev)
hook->prev->next = hook->next;
else
hook_list->hooks = hook->next;
if (hook->next)
{
hook->next->prev = hook->prev;
hook->next = NULL;
}
hook->prev = NULL;
if (!hook_list->is_setup)
{
hook_list->is_setup = TRUE;
g_hook_free (hook_list, hook);
hook_list->is_setup = FALSE;
if (!hook_list->hooks)
{
g_mem_chunk_destroy (hook_list->hook_memchunk);
hook_list->hook_memchunk = NULL;
}
}
else
g_hook_free (hook_list, hook);
}
}
void
g_hook_ref (GHookList *hook_list,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook != NULL);
g_return_if_fail (hook->ref_count > 0);
hook->ref_count++;
}
void
g_hook_prepend (GHookList *hook_list,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_hook_insert_before (hook_list, hook_list->hooks, hook);
}
void
g_hook_insert_before (GHookList *hook_list,
GHook *sibling,
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
g_return_if_fail (hook != NULL);
g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
g_return_if_fail (hook->func != NULL);
hook->hook_id = hook_list->seq_id++;
hook->ref_count = 1; /* counterpart to g_hook_destroy_link */
if (sibling)
{
if (sibling->prev)
{
hook->prev = sibling->prev;
hook->prev->next = hook;
hook->next = sibling;
sibling->prev = hook;
}
else
{
hook_list->hooks = hook;
hook->next = sibling;
sibling->prev = hook;
}
}
else
{
if (hook_list->hooks)
{
sibling = hook_list->hooks;
while (sibling->next)
sibling = sibling->next;
hook->prev = sibling;
sibling->next = hook;
}
else
hook_list->hooks = hook;
}
}
void
g_hook_list_invoke (GHookList *hook_list,
gboolean may_recurse)
{
GHook *hook;
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHookFunc func;
gboolean was_in_call;
func = (GHookFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
func (hook->data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
void
g_hook_list_invoke_check (GHookList *hook_list,
gboolean may_recurse)
{
GHook *hook;
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHookCheckFunc func;
gboolean was_in_call;
gboolean need_destroy;
func = (GHookCheckFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
need_destroy = !func (hook->data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
void
g_hook_list_marshal_check (GHookList *hook_list,
gboolean may_recurse,
GHookCheckMarshaller marshaller,
gpointer data)
{
GHook *hook;
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
g_return_if_fail (marshaller != NULL);
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
gboolean was_in_call;
gboolean need_destroy;
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
need_destroy = !marshaller (hook, data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
void
g_hook_list_marshal (GHookList *hook_list,
gboolean may_recurse,
GHookMarshaller marshaller,
gpointer data)
{
GHook *hook;
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
g_return_if_fail (marshaller != NULL);
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
gboolean was_in_call;
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
marshaller (hook, data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
GHook*
g_hook_first_valid (GHookList *hook_list,
gboolean may_be_in_call)
{
g_return_val_if_fail (hook_list != NULL, NULL);
if (hook_list->is_setup)
{
GHook *hook;
hook = hook_list->hooks;
if (hook)
{
g_hook_ref (hook_list, hook);
if (G_HOOK_IS_VALID (hook) && (may_be_in_call || !G_HOOK_IN_CALL (hook)))
return hook;
else
return g_hook_next_valid (hook_list, hook, may_be_in_call);
}
}
return NULL;
}
GHook*
g_hook_next_valid (GHookList *hook_list,
GHook *hook,
gboolean may_be_in_call)
{
GHook *ohook = hook;
g_return_val_if_fail (hook_list != NULL, NULL);
if (!hook)
return NULL;
hook = hook->next;
while (hook)
{
if (G_HOOK_IS_VALID (hook) && (may_be_in_call || !G_HOOK_IN_CALL (hook)))
{
g_hook_ref (hook_list, hook);
g_hook_unref (hook_list, ohook);
return hook;
}
hook = hook->next;
}
g_hook_unref (hook_list, ohook);
return NULL;
}
GHook*
g_hook_get (GHookList *hook_list,
guint hook_id)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (hook_id > 0, NULL);
hook = hook_list->hooks;
while (hook)
{
if (hook->hook_id == hook_id)
return hook;
hook = hook->next;
}
return NULL;
}
GHook*
g_hook_find (GHookList *hook_list,
gboolean need_valids,
GHookFindFunc func,
gpointer data)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (func != NULL, NULL);
hook = hook_list->hooks;
while (hook)
{
GHook *tmp;
/* test only non-destroyed hooks */
if (!hook->hook_id)
{
hook = hook->next;
continue;
}
g_hook_ref (hook_list, hook);
if (func (hook, data) && hook->hook_id && (!need_valids || G_HOOK_ACTIVE (hook)))
{
g_hook_unref (hook_list, hook);
return hook;
}
tmp = hook->next;
g_hook_unref (hook_list, hook);
hook = tmp;
}
return NULL;
}
GHook*
g_hook_find_data (GHookList *hook_list,
gboolean need_valids,
gpointer data)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
hook = hook_list->hooks;
while (hook)
{
/* test only non-destroyed hooks */
if (hook->data == data &&
hook->hook_id &&
(!need_valids || G_HOOK_ACTIVE (hook)))
return hook;
hook = hook->next;
}
return NULL;
}
GHook*
g_hook_find_func (GHookList *hook_list,
gboolean need_valids,
gpointer func)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (func != NULL, NULL);
hook = hook_list->hooks;
while (hook)
{
/* test only non-destroyed hooks */
if (hook->func == func &&
hook->hook_id &&
(!need_valids || G_HOOK_ACTIVE (hook)))
return hook;
hook = hook->next;
}
return NULL;
}
GHook*
g_hook_find_func_data (GHookList *hook_list,
gboolean need_valids,
gpointer func,
gpointer data)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (func != NULL, NULL);
hook = hook_list->hooks;
while (hook)
{
/* test only non-destroyed hooks */
if (hook->data == data &&
hook->func == func &&
hook->hook_id &&
(!need_valids || G_HOOK_ACTIVE (hook)))
return hook;
hook = hook->next;
}
return NULL;
}
void
g_hook_insert_sorted (GHookList *hook_list,
GHook *hook,
GHookCompareFunc func)
{
GHook *sibling;
g_return_if_fail (hook_list != NULL);
g_return_if_fail (hook_list->is_setup);
g_return_if_fail (hook != NULL);
g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
g_return_if_fail (hook->func != NULL);
g_return_if_fail (func != NULL);
/* first non-destroyed hook */
sibling = hook_list->hooks;
while (sibling && !sibling->hook_id)
sibling = sibling->next;
while (sibling)
{
GHook *tmp;
g_hook_ref (hook_list, sibling);
if (func (hook, sibling) <= 0 && sibling->hook_id)
{
g_hook_unref (hook_list, sibling);
break;
}
/* next non-destroyed hook */
tmp = sibling->next;
while (tmp && !tmp->hook_id)
tmp = tmp->next;
g_hook_unref (hook_list, sibling);
sibling = tmp;
}
g_hook_insert_before (hook_list, sibling, hook);
}
gint
g_hook_compare_ids (GHook *new_hook,
GHook *sibling)
{
return ((glong) new_hook->hook_id) - ((glong) sibling->hook_id);
}

Просмотреть файл

@ -1,128 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* giochannel.c: IO Channel abstraction
* Copyright 1998 Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "config.h"
#include "glib.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
void
g_io_channel_init (GIOChannel *channel)
{
channel->channel_flags = 0;
channel->ref_count = 1;
}
void
g_io_channel_ref (GIOChannel *channel)
{
g_return_if_fail (channel != NULL);
channel->ref_count++;
}
void
g_io_channel_unref (GIOChannel *channel)
{
g_return_if_fail (channel != NULL);
channel->ref_count--;
if (channel->ref_count == 0)
channel->funcs->io_free (channel);
}
GIOError
g_io_channel_read (GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_read)
{
g_return_val_if_fail (channel != NULL, G_IO_ERROR_UNKNOWN);
return channel->funcs->io_read (channel, buf, count, bytes_read);
}
GIOError
g_io_channel_write (GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_written)
{
g_return_val_if_fail (channel != NULL, G_IO_ERROR_UNKNOWN);
return channel->funcs->io_write (channel, buf, count, bytes_written);
}
GIOError
g_io_channel_seek (GIOChannel *channel,
gint offset,
GSeekType type)
{
g_return_val_if_fail (channel != NULL, G_IO_ERROR_UNKNOWN);
return channel->funcs->io_seek (channel, offset, type);
}
void
g_io_channel_close (GIOChannel *channel)
{
g_return_if_fail (channel != NULL);
channel->funcs->io_close (channel);
}
guint
g_io_add_watch_full (GIOChannel *channel,
gint priority,
GIOCondition condition,
GIOFunc func,
gpointer user_data,
GDestroyNotify notify)
{
g_return_val_if_fail (channel != NULL, 0);
return channel->funcs->io_add_watch (channel, priority, condition,
func, user_data, notify);
}
guint
g_io_add_watch (GIOChannel *channel,
GIOCondition condition,
GIOFunc func,
gpointer user_data)
{
return g_io_add_watch_full (channel, 0, condition, func, user_data, NULL);
}

Просмотреть файл

@ -1,313 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* giounix.c: IO Channels using unix file descriptors
* Copyright 1998 Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
/*
* Unix IO Channels
*/
typedef struct _GIOUnixChannel GIOUnixChannel;
typedef struct _GIOUnixWatch GIOUnixWatch;
struct _GIOUnixChannel {
GIOChannel channel;
gint fd;
};
struct _GIOUnixWatch {
GPollFD pollfd;
GIOChannel *channel;
GIOCondition condition;
GIOFunc callback;
};
static GIOError g_io_unix_read (GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_written);
static GIOError g_io_unix_write(GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_written);
static GIOError g_io_unix_seek (GIOChannel *channel,
gint offset,
GSeekType type);
static void g_io_unix_close (GIOChannel *channel);
static void g_io_unix_free (GIOChannel *channel);
static guint g_io_unix_add_watch (GIOChannel *channel,
gint priority,
GIOCondition condition,
GIOFunc func,
gpointer user_data,
GDestroyNotify notify);
static gboolean g_io_unix_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data);
static gboolean g_io_unix_check (gpointer source_data,
GTimeVal *current_time,
gpointer user_data);
static gboolean g_io_unix_dispatch (gpointer source_data,
GTimeVal *current_time,
gpointer user_data);
static void g_io_unix_destroy (gpointer source_data);
GSourceFuncs unix_watch_funcs = {
g_io_unix_prepare,
g_io_unix_check,
g_io_unix_dispatch,
g_io_unix_destroy
};
GIOFuncs unix_channel_funcs = {
g_io_unix_read,
g_io_unix_write,
g_io_unix_seek,
g_io_unix_close,
g_io_unix_add_watch,
g_io_unix_free,
};
static gboolean
g_io_unix_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data)
{
*timeout = -1;
return FALSE;
}
static gboolean
g_io_unix_check (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
GIOUnixWatch *data = source_data;
return (data->pollfd.revents & data->condition);
}
static gboolean
g_io_unix_dispatch (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
GIOUnixWatch *data = source_data;
return (*data->callback)(data->channel,
data->pollfd.revents & data->condition,
user_data);
}
static void
g_io_unix_destroy (gpointer source_data)
{
GIOUnixWatch *data = source_data;
g_main_remove_poll (&data->pollfd);
g_io_channel_unref (data->channel);
g_free (data);
}
static GIOError
g_io_unix_read (GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_read)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
gint result;
result = read (unix_channel->fd, buf, count);
if (result < 0)
{
*bytes_read = 0;
switch (errno)
{
case EINVAL:
return G_IO_ERROR_INVAL;
case EAGAIN:
return G_IO_ERROR_AGAIN;
default:
return G_IO_ERROR_UNKNOWN;
}
}
else
{
*bytes_read = result;
return G_IO_ERROR_NONE;
}
}
static GIOError
g_io_unix_write(GIOChannel *channel,
gchar *buf,
guint count,
guint *bytes_written)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
gint result;
result = write (unix_channel->fd, buf, count);
if (result < 0)
{
*bytes_written = 0;
switch (errno)
{
case EINVAL:
return G_IO_ERROR_INVAL;
case EAGAIN:
return G_IO_ERROR_AGAIN;
default:
return G_IO_ERROR_UNKNOWN;
}
}
else
{
*bytes_written = result;
return G_IO_ERROR_NONE;
}
}
static GIOError
g_io_unix_seek (GIOChannel *channel,
gint offset,
GSeekType type)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
int whence;
off_t result;
switch (type)
{
case G_SEEK_SET:
whence = SEEK_SET;
break;
case G_SEEK_CUR:
whence = SEEK_CUR;
break;
case G_SEEK_END:
whence = SEEK_END;
break;
default:
g_warning ("g_io_unix_seek: unknown seek type");
return G_IO_ERROR_UNKNOWN;
}
result = lseek (unix_channel->fd, offset, whence);
if (result < 0)
{
switch (errno)
{
case EINVAL:
return G_IO_ERROR_INVAL;
default:
return G_IO_ERROR_UNKNOWN;
}
}
else
return G_IO_ERROR_NONE;
}
static void
g_io_unix_close (GIOChannel *channel)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
close (unix_channel->fd);
}
static void
g_io_unix_free (GIOChannel *channel)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
g_free (unix_channel);
}
static guint
g_io_unix_add_watch (GIOChannel *channel,
gint priority,
GIOCondition condition,
GIOFunc func,
gpointer user_data,
GDestroyNotify notify)
{
GIOUnixWatch *watch = g_new (GIOUnixWatch, 1);
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
watch->channel = channel;
g_io_channel_ref (channel);
watch->callback = func;
watch->condition = condition;
watch->pollfd.fd = unix_channel->fd;
watch->pollfd.events = condition;
g_main_add_poll (&watch->pollfd, priority);
return g_source_add (priority, TRUE, &unix_watch_funcs, watch, user_data, notify);
}
GIOChannel *
g_io_channel_unix_new (gint fd)
{
GIOUnixChannel *unix_channel = g_new (GIOUnixChannel, 1);
GIOChannel *channel = (GIOChannel *)unix_channel;
g_io_channel_init (channel);
channel->funcs = &unix_channel_funcs;
unix_channel->fd = fd;
return channel;
}
gint
g_io_channel_unix_get_fd (GIOChannel *channel)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
return unix_channel->fd;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,111 +0,0 @@
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
usage()
{
cat <<EOF
Usage: glib-config [OPTIONS] [LIBRARIES]
Options:
[--prefix[=DIR]]
[--exec-prefix[=DIR]]
[--version]
[--libs]
[--cflags]
Libraries:
glib
gmodule
gthread
EOF
exit $1
}
if test $# -eq 0; then
usage 1 1>&2
fi
lib_glib=yes
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo_prefix=yes
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo_exec_prefix=yes
;;
--version)
echo @GLIB_VERSION@
exit 0
;;
--cflags)
if test "@includedir@" != /usr/include ; then
includes="-I@includedir@"
fi
echo_cflags=yes
;;
--libs)
echo_libs=yes
;;
glib)
lib_glib=yes
;;
gmodule)
lib_gmodule=yes
;;
gthread)
lib_gthread=yes
;;
*)
usage 1 1>&2
;;
esac
shift
done
if test "$echo_prefix" = "yes"; then
echo $prefix
fi
if test "$echo_exec_prefix" = "yes"; then
echo $exec_prefix
fi
if test "$echo_cflags" = "yes"; then
cflags=""
if test "$lib_gthread" = "yes"; then
cflags="$cflags @G_THREAD_CFLAGS@"
fi
echo -I@libdir@/glib/include $includes $cflags
fi
if test "$echo_libs" = "yes"; then
libsp=""
libsa=""
if test "$lib_glib" = "yes"; then
libsp="$libsp -lglib"
fi
if test "$lib_gthread" = "yes"; then
libsp="-lgthread $libsp"
libsa="$libsa @G_THREAD_LIBS@"
fi
if test "$lib_gmodule" = "yes"; then
libsp="@G_MODULE_LDFLAGS@ -lgmodule $libsp"
libsa="$libsa @G_MODULE_LIBS@"
fi
echo -L@libdir@ $libsp $libsa
fi

Просмотреть файл

@ -1,398 +0,0 @@
EXPORTS
g_array_append_vals
g_array_free
g_array_insert_vals
g_array_new
g_array_prepend_vals
g_array_remove_index
g_array_remove_index_fast
g_array_set_size
g_atexit
g_basename
g_bit_nth_lsf
g_bit_nth_msf
g_bit_storage
g_blow_chunks
g_byte_array_append
g_byte_array_free
g_byte_array_new
g_byte_array_prepend
g_byte_array_remove_index
g_byte_array_remove_index_fast
g_byte_array_set_size
g_cache_destroy
g_cache_insert
g_cache_key_foreach
g_cache_new
g_cache_remove
g_cache_value_foreach
g_completion_add_items
g_completion_clear_items
g_completion_complete
g_completion_free
g_completion_new
g_completion_remove_items
g_datalist_clear
g_datalist_foreach
g_datalist_id_get_data
g_datalist_id_remove_no_notify
g_datalist_id_set_data_full
g_datalist_init
g_dataset_destroy
g_dataset_foreach
g_dataset_id_get_data
g_dataset_id_remove_no_notify
g_dataset_id_set_data_full
g_date_add_days
g_date_add_months
g_date_add_years
g_date_clear
g_date_compare
g_date_day
g_date_day_of_year
g_date_days_in_month
g_date_free
g_date_is_first_of_month
g_date_is_last_of_month
g_date_is_leap_year
g_date_julian
g_date_julian
g_date_monday_week_of_year
g_date_monday_weeks_in_year
g_date_new
g_date_new_dmy
g_date_new_julian
g_date_month
g_date_set_day
g_date_set_dmy
g_date_set_julian
g_date_set_month
g_date_set_parse
g_date_set_time
g_date_set_year
g_date_strftime
g_date_subtract_days
g_date_subtract_months
g_date_subtract_years
g_date_sunday_week_of_year
g_date_sunday_weeks_in_year
g_date_to_struct_tm
g_date_valid
g_date_valid_day
g_date_valid_dmy
g_date_valid_julian
g_date_valid_month
g_date_valid_weekday
g_date_valid_year
g_date_weekday
g_date_year
g_direct_equal
g_direct_hash
g_dirname
g_free
g_get_current_dir
g_get_current_time
g_get_home_dir
g_get_prgname
g_get_real_name
g_get_tmp_dir
g_get_user_name
g_getenv
g_hash_table_destroy
g_hash_table_foreach
g_hash_table_foreach_remove
g_hash_table_freeze
g_hash_table_insert
g_hash_table_lookup
g_hash_table_lookup_extended
g_hash_table_new
g_hash_table_remove
g_hash_table_size
g_hash_table_thaw
g_hook_alloc
g_hook_compare_ids
g_hook_destroy
g_hook_destroy_link
g_hook_find
g_hook_find_data
g_hook_find_func
g_hook_find_func_data
g_hook_first_valid
g_hook_free
g_hook_get
g_hook_insert_before
g_hook_insert_sorted
g_hook_list_init
g_hook_list_invoke
g_hook_list_invoke_check
g_hook_list_marshal
g_hook_list_marshal_check
g_hook_list_clear
g_hook_next_valid
g_hook_prepend
g_hook_ref
g_hook_unref
g_idle_add
g_idle_add_full
g_idle_remove_by_data
g_int_equal
g_int_hash
g_io_add_watch
g_io_add_watch_full
g_io_channel_close
g_io_channel_init
g_io_channel_read
g_io_channel_ref
g_io_channel_seek
g_io_channel_unix_get_fd
g_io_channel_unix_new
g_io_channel_unref
g_io_channel_win32_get_fd
g_io_channel_win32_new_messages
g_io_channel_win32_new_pipe
g_io_channel_win32_new_pipe_with_wakeups
g_io_channel_win32_new_stream_socket
g_io_channel_win32_pipe_readable
g_io_channel_win32_pipe_request_wakeups
g_io_channel_write
g_list_alloc
g_list_append
g_list_concat
g_list_copy
g_list_find
g_list_find_custom
g_list_first
g_list_foreach
g_list_free
g_list_free_1
g_list_index
g_list_insert
g_list_insert_sorted
g_list_last
g_list_length
g_list_nth
g_list_nth_data
g_list_position
g_list_prepend
g_list_remove
g_list_remove_link
g_list_reverse
g_list_sort
g_log
g_log_default_handler
g_log_remove_handler
g_log_set_always_fatal
g_log_set_fatal_mask
g_log_set_handler
g_logv
g_main_add_poll
g_main_destroy
g_main_is_running
g_main_iteration
g_main_new
g_main_pending
g_main_remove_poll
g_main_quit
g_main_run
g_main_set_poll_func
g_malloc
g_malloc0
g_mem_check
g_mem_chunk_alloc
g_mem_chunk_alloc0
g_mem_chunk_clean
g_mem_chunk_destroy
g_mem_chunk_free
g_mem_chunk_info
g_mem_chunk_new
g_mem_chunk_print
g_mem_chunk_reset
g_mem_init
g_mem_profile
g_memdup
g_messages_init
g_mutex_init
g_node_child_index
g_node_child_position
g_node_children_foreach
g_node_depth
g_node_destroy
g_node_find
g_node_find_child
g_node_first_sibling
g_node_get_root
g_node_insert
g_node_insert_before
g_node_is_ancestor
g_node_last_child
g_node_last_sibling
g_node_max_height
g_node_n_children
g_node_n_nodes
g_node_new
g_node_nth_child
g_node_prepend
g_node_reverse_children
g_node_traverse
g_node_unlink
g_on_error_query
g_on_error_stack_trace
g_parse_debug_string
g_path_is_absolute
g_path_skip_root
g_pipe_readable_msg
g_print
g_printerr
g_printf_string_upper_bound
g_ptr_array_add
g_ptr_array_free
g_ptr_array_new
g_ptr_array_remove
g_ptr_array_remove_fast
g_ptr_array_remove_index
g_ptr_array_remove_index_fast
g_ptr_array_set_size
g_quark_from_static_string
g_quark_from_string
g_quark_to_string
g_quark_try_string
g_realloc
g_relation_count
g_relation_delete
g_relation_destroy
g_relation_exists
g_relation_index
g_relation_insert
g_relation_new
g_relation_print
g_relation_select
g_scanner_cur_line
g_scanner_cur_position
g_scanner_cur_token
g_scanner_cur_value
g_scanner_destroy
g_scanner_eof
g_scanner_error
g_scanner_freeze_symbol_table
g_scanner_get_next_token
g_scanner_input_file
g_scanner_input_text
g_scanner_lookup_symbol
g_scanner_new
g_scanner_peek_next_token
g_scanner_scope_add_symbol
g_scanner_scope_foreach_symbol
g_scanner_scope_lookup_symbol
g_scanner_scope_remove_symbol
g_scanner_set_scope
g_scanner_stat_mode
g_scanner_sync_file_offset
g_scanner_thaw_symbol_table
g_scanner_unexp_token
g_scanner_warn
g_set_error_handler
g_set_message_handler
g_set_prgname
g_set_print_handler
g_set_printerr_handler
g_set_warning_handler
g_slist_alloc
g_slist_append
g_slist_concat
g_slist_copy
g_slist_find
g_slist_find_custom
g_slist_foreach
g_slist_free
g_slist_free_1
g_slist_index
g_slist_insert
g_slist_insert_sorted
g_slist_last
g_slist_length
g_slist_nth
g_slist_nth_data
g_slist_position
g_slist_prepend
g_slist_remove
g_slist_remove_link
g_slist_reverse
g_slist_sort
g_snprintf
g_source_add
g_source_remove
g_source_remove_by_source_data
g_source_remove_by_user_data
g_static_mutex_get_mutex_impl
g_static_private_get
g_static_private_set
g_str_equal
g_str_hash
g_strcasecmp
g_strconcat
g_strdelimit
g_strdown
g_strdup
g_strdup_printf
g_strdup_vprintf
g_strerror
g_strfreev
g_string_append
g_string_append_c
g_string_assign
g_string_chunk_free
g_string_chunk_insert
g_string_chunk_insert_const
g_string_chunk_new
g_string_down
g_string_erase
g_string_free
g_string_insert
g_string_insert_c
g_string_new
g_string_prepend
g_string_prepend_c
g_string_sized_new
g_string_sprintf
g_string_sprintfa
g_string_truncate
g_string_up
g_strjoinv
g_strescape
g_strndup
g_strnfill
g_strreverse
g_strsignal
g_strsplit
g_strtod
g_strup
g_timeout_add
g_timeout_add_full
g_timer_destroy
g_timer_elapsed
g_timer_new
g_timer_reset
g_timer_start
g_timer_stop
g_tree_destroy
g_tree_height
g_tree_insert
g_tree_lookup
g_tree_new
g_tree_nnodes
g_tree_remove
g_tree_search
g_tree_traverse
g_tuples_destroy
g_tuples_index
g_vsnprintf
glib_binary_age
glib_interface_age
glib_major_version
glib_micro_version
glib_minor_version
gwin_ftruncate
gwin_opendir
gwin_readdir
gwin_rewinddir
gwin_closedir

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,196 +0,0 @@
# Configure paths for GLIB
# Owen Taylor 97-11-3
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
dnl gthread is specified in MODULES, pass to glib-config
dnl
AC_DEFUN(AM_PATH_GLIB,
[dnl
dnl Get the cflags and libraries from the glib-config script
dnl
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
glib_config_prefix="$withval", glib_config_prefix="")
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
if test x$glib_config_exec_prefix != x ; then
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
if test x${GLIB_CONFIG+set} != xset ; then
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
fi
fi
if test x$glib_config_prefix != x ; then
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
if test x${GLIB_CONFIG+set} != xset ; then
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
fi
fi
for module in . $4
do
case "$module" in
gmodule)
glib_config_args="$glib_config_args gmodule"
;;
gthread)
glib_config_args="$glib_config_args gthread"
;;
esac
done
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
min_glib_version=ifelse([$1], ,0.99.7,$1)
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
no_glib=""
if test "$GLIB_CONFIG" = "no" ; then
no_glib=yes
else
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
dnl
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
dnl checks the results of glib-config to some extent
dnl
rm -f conf.glibtest
AC_TRY_RUN([
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.glibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_glib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_glib_version");
exit(1);
}
if ((glib_major_version != $glib_config_major_version) ||
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If glib-config was correct, then it is best\n");
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
{
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
glib_major_version, glib_minor_version, glib_micro_version);
}
else
{
if ((glib_major_version > major) ||
((glib_major_version == major) && (glib_minor_version > minor)) ||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
glib_major_version, glib_minor_version, glib_micro_version);
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
printf("*** correct copy of glib-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GLIB_CONFIG" = "no" ; then
echo "*** The glib-config script installed by GLIB could not be found"
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
echo "*** full path to glib-config."
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
AC_TRY_LINK([
#include <glib.h>
#include <stdio.h>
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***"
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
echo "*** came with the system with the command"
echo "***"
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
rm -f conf.glibtest
])

Просмотреть файл

@ -1,90 +0,0 @@
# Note that this is NOT a relocatable package
%define ver 1.2.1
%define rel SNAP
%define prefix /usr
Summary: Handy library of utility functions
Name: glib
Version: %ver
Release: %rel
Copyright: LGPL
Group: Libraries
Source: ftp://ftp.gimp.org/pub/gtk/v1.1/glib-%{ver}.tar.gz
BuildRoot: /var/tmp/glib-%{PACKAGE_VERSION}-root
URL: http://www.gtk.org
Docdir: %{prefix}/doc
%description
Handy library of utility functions. Development libs and headers
are in glib-devel.
%package devel
Summary: GIMP Toolkit and GIMP Drawing Kit support library
Group: X11/Libraries
%description devel
Static libraries and header files for the support library for the GIMP's X
libraries, which are available as public libraries. GLIB includes generally
useful data structures.
%changelog
* Thu Feb 11 1999 Michael Fulbright <drmike@redhat.com>
- added libgthread to file list
* Fri Feb 05 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.15
* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.14
* Mon Jan 18 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.13
* Wed Jan 06 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.12
* Wed Dec 16 1998 Michael Fulbright <drmike@redhat.com>
- updated in preparation for the GNOME freeze
* Mon Apr 13 1998 Marc Ewing <marc@redhat.com>
- Split out glib package
%prep
%setup
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
make
%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{prefix} install
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README
%{prefix}/lib/libglib-1.1.so.*
%{prefix}/lib/libgthread-1.1.so.*
%{prefix}/lib/libgmodule-1.1.so.*
%files devel
%defattr(-, root, root)
%{prefix}/lib/lib*.so
%{prefix}/lib/*a
%{prefix}/lib/glib
%{prefix}/include/*
%{prefix}/man/man1/
%{prefix}/share/aclocal/*
%{prefix}/bin/*

Просмотреть файл

@ -1,90 +0,0 @@
# Note that this is NOT a relocatable package
%define ver @VERSION@
%define rel SNAP
%define prefix /usr
Summary: Handy library of utility functions
Name: glib
Version: %ver
Release: %rel
Copyright: LGPL
Group: Libraries
Source: ftp://ftp.gimp.org/pub/gtk/v1.1/glib-%{ver}.tar.gz
BuildRoot: /var/tmp/glib-%{PACKAGE_VERSION}-root
URL: http://www.gtk.org
Docdir: %{prefix}/doc
%description
Handy library of utility functions. Development libs and headers
are in glib-devel.
%package devel
Summary: GIMP Toolkit and GIMP Drawing Kit support library
Group: X11/Libraries
%description devel
Static libraries and header files for the support library for the GIMP's X
libraries, which are available as public libraries. GLIB includes generally
useful data structures.
%changelog
* Thu Feb 11 1999 Michael Fulbright <drmike@redhat.com>
- added libgthread to file list
* Fri Feb 05 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.15
* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.14
* Mon Jan 18 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.13
* Wed Jan 06 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.12
* Wed Dec 16 1998 Michael Fulbright <drmike@redhat.com>
- updated in preparation for the GNOME freeze
* Mon Apr 13 1998 Marc Ewing <marc@redhat.com>
- Split out glib package
%prep
%setup
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
make
%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{prefix} install
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README
%{prefix}/lib/libglib-1.1.so.*
%{prefix}/lib/libgthread-1.1.so.*
%{prefix}/lib/libgmodule-1.1.so.*
%files devel
%defattr(-, root, root)
%{prefix}/lib/lib*.so
%{prefix}/lib/*a
%{prefix}/lib/glib
%{prefix}/include/*
%{prefix}/man/man1/
%{prefix}/share/aclocal/*
%{prefix}/bin/*

Просмотреть файл

@ -1,120 +0,0 @@
/* glibconfig.h */
/* This is a generated file. Please modify `configure.in' */
#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <limits.h>
#include <float.h>
#ifdef XP_MAC
/* Why do I need this here? Why does it work on other platforms? */
#define G_STMT_START do
#define G_STMT_END while (0)
#define HAVE_UNISTD_H 1
#define NO_SYS_ERRLIST 1
#endif /* XP_MAC */
#define G_MINFLOAT FLT_MIN
#define G_MAXFLOAT FLT_MAX
#define G_MINDOUBLE DBL_MIN
#define G_MAXDOUBLE DBL_MAX
#define G_MINSHORT SHRT_MIN
#define G_MAXSHORT SHRT_MAX
#define G_MININT INT_MIN
#define G_MAXINT INT_MAX
#define G_MINLONG LONG_MIN
#define G_MAXLONG LONG_MAX
typedef signed char gint8;
typedef unsigned char guint8;
typedef signed short gint16;
typedef unsigned short guint16;
typedef signed int gint32;
typedef unsigned int guint32;
#if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
# define GLIB_WARNINGS_MAKE_PEOPLE_CRY __extension__
#else
# define GLIB_WARNINGS_MAKE_PEOPLE_CRY
#endif
#define G_HAVE_GINT64 1
GLIB_WARNINGS_MAKE_PEOPLE_CRY typedef signed long long gint64;
GLIB_WARNINGS_MAKE_PEOPLE_CRY typedef unsigned long long guint64;
#define G_GINT64_CONSTANT(val) (GLIB_WARNINGS_MAKE_PEOPLE_CRY (val##LL))
#define GPOINTER_TO_INT(p) ((gint)(p))
#define GPOINTER_TO_UINT(p) ((guint)(p))
#define GINT_TO_POINTER(i) ((gpointer)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(u))
#ifdef NeXT /* @#%@! NeXTStep */
# define g_ATEXIT(proc) (!atexit (proc))
#else
# define g_ATEXIT(proc) (atexit (proc))
#endif
#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END
#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 1
#define GLIB_MICRO_VERSION 5
#ifdef XP_MAC
/* Hacks to get mac to build */
#define GLIB_INTERFACE_AGE 4 // XXX guess
#define GLIB_BINARY_AGE 4 // XXX guess
#define NO_SYS_SIGLIST_DECL 1
#define SIZEOF_LONG 4
#endif /* XP_MAC */
#define G_COMPILED_WITH_DEBUGGING "minimum"
#define G_HAVE___INLINE 1
#define G_BYTE_ORDER G_BIG_ENDIAN
#define GINT16_TO_BE(val) ((gint16) (val))
#define GUINT16_TO_BE(val) ((guint16) (val))
#define GINT16_TO_LE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
#define GUINT16_TO_LE(val) (GUINT16_SWAP_LE_BE (val))
#define GINT32_TO_BE(val) ((gint32) (val))
#define GUINT32_TO_BE(val) ((guint32) (val))
#define GINT32_TO_LE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
#define GUINT32_TO_LE(val) (GUINT32_SWAP_LE_BE (val))
#define GINT64_TO_BE(val) ((gint64) (val))
#define GUINT64_TO_BE(val) ((guint64) (val))
#define GINT64_TO_LE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
#define GUINT64_TO_LE(val) (GUINT64_SWAP_LE_BE (val))
#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
#define G_HAVE_WCHAR_H 1
#define G_HAVE_WCTYPE_H 1
#define G_HAVE_BROKEN_WCTYPE 1
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GLIBCONFIG_H */

Просмотреть файл

@ -1,174 +0,0 @@
/* glibconfig.h.win32 */
/* Handcrafted for Microsoft C. */
#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef _MSC_VER
/* Make MSVC more pedantic, this is a recommended pragma list
* from _Win32_Programming_ by Rector and Newcomer.
*/
#pragma warning(error:4002)
#pragma warning(error:4003)
#pragma warning(1:4010)
#pragma warning(error:4013)
#pragma warning(1:4016)
#pragma warning(error:4020)
#pragma warning(error:4021)
#pragma warning(error:4027)
#pragma warning(error:4029)
#pragma warning(error:4033)
#pragma warning(error:4035)
#pragma warning(error:4045)
#pragma warning(error:4047)
#pragma warning(error:4049)
#pragma warning(error:4053)
#pragma warning(error:4071)
#pragma warning(disable:4101)
#pragma warning(error:4150)
#pragma warning(disable:4244) /* No possible loss of data warnings */
#pragma warning(disable:4305) /* No truncation from int to char warnings */
#endif /* _MSC_VER */
#include <limits.h>
#include <float.h>
#define G_MINFLOAT FLT_MIN
#define G_MAXFLOAT FLT_MAX
#define G_MINDOUBLE DBL_MIN
#define G_MAXDOUBLE DBL_MAX
#define G_MINSHORT SHRT_MIN
#define G_MAXSHORT SHRT_MAX
#define G_MININT INT_MIN
#define G_MAXINT INT_MAX
#define G_MINLONG LONG_MIN
#define G_MAXLONG LONG_MAX
typedef signed char gint8;
typedef unsigned char guint8;
typedef signed short gint16;
typedef unsigned short guint16;
typedef signed int gint32;
typedef unsigned int guint32;
#define G_HAVE_GINT64 1
typedef __int64 gint64;
typedef unsigned __int64 guint64;
#define G_GINT64_CONSTANT(val) (val##i64)
#define GPOINTER_TO_INT(p) ((gint)(p))
#define GPOINTER_TO_UINT(p) ((guint)(p))
#define GINT_TO_POINTER(i) ((gpointer)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(u))
#define g_ATEXIT(proc) (atexit (proc))
#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END
#define G_HAVE_ALLOCA 1
#define alloca _alloca
#define GLIB_MAJOR_VERSION @GLIB_MAJOR_VERSION@
#define GLIB_MINOR_VERSION @GLIB_MINOR_VERSION@
#define GLIB_MICRO_VERSION @GLIB_MICRO_VERSION@
#ifdef __cplusplus
#define G_HAVE_INLINE 1
#else /* !__cplusplus */
#define G_HAVE___INLINE 1
#endif
#define G_THREADS_ENABLED
/*
* The following program can be used to determine the magic values below:
* #include <stdio.h>
* #include <pthread.h>
* main(int argc, char **argv)
* {
* int i;
* pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
* printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t));
* printf ("PTHREAD_MUTEX_INITIALIZER = ");
* for (i = 0; i < sizeof (pthread_mutex_t); i++)
* printf ("%u, ", (unsigned) ((char *) &m)[i]);
* printf ("\n");
* exit(0);
* }
*/
#define G_THREADS_IMPL_POSIX
typedef struct _GStaticMutex GStaticMutex;
struct _GStaticMutex
{
struct _GMutex *runtime_mutex;
union {
/* The size of the pad array should be sizeof (pthread_mutext_t) */
/* This value corresponds to the 1999-01-24 version of pthreads-win32 */
char pad[36];
double dummy_double;
void *dummy_pointer;
long dummy_long;
} aligned_pad_u;
};
/* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */
#define G_STATIC_MUTEX_INIT { NULL, { { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } }
#define g_static_mutex_get_mutex(mutex) \
(g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \
g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#define GINT16_TO_LE(val) ((gint16) (val))
#define GUINT16_TO_LE(val) ((guint16) (val))
#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
#define GINT32_TO_LE(val) ((gint32) (val))
#define GUINT32_TO_LE(val) ((guint32) (val))
#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
#define GINT64_TO_LE(val) ((gint64) (val))
#define GUINT64_TO_LE(val) ((guint64) (val))
#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
#define GLIB_SYSDEF_POLLIN = 1
#define GLIB_SYSDEF_POLLOUT = 4
#define GLIB_SYSDEF_POLLPRI = 2
#define GLIB_SYSDEF_POLLERR = 8
#define GLIB_SYSDEF_POLLHUP = 16
#define GLIB_SYSDEF_POLLNVAL = 32
#define G_HAVE_WCHAR_H 1
#define G_HAVE_WCTYPE_H 1
/* Define if this is Win32, possibly using the Cygwin emulation layer. */
#define WIN32 1
/* Define if this is Win32 without Cygwin. */
#define NATIVE_WIN32 1
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GLIBCONFIG_H */

Просмотреть файл

@ -1,670 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
struct _GAllocator /* from gmem.c */
{
gchar *name;
guint16 n_preallocs;
guint is_unused : 1;
guint type : 4;
GAllocator *last;
GMemChunk *mem_chunk;
GList *free_lists; /* implementation specific */
};
static GAllocator *current_allocator = NULL;
G_LOCK_DEFINE_STATIC (current_allocator);
/* HOLDS: current_allocator_lock */
static void
g_list_validate_allocator (GAllocator *allocator)
{
g_return_if_fail (allocator != NULL);
g_return_if_fail (allocator->is_unused == TRUE);
if (allocator->type != G_ALLOCATOR_LIST)
{
allocator->type = G_ALLOCATOR_LIST;
if (allocator->mem_chunk)
{
g_mem_chunk_destroy (allocator->mem_chunk);
allocator->mem_chunk = NULL;
}
}
if (!allocator->mem_chunk)
{
allocator->mem_chunk = g_mem_chunk_new (allocator->name,
sizeof (GList),
sizeof (GList) * allocator->n_preallocs,
G_ALLOC_ONLY);
allocator->free_lists = NULL;
}
allocator->is_unused = FALSE;
}
void
g_list_push_allocator(GAllocator *allocator)
{
G_LOCK (current_allocator);
g_list_validate_allocator ( allocator );
allocator->last = current_allocator;
current_allocator = allocator;
G_UNLOCK (current_allocator);
}
void
g_list_pop_allocator (void)
{
G_LOCK (current_allocator);
if (current_allocator)
{
GAllocator *allocator;
allocator = current_allocator;
current_allocator = allocator->last;
allocator->last = NULL;
allocator->is_unused = TRUE;
}
G_UNLOCK (current_allocator);
}
GList*
g_list_alloc (void)
{
GList *list;
G_LOCK (current_allocator);
if (!current_allocator)
{
GAllocator *allocator = g_allocator_new ("GLib default GList allocator",
128);
g_list_validate_allocator (allocator);
allocator->last = NULL;
current_allocator = allocator;
}
if (!current_allocator->free_lists)
{
list = g_chunk_new (GList, current_allocator->mem_chunk);
list->data = NULL;
}
else
{
if (current_allocator->free_lists->data)
{
list = current_allocator->free_lists->data;
current_allocator->free_lists->data = list->next;
list->data = NULL;
}
else
{
list = current_allocator->free_lists;
current_allocator->free_lists = list->next;
}
}
G_UNLOCK (current_allocator);
list->next = NULL;
list->prev = NULL;
return list;
}
void
g_list_free (GList *list)
{
if (list)
{
list->data = list->next;
G_LOCK (current_allocator);
list->next = current_allocator->free_lists;
current_allocator->free_lists = list;
G_UNLOCK (current_allocator);
}
}
void
g_list_free_1 (GList *list)
{
if (list)
{
list->data = NULL;
G_LOCK (current_allocator);
list->next = current_allocator->free_lists;
current_allocator->free_lists = list;
G_UNLOCK (current_allocator);
}
}
GList*
g_list_append (GList *list,
gpointer data)
{
GList *new_list;
GList *last;
new_list = g_list_alloc ();
new_list->data = data;
if (list)
{
last = g_list_last (list);
/* g_assert (last != NULL); */
last->next = new_list;
new_list->prev = last;
return list;
}
else
return new_list;
}
GList*
g_list_prepend (GList *list,
gpointer data)
{
GList *new_list;
new_list = g_list_alloc ();
new_list->data = data;
if (list)
{
if (list->prev)
{
list->prev->next = new_list;
new_list->prev = list->prev;
}
list->prev = new_list;
new_list->next = list;
}
return new_list;
}
GList*
g_list_insert (GList *list,
gpointer data,
gint position)
{
GList *new_list;
GList *tmp_list;
if (position < 0)
return g_list_append (list, data);
else if (position == 0)
return g_list_prepend (list, data);
tmp_list = g_list_nth (list, position);
if (!tmp_list)
return g_list_append (list, data);
new_list = g_list_alloc ();
new_list->data = data;
if (tmp_list->prev)
{
tmp_list->prev->next = new_list;
new_list->prev = tmp_list->prev;
}
new_list->next = tmp_list;
tmp_list->prev = new_list;
if (tmp_list == list)
return new_list;
else
return list;
}
GList *
g_list_concat (GList *list1, GList *list2)
{
GList *tmp_list;
if (list2)
{
tmp_list = g_list_last (list1);
if (tmp_list)
tmp_list->next = list2;
else
list1 = list2;
list2->prev = tmp_list;
}
return list1;
}
GList*
g_list_remove (GList *list,
gpointer data)
{
GList *tmp;
tmp = list;
while (tmp)
{
if (tmp->data != data)
tmp = tmp->next;
else
{
if (tmp->prev)
tmp->prev->next = tmp->next;
if (tmp->next)
tmp->next->prev = tmp->prev;
if (list == tmp)
list = list->next;
g_list_free_1 (tmp);
break;
}
}
return list;
}
GList*
g_list_remove_link (GList *list,
GList *link)
{
if (link)
{
if (link->prev)
link->prev->next = link->next;
if (link->next)
link->next->prev = link->prev;
if (link == list)
list = list->next;
link->next = NULL;
link->prev = NULL;
}
return list;
}
GList*
g_list_copy (GList *list)
{
GList *new_list = NULL;
if (list)
{
GList *last;
new_list = g_list_alloc ();
new_list->data = list->data;
last = new_list;
list = list->next;
while (list)
{
last->next = g_list_alloc ();
last->next->prev = last;
last = last->next;
last->data = list->data;
list = list->next;
}
}
return new_list;
}
GList*
g_list_reverse (GList *list)
{
GList *last;
last = NULL;
while (list)
{
last = list;
list = last->next;
last->next = last->prev;
last->prev = list;
}
return last;
}
GList*
g_list_nth (GList *list,
guint n)
{
while ((n-- > 0) && list)
list = list->next;
return list;
}
gpointer
g_list_nth_data (GList *list,
guint n)
{
while ((n-- > 0) && list)
list = list->next;
return list ? list->data : NULL;
}
GList*
g_list_find (GList *list,
gpointer data)
{
while (list)
{
if (list->data == data)
break;
list = list->next;
}
return list;
}
GList*
g_list_find_custom (GList *list,
gpointer data,
GCompareFunc func)
{
g_return_val_if_fail (func != NULL, list);
while (list)
{
if (! func (list->data, data))
return list;
list = list->next;
}
return NULL;
}
gint
g_list_position (GList *list,
GList *link)
{
gint i;
i = 0;
while (list)
{
if (list == link)
return i;
i++;
list = list->next;
}
return -1;
}
gint
g_list_index (GList *list,
gpointer data)
{
gint i;
i = 0;
while (list)
{
if (list->data == data)
return i;
i++;
list = list->next;
}
return -1;
}
GList*
g_list_last (GList *list)
{
if (list)
{
while (list->next)
list = list->next;
}
return list;
}
GList*
g_list_first (GList *list)
{
if (list)
{
while (list->prev)
list = list->prev;
}
return list;
}
guint
g_list_length (GList *list)
{
guint length;
length = 0;
while (list)
{
length++;
list = list->next;
}
return length;
}
void
g_list_foreach (GList *list,
GFunc func,
gpointer user_data)
{
while (list)
{
(*func) (list->data, user_data);
list = list->next;
}
}
GList*
g_list_insert_sorted (GList *list,
gpointer data,
GCompareFunc func)
{
GList *tmp_list = list;
GList *new_list;
gint cmp;
g_return_val_if_fail (func != NULL, list);
if (!list)
{
new_list = g_list_alloc();
new_list->data = data;
return new_list;
}
cmp = (*func) (data, tmp_list->data);
while ((tmp_list->next) && (cmp > 0))
{
tmp_list = tmp_list->next;
cmp = (*func) (data, tmp_list->data);
}
new_list = g_list_alloc();
new_list->data = data;
if ((!tmp_list->next) && (cmp > 0))
{
tmp_list->next = new_list;
new_list->prev = tmp_list;
return list;
}
if (tmp_list->prev)
{
tmp_list->prev->next = new_list;
new_list->prev = tmp_list->prev;
}
new_list->next = tmp_list;
tmp_list->prev = new_list;
if (tmp_list == list)
return new_list;
else
return list;
}
static GList *
g_list_sort_merge (GList *l1,
GList *l2,
GCompareFunc compare_func)
{
GList list, *l, *lprev;
l = &list;
lprev = NULL;
while (l1 && l2)
{
if (compare_func (l1->data, l2->data) < 0)
{
l->next = l1;
l = l->next;
l->prev = lprev;
lprev = l;
l1 = l1->next;
}
else
{
l->next = l2;
l = l->next;
l->prev = lprev;
lprev = l;
l2 = l2->next;
}
}
l->next = l1 ? l1 : l2;
l->next->prev = l;
return list.next;
}
GList*
g_list_sort (GList *list,
GCompareFunc compare_func)
{
GList *l1, *l2;
if (!list)
return NULL;
if (!list->next)
return list;
l1 = list;
l2 = list->next;
while ((l2 = l2->next) != NULL)
{
if ((l2 = l2->next) == NULL)
break;
l1 = l1->next;
}
l2 = l1->next;
l1->next = NULL;
return g_list_sort_merge (g_list_sort (list, compare_func),
g_list_sort (l2, compare_func),
compare_func);
}
GList*
g_list_sort2 (GList *list,
GCompareFunc compare_func)
{
GSList *runs = NULL;
GList *tmp;
/* Degenerate case. */
if (!list) return NULL;
/* Assume: list = [12,2,4,11,2,4,6,1,1,12]. */
for (tmp = list; tmp; )
{
GList *tmp2;
for (tmp2 = tmp;
tmp2->next && compare_func (tmp2->data, tmp2->next->data) <= 0;
tmp2 = tmp2->next)
/* Nothing */;
runs = g_slist_append (runs, tmp);
tmp = tmp2->next;
tmp2->next = NULL;
}
/* Now: runs = [[12],[2,4,11],[2,4,6],[1,1,12]]. */
while (runs->next)
{
/* We have more than one run. Merge pairwise. */
GSList *dst, *src, *dstprev = NULL;
dst = src = runs;
while (src && src->next)
{
dst->data = g_list_sort_merge (src->data,
src->next->data,
compare_func);
dstprev = dst;
dst = dst->next;
src = src->next->next;
}
/* If number of runs was odd, just keep the last. */
if (src)
{
dst->data = src->data;
dstprev = dst;
dst = dst->next;
}
dstprev->next = NULL;
g_slist_free (dst);
}
/* After 1st loop: runs = [[2,4,11,12],[1,1,2,4,6,12]]. */
/* After 2nd loop: runs = [[1,1,2,2,4,4,6,11,12,12]]. */
list = runs->data;
g_slist_free (runs);
return list;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,754 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "glib.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
/* Just use stdio. If we're out of memory, we're hosed anyway. */
#undef write
static inline int
write (FILE *fd,
const char *buf,
int len)
{
fwrite (buf, len, 1, fd);
return len;
}
static void
ensure_stdout_valid (void)
{
HANDLE handle;
handle = GetStdHandle (STD_OUTPUT_HANDLE);
if (handle == INVALID_HANDLE_VALUE)
{
AllocConsole ();
freopen ("CONOUT$", "w", stdout);
}
}
#else
#define ensure_stdout_valid() /* Define as empty */
#endif
/* --- structures --- */
typedef struct _GLogDomain GLogDomain;
typedef struct _GLogHandler GLogHandler;
struct _GLogDomain
{
gchar *log_domain;
GLogLevelFlags fatal_mask;
GLogHandler *handlers;
GLogDomain *next;
};
struct _GLogHandler
{
guint id;
GLogLevelFlags log_level;
GLogFunc log_func;
gpointer data;
GLogHandler *next;
};
/* --- variables --- */
static GMutex* g_messages_lock = NULL;
const gchar *g_log_domain_glib = "GLib";
static GLogDomain *g_log_domains = NULL;
static GLogLevelFlags g_log_always_fatal = G_LOG_FATAL_MASK;
static GPrintFunc glib_print_func = NULL;
static GPrintFunc glib_printerr_func = NULL;
static GErrorFunc glib_error_func = NULL;
static GWarningFunc glib_warning_func = NULL;
static GPrintFunc glib_message_func = NULL;
static GPrivate* g_log_depth = NULL;
/* --- functions --- */
static inline GLogDomain*
g_log_find_domain (const gchar *log_domain)
{
register GLogDomain *domain;
g_mutex_lock (g_messages_lock);
domain = g_log_domains;
while (domain)
{
if (strcmp (domain->log_domain, log_domain) == 0)
{
g_mutex_unlock (g_messages_lock);
return domain;
}
domain = domain->next;
}
g_mutex_unlock (g_messages_lock);
return NULL;
}
static inline GLogDomain*
g_log_domain_new (const gchar *log_domain)
{
register GLogDomain *domain;
domain = g_new (GLogDomain, 1);
domain->log_domain = g_strdup (log_domain);
domain->fatal_mask = G_LOG_FATAL_MASK;
domain->handlers = NULL;
g_mutex_lock (g_messages_lock);
domain->next = g_log_domains;
g_log_domains = domain;
g_mutex_unlock (g_messages_lock);
return domain;
}
static inline void
g_log_domain_check_free (GLogDomain *domain)
{
if (domain->fatal_mask == G_LOG_FATAL_MASK &&
domain->handlers == NULL)
{
register GLogDomain *last, *work;
last = NULL;
g_mutex_lock (g_messages_lock);
work = g_log_domains;
while (work)
{
if (work == domain)
{
if (last)
last->next = domain->next;
else
g_log_domains = domain->next;
g_free (domain->log_domain);
g_free (domain);
break;
}
work = work->next;
}
g_mutex_unlock (g_messages_lock);
}
}
static inline GLogFunc
g_log_domain_get_handler (GLogDomain *domain,
GLogLevelFlags log_level,
gpointer *data)
{
if (domain && log_level)
{
register GLogHandler *handler;
handler = domain->handlers;
while (handler)
{
if ((handler->log_level & log_level) == log_level)
{
*data = handler->data;
return handler->log_func;
}
handler = handler->next;
}
}
return g_log_default_handler;
}
GLogLevelFlags
g_log_set_always_fatal (GLogLevelFlags fatal_mask)
{
GLogLevelFlags old_mask;
/* restrict the global mask to levels that are known to glib */
fatal_mask &= (1 << G_LOG_LEVEL_USER_SHIFT) - 1;
/* force errors to be fatal */
fatal_mask |= G_LOG_LEVEL_ERROR;
/* remove bogus flag */
fatal_mask &= ~G_LOG_FLAG_FATAL;
g_mutex_lock (g_messages_lock);
old_mask = g_log_always_fatal;
g_log_always_fatal = fatal_mask;
g_mutex_unlock (g_messages_lock);
return old_mask;
}
GLogLevelFlags
g_log_set_fatal_mask (const gchar *log_domain,
GLogLevelFlags fatal_mask)
{
GLogLevelFlags old_flags;
register GLogDomain *domain;
if (!log_domain)
log_domain = "";
/* force errors to be fatal */
fatal_mask |= G_LOG_LEVEL_ERROR;
/* remove bogus flag */
fatal_mask &= ~G_LOG_FLAG_FATAL;
domain = g_log_find_domain (log_domain);
if (!domain)
domain = g_log_domain_new (log_domain);
old_flags = domain->fatal_mask;
domain->fatal_mask = fatal_mask;
g_log_domain_check_free (domain);
return old_flags;
}
guint
g_log_set_handler (const gchar *log_domain,
GLogLevelFlags log_levels,
GLogFunc log_func,
gpointer user_data)
{
register GLogDomain *domain;
register GLogHandler *handler;
static guint handler_id = 0;
g_return_val_if_fail ((log_levels & G_LOG_LEVEL_MASK) != 0, 0);
g_return_val_if_fail (log_func != NULL, 0);
if (!log_domain)
log_domain = "";
domain = g_log_find_domain (log_domain);
if (!domain)
domain = g_log_domain_new (log_domain);
handler = g_new (GLogHandler, 1);
g_mutex_lock (g_messages_lock);
handler->id = ++handler_id;
g_mutex_unlock (g_messages_lock);
handler->log_level = log_levels;
handler->log_func = log_func;
handler->data = user_data;
handler->next = domain->handlers;
domain->handlers = handler;
return handler_id;
}
void
g_log_remove_handler (const gchar *log_domain,
guint handler_id)
{
register GLogDomain *domain;
g_return_if_fail (handler_id > 0);
if (!log_domain)
log_domain = "";
domain = g_log_find_domain (log_domain);
if (domain)
{
register GLogHandler *work, *last;
last = NULL;
work = domain->handlers;
while (work)
{
if (work->id == handler_id)
{
if (last)
last->next = work->next;
else
domain->handlers = work->next;
g_free (work);
g_log_domain_check_free (domain);
return;
}
work = work->next;
}
}
g_warning ("g_log_remove_handler(): could not find handler with id `%d' for domain \"%s\"",
handler_id,
log_domain);
}
void
g_logv (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *format,
va_list args1)
{
va_list args2;
gchar buffer[1025];
register gint i;
log_level &= G_LOG_LEVEL_MASK;
if (!log_level)
return;
/* we use a stack buffer of fixed size, because we might get called
* recursively.
*/
G_VA_COPY (args2, args1);
if (g_printf_string_upper_bound (format, args1) < 1024)
vsprintf (buffer, format, args2);
else
{
/* since we might be out of memory, we can't use g_vsnprintf(). */
#ifdef HAVE_VSNPRINTF
vsnprintf (buffer, 1024, format, args2);
#else /* !HAVE_VSNPRINTF */
/* we are out of luck here */
strncpy (buffer, format, 1024);
#endif /* !HAVE_VSNPRINTF */
buffer[1024] = 0;
}
va_end (args2);
for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i))
{
register GLogLevelFlags test_level;
test_level = 1 << i;
if (log_level & test_level)
{
guint depth = GPOINTER_TO_UINT (g_private_get (g_log_depth));
GLogDomain *domain;
GLogFunc log_func;
gpointer data = NULL;
domain = g_log_find_domain (log_domain ? log_domain : "");
if (depth)
test_level |= G_LOG_FLAG_RECURSION;
depth++;
g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
g_mutex_lock (g_messages_lock);
if ((((domain ? domain->fatal_mask : G_LOG_FATAL_MASK) |
g_log_always_fatal) & test_level) != 0)
test_level |= G_LOG_FLAG_FATAL;
g_mutex_unlock (g_messages_lock);
log_func = g_log_domain_get_handler (domain, test_level, &data);
log_func (log_domain, test_level, buffer, data);
/* *domain can be cluttered now */
if (test_level & G_LOG_FLAG_FATAL)
abort ();
depth--;
g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
}
}
}
void
g_log (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
g_logv (log_domain, log_level, format, args);
va_end (args);
}
void
g_log_default_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer unused_data)
{
#ifdef NATIVE_WIN32
FILE *fd;
#else
gint fd;
#endif
gboolean in_recursion;
gboolean is_fatal;
GErrorFunc local_glib_error_func;
GWarningFunc local_glib_warning_func;
GPrintFunc local_glib_message_func;
in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
log_level &= G_LOG_LEVEL_MASK;
if (!message)
message = "g_log_default_handler(): (NULL) message";
#ifdef NATIVE_WIN32
/* Use just stdout as stderr is hard to get redirected from the
* DOS prompt.
*/
fd = stdout;
#else
fd = (log_level >= G_LOG_LEVEL_MESSAGE) ? 1 : 2;
#endif
g_mutex_lock (g_messages_lock);
local_glib_error_func = glib_error_func;
local_glib_warning_func = glib_warning_func;
local_glib_message_func = glib_message_func;
g_mutex_unlock (g_messages_lock);
switch (log_level)
{
case G_LOG_LEVEL_ERROR:
if (!log_domain && local_glib_error_func)
{
/* compatibility code */
local_glib_error_func (message);
return;
}
/* use write(2) for output, in case we are out of memeory */
ensure_stdout_valid ();
if (log_domain)
{
write (fd, "\n", 1);
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
else
write (fd, "\n** ", 4);
if (in_recursion)
write (fd, "ERROR (recursed) **: ", 21);
else
write (fd, "ERROR **: ", 10);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
case G_LOG_LEVEL_CRITICAL:
ensure_stdout_valid ();
if (log_domain)
{
write (fd, "\n", 1);
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
else
write (fd, "\n** ", 4);
if (in_recursion)
write (fd, "CRITICAL (recursed) **: ", 24);
else
write (fd, "CRITICAL **: ", 13);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
case G_LOG_LEVEL_WARNING:
if (!log_domain && local_glib_warning_func)
{
/* compatibility code */
local_glib_warning_func (message);
return;
}
ensure_stdout_valid ();
if (log_domain)
{
write (fd, "\n", 1);
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
else
write (fd, "\n** ", 4);
if (in_recursion)
write (fd, "WARNING (recursed) **: ", 23);
else
write (fd, "WARNING **: ", 12);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
case G_LOG_LEVEL_MESSAGE:
if (!log_domain && local_glib_message_func)
{
/* compatibility code */
local_glib_message_func (message);
return;
}
ensure_stdout_valid ();
if (log_domain)
{
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
if (in_recursion)
write (fd, "Message (recursed): ", 20);
else
write (fd, "Message: ", 9);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
case G_LOG_LEVEL_INFO:
ensure_stdout_valid ();
if (log_domain)
{
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
if (in_recursion)
write (fd, "INFO (recursed): ", 17);
else
write (fd, "INFO: ", 6);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
case G_LOG_LEVEL_DEBUG:
ensure_stdout_valid ();
if (log_domain)
{
write (fd, log_domain, strlen (log_domain));
write (fd, "-", 1);
}
if (in_recursion)
write (fd, "DEBUG (recursed): ", 18);
else
write (fd, "DEBUG: ", 7);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
default:
/* we are used for a log level that is not defined by GLib itself,
* try to make the best out of it.
*/
ensure_stdout_valid ();
if (log_domain)
{
write (fd, log_domain, strlen (log_domain));
if (in_recursion)
write (fd, "-LOG (recursed:", 15);
else
write (fd, "-LOG (", 6);
}
else if (in_recursion)
write (fd, "LOG (recursed:", 14);
else
write (fd, "LOG (", 5);
if (log_level)
{
gchar string[] = "0x00): ";
gchar *p = string + 2;
guint i;
i = g_bit_nth_msf (log_level, -1);
*p = i >> 4;
p++;
*p = '0' + (i & 0xf);
if (*p > '9')
*p += 'A' - '9' - 1;
write (fd, string, 7);
}
else
write (fd, "): ", 3);
write (fd, message, strlen(message));
if (is_fatal)
write (fd, "\naborting...\n", 13);
else
write (fd, "\n", 1);
break;
}
}
GPrintFunc
g_set_print_handler (GPrintFunc func)
{
GPrintFunc old_print_func;
g_mutex_lock (g_messages_lock);
old_print_func = glib_print_func;
glib_print_func = func;
g_mutex_unlock (g_messages_lock);
return old_print_func;
}
void
g_print (const gchar *format,
...)
{
va_list args;
gchar *string;
GPrintFunc local_glib_print_func;
g_return_if_fail (format != NULL);
va_start (args, format);
string = g_strdup_vprintf (format, args);
va_end (args);
g_mutex_lock (g_messages_lock);
local_glib_print_func = glib_print_func;
g_mutex_unlock (g_messages_lock);
if (local_glib_print_func)
local_glib_print_func (string);
else
{
ensure_stdout_valid ();
fputs (string, stdout);
fflush (stdout);
}
g_free (string);
}
GPrintFunc
g_set_printerr_handler (GPrintFunc func)
{
GPrintFunc old_printerr_func;
g_mutex_lock (g_messages_lock);
old_printerr_func = glib_printerr_func;
glib_printerr_func = func;
g_mutex_unlock (g_messages_lock);
return old_printerr_func;
}
void
g_printerr (const gchar *format,
...)
{
va_list args;
gchar *string;
GPrintFunc local_glib_printerr_func;
g_return_if_fail (format != NULL);
va_start (args, format);
string = g_strdup_vprintf (format, args);
va_end (args);
g_mutex_lock (g_messages_lock);
local_glib_printerr_func = glib_printerr_func;
g_mutex_unlock (g_messages_lock);
if (local_glib_printerr_func)
local_glib_printerr_func (string);
else
{
fputs (string, stderr);
fflush (stderr);
}
g_free (string);
}
/* compatibility code */
GErrorFunc
g_set_error_handler (GErrorFunc func)
{
GErrorFunc old_error_func;
g_mutex_lock (g_messages_lock);
old_error_func = glib_error_func;
glib_error_func = func;
g_mutex_unlock (g_messages_lock);
return old_error_func;
}
/* compatibility code */
GWarningFunc
g_set_warning_handler (GWarningFunc func)
{
GWarningFunc old_warning_func;
g_mutex_lock (g_messages_lock);
old_warning_func = glib_warning_func;
glib_warning_func = func;
g_mutex_unlock (g_messages_lock);
return old_warning_func;
}
/* compatibility code */
GPrintFunc
g_set_message_handler (GPrintFunc func)
{
GPrintFunc old_message_func;
g_mutex_lock (g_messages_lock);
old_message_func = glib_message_func;
glib_message_func = func;
g_mutex_unlock (g_messages_lock);
return old_message_func;
}
void
g_messages_init (void)
{
g_messages_lock = g_mutex_new();
g_log_depth = g_private_new(NULL);
}

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +0,0 @@
Tim Janik <timj@gtk.org>

Просмотреть файл

@ -1,482 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 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!

Просмотреть файл

@ -1,178 +0,0 @@
Wed Feb 10 12:06:30 1999 Tim Janik <timj@gtk.org>
* gmodule.c (CHECK_ERROR): be more descriptive on unsupported systems.
Wed Feb 10 07:56:33 1999 Tim Janik <timj@gtk.org>
* gmodule.c (g_module_error): fixed errernerous code wrt to thread
specific error string allocation handling.
Thu Jan 21 12:40:11 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* gmodule-dl.c (_g_module_build_path):
Add braces to eliminate an ambiguous else warning.
1999-01-16 Tor Lillqvist <tml@iki.fi>
* gmodule-dl.c gmodule-dld.c: In
_g_module_build_path, don't add the "lib" prefix and
".so" or ".sl" suffix if already there.
* gmodule-win32.c: Likewise for the ".dll" suffix.
1998-12-10 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gmodule.c: Made it MT safe, the g_module_error() is now thread
specific.
Fri Nov 20 14:43:44 1998 Tim Janik <timj@gtk.org>
* gmodule.c (_g_module_build_path): added empty default imlementation
so gmodule.so compiles on systems that are not yet supported, fix from
Erik Bagfors <bagfors@hpc2n.umu.se>.
1998-11-13 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* Makefile.am (INCLUDES): The previous commit message is wrong
about the -I$(top_srcdir) being redundant. I put it back.
Wed Nov 11 23:23:22 EST 1998 Jeff Garzik <jgarzik@pobox.com>
* Makefile.am : INCLUDES is the right way to add to CFLAGS, not
DEFS. Also there are bugs with '+=' in makefiles.
Got rid of DEFS line by moving G_LOG_DOMAIN setting into INCLUDES.
Removed redundant -I from INCLUDES.
Tue Oct 27 04:00:11 1998 Tim Janik <timj@gtk.org>
* testgmodule.c (main): changed the #ifdef WIN32 test to NATIVE_WIN32,
this needs to be more constistent throughout the code, do we go for
NATIVE_WIN32 or WIN32?
* gmodule.c (LibMain): special cased the #ifdef __LCC__ case for
NATIVE_WIN32, since lcc maybe used on other platforms as well.
* libgplugin_a.c (LibMain):
* libgplugin_b.c (LibMain):
likewise. not sure i like this special requirement for lcc in here.
* gmodule-dl.c (_g_module_build_path):
feature empty "" directories and prepend the module name with "lib".
* gmodule-dld.c (_g_module_build_path):
* gmodule-win32.c (_g_module_build_path):
feature empty "" directories.
* we need some more magic in the _g_module_build_path variants
so we don't append/prepend lib and .so, .sl or .dll for those names
that already contain it.
* applied patch from Tor Lillqvist for g_module_build_path() and
windows support.
1998-10-20: Tor Lillqvist <tml@iki.fi>
* gmodule/gmodule-win32.c:
New file.
* gmodule/gmodule.c gmodule/gmodule.h:
Added the funcion g_module_build_path that builds the path to
a module file, decorating the name according to the system's
conventions. Added the Windows implementation.
* gmodule/libgplugin_a.c gmodule/libgplugin_b.c:
Added LibMain for LCC-Win32.
* gmodule/testgmodule.c:
Handle Windows dll names.
1998-10-25 Raja R Harinath <harinath@cs.umn.edu>
* gmodule.h: Remove `#pragma }'.
* gmoduleconf.h.in: Likewise.
Wed Oct 21 19:58:27 1998 Tim Janik <timj@gtk.org>
* gmodule.c (g_module_symbol): fixed a string pointer bug that could
cause garbage error messages from g_module_symbol() for systems that
NEED_USCORE.
Mon Sep 21 01:54:48 1998 Tim Janik <timj@gtk.org>
* gmodule.h:
* gmodule.c: renamed old _de_init functionality to _unload.
modules are now expected to export:
G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module);
and
G_MODULE_EXPORT void g_module_unload (GModule *module);
returning a string other than NULL from g_module_check_init() will
prevent the module from being loaded. a call to g_module_make_resident()
from g_module_unload() will prevent the module from being unloaded and
still make it resident.
Thu Sep 17 06:34:22 1998 Tim Janik <timj@gtk.org>
* gmodule.h:
* gmodule.c: implemented g_module_make_resident() which can be
used to make modules resident.
fixed a buglet about the optional "g_module_de_init" function in
modules, which could get invoked twice on very obscure occasions.
Tue Sep 15 14:57:30 1998 Owen Taylor <otaylor@redhat.com>
* Makefile.am: Update to libtool-1.2b,
change library versioning scheme to drop LT_RELEASE
from the -l line, while keeping it in the soname.
Thu Aug 20 07:08:16 1998 Tim Janik <timj@gtk.org>
* gmodule.c: provide no operation implementation for the underlying
_g_module_* functions, so we at least compile on systems that have
neither of G_MODULE_IMPL_DL or G_MODULE_IMPL_DLD.
Mon Aug 17 03:41:52 1998 Tim Janik <timj@gtk.org>
* gmodule.h:
* gmodule.c (g_module_open): changed the return type for the
GModuleCheckInit function to be a string, describing the error
condition.
(g_module_symbol): show the failing symbol on error messages.
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
Mon Aug 10 03:35:57 1998 Tim Janik <timj@gtk.org>
* gmodule.c: minor changes to internal interface.
* gmodule-dl.c:
* gmodule-dld.c: put some comments into the files, and provided
better error checking for shl_findsym(). whish i had a system to
test this stuff on.
Mon Aug 10 02:18:31 1998 Tim Janik <timj@gtk.org>
* Makefile.am (lib_LTLIBRARIES): for now, skip the dependency on
-lglib for libgmodule-1.1.la, libgplugin_a.la and libgplugin_b.la
since this clashes with inter-library-dependencies for not installed
libraries. glib-config takes care of this for the usuall case, but
there needs to be a better way...
Sun Aug 9 15:57:38 1998 Tim Janik <timj@gtk.org>
* testgmodule.c: test program for GModule.
* libgplugin_a.c:
* libgplugin_b.c: test plugins for testgmodule.c.
* gmodule.h:
* gmodule.c: GModule library implementation, which is basically
a wrapper about system specifc dynamic loading facilities.
Sun Aug 9 10:31:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog start for gmodule.

Просмотреть файл

@ -1,64 +0,0 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/gmodule \
-DG_LOG_DOMAIN=g_log_domain_gmodule @GLIB_DEBUG_FLAGS@
EXTRA_DIST = \
gmoduleconf.h.in \
gmodule.def \
gmodule-dl.c \
gmodule-dld.c \
gmodule-win32.c \
gmoduleconf.h.win32
BUILT_SOURCES = gmoduleconf.h
gmoduleconf.h: gmoduleconf.h.in
include_HEADERS = \
gmodule.h
libglib = $(top_builddir)/libglib.la # -lglib
lib_LTLIBRARIES = libgmodule.la libgplugin_a.la libgplugin_b.la
libgmodule_la_SOURCES = gmodule.c
libgmodule_la_LDFLAGS = \
@G_MODULE_LDFLAGS@ \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
libgmodule_la_LIBADD = @G_MODULE_LIBS@ # $(libglib)
# we should really depend on $(libglib) for libgmodule.la, but libtool has a
# problem with this ;(
libgplugin_a_la_SOURCES = libgplugin_a.c
libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@
libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ # $(libglib)
libgplugin_b_la_SOURCES = libgplugin_b.c
libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@
libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ # $(libglib)
noinst_PROGRAMS = testgmodule
testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@
testgmodule_LDADD = libgmodule.la $(libglib) @G_MODULE_LIBS@
.PHONY: files release
files:
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
echo $$p; \
done
install-libLTLIBRARIES: libgmodule.la
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='libgmodule.la'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
release:
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`

Просмотреть файл

@ -1,144 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <dlfcn.h>
/* Perl includes <nlist.h> and <link.h> instead of <dlfcn.h> on some systmes? */
/* dlerror() is not implemented on all systems
*/
#ifndef G_MODULE_HAVE_DLERROR
# ifdef __NetBSD__
# define dlerror() g_strerror (errno)
# else /* !__NetBSD__ */
/* could we rely on errno's state here? */
# define dlerror() "unknown dl-error"
# endif /* !__NetBSD__ */
#endif /* G_MODULE_HAVE_DLERROR */
/* some flags are missing on some systems, so we provide
* harmless defaults.
* The Perl sources say, RTLD_LAZY needs to be defined as (1),
* at least for Solaris 1.
*
* Mandatory:
* RTLD_LAZY - resolve undefined symbols as code from the dynamic library
* is executed.
* RTLD_NOW - resolve all undefined symbols before dlopen returns, and fail
* if this cannot be done.
* Optionally:
* RTLD_GLOBAL - the external symbols defined in the library will be made
* available to subsequently loaded libraries.
*/
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif /* RTLD_GLOBAL */
#ifndef RTLD_LAZY
#define RTLD_LAZY 1
#endif /* RTLD_LAZY */
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif /* RTLD_NOW */
/* --- functions --- */
static gpointer
_g_module_open (const gchar *file_name,
gboolean bind_lazy)
{
gpointer handle;
handle = dlopen (file_name, RTLD_GLOBAL | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
if (!handle)
g_module_set_error (dlerror ());
return handle;
}
static gpointer
_g_module_self (void)
{
gpointer handle;
/* to query symbols from the program itself, special link options
* are required on some systems.
*/
handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
if (!handle)
g_module_set_error (dlerror ());
return handle;
}
static void
_g_module_close (gpointer handle,
gboolean is_unref)
{
/* are there any systems out there that have dlopen()/dlclose()
* without a reference count implementation?
*/
is_unref |= 1;
if (is_unref)
{
if (dlclose (handle) != 0)
g_module_set_error (dlerror ());
}
}
static gpointer
_g_module_symbol (gpointer handle,
const gchar *symbol_name)
{
gpointer p;
p = dlsym (handle, symbol_name);
if (!p)
g_module_set_error (dlerror ());
return p;
}
static gchar*
_g_module_build_path (const gchar *directory,
const gchar *module_name)
{
if (directory && *directory) {
if (strncmp (module_name, "lib", 3) == 0)
return g_strconcat (directory, "/", module_name, NULL);
else
return g_strconcat (directory, "/lib", module_name, ".so", NULL);
} else if (strncmp (module_name, "lib", 3) == 0)
return g_strdup (module_name);
else
return g_strconcat ("lib", module_name, ".so", NULL);
}

Просмотреть файл

@ -1,141 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <dl.h>
/* some flags are missing on some systems, so we provide
* harmless defaults.
*
* Mandatory:
* BIND_IMMEDIATE - Resolve symbol references when the library is loaded.
* BIND_DEFERRED - Delay code symbol resolution until actual reference.
*
* Optionally:
* BIND_FIRST - Place the library at the head of the symbol search order.
* BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all unsatisfied
* symbols as fatal. This flag allows binding of unsatisfied code
* symbols to be deferred until use.
* [Perl: For certain libraries, like DCE, deferred binding often
* causes run time problems. Adding BIND_NONFATAL to BIND_IMMEDIATE
* still allows unresolved references in situations like this.]
* BIND_NOSTART - Do not call the initializer for the shared library when the
* library is loaded, nor on a future call to shl_unload().
* BIND_VERBOSE - Print verbose messages concerning possible unsatisfied symbols.
*
* hp9000s700/hp9000s800:
* BIND_RESTRICTED - Restrict symbols visible by the library to those present at
* library load time.
* DYNAMIC_PATH - Allow the loader to dynamically search for the library specified
* by the path argument.
*/
#ifndef DYNAMIC_PATH
#define DYNAMIC_PATH 0
#endif /* DYNAMIC_PATH */
#ifndef BIND_RESTRICTED
#define BIND_RESTRICTED 0
#endif /* BIND_RESTRICTED */
#define OPT_BIND_FLAGS (BIND_NONFATAL | BIND_VERBOSE)
/* --- functions --- */
static gpointer
_g_module_open (const gchar *file_name,
gboolean bind_lazy)
{
shl_t shl_handle;
shl_handle = shl_load (file_name,
(bind_lazy ? BIND_DEFERRED : BIND_IMMEDIATE) | OPT_BIND_FLAGS, 0);
if (!shl_handle)
{
/* the hp-docs say we should better abort() if errno==ENOSYM ;( */
g_module_set_error (g_strerror (errno));
}
return (gpointer) shl_handle;
}
static gpointer
_g_module_self (void)
{
shl_t shl_handle;
shl_handle = PROG_HANDLE;
if (!shl_handle)
g_module_set_error (g_strerror (errno));
return shl_handle;
}
static void
_g_module_close (gpointer handle,
gboolean is_unref)
{
if (!is_unref)
{
if (shl_unload ((shl_t) handle) != 0)
g_module_set_error (g_strerror (errno));
}
}
static gpointer
_g_module_symbol (gpointer handle,
const gchar *symbol_name)
{
gpointer p = NULL;
/* should we restrict lookups to TYPE_PROCEDURE?
*/
if (shl_findsym ((shl_t*) &handle, symbol_name, TYPE_UNDEFINED, &p) != 0 ||
handle == NULL || p == NULL)
{
/* the hp-docs say we should better abort() if errno==ENOSYM ;( */
g_module_set_error (g_strerror (errno));
}
return p;
}
static gchar*
_g_module_build_path (const gchar *directory,
const gchar *module_name)
{
if (directory && *directory)
if (strncmp (module_name, "lib", 3) == 0)
return g_strconcat (directory, "/", module_name, NULL);
else
return g_strconcat (directory, "/lib", module_name, ".sl", NULL);
else if (strncmp (module_name, "lib", 3) == 0)
return g_strdup (module_name);
else
return g_strconcat ("lib", module_name, ".sl", NULL);
}

Просмотреть файл

@ -1,113 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
* Copyright (C) 1998 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <stdio.h>
#include <windows.h>
/* --- functions --- */
static gpointer
_g_module_open (const gchar *file_name,
gboolean bind_lazy)
{
HINSTANCE handle;
handle = LoadLibrary (file_name);
if (!handle)
{
char error[100];
sprintf (error, "Error code %d", GetLastError ());
g_module_set_error (error);
}
return handle;
}
static gpointer
_g_module_self (void)
{
HMODULE handle;
handle = GetModuleHandle (NULL);
if (!handle)
{
char error[100];
sprintf (error, "Error code %d", GetLastError ());
g_module_set_error (error);
}
return handle;
}
static void
_g_module_close (gpointer handle,
gboolean is_unref)
{
if (!FreeLibrary (handle))
{
char error[100];
sprintf (error, "Error code %d", GetLastError ());
g_module_set_error (error);
}
}
static gpointer
_g_module_symbol (gpointer handle,
const gchar *symbol_name)
{
gpointer p;
p = GetProcAddress (handle, symbol_name);
if (!p)
{
char error[100];
sprintf (error, "Error code %d", GetLastError ());
g_module_set_error (error);
}
return p;
}
static gchar*
_g_module_build_path (const gchar *directory,
const gchar *module_name)
{
gint k;
k = strlen (module_name);
if (directory && *directory)
if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
return g_strconcat (directory, "\\", module_name, NULL);
else
return g_strconcat (directory, "\\", module_name, ".dll", NULL);
else if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0)
return g_strdup (module_name);
else
return g_strconcat (module_name, ".dll", NULL);
}

Просмотреть файл

@ -1,416 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "gmodule.h"
#include "gmoduleconf.h"
#include <errno.h>
#include <string.h>
/* We maintain a list of modules, so we can reference count them.
* That's needed because some platforms don't support refernce counts on
* modules e.g. the shl_* implementation of HP-UX
* (http://www.stat.umn.edu/~luke/xls/projects/dlbasics/dlbasics.html).
* Also, the module for the program itself is kept seperatedly for
* faster access and because it has special semantics.
*/
/* --- structures --- */
struct _GModule
{
gchar *file_name;
gpointer handle;
guint ref_count : 31;
guint is_resident : 1;
GModuleUnload unload;
GModule *next;
};
/* --- prototypes --- */
static gpointer _g_module_open (const gchar *file_name,
gboolean bind_lazy);
static void _g_module_close (gpointer handle,
gboolean is_unref);
static gpointer _g_module_self (void);
static gpointer _g_module_symbol (gpointer handle,
const gchar *symbol_name);
static gchar* _g_module_build_path (const gchar *directory,
const gchar *module_name);
static inline void g_module_set_error (const gchar *error);
static inline GModule* g_module_find_by_handle (gpointer handle);
static inline GModule* g_module_find_by_name (const gchar *name);
/* --- variables --- */
G_LOCK_DEFINE_STATIC (GModule);
const char *g_log_domain_gmodule = "GModule";
static GModule *modules = NULL;
static GModule *main_module = NULL;
static GStaticPrivate module_error_private = G_STATIC_PRIVATE_INIT;
/* --- inline functions --- */
static inline GModule*
g_module_find_by_handle (gpointer handle)
{
GModule *module;
GModule *retval = NULL;
G_LOCK (GModule);
if (main_module && main_module->handle == handle)
retval = main_module;
else
for (module = modules; module; module = module->next)
if (handle == module->handle)
{
retval = module;
break;
}
G_UNLOCK (GModule);
return retval;
}
static inline GModule*
g_module_find_by_name (const gchar *name)
{
GModule *module;
GModule *retval = NULL;
G_LOCK (GModule);
for (module = modules; module; module = module->next)
if (strcmp (name, module->file_name) == 0)
{
retval = module;
break;
}
G_UNLOCK (GModule);
return retval;
}
static inline void
g_module_set_error (const gchar *error)
{
g_static_private_set (&module_error_private, g_strdup (error), g_free);
errno = 0;
}
/* --- include platform specifc code --- */
#define CHECK_ERROR(rv) { g_module_set_error (NULL); }
#if (G_MODULE_IMPL == G_MODULE_IMPL_DL)
#include "gmodule-dl.c"
#elif (G_MODULE_IMPL == G_MODULE_IMPL_DLD)
#include "gmodule-dld.c"
#elif (G_MODULE_IMPL == G_MODULE_IMPL_WIN32)
#include "gmodule-win32.c"
#else
#undef CHECK_ERROR
#define CHECK_ERROR(rv) { g_module_set_error ("dynamic modules are " \
"not supported by this system"); return rv; }
static gpointer
_g_module_open (const gchar *file_name,
gboolean bind_lazy)
{
return NULL;
}
static void
_g_module_close (gpointer handle,
gboolean is_unref)
{
}
static gpointer
_g_module_self (void)
{
return NULL;
}
static gpointer
_g_module_symbol (gpointer handle,
const gchar *symbol_name)
{
return NULL;
}
static gchar*
_g_module_build_path (const gchar *directory,
const gchar *module_name)
{
return NULL;
}
#endif /* no implementation */
#if defined (NATIVE_WIN32) && defined (__LCC__)
int __stdcall
LibMain (void *hinstDll,
unsigned long dwReason,
void *reserved)
{
return 1;
}
#endif /* NATIVE_WIN32 && __LCC__ */
/* --- functions --- */
gboolean
g_module_supported (void)
{
CHECK_ERROR (FALSE);
return TRUE;
}
GModule*
g_module_open (const gchar *file_name,
GModuleFlags flags)
{
GModule *module;
gpointer handle;
CHECK_ERROR (NULL);
if (!file_name)
{
G_LOCK (GModule);
if (!main_module)
{
handle = _g_module_self ();
if (handle)
{
main_module = g_new (GModule, 1);
main_module->file_name = NULL;
main_module->handle = handle;
main_module->ref_count = 1;
main_module->is_resident = TRUE;
main_module->unload = NULL;
main_module->next = NULL;
}
}
G_UNLOCK (GModule);
return main_module;
}
/* we first search the module list by name */
module = g_module_find_by_name (file_name);
if (module)
{
module->ref_count++;
return module;
}
/* open the module */
handle = _g_module_open (file_name, (flags & G_MODULE_BIND_LAZY) != 0);
if (handle)
{
gchar *saved_error;
GModuleCheckInit check_init;
const gchar *check_failed = NULL;
/* search the module list by handle, since file names are not unique */
module = g_module_find_by_handle (handle);
if (module)
{
_g_module_close (module->handle, TRUE);
module->ref_count++;
g_module_set_error (NULL);
return module;
}
saved_error = g_strdup (g_module_error ());
g_module_set_error (NULL);
module = g_new (GModule, 1);
module->file_name = g_strdup (file_name);
module->handle = handle;
module->ref_count = 1;
module->is_resident = FALSE;
module->unload = NULL;
G_LOCK (GModule);
module->next = modules;
modules = module;
G_UNLOCK (GModule);
/* check initialization */
if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init))
check_failed = check_init (module);
/* we don't call unload() if the initialization check failed. */
if (!check_failed)
g_module_symbol (module, "g_module_unload", (gpointer) &module->unload);
if (check_failed)
{
gchar *error;
error = g_strconcat ("GModule initialization check failed: ", check_failed, NULL);
g_module_close (module);
module = NULL;
g_module_set_error (error);
g_free (error);
}
else
g_module_set_error (saved_error);
g_free (saved_error);
}
return module;
}
gboolean
g_module_close (GModule *module)
{
CHECK_ERROR (FALSE);
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (module->ref_count > 0, FALSE);
module->ref_count--;
if (!module->ref_count && !module->is_resident && module->unload)
{
GModuleUnload unload;
unload = module->unload;
module->unload = NULL;
unload (module);
}
if (!module->ref_count && !module->is_resident)
{
GModule *last;
GModule *node;
last = NULL;
G_LOCK (GModule);
node = modules;
while (node)
{
if (node == module)
{
if (last)
last->next = node->next;
else
modules = node->next;
break;
}
last = node;
node = last->next;
}
module->next = NULL;
G_UNLOCK (GModule);
_g_module_close (module->handle, FALSE);
g_free (module->file_name);
g_free (module);
}
return g_module_error() == NULL;
}
void
g_module_make_resident (GModule *module)
{
g_return_if_fail (module != NULL);
module->is_resident = TRUE;
}
gchar*
g_module_error (void)
{
return g_static_private_get (&module_error_private);
}
gboolean
g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol)
{
gchar *module_error;
if (symbol)
*symbol = NULL;
CHECK_ERROR (FALSE);
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (symbol_name != NULL, FALSE);
g_return_val_if_fail (symbol != NULL, FALSE);
#ifdef G_MODULE_NEED_USCORE
{
gchar *name;
name = g_strconcat ("_", symbol_name, NULL);
*symbol = _g_module_symbol (module->handle, name);
g_free (name);
}
#else /* !G_MODULE_NEED_USCORE */
*symbol = _g_module_symbol (module->handle, symbol_name);
#endif /* !G_MODULE_NEED_USCORE */
if ((module_error = g_module_error()))
{
gchar *error;
error = g_strconcat ("`", symbol_name, "': ", module_error, NULL);
g_module_set_error (error);
g_free (error);
*symbol = NULL;
return FALSE;
}
return TRUE;
}
gchar*
g_module_name (GModule *module)
{
g_return_val_if_fail (module != NULL, NULL);
if (module == main_module)
return "main";
return module->file_name;
}
gchar*
g_module_build_path (const gchar *directory,
const gchar *module_name)
{
g_return_val_if_fail (module_name != NULL, NULL);
return _g_module_build_path (directory, module_name);
}

Просмотреть файл

@ -1,10 +0,0 @@
EXPORTS
g_log_domain_gmodule
g_module_build_path
g_module_close
g_module_error
g_module_make_resident
g_module_name
g_module_open
g_module_supported
g_module_symbol

Просмотреть файл

@ -1,103 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GMODULE_H__
#define __GMODULE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern const char *g_log_domain_gmodule;
#include <glib.h>
/* exporting and importing functions, this is special cased
* to feature Windows dll stubs.
*/
#define G_MODULE_IMPORT extern
#ifdef NATIVE_WIN32
# define G_MODULE_EXPORT __declspec(dllexport)
#else /* !NATIVE_WIN32 */
# define G_MODULE_EXPORT
#endif /* !NATIVE_WIN32 */
typedef enum
{
G_MODULE_BIND_LAZY = 1 << 0,
G_MODULE_BIND_MASK = 0x01
} GModuleFlags;
typedef struct _GModule GModule;
typedef const gchar* (*GModuleCheckInit) (GModule *module);
typedef void (*GModuleUnload) (GModule *module);
/* return TRUE if dynamic module loading is supported */
gboolean g_module_supported (void);
/* open a module `file_name' and return handle, which is NULL on error */
GModule* g_module_open (const gchar *file_name,
GModuleFlags flags);
/* close a previously opened module, returns TRUE on success */
gboolean g_module_close (GModule *module);
/* make a module resident so g_module_close on it will be ignored */
void g_module_make_resident (GModule *module);
/* query the last module error as a string */
gchar* g_module_error (void);
/* retrive a symbol pointer from `module', returns TRUE on success */
gboolean g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol);
/* retrive the file name from an existing module */
gchar* g_module_name (GModule *module);
/* Build the actual file name containing a module. `directory' is the
* directory where the module file is supposed to be, or NULL or empty
* in which case it should either be in the current directory or, on
* some operating systems, in some standard place, for instance on the
* PATH. Hence, to be absoultely sure to get the correct module,
* always pass in a directory. The file name consists of the directory,
* if supplied, and `module_name' suitably decorated accoring to
* the operating system's conventions (for instance lib*.so or *.dll).
*
* No checks are made that the file exists, or is of correct type.
*/
gchar* g_module_build_path (const gchar *directory,
const gchar *module_name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GMODULE_H__ */

Просмотреть файл

@ -1,48 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __G_MODULE_CONF_H__
#define __G_MODULE_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define G_MODULE_IMPL_NONE 0
#define G_MODULE_IMPL_DL 1
#define G_MODULE_IMPL_DLD 2
#define G_MODULE_IMPL_WIN32 3
#define G_MODULE_IMPL @G_MODULE_IMPL@
#undef G_MODULE_HAVE_DLERROR
#if (@G_MODULE_HAVE_DLERROR@)
#define G_MODULE_HAVE_DLERROR
#endif
#if (@G_MODULE_NEED_USCORE@) || defined (hp9000s300) || defined (__hp9000s300) || defined (__hp9000s300__)
#define G_MODULE_NEED_USCORE
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __G_MODULE_CONF_H__ */

Просмотреть файл

@ -1,45 +0,0 @@
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __G_MODULE_CONF_H__
#define __G_MODULE_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define G_MODULE_IMPL_NONE 0
#define G_MODULE_IMPL_DL 1
#define G_MODULE_IMPL_DLD 2
#define G_MODULE_IMPL_WIN32 3
#define G_MODULE_IMPL G_MODULE_IMPL_WIN32
#undef G_MODULE_HAVE_DLERROR
#ifdef __LCC__
#define G_MODULE_NEED_USCORE
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __G_MODULE_CONF_H__ */

Просмотреть файл

@ -1,82 +0,0 @@
/* libgplugin_a.c - test plugin for testgmodule
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <gmodule.h>
#include <stdlib.h>
#if defined (NATIVE_WIN32) && defined (__LCC__)
int __stdcall
LibMain(void *hinstDll,
unsigned long dwReason,
void *reserved)
{
return 1;
}
#endif /* NATIVE_WIN32 && __LCC__ */
G_MODULE_EXPORT void
gplugin_a_func (void)
{
g_print ("GPluginA: Hello world\n");
}
G_MODULE_EXPORT void
gplugin_clash_func (void)
{
g_print ("GPluginA: Hello plugin clash\n");
}
G_MODULE_EXPORT void
g_clash_func (void)
{
g_print ("GPluginA: Hello global clash\n");
}
G_MODULE_EXPORT void
gplugin_say_boo_func (void)
{
g_print ("GPluginA: BOOH!\n");
}
G_MODULE_EXPORT void
gplugin_a_module_func (GModule *module)
{
void(*f)(void) = NULL;
gchar *string;
string = "gplugin_say_boo_func";
g_print ("GPluginA: retrive symbol `%s' from \"%s\"\n",
string,
g_basename (g_module_name (module)));
if (!g_module_symbol (module, string, (gpointer) &f))
{
g_print ("error: %s\n", g_module_error ());
exit (1);
}
g_print ("GPluginA: call that function(%p): ", f);
f ();
}

Просмотреть файл

@ -1,75 +0,0 @@
/* libgplugin_b.c - test plugin for testgmodule
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <gmodule.h>
#if defined (NATIVE_WIN32) && defined (__LCC__)
int __stdcall
LibMain(void *hinstDll,
unsigned long dwReason,
void *reserved)
{
return 1;
}
#endif /* NATIVE_WIN32 && __LCC__ */
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
g_print ("GPluginB: check-init\n");
return NULL;
}
G_MODULE_EXPORT void
g_module_unload (GModule *module)
{
g_print ("GPluginB: unloaded\n");
}
G_MODULE_EXPORT void
gplugin_b_func (void)
{
g_print ("GPluginB: Hello world\n");
}
G_MODULE_EXPORT void
gplugin_clash_func (void)
{
g_print ("GPluginB: Hello plugin clash\n");
}
G_MODULE_EXPORT void
g_clash_func (void)
{
g_print ("GPluginB: Hello global clash\n");
}
G_MODULE_EXPORT void
gplugin_say_boo_func (void)
{
g_print ("GPluginB: BOOH!\n");
}

Просмотреть файл

@ -1,190 +0,0 @@
/* testgmodule.c - test program for GMODULE
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#undef G_LOG_DOMAIN
#include <gmodule.h>
G_MODULE_EXPORT void
g_clash_func (void)
{
g_print ("GModule: Hello global clash\n");
}
typedef void (*SimpleFunc) (void);
typedef void (*GModuleFunc) (GModule *);
SimpleFunc gplugin_clash_func;
int
main (int arg,
char *argv[])
{
GModule *module_self, *module_a, *module_b;
gchar *string;
gchar *plugin_a, *plugin_b;
SimpleFunc f_a, f_b, f_self;
GModuleFunc gmod_f;
string = g_get_current_dir ();
g_print ("testgmodule (%s):\n", string);
#ifdef NATIVE_WIN32
plugin_a = g_strconcat (string, "\\libgplugin_a.dll", NULL);
plugin_b = g_strconcat (string, "\\libgplugin_b.dll", NULL);
#else /* !NATIVE_WIN32 */
plugin_a = g_strconcat (string, "/.libs/", "libgplugin_a.so", NULL);
plugin_b = g_strconcat (string, "/.libs/", "libgplugin_b.so", NULL);
#endif /* NATIVE_WIN32 */
g_free (string);
/* module handles
*/
g_print ("get main module handle\n");
module_self = g_module_open (NULL, G_MODULE_BIND_LAZY);
if (!module_self)
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("load plugin from \"%s\"\n", plugin_a);
module_a = g_module_open (plugin_a, G_MODULE_BIND_LAZY);
if (!module_a)
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("load plugin from \"%s\"\n", plugin_b);
module_b = g_module_open (plugin_b, G_MODULE_BIND_LAZY);
if (!module_b)
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
/* get plugin specific symbols and call them
*/
string = "gplugin_a_func";
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
string = "gplugin_b_func";
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("call plugin function(%p) A: ", f_a);
f_a ();
g_print ("call plugin function(%p) B: ", f_b);
f_b ();
/* get and call globally clashing functions
*/
string = "g_clash_func";
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_self)));
if (!g_module_symbol (module_self, string, (gpointer) &f_self))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("call plugin function(%p) self: ", f_self);
f_self ();
g_print ("call plugin function(%p) A: ", f_a);
f_a ();
g_print ("call plugin function(%p) B: ", f_b);
f_b ();
/* get and call clashing plugin functions
*/
string = "gplugin_clash_func";
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("call plugin function(%p) A: ", f_a);
gplugin_clash_func = f_a;
gplugin_clash_func ();
g_print ("call plugin function(%p) B: ", f_b);
gplugin_clash_func = f_b;
gplugin_clash_func ();
/* call gmodule function form A
*/
string = "gplugin_a_module_func";
g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
if (!g_module_symbol (module_a, string, (gpointer) &gmod_f))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
g_print ("call plugin A's module function(%p):\n{\n", gmod_f);
gmod_f (module_b);
g_print ("}\n");
/* unload plugins
*/
g_print ("unload plugin A:\n");
if (!g_module_close (module_a))
g_print ("error: %s\n", g_module_error ());
g_print ("unload plugin B:\n");
if (!g_module_close (module_b))
g_print ("error: %s\n", g_module_error ());
#if 0
g_log_set_fatal_mask ("GModule", G_LOG_FATAL_MASK|G_LOG_LEVEL_WARNING);
g_module_symbol (0, 0, 0);
g_warning("jahooo");
g_on_error_query (".libs/testgmodule");
#endif
return 0;
}

Просмотреть файл

@ -1,202 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gmutex.c: MT safety related functions
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
* Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
typedef struct _GStaticPrivateNode GStaticPrivateNode;
struct _GStaticPrivateNode
{
gpointer data;
GDestroyNotify destroy;
};
static void g_static_private_free_data (gpointer data);
static void g_thread_fail (void);
/* Global variables */
gboolean g_thread_use_default_impl = TRUE;
gboolean g_threads_got_initialized = FALSE;
GThreadFunctions g_thread_functions_for_glib_use = {
(GMutex*(*)())g_thread_fail, /* mutex_new */
NULL, /* mutex_lock */
NULL, /* mutex_trylock */
NULL, /* mutex_unlock */
NULL, /* mutex_free */
(GCond*(*)())g_thread_fail, /* cond_new */
NULL, /* cond_signal */
NULL, /* cond_broadcast */
NULL, /* cond_wait */
NULL, /* cond_timed_wait */
NULL, /* cond_free */
(GPrivate*(*)(GDestroyNotify))g_thread_fail, /* private_new */
NULL, /* private_get */
NULL, /* private_set */
};
/* Local data */
static GMutex *g_mutex_protect_static_mutex_allocation = NULL;
static GMutex *g_thread_specific_mutex = NULL;
static GPrivate *g_thread_specific_private = NULL;
/* This must be called only once, before any threads are created.
* It will only be called from g_thread_init() in -lgthread.
*/
void
g_mutex_init (void)
{
/* We let the main thread (the one that calls g_thread_init) inherit
* the data, that it set before calling g_thread_init
*/
gpointer private_old = g_thread_specific_private;
g_thread_specific_private = g_private_new (g_static_private_free_data);
/* we can not use g_private_set here, as g_threads_got_initialized is not
* yet set TRUE, whereas the private_set function is already set.
*/
g_thread_functions_for_glib_use.private_set (g_thread_specific_private,
private_old);
g_mutex_protect_static_mutex_allocation = g_mutex_new();
g_thread_specific_mutex = g_mutex_new();
}
GMutex *
g_static_mutex_get_mutex_impl (GMutex** mutex)
{
if (!g_thread_supported ())
return NULL;
g_assert (g_mutex_protect_static_mutex_allocation);
g_mutex_lock (g_mutex_protect_static_mutex_allocation);
if (!(*mutex))
*mutex = g_mutex_new();
g_mutex_unlock (g_mutex_protect_static_mutex_allocation);
return *mutex;
}
gpointer
g_static_private_get (GStaticPrivate *private_key)
{
GArray *array;
array = g_private_get (g_thread_specific_private);
if (!array)
return NULL;
if (!private_key->index)
return NULL;
else if (private_key->index <= array->len)
return g_array_index (array, GStaticPrivateNode, private_key->index - 1).data;
else
return NULL;
}
void
g_static_private_set (GStaticPrivate *private_key,
gpointer data,
GDestroyNotify notify)
{
GArray *array;
static guint next_index = 0;
GStaticPrivateNode *node;
array = g_private_get (g_thread_specific_private);
if (!array)
{
array = g_array_new (FALSE, TRUE, sizeof (GStaticPrivateNode));
g_private_set (g_thread_specific_private, array);
}
if (!private_key->index)
{
g_mutex_lock (g_thread_specific_mutex);
if (!private_key->index)
private_key->index = ++next_index;
g_mutex_unlock (g_thread_specific_mutex);
}
if (private_key->index > array->len)
g_array_set_size (array, private_key->index);
node = &g_array_index (array, GStaticPrivateNode, private_key->index - 1);
if (node->destroy)
{
gpointer ddata = node->data;
GDestroyNotify ddestroy = node->destroy;
node->data = data;
node->destroy = notify;
ddestroy (ddata);
}
else
{
node->data = data;
node->destroy = notify;
}
}
static void
g_static_private_free_data (gpointer data)
{
if (data)
{
GArray* array = data;
guint i;
for (i = 0; i < array->len; i++ )
{
GStaticPrivateNode *node = &g_array_index (array, GStaticPrivateNode, i);
if (node->destroy)
node->destroy (node->data);
}
}
}
static void
g_thread_fail (void)
{
g_error ("The thread system is not yet initialized.");
}

Просмотреть файл

@ -1,965 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* GNode: N-way tree implementation.
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
/* node allocation
*/
struct _GAllocator /* from gmem.c */
{
gchar *name;
guint16 n_preallocs;
guint is_unused : 1;
guint type : 4;
GAllocator *last;
GMemChunk *mem_chunk;
GNode *free_nodes; /* implementation specific */
};
G_LOCK_DEFINE_STATIC (current_allocator);
static GAllocator *current_allocator = NULL;
/* HOLDS: current_allocator_lock */
static void
g_node_validate_allocator (GAllocator *allocator)
{
g_return_if_fail (allocator != NULL);
g_return_if_fail (allocator->is_unused == TRUE);
if (allocator->type != G_ALLOCATOR_NODE)
{
allocator->type = G_ALLOCATOR_NODE;
if (allocator->mem_chunk)
{
g_mem_chunk_destroy (allocator->mem_chunk);
allocator->mem_chunk = NULL;
}
}
if (!allocator->mem_chunk)
{
allocator->mem_chunk = g_mem_chunk_new (allocator->name,
sizeof (GNode),
sizeof (GNode) * allocator->n_preallocs,
G_ALLOC_ONLY);
allocator->free_nodes = NULL;
}
allocator->is_unused = FALSE;
}
void
g_node_push_allocator (GAllocator *allocator)
{
G_LOCK (current_allocator);
g_node_validate_allocator ( allocator );
allocator->last = current_allocator;
current_allocator = allocator;
G_UNLOCK (current_allocator);
}
void
g_node_pop_allocator (void)
{
G_LOCK (current_allocator);
if (current_allocator)
{
GAllocator *allocator;
allocator = current_allocator;
current_allocator = allocator->last;
allocator->last = NULL;
allocator->is_unused = TRUE;
}
G_UNLOCK (current_allocator);
}
/* --- functions --- */
GNode*
g_node_new (gpointer data)
{
GNode *node;
G_LOCK (current_allocator);
if (!current_allocator)
{
GAllocator *allocator = g_allocator_new ("GLib default GNode allocator",
128);
g_node_validate_allocator (allocator);
allocator->last = NULL;
current_allocator = allocator;
}
if (!current_allocator->free_nodes)
node = g_chunk_new (GNode, current_allocator->mem_chunk);
else
{
node = current_allocator->free_nodes;
current_allocator->free_nodes = node->next;
}
G_UNLOCK (current_allocator);
node->data = data;
node->next = NULL;
node->prev = NULL;
node->parent = NULL;
node->children = NULL;
return node;
}
static void
g_nodes_free (GNode *node)
{
GNode *parent;
parent = node;
while (1)
{
if (parent->children)
g_nodes_free (parent->children);
if (parent->next)
parent = parent->next;
else
break;
}
G_LOCK (current_allocator);
parent->next = current_allocator->free_nodes;
current_allocator->free_nodes = node;
G_UNLOCK (current_allocator);
}
void
g_node_destroy (GNode *root)
{
g_return_if_fail (root != NULL);
if (!G_NODE_IS_ROOT (root))
g_node_unlink (root);
g_nodes_free (root);
}
void
g_node_unlink (GNode *node)
{
g_return_if_fail (node != NULL);
if (node->prev)
node->prev->next = node->next;
else if (node->parent)
node->parent->children = node->next;
node->parent = NULL;
if (node->next)
{
node->next->prev = node->prev;
node->next = NULL;
}
node->prev = NULL;
}
GNode*
g_node_insert (GNode *parent,
gint position,
GNode *node)
{
g_return_val_if_fail (parent != NULL, node);
g_return_val_if_fail (node != NULL, node);
g_return_val_if_fail (G_NODE_IS_ROOT (node), node);
if (position > 0)
return g_node_insert_before (parent,
g_node_nth_child (parent, position),
node);
else if (position == 0)
return g_node_prepend (parent, node);
else /* if (position < 0) */
return g_node_append (parent, node);
}
GNode*
g_node_insert_before (GNode *parent,
GNode *sibling,
GNode *node)
{
g_return_val_if_fail (parent != NULL, node);
g_return_val_if_fail (node != NULL, node);
g_return_val_if_fail (G_NODE_IS_ROOT (node), node);
if (sibling)
g_return_val_if_fail (sibling->parent == parent, node);
node->parent = parent;
if (sibling)
{
if (sibling->prev)
{
node->prev = sibling->prev;
node->prev->next = node;
node->next = sibling;
sibling->prev = node;
}
else
{
node->parent->children = node;
node->next = sibling;
sibling->prev = node;
}
}
else
{
if (parent->children)
{
sibling = parent->children;
while (sibling->next)
sibling = sibling->next;
node->prev = sibling;
sibling->next = node;
}
else
node->parent->children = node;
}
return node;
}
GNode*
g_node_prepend (GNode *parent,
GNode *node)
{
g_return_val_if_fail (parent != NULL, node);
return g_node_insert_before (parent, parent->children, node);
}
GNode*
g_node_get_root (GNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
while (node->parent)
node = node->parent;
return node;
}
gboolean
g_node_is_ancestor (GNode *node,
GNode *descendant)
{
g_return_val_if_fail (node != NULL, FALSE);
g_return_val_if_fail (descendant != NULL, FALSE);
while (descendant)
{
if (descendant->parent == node)
return TRUE;
descendant = descendant->parent;
}
return FALSE;
}
/* returns 1 for root, 2 for first level children,
* 3 for children's children...
*/
guint
g_node_depth (GNode *node)
{
register guint depth = 0;
while (node)
{
depth++;
node = node->parent;
}
return depth;
}
void
g_node_reverse_children (GNode *node)
{
GNode *child;
GNode *last;
g_return_if_fail (node != NULL);
child = node->children;
last = NULL;
while (child)
{
last = child;
child = last->next;
last->next = last->prev;
last->prev = child;
}
node->children = last;
}
guint
g_node_max_height (GNode *root)
{
register GNode *child;
register guint max_height = 0;
if (!root)
return 0;
child = root->children;
while (child)
{
register guint tmp_height;
tmp_height = g_node_max_height (child);
if (tmp_height > max_height)
max_height = tmp_height;
child = child->next;
}
return max_height + 1;
}
static gboolean
g_node_traverse_pre_order (GNode *node,
GTraverseFlags flags,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
GNode *child;
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (g_node_traverse_pre_order (current, flags, func, data))
return TRUE;
}
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_depth_traverse_pre_order (GNode *node,
GTraverseFlags flags,
guint depth,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
GNode *child;
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
depth--;
if (!depth)
return FALSE;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (g_node_depth_traverse_pre_order (current, flags, depth, func, data))
return TRUE;
}
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_traverse_post_order (GNode *node,
GTraverseFlags flags,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
GNode *child;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (g_node_traverse_post_order (current, flags, func, data))
return TRUE;
}
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_depth_traverse_post_order (GNode *node,
GTraverseFlags flags,
guint depth,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
depth--;
if (depth)
{
GNode *child;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (g_node_depth_traverse_post_order (current, flags, depth, func, data))
return TRUE;
}
}
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_traverse_in_order (GNode *node,
GTraverseFlags flags,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
GNode *child;
register GNode *current;
child = node->children;
current = child;
child = current->next;
if (g_node_traverse_in_order (current, flags, func, data))
return TRUE;
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
while (child)
{
current = child;
child = current->next;
if (g_node_traverse_in_order (current, flags, func, data))
return TRUE;
}
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_depth_traverse_in_order (GNode *node,
GTraverseFlags flags,
guint depth,
GNodeTraverseFunc func,
gpointer data)
{
if (node->children)
{
depth--;
if (depth)
{
GNode *child;
register GNode *current;
child = node->children;
current = child;
child = current->next;
if (g_node_depth_traverse_in_order (current, flags, depth, func, data))
return TRUE;
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
while (child)
{
current = child;
child = current->next;
if (g_node_depth_traverse_in_order (current, flags, depth, func, data))
return TRUE;
}
}
else if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (node, data))
return TRUE;
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (node, data))
return TRUE;
return FALSE;
}
static gboolean
g_node_traverse_children (GNode *node,
GTraverseFlags flags,
GNodeTraverseFunc func,
gpointer data)
{
GNode *child;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (current->children)
{
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (current, data))
return TRUE;
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (current, data))
return TRUE;
}
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (current->children &&
g_node_traverse_children (current, flags, func, data))
return TRUE;
}
return FALSE;
}
static gboolean
g_node_depth_traverse_children (GNode *node,
GTraverseFlags flags,
guint depth,
GNodeTraverseFunc func,
gpointer data)
{
GNode *child;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (current->children)
{
if ((flags & G_TRAVERSE_NON_LEAFS) &&
func (current, data))
return TRUE;
}
else if ((flags & G_TRAVERSE_LEAFS) &&
func (current, data))
return TRUE;
}
depth--;
if (!depth)
return FALSE;
child = node->children;
while (child)
{
register GNode *current;
current = child;
child = current->next;
if (current->children &&
g_node_depth_traverse_children (current, flags, depth, func, data))
return TRUE;
}
return FALSE;
}
void
g_node_traverse (GNode *root,
GTraverseType order,
GTraverseFlags flags,
gint depth,
GNodeTraverseFunc func,
gpointer data)
{
g_return_if_fail (root != NULL);
g_return_if_fail (func != NULL);
g_return_if_fail (order <= G_LEVEL_ORDER);
g_return_if_fail (flags <= G_TRAVERSE_MASK);
g_return_if_fail (depth == -1 || depth > 0);
switch (order)
{
case G_PRE_ORDER:
if (depth < 0)
g_node_traverse_pre_order (root, flags, func, data);
else
g_node_depth_traverse_pre_order (root, flags, depth, func, data);
break;
case G_POST_ORDER:
if (depth < 0)
g_node_traverse_post_order (root, flags, func, data);
else
g_node_depth_traverse_post_order (root, flags, depth, func, data);
break;
case G_IN_ORDER:
if (depth < 0)
g_node_traverse_in_order (root, flags, func, data);
else
g_node_depth_traverse_in_order (root, flags, depth, func, data);
break;
case G_LEVEL_ORDER:
if (root->children)
{
if (!((flags & G_TRAVERSE_NON_LEAFS) &&
func (root, data)))
{
if (depth < 0)
g_node_traverse_children (root, flags, func, data);
else
{
depth--;
if (depth)
g_node_depth_traverse_children (root, flags, depth, func, data);
}
}
}
else if (flags & G_TRAVERSE_LEAFS)
func (root, data);
break;
}
}
static gboolean
g_node_find_func (GNode *node,
gpointer data)
{
register gpointer *d = data;
if (*d != node->data)
return FALSE;
*(++d) = node;
return TRUE;
}
GNode*
g_node_find (GNode *root,
GTraverseType order,
GTraverseFlags flags,
gpointer data)
{
gpointer d[2];
g_return_val_if_fail (root != NULL, NULL);
g_return_val_if_fail (order <= G_LEVEL_ORDER, NULL);
g_return_val_if_fail (flags <= G_TRAVERSE_MASK, NULL);
d[0] = data;
d[1] = NULL;
g_node_traverse (root, order, flags, -1, g_node_find_func, d);
return d[1];
}
static void
g_node_count_func (GNode *node,
GTraverseFlags flags,
guint *n)
{
if (node->children)
{
GNode *child;
if (flags & G_TRAVERSE_NON_LEAFS)
(*n)++;
child = node->children;
while (child)
{
g_node_count_func (child, flags, n);
child = child->next;
}
}
else if (flags & G_TRAVERSE_LEAFS)
(*n)++;
}
guint
g_node_n_nodes (GNode *root,
GTraverseFlags flags)
{
guint n = 0;
g_return_val_if_fail (root != NULL, 0);
g_return_val_if_fail (flags <= G_TRAVERSE_MASK, 0);
g_node_count_func (root, flags, &n);
return n;
}
GNode*
g_node_last_child (GNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
node = node->children;
if (node)
while (node->next)
node = node->next;
return node;
}
GNode*
g_node_nth_child (GNode *node,
guint n)
{
g_return_val_if_fail (node != NULL, NULL);
node = node->children;
if (node)
while ((n-- > 0) && node)
node = node->next;
return node;
}
guint
g_node_n_children (GNode *node)
{
guint n = 0;
g_return_val_if_fail (node != NULL, 0);
node = node->children;
while (node)
{
n++;
node = node->next;
}
return n;
}
GNode*
g_node_find_child (GNode *node,
GTraverseFlags flags,
gpointer data)
{
g_return_val_if_fail (node != NULL, NULL);
g_return_val_if_fail (flags <= G_TRAVERSE_MASK, NULL);
node = node->children;
while (node)
{
if (node->data == data)
{
if (G_NODE_IS_LEAF (node))
{
if (flags & G_TRAVERSE_LEAFS)
return node;
}
else
{
if (flags & G_TRAVERSE_NON_LEAFS)
return node;
}
}
node = node->next;
}
return NULL;
}
gint
g_node_child_position (GNode *node,
GNode *child)
{
register guint n = 0;
g_return_val_if_fail (node != NULL, -1);
g_return_val_if_fail (child != NULL, -1);
g_return_val_if_fail (child->parent == node, -1);
node = node->children;
while (node)
{
if (node == child)
return n;
n++;
node = node->next;
}
return -1;
}
gint
g_node_child_index (GNode *node,
gpointer data)
{
register guint n = 0;
g_return_val_if_fail (node != NULL, -1);
node = node->children;
while (node)
{
if (node->data == data)
return n;
n++;
node = node->next;
}
return -1;
}
GNode*
g_node_first_sibling (GNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
while (node->prev)
node = node->prev;
return node;
}
GNode*
g_node_last_sibling (GNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
while (node->next)
node = node->next;
return node;
}
void
g_node_children_foreach (GNode *node,
GTraverseFlags flags,
GNodeForeachFunc func,
gpointer data)
{
g_return_if_fail (node != NULL);
g_return_if_fail (flags <= G_TRAVERSE_MASK);
g_return_if_fail (func != NULL);
node = node->children;
while (node)
{
register GNode *current;
current = node;
node = current->next;
if (G_NODE_IS_LEAF (current))
{
if (flags & G_TRAVERSE_LEAFS)
func (current, data);
}
else
{
if (flags & G_TRAVERSE_NON_LEAFS)
func (current, data);
}
}
}

Просмотреть файл

@ -1,83 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
static const guint g_primes[] =
{
11,
19,
37,
73,
109,
163,
251,
367,
557,
823,
1237,
1861,
2777,
4177,
6247,
9371,
14057,
21089,
31627,
47431,
71143,
106721,
160073,
240101,
360163,
540217,
810343,
1215497,
1823231,
2734867,
4102283,
6153409,
9230113,
13845163,
};
static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
guint
g_spaced_primes_closest (guint num)
{
gint i;
for (i = 0; i < g_nprimes; i++)
if (g_primes[i] > num)
return g_primes[i];
return g_primes[g_nprimes - 1];
}

Просмотреть файл

@ -1,459 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
#include <stdarg.h>
#include <string.h>
typedef struct _GRealRelation GRealRelation;
typedef struct _GRealTuples GRealTuples;
struct _GRealRelation
{
gint fields;
gint current_field;
GHashTable *all_tuples;
GHashTable **hashed_tuple_tables;
GMemChunk *tuple_chunk;
gint count;
};
struct _GRealTuples
{
gint len;
gint width;
gpointer *data;
};
static gboolean
tuple_equal_2 (gconstpointer v_a,
gconstpointer v_b)
{
gpointer* a = (gpointer*) v_a;
gpointer* b = (gpointer*) v_b;
return a[0] == b[0] && a[1] == b[1];
}
static guint
tuple_hash_2 (gconstpointer v_a)
{
gpointer* a = (gpointer*) v_a;
return (gulong)a[0] ^ (gulong)a[1];
}
static GHashFunc
tuple_hash (gint fields)
{
switch (fields)
{
case 2:
return tuple_hash_2;
default:
g_error ("no tuple hash for %d", fields);
}
return NULL;
}
static GCompareFunc
tuple_equal (gint fields)
{
switch (fields)
{
case 2:
return tuple_equal_2;
default:
g_error ("no tuple equal for %d", fields);
}
return NULL;
}
GRelation*
g_relation_new (gint fields)
{
GRealRelation* rel = g_new0 (GRealRelation, 1);
rel->fields = fields;
rel->tuple_chunk = g_mem_chunk_new ("Relation Chunk",
fields * sizeof (gpointer),
fields * sizeof (gpointer) * 128,
G_ALLOC_AND_FREE);
rel->all_tuples = g_hash_table_new (tuple_hash (fields), tuple_equal (fields));
rel->hashed_tuple_tables = g_new0 (GHashTable*, fields);
return (GRelation*) rel;
}
static void
g_relation_free_array (gpointer key, gpointer value, gpointer user_data)
{
g_hash_table_destroy ((GHashTable*) value);
}
void
g_relation_destroy (GRelation *relation)
{
GRealRelation *rel = (GRealRelation *) relation;
gint i;
if (rel)
{
g_hash_table_destroy (rel->all_tuples);
g_mem_chunk_destroy (rel->tuple_chunk);
for (i = 0; i < rel->fields; i += 1)
{
if (rel->hashed_tuple_tables[i])
{
g_hash_table_foreach (rel->hashed_tuple_tables[i], g_relation_free_array, NULL);
g_hash_table_destroy (rel->hashed_tuple_tables[i]);
}
}
g_free (rel->hashed_tuple_tables);
g_free (rel);
}
}
void
g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
GCompareFunc key_compare_func)
{
GRealRelation *rel = (GRealRelation *) relation;
g_return_if_fail (relation != NULL);
g_return_if_fail (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
}
void
g_relation_insert (GRelation *relation,
...)
{
GRealRelation *rel = (GRealRelation *) relation;
gpointer* tuple = g_chunk_new (gpointer, rel->tuple_chunk);
va_list args;
gint i;
va_start(args, relation);
for (i = 0; i < rel->fields; i += 1)
tuple[i] = va_arg(args, gpointer);
va_end(args);
g_hash_table_insert (rel->all_tuples, tuple, tuple);
rel->count += 1;
for (i = 0; i < rel->fields; i += 1)
{
GHashTable *table;
gpointer key;
GHashTable *per_key_table;
table = rel->hashed_tuple_tables[i];
if (table == NULL)
continue;
key = tuple[i];
per_key_table = g_hash_table_lookup (table, key);
if (per_key_table == NULL)
{
per_key_table = g_hash_table_new (tuple_hash (rel->fields), tuple_equal (rel->fields));
g_hash_table_insert (table, key, per_key_table);
}
g_hash_table_insert (per_key_table, tuple, tuple);
}
}
static void
g_relation_delete_tuple (gpointer tuple_key,
gpointer tuple_value,
gpointer user_data)
{
gpointer *tuple = (gpointer*) tuple_value;
GRealRelation *rel = (GRealRelation *) user_data;
gint j;
g_assert (tuple_key == tuple_value);
for (j = 0; j < rel->fields; j += 1)
{
GHashTable *one_table = rel->hashed_tuple_tables[j];
gpointer one_key;
GHashTable *per_key_table;
if (one_table == NULL)
continue;
if (j == rel->current_field)
/* can't delete from the table we're foreaching in */
continue;
one_key = tuple[j];
per_key_table = g_hash_table_lookup (one_table, one_key);
g_hash_table_remove (per_key_table, tuple);
}
g_hash_table_remove (rel->all_tuples, tuple);
rel->count -= 1;
}
gint
g_relation_delete (GRelation *relation,
gconstpointer key,
gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GHashTable *key_table;
gint count = rel->count;
g_return_val_if_fail (relation != NULL, 0);
g_return_val_if_fail (table != NULL, 0);
key_table = g_hash_table_lookup (table, key);
if (!key_table)
return 0;
rel->current_field = field;
g_hash_table_foreach (key_table, g_relation_delete_tuple, rel);
g_hash_table_remove (table, key);
g_hash_table_destroy (key_table);
/* @@@ FIXME: Remove empty hash tables. */
return count - rel->count;
}
static void
g_relation_select_tuple (gpointer tuple_key,
gpointer tuple_value,
gpointer user_data)
{
gpointer *tuple = (gpointer*) tuple_value;
GRealTuples *tuples = (GRealTuples*) user_data;
gint stride = sizeof (gpointer) * tuples->width;
g_assert (tuple_key == tuple_value);
memcpy (tuples->data + (tuples->len * tuples->width),
tuple,
stride);
tuples->len += 1;
}
GTuples*
g_relation_select (GRelation *relation,
gconstpointer key,
gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GHashTable *key_table;
GRealTuples *tuples = g_new0 (GRealTuples, 1);
gint count;
g_return_val_if_fail (relation != NULL, NULL);
g_return_val_if_fail (table != NULL, NULL);
key_table = g_hash_table_lookup (table, key);
if (!key_table)
return (GTuples*)tuples;
count = g_relation_count (relation, key, field);
tuples->data = g_malloc (sizeof (gpointer) * rel->fields * count);
tuples->width = rel->fields;
g_hash_table_foreach (key_table, g_relation_select_tuple, tuples);
g_assert (count == tuples->len);
return (GTuples*)tuples;
}
gint
g_relation_count (GRelation *relation,
gconstpointer key,
gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GHashTable *key_table;
g_return_val_if_fail (relation != NULL, 0);
g_return_val_if_fail (table != NULL, 0);
key_table = g_hash_table_lookup (table, key);
if (!key_table)
return 0;
return g_hash_table_size (key_table);
}
gboolean
g_relation_exists (GRelation *relation, ...)
{
GRealRelation *rel = (GRealRelation *) relation;
gpointer* tuple = g_chunk_new (gpointer, rel->tuple_chunk);
va_list args;
gint i;
gboolean result;
va_start(args, relation);
for (i = 0; i < rel->fields; i += 1)
tuple[i] = va_arg(args, gpointer);
va_end(args);
result = g_hash_table_lookup (rel->all_tuples, tuple) != NULL;
g_mem_chunk_free (rel->tuple_chunk, tuple);
return result;
}
void
g_tuples_destroy (GTuples *tuples0)
{
GRealTuples *tuples = (GRealTuples*) tuples0;
if (tuples)
{
g_free (tuples->data);
g_free (tuples);
}
}
gpointer
g_tuples_index (GTuples *tuples0,
gint index,
gint field)
{
GRealTuples *tuples = (GRealTuples*) tuples0;
g_return_val_if_fail (tuples0 != NULL, NULL);
g_return_val_if_fail (field < tuples->width, NULL);
return tuples->data[index * tuples->width + field];
}
/* Print
*/
static void
g_relation_print_one (gpointer tuple_key,
gpointer tuple_value,
gpointer user_data)
{
gint i;
GString *gstring;
GRealRelation* rel = (GRealRelation*) user_data;
gpointer* tuples = (gpointer*) tuple_value;
gstring = g_string_new ("[");
for (i = 0; i < rel->fields; i += 1)
{
g_string_sprintfa (gstring, "%p", tuples[i]);
if (i < (rel->fields - 1))
g_string_append (gstring, ",");
}
g_string_append (gstring, "]");
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, gstring->str);
g_string_free (gstring, TRUE);
}
static void
g_relation_print_index (gpointer tuple_key,
gpointer tuple_value,
gpointer user_data)
{
GRealRelation* rel = (GRealRelation*) user_data;
GHashTable* table = (GHashTable*) tuple_value;
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "*** key %p", tuple_key);
g_hash_table_foreach (table,
g_relation_print_one,
rel);
}
void
g_relation_print (GRelation *relation)
{
gint i;
GRealRelation* rel = (GRealRelation*) relation;
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "*** all tuples (%d)", rel->count);
g_hash_table_foreach (rel->all_tuples,
g_relation_print_one,
rel);
for (i = 0; i < rel->fields; i += 1)
{
if (rel->hashed_tuple_tables[i] == NULL)
continue;
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "*** index %d", i);
g_hash_table_foreach (rel->hashed_tuple_tables[i],
g_relation_print_index,
rel);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,601 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
struct _GAllocator /* from gmem.c */
{
gchar *name;
guint16 n_preallocs;
guint is_unused : 1;
guint type : 4;
GAllocator *last;
GMemChunk *mem_chunk;
GSList *free_lists; /* implementation specific */
};
G_LOCK_DEFINE_STATIC (current_allocator);
static GAllocator *current_allocator = NULL;
/* HOLDS: current_allocator_lock */
static void
g_slist_validate_allocator (GAllocator *allocator)
{
g_return_if_fail (allocator != NULL);
g_return_if_fail (allocator->is_unused == TRUE);
if (allocator->type != G_ALLOCATOR_SLIST)
{
allocator->type = G_ALLOCATOR_SLIST;
if (allocator->mem_chunk)
{
g_mem_chunk_destroy (allocator->mem_chunk);
allocator->mem_chunk = NULL;
}
}
if (!allocator->mem_chunk)
{
allocator->mem_chunk = g_mem_chunk_new (allocator->name,
sizeof (GSList),
sizeof (GSList) * allocator->n_preallocs,
G_ALLOC_ONLY);
allocator->free_lists = NULL;
}
allocator->is_unused = FALSE;
}
void
g_slist_push_allocator (GAllocator *allocator)
{
G_LOCK (current_allocator);
g_slist_validate_allocator (allocator);
allocator->last = current_allocator;
current_allocator = allocator;
G_UNLOCK (current_allocator);
}
void
g_slist_pop_allocator (void)
{
G_LOCK (current_allocator);
if (current_allocator)
{
GAllocator *allocator;
allocator = current_allocator;
current_allocator = allocator->last;
allocator->last = NULL;
allocator->is_unused = TRUE;
}
G_UNLOCK (current_allocator);
}
GSList*
g_slist_alloc (void)
{
GSList *list;
G_LOCK (current_allocator);
if (!current_allocator)
{
GAllocator *allocator = g_allocator_new ("GLib default GSList allocator",
128);
g_slist_validate_allocator (allocator);
allocator->last = NULL;
current_allocator = allocator;
}
if (!current_allocator->free_lists)
{
list = g_chunk_new (GSList, current_allocator->mem_chunk);
list->data = NULL;
}
else
{
if (current_allocator->free_lists->data)
{
list = current_allocator->free_lists->data;
current_allocator->free_lists->data = list->next;
list->data = NULL;
}
else
{
list = current_allocator->free_lists;
current_allocator->free_lists = list->next;
}
}
G_UNLOCK (current_allocator);
list->next = NULL;
return list;
}
void
g_slist_free (GSList *list)
{
if (list)
{
list->data = list->next;
G_LOCK (current_allocator);
list->next = current_allocator->free_lists;
current_allocator->free_lists = list;
G_UNLOCK (current_allocator);
}
}
void
g_slist_free_1 (GSList *list)
{
if (list)
{
list->data = NULL;
G_LOCK (current_allocator);
list->next = current_allocator->free_lists;
current_allocator->free_lists = list;
G_UNLOCK (current_allocator);
}
}
GSList*
g_slist_append (GSList *list,
gpointer data)
{
GSList *new_list;
GSList *last;
new_list = g_slist_alloc ();
new_list->data = data;
if (list)
{
last = g_slist_last (list);
/* g_assert (last != NULL); */
last->next = new_list;
return list;
}
else
return new_list;
}
GSList*
g_slist_prepend (GSList *list,
gpointer data)
{
GSList *new_list;
new_list = g_slist_alloc ();
new_list->data = data;
new_list->next = list;
return new_list;
}
GSList*
g_slist_insert (GSList *list,
gpointer data,
gint position)
{
GSList *prev_list;
GSList *tmp_list;
GSList *new_list;
if (position < 0)
return g_slist_append (list, data);
else if (position == 0)
return g_slist_prepend (list, data);
new_list = g_slist_alloc ();
new_list->data = data;
if (!list)
return new_list;
prev_list = NULL;
tmp_list = list;
while ((position-- > 0) && tmp_list)
{
prev_list = tmp_list;
tmp_list = tmp_list->next;
}
if (prev_list)
{
new_list->next = prev_list->next;
prev_list->next = new_list;
}
else
{
new_list->next = list;
list = new_list;
}
return list;
}
GSList *
g_slist_concat (GSList *list1, GSList *list2)
{
if (list2)
{
if (list1)
g_slist_last (list1)->next = list2;
else
list1 = list2;
}
return list1;
}
GSList*
g_slist_remove (GSList *list,
gpointer data)
{
GSList *tmp;
GSList *prev;
prev = NULL;
tmp = list;
while (tmp)
{
if (tmp->data == data)
{
if (prev)
prev->next = tmp->next;
if (list == tmp)
list = list->next;
tmp->next = NULL;
g_slist_free (tmp);
break;
}
prev = tmp;
tmp = tmp->next;
}
return list;
}
GSList*
g_slist_remove_link (GSList *list,
GSList *link)
{
GSList *tmp;
GSList *prev;
prev = NULL;
tmp = list;
while (tmp)
{
if (tmp == link)
{
if (prev)
prev->next = tmp->next;
if (list == tmp)
list = list->next;
tmp->next = NULL;
break;
}
prev = tmp;
tmp = tmp->next;
}
return list;
}
GSList*
g_slist_copy (GSList *list)
{
GSList *new_list = NULL;
if (list)
{
GSList *last;
new_list = g_slist_alloc ();
new_list->data = list->data;
last = new_list;
list = list->next;
while (list)
{
last->next = g_slist_alloc ();
last = last->next;
last->data = list->data;
list = list->next;
}
}
return new_list;
}
GSList*
g_slist_reverse (GSList *list)
{
GSList *tmp;
GSList *prev;
GSList *last;
last = NULL;
prev = NULL;
while (list)
{
last = list;
tmp = list->next;
list->next = prev;
prev = list;
list = tmp;
}
return last;
}
GSList*
g_slist_nth (GSList *list,
guint n)
{
while ((n-- > 0) && list)
list = list->next;
return list;
}
gpointer
g_slist_nth_data (GSList *list,
guint n)
{
while ((n-- > 0) && list)
list = list->next;
return list ? list->data : NULL;
}
GSList*
g_slist_find (GSList *list,
gpointer data)
{
while (list)
{
if (list->data == data)
break;
list = list->next;
}
return list;
}
GSList*
g_slist_find_custom (GSList *list,
gpointer data,
GCompareFunc func)
{
g_return_val_if_fail (func != NULL, list);
while (list)
{
if (! func (list->data, data))
return list;
list = list->next;
}
return NULL;
}
gint
g_slist_position (GSList *list,
GSList *link)
{
gint i;
i = 0;
while (list)
{
if (list == link)
return i;
i++;
list = list->next;
}
return -1;
}
gint
g_slist_index (GSList *list,
gpointer data)
{
gint i;
i = 0;
while (list)
{
if (list->data == data)
return i;
i++;
list = list->next;
}
return -1;
}
GSList*
g_slist_last (GSList *list)
{
if (list)
{
while (list->next)
list = list->next;
}
return list;
}
guint
g_slist_length (GSList *list)
{
guint length;
length = 0;
while (list)
{
length++;
list = list->next;
}
return length;
}
void
g_slist_foreach (GSList *list,
GFunc func,
gpointer user_data)
{
while (list)
{
(*func) (list->data, user_data);
list = list->next;
}
}
GSList*
g_slist_insert_sorted (GSList *list,
gpointer data,
GCompareFunc func)
{
GSList *tmp_list = list;
GSList *prev_list = NULL;
GSList *new_list;
gint cmp;
g_return_val_if_fail (func != NULL, list);
if (!list)
{
new_list = g_slist_alloc();
new_list->data = data;
return new_list;
}
cmp = (*func) (data, tmp_list->data);
while ((tmp_list->next) && (cmp > 0))
{
prev_list = tmp_list;
tmp_list = tmp_list->next;
cmp = (*func) (data, tmp_list->data);
}
new_list = g_slist_alloc();
new_list->data = data;
if ((!tmp_list->next) && (cmp > 0))
{
tmp_list->next = new_list;
return list;
}
if (prev_list)
{
prev_list->next = new_list;
new_list->next = tmp_list;
return list;
}
else
{
new_list->next = list;
return new_list;
}
}
static GSList*
g_slist_sort_merge (GSList *l1,
GSList *l2,
GCompareFunc compare_func)
{
GSList list, *l;
l=&list;
while (l1 && l2)
{
if (compare_func(l1->data,l2->data) < 0)
{
l=l->next=l1;
l1=l1->next;
}
else
{
l=l->next=l2;
l2=l2->next;
}
}
l->next= l1 ? l1 : l2;
return list.next;
}
GSList*
g_slist_sort (GSList *list,
GCompareFunc compare_func)
{
GSList *l1, *l2;
if (!list)
return NULL;
if (!list->next)
return list;
l1 = list;
l2 = list->next;
while ((l2 = l2->next) != NULL)
{
if ((l2 = l2->next) == NULL)
break;
l1=l1->next;
}
l2 = l1->next;
l1->next = NULL;
return g_slist_sort_merge (g_slist_sort (list, compare_func),
g_slist_sort (l2, compare_func),
compare_func);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,514 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "glib.h"
typedef struct _GRealStringChunk GRealStringChunk;
typedef struct _GRealString GRealString;
struct _GRealStringChunk
{
GHashTable *const_table;
GSList *storage_list;
gint storage_next;
gint this_size;
gint default_size;
};
struct _GRealString
{
gchar *str;
gint len;
gint alloc;
};
G_LOCK_DEFINE_STATIC (string_mem_chunk);
static GMemChunk *string_mem_chunk = NULL;
/* Hash Functions.
*/
gint
g_str_equal (gconstpointer v, gconstpointer v2)
{
return strcmp ((const gchar*) v, (const gchar*)v2) == 0;
}
/* a char* hash function from ASU */
guint
g_str_hash (gconstpointer v)
{
const char *s = (char*)v;
const char *p;
guint h=0, g;
for(p = s; *p != '\0'; p += 1) {
h = ( h << 4 ) + *p;
if ( ( g = h & 0xf0000000 ) ) {
h = h ^ (g >> 24);
h = h ^ g;
}
}
return h /* % M */;
}
/* String Chunks.
*/
GStringChunk*
g_string_chunk_new (gint default_size)
{
GRealStringChunk *new_chunk = g_new (GRealStringChunk, 1);
gint size = 1;
while (size < default_size)
size <<= 1;
new_chunk->const_table = NULL;
new_chunk->storage_list = NULL;
new_chunk->storage_next = size;
new_chunk->default_size = size;
new_chunk->this_size = size;
return (GStringChunk*) new_chunk;
}
void
g_string_chunk_free (GStringChunk *fchunk)
{
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
GSList *tmp_list;
g_return_if_fail (chunk != NULL);
if (chunk->storage_list)
{
for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next)
g_free (tmp_list->data);
g_slist_free (chunk->storage_list);
}
if (chunk->const_table)
g_hash_table_destroy (chunk->const_table);
g_free (chunk);
}
gchar*
g_string_chunk_insert (GStringChunk *fchunk,
const gchar *string)
{
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
gint len = strlen (string);
char* pos;
g_return_val_if_fail (chunk != NULL, NULL);
if ((chunk->storage_next + len + 1) > chunk->this_size)
{
gint new_size = chunk->default_size;
while (new_size < len+1)
new_size <<= 1;
chunk->storage_list = g_slist_prepend (chunk->storage_list,
g_new (char, new_size));
chunk->this_size = new_size;
chunk->storage_next = 0;
}
pos = ((char*)chunk->storage_list->data) + chunk->storage_next;
strcpy (pos, string);
chunk->storage_next += len + 1;
return pos;
}
gchar*
g_string_chunk_insert_const (GStringChunk *fchunk,
const gchar *string)
{
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
char* lookup;
g_return_val_if_fail (chunk != NULL, NULL);
if (!chunk->const_table)
chunk->const_table = g_hash_table_new (g_str_hash, g_str_equal);
lookup = (char*) g_hash_table_lookup (chunk->const_table, (gchar *)string);
if (!lookup)
{
lookup = g_string_chunk_insert (fchunk, string);
g_hash_table_insert (chunk->const_table, lookup, lookup);
}
return lookup;
}
/* Strings.
*/
static gint
nearest_pow (gint num)
{
gint n = 1;
while (n < num)
n <<= 1;
return n;
}
static void
g_string_maybe_expand (GRealString* string, gint len)
{
if (string->len + len >= string->alloc)
{
string->alloc = nearest_pow (string->len + len + 1);
string->str = g_realloc (string->str, string->alloc);
}
}
GString*
g_string_sized_new (guint dfl_size)
{
GRealString *string;
G_LOCK (string_mem_chunk);
if (!string_mem_chunk)
string_mem_chunk = g_mem_chunk_new ("string mem chunk",
sizeof (GRealString),
1024, G_ALLOC_AND_FREE);
string = g_chunk_new (GRealString, string_mem_chunk);
G_UNLOCK (string_mem_chunk);
string->alloc = 0;
string->len = 0;
string->str = NULL;
g_string_maybe_expand (string, MAX (dfl_size, 2));
string->str[0] = 0;
return (GString*) string;
}
GString*
g_string_new (const gchar *init)
{
GString *string;
string = g_string_sized_new (2);
if (init)
g_string_append (string, init);
return string;
}
void
g_string_free (GString *string,
gint free_segment)
{
g_return_if_fail (string != NULL);
if (free_segment)
g_free (string->str);
G_LOCK (string_mem_chunk);
g_mem_chunk_free (string_mem_chunk, string);
G_UNLOCK (string_mem_chunk);
}
GString*
g_string_assign (GString *lval,
const gchar *rval)
{
g_string_truncate (lval, 0);
g_string_append (lval, rval);
return lval;
}
GString*
g_string_truncate (GString* fstring,
gint len)
{
GRealString *string = (GRealString*)fstring;
g_return_val_if_fail (string != NULL, NULL);
string->len = len;
string->str[len] = 0;
return fstring;
}
GString*
g_string_append (GString *fstring,
const gchar *val)
{
GRealString *string = (GRealString*)fstring;
int len;
g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (val != NULL, fstring);
len = strlen (val);
g_string_maybe_expand (string, len);
strcpy (string->str + string->len, val);
string->len += len;
return fstring;
}
GString*
g_string_append_c (GString *fstring,
gchar c)
{
GRealString *string = (GRealString*)fstring;
g_return_val_if_fail (string != NULL, NULL);
g_string_maybe_expand (string, 1);
string->str[string->len++] = c;
string->str[string->len] = 0;
return fstring;
}
GString*
g_string_prepend (GString *fstring,
const gchar *val)
{
GRealString *string = (GRealString*)fstring;
gint len;
g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (val != NULL, fstring);
len = strlen (val);
g_string_maybe_expand (string, len);
g_memmove (string->str + len, string->str, string->len);
strncpy (string->str, val, len);
string->len += len;
string->str[string->len] = 0;
return fstring;
}
GString*
g_string_prepend_c (GString *fstring,
gchar c)
{
GRealString *string = (GRealString*)fstring;
g_return_val_if_fail (string != NULL, NULL);
g_string_maybe_expand (string, 1);
g_memmove (string->str + 1, string->str, string->len);
string->str[0] = c;
string->len += 1;
string->str[string->len] = 0;
return fstring;
}
GString*
g_string_insert (GString *fstring,
gint pos,
const gchar *val)
{
GRealString *string = (GRealString*)fstring;
gint len;
g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (val != NULL, fstring);
g_return_val_if_fail (pos >= 0, fstring);
g_return_val_if_fail (pos <= string->len, fstring);
len = strlen (val);
g_string_maybe_expand (string, len);
g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
strncpy (string->str + pos, val, len);
string->len += len;
string->str[string->len] = 0;
return fstring;
}
GString *
g_string_insert_c (GString *fstring,
gint pos,
gchar c)
{
GRealString *string = (GRealString*)fstring;
g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (pos <= string->len, fstring);
g_string_maybe_expand (string, 1);
g_memmove (string->str + pos + 1, string->str + pos, string->len - pos);
string->str[pos] = c;
string->len += 1;
string->str[string->len] = 0;
return fstring;
}
GString*
g_string_erase (GString *fstring,
gint pos,
gint len)
{
GRealString *string = (GRealString*)fstring;
g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (len >= 0, fstring);
g_return_val_if_fail (pos >= 0, fstring);
g_return_val_if_fail (pos <= string->len, fstring);
g_return_val_if_fail (pos + len <= string->len, fstring);
if (pos + len < string->len)
g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len));
string->len -= len;
string->str[string->len] = 0;
return fstring;
}
GString*
g_string_down (GString *fstring)
{
GRealString *string = (GRealString*)fstring;
gchar *s;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
while (*s)
{
*s = tolower (*s);
s++;
}
return fstring;
}
GString*
g_string_up (GString *fstring)
{
GRealString *string = (GRealString*)fstring;
gchar *s;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
while (*s)
{
*s = toupper (*s);
s++;
}
return fstring;
}
static void
g_string_sprintfa_int (GString *string,
const gchar *fmt,
va_list args)
{
gchar *buffer;
buffer = g_strdup_vprintf (fmt, args);
g_string_append (string, buffer);
g_free (buffer);
}
void
g_string_sprintf (GString *string,
const gchar *fmt,
...)
{
va_list args;
g_string_truncate (string, 0);
va_start (args, fmt);
g_string_sprintfa_int (string, fmt, args);
va_end (args);
}
void
g_string_sprintfa (GString *string,
const gchar *fmt,
...)
{
va_list args;
va_start (args, fmt);
g_string_sprintfa_int (string, fmt, args);
va_end (args);
}

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1,69 +0,0 @@
1999-03-03 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-posix.c: Fixed broken mutex_trylock and slightly broken
cond_timed_wait functions.
1999-02-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* testgthread.c (test_mutexes): Use new signature of
g_static_mutex* functions.
1999-02-08 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-posix.c (g_private_get_posix_impl): Use the
HAVE_PTHREAD_GETSPECIFIC_POSIX macro to determine, which signature
to use for pthread_getspecific.
Tue Jan 19 20:56:02 1999 Tor Lillqvist <tml@iki.fi>
* Makefile.am (EXTRA_DIST): Added gthread.def.
Sun Jan 17 10:58:19 1999 Tor Lillqvist <tml@iki.fi>
* gthread.def: New file.
1999-01-16 1999 Tor Lillqvist <tml@iki.fi>
* gthread-posix.c: Conditionalize <sys/time.h> inclusion.
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* testgthread.c: conditionally compile according to the
G_THREADS_IMPL_??? macros.
(test_private_func): use rand_r instead of rand to make it
thread safe.
1998-12-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* testgthread.c (new_thread): As a joinable thread seems to be the
default on posix, leave the explicit setting out, as it causes
problems on some older platforms.
Wed Dec 16 22:21:33 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* gthread-posix.c: use g_free in mutex_free (from Tim Janik)
Thu Dec 17 03:38:57 1998 Tim Janik <timj@gtk.org>
* Makefile.am: -DG_LOG_DOMAIN="GThread", we don't need an extern
variable for that (noticed by Joel Becker <jlbec@ocala.cs.miami.edu>)
Wed Dec 16 03:16:16 1998 Tim Janik <timj@gtk.org>
* testgthread.c: s/g_thread_supported/g_thread_supported ()/
* gthread.c: s/g_thread_supported/g_threads_got_initialized/
(g_thread_init): bail out if G_THREADS_ENABLED is not defined.
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* Makefile.am (EXTRA_DIST): updated.
* testgthread.c, gthread-*.c: Changed private to private_key to
avoid problems when compiling with under C++.
* gthread-none.c:
s/g_mutex_functions_for_glib_use/g_thread_functions_for_glib_use/
* ChangeLog: from now on there is an extra ChangeLog for gthread

Просмотреть файл

@ -1,24 +0,0 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/gthread -DG_LOG_DOMAIN=\"GThread\"
EXTRA_DIST = \
gthread-posix.c \
gthread-solaris.c \
gthread-nspr.c \
gthread-none.c \
gthread.def
libglib = $(top_builddir)/libglib.la # -lglib
lib_LTLIBRARIES = libgthread.la
libgthread_la_SOURCES = gthread.c
libgthread_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
libgthread_la_LIBADD = @G_THREAD_LIBS@
noinst_PROGRAMS = testgthread
testgthread_LDADD = ../libglib.la libgthread.la

Просмотреть файл

@ -1,35 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gthread.c: fallback thread system implementation
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
static GThreadFunctions
g_thread_functions_for_glib_use_default; /* is NULLified */

Просмотреть файл

@ -1,225 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gthread.c: nspr thread system implementation
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <prpdce.h>
#include <prthread.h>
#include <stdlib.h>
#ifdef G_DISABLE_ASSERT
#define STDERR_ASSERT(expr)
#else /* G_DISABLE_ASSERT */
#define STDERR_ASSERT(expr) G_STMT_START{ \
if (!(expr)) \
g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_ERROR, \
"file %s: line %d: assertion failed: (%s)", \
__FILE__, \
__LINE__, \
#expr); }G_STMT_END
#endif /* G_DISABLE_ASSERT */
/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
functions from gmem.c and gmessages.c; */
static gboolean
g_mutex_trylock_nspr_impl (GMutex * mutex)
{
PRStatus status = PRP_TryLock ((PRLock *) mutex);
if (status == PR_SUCCESS)
{
return TRUE;
}
return FALSE;
}
static void
g_cond_wait_nspr_impl (GCond * cond,
GMutex * entered_mutex)
{
PRStatus status = PRP_NakedWait ((PRCondVar *) cond,
(PRLock *) entered_mutex,
PR_INTERVAL_NO_TIMEOUT);
g_assert (status == PR_SUCCESS);
}
#define G_MICROSEC 1000000
static gboolean
g_cond_timed_wait_nspr_impl (GCond * cond,
GMutex * entered_mutex,
GTimeVal * abs_time)
{
PRStatus status;
PRIntervalTime interval;
GTimeVal current_time;
glong microsecs;
g_return_val_if_fail (cond != NULL, FALSE);
g_return_val_if_fail (entered_mutex != NULL, FALSE);
g_get_current_time (&current_time);
if (abs_time->tv_sec < current_time.tv_sec ||
(abs_time->tv_sec == current_time.tv_sec &&
abs_time->tv_usec < current_time.tv_usec))
return FALSE;
interval = PR_SecondsToInterval (abs_time->tv_sec - current_time.tv_sec);
microsecs = abs_time->tv_usec - current_time.tv_usec;
if (microsecs < 0)
interval -= PR_MicrosecondsToInterval (-microsecs);
else
interval += PR_MicrosecondsToInterval (microsecs);
status = PRP_NakedWait ((PRCondVar *) cond, (PRLock *) entered_mutex,
interval);
g_assert (status == PR_SUCCESS);
g_get_current_time (&current_time);
if (abs_time->tv_sec < current_time.tv_sec ||
(abs_time->tv_sec == current_time.tv_sec &&
abs_time->tv_usec < current_time.tv_usec))
return FALSE;
return TRUE;
}
typedef struct _GPrivateNSPRData GPrivateNSPRData;
struct _GPrivateNSPRData
{
gpointer data;
GDestroyNotify destructor;
};
typedef struct _GPrivateNSPR GPrivateNSPR;
struct _GPrivateNSPR
{
PRUintn private_key;
GDestroyNotify destructor;
};
static GPrivateNSPRData *
g_private_nspr_data_constructor (GDestroyNotify destructor, gpointer data)
{
/* we can not use g_new and friends, as they might use private data by
themself */
GPrivateNSPRData *private_key = malloc (sizeof (GPrivateNSPRData));
g_assert (private_key);
private_key->data = data;
private_key->destructor = destructor;
return private_key;
}
static void
g_private_nspr_data_destructor (gpointer data)
{
GPrivateNSPRData *private_key = data;
if (private_key->destructor && private_key->data)
(*private_key->destructor) (private_key->data);
free (private_key);
}
static GPrivate *
g_private_new_nspr_impl (GDestroyNotify destructor)
{
GPrivateNSPR *result = g_new (GPrivateNSPR, 1);
PRStatus status = PR_NewThreadPrivateIndex (&result->private_key,
g_private_nspr_data_destructor);
g_assert (status == PR_SUCCESS);
result->destructor = destructor;
return (GPrivate *) result;
}
/* NOTE: the functions g_private_get and g_private_set may not use
functions from gmem.c and gmessages.c */
static GPrivateNSPRData *
g_private_nspr_data_get (GPrivateNSPR * private_key)
{
GPrivateNSPRData *data;
STDERR_ASSERT (private_key);
data = PR_GetThreadPrivate (private_key->private_key);
if (!data)
{
data = g_private_nspr_data_constructor (private_key->destructor, NULL);
STDERR_ASSERT (PR_SetThreadPrivate (private_key->private_key, data)
== PR_SUCCESS);
}
return data;
}
static void
g_private_set_nspr_impl (GPrivate * private_key, gpointer value)
{
if (!private_key)
return;
g_private_nspr_data_get ((GPrivateNSPR *) private_key)->data = value;
}
static gpointer
g_private_get_nspr_impl (GPrivate * private_key)
{
if (!private_key)
return NULL;
return g_private_nspr_data_get ((GPrivateNSPR *) private_key)->data;
}
static GThreadFunctions g_thread_functions_for_glib_use_default =
{
(GMutex * (*)())PR_NewLock,
(void (*)(GMutex *)) PR_Lock,
g_mutex_trylock_nspr_impl,
(void (*)(GMutex *)) PR_Unlock,
(void (*)(GMutex *)) PR_DestroyLock,
(GCond * (*)())PRP_NewNakedCondVar,
(void (*)(GCond *)) PRP_NakedNotify,
(void (*)(GCond *)) PRP_NakedBroadcast,
g_cond_wait_nspr_impl,
g_cond_timed_wait_nspr_impl,
(void (*)(GCond *)) PRP_DestroyNakedCondVar,
g_private_new_nspr_impl,
g_private_get_nspr_impl,
g_private_set_nspr_impl
};

Просмотреть файл

@ -1,200 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gthread.c: posix thread system implementation
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#define posix_print_error( name, num ) \
g_error( "file %s: line %d (%s): error %s during %s", \
__FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \
g_strerror((num)), #name )
#define posix_check_for_error( what ) G_STMT_START{ \
int error = (what); \
if( error ) { posix_print_error( what, error ); } \
}G_STMT_END
static GMutex *
g_mutex_new_posix_impl (void)
{
GMutex *result = (GMutex *) g_new (pthread_mutex_t, 1);
posix_check_for_error (pthread_mutex_init ((pthread_mutex_t *) result, NULL));
return result;
}
static void
g_mutex_free_posix_impl (GMutex * mutex)
{
posix_check_for_error (pthread_mutex_destroy ((pthread_mutex_t *) mutex));
g_free (mutex);
}
/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
functions from gmem.c and gmessages.c; */
/* pthread_mutex_lock, pthread_mutex_unlock can be taken directly, as
signature and semantic are right, but without error check then!!!!,
we might want to change this therefore. */
static gboolean
g_mutex_trylock_posix_impl (GMutex * mutex)
{
int result;
result = pthread_mutex_trylock ((pthread_mutex_t *) mutex);
#ifdef HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX
if (result == EBUSY)
return FALSE;
posix_check_for_error (result);
#else
if (result == 0)
return FALSE;
#endif
return TRUE;
}
static GCond *
g_cond_new_posix_impl (void)
{
GCond *result = (GCond *) g_new (pthread_cond_t, 1);
posix_check_for_error (pthread_cond_init ((pthread_cond_t *) result, NULL));
return result;
}
/* pthread_cond_signal, pthread_cond_broadcast and pthread_cond_wait
can be taken directly, as signature and semantic are right, but
without error check then!!!!, we might want to change this
therfore. */
#define G_MICROSEC 1000000
#define G_NANOSEC 1000000000
static gboolean
g_cond_timed_wait_posix_impl (GCond * cond,
GMutex * entered_mutex,
GTimeVal * abs_time)
{
int result;
struct timespec end_time;
gboolean timed_out;
g_return_val_if_fail (cond != NULL, FALSE);
g_return_val_if_fail (entered_mutex != NULL, FALSE);
if (!abs_time)
{
g_cond_wait (cond, entered_mutex);
return TRUE;
}
end_time.tv_sec = abs_time->tv_sec;
end_time.tv_nsec = abs_time->tv_usec * (G_NANOSEC / G_MICROSEC);
g_assert (end_time.tv_nsec < G_NANOSEC);
result = pthread_cond_timedwait ((pthread_cond_t *) cond,
(pthread_mutex_t *) entered_mutex,
&end_time);
#ifdef HAVE_PTHREAD_COND_TIMEDWAIT_POSIX
timed_out = (result == ETIMEDOUT);
#else
timed_out = (result == -1 && errno == EAGAIN);
#endif
if (!timed_out)
posix_check_for_error (result);
return !timed_out;
}
static void
g_cond_free_posix_impl (GCond * cond)
{
posix_check_for_error (pthread_cond_destroy ((pthread_cond_t *) cond));
g_free (cond);
}
static GPrivate *
g_private_new_posix_impl (GDestroyNotify destructor)
{
GPrivate *result = (GPrivate *) g_new (pthread_key_t, 1);
posix_check_for_error (pthread_key_create ((pthread_key_t *) result,
destructor));
return result;
}
/* NOTE: the functions g_private_get and g_private_set may not use
functions from gmem.c and gmessages.c */
static void
g_private_set_posix_impl (GPrivate * private_key, gpointer value)
{
if (!private_key)
return;
pthread_setspecific (*(pthread_key_t *) private_key, value);
}
static gpointer
g_private_get_posix_impl (GPrivate * private_key)
{
if (!private_key)
return NULL;
#ifdef HAVE_PTHREAD_GETSPECIFIC_POSIX
return pthread_getspecific (*(pthread_key_t *) private_key);
#else /* HAVE_PTHREAD_GETSPECIFIC_POSIX */
{
void* data;
pthread_getspecific (*(pthread_key_t *) private_key, &data);
return data;
}
#endif /* HAVE_PTHREAD_GETSPECIFIC_POSIX */
}
static GThreadFunctions g_thread_functions_for_glib_use_default =
{
g_mutex_new_posix_impl,
(void (*)(GMutex *)) pthread_mutex_lock,
g_mutex_trylock_posix_impl,
(void (*)(GMutex *)) pthread_mutex_unlock,
g_mutex_free_posix_impl,
g_cond_new_posix_impl,
(void (*)(GCond *)) pthread_cond_signal,
(void (*)(GCond *)) pthread_cond_broadcast,
(void (*)(GCond *, GMutex *)) pthread_cond_wait,
g_cond_timed_wait_posix_impl,
g_cond_free_posix_impl,
g_private_new_posix_impl,
g_private_get_posix_impl,
g_private_set_posix_impl
};

Просмотреть файл

@ -1,184 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gthread.c: solaris thread system implementation
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include <thread.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#define solaris_print_error( name, num ) \
g_error( "file %s: line %d (%s): error %s during %s", \
__FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \
g_strerror((num)), #name )
#define solaris_check_for_error( what ) G_STMT_START{ \
int error = (what); \
if( error ) { solaris_print_error( what, error ); } \
}G_STMT_END
static GMutex *
g_mutex_new_solaris_impl (void)
{
GMutex *result = (GMutex *) g_new (mutex_t, 1);
solaris_check_for_error (mutex_init ((mutex_t *) result, USYNC_PROCESS, 0));
return result;
}
static void
g_mutex_free_solaris_impl (GMutex * mutex)
{
solaris_check_for_error (mutex_destroy ((mutex_t *) mutex));
free (mutex);
}
/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
functions from gmem.c and gmessages.c; */
/* mutex_lock, mutex_unlock can be taken directly, as
signature and semantic are right, but without error check then!!!!,
we might want to change this therefore. */
static gboolean
g_mutex_trylock_solaris_impl (GMutex * mutex)
{
int result;
result = mutex_trylock ((mutex_t *) mutex);
if (result == EBUSY)
return FALSE;
solaris_check_for_error (result);
return TRUE;
}
static GCond *
g_cond_new_solaris_impl ()
{
GCond *result = (GCond *) g_new (cond_t, 1);
solaris_check_for_error (cond_init ((cond_t *) result, USYNC_THREAD, 0));
return result;
}
/* cond_signal, cond_broadcast and cond_wait
can be taken directly, as signature and semantic are right, but
without error check then!!!!, we might want to change this
therfore. */
#define G_MICROSEC 1000000
#define G_NANOSEC 1000000000
static gboolean
g_cond_timed_wait_solaris_impl (GCond * cond,
GMutex * entered_mutex,
GTimeVal * abs_time)
{
int result;
timestruc_t end_time;
gboolean timed_out;
g_return_val_if_fail (cond != NULL, FALSE);
g_return_val_if_fail (entered_mutex != NULL, FALSE);
if (!abs_time)
{
g_cond_wait (cond, entered_mutex);
return TRUE;
}
end_time.tv_sec = abs_time->tv_sec;
end_time.tv_nsec = abs_time->tv_usec * (G_NANOSEC / G_MICROSEC);
g_assert (end_time.tv_nsec < G_NANOSEC);
result = cond_timedwait ((cond_t *) cond, (mutex_t *) entered_mutex,
&end_time);
timed_out = (result == ETIME);
if (!timed_out)
solaris_check_for_error (result);
return !timed_out;
}
static void
g_cond_free_solaris_impl (GCond * cond)
{
solaris_check_for_error (cond_destroy ((cond_t *) cond));
g_free (cond);
}
static GPrivate *
g_private_new_solaris_impl (GDestroyNotify destructor)
{
GPrivate *result = (GPrivate *) g_new (thread_key_t,1);
solaris_check_for_error (thr_keycreate ((thread_key_t *) result,
destructor));
return result;
}
/* NOTE: the functions g_private_get and g_private_set may not use
functions from gmem.c and gmessages.c */
static void
g_private_set_solaris_impl (GPrivate * private_key, gpointer value)
{
if (!private_key)
return;
thr_setspecific (*(thread_key_t *) private_key, value);
}
static gpointer
g_private_get_solaris_impl (GPrivate * private_key)
{
gpointer result;
if (!private_key)
return NULL;
thr_getspecific (*(thread_key_t *) private_key, &result);
return result;
}
static GThreadFunctions g_thread_functions_for_glib_use_default =
{
g_mutex_new_solaris_impl,
(void (*)(GMutex *)) mutex_lock,
g_mutex_trylock_solaris_impl,
(void (*)(GMutex *)) mutex_unlock,
g_mutex_free_solaris_impl,
g_cond_new_solaris_impl,
(void (*)(GCond *)) cond_signal,
(void (*)(GCond *)) cond_broadcast,
(void (*)(GCond *, GMutex *)) cond_wait,
g_cond_timed_wait_solaris_impl,
g_cond_free_solaris_impl,
g_private_new_solaris_impl,
g_private_get_solaris_impl,
g_private_set_solaris_impl
};

Просмотреть файл

@ -1,110 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* gthread.c: thread related functions
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
static gboolean thread_system_already_initialized = FALSE;
#include G_THREAD_SOURCE
void g_mutex_init (void);
void g_mem_init (void);
void g_messages_init (void);
void
g_thread_init (GThreadFunctions* init)
{
gboolean supported;
#ifndef G_THREADS_ENABLED
g_error ("GLib thread support is disabled.");
#endif /* !G_THREADS_ENABLED */
if (thread_system_already_initialized)
g_error ("GThread system may only be initialized once.");
thread_system_already_initialized = TRUE;
if (init == NULL)
init = &g_thread_functions_for_glib_use_default;
else
g_thread_use_default_impl = FALSE;
g_thread_functions_for_glib_use = *init;
/* It is important, that g_threads_got_initialized is not set before the
* thread initialization functions of the different modules are called
*/
supported = (init->mutex_new &&
init->mutex_lock &&
init->mutex_trylock &&
init->mutex_unlock &&
init->mutex_free &&
init->cond_new &&
init->cond_signal &&
init->cond_broadcast &&
init->cond_wait &&
init->cond_timed_wait &&
init->cond_free &&
init->private_new &&
init->private_get &&
init->private_get);
/* if somebody is calling g_thread_init (), it means that he wants to
* have thread support, so check this
*/
if (!supported)
{
if (g_thread_use_default_impl)
g_error ("Threads are not supported on this platform.");
else
g_error ("The supplied thread function vector is invalid.");
}
/* now call the thread initialization functions of the different
* glib modules. order does matter, g_mutex_init MUST come first.
*/
g_mutex_init ();
g_mem_init ();
g_messages_init ();
/* now we can set g_threads_got_initialized and thus enable
* all the thread functions
*/
g_threads_got_initialized = TRUE;
}

Просмотреть файл

@ -1,2 +0,0 @@
EXPORTS
g_thread_init

Просмотреть файл

@ -1,217 +0,0 @@
#include "config.h"
#include <stdlib.h>
#define main testglib_main
#include <testglib.c>
#undef main
#define TEST_PRIVATE_THREADS 9
#define TEST_PRIVATE_ROUNDS 5
void
test_mutexes (void)
{
GMutex *mutex = NULL;
GCond *cond = NULL;
GStaticMutex static_mutex = G_STATIC_MUTEX_INIT;
G_LOCK_DEFINE (test_me);
if (g_thread_supported ())
{
mutex = g_mutex_new ();
cond = g_cond_new ();
}
g_mutex_lock (mutex);
g_mutex_unlock (mutex);
g_static_mutex_lock (&static_mutex);
g_static_mutex_unlock (&static_mutex);
g_cond_signal (cond);
g_cond_broadcast (cond);
G_LOCK (test_me);
G_UNLOCK (test_me);
if (g_thread_supported ())
{
g_cond_free (cond);
g_mutex_free (mutex);
}
}
#if defined(G_THREADS_IMPL_NSPR)
#warning "note, that you have to link with whatever library"
#warning "nspr is building upon, it might otherwise (as on solaris) lead to"
#warning "run time failure, as the mutex functions are defined in libc, but"
#warning "as noops, that will make some nspr assertions fail."
#include <prthread.h>
gpointer
new_thread (GHookFunc func, gpointer data)
{
PRThread *thread = PR_CreateThread (PR_SYSTEM_THREAD, func, data,
PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
PR_JOINABLE_THREAD, 0);
return thread;
}
#define join_thread(thread) PR_JoinThread (thread)
#define self_thread() PR_GetCurrentThread ()
#elif defined(G_THREADS_IMPL_SOLARIS)
#include <thread.h>
gpointer
new_thread (GHookFunc func, gpointer data)
{
thread_t thread;
thr_create (NULL, 0, (void *(*)(void *)) func, data, THR_BOUND, &thread);
return GUINT_TO_POINTER (thread);
}
#define join_thread(thread) \
thr_join ((thread_t)GPOINTER_TO_UINT (thread), NULL, NULL)
#define self_thread() GUINT_TO_POINTER (thr_self ())
#elif defined(G_THREADS_IMPL_POSIX)
#include <pthread.h>
gpointer
new_thread(GHookFunc func, gpointer data)
{
pthread_t thread;
pthread_attr_t pthread_attr;
pthread_attr_init (&pthread_attr);
/* This is the default, it seems, so leave that out for now
pthread_attr_setdetachstate (&pthread_attr, PTHREAD_CREATE_JOINABLE);
*/
pthread_create (&thread, &pthread_attr, (void *(*)(void *)) func, data);
return GUINT_TO_POINTER (thread);
}
#define join_thread(thread) \
pthread_join ((pthread_t)GPOINTER_TO_UINT (thread), NULL)
#define self_thread() GUINT_TO_POINTER (pthread_self ())
#else /* we are not having a thread implementation, do nothing */
#define new_thread(func,data) (NULL)
#define join_thread(thread) ((void)0)
#define self_thread() NULL
#endif
#define G_MICROSEC 1000000
void
wait_thread (double seconds)
{
GMutex *mutex;
GCond *cond;
GTimeVal current_time;
g_get_current_time (&current_time);
mutex = g_mutex_new ();
cond = g_cond_new ();
current_time.tv_sec += (guint) seconds;
seconds -= (guint) seconds;
current_time.tv_usec += (guint) (seconds * G_MICROSEC);
while (current_time.tv_usec >= G_MICROSEC)
{
current_time.tv_usec -= G_MICROSEC;
current_time.tv_sec++;
}
g_mutex_lock (mutex);
g_cond_timed_wait (cond, mutex, &current_time);
g_mutex_unlock (mutex);
g_mutex_free (mutex);
g_cond_free (cond);
}
gpointer
private_constructor (void)
{
gpointer *result = g_new (gpointer, 2);
result[0] = 0;
result[1] = self_thread ();
g_print ("allocating data for the thread %p.\n", result[1]);
return result;
}
void
private_destructor (gpointer data)
{
gpointer *real = data;
g_print ("freeing data for the thread %p.\n", real[1]);
g_free (real);
}
GStaticPrivate private_key;
void
test_private_func (void *data)
{
guint i = 0;
static unsigned int seed = 0;
if (!seed)
{
GTimeVal now;
g_get_current_time (&now);
seed = now.tv_usec;
}
wait_thread (1);
while (i < TEST_PRIVATE_ROUNDS)
{
#ifdef HAVE_RAND_R
guint random_value = rand_r (&seed) % 10000;
#else
guint random_value = rand() % 10000;
#endif
guint *data = g_static_private_get (&private_key);
if (!data)
{
data = private_constructor ();
g_static_private_set (&private_key, data, private_destructor);
}
*data = random_value;
wait_thread (.2);
g_assert (*(guint *) g_static_private_get (&private_key) == random_value);
i++;
}
}
void
test_private (void)
{
int i;
gpointer threads[TEST_PRIVATE_THREADS];
for (i = 0; i < TEST_PRIVATE_THREADS; i++)
{
threads[i] = new_thread (test_private_func, GINT_TO_POINTER(i));
}
for (i = 0; i < TEST_PRIVATE_THREADS; i++)
{
join_thread (threads[i]);
}
g_print ("\n");
}
int
main (void)
{
test_mutexes ();
g_thread_init (NULL);
test_mutexes ();
test_private ();
/* later we might want to start n copies of that */
testglib_main (0, NULL);
return 0;
}

Просмотреть файл

@ -1,193 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glib.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifndef NATIVE_WIN32
#include <sys/time.h>
#endif /* NATIVE_WIN32 */
#ifdef NATIVE_WIN32
#include <windows.h>
#endif /* NATIVE_WIN32 */
typedef struct _GRealTimer GRealTimer;
struct _GRealTimer
{
#ifdef NATIVE_WIN32
DWORD start;
DWORD end;
#else /* !NATIVE_WIN32 */
struct timeval start;
struct timeval end;
#endif /* !NATIVE_WIN32 */
guint active : 1;
};
GTimer*
g_timer_new (void)
{
GRealTimer *timer;
timer = g_new (GRealTimer, 1);
timer->active = TRUE;
#ifdef NATIVE_WIN32
timer->start = GetTickCount ();
#else /* !NATIVE_WIN32 */
gettimeofday (&timer->start, NULL);
#endif /* !NATIVE_WIN32 */
return ((GTimer*) timer);
}
void
g_timer_destroy (GTimer *timer)
{
g_return_if_fail (timer != NULL);
g_free (timer);
}
void
g_timer_start (GTimer *timer)
{
GRealTimer *rtimer;
g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = TRUE;
#ifdef NATIVE_WIN32
rtimer->start = GetTickCount ();
#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
#endif /* !NATIVE_WIN32 */
}
void
g_timer_stop (GTimer *timer)
{
GRealTimer *rtimer;
g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = FALSE;
#ifdef NATIVE_WIN32
rtimer->end = GetTickCount ();
#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->end, NULL);
#endif /* !NATIVE_WIN32 */
}
void
g_timer_reset (GTimer *timer)
{
GRealTimer *rtimer;
g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
#ifdef NATIVE_WIN32
rtimer->start = GetTickCount ();
#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
#endif /* !NATIVE_WIN32 */
}
gdouble
g_timer_elapsed (GTimer *timer,
gulong *microseconds)
{
GRealTimer *rtimer;
gdouble total;
#ifndef NATIVE_WIN32
struct timeval elapsed;
#endif /* NATIVE_WIN32 */
g_return_val_if_fail (timer != NULL, 0);
rtimer = (GRealTimer*) timer;
#ifdef NATIVE_WIN32
if (rtimer->active)
rtimer->end = GetTickCount ();
/* Check for wraparound, which happens every 49.7 days.
* No, Win95 machines probably are never running for that long,
* but NT machines are.
*/
if (rtimer->end < rtimer->start)
total = (UINT_MAX - (rtimer->start - rtimer->end)) / 1000.0;
else
total = (rtimer->end - rtimer->start) / 1000.0;
if (microseconds)
{
if (rtimer->end < rtimer->start)
*microseconds =
((UINT_MAX - (rtimer->start - rtimer->end)) % 1000) * 1000;
else
*microseconds =
((rtimer->end - rtimer->start) % 1000) * 1000;
}
#else /* !NATIVE_WIN32 */
if (rtimer->active)
gettimeofday (&rtimer->end, NULL);
if (rtimer->start.tv_usec > rtimer->end.tv_usec)
{
rtimer->end.tv_usec += 1000000;
rtimer->end.tv_sec--;
}
elapsed.tv_usec = rtimer->end.tv_usec - rtimer->start.tv_usec;
elapsed.tv_sec = rtimer->end.tv_sec - rtimer->start.tv_sec;
total = elapsed.tv_sec + ((gdouble) elapsed.tv_usec / 1e6);
if (microseconds)
*microseconds = elapsed.tv_usec;
#endif /* !NATIVE_WIN32 */
return total;
}

Просмотреть файл

@ -1,746 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe
*/
#include "glib.h"
typedef struct _GRealTree GRealTree;
typedef struct _GTreeNode GTreeNode;
struct _GRealTree
{
GTreeNode *root;
GCompareFunc key_compare;
};
struct _GTreeNode
{
gint balance; /* height (left) - height (right) */
GTreeNode *left; /* left subtree */
GTreeNode *right; /* right subtree */
gpointer key; /* key for this node */
gpointer value; /* value stored at this node */
};
static GTreeNode* g_tree_node_new (gpointer key,
gpointer value);
static void g_tree_node_destroy (GTreeNode *node);
static GTreeNode* g_tree_node_insert (GTreeNode *node,
GCompareFunc compare,
gpointer key,
gpointer value,
gint *inserted);
static GTreeNode* g_tree_node_remove (GTreeNode *node,
GCompareFunc compare,
gpointer key);
static GTreeNode* g_tree_node_balance (GTreeNode *node);
static GTreeNode* g_tree_node_remove_leftmost (GTreeNode *node,
GTreeNode **leftmost);
static GTreeNode* g_tree_node_restore_left_balance (GTreeNode *node,
gint old_balance);
static GTreeNode* g_tree_node_restore_right_balance (GTreeNode *node,
gint old_balance);
static gpointer g_tree_node_lookup (GTreeNode *node,
GCompareFunc compare,
gpointer key);
static gint g_tree_node_count (GTreeNode *node);
static gint g_tree_node_pre_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data);
static gint g_tree_node_in_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data);
static gint g_tree_node_post_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data);
static gpointer g_tree_node_search (GTreeNode *node,
GSearchFunc search_func,
gpointer data);
static gint g_tree_node_height (GTreeNode *node);
static GTreeNode* g_tree_node_rotate_left (GTreeNode *node);
static GTreeNode* g_tree_node_rotate_right (GTreeNode *node);
static void g_tree_node_check (GTreeNode *node);
G_LOCK_DEFINE_STATIC (g_tree_global);
static GMemChunk *node_mem_chunk = NULL;
static GTreeNode *node_free_list = NULL;
static GTreeNode*
g_tree_node_new (gpointer key,
gpointer value)
{
GTreeNode *node;
G_LOCK (g_tree_global);
if (node_free_list)
{
node = node_free_list;
node_free_list = node->right;
}
else
{
if (!node_mem_chunk)
node_mem_chunk = g_mem_chunk_new ("GLib GTreeNode mem chunk",
sizeof (GTreeNode),
1024,
G_ALLOC_ONLY);
node = g_chunk_new (GTreeNode, node_mem_chunk);
}
G_UNLOCK (g_tree_global);
node->balance = 0;
node->left = NULL;
node->right = NULL;
node->key = key;
node->value = value;
return node;
}
static void
g_tree_node_destroy (GTreeNode *node)
{
if (node)
{
g_tree_node_destroy (node->right);
g_tree_node_destroy (node->left);
G_LOCK (g_tree_global);
node->right = node_free_list;
node_free_list = node;
G_UNLOCK (g_tree_global);
}
}
GTree*
g_tree_new (GCompareFunc key_compare_func)
{
GRealTree *rtree;
g_return_val_if_fail (key_compare_func != NULL, NULL);
rtree = g_new (GRealTree, 1);
rtree->root = NULL;
rtree->key_compare = key_compare_func;
return (GTree*) rtree;
}
void
g_tree_destroy (GTree *tree)
{
GRealTree *rtree;
g_return_if_fail (tree != NULL);
rtree = (GRealTree*) tree;
g_tree_node_destroy (rtree->root);
g_free (rtree);
}
void
g_tree_insert (GTree *tree,
gpointer key,
gpointer value)
{
GRealTree *rtree;
gint inserted;
g_return_if_fail (tree != NULL);
rtree = (GRealTree*) tree;
inserted = FALSE;
rtree->root = g_tree_node_insert (rtree->root, rtree->key_compare,
key, value, &inserted);
}
void
g_tree_remove (GTree *tree,
gpointer key)
{
GRealTree *rtree;
g_return_if_fail (tree != NULL);
rtree = (GRealTree*) tree;
rtree->root = g_tree_node_remove (rtree->root, rtree->key_compare, key);
}
gpointer
g_tree_lookup (GTree *tree,
gpointer key)
{
GRealTree *rtree;
g_return_val_if_fail (tree != NULL, NULL);
rtree = (GRealTree*) tree;
return g_tree_node_lookup (rtree->root, rtree->key_compare, key);
}
void
g_tree_traverse (GTree *tree,
GTraverseFunc traverse_func,
GTraverseType traverse_type,
gpointer data)
{
GRealTree *rtree;
g_return_if_fail (tree != NULL);
rtree = (GRealTree*) tree;
if (!rtree->root)
return;
switch (traverse_type)
{
case G_PRE_ORDER:
g_tree_node_pre_order (rtree->root, traverse_func, data);
break;
case G_IN_ORDER:
g_tree_node_in_order (rtree->root, traverse_func, data);
break;
case G_POST_ORDER:
g_tree_node_post_order (rtree->root, traverse_func, data);
break;
case G_LEVEL_ORDER:
g_warning ("g_tree_traverse(): traverse type G_LEVEL_ORDER isn't implemented.");
break;
}
}
gpointer
g_tree_search (GTree *tree,
GSearchFunc search_func,
gpointer data)
{
GRealTree *rtree;
g_return_val_if_fail (tree != NULL, NULL);
rtree = (GRealTree*) tree;
if (rtree->root)
return g_tree_node_search (rtree->root, search_func, data);
else
return NULL;
}
gint
g_tree_height (GTree *tree)
{
GRealTree *rtree;
g_return_val_if_fail (tree != NULL, 0);
rtree = (GRealTree*) tree;
if (rtree->root)
return g_tree_node_height (rtree->root);
else
return 0;
}
gint
g_tree_nnodes (GTree *tree)
{
GRealTree *rtree;
g_return_val_if_fail (tree != NULL, 0);
rtree = (GRealTree*) tree;
if (rtree->root)
return g_tree_node_count (rtree->root);
else
return 0;
}
static GTreeNode*
g_tree_node_insert (GTreeNode *node,
GCompareFunc compare,
gpointer key,
gpointer value,
gint *inserted)
{
gint old_balance;
gint cmp;
if (!node)
{
*inserted = TRUE;
return g_tree_node_new (key, value);
}
cmp = (* compare) (key, node->key);
if (cmp == 0)
{
*inserted = FALSE;
node->value = value;
return node;
}
if (cmp < 0)
{
if (node->left)
{
old_balance = node->left->balance;
node->left = g_tree_node_insert (node->left, compare, key, value, inserted);
if ((old_balance != node->left->balance) && node->left->balance)
node->balance -= 1;
}
else
{
*inserted = TRUE;
node->left = g_tree_node_new (key, value);
node->balance -= 1;
}
}
else if (cmp > 0)
{
if (node->right)
{
old_balance = node->right->balance;
node->right = g_tree_node_insert (node->right, compare, key, value, inserted);
if ((old_balance != node->right->balance) && node->right->balance)
node->balance += 1;
}
else
{
*inserted = TRUE;
node->right = g_tree_node_new (key, value);
node->balance += 1;
}
}
if (*inserted)
{
if ((node->balance < -1) || (node->balance > 1))
node = g_tree_node_balance (node);
}
return node;
}
static GTreeNode*
g_tree_node_remove (GTreeNode *node,
GCompareFunc compare,
gpointer key)
{
GTreeNode *new_root;
gint old_balance;
gint cmp;
if (!node)
return NULL;
cmp = (* compare) (key, node->key);
if (cmp == 0)
{
GTreeNode *garbage;
garbage = node;
if (!node->right)
{
node = node->left;
}
else
{
old_balance = node->right->balance;
node->right = g_tree_node_remove_leftmost (node->right, &new_root);
new_root->left = node->left;
new_root->right = node->right;
new_root->balance = node->balance;
node = g_tree_node_restore_right_balance (new_root, old_balance);
}
G_LOCK (g_tree_global);
garbage->right = node_free_list;
node_free_list = garbage;
G_UNLOCK (g_tree_global);
}
else if (cmp < 0)
{
if (node->left)
{
old_balance = node->left->balance;
node->left = g_tree_node_remove (node->left, compare, key);
node = g_tree_node_restore_left_balance (node, old_balance);
}
}
else if (cmp > 0)
{
if (node->right)
{
old_balance = node->right->balance;
node->right = g_tree_node_remove (node->right, compare, key);
node = g_tree_node_restore_right_balance (node, old_balance);
}
}
return node;
}
static GTreeNode*
g_tree_node_balance (GTreeNode *node)
{
if (node->balance < -1)
{
if (node->left->balance > 0)
node->left = g_tree_node_rotate_left (node->left);
node = g_tree_node_rotate_right (node);
}
else if (node->balance > 1)
{
if (node->right->balance < 0)
node->right = g_tree_node_rotate_right (node->right);
node = g_tree_node_rotate_left (node);
}
return node;
}
static GTreeNode*
g_tree_node_remove_leftmost (GTreeNode *node,
GTreeNode **leftmost)
{
gint old_balance;
if (!node->left)
{
*leftmost = node;
return node->right;
}
old_balance = node->left->balance;
node->left = g_tree_node_remove_leftmost (node->left, leftmost);
return g_tree_node_restore_left_balance (node, old_balance);
}
static GTreeNode*
g_tree_node_restore_left_balance (GTreeNode *node,
gint old_balance)
{
if (!node->left)
node->balance += 1;
else if ((node->left->balance != old_balance) &&
(node->left->balance == 0))
node->balance += 1;
if (node->balance > 1)
return g_tree_node_balance (node);
return node;
}
static GTreeNode*
g_tree_node_restore_right_balance (GTreeNode *node,
gint old_balance)
{
if (!node->right)
node->balance -= 1;
else if ((node->right->balance != old_balance) &&
(node->right->balance == 0))
node->balance -= 1;
if (node->balance < -1)
return g_tree_node_balance (node);
return node;
}
static gpointer
g_tree_node_lookup (GTreeNode *node,
GCompareFunc compare,
gpointer key)
{
gint cmp;
if (!node)
return NULL;
cmp = (* compare) (key, node->key);
if (cmp == 0)
return node->value;
if (cmp < 0)
{
if (node->left)
return g_tree_node_lookup (node->left, compare, key);
}
else if (cmp > 0)
{
if (node->right)
return g_tree_node_lookup (node->right, compare, key);
}
return NULL;
}
static gint
g_tree_node_count (GTreeNode *node)
{
gint count;
count = 1;
if (node->left)
count += g_tree_node_count (node->left);
if (node->right)
count += g_tree_node_count (node->right);
return count;
}
static gint
g_tree_node_pre_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data)
{
if ((*traverse_func) (node->key, node->value, data))
return TRUE;
if (node->left)
{
if (g_tree_node_pre_order (node->left, traverse_func, data))
return TRUE;
}
if (node->right)
{
if (g_tree_node_pre_order (node->right, traverse_func, data))
return TRUE;
}
return FALSE;
}
static gint
g_tree_node_in_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data)
{
if (node->left)
{
if (g_tree_node_in_order (node->left, traverse_func, data))
return TRUE;
}
if ((*traverse_func) (node->key, node->value, data))
return TRUE;
if (node->right)
{
if (g_tree_node_in_order (node->right, traverse_func, data))
return TRUE;
}
return FALSE;
}
static gint
g_tree_node_post_order (GTreeNode *node,
GTraverseFunc traverse_func,
gpointer data)
{
if (node->left)
{
if (g_tree_node_post_order (node->left, traverse_func, data))
return TRUE;
}
if (node->right)
{
if (g_tree_node_post_order (node->right, traverse_func, data))
return TRUE;
}
if ((*traverse_func) (node->key, node->value, data))
return TRUE;
return FALSE;
}
static gpointer
g_tree_node_search (GTreeNode *node,
GSearchFunc search_func,
gpointer data)
{
gint dir;
if (!node)
return NULL;
do {
dir = (* search_func) (node->key, data);
if (dir == 0)
return node->value;
if (dir < 0)
node = node->left;
else if (dir > 0)
node = node->right;
} while (node && (dir != 0));
return NULL;
}
static gint
g_tree_node_height (GTreeNode *node)
{
gint left_height;
gint right_height;
if (node)
{
left_height = 0;
right_height = 0;
if (node->left)
left_height = g_tree_node_height (node->left);
if (node->right)
right_height = g_tree_node_height (node->right);
return MAX (left_height, right_height) + 1;
}
return 0;
}
static GTreeNode*
g_tree_node_rotate_left (GTreeNode *node)
{
GTreeNode *left;
GTreeNode *right;
gint a_bal;
gint b_bal;
left = node->left;
right = node->right;
node->right = right->left;
right->left = node;
a_bal = node->balance;
b_bal = right->balance;
if (b_bal <= 0)
{
if (a_bal >= 1)
right->balance = b_bal - 1;
else
right->balance = a_bal + b_bal - 2;
node->balance = a_bal - 1;
}
else
{
if (a_bal <= b_bal)
right->balance = a_bal - 2;
else
right->balance = b_bal - 1;
node->balance = a_bal - b_bal - 1;
}
return right;
}
static GTreeNode*
g_tree_node_rotate_right (GTreeNode *node)
{
GTreeNode *left;
GTreeNode *right;
gint a_bal;
gint b_bal;
left = node->left;
right = node->right;
node->left = left->right;
left->right = node;
a_bal = node->balance;
b_bal = left->balance;
if (b_bal <= 0)
{
if (b_bal > a_bal)
left->balance = b_bal + 1;
else
left->balance = a_bal + 2;
node->balance = a_bal - b_bal + 1;
}
else
{
if (a_bal <= -1)
left->balance = b_bal + 1;
else
left->balance = a_bal + b_bal + 2;
node->balance = a_bal + 1;
}
return left;
}
static void
g_tree_node_check (GTreeNode *node)
{
gint left_height;
gint right_height;
gint balance;
if (node)
{
left_height = 0;
right_height = 0;
if (node->left)
left_height = g_tree_node_height (node->left);
if (node->right)
right_height = g_tree_node_height (node->right);
balance = right_height - left_height;
if (balance != node->balance)
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
"g_tree_node_check: failed: %d ( %d )\n",
balance, node->balance);
if (node->left)
g_tree_node_check (node->left);
if (node->right)
g_tree_node_check (node->right);
}
}

Просмотреть файл

@ -1,900 +0,0 @@
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* MT safe for the unix part, FIXME: make the win32 part MT safe as well.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glibconfig.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifndef XP_MAC
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#endif /* XP_MAC */
#ifdef XP_MAC
#include <unistd.h>
#endif /* XP_MAC */
#ifdef NATIVE_WIN32
# define STRICT /* Strict typing, please */
# include <windows.h>
# include <direct.h>
# include <errno.h>
# include <ctype.h>
# ifdef _MSC_VER
# include <io.h>
# endif /* _MSC_VER */
#endif /* NATIVE_WIN32 */
/* implement Glib's inline functions
*/
#define G_INLINE_FUNC extern
#define G_CAN_INLINE 1
#include "glib.h"
#ifdef MAXPATHLEN
#define G_PATH_LENGTH (MAXPATHLEN + 1)
#elif defined (PATH_MAX)
#define G_PATH_LENGTH (PATH_MAX + 1)
#else /* !MAXPATHLEN */
#define G_PATH_LENGTH (2048 + 1)
#endif /* !MAXPATHLEN && !PATH_MAX */
const guint glib_major_version = GLIB_MAJOR_VERSION;
const guint glib_minor_version = GLIB_MINOR_VERSION;
const guint glib_micro_version = GLIB_MICRO_VERSION;
const guint glib_interface_age = GLIB_INTERFACE_AGE;
const guint glib_binary_age = GLIB_BINARY_AGE;
#if defined (NATIVE_WIN32) && defined (__LCC__)
int __stdcall
LibMain (void *hinstDll,
unsigned long dwReason,
void *reserved)
{
return 1;
}
#endif /* NATIVE_WIN32 && __LCC__ */
void
g_atexit (GVoidFunc func)
{
gint result;
gchar *error = NULL;
/* keep this in sync with glib.h */
#ifdef G_NATIVE_ATEXIT
result = ATEXIT (func);
if (result)
error = g_strerror (errno);
#elif defined (HAVE_ATEXIT)
# ifdef NeXT /* @#%@! NeXTStep */
result = !atexit ((void (*)(void)) func);
if (result)
error = g_strerror (errno);
# else
result = atexit ((void (*)(void)) func);
if (result)
error = g_strerror (errno);
# endif /* NeXT */
#elif defined (HAVE_ON_EXIT)
result = on_exit ((void (*)(int, void *)) func, NULL);
if (result)
error = g_strerror (errno);
#else
result = 0;
error = "no implementation";
#endif /* G_NATIVE_ATEXIT */
if (error)
g_error ("Could not register atexit() function: %s", error);
}
gint
g_snprintf (gchar *str,
gulong n,
gchar const *fmt,
...)
{
#ifdef HAVE_VSNPRINTF
va_list args;
gint retval;
va_start (args, fmt);
retval = vsnprintf (str, n, fmt, args);
va_end (args);
return retval;
#else /* !HAVE_VSNPRINTF */
gchar *printed;
va_list args;
va_start (args, fmt);
printed = g_strdup_vprintf (fmt, args);
va_end (args);
strncpy (str, printed, n);
str[n-1] = '\0';
g_free (printed);
return strlen (str);
#endif /* !HAVE_VSNPRINTF */
}
gint
g_vsnprintf (gchar *str,
gulong n,
gchar const *fmt,
va_list args)
{
#ifdef HAVE_VSNPRINTF
gint retval;
retval = vsnprintf (str, n, fmt, args);
return retval;
#else /* !HAVE_VSNPRINTF */
gchar *printed;
printed = g_strdup_vprintf (fmt, args);
strncpy (str, printed, n);
str[n-1] = '\0';
g_free (printed);
return strlen (str);
#endif /* !HAVE_VSNPRINTF */
}
guint
g_parse_debug_string (const gchar *string,
GDebugKey *keys,
guint nkeys)
{
guint i;
guint result = 0;
g_return_val_if_fail (string != NULL, 0);
if (!g_strcasecmp (string, "all"))
{
for (i=0; i<nkeys; i++)
result |= keys[i].value;
}
else
{
gchar *str = g_strdup (string);
gchar *p = str;
gchar *q;
gboolean done = FALSE;
while (*p && !done)
{
q = strchr (p, ':');
if (!q)
{
q = p + strlen(p);
done = TRUE;
}
*q = 0;
for (i=0; i<nkeys; i++)
if (!g_strcasecmp(keys[i].key, p))
result |= keys[i].value;
p = q+1;
}
g_free (str);
}
return result;
}
gchar*
g_basename (const gchar *file_name)
{
register gchar *base;
g_return_val_if_fail (file_name != NULL, NULL);
base = strrchr (file_name, G_DIR_SEPARATOR);
if (base)
return base + 1;
#ifdef NATIVE_WIN32
if (isalpha (file_name[0]) && file_name[1] == ':')
return (gchar*) file_name + 2;
#endif /* NATIVE_WIN32 */
return (gchar*) file_name;
}
gboolean
g_path_is_absolute (const gchar *file_name)
{
g_return_val_if_fail (file_name != NULL, FALSE);
if (file_name[0] == G_DIR_SEPARATOR)
return TRUE;
#ifdef NATIVE_WIN32
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return TRUE;
#endif
return FALSE;
}
gchar*
g_path_skip_root (gchar *file_name)
{
g_return_val_if_fail (file_name != NULL, NULL);
if (file_name[0] == G_DIR_SEPARATOR)
return file_name + 1;
#ifdef NATIVE_WIN32
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return file_name + 3;
#endif
return NULL;
}
gchar*
g_dirname (const gchar *file_name)
{
register gchar *base;
register guint len;
g_return_val_if_fail (file_name != NULL, NULL);
base = strrchr (file_name, G_DIR_SEPARATOR);
if (!base)
return g_strdup (".");
while (base > file_name && *base == G_DIR_SEPARATOR)
base--;
len = (guint) 1 + base - file_name;
base = g_new (gchar, len + 1);
g_memmove (base, file_name, len);
base[len] = 0;
return base;
}
gchar*
g_get_current_dir (void)
{
gchar *buffer;
gchar *dir;
buffer = g_new (gchar, G_PATH_LENGTH);
*buffer = 0;
/* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
* and, if that wasn't bad enough, hangs in doing so.
*/
#if defined (sun) && !defined (__SVR4)
dir = getwd (buffer);
#else /* !sun */
dir = getcwd (buffer, G_PATH_LENGTH - 1);
#endif /* !sun */
if (!dir || !*buffer)
{
/* hm, should we g_error() out here?
* this can happen if e.g. "./" has mode \0000
*/
buffer[0] = G_DIR_SEPARATOR;
buffer[1] = 0;
}
dir = g_strdup (buffer);
g_free (buffer);
return dir;
}
gchar*
g_getenv (const gchar *variable)
{
#ifndef NATIVE_WIN32
g_return_val_if_fail (variable != NULL, NULL);
return getenv (variable);
#else
gchar *v;
guint k;
static gchar *p = NULL;
static gint l;
gchar dummy[2];
g_return_val_if_fail (variable != NULL, NULL);
v = getenv (variable);
if (!v)
return NULL;
/* On Windows NT, it is relatively typical that environment variables
* contain references to other environment variables. Handle that by
* calling ExpandEnvironmentStrings.
*/
/* First check how much space we need */
k = ExpandEnvironmentStrings (v, dummy, 2);
/* Then allocate that much, and actualy do the expansion */
if (p == NULL)
{
p = g_malloc (k);
l = k;
}
else if (k > l)
{
p = g_realloc (p, k);
l = k;
}
ExpandEnvironmentStrings (v, p, k);
return p;
#endif
}
G_LOCK_DEFINE_STATIC (g_utils_global);
static gchar *g_tmp_dir = NULL;
static gchar *g_user_name = NULL;
static gchar *g_real_name = NULL;
static gchar *g_home_dir = NULL;
/* HOLDS: g_utils_global_lock */
static void
g_get_any_init (void)
{
if (!g_tmp_dir)
{
g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
if (!g_tmp_dir)
g_tmp_dir = g_strdup (g_getenv ("TMP"));
if (!g_tmp_dir)
g_tmp_dir = g_strdup (g_getenv ("TEMP"));
#ifdef P_tmpdir
if (!g_tmp_dir)
{
int k;
g_tmp_dir = g_strdup (P_tmpdir);
k = strlen (g_tmp_dir);
if (g_tmp_dir[k-1] == G_DIR_SEPARATOR)
g_tmp_dir[k-1] = '\0';
}
#endif
if (!g_tmp_dir)
{
#ifndef NATIVE_WIN32
g_tmp_dir = g_strdup ("/tmp");
#else /* NATIVE_WIN32 */
g_tmp_dir = g_strdup ("C:\\");
#endif /* NATIVE_WIN32 */
}
if (!g_home_dir)
g_home_dir = g_strdup (g_getenv ("HOME"));
#ifdef NATIVE_WIN32
if (!g_home_dir)
{
/* The official way to specify a home directory on NT is
* the HOMEDRIVE and HOMEPATH environment variables.
*
* This is inside #ifdef NATIVE_WIN32 because with the cygwin dll,
* HOME should be a POSIX style pathname.
*/
if (getenv ("HOMEDRIVE") != NULL && getenv ("HOMEPATH") != NULL)
{
gchar *homedrive, *homepath;
homedrive = g_strdup (g_getenv ("HOMEDRIVE"));
homepath = g_strdup (g_getenv ("HOMEPATH"));
g_home_dir = g_strconcat (homedrive, homepath, NULL);
g_free (homedrive);
g_free (homepath);
}
}
#endif /* !NATIVE_WIN32 */
#ifdef HAVE_PWD_H
{
struct passwd *pw = NULL;
gpointer buffer = NULL;
# ifdef HAVE_GETPWUID_R
struct passwd pwd;
guint bufsize = 64;
gint error;
do
{
g_free (buffer);
buffer = g_malloc (bufsize);
errno = 0;
# ifdef HAVE_GETPWUID_R_POSIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
error = error < 0 ? errno : error;
# else /* !HAVE_GETPWUID_R_POSIX */
# ifdef _AIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
pw = error == 0 ? &pwd : NULL;
# else /* !_AIX */
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
error = pw ? 0 : errno;
# endif /* !_AIX */
# endif /* !HAVE_GETPWUID_R_POSIX */
if (!pw)
{
/* we bail out prematurely if the user id can't be found
* (should be pretty rare case actually), or if the buffer
* should be sufficiently big and lookups are still not
* successfull.
*/
if (error == 0 || error == ENOENT)
{
g_warning ("getpwuid_r(): failed due to: No such user %d.",
getuid ());
break;
}
if (bufsize > 32 * 1024)
{
g_warning ("getpwuid_r(): failed due to: %s.",
g_strerror (error));
break;
}
bufsize *= 2;
}
}
while (!pw);
# endif /* !HAVE_GETPWUID_R */
if (!pw)
{
setpwent ();
pw = getpwuid (getuid ());
endpwent ();
}
if (pw)
{
g_user_name = g_strdup (pw->pw_name);
g_real_name = g_strdup (pw->pw_gecos);
if (!g_home_dir)
g_home_dir = g_strdup (pw->pw_dir);
}
g_free (buffer);
}
#else /* !HAVE_PWD_H */
# ifdef NATIVE_WIN32
{
guint len = 17;
gchar buffer[17];
if (GetUserName (buffer, &len))
{
g_user_name = g_strdup (buffer);
g_real_name = g_strdup (buffer);
}
}
# endif /* NATIVE_WIN32 */
#endif /* !HAVE_PWD_H */
if (!g_user_name)
g_user_name = g_strdup ("somebody");
if (!g_real_name)
g_real_name = g_strdup ("Unknown");
else
{
gchar *p;
for (p = g_real_name; *p; p++)
if (*p == ',')
{
*p = 0;
p = g_strdup (g_real_name);
g_free (g_real_name);
g_real_name = p;
break;
}
}
}
}
gchar*
g_get_user_name (void)
{
G_LOCK (g_utils_global);
if (!g_tmp_dir)
g_get_any_init ();
G_UNLOCK (g_utils_global);
return g_user_name;
}
gchar*
g_get_real_name (void)
{
G_LOCK (g_utils_global);
if (!g_tmp_dir)
g_get_any_init ();
G_UNLOCK (g_utils_global);
return g_real_name;
}
/* Return the home directory of the user. If there is a HOME
* environment variable, its value is returned, otherwise use some
* system-dependent way of finding it out. If no home directory can be
* deduced, return NULL.
*/
gchar*
g_get_home_dir (void)
{
G_LOCK (g_utils_global);
if (!g_tmp_dir)
g_get_any_init ();
G_UNLOCK (g_utils_global);
return g_home_dir;
}
/* Return a directory to be used to store temporary files. This is the
* value of the TMPDIR, TMP or TEMP environment variables (they are
* checked in that order). If none of those exist, use P_tmpdir from
* stdio.h. If that isn't defined, return "/tmp" on POSIXly systems,
* and C:\ on Windows.
*/
gchar*
g_get_tmp_dir (void)
{
G_LOCK (g_utils_global);
if (!g_tmp_dir)
g_get_any_init ();
G_UNLOCK (g_utils_global);
return g_tmp_dir;
}
static gchar *g_prgname = NULL;
gchar*
g_get_prgname (void)
{
gchar* retval;
G_LOCK (g_utils_global);
retval = g_prgname;
G_UNLOCK (g_utils_global);
return retval;
}
void
g_set_prgname (const gchar *prgname)
{
gchar *c;
G_LOCK (g_utils_global);
c = g_prgname;
g_prgname = g_strdup (prgname);
g_free (c);
G_UNLOCK (g_utils_global);
}
guint
g_direct_hash (gconstpointer v)
{
return GPOINTER_TO_UINT (v);
}
gint
g_direct_equal (gconstpointer v1,
gconstpointer v2)
{
return v1 == v2;
}
gint
g_int_equal (gconstpointer v1,
gconstpointer v2)
{
return *((const gint*) v1) == *((const gint*) v2);
}
guint
g_int_hash (gconstpointer v)
{
return *(const gint*) v;
}
#if 0 /* Old IO Channels */
GIOChannel*
g_iochannel_new (gint fd)
{
GIOChannel *channel = g_new (GIOChannel, 1);
channel->fd = fd;
#ifdef NATIVE_WIN32
channel->peer = 0;
channel->peer_fd = 0;
channel->offset = 0;
channel->need_wakeups = 0;
#endif /* NATIVE_WIN32 */
return channel;
}
void
g_iochannel_free (GIOChannel *channel)
{
g_return_if_fail (channel != NULL);
g_free (channel);
}
void
g_iochannel_close_and_free (GIOChannel *channel)
{
g_return_if_fail (channel != NULL);
close (channel->fd);
g_iochannel_free (channel);
}
#undef g_iochannel_wakeup_peer
void
g_iochannel_wakeup_peer (GIOChannel *channel)
{
#ifdef NATIVE_WIN32
static guint message = 0;
#endif
g_return_if_fail (channel != NULL);
#ifdef NATIVE_WIN32
if (message == 0)
message = RegisterWindowMessage ("gdk-pipe-readable");
# if 0
g_print ("g_iochannel_wakeup_peer: calling PostThreadMessage (%#x, %d, %d, %d)\n",
channel->peer, message, channel->peer_fd, channel->offset);
# endif
PostThreadMessage (channel->peer, message,
channel->peer_fd, channel->offset);
#endif /* NATIVE_WIN32 */
}
#endif /* Old IO Channels */
#ifdef NATIVE_WIN32
#ifdef _MSC_VER
int
gwin_ftruncate (gint fd,
guint size)
{
HANDLE hfile;
guint curpos;
g_return_val_if_fail (fd >= 0, -1);
hfile = (HANDLE) _get_osfhandle (fd);
curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
if (curpos == 0xFFFFFFFF
|| SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
|| !SetEndOfFile (hfile))
{
gint error = GetLastError ();
switch (error)
{
case ERROR_INVALID_HANDLE:
errno = EBADF;
break;
default:
errno = EIO;
break;
}
return -1;
}
return 0;
}
DIR*
gwin_opendir (const char *dirname)
{
DIR *result;
gchar *mask;
guint k;
g_return_val_if_fail (dirname != NULL, NULL);
result = g_new0 (DIR, 1);
result->find_file_data = g_new0 (WIN32_FIND_DATA, 1);
result->dir_name = g_strdup (dirname);
k = strlen (result->dir_name);
if (k && result->dir_name[k - 1] == '\\')
{
result->dir_name[k - 1] = '\0';
k--;
}
mask = g_strdup_printf ("%s\\*", result->dir_name);
result->find_file_handle = (guint) FindFirstFile (mask,
(LPWIN32_FIND_DATA) result->find_file_data);
g_free (mask);
if (result->find_file_handle == (guint) INVALID_HANDLE_VALUE)
{
int error = GetLastError ();
g_free (result->dir_name);
g_free (result->find_file_data);
g_free (result);
switch (error)
{
default:
errno = EIO;
return NULL;
}
}
result->just_opened = TRUE;
return result;
}
struct dirent*
gwin_readdir (DIR *dir)
{
static struct dirent result;
g_return_val_if_fail (dir != NULL, NULL);
if (dir->just_opened)
dir->just_opened = FALSE;
else
{
if (!FindNextFile ((HANDLE) dir->find_file_handle,
(LPWIN32_FIND_DATA) dir->find_file_data))
{
int error = GetLastError ();
switch (error)
{
case ERROR_NO_MORE_FILES:
return NULL;
default:
errno = EIO;
return NULL;
}
}
}
strcpy (result.d_name, g_basename (((LPWIN32_FIND_DATA) dir->find_file_data)->cFileName));
return &result;
}
void
gwin_rewinddir (DIR *dir)
{
gchar *mask;
g_return_if_fail (dir != NULL);
if (!FindClose ((HANDLE) dir->find_file_handle))
g_warning ("gwin_rewinddir(): FindClose() failed\n");
mask = g_strdup_printf ("%s\\*", dir->dir_name);
dir->find_file_handle = (guint) FindFirstFile (mask,
(LPWIN32_FIND_DATA) dir->find_file_data);
g_free (mask);
if (dir->find_file_handle == (guint) INVALID_HANDLE_VALUE)
{
int error = GetLastError ();
switch (error)
{
default:
errno = EIO;
return;
}
}
dir->just_opened = TRUE;
}
gint
gwin_closedir (DIR *dir)
{
g_return_val_if_fail (dir != NULL, -1);
if (!FindClose ((HANDLE) dir->find_file_handle))
{
int error = GetLastError ();
switch (error)
{
default:
errno = EIO; return -1;
}
}
g_free (dir->dir_name);
g_free (dir->find_file_data);
g_free (dir);
return 0;
}
#endif /* _MSC_VER */
#endif /* NATIVE_WIN32 */

Просмотреть файл

@ -1,251 +0,0 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# 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 $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,163 +0,0 @@
## Makefile for building the GLib, gmodule and gthread dlls with Microsoft C
## Use: nmake -f makefile.msc install
# Change this to wherever you want to install the DLLs. This directory
# should be in your PATH.
BIN = C:\bin
# This is the location of pthreads for Win32,
# see http://sourceware.cygnus.com/pthreads-win32/
PTHREAD_LIB = ..\lib\pthread.lib
PTHREAD_INC = ..\include
################################################################
# Nothing much configurable below
# cl -? described the options
CC = cl -G5 -GF -Ox -W3 -MD -nologo
# No general LDFLAGS needes
LDFLAGS = /link
INSTALL = copy
GLIB_VER = 1.2
CFLAGS = -I. -DHAVE_CONFIG_H
all : \
glibconfig.h \
config.h \
glib-$(GLIB_VER).dll \
gmodule\gmoduleconf.h \
gmodule-$(GLIB_VER).dll \
gthread-$(GLIB_VER).dll \
testglib.exe \
testgmodule.exe \
testgdate.exe \
testgdateparser.exe \
testgthread.exe
install : all
$(INSTALL) glib-$(GLIB_VER).dll $(BIN)
$(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
$(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
glib_OBJECTS = \
garray.obj \
gcache.obj \
gcompletion.obj \
gdataset.obj \
gdate.obj \
gerror.obj \
ghook.obj \
ghash.obj \
giochannel.obj \
giowin32.obj \
glist.obj \
gmain.obj \
gmem.obj \
gmessages.obj \
gmutex.obj \
gnode.obj \
gprimes.obj \
gslist.obj \
gtimer.obj \
gtree.obj \
grel.obj \
gstring.obj \
gstrfuncs.obj \
gscanner.obj \
gutils.obj
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
glibconfig.h: glibconfig.h.win32
copy glibconfig.h.win32 glibconfig.h
config.h: config.h.win32
copy config.h.win32 config.h
.c.obj :
$(CC) $(CFLAGS) -GD -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
gmodule_OBJECTS = \
gmodule.obj
gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS)
$(CC) $(CFLAGS) -LD -Fegmodule-$(GLIB_VER).dll $(gmodule_OBJECTS) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gmodule\gmodule.def
gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
$(CC) $(CFLAGS) -GD -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule\gmodule.c
gmodule\gmoduleconf.h: gmodule\gmoduleconf.h.win32
copy gmodule\gmoduleconf.h.win32 gmodule\gmoduleconf.h
gthread_OBJECTS = \
gthread.obj
gthread-$(GLIB_VER).dll : $(gthread_OBJECTS)
$(CC) $(CFLAGS) -LD -Fegthread-$(GLIB_VER).dll $(gthread_OBJECTS) glib-$(GLIB_VER).lib $(PTHREAD_LIB) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gthread\gthread.def
gthread.obj : gthread\gthread.c gthread\gthread-posix.c
$(CC) $(CFLAGS) -GD -I$(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread\gthread.c
testglib.exe : glib-$(GLIB_VER).dll testglib.obj
$(CC) $(CFLAGS) -Fetestglib.exe testglib.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
testglib.obj : testglib.c
$(CC) -c $(CFLAGS) testglib.c
testgdate.exe : glib-$(GLIB_VER).dll testgdate.obj
$(CC) $(CFLAGS) -Fetestgdate.exe testgdate.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
testgdate.obj : testgdate.c
$(CC) -c $(CFLAGS) testgdate.c
testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.obj
$(CC) $(CFLAGS) -Fetestgdateparser.exe testgdateparser.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
testgdateparser.obj : testgdateparser.c
$(CC) -c $(CFLAGS) testgdateparser.c
testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.obj libgplugin_a.dll libgplugin_b.dll
$(CC) $(CFLAGS) testgmodule.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
testgmodule.obj : gmodule\testgmodule.c
$(CC) $(CFLAGS) -Igmodule -c gmodule\testgmodule.c
libgplugin_a.dll : libgplugin_a.obj
$(CC) $(CFLAGS) -LD libgplugin_a.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
libgplugin_a.obj : gmodule\libgplugin_a.c
$(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_a.c
libgplugin_b.dll : libgplugin_b.obj
$(CC) $(CFLAGS) -LD libgplugin_b.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
libgplugin_b.obj : gmodule\libgplugin_b.c
$(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_b.c
testgthread.exe : glib-$(GLIB_VER).dll gthread-$(GLIB_VER).dll testgthread.obj
$(CC) $(CFLAGS) testgthread.obj glib-$(GLIB_VER).lib gthread-$(GLIB_VER).lib $(PTHREAD_LIB) $(LDFLAGS) /subsystem:console
testgthread.obj : gthread\testgthread.c
$(CC) $(CFLAGS) -I$(PTHREAD_INC) -c gthread\testgthread.c
clean:
del config.h
del glibconfig.h
del gmodule\gmoduleconf.h
del *.exe
del *.obj
del *.dll
del *.lib
del *.err
del *.map
del *.sym
del *.exp
del *.lk1
del *.mk1
del *.pdb
del *.ilk

Просмотреть файл

@ -1,190 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

Просмотреть файл

@ -1,40 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 1999/05/06 14:59:47 beard%netscape.com Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
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
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

Просмотреть файл

@ -1,41 +0,0 @@
#!/bin/sh
VERSION=$1
if [ ! -f glib-$VERSION.tar.gz ]; then
echo "ERROR: glib-$VERSION.tar.gz does not exist..."
exit 1
fi
echo ""
echo "Checking glib-$VERSION.tar.gz..."
tar xfz glib-$VERSION.tar.gz
for file in README NEWS
do
echo -n "$file... "
if [ "x`grep $VERSION glib-$VERSION/$file | wc -l | awk -F' ' '{print $1}'`" == "x1" ]; then
echo "ok"
else
echo "failed."
exit 1
fi
done
echo -n "INSTALL..."
if [ "x`grep $VERSION glib-$VERSION/INSTALL | wc -l | awk -F' ' '{print $1}'`" == "x2" ]; then
echo "ok"
else
echo "failed."
exit 1
fi
echo ""
echo "Number of lines in created documentation files:"
wc -l glib-$VERSION/docs/*.html | grep -v total
wc -l glib-$VERSION/docs/*.info | grep -v total
rm -rf glib-$VERSION

Просмотреть файл

@ -1 +0,0 @@
timestamp

Просмотреть файл

@ -1,489 +0,0 @@
#include "glib.h"
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <time.h>
gboolean failed = FALSE;
guint32 passed = 0;
guint32 notpassed = 0;
#define TEST(m,cond) G_STMT_START { failed = !(cond); \
if (failed) \
{ ++notpassed; \
if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
} \
else \
++passed; \
if ((passed+notpassed) % 10000 == 0) g_print ("."); fflush (stdout); \
} G_STMT_END
void g_date_debug_print(GDate* d)
{
if (!d) g_print("NULL!\n");
else
g_print("julian: %u (%s) DMY: %u %u %u (%s)\n",
d->julian_days,
d->julian ? "valid" : "invalid",
d->day,
d->month,
d->year,
d->dmy ? "valid" : "invalid");
fflush(stdout);
}
int main(int argc, char** argv)
{
GDate* d;
guint32 j;
GDateMonth m;
GDateYear y, prev_y;
GDateDay day;
gchar buf[101];
gchar* loc;
/* Try to get all the leap year cases. */
GDateYear check_years[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 98, 99, 100, 101, 102, 103, 397,
398, 399, 400, 401, 402, 403, 404, 405, 406,
1598, 1599, 1600, 1601, 1602, 1650, 1651,
1897, 1898, 1899, 1900, 1901, 1902, 1903,
1961, 1962, 1963, 1964, 1965, 1967,
1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976,
1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
3000, 3001, 3002, 3998, 3999, 4000, 4001, 4002, 4003
};
guint n_check_years = sizeof(check_years)/sizeof(GDateYear);
guint i = 0;
gboolean discontinuity = FALSE;
g_print("checking GDate...");
TEST("sizeof(GDate) is not more than 8 bytes on this platform", sizeof(GDate) < 9);
d = g_date_new();
TEST("Empty constructor produces invalid date", !g_date_valid(d));
g_date_free(d);
d = g_date_new_dmy(1,1,1);
TEST("January 1, Year 1 created and valid", g_date_valid(d));
j = g_date_julian(d);
TEST("January 1, Year 1 is Julian date 1", j == 1);
TEST("Returned month is January", g_date_month(d) == G_DATE_JANUARY);
TEST("Returned day is 1", g_date_day(d) == 1);
TEST("Returned year is 1", g_date_year(d) == 1);
TEST("Bad month is invalid", !g_date_valid_month(G_DATE_BAD_MONTH));
TEST("Month 13 is invalid", !g_date_valid_month(13));
TEST("Bad day is invalid", !g_date_valid_day(G_DATE_BAD_DAY));
TEST("Day 32 is invalid", !g_date_valid_day(32));
TEST("Bad year is invalid", !g_date_valid_year(G_DATE_BAD_YEAR));
TEST("Bad julian is invalid", !g_date_valid_julian(G_DATE_BAD_JULIAN));
TEST("Bad weekday is invalid", !g_date_valid_weekday(G_DATE_BAD_WEEKDAY));
TEST("Year 2000 is a leap year", g_date_is_leap_year(2000));
TEST("Year 1999 is not a leap year", !g_date_is_leap_year(1999));
TEST("Year 1996 is a leap year", g_date_is_leap_year(1996));
TEST("Year 1600 is a leap year", g_date_is_leap_year(1600));
TEST("Year 2100 is not a leap year", !g_date_is_leap_year(2100));
TEST("Year 1800 is not a leap year", !g_date_is_leap_year(1800));
g_date_free(d);
loc = setlocale(LC_ALL,"");
if (loc)
g_print("\nLocale set to %s\n", loc);
else
g_print("\nLocale unchanged\n");
d = g_date_new();
g_date_set_time(d, time(NULL));
TEST("Today is valid", g_date_valid(d));
g_date_strftime(buf,100,"Today is a %A, %x\n", d);
g_print("%s", buf);
g_date_set_time(d, 1);
TEST("Beginning of Unix epoch is valid", g_date_valid(d));
g_date_strftime(buf,100,"1 second into the Unix epoch it was a %A, in the month of %B, %x\n", d);
g_print("%s", buf);
g_date_set_julian(d, 1);
TEST("GDate's \"Julian\" epoch's first day is valid", g_date_valid(d));
g_date_strftime(buf,100,"Our \"Julian\" epoch begins on a %A, in the month of %B, %x\n",
d);
g_print("%s", buf);
g_date_set_dmy(d, 10, 1, 2000);
g_date_strftime(buf,100,"%x", d);
g_date_set_parse(d, buf);
/* Note: this test will hopefully work, but no promises. */
TEST("Successfully parsed a %x-formatted string",
g_date_valid(d) &&
g_date_month(d) == 1 &&
g_date_day(d) == 10 &&
g_date_year(d) == 2000);
if (failed)
g_date_debug_print(d);
g_date_free(d);
j = G_DATE_BAD_JULIAN;
i = 0;
discontinuity = TRUE;
y = check_years[0];
prev_y = G_DATE_BAD_YEAR;
while (i < n_check_years)
{
guint32 first_day_of_year = G_DATE_BAD_JULIAN;
guint16 days_in_year = g_date_is_leap_year(y) ? 366 : 365;
guint sunday_week_of_year = 0;
guint sunday_weeks_in_year = g_date_sunday_weeks_in_year(y);
guint monday_week_of_year = 0;
guint monday_weeks_in_year = g_date_monday_weeks_in_year(y);
if (discontinuity)
g_print(" (Break in sequence of requested years to check)\n");
g_print("Checking year %u", y);
TEST("Year is valid", g_date_valid_year(y));
TEST("Number of Sunday weeks in year is 52 or 53",
sunday_weeks_in_year == 52 || sunday_weeks_in_year == 53);
TEST("Number of Monday weeks in year is 52 or 53",
monday_weeks_in_year == 52 || monday_weeks_in_year == 53);
m = 1;
while (m < 13)
{
guint8 dim = g_date_days_in_month(m,y);
GDate days[31]; /* This is the fast way, no allocation */
TEST("Sensible number of days in month", (dim > 0 && dim < 32));
TEST("Month between 1 and 12 is valid", g_date_valid_month(m));
day = 1;
g_date_clear(days, 31);
while (day <= dim)
{
guint i;
GDate tmp;
TEST("DMY triplet is valid", g_date_valid_dmy(day,m,y));
/* Create GDate with triplet */
d = &days[day-1];
TEST("Cleared day is invalid", !g_date_valid(d));
g_date_set_dmy(d,day,m,y);
TEST("Set day is valid", g_date_valid(d));
if (m == G_DATE_JANUARY && day == 1)
{
first_day_of_year = g_date_julian(d);
}
g_assert(first_day_of_year != G_DATE_BAD_JULIAN);
TEST("Date with DMY triplet is valid", g_date_valid(d));
TEST("Month accessor works", g_date_month(d) == m);
TEST("Year accessor works", g_date_year(d) == y);
TEST("Day of month accessor works", g_date_day(d) == day);
TEST("Day of year is consistent with Julian dates",
((g_date_julian(d) + 1 - first_day_of_year) ==
(g_date_day_of_year(d))));
if (failed)
{
g_print("first day: %u this day: %u day of year: %u\n",
first_day_of_year,
g_date_julian(d),
g_date_day_of_year(d));
}
if (m == G_DATE_DECEMBER && day == 31)
{
TEST("Last day of year equals number of days in year",
g_date_day_of_year(d) == days_in_year);
if (failed)
{
g_print("last day: %u days in year: %u\n",
g_date_day_of_year(d), days_in_year);
}
}
TEST("Day of year is not more than number of days in the year",
g_date_day_of_year(d) <= days_in_year);
TEST("Monday week of year is not more than number of weeks in the year",
g_date_monday_week_of_year(d) <= monday_weeks_in_year);
if (failed)
{
g_print("Weeks in year: %u\n", monday_weeks_in_year);
g_date_debug_print(d);
}
TEST("Monday week of year is >= than last week of year",
g_date_monday_week_of_year(d) >= monday_week_of_year);
if (g_date_weekday(d) == G_DATE_MONDAY)
{
TEST("Monday week of year on Monday 1 more than previous day's week of year",
(g_date_monday_week_of_year(d) - monday_week_of_year) == 1);
}
else
{
TEST("Monday week of year on non-Monday 0 more than previous day's week of year",
(g_date_monday_week_of_year(d) - monday_week_of_year) == 0);
}
monday_week_of_year = g_date_monday_week_of_year(d);
TEST("Sunday week of year is not more than number of weeks in the year",
g_date_sunday_week_of_year(d) <= sunday_weeks_in_year);
if (failed)
{
g_date_debug_print(d);
}
TEST("Sunday week of year is >= than last week of year",
g_date_sunday_week_of_year(d) >= sunday_week_of_year);
if (g_date_weekday(d) == G_DATE_SUNDAY)
{
TEST("Sunday week of year on Sunday 1 more than previous day's week of year",
(g_date_sunday_week_of_year(d) - sunday_week_of_year) == 1);
}
else
{
TEST("Sunday week of year on non-Sunday 0 more than previous day's week of year",
(g_date_sunday_week_of_year(d) - sunday_week_of_year) == 0);
}
sunday_week_of_year = g_date_sunday_week_of_year(d);
TEST("Date is equal to itself",
g_date_compare(d,d) == 0);
/*************** Increments ***********/
i = 1;
while (i < 402) /* Need to get 400 year increments in */
{
/***** Days ******/
tmp = *d;
g_date_add_days(d, i);
TEST("Adding days gives a value greater than previous",
g_date_compare(d, &tmp) > 0);
g_date_subtract_days(d, i);
TEST("Forward days then backward days returns us to current day",
g_date_day(d) == day);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
TEST("Forward days then backward days returns us to current month",
g_date_month(d) == m);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
TEST("Forward days then backward days returns us to current year",
g_date_year(d) == y);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
/******* Months ********/
tmp = *d;
g_date_add_months(d, i);
TEST("Adding months gives a larger value",
g_date_compare(d, &tmp) > 0);
g_date_subtract_months(d, i);
TEST("Forward months then backward months returns us to current month",
g_date_month(d) == m);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
TEST("Forward months then backward months returns us to current year",
g_date_year(d) == y);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
if (day < 29)
{
/* Day should be unchanged */
TEST("Forward months then backward months returns us to current day",
g_date_day(d) == day);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
}
else
{
/* reset the day for later tests */
g_date_set_day(d, day);
}
/******* Years ********/
tmp = *d;
g_date_add_years(d, i);
TEST("Adding years gives a larger value",
g_date_compare(d,&tmp) > 0);
g_date_subtract_years(d, i);
TEST("Forward years then backward years returns us to current month",
g_date_month(d) == m);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
TEST("Forward years then backward years returns us to current year",
g_date_year(d) == y);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
if (m != 2 && day != 29)
{
TEST("Forward years then backward years returns us to current day",
g_date_day(d) == day);
if (failed)
{
g_print(" (increment %u, dmy %u %u %u) ", i, day, m, y);
g_date_debug_print(d);
}
}
else
{
g_date_set_day(d, day); /* reset */
}
i += 10;
}
/***** increment test relative to our local Julian count */
if (!discontinuity) {
/* We can only run sequence tests between sequential years */
TEST("Julians are sequential with increment 1",
j+1 == g_date_julian(d));
if (failed)
{
g_print("Out of sequence, prev: %u expected: %u got: %u\n",
j, j+1, g_date_julian(d));
}
g_date_add_days(d,1);
TEST("Next day has julian 1 higher",
g_date_julian(d) == j + 2);
g_date_subtract_days(d, 1);
if (j != G_DATE_BAD_JULIAN)
{
g_date_subtract_days(d, 1);
TEST("Previous day has julian 1 lower",
g_date_julian(d) == j);
g_date_add_days(d, 1); /* back to original */
}
}
discontinuity = FALSE; /* goes away now */
fflush(stdout);
fflush(stderr);
j = g_date_julian(d); /* inc current julian */
++day;
}
++m;
}
g_print(" done\n");
++i;
prev_y = y;
y = check_years[i];
if (prev_y == G_DATE_BAD_YEAR ||
(prev_y + 1) != y) discontinuity = TRUE;
}
g_print("\n%u tests passed, %u failed\n",passed, notpassed);
return 0;
}

Просмотреть файл

@ -1,109 +0,0 @@
#include "glib.h"
#include <stdio.h>
#include <string.h>
#include <locale.h>
void g_date_debug_print(GDate* d)
{
if (!d) g_print("NULL!\n");
else
g_print("julian: %u (%s) DMY: %u %u %u (%s)\n",
d->julian_days,
d->julian ? "valid" : "invalid",
d->day,
d->month,
d->year,
d->dmy ? "valid" : "invalid");
fflush(stdout);
}
/* These only work in the POSIX locale, maybe C too -
* type POSIX into the program to check them
*/
char* posix_tests [] = {
"19981024",
"981024",
"October 1998",
"October 98",
"oCT 98",
"10/24/98",
"10 -- 24 -- 98",
"10/24/1998",
"October 24, 1998",
NULL
};
int main(int argc, char** argv)
{
GDate* d;
gchar* loc;
gchar input[1024];
loc = setlocale(LC_ALL,"");
if (loc)
g_print("\nLocale set to %s\n", loc);
else
g_print("\nLocale unchanged\n");
d = g_date_new();
while (fgets(input, 1023, stdin))
{
if (input[0] == '\n')
{
g_print("Enter a date to parse and press enter, or type `POSIX':\n");
continue;
}
if (strcmp(input,"POSIX\n") == 0)
{
char** s = posix_tests;
while (*s) {
g_date_set_parse(d, *s);
g_print("POSIXy parse test `%s' ...", *s);
if (!g_date_valid(d))
{
g_print(" failed.\n");
}
else
{
gchar buf[256];
g_date_strftime(buf,100," parsed `%x' (%B %d %Y)\n",
d);
g_print("%s", buf);
}
++s;
}
}
else
{
g_date_set_parse(d, input);
if (!g_date_valid(d))
{
g_print("Parse failed.\n");
}
else
{
gchar buf[256];
g_date_strftime(buf,100,"Parsed: `%x' (%B %d %Y)\n",
d);
g_print("%s", buf);
}
}
}
g_date_free(d);
return 0;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше