mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5df4e8d92d |
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
_tmpinst
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
libtool
|
||||
ltconfig
|
||||
ltmain.sh
|
||||
mint.pc
|
||||
mono-*.tar.gz
|
||||
mono.pc
|
||||
mono.spec
|
||||
semantic.cache
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
tmpinst-dir.stamp
|
||||
@@ -1,101 +0,0 @@
|
||||
|
||||
Mono is made up of many pieces of code, all of them open source, but
|
||||
different pieces of Mono use different licensing terms.
|
||||
|
||||
For comments, corrections and updates, please contact [email protected]
|
||||
|
||||
* Dual Licensing
|
||||
|
||||
Parts of Mono are dual licensed, they are available to the
|
||||
public in GPL or LGPL forms, but we also offer those pieces
|
||||
under commercial terms from Novell for when the GPL and the
|
||||
LGPL are not suitable.
|
||||
|
||||
We have tried to pick the licenses that will maximize adoption
|
||||
of Mono, so we tend to use the MIT X11 or LGPL liceses.
|
||||
|
||||
Contributions to dual-licensed module require that the author
|
||||
contributes the code under the terms of the MIT X11 code, or
|
||||
to sign an agreement that allows Novell to redistribute the
|
||||
code under other licenses.
|
||||
|
||||
Contributions for other modules should be under the same license
|
||||
terms as the rest of the module, or under MIT X11 terms.
|
||||
|
||||
If you ned further information, please contact [email protected]
|
||||
|
||||
* The Modules
|
||||
|
||||
** mono/mono: the Mono VM
|
||||
|
||||
This code is dual licensed under the LGPL or commercial licenses.
|
||||
|
||||
The LGPL ensures that Mono can be used in most scenarios, but
|
||||
gives Novell the flexibility to relicense the code for embedded
|
||||
systems or commercial settings where the LGPL can not be used.
|
||||
|
||||
Contact [email protected] for details on obtaining the Mono
|
||||
runtime under other terms.
|
||||
|
||||
** mono/eglib: Mono's X11 glib implementation
|
||||
|
||||
This is a minimal subset of glib that is to be licensed under
|
||||
the terms of the MIT X11, this means that this code can be
|
||||
used for any purposes by anyone.
|
||||
|
||||
** mcs/mcs, mcs/gmcs
|
||||
|
||||
The C# Compilers (1.0 and 2.0)
|
||||
|
||||
These compilers are dual licensed under the GPL and commercial
|
||||
terms.
|
||||
|
||||
** tests
|
||||
|
||||
Unless explicitly stated, the tests are under the MIT X11 license.
|
||||
|
||||
** mcs/class
|
||||
|
||||
The class libraries developed by the Mono team are licensed
|
||||
under the MIT X11 terms.
|
||||
|
||||
In addition to the class libraries developed by the Mono team,
|
||||
there are a number of class libraries that we bundle as part
|
||||
of the distribution that were integrated from third-parties or
|
||||
that contain code that was originally licensed under different
|
||||
terms, these are:
|
||||
|
||||
ByteFX.Data: LGPL
|
||||
|
||||
Npgsql: LGPL
|
||||
|
||||
FirebirdSql.Data.Firebird: Firebird public license.
|
||||
See: mcs/class/FirebirdSql.Data.Firebird/license.txt
|
||||
|
||||
ICSharpCode.SharpZipLib, GPL with exceptions.
|
||||
See: mcs/class/ICSharpCode.SharpZipLib/README
|
||||
|
||||
|
||||
** mcs/tools
|
||||
|
||||
These are licensed under the MIT X11 license, except where the
|
||||
GPL is explicitly used.
|
||||
|
||||
** mcs/jay
|
||||
|
||||
This is a port of Berkeley yacc, so it is available under the BSD
|
||||
license. See the license in the individual C files for details.
|
||||
|
||||
** mono/man
|
||||
|
||||
Manual pages and Mono documentation are covered by the MIT X11 license.
|
||||
|
||||
* The Licenses
|
||||
|
||||
These are the licenses used in Mono, the files are located:
|
||||
|
||||
GNU GPL: details avaliable in the file mcs/LICENSE.GPL
|
||||
GNU LGPL: details available in the file mcs/LICENSE.LGPL
|
||||
MIT X11: text available in the file mcs/MIT.X11
|
||||
MPL: text available in the file mcs/LICENSE.MPL
|
||||
|
||||
+213
-47
@@ -1,74 +1,242 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I .
|
||||
|
||||
SUBDIRS = $(libgc_dir) mono $(ikvm_native_dir) support docs data runtime scripts man samples web
|
||||
SUBDIRS = $(libgc_dir) mono $(ikvm_jni_dir) docs data runtime scripts man samples support web
|
||||
|
||||
# Keep in sync with SUBDIRS
|
||||
## 'tools' is not normally built
|
||||
DIST_SUBDIRS = libgc mono ikvm-native support docs data runtime scripts man samples web tools
|
||||
DIST_SUBDIRS = libgc mono ikvm-jni docs data runtime scripts man samples support web tools
|
||||
|
||||
vs_files = genmdesc.vcproj libmono.vcproj mono.vcproj mono.sln
|
||||
|
||||
EXTRA_DIST= mono.pc.in mint.pc.in mono-uninstalled.pc.in dotnet.pc.in mono-cairo.pc.in LICENSE $(vs_files)
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
|
||||
EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
|
||||
|
||||
# Distribute the 'mcs' tree too
|
||||
dist-hook:
|
||||
test -d $(distdir)/mcs || mkdir $(distdir)/mcs
|
||||
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=default distdir=$$d dist-recursive
|
||||
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
if JIT_SUPPORTED
|
||||
if INTERP_SUPPORTED
|
||||
pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc
|
||||
pkgconfig_DATA= mono.pc mint.pc
|
||||
else
|
||||
pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc
|
||||
pkgconfig_DATA= mint.pc
|
||||
endif
|
||||
else
|
||||
pkgconfig_DATA= mint.pc mono-cairo.pc
|
||||
endif
|
||||
noinst_DATA = mono-uninstalled.pc
|
||||
DISTCLEANFILES= mono.pc mint.pc mono-uninstalled.pc dotnet.pc mono-cairo.pc
|
||||
DISTCLEANFILES= mono.pc mint.pc
|
||||
|
||||
.PHONY: get-monolite-latest mcs-do-compiler-tests compiler-tests bootstrap-world
|
||||
#
|
||||
# The following targets are used to compile and install
|
||||
# mono and mcs without running into the out-of-sync
|
||||
# problems by doing the compilation in the right order.
|
||||
#
|
||||
|
||||
.PHONY: bootstrap faststrap fasterstrap bootstrap-clean bootstrap-check get-monolite-latest monolite-bootstrap
|
||||
.PHONY: tmpinst-dir tmpinst-mcs-basic-build tmpinst-mcs-short-build tmpinst-mcs-full-build tmpinst-monolite
|
||||
.PHONY: mono-do-runtime-only mcs-do-basic-build mcs-do-short-build mcs-do-full-build mcs-do-clean-profiles mcs-do-run-test
|
||||
.PHONY: populate-runtime-subdir
|
||||
|
||||
if USE_JIT
|
||||
mono_runtime = mono/mini/mono
|
||||
else
|
||||
mono_runtime = mono/interpreter/mint
|
||||
endif
|
||||
|
||||
# Minimal set of directories to build, and files used to run the 'mcs' compiler
|
||||
MCS_BASIC_DIRS = jay mcs class/corlib class/System
|
||||
MCS_BASIC_FILES = \
|
||||
$(mcs_topdir)/mcs/mcs.exe \
|
||||
$(mcs_topdir)/class/lib/default/mscorlib.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.dll
|
||||
|
||||
# Set of directories and files the 'mcs' compiler can use
|
||||
## We build class/System twice to resolve the cyclic dependency of class/System.XML
|
||||
MCS_DIRS = $(MCS_BASIC_DIRS) class/System.XML class/System class/Mono.CSharp.Debugger
|
||||
MCS_FILES = $(MCS_BASIC_FILES) \
|
||||
$(mcs_topdir)/class/lib/default/System.Xml.dll \
|
||||
$(mcs_topdir)/class/lib/default/Mono.CompilerServices.SymbolWriter.dll
|
||||
|
||||
tmpinst = _tmpinst
|
||||
|
||||
if PLATFORM_WIN32
|
||||
|
||||
populate_profiles = default:net_1_1
|
||||
|
||||
# bootstraps using the .NET C# compiler
|
||||
bootstrap: tmpinst-dir mono-do-runtime-only
|
||||
$(MAKE) fasterstrap
|
||||
|
||||
else
|
||||
|
||||
populate_profiles = default:net_1_1 net_2_0:net_2_0
|
||||
|
||||
bootstrap: tmpinst-mcs-basic-build mono-do-runtime-only
|
||||
$(MAKE) tmpinst-mcs-short-build
|
||||
$(MAKE) fasterstrap
|
||||
|
||||
endif
|
||||
|
||||
faststrap: tmpinst-mcs-short-build
|
||||
$(MAKE) mono-do-runtime-only
|
||||
$(MAKE) fasterstrap
|
||||
|
||||
fasterstrap: tmpinst-mcs-full-build
|
||||
$(MAKE) populate-runtime-subdir
|
||||
$(MAKE)
|
||||
|
||||
bootstrap-clean: clean mcs-do-clean-profiles
|
||||
|
||||
bootstrap-check: check mcs-do-run-test-profiles #mono-do-testjit
|
||||
|
||||
mono-do-testjit: $(tmpinst)/bin/ilasm
|
||||
tmpinst=`cd $(tmpinst) && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd mono/tests && $(MAKE) test
|
||||
|
||||
# building with monolite
|
||||
mcslib = $(mcs_topdir)/class/lib
|
||||
monolite = $(mcslib)/monolite
|
||||
|
||||
get-monolite-latest:
|
||||
-rm -fr $(mcslib)/monolite-*
|
||||
test ! -d $(monolite) || test ! -d $(monolite).old || rm -fr $(monolite).old
|
||||
test ! -d $(monolite) || mv -f $(monolite) $(monolite).old
|
||||
cd $(mcslib) && { wget -O- http://www.go-mono.com/daily/monolite-latest.tar.gz | gzip -d | tar xf - ; }
|
||||
cd $(mcslib) && mv -f monolite-* monolite
|
||||
wget -O $(srcdir)/../monolite-latest.tar.gz http://www.go-mono.com/daily/monolite-latest.tar.gz
|
||||
|
||||
compiler-tests: mcs-do-clean
|
||||
$(MAKE) all
|
||||
monolite-bootstrap: tmpinst-monolite mono-do-runtime-only
|
||||
rm -f $(MCS_FILES)
|
||||
$(MAKE) tmpinst-mcs-short-build
|
||||
$(MAKE) fasterstrap
|
||||
|
||||
compiler-tests:
|
||||
$(MAKE) mcs-do-clean-profiles
|
||||
$(MAKE) bootstrap
|
||||
$(MAKE) mcs-do-compiler-tests
|
||||
|
||||
compiler-tests-net_2_0:
|
||||
-rm -f $(mcs_topdir)/build/common/Consts.cs.save
|
||||
-mv -f $(mcs_topdir)/build/common/Consts.cs $(mcs_topdir)/build/common/Consts.cs.save
|
||||
cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0_bootstrap clean
|
||||
cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 clean
|
||||
-mv -f $(mcs_topdir)/build/common/Consts.cs.save $(mcs_topdir)/build/common/Consts.cs
|
||||
$(MAKE) all
|
||||
$(MAKE) build_profiles=net_2_0 mcs-do-compiler-tests
|
||||
|
||||
bootstrap-world: compiler-tests
|
||||
$(MAKE) install
|
||||
|
||||
bootstrap-world-net_2_0: compiler-tests-net_2_0
|
||||
$(MAKE) install
|
||||
|
||||
# internal targets
|
||||
mcs-do-clean:
|
||||
cd runtime && $(MAKE) clean-local
|
||||
cd mono/tests && $(MAKE) clean
|
||||
|
||||
tmpinst-mcs-basic-build: mcs-do-basic-build tmpinst-dir
|
||||
mv -f $(MCS_BASIC_FILES) $(tmpinst)/lib
|
||||
|
||||
tmpinst-mcs-short-build: mcs-do-short-build tmpinst-dir
|
||||
mv -f $(MCS_FILES) $(tmpinst)/lib
|
||||
|
||||
tmpinst-mcs-full-build: mcs-do-full-build tmpinst-dir
|
||||
cp -f $(MCS_FILES) $(tmpinst)/lib
|
||||
|
||||
tmpinst-monolite: tmpinst-dir
|
||||
-rm -f $(tmpinst)/lib/mcs.exe $(tmpinst)/lib/*.dll
|
||||
-rm -fr $(tmpinst)/monolite-*
|
||||
srcdir=`cd $(srcdir) && pwd` && cd $(tmpinst) && ( gzip -d -c $$srcdir/../monolite-latest.tar.gz | tar xf - )
|
||||
mv -f $(tmpinst)/monolite-*/mcs.exe $(tmpinst)/monolite-*/*.dll $(tmpinst)/lib
|
||||
rm -fr $(tmpinst)/monolite-*
|
||||
|
||||
# Build enough of 'mono' to run the stage1 mcs.exe
|
||||
mono-do-runtime-only: $(CONFIG_HEADER)
|
||||
for dir in $(libgc_dir) mono data; do \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
done
|
||||
|
||||
mcs-do-basic-build:
|
||||
rm -f $(MCS_FILES)
|
||||
for dir in $(MCS_BASIC_DIRS); do \
|
||||
(cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default NO_SIGN_ASSEMBLY=yes USE_BOOT_COMPILE=yes BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB") || exit 1 ; \
|
||||
done
|
||||
|
||||
mcs-do-short-build:
|
||||
tmpinst=`cd $(tmpinst) && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH; export PATH ; \
|
||||
for dir in $(MCS_DIRS); do \
|
||||
(cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default NO_SIGN_ASSEMBLY=yes) || exit 1 ; \
|
||||
done
|
||||
|
||||
mcs-do-full-build:
|
||||
tmpinst=`cd $(tmpinst) && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd $(mcs_topdir) && $(MAKE) NO_SIGN_ASSEMBLY=yes all-profiles
|
||||
|
||||
mcs-do-clean-profiles:
|
||||
cd $(mcs_topdir) && $(MAKE) clean-profiles
|
||||
|
||||
mcs-do-run-test-profiles: tmpinst-dir $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm $(tmpinst)/bin/pedump
|
||||
tmpinst=`cd $(tmpinst) && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd $(mcs_topdir) && $(MAKE) run-test-profiles
|
||||
|
||||
mcs-do-compiler-tests:
|
||||
cd runtime && $(MAKE) test_select='TEST_SUBDIRS="tests errors"' check-local
|
||||
cd mono/tests && $(MAKE) check
|
||||
tmpinst=`cd $(tmpinst) && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd $(mcs_topdir) && $(MAKE) compiler-tests
|
||||
|
||||
populate-runtime-subdir:
|
||||
test -n '$(populate_profiles)'
|
||||
@srcdir=`cd $(srcdir) && pwd`; tmpinst=`pwd`/$(tmpinst) ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
for profile in $(populate_profiles); do \
|
||||
( set fnord `echo $$profile | sed 's,:, ,g'` && \
|
||||
echo "cd $(mcs_topdir) && $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install" && \
|
||||
cd $(mcs_topdir) && \
|
||||
$(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install ) || exit 1 ; \
|
||||
done
|
||||
find $(tmpinst)/prefix -type f -name '*jay*' -exec rm -f '{}' ';'
|
||||
for i in `find $(tmpinst)/prefix -type d -name '*jay*' -print`; do rm -f $$i/*; done
|
||||
test -z "`find $(tmpinst)/prefix -type f -print`"
|
||||
rm -rf $(tmpinst)/prefix
|
||||
|
||||
tmpinst-dir:
|
||||
mkdir -p $(tmpinst) $(tmpinst)/bin $(tmpinst)/lib $(tmpinst)/etc/mono/1.0 $(tmpinst)/etc/mono/2.0
|
||||
$(MAKE) tmpinst-dir-contents
|
||||
|
||||
tmpinst-dir-contents: $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/etc/mono/1.0/machine.config $(tmpinst)/etc/mono/2.0/machine.config
|
||||
|
||||
if PLATFORM_WIN32
|
||||
|
||||
$(tmpinst)/bin/mono: $(srcdir)/Makefile.am
|
||||
echo '#! /bin/sh' > $@
|
||||
echo 'builddir="'`pwd`'"; win_builddir="'`cygpath -w -a .`'"' >> $@
|
||||
echo 'tmpinst="$$win_builddir\\$(tmpinst)"' >> $@
|
||||
echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="$$tmpinst\\lib"; else MONO_PATH="$${MONO_PATH};$$tmpinst\\lib" ; fi' >> $@
|
||||
echo 'MONO_CFG_DIR="$$tmpinst\\etc"' >> $@
|
||||
echo 'export MONO_PATH MONO_CFG_DIR' >> $@
|
||||
echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime).exe" "$$@"' >> $@
|
||||
chmod +x $@
|
||||
|
||||
else
|
||||
|
||||
$(tmpinst)/bin/mono: $(srcdir)/Makefile.am
|
||||
echo '#! /bin/sh' > $@
|
||||
echo 'builddir="'`pwd`'"; tmpinst=$$builddir/$(tmpinst)' >> $@
|
||||
echo 'if test -z "$$MONO_PATH" ; then MONO_PATH=$$tmpinst/lib; else MONO_PATH=$${MONO_PATH}:$$tmpinst/lib ; fi' >> $@
|
||||
echo 'MONO_CFG_DIR=$$tmpinst/etc' >> $@
|
||||
echo 'export MONO_PATH MONO_CFG_DIR' >> $@
|
||||
echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime)" --config "$$builddir/data/config" "$$@"' >> $@
|
||||
chmod +x $@
|
||||
|
||||
endif
|
||||
|
||||
$(tmpinst)/bin/pedump: $(srcdir)/Makefile.am
|
||||
(b=`pwd`; echo '#! /bin/sh'; echo 'exec "'"$$b/libtool"'" --mode=execute "'"$$b/mono/metadata/pedump"'" "$$@"') > $@
|
||||
chmod +x $@
|
||||
|
||||
$(tmpinst)/bin/mcs: $(srcdir)/Makefile.am
|
||||
(t=`cd $(tmpinst) && pwd`; echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$t/lib/mcs.exe"'" "$$@"') > $@
|
||||
chmod +x $@
|
||||
|
||||
# Used only by 'bootstrap-check' -- so, can safely use runtime/.
|
||||
$(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm: $(srcdir)/Makefile.am
|
||||
t=`cd $(tmpinst) && pwd`; r=`cd $(srcdir)/runtime && pwd`; \
|
||||
( echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$r/$(@F).exe"'" "$$@"' ) > $@
|
||||
chmod +x $@
|
||||
|
||||
$(tmpinst)/etc/mono/1.0/machine.config: $(srcdir)/data/net_1_1/machine.config
|
||||
rm -f $@
|
||||
srcdir=`cd $(srcdir) && pwd`; cd $(tmpinst)/etc/mono/1.0 && $(LN_S) $$srcdir/data/net_1_1/machine.config machine.config
|
||||
|
||||
$(tmpinst)/etc/mono/2.0/machine.config: $(srcdir)/data/net_2_0/machine.config
|
||||
rm -f $@
|
||||
srcdir=`cd $(srcdir) && pwd`; cd $(tmpinst)/etc/mono/2.0 && $(LN_S) $$srcdir/data/net_2_0/machine.config machine.config
|
||||
|
||||
# Obsolete target -- don't use.
|
||||
.PHONY: fullbuild
|
||||
fullbuild: bootstrap
|
||||
$(MAKE) install
|
||||
echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
|
||||
exit 1
|
||||
|
||||
win32getdeps:
|
||||
wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
|
||||
@@ -77,16 +245,14 @@ win32getdeps:
|
||||
wget http://www.go-mono.com/archive/libiconv-1.7.zip
|
||||
wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip
|
||||
wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
|
||||
wget http://www.jroith.de/nsis4cygwin.zip
|
||||
unzip -n -d / pkgconfig-0.11-20020310.zip
|
||||
unzip -n -d / glib-2.0.4-20020703.zip
|
||||
unzip -n -d / glib-dev-2.0.4-20020703.zip
|
||||
unzip -n -d / libiconv-1.7.zip
|
||||
unzip -n -d / libiconv-dev-1.7.zip
|
||||
unzip -n -d / libintl-0.10.40-20020101.zip
|
||||
unzip -n -d / nsis4cygwin.zip
|
||||
|
||||
win32setup:
|
||||
makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
|
||||
|
||||
bootstrap: all
|
||||
@echo "*** 'make bootstrap' is obsolete. Just run 'make' to perform a combined mono+mcs build"
|
||||
exit 1
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
This is Mono.
|
||||
|
||||
1. Installation
|
||||
2. Using Mono
|
||||
3. Directory Roadmap
|
||||
1. Installation
|
||||
2. Using Mono
|
||||
3. Directory Roadmap
|
||||
|
||||
1. Compilation and Installation
|
||||
===============================
|
||||
@@ -17,30 +17,23 @@ This is Mono.
|
||||
|
||||
Available from: http://www.freedesktop.org/Software/pkgconfig
|
||||
|
||||
* glib 2.4
|
||||
* glib 2.0
|
||||
|
||||
Available from: http://www.gtk.org/
|
||||
|
||||
On Itanium, you must obtain libunwind:
|
||||
|
||||
http://www.hpl.hp.com/research/linux/libunwind/download.php4
|
||||
|
||||
On Solaris, make sure that you used GNU tar to unpack this package, as
|
||||
Solaris tar will not unpack this correctly, and you will get strange errors.
|
||||
|
||||
On Solaris, make sure that you use the GNU toolchain to build the software.
|
||||
|
||||
Optional dependencies:
|
||||
|
||||
* libgdiplus
|
||||
* ICU library
|
||||
|
||||
http://oss.software.ibm.com/icu/index.html
|
||||
|
||||
You will need this one to get complete support for the international
|
||||
features of the .NET Framework.
|
||||
|
||||
* Cairo and libgdiplus
|
||||
|
||||
If you want to get support for System.Drawing, you will need to get
|
||||
Libgdiplus.
|
||||
|
||||
* libzlib
|
||||
|
||||
This library and the development headers are required for compression
|
||||
file support in the 2.0 profile.
|
||||
both Libgdiplus and Cairo.
|
||||
|
||||
b. Building the Software
|
||||
------------------------
|
||||
@@ -52,8 +45,13 @@ This is Mono.
|
||||
make
|
||||
make install
|
||||
|
||||
Mono supports a JIT engine on x86, SPARC, SPARCv9, S/390, AMD64, ARM
|
||||
and PowerPC systems.
|
||||
Mono supports a JIT engine on x86, SPARC and PowerPC systems.
|
||||
The various commands that ship with Mono default to the JIT engine
|
||||
on x86 and SPARC, to turn it on for PPC systems, use the --with-jit=yes
|
||||
command line option to configure.
|
||||
|
||||
MacOS X Users: you will need to download the latest Boehm GC
|
||||
Alpha release for garbage collection to work properly.
|
||||
|
||||
If you obtained this as a snapshot, you will need an existing
|
||||
Mono installation. To upgrade your installation, unpack both
|
||||
@@ -65,263 +63,119 @@ This is Mono.
|
||||
mv mcs-XXX mcs
|
||||
cd mono
|
||||
./autogen.sh --prefix=/usr/local
|
||||
make
|
||||
make bootstrap
|
||||
|
||||
c. Building the software from SVN
|
||||
c. Building the software from CVS
|
||||
---------------------------------
|
||||
|
||||
If you are building the software from SVN, make sure that you
|
||||
If you are building the software from CVS, make sure that you
|
||||
have up-to-date mcs and mono sources:
|
||||
|
||||
svn co svn+ssh://[email protected]/source/trunk/mono
|
||||
svn co svn+ssh://[email protected]/source/trunk/mcs
|
||||
cvs co mono mcs
|
||||
|
||||
Then, go into the mono directory, and configure:
|
||||
|
||||
cd mono
|
||||
./autogen.sh --prefix=/usr/local
|
||||
make
|
||||
|
||||
Depending on whether you have an existing Mono installation or
|
||||
not, you can try the following:
|
||||
|
||||
i. If you have an existing Mono installation
|
||||
-----------------------------------------
|
||||
|
||||
First verify that you have a working installation:
|
||||
|
||||
echo 'class X { static void Main () { System.Console.Write("OK");}}' > x.cs
|
||||
|
||||
Compile:
|
||||
|
||||
mcs x.cs
|
||||
|
||||
And run:
|
||||
|
||||
mono x.exe
|
||||
|
||||
If you get the output `OK' and no errors, and you have mono
|
||||
version 0.31 or later, continue. Otherwise, you can try option
|
||||
(ii) below.
|
||||
|
||||
You are ready to start your CVS upgrade. Compile with
|
||||
|
||||
make bootstrap
|
||||
|
||||
This will automatically go into the mcs/ tree and build the
|
||||
binaries there.
|
||||
binaries there, and copy them into the appropriate
|
||||
sub-directories of mono/runtime/.
|
||||
|
||||
This assumes that you have a working mono installation, and that
|
||||
there's a C# compiler named 'mcs', and a corresponding IL
|
||||
runtime called 'mono'. You can use two make variables
|
||||
EXTERNAL_MCS and EXTERNAL_RUNTIME to override these. e.g., you
|
||||
can say
|
||||
Now, go to step (iii) below.
|
||||
|
||||
make EXTERNAL_MCS=/foo/bar/mcs EXTERNAL_RUNTIME=/somewhere/else/mono
|
||||
|
||||
If you don't have a working Mono installation
|
||||
---------------------------------------------
|
||||
ii. If you don't have a working Mono installation
|
||||
---------------------------------------------
|
||||
|
||||
If you don't have a working Mono installation, an obvious choice
|
||||
is to install the latest released packages of 'mono' for your
|
||||
distribution and running autogen.sh; make; make install in the
|
||||
mono module directory.
|
||||
distribution and go back to step (i).
|
||||
|
||||
You can also try a slightly more risky approach: this may not work,
|
||||
so start from the released tarball as detailed above.
|
||||
You can also try a slightly more risky approach that should work
|
||||
almost all the time.
|
||||
|
||||
This works by first getting the latest version of the 'monolite'
|
||||
distribution, which contains just enough to run the 'mcs'
|
||||
compiler. You do this with:
|
||||
compiler. You do this by
|
||||
|
||||
make get-monolite-latest
|
||||
|
||||
This will download and automatically gunzip and untar the
|
||||
tarball, and place the files appropriately so that you can then
|
||||
just run:
|
||||
This should place a monolite-latest.tar.gz in the parent
|
||||
directory of the 'mono' source tree. You can then run:
|
||||
|
||||
make
|
||||
make monolite-bootstrap
|
||||
|
||||
To ensure that you're using the 'monolite' distribution, you can
|
||||
also try passing EXTERNAL_MCS=false on the make command-line.
|
||||
This will automatically gunzip and untar the tarball, place the
|
||||
files appropriately, and then complete the bootstrap.
|
||||
|
||||
Testing and Installation
|
||||
------------------------
|
||||
iii. Testing and Installation
|
||||
------------------------
|
||||
|
||||
You can run (part of) the mono and mcs testsuites with the command:
|
||||
You can run the mono and mcs testsuites with the command:
|
||||
|
||||
make check
|
||||
make -k bootstrap-check
|
||||
|
||||
All tests should pass.
|
||||
|
||||
If you want more extensive tests, including those that test the
|
||||
class libraries, you need to re-run 'configure' with the
|
||||
'--enable-nunit-tests' flag, and try
|
||||
|
||||
make -k check
|
||||
|
||||
Expect to find a few testsuite failures. As a sanity check, you
|
||||
can compare the failures you got with
|
||||
Expect to find several testsuite failures, especially in the
|
||||
mcs/ tree. As a sanity check, you can compare the failures you
|
||||
got with
|
||||
|
||||
http://go-mono.com/tests/displayTestResults.php
|
||||
|
||||
You can now install mono with:
|
||||
You can now install it:
|
||||
|
||||
make install
|
||||
|
||||
Failure to follow these steps may result in a broken installation.
|
||||
Failure to follow these steps will result in a broken installation.
|
||||
|
||||
d. Common Configuration Options
|
||||
-------------------------------
|
||||
iv. Other useful "bootstrap"-like facilities
|
||||
----------------------------------------
|
||||
|
||||
The following are the configuration options that someone
|
||||
building Mono might want to use:
|
||||
|
||||
If you have a CVS snapshot that you keep updating periodically,
|
||||
and/or do your development in, you may try using a couple of
|
||||
specialty make targets that may be slightly faster than a
|
||||
"make bootstrap".
|
||||
|
||||
--with-gc=[boehm, included, sgen, none]
|
||||
You can try a two-stage bootstrap with:
|
||||
|
||||
Selects the garbage collector engine to use, the
|
||||
default is the "included" value.
|
||||
|
||||
included:
|
||||
This is the default value, and its
|
||||
the most feature complete, it will allow Mono
|
||||
to use typed allocations and support the
|
||||
debugger.
|
||||
make faststrap
|
||||
|
||||
It is essentially a slightly modified Boehm GC
|
||||
This assumes that you have already run a "make bootstrap" on the
|
||||
tree before.
|
||||
|
||||
boehm:
|
||||
This is used to use a system-install Boehm GC,
|
||||
it is useful to test new features available in
|
||||
Boehm GC, but we do not recommend that people
|
||||
use this, as it disables a few features.
|
||||
If you want to avoid waiting even for that, you can try the
|
||||
riskier one-stage build:
|
||||
|
||||
sgen:
|
||||
The under-development Generational GC for
|
||||
Mono, do not use this in production.
|
||||
|
||||
none:
|
||||
Disables the inclusion of a garbage
|
||||
collector.
|
||||
|
||||
--with-tls=__thread,pthread
|
||||
|
||||
Controls how Mono should access thread local storage,
|
||||
pthread forces Mono to use the pthread APIs, while
|
||||
__thread uses compiler-optimized access to it.
|
||||
|
||||
Although __thread is faster, it requires support from
|
||||
the compiler, kernel and libc. Old Linux systems do
|
||||
not support with __thread.
|
||||
|
||||
This value is typically pre-configured and there is no
|
||||
need to set it, unless you are trying to debug a
|
||||
problem.
|
||||
|
||||
--with-sigaltstack=yes,no
|
||||
|
||||
This controls whether Mono will install a special
|
||||
signal handler to handle stack overflows. If set to
|
||||
"yes", it will turn stack overflows into the
|
||||
StackOverflowException. Otherwise when a stack
|
||||
overflow happens, your program will receive a
|
||||
segmentation fault.
|
||||
|
||||
The configure script will try to detect if your
|
||||
operating system supports this. Some older Linux
|
||||
systems do not support this feature, or you might want
|
||||
to override the auto-detection.
|
||||
|
||||
--with-static-mono=yes,no
|
||||
|
||||
This controls whether `mono' should link against a
|
||||
static library (libmono.a) or a shared library
|
||||
(libmono.so).
|
||||
|
||||
This defaults to yes, and will improve the performance
|
||||
of the `mono' program.
|
||||
|
||||
This only affects the `mono' binary, the shared
|
||||
library libmono.so will always be produced for
|
||||
developers that want to embed the runtime in their
|
||||
application.
|
||||
|
||||
--with-xen-opt=yes,no
|
||||
|
||||
The default value for this is `yes', and it makes Mono
|
||||
generate code which might be slightly slower on
|
||||
average systems, but the resulting executable will run
|
||||
faster under the Xen virtualization system.
|
||||
|
||||
--with-large-heap=yes,no
|
||||
|
||||
Enable support for GC heaps larger than 3GB.
|
||||
|
||||
This value is set to `no' by default.
|
||||
|
||||
--with-ikvm-native=yes,no
|
||||
|
||||
Controls whether the IKVM JNI interface library is
|
||||
built or not. This is used if you are planning on
|
||||
using the IKVM Java Virtual machine with Mono.
|
||||
|
||||
This defaults to `yes'.
|
||||
|
||||
--with-preview=yes,no
|
||||
|
||||
Whether you want to build libraries that are still not
|
||||
completed (The 2.0 APIs). It defaults to `yes'.
|
||||
|
||||
--with-libgdiplus=installed,sibling,<path>
|
||||
|
||||
This is used to configure where should Mono look for
|
||||
libgdiplus when running the System.Drawing tests.
|
||||
|
||||
It defaults to `installed', which means that the
|
||||
library is available to Mono through the regular
|
||||
system setup.
|
||||
|
||||
`sibling' can be used to specify that a libgdiplus
|
||||
that resides as a sibling of this directory (mono)
|
||||
should be used.
|
||||
|
||||
Or you can specify a path to a libgdiplus.
|
||||
|
||||
--enable-minimal=LIST
|
||||
|
||||
Use this feature to specify optional runtime
|
||||
components that you might not want to include. This
|
||||
is only useful for developers embedding Mono that
|
||||
require a subset of Mono functionality.
|
||||
|
||||
The list is a comma-separated list of components that
|
||||
should be removed, these are:
|
||||
|
||||
aot:
|
||||
Disables support for the Ahead of Time
|
||||
compilation.
|
||||
|
||||
profiler:
|
||||
Disables support for the default profiler.
|
||||
|
||||
decimal:
|
||||
Disables support for System.Decimal.
|
||||
|
||||
pinvoke:
|
||||
Support for Platform Invocation services,
|
||||
disabling this will drop support for any
|
||||
libraries using DllImport.
|
||||
|
||||
debug:
|
||||
Drop debugging support.
|
||||
|
||||
reflection_emit:
|
||||
Drop System.Reflection.Emit support
|
||||
|
||||
large_code:
|
||||
Disables support for large assemblies.
|
||||
|
||||
logging:
|
||||
Disables support for debug logging.
|
||||
|
||||
com:
|
||||
Disables COM support.
|
||||
|
||||
ssa:
|
||||
Disables compilation for the SSA optimization
|
||||
framework, and the various SSA-based
|
||||
optimizations.
|
||||
|
||||
generics:
|
||||
Generics support. Disabling this will not
|
||||
allow Mono to run any 2.0 libraries or
|
||||
code that contains generics.
|
||||
|
||||
--disable-dev-random
|
||||
|
||||
Mono uses /dev/random to obtain good random data for
|
||||
any source that requires random numbers. If your
|
||||
system does not support this, you might want to
|
||||
disable it.
|
||||
|
||||
There are a number of runtime options to control this
|
||||
also, see the man page.
|
||||
make fasterstrap
|
||||
|
||||
This should be attempted only if you're sure that the sources of
|
||||
the mcs compiler itself and the sources of the libraries used by
|
||||
it have not been changed.
|
||||
|
||||
2. Using Mono
|
||||
=============
|
||||
@@ -331,6 +185,8 @@ This is Mono.
|
||||
* runtime engine
|
||||
|
||||
mono program.exe
|
||||
or
|
||||
mint program.exe
|
||||
|
||||
* C# compiler
|
||||
|
||||
@@ -346,6 +202,9 @@ This is Mono.
|
||||
3. Directory Roadmap
|
||||
====================
|
||||
|
||||
doc/
|
||||
Contains the web site contents.
|
||||
|
||||
docs/
|
||||
Technical documents about the Mono runtime.
|
||||
|
||||
@@ -358,7 +217,7 @@ This is Mono.
|
||||
metadata/
|
||||
The object system and metadata reader.
|
||||
|
||||
mini/
|
||||
jit/
|
||||
The Just in Time Compiler.
|
||||
|
||||
dis/
|
||||
@@ -376,7 +235,7 @@ This is Mono.
|
||||
definition of the CIL bytecodes.
|
||||
|
||||
interp/
|
||||
Interpreter for CLI executables (obsolete).
|
||||
Interpreter for CLI executables.
|
||||
|
||||
arch/
|
||||
Architecture specific portions.
|
||||
@@ -391,6 +250,7 @@ This is Mono.
|
||||
|
||||
runtime/
|
||||
|
||||
A directory that contains the Makefiles that link the
|
||||
mono/ and mcs/ build systems.
|
||||
A directory holding a pre-compiled version of the Mono
|
||||
runtime.
|
||||
|
||||
|
||||
-120
@@ -1,120 +0,0 @@
|
||||
README.vsnet Last updated: 2006-02-01
|
||||
|
||||
|
||||
SVN includes a Visual Studio .NET 2005 solution, mono.sln, and some
|
||||
projects files to build most of the unmanaged parts in Mono.
|
||||
|
||||
The "mono.sln" solution file contains the VC projects files for:
|
||||
|
||||
* Embedded Samples
|
||||
* test-invoke.vcproj
|
||||
* test-metadata.vcproj
|
||||
* teste.vcproj
|
||||
* Libraries
|
||||
* libgc.vcproj
|
||||
* libmono.vcproj
|
||||
* Tools
|
||||
* genmdesc.vcproj
|
||||
* monoburg.vcproj
|
||||
* monodiet.vcproj
|
||||
* monodis.vcproj
|
||||
* monograph.vcproj
|
||||
* pedump.vcproj
|
||||
* mono.vcproj
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
|
||||
* A working (i.e. where you could succesfully build mono) cygwin
|
||||
(http://www.cygwin.com/) setup! This is required to:
|
||||
* generate some files (via monoburg and genmdesc);
|
||||
* build the class libraries; and
|
||||
* test for regressions.
|
||||
|
||||
* Visual Studio .NET 2005. Previous Visual Studio versions may work or
|
||||
requires, hopefully minimal, changes.
|
||||
|
||||
* VSDependencies.zip must be decompressed under the /mono/ directory
|
||||
(otherwise you will need to edit all the projects files). This file can
|
||||
be downloaded from http://www.go-mono.com/archive/VSDependencies.zip
|
||||
|
||||
|
||||
LOCAL CHANGES
|
||||
|
||||
Sadly solution/projects files aren't easy to move from computers to
|
||||
computers (well unless everyone follow the same naming convention) so
|
||||
you'll likely have to changes some options in order to compile the
|
||||
solution.
|
||||
|
||||
* each executed assembly (i.e. the EXE) must be able to find a
|
||||
working mscorlib.dll (and all the other required assemblies).
|
||||
This can be done in different ways. My preference is to use the
|
||||
project "properties pages" in the "Configuration Properties
|
||||
\Debugging\Environment" options and set MONO_PATH to the class
|
||||
libraries directory build by cygwin (local) or on Linux
|
||||
(remote).
|
||||
|
||||
e.g. MONO_PATH=z:\svn\mcs\class\lib\default\
|
||||
allows me to use the class libs build under Linux, while
|
||||
MONO_PATH=C:\cygwin\opt\mono\lib\mono\1.0
|
||||
use the one built from cygwin (after a make install)
|
||||
|
||||
Some useful informations to adapt the solution/project files...
|
||||
|
||||
* My cygwin root dir is: c:\cygwin\
|
||||
* My username is: poupou
|
||||
* My mono install prefix is: /opt/mono
|
||||
|
||||
|
||||
BUILDING
|
||||
|
||||
Once everything is installed (and edited) you can right-click on the
|
||||
"mono" solution (in the "Solution Explorer"), select "Clean
|
||||
Solution" (for the first time) then "Build Solution".
|
||||
|
||||
|
||||
KNOWN ISSUES
|
||||
|
||||
[1] Most, BUT NOT ALL, the regressions tests pass under this build. The
|
||||
failures seems limited to some mathematical differences and to code
|
||||
relying on the stack walking functions. The hacks to replace the GCC
|
||||
functions (__builtin_frame_address and __builtin_return_address) are
|
||||
incomplete;
|
||||
|
||||
[2] The solution doesn't provide complete (i.e. from scratch) build. It
|
||||
requires a working cygwin environment to create some files (e.g. via
|
||||
genmdesc, monoburg). This isn't so bad as without cygwin you wouldn't be
|
||||
able to test Mono properly (see REQUIREMENTS);
|
||||
|
||||
[3] Only the Debug target is configured properly (that would be easy to
|
||||
fix, but would require turning off some optimizations like omitting
|
||||
stack frames). Anyway there are other issues [1] to fix before switching
|
||||
to Release and IMHO the _biggest_ advantage to VS.NET is it's debugger/
|
||||
debugging tools;
|
||||
|
||||
[4] The C compiler emits _lots_ of warning during compilation. Some
|
||||
warnings have been turned off for some projects (there was so much that
|
||||
it slowed down compilation). You can bring them back (or hide more of
|
||||
them) using the project "properties pages" windows, "Configuration
|
||||
Properties\C/C++\Advanced\Disable Specific Warnings";
|
||||
|
||||
[5] Visual Studio 2005 should have all the latest header files required,
|
||||
but if not (or if you're using an older version of VS) then install MS
|
||||
Platform SDK (Windows Server 2003 is the latest) to ensure you have the
|
||||
latest Windows header files. You can download it from:
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
|
||||
|
||||
[6] Not everyone has VS.NET so it is possible you may have to add some
|
||||
(new) files to the build from time to time. See "more informations" for
|
||||
reporting those changes.
|
||||
|
||||
[7] Probably a lot more I didn't discover... or has changed since.
|
||||
|
||||
|
||||
MORE INFORMATION
|
||||
|
||||
Please email <[email protected]> if you have any problem
|
||||
and/or if there's something wrong/missing in the instructions.
|
||||
|
||||
An online version of this file is available at
|
||||
http://www.mono-project.com/Compiling_Mono_VSNET
|
||||
@@ -5,7 +5,6 @@
|
||||
#undef HAVE_SOL_TCP
|
||||
#undef HAVE_SOL_IPV6
|
||||
#undef HAVE_IP_PKTINFO
|
||||
#undef HAVE_IPV6_PKTINFO
|
||||
#undef HAVE_STRUCT_IP_MREQN
|
||||
#undef HAVE_STRUCT_IP_MREQ
|
||||
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
|
||||
+222
-753
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,4 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
config
|
||||
.cvsignore
|
||||
+1
-1
@@ -3,7 +3,7 @@ SUBDIRS = net_1_1 net_2_0
|
||||
monodir = $(sysconfdir)/mono
|
||||
|
||||
EXTRA_DIST = config.in \
|
||||
browscap.ini mono.supp README
|
||||
browscap.ini
|
||||
|
||||
mono_DATA = config \
|
||||
browscap.ini
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
Files in this directory:
|
||||
|
||||
config.in, config:
|
||||
These files are installed into $prefix/etc/mono and
|
||||
contain the global mappings of dllnames into native
|
||||
library names.
|
||||
|
||||
browscap.ini
|
||||
This file contains the browser capabilty database,
|
||||
this is used by ASP.NET to determine in a per-browser
|
||||
basis what kind of features it can depend on when
|
||||
producing the HTML code.
|
||||
|
||||
mono.supp
|
||||
This is a valgrind data file, it lists the warnings
|
||||
that should be supressed when reporting Mono-related
|
||||
errors.
|
||||
|
||||
net_1_1 and net_2_0
|
||||
They contain profile-specific data files
|
||||
+5454
-7832
File diff suppressed because it is too large.
Load diff
+2
-10
@@ -1,18 +1,10 @@
|
||||
<configuration>
|
||||
<dllmap dll="cygwin1.dll" target="@LIBC@" />
|
||||
<dllmap dll="libc" target="@LIBC@" />
|
||||
<dllmap dll="intl" target="@INTL@" />
|
||||
<dllmap dll="libintl" target="@INTL@" />
|
||||
<dllmap dll="libxslt.dll" target="libxslt@libsuffix@" />
|
||||
<dllmap dll="libmySQL.dll" target="libmysqlclient@libsuffix@" />
|
||||
<dllmap dll="odbc32.dll" target="libodbc@libsuffix@" />
|
||||
<dllmap os="osx" dll="odbc32.dll" target="libiodbc.dylib" />
|
||||
<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
|
||||
<dllmap dll="db2cli" target="libdb2_36@libsuffix@" />
|
||||
<dllmap dll="msvcrt" target="@LIBC@" />
|
||||
<dllmap dll="MonoPosixHelper" target="libMonoPosixHelper@libsuffix@" />
|
||||
<dllmap dll="sqlite" target="@SQLITE@" />
|
||||
<dllmap dll="sqlite3" target="@SQLITE3@" />
|
||||
<dllmap dll="libX11" target="@X11@" />
|
||||
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" />
|
||||
<dllmap dll="oci" target="clntsh" />
|
||||
<dllmap dll="db2cli" target="libdb2_36@libsuffix@"/>
|
||||
</configuration>
|
||||
@@ -1,40 +0,0 @@
|
||||
##
|
||||
## mono-specific suppressions (Boehm-GC) for use with valgrind
|
||||
##
|
||||
|
||||
{
|
||||
mono - Conditional jump or move depends on uninitialised value
|
||||
Memcheck:Cond
|
||||
fun:GC_*
|
||||
fun:*
|
||||
obj:*mono
|
||||
}
|
||||
{
|
||||
mono - Use of uninitialized value of size 4
|
||||
Memcheck:Value4
|
||||
fun:GC_*
|
||||
fun:*
|
||||
obj:*mono
|
||||
}
|
||||
{
|
||||
mono - Use of uninitialized value of size 8
|
||||
Memcheck:Value8
|
||||
fun:GC_*
|
||||
fun:*
|
||||
obj:*mono
|
||||
}
|
||||
{
|
||||
mono - Use of uninitialized value of size 1
|
||||
Memcheck:Value1
|
||||
fun:GC_*
|
||||
fun:*
|
||||
obj:*mono
|
||||
}
|
||||
{
|
||||
mono - Invalid read of size 4
|
||||
Memcheck:Addr4
|
||||
fun:GC_*
|
||||
fun:*
|
||||
obj:*mono
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -337,9 +337,7 @@ string GetTestResult ()
|
||||
|
||||
try
|
||||
{
|
||||
string url = location + "/" + CurrentOperationName;
|
||||
Uri uri = new Uri (url);
|
||||
WebRequest req = WebRequest.Create (url + "?" + qs);
|
||||
WebRequest req = WebRequest.Create (location + "/" + CurrentOperationName + "?" + qs);
|
||||
HttpCookieCollection cookies = Request.Cookies;
|
||||
int last = cookies.Count;
|
||||
if (last > 0) {
|
||||
@@ -347,7 +345,7 @@ string GetTestResult ()
|
||||
for (int i = 0; i < last; i++) {
|
||||
HttpCookie hcookie = cookies [i];
|
||||
Cookie cookie = new Cookie (hcookie.Name, hcookie.Value, hcookie.Path, hcookie.Domain);
|
||||
container.Add (uri, cookie);
|
||||
container.Add (cookie);
|
||||
}
|
||||
((HttpWebRequest) req).CookieContainer = container;
|
||||
}
|
||||
@@ -1586,7 +1584,7 @@ function clearForm ()
|
||||
<span class="bindingLabel"><%#FormatBindingName(DataBinder.Eval(Container.DataItem, "Name").ToString())%></span>
|
||||
<asp:repeater id="OperationsRepeater" runat=server datasource='<%# ((Binding)Container.DataItem).Operations %>'>
|
||||
<itemtemplate>
|
||||
<a class="method" href="<%=PageName%>?<%=GetTabContext("op",null)%>op=<%#GetOpName(Container.DataItem)%>&bnd=<%#DataBinder.Eval(Container.DataItem, "Binding.Name")%>"><%#GetOpName(Container.DataItem)%></a>
|
||||
<a class="method" href="<%#PageName%>?<%#GetTabContext("op",null)%>op=<%#GetOpName(Container.DataItem)%>&bnd=<%#DataBinder.Eval(Container.DataItem, "Binding.Name")%>"><%#GetOpName(Container.DataItem)%></a>
|
||||
<div class="smallSeparator"></div>
|
||||
</itemtemplate>
|
||||
</asp:repeater>
|
||||
@@ -1604,7 +1602,7 @@ function clearForm ()
|
||||
-->
|
||||
|
||||
<p class="label">Web Service Overview</p>
|
||||
<%=WebServiceDescription%>
|
||||
<%#WebServiceDescription%>
|
||||
|
||||
<%} if (DefaultBinding == null) {%>
|
||||
This service does not contain any public web method.
|
||||
@@ -1615,7 +1613,7 @@ This service does not contain any public web method.
|
||||
Operation description
|
||||
-->
|
||||
|
||||
<span class="operationTitle"><%=CurrentOperationName%></span>
|
||||
<span class="operationTitle"><%#CurrentOperationName%></span>
|
||||
<br><br>
|
||||
<% WriteTabs (); %>
|
||||
<br><br><br>
|
||||
@@ -1657,12 +1655,12 @@ This service does not contain any public web method.
|
||||
|
||||
<span class="label">Remarks</span>
|
||||
<div class="smallSeparator"></div>
|
||||
<%=OperationDocumentation%>
|
||||
<%#OperationDocumentation%>
|
||||
<br><br>
|
||||
<span class="label">Technical information</span>
|
||||
<div class="smallSeparator"></div>
|
||||
Format: <%=CurrentOperationFormat%>
|
||||
<br>Supported protocols: <%=CurrentOperationProtocols%>
|
||||
Format: <%#CurrentOperationFormat%>
|
||||
<br>Supported protocols: <%#CurrentOperationProtocols%>
|
||||
<% } %>
|
||||
|
||||
<!--
|
||||
@@ -1673,11 +1671,11 @@ This service does not contain any public web method.
|
||||
<% if (CurrentTab == "test") {
|
||||
if (CurrentOperationSupportsTest) {%>
|
||||
Enter values for the parameters and click the 'Invoke' button to test this method:<br><br>
|
||||
<form action="<%=PageName%>" method="GET">
|
||||
<input type="hidden" name="page" value="<%=CurrentPage%>">
|
||||
<input type="hidden" name="tab" value="<%=CurrentTab%>">
|
||||
<input type="hidden" name="op" value="<%=CurrentOperationName%>">
|
||||
<input type="hidden" name="bnd" value="<%=CurrentOperationBinding%>">
|
||||
<form action="<%#PageName%>" method="GET">
|
||||
<input type="hidden" name="page" value="<%#CurrentPage%>">
|
||||
<input type="hidden" name="tab" value="<%#CurrentTab%>">
|
||||
<input type="hidden" name="op" value="<%#CurrentOperationName%>">
|
||||
<input type="hidden" name="bnd" value="<%#CurrentOperationBinding%>">
|
||||
<input type="hidden" name="ext" value="testform">
|
||||
<table class="paramFormTable" cellspacing="0" cellpadding="3">
|
||||
<asp:repeater id="InputFormParamsRepeater" runat=server>
|
||||
@@ -1691,9 +1689,9 @@ This service does not contain any public web method.
|
||||
<tr><td></td><td><input class="button" type="submit" value="Invoke"> <input class="button" type="button" onclick="clearForm()" value="Clear"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<div id="testFormResult" style="display:<%= (HasFormResult?"block":"none") %>">
|
||||
<div id="testFormResult" style="display:<%# (HasFormResult?"block":"none") %>">
|
||||
The web service returned the following result:<br/><br/>
|
||||
<div class="codePanel"><%=GetTestResult()%></div>
|
||||
<div class="codePanel"><%#GetTestResult()%></div>
|
||||
</div>
|
||||
<% } else {%>
|
||||
The test form is not available for this operation because it has parameters with a complex structure.
|
||||
@@ -1713,25 +1711,25 @@ This service does not contain any public web method.
|
||||
<% if (IsOperationSupported ("Soap")) { %>
|
||||
<span class="label">Soap</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("Soap", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("Soap", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
<% if (IsOperationSupported ("HttpGet")) { %>
|
||||
<span class="label">HTTP Get</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpGet", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpGet", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
<% if (IsOperationSupported ("HttpPost")) { %>
|
||||
<span class="label">HTTP Post</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpPost", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpPost", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
|
||||
@@ -1741,21 +1739,21 @@ This service does not contain any public web method.
|
||||
**********************************************************
|
||||
Client Proxy
|
||||
-->
|
||||
<form action="<%=PageName%>" name="langForm" method="GET">
|
||||
<form action="<%#PageName%>" name="langForm" method="GET">
|
||||
Select the language for which you want to generate a proxy
|
||||
<input type="hidden" name="page" value="<%=CurrentPage%>">
|
||||
<input type="hidden" name="page" value="<%#CurrentPage%>">
|
||||
<SELECT name="lang" onchange="langForm.submit()">
|
||||
<%=GetOptionSel("cs",CurrentLanguage)%>C#</option>
|
||||
<%=GetOptionSel("vb",CurrentLanguage)%>Visual Basic</option>
|
||||
<%#GetOptionSel("cs",CurrentLanguage)%>C#</option>
|
||||
<%#GetOptionSel("vb",CurrentLanguage)%>Visual Basic</option>
|
||||
</SELECT>
|
||||
|
||||
</form>
|
||||
<br>
|
||||
<span class="label"><%=CurrentProxytName%></span>
|
||||
<a href="<%=PageName + "?code=" + CurrentLanguage%>">Download</a>
|
||||
<span class="label"><%#CurrentProxytName%></span>
|
||||
<a href="<%#PageName + "?code=" + CurrentLanguage%>">Download</a>
|
||||
<br><br>
|
||||
<div class="codePanel">
|
||||
<div class="code-<%=CurrentLanguage%>"><%=GetProxyCode ()%></div>
|
||||
<div class="code-<%#CurrentLanguage%>"><%#GetProxyCode ()%></div>
|
||||
</div>
|
||||
<%} else if (CurrentPage == "wsdl") {%>
|
||||
<!--
|
||||
@@ -1777,18 +1775,18 @@ This service does not contain any public web method.
|
||||
<%} else {%>
|
||||
<%}%>
|
||||
<br>
|
||||
<span class="label"><%=CurrentDocumentName%></span>
|
||||
<span class="label"><%#CurrentDocumentName%></span>
|
||||
<a href="<%=PageName + "?" + CurrentDocType + "=" + CurrentDocInd %>">Download</a>
|
||||
<br><br>
|
||||
<div class="codePanel">
|
||||
<div class="code-xml"><%=GenerateDocument ()%></div>
|
||||
<div class="code-xml"><%#GenerateDocument ()%></div>
|
||||
</div>
|
||||
|
||||
<%}%>
|
||||
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
</td>
|
||||
<td width="20px"></td>
|
||||
<td withd="20px"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -62,11 +62,9 @@
|
||||
<add type="System.Net.NtlmClient, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</authenticationModules>
|
||||
<defaultProxy>
|
||||
<proxy
|
||||
usesystemdefault = "true"
|
||||
bypassonlocal = "true"
|
||||
/>
|
||||
<!-- proxyaddress can also be set -->
|
||||
<proxy />
|
||||
<!-- bypassonlocal and proxyaddress are ok -->
|
||||
<!-- usessystemdefault is not supported -->
|
||||
</defaultProxy>
|
||||
<webRequestModules>
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
@@ -87,9 +85,7 @@
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.Config" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
@@ -127,7 +123,7 @@
|
||||
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||
</webServices>
|
||||
<webControls clientScriptsLocation="/web_scripts" />
|
||||
<compilation debug="false" defaultLanguage="c#" explicit="true" strict="false" >
|
||||
<compilation debug="false" defaultLanguage="c#">
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
@@ -146,13 +142,8 @@
|
||||
<add assembly="*" /> <!-- Add assemblies in bin directory -->
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<!--
|
||||
RequestLengthDiskThreshold is a 2.0 feature that we
|
||||
enable for 1.x too.
|
||||
-->
|
||||
<httpRuntime executionTimeout="90"
|
||||
maxRequestLength="4096"
|
||||
requestLengthDiskThreshold="256"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
@@ -208,20 +199,6 @@
|
||||
<system.drawing>
|
||||
</system.drawing>
|
||||
|
||||
<mscorlib>
|
||||
<cryptographySettings>
|
||||
<cryptoNameMapping>
|
||||
<cryptoClasses>
|
||||
<cryptoClass monoMD2="Mono.Security.Cryptography.MD2Managed, Mono.Security, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
|
||||
</cryptoClasses>
|
||||
<nameEntry name="MD2" class="monoMD2" />
|
||||
</cryptoNameMapping>
|
||||
<oidMap>
|
||||
<oidEntry OID="1.2.840.113549.2.2" name="MD2" />
|
||||
</oidMap>
|
||||
</cryptographySettings>
|
||||
</mscorlib>
|
||||
|
||||
<strongNames>
|
||||
<pubTokenMapping>
|
||||
<!-- ECMA key -->
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -344,9 +344,7 @@ string GetTestResult ()
|
||||
|
||||
try
|
||||
{
|
||||
string url = location + "/" + CurrentOperationName;
|
||||
Uri uri = new Uri (url);
|
||||
WebRequest req = WebRequest.Create (url + "?" + qs);
|
||||
WebRequest req = WebRequest.Create (location + "/" + CurrentOperationName + "?" + qs);
|
||||
HttpCookieCollection cookies = Request.Cookies;
|
||||
int last = cookies.Count;
|
||||
if (last > 0) {
|
||||
@@ -354,7 +352,7 @@ string GetTestResult ()
|
||||
for (int i = 0; i < last; i++) {
|
||||
HttpCookie hcookie = cookies [i];
|
||||
Cookie cookie = new Cookie (hcookie.Name, hcookie.Value, hcookie.Path, hcookie.Domain);
|
||||
container.Add (uri, cookie);
|
||||
container.Add (cookie);
|
||||
}
|
||||
((HttpWebRequest) req).CookieContainer = container;
|
||||
}
|
||||
@@ -1593,7 +1591,7 @@ function clearForm ()
|
||||
<span class="bindingLabel"><%#FormatBindingName(DataBinder.Eval(Container.DataItem, "Name").ToString())%></span>
|
||||
<asp:repeater id="OperationsRepeater" runat=server datasource='<%# ((Binding)Container.DataItem).Operations %>'>
|
||||
<itemtemplate>
|
||||
<a class="method" href="<%=PageName%>?<%=GetTabContext("op",null)%>op=<%#GetOpName(Container.DataItem)%>&bnd=<%#DataBinder.Eval(Container.DataItem, "Binding.Name")%>"><%#GetOpName(Container.DataItem)%></a>
|
||||
<a class="method" href="<%#PageName%>?<%#GetTabContext("op",null)%>op=<%#GetOpName(Container.DataItem)%>&bnd=<%#DataBinder.Eval(Container.DataItem, "Binding.Name")%>"><%#GetOpName(Container.DataItem)%></a>
|
||||
<div class="smallSeparator"></div>
|
||||
</itemtemplate>
|
||||
</asp:repeater>
|
||||
@@ -1611,7 +1609,7 @@ function clearForm ()
|
||||
-->
|
||||
|
||||
<p class="label">Web Service Overview</p>
|
||||
<%=WebServiceDescription%>
|
||||
<%#WebServiceDescription%>
|
||||
<br/><br/>
|
||||
<% if (ProfileViolations.Count > 0) { %>
|
||||
<p class="label">Basic Profile Conformance</p>
|
||||
@@ -1638,7 +1636,7 @@ This service does not contain any public web method.
|
||||
Operation description
|
||||
-->
|
||||
|
||||
<span class="operationTitle"><%=CurrentOperationName%></span>
|
||||
<span class="operationTitle"><%#CurrentOperationName%></span>
|
||||
<br><br>
|
||||
<% WriteTabs (); %>
|
||||
<br><br><br>
|
||||
@@ -1680,12 +1678,12 @@ This service does not contain any public web method.
|
||||
|
||||
<span class="label">Remarks</span>
|
||||
<div class="smallSeparator"></div>
|
||||
<%=OperationDocumentation%>
|
||||
<%#OperationDocumentation%>
|
||||
<br><br>
|
||||
<span class="label">Technical information</span>
|
||||
<div class="smallSeparator"></div>
|
||||
Format: <%=CurrentOperationFormat%>
|
||||
<br>Supported protocols: <%=CurrentOperationProtocols%>
|
||||
Format: <%#CurrentOperationFormat%>
|
||||
<br>Supported protocols: <%#CurrentOperationProtocols%>
|
||||
<% } %>
|
||||
|
||||
<!--
|
||||
@@ -1696,11 +1694,11 @@ This service does not contain any public web method.
|
||||
<% if (CurrentTab == "test") {
|
||||
if (CurrentOperationSupportsTest) {%>
|
||||
Enter values for the parameters and click the 'Invoke' button to test this method:<br><br>
|
||||
<form action="<%=PageName%>" method="GET">
|
||||
<input type="hidden" name="page" value="<%=CurrentPage%>">
|
||||
<input type="hidden" name="tab" value="<%=CurrentTab%>">
|
||||
<input type="hidden" name="op" value="<%=CurrentOperationName%>">
|
||||
<input type="hidden" name="bnd" value="<%=CurrentOperationBinding%>">
|
||||
<form action="<%#PageName%>" method="GET">
|
||||
<input type="hidden" name="page" value="<%#CurrentPage%>">
|
||||
<input type="hidden" name="tab" value="<%#CurrentTab%>">
|
||||
<input type="hidden" name="op" value="<%#CurrentOperationName%>">
|
||||
<input type="hidden" name="bnd" value="<%#CurrentOperationBinding%>">
|
||||
<input type="hidden" name="ext" value="testform">
|
||||
<table class="paramFormTable" cellspacing="0" cellpadding="3">
|
||||
<asp:repeater id="InputFormParamsRepeater" runat=server>
|
||||
@@ -1714,9 +1712,9 @@ This service does not contain any public web method.
|
||||
<tr><td></td><td><input class="button" type="submit" value="Invoke"> <input class="button" type="button" onclick="clearForm()" value="Clear"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<div id="testFormResult" style="display:<%= (HasFormResult?"block":"none") %>">
|
||||
<div id="testFormResult" style="display:<%# (HasFormResult?"block":"none") %>">
|
||||
The web service returned the following result:<br/><br/>
|
||||
<div class="codePanel"><%=GetTestResult()%></div>
|
||||
<div class="codePanel"><%#GetTestResult()%></div>
|
||||
</div>
|
||||
<% } else {%>
|
||||
The test form is not available for this operation because it has parameters with a complex structure.
|
||||
@@ -1736,25 +1734,25 @@ This service does not contain any public web method.
|
||||
<% if (IsOperationSupported ("Soap")) { %>
|
||||
<span class="label">Soap</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("Soap", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("Soap", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
<% if (IsOperationSupported ("HttpGet")) { %>
|
||||
<span class="label">HTTP Get</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpGet", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpGet", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
<% if (IsOperationSupported ("HttpPost")) { %>
|
||||
<span class="label">HTTP Post</span>
|
||||
<br/><br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpPost", true)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", true)%></div></div>
|
||||
<br/>
|
||||
<div class="codePanel"><div class="code-xml"><%=GenerateOperationMessages ("HttpPost", false)%></div></div>
|
||||
<div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", false)%></div></div>
|
||||
<br/>
|
||||
<% } %>
|
||||
|
||||
@@ -1764,21 +1762,21 @@ This service does not contain any public web method.
|
||||
**********************************************************
|
||||
Client Proxy
|
||||
-->
|
||||
<form action="<%=PageName%>" name="langForm" method="GET">
|
||||
<form action="<%#PageName%>" name="langForm" method="GET">
|
||||
Select the language for which you want to generate a proxy
|
||||
<input type="hidden" name="page" value="<%=CurrentPage%>">
|
||||
<input type="hidden" name="page" value="<%#CurrentPage%>">
|
||||
<SELECT name="lang" onchange="langForm.submit()">
|
||||
<%=GetOptionSel("cs",CurrentLanguage)%>C#</option>
|
||||
<%=GetOptionSel("vb",CurrentLanguage)%>Visual Basic</option>
|
||||
<%#GetOptionSel("cs",CurrentLanguage)%>C#</option>
|
||||
<%#GetOptionSel("vb",CurrentLanguage)%>Visual Basic</option>
|
||||
</SELECT>
|
||||
|
||||
</form>
|
||||
<br>
|
||||
<span class="label"><%=CurrentProxytName%></span>
|
||||
<a href="<%=PageName + "?code=" + CurrentLanguage%>">Download</a>
|
||||
<span class="label"><%#CurrentProxytName%></span>
|
||||
<a href="<%#PageName + "?code=" + CurrentLanguage%>">Download</a>
|
||||
<br><br>
|
||||
<div class="codePanel">
|
||||
<div class="code-<%=CurrentLanguage%>"><%=GetProxyCode ()%></div>
|
||||
<div class="code-<%#CurrentLanguage%>"><%#GetProxyCode ()%></div>
|
||||
</div>
|
||||
<%} else if (CurrentPage == "wsdl") {%>
|
||||
<!--
|
||||
@@ -1800,18 +1798,18 @@ This service does not contain any public web method.
|
||||
<%} else {%>
|
||||
<%}%>
|
||||
<br>
|
||||
<span class="label"><%=CurrentDocumentName%></span>
|
||||
<span class="label"><%#CurrentDocumentName%></span>
|
||||
<a href="<%=PageName + "?" + CurrentDocType + "=" + CurrentDocInd %>">Download</a>
|
||||
<br><br>
|
||||
<div class="codePanel">
|
||||
<div class="code-xml"><%=GenerateDocument ()%></div>
|
||||
<div class="code-xml"><%#GenerateDocument ()%></div>
|
||||
</div>
|
||||
|
||||
<%}%>
|
||||
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
</td>
|
||||
<td width="20px"></td>
|
||||
<td withd="20px"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,10 +1,8 @@
|
||||
monodir = $(sysconfdir)/mono/2.0
|
||||
|
||||
EXTRA_DIST = machine.config \
|
||||
web.config \
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
|
||||
mono_DATA = machine.config \
|
||||
web.config \
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
|
||||
+146
-105
@@ -3,118 +3,187 @@
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="configProtectedData" type="System.Configuration.ProtectedConfigurationSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="connectionStrings" type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="mscorlib" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="startup" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.data" type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<section name="anonymousIdentification" type="System.Web.Configuration.AnonymousIdentificationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authentication" type="System.Web.Configuration.AuthenticationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authorization" type="System.Web.Configuration.AuthorizationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="clientTarget" type="System.Web.Configuration.ClientTargetSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="compilation" type="System.Web.Configuration.CompilationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="globalization" type="System.Web.Configuration.GlobalizationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpHandlers" type="System.Web.Configuration.HttpHandlersSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpModules" type="System.Web.Configuration.HttpModulesSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpRuntime" type="System.Web.Configuration.HttpRuntimeSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="machineKey" type="System.Web.Configuration.MachineKeySection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="membership" type="System.Web.Configuration.MembershipSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="pages" type="System.Web.Configuration.PagesSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="profile" type="System.Web.Configuration.ProfileSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="roleManager" type="System.Web.Configuration.RoleManagerSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sessionState" type="System.Web.Configuration.SessionStateSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="siteMap" type="System.Web.Configuration.SiteMapSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="trace" type="System.Web.Configuration.TraceSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webControls" type="System.Web.Configuration.WebControlsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webServices" type="System.Web.Services.Configuration.WebServicesSection, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="xhtmlConformance" type="System.Web.Services.Configuration.XhtmlConformanceSection, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<sectionGroup name="caching" type="System.Web.Configuration.SystemWebCachingSectionGroup, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<section name="cache" type="System.Web.Configuration.CacheSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="outputCache" type="System.Web.Configuration.OutputCacheSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="outputCacheSettings" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sqlCacheDependency" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</sectionGroup>
|
||||
<section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSectionHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<sectionGroup name="system.web">
|
||||
<section name="httpHandlers"
|
||||
type="System.Web.Configuration.HttpHandlersSectionHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpModules"
|
||||
type="System.Web.Configuration.HttpModulesConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="machineKey"
|
||||
type="System.Web.Configuration.MachineKeyConfigHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authentication"
|
||||
type="System.Web.Configuration.AuthenticationConfigHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authorization"
|
||||
type="System.Web.Configuration.AuthorizationConfigHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="globalization"
|
||||
type="System.Web.Configuration.GlobalizationConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sessionState"
|
||||
type="System.Web.SessionState.SessionStateSectionHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="trace"
|
||||
type="System.Web.Configuration.TraceConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webServices"
|
||||
type="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler, System.Web.Services, Version=2.0.3600.0 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webControls"
|
||||
type="System.Web.Configuration.WebControlsSectionHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="compilation"
|
||||
type="System.Web.Configuration.CompilationConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpRuntime"
|
||||
type="System.Web.Configuration.HttpRuntimeConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="customErrors"
|
||||
type="System.Web.Configuration.CustomErrorsConfigHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="pages"
|
||||
type="System.Web.Configuration.PagesConfigurationHandler, System.Web, Version=2.0.3600.0, Culture=neutral" />
|
||||
<section name="clientTarget"
|
||||
type="System.Web.Configuration.ClientTargetSectionHandler, System.Web, Version=2.0.3600.0, Culture=neutral" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.net">
|
||||
<section name="settings"
|
||||
type="System.Net.Configuration.SettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.NetConfigurationHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="connectionManagement"
|
||||
type="System.Net.Configuration.ConnectionManagementSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.ConnectionManagementHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="authenticationModules"
|
||||
type="System.Net.Configuration.NetAuthenticationModuleHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.NetAuthenticationModuleHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="defaultProxy"
|
||||
type="System.Net.Configuration.DefaultProxySection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.DefaultProxyHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="webRequestModules"
|
||||
type="System.Net.Configuration.WebRequestModulesSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.WebRequestModuleHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</sectionGroup>
|
||||
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</configSections>
|
||||
|
||||
<configProtectedData defaultProvider="RsaProtectedConfigurationProvider">
|
||||
<providers>
|
||||
<add name="RsaProtectedConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
description="" keyContainerName="MonoFrameworkConfigurationKey" cspProviderName="" useMachineContainer="true" useOAEP="false" />
|
||||
<add name="DataProtectionConfigurationProvider" type="System.Configuration.DpapiProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
description="" useMachineProtection="true" keyEntropy="" />
|
||||
</providers>
|
||||
</configProtectedData>
|
||||
|
||||
<system.net>
|
||||
<connectionManagement>
|
||||
<add address="*" maxconnection="2" />
|
||||
</connectionManagement>
|
||||
<authenticationModules>
|
||||
<add type="System.Net.BasicClient, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.DigestClient, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.NtlmClient, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.BasicClient, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.DigestClient, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.NtlmClient, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</authenticationModules>
|
||||
<defaultProxy>
|
||||
<proxy />
|
||||
<!-- bypassonlocal and proxyaddress are ok -->
|
||||
<!-- usessystemdefault is not supported -->
|
||||
</defaultProxy>
|
||||
<webRequestModules>
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
<settings>
|
||||
<ipv6 enabled="false"/>
|
||||
</settings>
|
||||
</system.net>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
<credentials passwordFormat="Clear">
|
||||
<!--<user name="gonzalo" password="gonz"/>-->
|
||||
</credentials>
|
||||
</forms>
|
||||
</authentication>
|
||||
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
|
||||
<globalization requestEncoding="utf-8"
|
||||
responseEncoding="utf-8"
|
||||
fileEncoding="utf-8"/>
|
||||
<!--
|
||||
culture="en-US"
|
||||
uiculture="en-US" />
|
||||
-->
|
||||
<sessionState mode="InProc" />
|
||||
<webServices>
|
||||
<protocols>
|
||||
<add name="HttpSoap"/>
|
||||
<add name="HttpPost"/>
|
||||
<add name="HttpGet"/>
|
||||
<add name="Documentation"/>
|
||||
</protocols>
|
||||
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||
</webServices>
|
||||
<webControls clientScriptsLocation="/web_scripts" />
|
||||
<compilation debug="false" defaultLanguage="c#">
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</compilers>
|
||||
<assemblies>
|
||||
<!--<add assembly="mscorlib" /> -->
|
||||
<add assembly="System" />
|
||||
<add assembly="System.Xml" />
|
||||
<add assembly="System.Data" />
|
||||
<add assembly="System.Web" />
|
||||
<add assembly="System.Web.Services" />
|
||||
<add assembly="System.Drawing" />
|
||||
<add assembly="*" /> <!-- Add assemblies in bin directory -->
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="90"
|
||||
maxRequestLength="4096"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
appRequestQueueLimit="100" />
|
||||
<pages buffer="true"
|
||||
enableSessionState="true"
|
||||
autoEventWireup="true"
|
||||
validateRequest="true" />
|
||||
<clientTarget>
|
||||
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
|
||||
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="downlevel" userAgent="Unknown" />
|
||||
</clientTarget>
|
||||
</system.web>
|
||||
|
||||
<system.runtime.remoting>
|
||||
<application>
|
||||
<channels>
|
||||
<channel ref="http client" displayName="http client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||
<channel ref="tcp client" displayName="tcp client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||
<channel ref="ipc client" displayName="ipc client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||
</channels>
|
||||
</application>
|
||||
<channels>
|
||||
<channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="ipc" type="System.Runtime.Remoting.Channels.Ipc.IpcChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="ipc client" type="System.Runtime.Remoting.Channels.Ipc.IpcClientChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="ipc server" type="System.Runtime.Remoting.Channels.Ipc.IpcServerChannel, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</channels>
|
||||
<channelSinkProviders>
|
||||
<clientProviders>
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</clientProviders>
|
||||
<serverProviders>
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</serverProviders>
|
||||
</channelSinkProviders>
|
||||
</system.runtime.remoting>
|
||||
@@ -130,20 +199,6 @@
|
||||
<system.drawing>
|
||||
</system.drawing>
|
||||
|
||||
<mscorlib>
|
||||
<cryptographySettings>
|
||||
<cryptoNameMapping>
|
||||
<cryptoClasses>
|
||||
<cryptoClass monoMD2="Mono.Security.Cryptography.MD2Managed, Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
|
||||
</cryptoClasses>
|
||||
<nameEntry name="MD2" class="monoMD2" />
|
||||
</cryptoNameMapping>
|
||||
<oidMap>
|
||||
<oidEntry OID="1.2.840.113549.2.2" name="MD2" />
|
||||
</oidMap>
|
||||
</cryptographySettings>
|
||||
</mscorlib>
|
||||
|
||||
<strongNames>
|
||||
<pubTokenMapping>
|
||||
<!-- ECMA key -->
|
||||
@@ -156,20 +211,6 @@
|
||||
<map Token="7c307b91aa13d208" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||
</pubTokenMapping>
|
||||
</strongNames>
|
||||
|
||||
<system.web>
|
||||
<membership>
|
||||
<providers>
|
||||
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="LocalSqlServer" />
|
||||
</providers>
|
||||
</membership>
|
||||
|
||||
<roleManager>
|
||||
<providers>
|
||||
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="LocalSqlServer" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
</configuration>
|
||||
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*" />
|
||||
</authorization>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.master" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.resources" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.skin" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.browser" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.sitemap" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.webinfo" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.resx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.Config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.vb" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.csproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="RoleManager" type="System.Web.Security.RoleManagerModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
<credentials passwordFormat="Clear">
|
||||
<!--<user name="gonzalo" password="gonz"/>-->
|
||||
</credentials>
|
||||
</forms>
|
||||
</authentication>
|
||||
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
|
||||
<globalization requestEncoding="utf-8"
|
||||
responseEncoding="utf-8"
|
||||
fileEncoding="utf-8"/>
|
||||
<!--
|
||||
culture="en-US"
|
||||
uiculture="en-US" />
|
||||
-->
|
||||
<sessionState mode="InProc" />
|
||||
<webServices>
|
||||
<protocols>
|
||||
<add name="HttpSoap"/>
|
||||
<add name="HttpPost"/>
|
||||
<add name="HttpGet"/>
|
||||
<add name="Documentation"/>
|
||||
</protocols>
|
||||
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||
</webServices>
|
||||
<webControls clientScriptsLocation="/web_scripts" />
|
||||
<compilation debug="false" defaultLanguage="c#" explicit="true" strict="false" >
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</compilers>
|
||||
<assemblies>
|
||||
<!--<add assembly="mscorlib" /> -->
|
||||
<add assembly="System" />
|
||||
<add assembly="System.Xml" />
|
||||
<add assembly="System.Configuration" />
|
||||
<add assembly="System.Data" />
|
||||
<add assembly="System.Web" />
|
||||
<add assembly="System.Web.Services" />
|
||||
<add assembly="System.Drawing" />
|
||||
<add assembly="*" /> <!-- Add assemblies in bin directory -->
|
||||
</assemblies>
|
||||
<expressionBuilders>
|
||||
<add expressionPrefix="Resources"
|
||||
type="System.Web.Compilation.ResourceExpressionBuilder, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add expressionPrefix="ConnectionStrings"
|
||||
type="System.Web.Compilation.ConnectionStringsExpressionBuilder, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add expressionPrefix="AppSettings"
|
||||
type="System.Web.Compilation.AppSettingsExpressionBuilder, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</expressionBuilders>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="90"
|
||||
maxRequestLength="4096"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
appRequestQueueLimit="100" />
|
||||
<clientTarget>
|
||||
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
|
||||
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="downlevel" userAgent="Unknown" />
|
||||
</clientTarget>
|
||||
|
||||
<siteMap enabled="false">
|
||||
<providers>
|
||||
<add name="AspNetXmlSiteMapProvider"
|
||||
description="Default site map provider that reads in .sitemap xml files."
|
||||
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
siteMapFile="Web.sitemap" />
|
||||
</providers>
|
||||
</siteMap>
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,246 @@
|
||||
System.Object
|
||||
System.Exception
|
||||
System.ValueType
|
||||
System.Delegate
|
||||
System.MulticastDelegate
|
||||
System.Enum
|
||||
System.Activator
|
||||
System.ArgIterator
|
||||
System.__ComObject
|
||||
System.TypedReference
|
||||
System.Security.AllowPartiallyTrustedCallersAttribute
|
||||
System.Runtime.Serialization.Formatter
|
||||
System.Runtime.Serialization.FormatterConverter
|
||||
System.Runtime.Serialization.FormatterServices
|
||||
System.Runtime.Serialization.ObjectIDGenerator
|
||||
System.Runtime.Serialization.ObjectManager
|
||||
System.Reflection.ModuleResolveEventHandler
|
||||
System.Reflection.Pointer
|
||||
System.Globalization.CompareInfo
|
||||
System.Globalization.HebrewCalendar
|
||||
System.Globalization.HijriCalendar
|
||||
System.Globalization.JapaneseCalendar
|
||||
System.Globalization.KoreanCalendar
|
||||
System.Globalization.SortKey
|
||||
System.Globalization.StringInfo
|
||||
System.Globalization.TaiwanCalendar
|
||||
System.Globalization.TextElementEnumerator
|
||||
System.Globalization.TextInfo
|
||||
System.Globalization.ThaiBuddhistCalendar
|
||||
System.IO.IsolatedStorage.IsolatedStorageFile
|
||||
System.Reflection.Emit.MethodRental
|
||||
System.Runtime.CompilerServices.AccessedThroughPropertyAttribute
|
||||
System.Runtime.CompilerServices.CallConvCdecl
|
||||
System.Runtime.CompilerServices.CallConvStdcall
|
||||
System.Runtime.CompilerServices.CallConvThiscall
|
||||
System.Runtime.CompilerServices.CallConvFastcall
|
||||
System.Runtime.CompilerServices.CustomConstantAttribute
|
||||
System.Runtime.CompilerServices.DateTimeConstantAttribute
|
||||
System.Runtime.CompilerServices.DiscardableAttribute
|
||||
System.Runtime.CompilerServices.DecimalConstantAttribute
|
||||
System.Runtime.CompilerServices.CompilationRelaxationsAttribute
|
||||
System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
|
||||
System.Runtime.CompilerServices.IDispatchConstantAttribute
|
||||
System.Runtime.CompilerServices.IsVolatile
|
||||
System.Runtime.CompilerServices.IUnknownConstantAttribute
|
||||
System.Runtime.CompilerServices.RequiredAttributeAttribute
|
||||
System.Runtime.InteropServices.ArrayWithOffset
|
||||
System.Runtime.InteropServices.DispIdAttribute
|
||||
System.Runtime.InteropServices.ClassInterfaceType
|
||||
System.Runtime.InteropServices.ClassInterfaceAttribute
|
||||
System.Runtime.InteropServices.ComVisibleAttribute
|
||||
System.Runtime.InteropServices.LCIDConversionAttribute
|
||||
System.Runtime.InteropServices.ComRegisterFunctionAttribute
|
||||
System.Runtime.InteropServices.ComUnregisterFunctionAttribute
|
||||
System.Runtime.InteropServices.ProgIdAttribute
|
||||
System.Runtime.InteropServices.ImportedFromTypeLibAttribute
|
||||
System.Runtime.InteropServices.IDispatchImplType
|
||||
System.Runtime.InteropServices.IDispatchImplAttribute
|
||||
System.Runtime.InteropServices.ComSourceInterfacesAttribute
|
||||
System.Runtime.InteropServices.ComConversionLossAttribute
|
||||
System.Runtime.InteropServices.TypeLibTypeFlags
|
||||
System.Runtime.InteropServices.TypeLibFuncFlags
|
||||
System.Runtime.InteropServices.TypeLibVarFlags
|
||||
System.Runtime.InteropServices.TypeLibTypeAttribute
|
||||
System.Runtime.InteropServices.TypeLibFuncAttribute
|
||||
System.Runtime.InteropServices.TypeLibVarAttribute
|
||||
System.Runtime.InteropServices.ComImportAttribute
|
||||
System.Runtime.InteropServices.PreserveSigAttribute
|
||||
System.Runtime.InteropServices.ComAliasNameAttribute
|
||||
System.Runtime.InteropServices.AutomationProxyAttribute
|
||||
System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute
|
||||
System.Runtime.InteropServices.CoClassAttribute
|
||||
System.Runtime.InteropServices.ComEventInterfaceAttribute
|
||||
System.Runtime.InteropServices.COMException
|
||||
System.Runtime.InteropServices.ComMemberType
|
||||
System.Runtime.InteropServices.CurrencyWrapper
|
||||
System.Runtime.InteropServices.DispatchWrapper
|
||||
System.Runtime.InteropServices.ErrorWrapper
|
||||
System.Runtime.InteropServices.ExtensibleClassFactory
|
||||
System.Runtime.InteropServices.HandleRef
|
||||
System.Runtime.InteropServices.InvalidComObjectException
|
||||
System.Runtime.InteropServices.InvalidOleVariantTypeException
|
||||
System.Runtime.InteropServices.TypeLibImporterFlags
|
||||
System.Runtime.InteropServices.ExporterEventKind
|
||||
System.Runtime.InteropServices.ITypeLibExporterNotifySink
|
||||
System.Runtime.InteropServices.ITypeLibConverter
|
||||
System.Runtime.InteropServices.MarshalDirectiveException
|
||||
System.Runtime.InteropServices.ObjectCreationDelegate
|
||||
System.Runtime.InteropServices.RuntimeEnvironment
|
||||
System.Runtime.InteropServices.RegistrationServices
|
||||
System.Runtime.InteropServices.SafeArrayRankMismatchException
|
||||
System.Runtime.InteropServices.SafeArrayTypeMismatchException
|
||||
System.Runtime.InteropServices.SEHException
|
||||
System.Runtime.InteropServices.TypeLibConverter
|
||||
System.Runtime.InteropServices.BIND_OPTS
|
||||
System.Runtime.InteropServices.UCOMIBindCtx
|
||||
System.Runtime.InteropServices.UCOMIConnectionPointContainer
|
||||
System.Runtime.InteropServices.UCOMIConnectionPoint
|
||||
System.Runtime.InteropServices.UCOMIEnumMoniker
|
||||
System.Runtime.InteropServices.CONNECTDATA
|
||||
System.Runtime.InteropServices.UCOMIEnumConnections
|
||||
System.Runtime.InteropServices.UCOMIEnumConnectionPoints
|
||||
System.Runtime.InteropServices.UCOMIEnumString
|
||||
System.Runtime.InteropServices.UCOMIEnumVARIANT
|
||||
System.Runtime.InteropServices.FILETIME
|
||||
System.Runtime.InteropServices.UCOMIMoniker
|
||||
System.Runtime.InteropServices.UCOMIPersistFile
|
||||
System.Runtime.InteropServices.UCOMIRunningObjectTable
|
||||
System.Runtime.InteropServices.STATSTG
|
||||
System.Runtime.InteropServices.UCOMIStream
|
||||
System.Runtime.InteropServices.DESCKIND
|
||||
System.Runtime.InteropServices.BINDPTR
|
||||
System.Runtime.InteropServices.UCOMITypeComp
|
||||
System.Runtime.InteropServices.TYPEKIND
|
||||
System.Runtime.InteropServices.TYPEFLAGS
|
||||
System.Runtime.InteropServices.IMPLTYPEFLAGS
|
||||
System.Runtime.InteropServices.TYPEATTR
|
||||
System.Runtime.InteropServices.FUNCDESC
|
||||
System.Runtime.InteropServices.IDLFLAG
|
||||
System.Runtime.InteropServices.IDLDESC
|
||||
System.Runtime.InteropServices.PARAMFLAG
|
||||
System.Runtime.InteropServices.PARAMDESC
|
||||
System.Runtime.InteropServices.TYPEDESC
|
||||
System.Runtime.InteropServices.ELEMDESC
|
||||
System.Runtime.InteropServices.VARDESC
|
||||
System.Runtime.InteropServices.DISPPARAMS
|
||||
System.Runtime.InteropServices.EXCEPINFO
|
||||
System.Runtime.InteropServices.FUNCKIND
|
||||
System.Runtime.InteropServices.INVOKEKIND
|
||||
System.Runtime.InteropServices.CALLCONV
|
||||
System.Runtime.InteropServices.FUNCFLAGS
|
||||
System.Runtime.InteropServices.VARFLAGS
|
||||
System.Runtime.InteropServices.UCOMITypeInfo
|
||||
System.Runtime.InteropServices.SYSKIND
|
||||
System.Runtime.InteropServices.LIBFLAGS
|
||||
System.Runtime.InteropServices.TYPELIBATTR
|
||||
System.Runtime.InteropServices.UCOMITypeLib
|
||||
System.Runtime.InteropServices.UnknownWrapper
|
||||
System.Runtime.Remoting.IObjectHandle
|
||||
System.Runtime.Remoting.IRemotingTypeInfo
|
||||
System.Runtime.Remoting.IChannelInfo
|
||||
System.Runtime.Remoting.IEnvoyInfo
|
||||
System.Runtime.Remoting.RemotingConfiguration
|
||||
System.Runtime.Remoting.TypeEntry
|
||||
System.Runtime.Remoting.ActivatedClientTypeEntry
|
||||
System.Runtime.Remoting.ActivatedServiceTypeEntry
|
||||
System.Runtime.Remoting.WellKnownClientTypeEntry
|
||||
System.Runtime.Remoting.WellKnownServiceTypeEntry
|
||||
System.Runtime.Remoting.RemotingException
|
||||
System.Runtime.Remoting.ServerException
|
||||
System.Runtime.Remoting.RemotingTimeoutException
|
||||
System.Runtime.Remoting.RemotingServices
|
||||
System.Runtime.Remoting.InternalRemotingServices
|
||||
System.Runtime.Remoting.SoapServices
|
||||
System.Runtime.Remoting.Activation.UrlAttribute
|
||||
System.Runtime.Remoting.Messaging.IMessageSink
|
||||
System.Runtime.Remoting.Messaging.AsyncResult
|
||||
System.Runtime.Remoting.Messaging.CallContext
|
||||
System.Runtime.Remoting.Messaging.ILogicalThreadAffinative
|
||||
System.Runtime.Remoting.Messaging.InternalMessageWrapper
|
||||
System.Runtime.Remoting.Messaging.IMethodCallMessage
|
||||
System.Runtime.Remoting.Messaging.MethodCallMessageWrapper
|
||||
System.Runtime.Remoting.Messaging.HeaderHandler
|
||||
System.Runtime.Remoting.Messaging.IMessageCtrl
|
||||
System.Runtime.Remoting.Messaging.IRemotingFormatter
|
||||
System.Runtime.Remoting.Messaging.ReturnMessage
|
||||
System.Runtime.Remoting.Messaging.MethodCall
|
||||
System.Runtime.Remoting.Messaging.ConstructionCall
|
||||
System.Runtime.Remoting.Messaging.MethodResponse
|
||||
System.Runtime.Remoting.Messaging.ConstructionResponse
|
||||
System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper
|
||||
System.Runtime.Remoting.Messaging.OneWayAttribute
|
||||
System.Runtime.Remoting.Messaging.MessageSurrogateFilter
|
||||
System.Runtime.Remoting.Messaging.RemotingSurrogateSelector
|
||||
System.Runtime.Remoting.Contexts.CrossContextDelegate
|
||||
System.Runtime.Remoting.Contexts.ContextProperty
|
||||
System.Runtime.Remoting.Contexts.IContextPropertyActivator
|
||||
System.Runtime.Remoting.Contexts.IContributeClientContextSink
|
||||
System.Runtime.Remoting.Contexts.IContributeDynamicSink
|
||||
System.Runtime.Remoting.Contexts.IContributeEnvoySink
|
||||
System.Runtime.Remoting.Contexts.IContributeObjectSink
|
||||
System.Runtime.Remoting.Contexts.IContributeServerContextSink
|
||||
System.Runtime.Serialization.Formatters.InternalRM
|
||||
System.Runtime.Serialization.Formatters.InternalST
|
||||
System.Runtime.Serialization.Formatters.SoapMessage
|
||||
System.Runtime.Serialization.Formatters.SoapFault
|
||||
System.Runtime.Serialization.Formatters.ServerFault
|
||||
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
System.Security.Cryptography.CryptoConfig
|
||||
System.Security.Cryptography.KeyedHashAlgorithm
|
||||
System.Security.Cryptography.HMACSHA1
|
||||
System.Security.Cryptography.MACTripleDES
|
||||
System.Security.Cryptography.MaskGenerationMethod
|
||||
System.Security.Cryptography.PasswordDeriveBytes
|
||||
System.Security.Cryptography.PKCS1MaskGenerationMethod
|
||||
System.Security.Cryptography.RC2
|
||||
System.Security.Cryptography.RC2CryptoServiceProvider
|
||||
System.Security.Cryptography.RSACryptoServiceProvider
|
||||
System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter
|
||||
System.Security.Cryptography.RSAOAEPKeyExchangeFormatter
|
||||
System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter
|
||||
System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter
|
||||
System.Security.Cryptography.RSAPKCS1SignatureDeformatter
|
||||
System.Security.Cryptography.RSAPKCS1SignatureFormatter
|
||||
System.Security.Cryptography.SHA1Managed
|
||||
System.Security.Cryptography.TripleDES
|
||||
System.Security.Cryptography.TripleDESCryptoServiceProvider
|
||||
System.Security.Permissions.EnvironmentPermission
|
||||
System.Security.Permissions.FileDialogPermission
|
||||
System.Security.Permissions.IsolatedStorageFilePermission
|
||||
System.Security.Permissions.PrincipalPermissionAttribute
|
||||
System.Security.Permissions.SecurityPermissionAttribute
|
||||
System.Security.Permissions.PublisherIdentityPermissionAttribute
|
||||
System.Security.Permissions.PublisherIdentityPermission
|
||||
System.Security.Permissions.ReflectionPermission
|
||||
System.Security.Permissions.RegistryPermission
|
||||
System.Security.Permissions.PrincipalPermission
|
||||
System.Security.Permissions.SiteIdentityPermission
|
||||
System.Security.Permissions.StrongNameIdentityPermission
|
||||
System.Security.Permissions.StrongNamePublicKeyBlob
|
||||
System.Security.Permissions.UIPermission
|
||||
System.Security.Permissions.UrlIdentityPermission
|
||||
System.Security.Permissions.ZoneIdentityPermission
|
||||
System.Security.Policy.ApplicationDirectory
|
||||
System.Security.Policy.ApplicationDirectoryMembershipCondition
|
||||
System.Security.Policy.FirstMatchCodeGroup
|
||||
System.Security.Policy.Hash
|
||||
System.Security.Policy.HashMembershipCondition
|
||||
System.Security.Policy.NetCodeGroup
|
||||
System.Security.Policy.PermissionRequestEvidence
|
||||
System.Security.Policy.Publisher
|
||||
System.Security.Policy.PublisherMembershipCondition
|
||||
System.Security.Policy.Site
|
||||
System.Security.Policy.SiteMembershipCondition
|
||||
System.Security.Policy.StrongName
|
||||
System.Security.Policy.StrongNameMembershipCondition
|
||||
System.Security.Policy.UnionCodeGroup
|
||||
System.Security.Policy.Url
|
||||
System.Security.Policy.UrlMembershipCondition
|
||||
System.Security.Policy.Zone
|
||||
System.Security.Policy.ZoneMembershipCondition
|
||||
System.Security.Principal.WindowsIdentity
|
||||
System.Security.Principal.WindowsImpersonationContext
|
||||
System.Security.Principal.WindowsPrincipal
|
||||
System.Threading.CompressedStack
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
+38
-167
@@ -1,173 +1,44 @@
|
||||
Mono Ahead Of Time Compiler
|
||||
===========================
|
||||
|
||||
The Ahead of Time compilation feature in Mono allows Mono to
|
||||
precompile assemblies to minimize JIT time, reduce memory
|
||||
usage at runtime and increase the code sharing across multiple
|
||||
running Mono application.
|
||||
|
||||
To precompile an assembly use the following command:
|
||||
|
||||
mono --aot -O=all assembly.exe
|
||||
|
||||
The `--aot' flag instructs Mono to ahead-of-time compile your
|
||||
assembly, while the -O=all flag instructs Mono to use all the
|
||||
available optimizations.
|
||||
|
||||
* Position Independent Code
|
||||
---------------------------
|
||||
|
||||
On x86 and x86-64 the code generated by Ahead-of-Time compiled
|
||||
images is position-independent code. This allows the same
|
||||
precompiled image to be reused across multiple applications
|
||||
without having different copies: this is the same way in which
|
||||
ELF shared libraries work: the code produced can be relocated
|
||||
to any address.
|
||||
|
||||
The implementation of Position Independent Code had a
|
||||
performance impact on Ahead-of-Time compiled images but
|
||||
compiler bootstraps are still faster than JIT-compiled images,
|
||||
specially with all the new optimizations provided by the Mono
|
||||
engine.
|
||||
|
||||
* How to support Position Independent Code in new Mono Ports
|
||||
------------------------------------------------------------
|
||||
|
||||
Generated native code needs to reference various runtime
|
||||
structures/functions whose address is only known at run
|
||||
time. JITted code can simple embed the address into the native
|
||||
code, but AOT code needs to do an indirection. This
|
||||
indirection is done through a table called the Global Offset
|
||||
Table (GOT), which is similar to the GOT table in the Elf
|
||||
spec. When the runtime saves the AOT image, it saves some
|
||||
information for each method describing the GOT table entries
|
||||
used by that method. When loading a method from an AOT image,
|
||||
the runtime will fill out the GOT entries needed by the
|
||||
method.
|
||||
|
||||
* Computing the address of the GOT
|
||||
|
||||
Methods which need to access the GOT first need to compute its
|
||||
address. On the x86 it is done by code like this:
|
||||
|
||||
call <IP + 5>
|
||||
pop ebx
|
||||
add <OFFSET TO GOT>, ebx
|
||||
<save got addr to a register>
|
||||
|
||||
The variable representing the got is stored in
|
||||
cfg->got_var. It is allways allocated to a global register to
|
||||
prevent some problems with branches + basic blocks.
|
||||
|
||||
* Referencing GOT entries
|
||||
|
||||
Any time the native code needs to access some other runtime
|
||||
structure/function (i.e. any time the backend calls
|
||||
mono_add_patch_info ()), the code pointed by the patch needs
|
||||
to load the value from the got. For example, instead of:
|
||||
|
||||
call <ABSOLUTE ADDR>
|
||||
it needs to do:
|
||||
call *<OFFSET>(<GOT REG>)
|
||||
|
||||
Here, the <OFFSET> can be 0, it will be fixed up by the AOT compiler.
|
||||
|
||||
For more examples on the changes required, see
|
||||
|
||||
svn diff -r 37739:38213 mini-x86.c
|
||||
|
||||
* The Precompiled File Format
|
||||
-----------------------------
|
||||
|
||||
We use the native object format of the platform. That way it
|
||||
is possible to reuse existing tools like objdump and the
|
||||
dynamic loader. All we need is a working assembler, i.e. we
|
||||
write out a text file which is then passed to gas (the gnu
|
||||
assembler) to generate the object file.
|
||||
|
||||
The precompiled image is stored in a file next to the original
|
||||
assembly that is precompiled with the native extension for a shared
|
||||
library (on Linux its ".so" to the generated file).
|
||||
|
||||
For example: basic.exe -> basic.exe.so; corlib.dll -> corlib.dll.so
|
||||
|
||||
The following things are saved in the object file and can be
|
||||
looked up using the equivalent to dlsym:
|
||||
|
||||
mono_assembly_guid
|
||||
|
||||
A copy of the assembly GUID.
|
||||
|
||||
mono_aot_version
|
||||
|
||||
The format of the AOT file format.
|
||||
|
||||
mono_aot_opt_flags
|
||||
|
||||
The optimizations flags used to build this
|
||||
precompiled image.
|
||||
|
||||
method_infos
|
||||
|
||||
Contains additional information needed by the runtime for using the
|
||||
precompiled method, like the GOT entries it uses.
|
||||
|
||||
method_info_offsets
|
||||
|
||||
Maps method indexes to offsets in the method_infos array.
|
||||
|
||||
mono_icall_table
|
||||
|
||||
A table that lists all the internal calls
|
||||
references by the precompiled image.
|
||||
|
||||
mono_image_table
|
||||
|
||||
A list of assemblies referenced by this AOT
|
||||
module.
|
||||
|
||||
method_offsets
|
||||
|
||||
The equivalent to a procedure linkage table.
|
||||
|
||||
* Performance considerations
|
||||
----------------------------
|
||||
|
||||
Using AOT code is a trade-off which might lead to higher or slower performance,
|
||||
depending on a lot of circumstances. Some of these are:
|
||||
|
||||
- AOT code needs to be loaded from disk before being used, so cold startup of
|
||||
an application using AOT code MIGHT be slower than using JITed code. Warm
|
||||
startup (when the code is already in the machines cache) should be faster.
|
||||
Also, JITing code takes time, and the JIT compiler also need to load
|
||||
additional metadata for the method from the disk, so startup can be faster
|
||||
even in the cold startup case.
|
||||
- AOT code is usually compiled with all optimizations turned on, while JITted
|
||||
code is usually compiled with default optimizations, so the generated code
|
||||
in the AOT case should be faster.
|
||||
- JITted code can directly access runtime data structures and helper functions,
|
||||
while AOT code needs to go through an indirection (the GOT) to access them,
|
||||
so it will be slower and somewhat bigger as well.
|
||||
- When JITting code, the JIT compiler needs to load a lot of metadata about
|
||||
methods and types into memory.
|
||||
- JITted code has better locality, meaning that if A method calls B, then
|
||||
the native code for A and B is usually quite close in memory, leading to
|
||||
better cache behaviour thus improved performance. In contrast, the native
|
||||
code of methods inside the AOT file is in a somewhat random order.
|
||||
|
||||
* Future Work
|
||||
-------------
|
||||
|
||||
- Currently, the runtime needs to setup some data structures and fill out
|
||||
GOT entries before a method is first called. This means that even calls to
|
||||
a method whose code is in the same AOT image need to go through the GOT,
|
||||
instead of using a direct call.
|
||||
- On x86, the generated code uses call 0, pop REG, add GOTOFFSET, REG to
|
||||
materialize the GOT address. Newer versions of gcc use a separate function
|
||||
to do this, maybe we need to do the same.
|
||||
- Currently, we get vtable addresses from the GOT. Another solution would be
|
||||
to store the data from the vtables in the .bss section, so accessing them
|
||||
would involve less indirection.
|
||||
The new mono JIT has sophisticated optimization features. It uses SSA and has a
|
||||
pluggable architecture for further optimizations. This makes it possible and
|
||||
efficient to use the JIT also for AOT compilation.
|
||||
|
||||
|
||||
* file format: We use the native object format of the platform. That way it is
|
||||
possible to reuse existing tools like objdump and the dynamic loader. All we
|
||||
need is a working assembler, i.e. we write out a text file which is then
|
||||
passed to gas (the gnu assembler) to generate the object file.
|
||||
|
||||
* file names: we simply add ".so" to the generated file. For example:
|
||||
basic.exe -> basic.exe.so
|
||||
corlib.dll -> corlib.dll.so
|
||||
|
||||
* staring the AOT compiler: mini --aot assembly_name
|
||||
|
||||
The following things are saved in the object file:
|
||||
|
||||
* version infos:
|
||||
|
||||
* native code: this is labeled with method_XXXXXXXX: where XXXXXXXX is the
|
||||
hexadecimal token number of the method.
|
||||
|
||||
* additional informations needed by the runtime: For example we need to store
|
||||
the code length and the exception tables. We also need a way to patch
|
||||
constants only available at runtime (for example vtable and class
|
||||
addresses). This is stored i a binary blob labeled method_info_XXXXXXXX:
|
||||
|
||||
PROBLEMS:
|
||||
|
||||
- all precompiled methods must be domain independent, or we add patch infos to
|
||||
patch the target doamin.
|
||||
|
||||
- the main problem is how to patch runtime related addresses, for example:
|
||||
|
||||
- current application domain
|
||||
- string objects loaded with LDSTR
|
||||
- address of MonoClass data
|
||||
- static field offsets
|
||||
- method addreses
|
||||
- virtual function and interface slots
|
||||
@@ -3,21 +3,12 @@
|
||||
Miguel de Icaza ([email protected]),
|
||||
Paolo Molaro ([email protected])
|
||||
|
||||
|
||||
This document describes how to embed the Mono runtime in your
|
||||
application, and how to invoke CIL methods from C, and how to
|
||||
invoke C code from CIL. Both the JIT and interpreter can be
|
||||
embedded in very similar ways so most of what is described
|
||||
here can be used in either case.
|
||||
|
||||
* IMPORTANT
|
||||
|
||||
This document is now outdated, see:
|
||||
|
||||
http://www.mono-project.com/Embedding_Mono
|
||||
|
||||
For an up-to-date version of this document
|
||||
|
||||
* Embedding the runtime.
|
||||
|
||||
Embedding the runtime consists of various steps:
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
|
||||
Exception Handling In the Mono Runtime
|
||||
--------------------------------------
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
There are many types of exceptions which the runtime needs to handle. These
|
||||
are:
|
||||
- exceptions thrown from managed code using the 'throw' or 'rethrow' CIL
|
||||
instructions.
|
||||
- exceptions thrown by some IL instructions like InvalidCastException thrown
|
||||
by the 'castclass' CIL instruction.
|
||||
- exceptions thrown by runtime code
|
||||
- synchronous signals received while in managed code
|
||||
- synchronous signals received while in native code
|
||||
- asynchronous signals
|
||||
|
||||
Since exception handling is very arch dependent, parts of the exception
|
||||
handling code reside in the arch specific exceptions-<ARCH>.c files. The
|
||||
architecture independent parts are in mini-exceptions.c. The different
|
||||
exception types listed above are generated in different parts of the runtime,
|
||||
but ultimately, they all end up in the mono_handle_exception () function in
|
||||
mini-exceptions.c.
|
||||
|
||||
Exceptions throw programmatically from managed code
|
||||
---------------------------------------------------
|
||||
|
||||
These exceptions are thrown from managed code using 'throw' or 'rethrow' CIL
|
||||
instructions. The JIT compiler will translate them to a call to a helper
|
||||
function called 'mono_arch_throw/rethrow_exception'. These helper functions do
|
||||
not exist at compile time, they are created dynamically at run time by the
|
||||
code in the exceptions-<ARCH>.c files. They perform various stack
|
||||
manipulation magic, then call a helper function usually named throw_exception (), which
|
||||
does further processing in C code, then calls mono_handle_exception () to do the rest.
|
||||
|
||||
Exceptions thrown implicitly from managed code
|
||||
----------------------------------------------
|
||||
|
||||
These exceptions are thrown by some IL instructions when something goes wrong.
|
||||
When the JIT needs to throw such an exception, it emits a forward conditional
|
||||
branch and remembers its position, along with the exception which needs to
|
||||
be emitted. This is usually done in macros named EMIT_COND_SYSTEM_EXCEPTION in
|
||||
the mini-<ARCH>.c files. After the machine code for the method is emitted, the
|
||||
JIT calls the arch dependent mono_arch_emit_exceptions () function which will
|
||||
add the exception throwing code to the end of the method, and patches up the
|
||||
previous forward branches so they will point to this code. This has the
|
||||
advantage that the rarely-executed exception throwing code is kept separate
|
||||
from the method body, leading to better icache performance.
|
||||
The exception throwing code braches to the dynamically generated
|
||||
mono_arch_throw_corlib_exception helper function, which will create the
|
||||
proper exception object, does some stack manipulation, then calls
|
||||
throw_exception ().
|
||||
|
||||
Exceptions thrown by runtime code
|
||||
---------------------------------
|
||||
|
||||
These exceptions are usually thrown by the implementations of InternalCalls
|
||||
(icalls). First an appropriate exception object is created with the help of
|
||||
various helper functions in metadata/exception.c, which has a separate helper
|
||||
function for allocating each kind of exception object used by the runtime code.
|
||||
Then the mono_raise_exception () function is called to actually throw the
|
||||
exception. That function never returns.
|
||||
|
||||
An example:
|
||||
if (something_is_wrong)
|
||||
mono_raise_exception (mono_get_exception_index_out_of_range ());
|
||||
|
||||
mono_raise_exception () simply passes the exception to the JIT side through
|
||||
an API, where it will be received by helper created by mono_arch_throw_exception (). From now on, it is treated as an exception thrown from managed code.
|
||||
|
||||
Synchronous signals
|
||||
-------------------
|
||||
|
||||
For performance reasons, the runtime does not do same checks required by the
|
||||
CLI spec. Instead, it relies on the CPU to do them. The two main checks which
|
||||
are omitted are null-pointer checks, and arithmetic checks. When a null
|
||||
pointer is dereferenced by JITted code, the CPU will notify the kernel through
|
||||
an interrupt, and the kernel will send a SIGSEGV signal to the process. The
|
||||
runtime installs a signal handler for SIGSEGV, which is
|
||||
sigsegv_signal_handler () in mini.c. The signal handler creates the appropriate
|
||||
exception object and calls mono_handle_exception () with it. Arithmetic
|
||||
exceptions like division by zero are handled similarly.
|
||||
|
||||
Synchronous signals in native code
|
||||
----------------------------------
|
||||
|
||||
Receiving a signal such as SIGSEGV while in native code means something very
|
||||
bad has happened. Because of this, the runtime will abort after trying to print a
|
||||
managed plus a native stack trace. The logic is in the mono_handle_native_sigsegv ()
|
||||
function.
|
||||
Note that there are two kinds of native code which can be the source of the signal:
|
||||
- code inside the runtime
|
||||
- code inside a native library loaded by an application, ie. libgtk+
|
||||
|
||||
Stack overflow checking
|
||||
-----------------------
|
||||
|
||||
Stack overflow exceptions need special handling. When a thread overflows its
|
||||
stack, the kernel sends it a normal SIGSEGV signal, but the signal handler
|
||||
tries to execute on the same as the thread leading to a further SIGSEGV which
|
||||
will terminate the thread. A solution is to use an alternative signal stack
|
||||
supported by UNIX operating systems through the sigaltstack (2) system call.
|
||||
When a thread starts up, the runtime will install an altstack using the
|
||||
mono_setup_altstack () function in mini-exceptions.c. When a SIGSEGV is
|
||||
received, the signal handler checks whenever the fault address is near the
|
||||
bottom of the threads normal stack. If it is, a StackOverflowException is
|
||||
created instead of a NullPointerException. This exception is handled like
|
||||
any other exception, with some minor differences.
|
||||
Working sigaltstack support is very much os/kernel/libc dependent, so it is
|
||||
disabled by default.
|
||||
|
||||
Asynchronous signals
|
||||
--------------------
|
||||
|
||||
Async signals are used by the runtime to notify a thread that it needs to
|
||||
change its state somehow. Currently, it is used for implementing
|
||||
thread abort/suspend/resume.
|
||||
|
||||
Handling async signals correctly is a very hard problem, since the receiving
|
||||
thread can be in basically any state upon receipt of the signal. It can
|
||||
execute managed code, native code, it can hold various managed/native locks, or
|
||||
it can be in a process of acquiring them, it can be starting up, shutting down
|
||||
etc. Most of the C APIs used by the runtime are not asynch-signal safe,
|
||||
meaning it is not safe to call them from an async signal handler. In
|
||||
particular, the pthread locking functions are not async-safe, so if a
|
||||
signal handler interrupted code which was in the process of acquiring a lock,
|
||||
and the signal handler tries to acquire a lock, the thread will deadlock.
|
||||
Unfortunately, the current signal handling code does acquire locks, so
|
||||
sometimes it does deadlock.
|
||||
|
||||
When receiving an async signal, the signal handler first tries to determine
|
||||
whenever the thread was executing managed code when it was interrupted. If
|
||||
it did, then it is safe to interrupt it, so a ThreadAbortException is
|
||||
constructed and thrown. If the thread was executing native code, then it is
|
||||
generally not safe to interrupt it. In this case, the runtime sets a flag
|
||||
then returns from the signal handler. That flag is checked every time the
|
||||
runtime returns from native code to managed code, and the exception is thrown
|
||||
then. Also, a platform specific mechanism is used to cause the thread to
|
||||
interrupt any blocking operation it might be doing.
|
||||
|
||||
The async signal handler is in sigusr1_signal_handler () in mini.c, while
|
||||
the logic which determines whenever an exception is safe to be thrown is in
|
||||
mono_thread_request_interruption ().
|
||||
|
||||
Stack unwinding during exception handling
|
||||
-----------------------------------------
|
||||
|
||||
The execution state of a thread during exception handling is stored in an
|
||||
arch-specific structure called MonoContext. This structure contains the values
|
||||
of all the CPU registers relevant during exception handling, which
|
||||
usually means:
|
||||
- IP (instruction pointer)
|
||||
- SP (stack pointer)
|
||||
- FP (frame pointer)
|
||||
- callee saved registers
|
||||
|
||||
Callee saved registers are the registers which are required by any procedure
|
||||
to be saved/restored before/after using them. They are usually defined by
|
||||
each platforms ABI (Application Binary Interface). For example, on x86, they
|
||||
are EBX, ESI and EDI.
|
||||
|
||||
The code which calls mono_handle_exception () is required to construct the
|
||||
initial MonoContext. How this is done depends on the caller. For exceptions
|
||||
thrown from managed code, the mono_arch_throw_exception helper function
|
||||
saves the values of the required registers and passes them to throw_exception (), which will save them in the MonoContext structure. For exceptions thrown from
|
||||
signal handlers, the MonoContext stucture is initialized from the signal info
|
||||
received from the kernel.
|
||||
|
||||
During exception handling, the runtime needs to 'unwind' the stack, i.e.
|
||||
given the state of the thread at a stack frame, construct the state at its
|
||||
callers. Since this is platform specific, it is done by a platform specific
|
||||
function called mono_arch_find_jit_info ().
|
||||
|
||||
Two kinds of stack frames need handling:
|
||||
- Managed frames are easier. The JIT will store some information about each
|
||||
managed method, like which callee-saved registers it uses. Based on this
|
||||
information, mono_arch_find_jit_info () can find the values of the registers
|
||||
on the thread stack, and restore them.
|
||||
- Native frames are problematic, since we have no information about how to
|
||||
unwind through them. Some compilers generate unwind information for code,
|
||||
some don't. Also, there is no general purpose library to obtain and decode
|
||||
this unwind information. So the runtime uses a different solution. When
|
||||
managed code needs to call into native code, it does through a
|
||||
managed->native wrapper function, which is generated by the JIT. This
|
||||
function is responsible for saving the machine state into a per-thread
|
||||
structure called MonoLMF (Last Managed Frame). These LMF structures are
|
||||
stored on the threads stack, and are linked together using one of their
|
||||
fields. When the unwinder encounters a native frame, it simply pops
|
||||
one entry of the LMF 'stack', and uses it to restore the frame state to the
|
||||
moment before control passed to native code. In effect, all successive native
|
||||
frames are skipped together.
|
||||
|
||||
Problems/future work
|
||||
--------------------
|
||||
|
||||
1. Async signal safety
|
||||
----------------------
|
||||
|
||||
The current async signal handling code is not async safe, so it can and does
|
||||
deadlock in practice. It needs to be rewritten to avoid taking locks at least
|
||||
until it can determine that it was interrupting managed code.
|
||||
|
||||
Another problem is the managed stack frame unwinding code. It blindly assumes
|
||||
that if the IP points into a managed frame, then all the callee saved
|
||||
registers + the stack pointer are saved on the stack. This is not true if
|
||||
the thread was interrupted while executing the method prolog/epilog.
|
||||
|
||||
2. Raising exceptions from native code
|
||||
--------------------------------------
|
||||
|
||||
Currently, exceptions are raised by calling mono_raise_exception () in
|
||||
the middle of runtime code. This has two problems:
|
||||
- No cleanup is done, ie. if the caller of the function which throws an
|
||||
exception has taken locks, or allocated memory, that is not cleaned up. For
|
||||
this reason, it is only safe to call mono_raise_exception () 'very close' to
|
||||
managed code, ie. in the icall functions themselves.
|
||||
- To allow mono_raise_exception () to unwind through native code, we need to
|
||||
save the LMF structures which can add a lot of overhead even in the common
|
||||
case when no exception is thrown. So this is not zero-cost exception handling.
|
||||
|
||||
An alternative might be to use a JNI style set-pending-exception API.
|
||||
Runtime code could call mono_set_pending_exception (), then return to its
|
||||
caller with an error indication allowing the caller to clean up. When execution
|
||||
returns to managed code, then managed->native wrapper could check whenever
|
||||
there is a pending exception and throw it if neccesary. Since we already check
|
||||
for pending thread interruption, this would have no overhead, allowing us
|
||||
to drop the LMF saving/restoring code, or significant parts of it.
|
||||
|
||||
4. libunwind
|
||||
------------
|
||||
|
||||
There is an OSS project called libunwind which is a standalone stack unwinding
|
||||
library. It is currently in development, but it is used by default by gcc on
|
||||
ia64 for its stack unwinding. The mono runtime also uses it on ia64. It has
|
||||
several advantages in relation to our current unwinding code:
|
||||
- it has a platform independent API, i.e. the same unwinding code can be used
|
||||
on multiple platforms.
|
||||
- it can generate unwind tables which are correct at every instruction, i.e.
|
||||
can be used for unwinding from async signals.
|
||||
- given sufficient unwind info generated by a C compiler, it can unwind through
|
||||
C code.
|
||||
- most of its API is async-safe
|
||||
- it implements the gcc C++ exception handling API, so in theory it can
|
||||
be used to implement mixed-language exception handling (i.e. C++ exception
|
||||
caught in mono, mono exception caught in C++).
|
||||
- it is MIT licensed
|
||||
|
||||
The biggest problem with libuwind is its platform support. ia64 support is
|
||||
complete/well tested, while support for other platforms is missing/incomplete.
|
||||
|
||||
http://www.hpl.hp.com/research/linux/libunwind/
|
||||
|
||||
@@ -93,8 +93,4 @@ the GC memory, to remove the reference, set the variable to NULL.
|
||||
|
||||
As we prepare the code for a precise GC, GC_MALLOC () will not be used anymore
|
||||
in this way in most cases: we'll have a mechanism to specify exactly where
|
||||
references to GC memory is stored. This mechanism is now available with the new GC,
|
||||
see usages of mono_gc_alloc_fixed (), mono_gc_register_root () and
|
||||
mono_gc_make_descr_from_bitmap().
|
||||
See also docs/precise-gc for additional info.
|
||||
|
||||
references to GC memory is stored.
|
||||
+9
-7
@@ -62,11 +62,13 @@
|
||||
* How to hook internal calls with the runtime
|
||||
|
||||
Once you require an internal call in corlib, you need to
|
||||
create a C implementation for it and register it in a
|
||||
table in metadata/icall-def.h. See the top of that file
|
||||
for more information.
|
||||
create a C implementation for it and register it in a static
|
||||
table in metadata/icall.c. Add an entry in the table like:
|
||||
|
||||
If there are overloaded methods, you need also to
|
||||
"System.String::GetHashCode", ves_icall_System_String_GetHashCode,
|
||||
|
||||
Note that you need to include the full namespace.name of the
|
||||
class. If there are overloaded methods, you need also to
|
||||
specify the signature of _all_ of them:
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
@@ -74,9 +76,9 @@
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
public extern override void DoSomething (bool useful);
|
||||
|
||||
should be mapped with the following method names:
|
||||
should be mapped with:
|
||||
|
||||
"DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
|
||||
"DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,
|
||||
"Namespace.ClassName::DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
|
||||
"Namespace.ClassName::DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,
|
||||
|
||||
|
||||
@@ -62,222 +62,3 @@ Global Register Allocation
|
||||
==========================
|
||||
|
||||
TODO.
|
||||
|
||||
Local Register Allocation
|
||||
=========================
|
||||
|
||||
This section describes the cross-platform local register allocator which is
|
||||
in the file mini-codegen.c.
|
||||
|
||||
The input to the allocator is a basic block which contains linear IL, ie.
|
||||
instructions of the form:
|
||||
|
||||
DEST <- SRC1 OP SRC2
|
||||
|
||||
where DEST, SRC1, and SRC2 are virtual registers (vregs). The job of the
|
||||
allocator is to assign hard or physical registers (hregs) to each virtual
|
||||
registers so the vreg references in the instructions can be replaced with their
|
||||
assigned hreg, allowing machine code to be generated later.
|
||||
|
||||
The allocator needs information about the number and types of arguments of
|
||||
instructions. It takes this information from the machine description files. It
|
||||
also needs arch specific information, like the number and type of the hard
|
||||
registers. It gets this information from arch-specific macros.
|
||||
|
||||
Currently, the vregs and hregs are partitioned into two classes: integer and
|
||||
floating point.
|
||||
|
||||
The allocator consists of two phases: In the first phase, a forward pass is
|
||||
made over the instructions, collecting liveness information for vregs. In the
|
||||
second phase, a backward pass is made over the instructions, assigning
|
||||
registers. This backward mode of operation makes understanding the allocator
|
||||
somewhat difficult to understand, but leads to better code in most cases.
|
||||
|
||||
Allocator state
|
||||
===============
|
||||
|
||||
The state of the allocator is stored in two arrays: iassign and isymbolic.
|
||||
iassign maps vregs to hregs, while isymbolic is the opposite.
|
||||
For a vreg, iassign [vreg] can contain the following values:
|
||||
|
||||
* -1 vreg has no assigned hreg
|
||||
|
||||
* hreg index (>= 0) vreg is assigned to the given hreg. This means
|
||||
later instructions (which we have already
|
||||
processed due to the backward direction) expect
|
||||
the value of vreg to be found in hreg.
|
||||
|
||||
* spill slot index (< -1) vreg is spilled to the given spill slot. This
|
||||
means later instructions expect the value of
|
||||
vreg to be found on the stack in the given
|
||||
spill slot.
|
||||
|
||||
Also, the allocator keeps track of which hregs are free and which are used.
|
||||
This information is stored in a bitmask called ifree_mask.
|
||||
|
||||
There is a similar set of data structures for floating point registers.
|
||||
|
||||
Spilling
|
||||
========
|
||||
|
||||
When an allocator needs a free hreg, but all of them are assigned, it needs to
|
||||
free up one of them. It does this by spilling the contents of the vreg which
|
||||
is currently assigned to the selected hreg. Since later instructions expect
|
||||
the vreg to be found in the selected hreg, the allocator emits a spill-load
|
||||
instruction to load the value from the spill slot into the hreg after the
|
||||
currently processed instruction. When the vreg which is spilled is a
|
||||
destination in an instruction, the allocator will emit a spill-store to store
|
||||
the value into the spill slot.
|
||||
|
||||
Fixed registers
|
||||
===============
|
||||
|
||||
Some architectures, notably x86/amd64 require that the arguments/results of
|
||||
some instructions be assigned to specific hregs. An example is the shift
|
||||
opcodes on x86, where the second argument must be in ECX. The allocator
|
||||
has support for this. It tries to allocate the vreg to the required hreg. If
|
||||
thats not possible, then it will emit compensation code which moves values to
|
||||
the correct registers before/after the instruction.
|
||||
|
||||
Fixed registers are mainly used on x86, but they are useful on more regular
|
||||
architectures on well, for example to model that after a call instruction, the
|
||||
return of the call is in a specific register.
|
||||
|
||||
A special case of fixed registers is two address architectures, like the x86,
|
||||
where the instructions place their results into their first argument. This is
|
||||
modelled in the allocator by allocating SRC1 and DEST to the same hreg.
|
||||
|
||||
Global registers
|
||||
================
|
||||
|
||||
Some variables might already be allocated to hardware registers during the
|
||||
global allocation phase. In this case, SRC1, SRC2 and DEST might already be
|
||||
a hardware register. The allocator needs to do nothing in this case, except
|
||||
when the architecture uses fixed registers, in which case it needs to emit
|
||||
compensation code.
|
||||
|
||||
Register pairs
|
||||
==============
|
||||
|
||||
64 bit arithmetic on 32 bit machines requires instructions whose arguments are
|
||||
not registers, but register pairs. The allocator has support for this, both
|
||||
for freely allocatable register pairs, and for register pairs which are
|
||||
constrained to specific hregs (EDX:EAX on x86).
|
||||
|
||||
Floating point stack
|
||||
====================
|
||||
|
||||
The x86 architecture uses a floating point register stack instead of a set of
|
||||
fp registers. The allocator supports this by keeping track of the height of the
|
||||
fp stack, and spilling/loading values from the stack as neccesary.
|
||||
|
||||
Calls
|
||||
=====
|
||||
|
||||
Calls need special handling for two reasons: first, they will clobber all
|
||||
caller-save registers, meaning their contents will need to be spilled. Also,
|
||||
some architectures pass arguments in registers. The registers used for
|
||||
passing arguments are usually the same as the ones used for local allocation,
|
||||
so the allocator needs to handle them specially. This is done as follows:
|
||||
the MonoInst for the call instruction contains a map mapping vregs which
|
||||
contain the argument values to hregs where the argument needs to be placed,
|
||||
like this (on amd64):
|
||||
|
||||
R33 -> RDI
|
||||
R34 -> RSI
|
||||
...
|
||||
|
||||
When the allocator processes the call instruction, it allocates the vregs
|
||||
in the map to their associated hregs. So the call instruction is processed as
|
||||
if having a variable number of arguments which fixed register assignments.
|
||||
|
||||
An example:
|
||||
|
||||
R33 <- 1
|
||||
R34 <- 2
|
||||
call
|
||||
|
||||
When the call instruction is processed, R33 is assigned to RDI, and R34 is
|
||||
assigned to RSI. Later, when the two assignment instructions are processed,
|
||||
R33 and R34 are already assigned to a hreg, so they are replaced with the
|
||||
associated hreg leading to the following final code:
|
||||
|
||||
RDI <- 1
|
||||
RSI <- 1
|
||||
call
|
||||
|
||||
Machine description files
|
||||
=========================
|
||||
|
||||
A typical entry in the machine description files looks like this:
|
||||
|
||||
shl: dest:i src1:i src2:s clob:1 len:2
|
||||
|
||||
The allocator is only interested in the dest,src1,src2 and clob fields.
|
||||
It understands the following values for the dest, src1, src2 fields:
|
||||
|
||||
i - integer register
|
||||
f - fp register
|
||||
b - base register (same as i, but the instruction does not modify the reg)
|
||||
m - fp register, even if an fp stack is used (no fp stack tracking)
|
||||
|
||||
It understands the following values for the clob field:
|
||||
|
||||
1 - sreg1 needs to be the same as dreg
|
||||
c - instruction clobbers the caller-save registers
|
||||
|
||||
Beside these values, an architecture can define additional values (like the 's'
|
||||
in the example). The allocator depends on a set of arch-specific macros to
|
||||
convert these values to information it needs during allocation.
|
||||
|
||||
Arch specific macros
|
||||
====================
|
||||
|
||||
These macros usually receive a value from the machine description file (like
|
||||
the 's' in the example). The examples below are for x86.
|
||||
|
||||
/*
|
||||
* A bitmask selecting the caller-save registers (these are used for local
|
||||
* allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_REGS X86_CALLEE_REGS
|
||||
|
||||
/*
|
||||
* A bitmask selecting the callee-saved registers (these are usually used for
|
||||
* global allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_SAVED_REGS X86_CALLER_REGS
|
||||
|
||||
/* Same for the floating point registers */
|
||||
#define MONO_ARCH_CALLEE_FREGS 0
|
||||
#define MONO_ARCH_CALLEE_SAVED_FREGS 0
|
||||
|
||||
/* Whenever the target uses a floating point stack */
|
||||
#define MONO_ARCH_USE_FPSTACK TRUE
|
||||
|
||||
/* The size of the floating point stack */
|
||||
#define MONO_ARCH_FPSTACK_SIZE 6
|
||||
|
||||
/*
|
||||
* Given a descriptor value from the machine description file, return the fixed
|
||||
* hard reg corresponding to that value.
|
||||
*/
|
||||
#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 's') ? X86_ECX : ((desc == 'a') ? X86_EAX : ((desc == 'd') ? X86_EDX : ((desc == 'y') ? X86_EAX : ((desc == 'l') ? X86_EAX : -1)))))
|
||||
|
||||
/*
|
||||
* A bitmask selecting the hregs which can be used for allocating sreg2 for
|
||||
* a given instruction.
|
||||
*/
|
||||
#define MONO_ARCH_INST_SREG2_MASK(ins) (((ins [MONO_INST_CLOB] == 'a') || (ins [MONO_INST_CLOB] == 'd')) ? (1 << X86_EDX) : 0)
|
||||
|
||||
/*
|
||||
* Given a descriptor value, return whenever it denotes a register pair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_IS_REGPAIR(desc) (desc == 'l' || desc == 'L')
|
||||
|
||||
/*
|
||||
* Given a descriptor value, and the first register of a regpair, return a
|
||||
* bitmask selecting the hregs which can be used for allocating the second
|
||||
* register of the regpair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (desc == 'l' ? X86_EDX : -1)
|
||||
@@ -1,15 +0,0 @@
|
||||
This is a patch that can be applied to the magic file used by file(1) to
|
||||
recognize mono assemblies.
|
||||
Apply it to the magic file (usually in /usr/share/file/magic or
|
||||
/usr/share/misc/magic) and recompile it with file -C.
|
||||
|
||||
--- magic.old 2006-03-24 21:12:25.000000000 +0100
|
||||
+++ magic 2006-03-24 21:12:17.000000000 +0100
|
||||
@@ -7205,6 +7205,7 @@
|
||||
>>>>(0x3c.l+4) leshort 0x290 PA-RISC
|
||||
>>>>(0x3c.l+22) leshort&0x0100 >0 32-bit
|
||||
>>>>(0x3c.l+22) leshort&0x1000 >0 system file
|
||||
+>>>>(0x3c.l+232) lelong >0 Mono/.Net assembly
|
||||
|
||||
>>>>(0x3c.l+0xf8) string UPX0 \b, UPX compressed
|
||||
>>>>(0x3c.l+0xf8) search/0x140 PEC2 \b, PECompact2 compressed
|
||||
+2
-12
@@ -241,9 +241,6 @@
|
||||
collecting liveness information and in a backward pass on the
|
||||
same list performs the actual register allocation, inserting
|
||||
the instructions needed to spill values, if necessary.
|
||||
|
||||
The cross-platform local register allocator is now implemented
|
||||
and it is documented in the jit-regalloc file.
|
||||
|
||||
When this part of code is implemented, some testing can be
|
||||
done with the generated code for the new architecture. Most
|
||||
@@ -257,14 +254,7 @@
|
||||
tests. Also, using multiple -v switches on the command line
|
||||
makes the JIT dump an increasing amount of information during
|
||||
compilation.
|
||||
|
||||
Values loaded into registers need to be extened as needed by
|
||||
the ECMA specs:
|
||||
|
||||
*) integers smaller than 4 bytes are extended to int32 values
|
||||
*) 32 bit floats are extended to double precision (in particular
|
||||
this means that currently all the floating point operations operate
|
||||
on doubles)
|
||||
|
||||
|
||||
* Method trampolines
|
||||
|
||||
@@ -458,4 +448,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+64
-84
@@ -3,95 +3,75 @@ precise, generational GC for better performance and smaller
|
||||
memory usage (no false-positives memory retentions with big
|
||||
allocations).
|
||||
|
||||
The first working implementation is committed in metadata/sgen-gc.c
|
||||
as of May, 2006. This is a two-generations moving collector and it is
|
||||
currently used to shake out all the issues in the runtime that need to
|
||||
be fixed in order to support precise generational and moving collectors.
|
||||
This is a large task, but it can be done in steps.
|
||||
|
||||
The two main issues are:
|
||||
1) identify as precisely as possible all the pointers to managed objects
|
||||
2) insert write barriers to be able to account for pointers in the old
|
||||
generation pointing to objects in the newer generations
|
||||
1) use the GCJ support to mark reference fields in objects, so
|
||||
scanning the heap is faster. This is mostly done already, needs
|
||||
checking that it is always used correctly (big objects, arrays).
|
||||
There are also some data structures we use in the runtime that are
|
||||
currently untyped that are allocated in the Gc heap and used to
|
||||
keep references to GC objects. We need to make them typed as to
|
||||
precisely track GC references or make them non-GC memory,
|
||||
by using more the GC hnadle support code (MonoGHashTable, MonoDomain,
|
||||
etc).
|
||||
|
||||
Point 1 is mostly complete. The runtime can register additional roots
|
||||
with the GC as needed and it provides to the GC precise info on the
|
||||
objects layout. In particular with the new precise GC it is not possible to
|
||||
store GC-allocated memory in IntPtr or UIntPtr fields (in fact, the new GC
|
||||
can allocate only objects and not GC-tracked untyped blobs of memory
|
||||
as the Boehm GC can do). Precise info is tracked also for static fields.
|
||||
What is currently missing here is:
|
||||
*) precise info for ThreadStatic and ContextStatic storage (this also requires
|
||||
better memory management for these sub-heaps)
|
||||
*) precise info for HANDLE_NORMAL gc handles
|
||||
*) precise info for thread stacks (this requires storing the info about
|
||||
managed stack frames along with the jitted code for a method and doing the
|
||||
stack walk for the active threads, considering conservatively the unmanaged
|
||||
stack frames and precisely the managed ones. mono_jit_info_table_find () must
|
||||
be made lock-free for this to work). Precise type info must be maintained
|
||||
for all the local variables. Precise type info should be maintained also
|
||||
for registers.
|
||||
Note that this is not a correctness issue, but a performance one. The more
|
||||
pointers to objects we can deal with precisely, the more effective the GC
|
||||
will be, since it will be able to move the objects. The first two todo items
|
||||
are mostly trivial, while handling precisely the thread stacks is complex to
|
||||
implement and to test and it has a cpu and memory use runtime penalty.
|
||||
In practice we need to be able to describe to the GC _all_ the memory
|
||||
locations that can hold a pointer to a managed object and we must tell it also
|
||||
if that location can contain:
|
||||
*) a pointer to the start of an object or NULL (typically a field of an object)
|
||||
*) a pinning pointer to an object (typically the result of the fixed statment in C#)
|
||||
*) a pointer to the managed heap or to other locations (a typical stack location)
|
||||
Since we need to provide to the GC all the locations it's not possible anymore to
|
||||
store any object in unmanaged memory if it is not explicitly pinned for the entire
|
||||
time the object is stored there. With the Boehm GC this was possible if the object
|
||||
was kept alive in some way, but with the new GC it is not valid anymore, because
|
||||
objects can move: the object will be kept alive because of the other reference, but the
|
||||
pointer in unmanaged memory won't be updated to the new location where the object
|
||||
has been moved.
|
||||
2) don't include in the static roots the .bss and .data segments
|
||||
to save in scanning time and limit false-positives. This is mostly
|
||||
done already.
|
||||
|
||||
Most of the work for inserting write barrier calls is already done as well,
|
||||
but there may be still bugs in this area. In particular for it to work,
|
||||
the correct IL opcodes must be used when storing an object in a field or
|
||||
array element (most of the marshal.c code needs to be reviewed to use
|
||||
stind.ref instead of stind.i/stind.u when needed). When this is done, the
|
||||
JIT will take care of automatically inserting the write barriers.
|
||||
What the JIT does automatically for managed code, must be done manually
|
||||
in the runtime C code that deals with storing fields in objects and arrays
|
||||
or otherwise any operation that could change a pointer in the old generation
|
||||
to point to an object in the new generation. Sample cases are as follows:
|
||||
3) keep track precisely of stack locations and registers in native
|
||||
code generation. This basically requires the regalloc rewrite code
|
||||
first, if we don't want to duplicate much of it. This is the hardest
|
||||
task of all, since proving it's correctness is very hard. Some tricks,
|
||||
like having a build that injects GC.Collect() after every few simple
|
||||
operations may help. We also need to decide if we want to handle safe
|
||||
points at calls and back jumps only or at every instruction. The latter
|
||||
case is harder to implement and requires we keep around much more data
|
||||
(it potentially makes for faster stop-the-world phases).
|
||||
The first case requires us to be able to advance a thread until it
|
||||
reaches the next safe point: this can be done with the same techniques
|
||||
used by a debugger. We already need something like this to handle
|
||||
safely aborts happening in the middle of a prolog in managed code,
|
||||
for example, so this could be an additional sub-task that can be done
|
||||
separately from the GC work.
|
||||
Note that we can adapt the libgc code to use the info we collect
|
||||
when scanning the stack in managed methods and still use the conservative
|
||||
approach for the unmanaged stack, until we have our own collector,
|
||||
which requires we define a proper icall interface to switch from managed
|
||||
to unmanaged code (hwo to we handle object references in the icall
|
||||
implementations, for example).
|
||||
|
||||
*) when using C structs that map to managed objects the following macro
|
||||
must be used to store an object in a field (the macro must not be used
|
||||
when storing non-objects and it should not be used when storing NULL values):
|
||||
4) we could make use of the generational capabilities of the
|
||||
Boehm GC, but not with the current method involving signals which
|
||||
may create incompatibilities and is not supported on all platforms.
|
||||
We need to start using write barriers: they will be required anyway
|
||||
for the generational GC we'll use. When a field holding a reference
|
||||
is changed in an object (or an item in an array), we mark the card
|
||||
or page where the field is stored as dirty. Later, when a collection
|
||||
is run, only objects in pages marked as dirty are scanned for
|
||||
references instead of the whole heap. This could take a few days to
|
||||
implement and probably much more time to debug if all the cases were
|
||||
not catched:-)
|
||||
|
||||
MONO_OBJECT_SETREF(obj,fieldname,value)
|
||||
where obj is the pointer to the object, fieldname is the name of the field in
|
||||
the C struct and value is a MonoObject*. Note that obj must be a correctly
|
||||
typed pointer to a struct that embeds MonoObject as the first field and
|
||||
have fieldname as a field.
|
||||
5) actually write the new generational and precise collector. There are
|
||||
several examples out there as open source projects, though the CLR
|
||||
needs some specific semantics so the code needs to be written from
|
||||
scratch anyway. Compared to item 3 this is relatively easer and it can
|
||||
be tested outside of mono, too, until mono is ready to use it.
|
||||
The important features needed:
|
||||
*) precise, so there is no false positive memory retention
|
||||
*) generational to reduce collection times
|
||||
*) pointer-hopping allocation to reduce alloc time
|
||||
*) possibly per-thread lock-free allocation
|
||||
*) handle weakrefs and finalizers with the CLR semantics
|
||||
|
||||
*) when setting the element of an array of references to an object, use the
|
||||
following macro:
|
||||
|
||||
mono_array_setref (array,index,value)
|
||||
|
||||
*) when copying a number of references from an array to another:
|
||||
|
||||
mono_array_memcpy_refs (dest,destidx,src,srcidx,count)
|
||||
|
||||
*) when copying a struct that may containe reference fields, use:
|
||||
|
||||
void mono_value_copy (gpointer dest, gpointer src, MonoClass *klass)
|
||||
|
||||
*) when it is unknown if a pointer points to the stack or to the heap and an
|
||||
object needs to be stored through it, use:
|
||||
|
||||
void mono_gc_wbarrier_generic_store (gpointer ptr, MonoObject* value)
|
||||
|
||||
Note that the support for write barriers in the runtime could be
|
||||
used to enable also the generational features of the Boehm GC.
|
||||
|
||||
Some more documentation on the new GC is available at:
|
||||
http://www.mono-project.com/Compacting_GC
|
||||
Note: some GC engines use a single mmap area, because it makes
|
||||
handling generations and the implementation much easier, but this also
|
||||
limits the expension of the heap, so people may need to use a command-line
|
||||
option to set the max heap size etc. It would be better to have a design
|
||||
that allows mmapping a few megabytes chunks at a time.
|
||||
|
||||
The different tasks can be done in parallel. 1, 2 and 4 can be done in time
|
||||
for the mono 1.2 release. Parts of 3 and 5 could be done as well.
|
||||
The complete switch is supposed to happen with the mono 2.0 release.
|
||||
|
||||
-227
@@ -23,231 +23,4 @@ There are two helper methods which can be used by the JIT and the interpreter
|
||||
to convert LDFLD/STFLD operations into messages and then call
|
||||
RealProxy::Invoke(): mono_store_remote_field() and mono_load_remote_field().
|
||||
|
||||
Cross app domain optimizations
|
||||
==============================
|
||||
|
||||
The new implementation of the cross app domain channel makes a minimal use of
|
||||
the remoting infrastructure. The idea is to create remoting wrappers specific
|
||||
for cross app domain calls, which take the input paramers, switch the domain
|
||||
and dispatch the call in the new domain.
|
||||
|
||||
When an vtable for a proxy needs to be created, the runtime checks if the proxy
|
||||
is referencing an object that belongs to another domain in the same process.
|
||||
In such case, the fast xdomain wrapper is returned instead of the regular one.
|
||||
|
||||
The xdomain wrapper will have a different structure depending on the signature
|
||||
of the method it wraps, since different types have different marshalling needs.
|
||||
There are four types of marshalling, the first one is the fastest, the last one
|
||||
is the slowest:
|
||||
|
||||
1) No marshalling at all: this is for primitive types.
|
||||
|
||||
2) Internal copy of the object in the new domain: some system types can
|
||||
be copied from one domain to the other by the runtime. This currently
|
||||
applies to arrays of primitive types (or arrays of values that can be
|
||||
internally copied), String and StringBuilder. We can add more types in
|
||||
the future.
|
||||
|
||||
3) Internal copy for Out parameters. It is a specific case of the previous
|
||||
type, when an input parameter has the [Out] attribute, which means that the
|
||||
content of the object that is marshalled into the new domain, needs to be
|
||||
copied over the instance of the original object. This applies to arrays
|
||||
of primitive types and StringBuilder. This is used, for example, to be able
|
||||
to call methods such as Stream.Read ([Out]buffer, pos, lengh) across domains.
|
||||
|
||||
4) Serialization. The value is serialized in one domain and deserialized in the
|
||||
other one.
|
||||
|
||||
The xdomain wrapper will be generated according to the marshalling needs of
|
||||
each parameter.
|
||||
|
||||
The cross domain wrapper is divided in two methods. The first method (the
|
||||
wrapper itself) takes the input parameters and serializes those that need to
|
||||
be serialized. After that, sets the new domain and calls to a second method
|
||||
in the new domain, which deserializes the parameters, makes a local copy of
|
||||
those that don't need serialization, and dispatches the call to the real
|
||||
object. Then, the inverse sequence is followed: return values are serialized,
|
||||
flow returns to the first method, which changes the domain again and
|
||||
deserializes the values.
|
||||
|
||||
Sample wrapper
|
||||
--------------
|
||||
|
||||
This are examples of cross domain wrappers in pseudo-C# code.
|
||||
The first example is for a method with the following signature:
|
||||
|
||||
ArrayList Test (int a, string b, ArrayList c, ref ArrayList d, ref string e, ref int f)
|
||||
|
||||
Of course, the wrapper has the same signature:
|
||||
|
||||
ArrayList Test_xdomain_invoke (int a, string b, ArrayList c, ref ArrayList d, ref string e, ref int f)
|
||||
{
|
||||
int loc_new_domainid, loc_old_domainid;
|
||||
ArrayList loc_return;
|
||||
byte[] loc_serialized_array;
|
||||
|
||||
// Save thread domain data
|
||||
Context loc_context = Thread.CurrentContext;
|
||||
if (loc_context.IsDefaultContext) {
|
||||
return Test_remoting_invoke (a, b, c, ref d, ref e, ref f);
|
||||
}
|
||||
object loc_datastore = Thread.ResetDataStoreStatus ();
|
||||
|
||||
// Create the array that will hold the parameters to be serialized
|
||||
object[] loc_array = new object [3]; // +1 to store the return value
|
||||
loc_array [0] = c;
|
||||
loc_array [1] = d;
|
||||
|
||||
// Serialize parameters
|
||||
loc_serialized_array = RemotingServices.SerializeCallData (loc_Array);
|
||||
|
||||
// Get the target domain id and change the domain
|
||||
RealProxy loc_real_proxy = ((TransparentProxy)this).rp;
|
||||
loc_new_domainid = loc_real_proxy->target_domain_id;
|
||||
|
||||
loc_old_domainid = mono_remoting_set_domain_by_id (loc_new_domainid);
|
||||
|
||||
string e_copy = e;
|
||||
/* The following is an indirect call made into the target domain */
|
||||
Test_xdomain_dispatch (rp, ref loc_serialized_array, out loc_serialized_exc, a, b, ref e_copy, ref f);
|
||||
|
||||
// Switch context
|
||||
mono_remoting_set_domain_by_id (loc_old_domainid);
|
||||
|
||||
// Restore thread domain data
|
||||
mono_context_set (loc_context);
|
||||
Thread.RestoreDataStoreStatus (loc_datastore);
|
||||
|
||||
if (loc_serialized_exc != null) {
|
||||
Exception ex = (Exception) RemotingServices.DeserializeCallData (loc_serialized_exc);
|
||||
ex.FixRemotingException ();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
// copy back non-serialized output parametars
|
||||
e = mono_marshal_xdomain_copy_value (e_copy);
|
||||
|
||||
// Deserialize out parameters
|
||||
loc_serialized_array = mono_marshal_xdomain_copy_value (loc_serialized_array);
|
||||
loc_array = RemotingServices.DeserializeObject (loc_serialized_array);
|
||||
d = loc_array [1];
|
||||
mono_thread_force_interruption_checkpoint ();
|
||||
return loc_array [2];
|
||||
}
|
||||
|
||||
void Test_xdomain_dispatch (RealProxy rp, ref byte[] loc_call_data, out byte[] loc_exc_data, int a, string b, ref string e, ref int f)
|
||||
{
|
||||
// Deserialize parameters
|
||||
try {
|
||||
// Clean the call context
|
||||
CallContext.SetCurrentCallContext (null);
|
||||
|
||||
// Deserialize call data
|
||||
if (loc_call_data != null) {
|
||||
loc_call_data = mono_marshal_xdomain_copy_value (loc_call_data);
|
||||
loc_array = RemotingServices.DeserializeCallData (loc_call_data);
|
||||
}
|
||||
|
||||
// Get the target object
|
||||
object target = rp.GetAppDomainTarget ();
|
||||
|
||||
// Load the arguments
|
||||
b = mono_marshal_xdomain_copy_value (b);
|
||||
|
||||
// Make the call to the real object
|
||||
mono_thread_force_interruption_checkpoint ();
|
||||
loc_return = target.Test (a, b, loc_array[0], ref loc_array[1], ref e, ref f);
|
||||
|
||||
// Serialize the return values
|
||||
// Reset parameters in the array that don't need to be serialized back
|
||||
loc_array [0] = null;
|
||||
// Add the return value to the array
|
||||
loc_array [2] = loc_return;
|
||||
// Serialize
|
||||
loc_call_data = RemotingServices.SerializeCallData (loc_array);
|
||||
loc_exc_data = null;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
loc_exc_data = RemotingServices.SerializeExceptionData (ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Another example
|
||||
---------------
|
||||
|
||||
This is another example of a method with more simple parameters:
|
||||
|
||||
int SimpleTest_xdomain_invoke (int a)
|
||||
{
|
||||
int loc_new_domainid, loc_old_domainid;
|
||||
int loc_return;
|
||||
byte[] loc_serialized_array;
|
||||
|
||||
// Save thread domain data
|
||||
Context loc_context = Thread.CurrentContext;
|
||||
if (loc_context.IsDefaultContext) {
|
||||
return SimpleTest_remoting_invoke (a, b, c, ref d, ref e, ref f);
|
||||
}
|
||||
object loc_datastore = Thread.ResetDataStoreStatus ();
|
||||
|
||||
// Serialize parameters. This will only serialize LogicalContext data if needed.
|
||||
loc_serialized_array = RemotingServices.SerializeCallData (null);
|
||||
|
||||
// Get the target domain id and change the domain
|
||||
RealProxy loc_real_proxy = ((TransparentProxy)this).rp;
|
||||
loc_new_domainid = loc_real_proxy->target_domain_id;
|
||||
|
||||
loc_old_domainid = mono_remoting_set_domain_by_id (loc_new_domainid);
|
||||
|
||||
/* The following is an indirect call made into the target domain */
|
||||
loc_return = SimpleTest_xdomain_dispatch (rp, ref loc_serialized_array, out loc_serialized_exc, a);
|
||||
|
||||
// Switch domain
|
||||
mono_remoting_set_domain_by_id (loc_old_domainid);
|
||||
|
||||
// Restore thread domain data
|
||||
mono_context_set (loc_context);
|
||||
Thread.RestoreDataStoreStatus (loc_datastore);
|
||||
|
||||
if (loc_serialized_exc != null) {
|
||||
Exception ex = (Exception) RemotingServices.DeserializeCallData (loc_serialized_exc);
|
||||
ex.FixRemotingException ();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
RemotingServices.DeserializeCallData (loc_serialized_array);
|
||||
return loc_return [2];
|
||||
}
|
||||
|
||||
|
||||
int SimpleTest_xdomain_dispatch (RealProxy rp, ref byte[] loc_call_data, out byte[] loc_exc_data, int a)
|
||||
{
|
||||
int loc_return;
|
||||
|
||||
// Deserialize parameters
|
||||
try {
|
||||
// Clean the call context
|
||||
CallContext.SetCurrentCallContext (null);
|
||||
|
||||
// Deserialize call data
|
||||
if (loc_call_data != null) {
|
||||
loc_call_data = mono_marshal_xdomain_copy_value (loc_call_data);
|
||||
RemotingServices.DeserializeCallData (loc_call_data);
|
||||
}
|
||||
|
||||
// Get the target object
|
||||
object target = rp.GetAppDomainTarget ();
|
||||
|
||||
// Make the call to the real object
|
||||
loc_return = target.Test (a);
|
||||
|
||||
loc_call_data = RemotingServices.SerializeCallData (loc_Array);
|
||||
loc_exc_data = null;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
loc_exc_data = RemotingServices.SerializeExceptionData (ex);
|
||||
}
|
||||
return loc_return;
|
||||
}
|
||||
|
||||
-250
@@ -1,250 +0,0 @@
|
||||
|
||||
SSAPRE stands for "SSA based Partial Redundancy Elimination".
|
||||
|
||||
The algorithm is explained in this paper:
|
||||
|
||||
Partial Redundancy Elimination in SSA Form (1999)
|
||||
Robert Kennedy, Sun Chan, SHIN-MING LIU, RAYMOND LO, PENG TU, FRED CHOW
|
||||
ACM Transactions on Programming Languages and Systems
|
||||
|
||||
http://citeseer.ist.psu.edu/kennedy99partial.html
|
||||
|
||||
In this document I give a gentle introduction to the concept of "partial"
|
||||
redundancies, and I explain the basic design decisions I took in implementing
|
||||
SSAPRE, but the paper is essential to understand the code.
|
||||
|
||||
Partial Redundancy Elimination (or PRE) is an optimization that (guess what?)
|
||||
tries to remove redundant computations.
|
||||
It achieves this by saving the result of "not redundant" evaluations of
|
||||
expressions into appositely created temporary variables, so that "redundant"
|
||||
evaluations can be replaced by a load from the appropriate variable.
|
||||
|
||||
Of course, on register starved architectures (x86) a temporary could cost more
|
||||
than the evaluation itself... PRE guarantees that the live range of the
|
||||
introduced variables is the minimal possible, but the added pressure on the
|
||||
register allocator can be an issue.
|
||||
|
||||
The nice thing about PRE is that it not only removes "full" redundancies, but
|
||||
also "partial" ones.
|
||||
A full redundancy is easy to spot, and straightforward to handle, like in the
|
||||
following example (in every example here, the "expression" is "a + b"):
|
||||
|
||||
int FullRedundancy1 (int a, int b) {
|
||||
int v1 = a + b;
|
||||
int v2 = a + b;
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
PRE would transform it like this:
|
||||
|
||||
int FullRedundancy1 (int a, int b) {
|
||||
int t = a + b;
|
||||
int v1 = t;
|
||||
int v2 = t;
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
Of course, either a copy propagation pass or a register allocator smart enough
|
||||
to remove unneeded variables would be necessary afterwords.
|
||||
|
||||
Another example of full redundancy is the following:
|
||||
|
||||
int FullRedundancy2 (int a, int b) {
|
||||
int v1;
|
||||
|
||||
if (a >= 0) {
|
||||
v1 = a + b; // BB1
|
||||
} else {
|
||||
a = -a; // BB2
|
||||
v1 = a + b;
|
||||
}
|
||||
|
||||
int v2 = a + b; // BB3
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
Here the two expressions in BB1 and BB2 are *not* the same thing (a is
|
||||
modified in BB2), but both are redundant with the expression in BB3, so the
|
||||
code can be transformed like this:
|
||||
|
||||
int FullRedundancy2 (int a, int b) {
|
||||
int v1;
|
||||
int t;
|
||||
|
||||
if (a >= 0) {
|
||||
t = a + b; // BB1
|
||||
v1 = t;
|
||||
} else {
|
||||
a = -a; // BB2
|
||||
t = a + b;
|
||||
v1 = t;
|
||||
}
|
||||
|
||||
int v2 = t; // BB3
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
Note that there are still two occurrences of the expression, while it can be
|
||||
easily seen that one (at the beginning of BB3) would suffice.
|
||||
This, however, is not a redundancy for PRE, because there is no path in the
|
||||
CFG where the expression is evaluated twice.
|
||||
Maybe this other kind of redundancy (which affects code size, and not the
|
||||
computations that are actually performed) would be eliminated by code hoisting,
|
||||
but I should check it; anyway, it is not a PRE related thing.
|
||||
|
||||
An example of partial redundancy, on the other hand, is the following:
|
||||
|
||||
int PartialRedundancy (int a, int b) {
|
||||
int v1;
|
||||
|
||||
if (a >= 0) {
|
||||
v1 = a + b; // BB1
|
||||
} else {
|
||||
v1 = 0; // BB2
|
||||
}
|
||||
|
||||
int v2 = a + b; // BB3
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
The redundancy is partial because the expression is computed more than once
|
||||
along some path in the CFG, not all paths.
|
||||
In fact, on the path BB1 - BB3 the expression is computed twice, but on the
|
||||
path BB2 - BB3 it is computed only once.
|
||||
In this case, PRE must insert new occurrences of the expression in order to
|
||||
obtain a full redundancy, and then use temporary variables as before.
|
||||
Adding a computation in BB2 would do the job.
|
||||
|
||||
One nice thing about PRE is that loop invariants can be seen as partial
|
||||
redundancies.
|
||||
The idea is that you can get into the loop from two locations: from before the
|
||||
loop (at the 1st iteration), and from inside the loop itself (at any other
|
||||
iteration). If there is a computation inside the loop that is in fact a loop
|
||||
invariant, PRE will spot this, and will handle the BB before the loop as a
|
||||
place where to insert a new computation to get a full redundancy.
|
||||
At this point, the computation inside the loop would be replaced by an use of
|
||||
the temporary stored before the loop, effectively performing "loop invariant
|
||||
code motion".
|
||||
|
||||
Now, this is what PRE does to the code.
|
||||
|
||||
But how does it work?
|
||||
|
||||
In "classic" solutions, PRE is formulated as a data flow analysis problem.
|
||||
The Muchnick provides a detailed description of the algorithm in this way (it
|
||||
is by far the most complex problem of this kind in the whole book).
|
||||
The point is that this algorithm does not exploit the SSA form.
|
||||
In fact, it has to perform all that amount of data flow analysis exactly
|
||||
because it does not take advantage of the work already done if you have put
|
||||
the program into SSA form.
|
||||
|
||||
The SSAPRE algorithm, on the other hand, is designed with SSA in mind.
|
||||
It fully exploits the properties of SSA variables, it also explicitly reuses
|
||||
some data structures that must have been computed when building the SSA form,
|
||||
and takes great care to output its code in that form already (which means that
|
||||
the temporaries it introduces are already "versioned", with all the phi
|
||||
variables correctly placed).
|
||||
|
||||
The main concept used in this algorithm is the "Factored Redundancy Graph" (or
|
||||
FRG in short). Basically, for each given expression, this graph shows all its
|
||||
occurrences in the program, and redundant ones are linked to their
|
||||
"representative occurrence" (the 1st occurrence met in a CFG traversal).
|
||||
The central observation is that the FRG is "factored" because each expression
|
||||
occurrence has exactly one representative occurrence, in the same way as the
|
||||
SSA form is a "factored" use-definition graph (each use is related to exactly
|
||||
one definition).
|
||||
And in fact building the FRG is much like building an SSA representation, with
|
||||
PHI nodes and all.
|
||||
By the way, I use "PHI" for "PHI expression occurrences", and "phi" for the
|
||||
usual phi definitions in SSA, because the paper uses an uppercase phi greek
|
||||
letter for PHI occurrences (while the lowercase one is standard in SSA).
|
||||
|
||||
The really interesting point is that the FRG for a given expression has exactly
|
||||
the same "shape" of the use-definition graph for the temporary var that must
|
||||
be introduced to remove the redundancy, and this is why SSAPRE can easily emit
|
||||
its output code in correct SSA form.
|
||||
|
||||
One particular characteristic of the SSAPRE algorithm is that it is "sparse",
|
||||
in the sense that it operates on expressions individually, looking only at the
|
||||
specific nodes it needs. This is in contrast to the classical way of solving
|
||||
data flow analysis problems, which is to operate globally, using data
|
||||
structures that work "in parallel" on all the entities they operate on (in
|
||||
practice bit sets, with for instance one bit per variable, or one bit per
|
||||
expression occurrence, you get the idea). This is handy (it exploits the
|
||||
parallelism of bit operations), but in general setting up those data
|
||||
structures is time consuming, and if the number of the things represented by
|
||||
the bits is not fixed in advance the code can get quite messy (bit sets must
|
||||
become growable).
|
||||
Moreover, applying special handling to individual expressions becomes a very
|
||||
tricky thing.
|
||||
|
||||
SSAPRE, on the other hand, looks at the whole program (method in our case) only
|
||||
once, when it scans the code to collect (and classify) all expression
|
||||
occurrences.
|
||||
From here on, it operates on one expression at a time, looking only at its
|
||||
specific data structures (which, for each expression, are much smaller than
|
||||
the whole program, so the operations are fast).
|
||||
|
||||
This approach has another advantage: the data structures used to operate on
|
||||
one expressions can be recycled when operating on other expressions, making
|
||||
the memory usage of the compiler lower, and (also important) avoiding losing
|
||||
time with memory allocations at all.
|
||||
This reflects directly on the design of those data structures.
|
||||
We can better see these advantages following which data structures are used
|
||||
during the application of SSAPRE to a method.
|
||||
|
||||
The steps that are performed are the following:
|
||||
|
||||
* Initialization: scan the whole program, collect all the occurrences, and
|
||||
build a worklist of expressions to be processed (each worklist entry
|
||||
describes all the occurrences of the given expression).
|
||||
Here the data structures are the following:
|
||||
- One struct (the working area), containing the worklist and other
|
||||
"global" data. The worklist itself contains an entry for each expression
|
||||
which in turn has an entry for each occurrence.
|
||||
- One "info" struct for each BB, containing interesting dominance and CFG
|
||||
related properties of the BB.
|
||||
|
||||
Then, for each entry in the worklist, these operations are performed:
|
||||
|
||||
* PHI placement: find where the PHI nodes of the FRG must be placed.
|
||||
* Renaming: assign appropriate "redundancy classes" to all occurrences (it
|
||||
is like assigning variable versions when building an SSA form).
|
||||
* Analyze: compute various flags in PHI nodes (which are the only places
|
||||
that define where additional computations may be added).
|
||||
This conceptually is composed of two data flow analysis passes, which in
|
||||
practice only scan the PHI nodes in the FRG, not the whole code, so they
|
||||
are not that heavy.
|
||||
* Finalize: make so that the FRG is exactly like the use-def graph for the
|
||||
temporary that will be introduced (it generally must be reshaped a bit
|
||||
according to the flags computed in the previous step).
|
||||
This is also made of two steps, but more for implementation reasons than
|
||||
for conceptual ones.
|
||||
* Code motion: actually update the code using the FRG.
|
||||
Here, what's needed is the following:
|
||||
- PHI occurrences (and some flags sbout them)
|
||||
- PHI argument occurrences (and some flags sbout them)
|
||||
- The renaming stack
|
||||
In practice, one can observe that each BB can have at most one PHI (we work
|
||||
on one expression at a time), and also one PHI argument (which we consider
|
||||
occurring at the end of the BB). Therefore, we do not have separate structures
|
||||
for these, but store them directly in the BB infos (which are kept for the
|
||||
whole SSAPRE invocation).
|
||||
The renaming stack is managed directly as a list of occurrences, with
|
||||
special handling for PHI nodes (which, being represented directly by their
|
||||
BB, are not "occurrences").
|
||||
|
||||
|
||||
So far, the only two missing things (with respect to SSAPRE in the paper) are
|
||||
unneeded PHIs eliminantion and the handling of "composite" expressions.
|
||||
Otherwise, the implementation is complete.
|
||||
|
||||
Other interesting issues are:
|
||||
- SSAPRE has the assumption that:
|
||||
- each SSA variable is related to one "original" (not SSA) variable, and
|
||||
- no more than one version of each originsl variable is live at the same time
|
||||
in the CFG.
|
||||
It would be better to relax these assumptions.
|
||||
- SSAPRE operates on "syntactic" redundancies, not on "values".
|
||||
GVNPRE (or other means of merging GVN) would be a nice alternative, see
|
||||
"http://www.cs.purdue.edu/homes/vandrutj/papers/thesis.pdf".
|
||||
@@ -1,425 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.42.2"
|
||||
sodipodi:docbase="/home/miguel/mono/gc"
|
||||
sodipodi:docname="fragmentation.svg"
|
||||
inkscape:export-filename="/tmp/fragmentation.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.6081777"
|
||||
inkscape:cx="225.44672"
|
||||
inkscape:cy="575.14344"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:window-width="1388"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g2181"
|
||||
transform="translate(0.000000,5.340576e-5)"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000">
|
||||
<rect
|
||||
y="336.88107"
|
||||
x="40.380459"
|
||||
height="33.335033"
|
||||
width="150.56403"
|
||||
id="rect1306"
|
||||
style="opacity:1.0000000;fill:#bf0000;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#e97500;stroke-width:0.96217525;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text1308"
|
||||
y="356.82397"
|
||||
x="112.17029"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="356.82397"
|
||||
x="112.17029"
|
||||
id="tspan1310"
|
||||
sodipodi:role="line">a</tspan></text>
|
||||
<text
|
||||
id="text1312"
|
||||
y="357.98737"
|
||||
x="210.86664"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="357.98737"
|
||||
x="210.86664"
|
||||
id="tspan1314"
|
||||
sodipodi:role="line">b</tspan></text>
|
||||
<rect
|
||||
y="336.67050"
|
||||
x="191.33643"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect1320"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2066"
|
||||
y="356.79828"
|
||||
x="258.88504"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="356.79828"
|
||||
x="258.88504"
|
||||
id="tspan2068"
|
||||
sodipodi:role="line">c</tspan></text>
|
||||
<rect
|
||||
y="332.71930"
|
||||
x="36.785717"
|
||||
height="42.142857"
|
||||
width="252.85715"
|
||||
id="rect2087"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#e93a3a;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="336.67966"
|
||||
x="238.58723"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2070"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
</g>
|
||||
<g
|
||||
id="g2193"
|
||||
transform="translate(0.000000,-1.451759)"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000">
|
||||
<text
|
||||
id="text2095"
|
||||
y="407.98737"
|
||||
x="210.86664"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="407.98737"
|
||||
x="210.86664"
|
||||
id="tspan2097"
|
||||
sodipodi:role="line">b</tspan></text>
|
||||
<rect
|
||||
y="386.67050"
|
||||
x="191.33643"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2099"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2101"
|
||||
y="406.79828"
|
||||
x="258.88504"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="406.79828"
|
||||
x="258.88504"
|
||||
id="tspan2103"
|
||||
sodipodi:role="line">c</tspan></text>
|
||||
<rect
|
||||
y="386.67966"
|
||||
x="238.58722"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2107"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="382.36215"
|
||||
x="37.142860"
|
||||
height="42.142857"
|
||||
width="252.85715"
|
||||
id="rect2105"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#e93a3a;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
</g>
|
||||
<g
|
||||
id="g2202"
|
||||
transform="translate(0.000000,-1.117897)"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000">
|
||||
<text
|
||||
id="text2109"
|
||||
y="455.84454"
|
||||
x="210.86664"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="455.84454"
|
||||
x="210.86664"
|
||||
id="tspan2111"
|
||||
sodipodi:role="line">b</tspan></text>
|
||||
<rect
|
||||
y="434.52768"
|
||||
x="191.33643"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2113"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2115"
|
||||
y="454.65546"
|
||||
x="258.88504"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="454.65546"
|
||||
x="258.88504"
|
||||
id="tspan2117"
|
||||
sodipodi:role="line">c</tspan></text>
|
||||
<rect
|
||||
y="434.53683"
|
||||
x="238.58722"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2119"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="434.44754"
|
||||
x="41.444386"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2127"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="430.21933"
|
||||
x="37.142857"
|
||||
height="42.142857"
|
||||
width="252.85715"
|
||||
id="rect2121"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#e93a3a;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2123"
|
||||
y="455.7644"
|
||||
x="60.974598"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="455.76440"
|
||||
x="60.974598"
|
||||
id="tspan2125"
|
||||
sodipodi:role="line">d</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g2214"
|
||||
transform="translate(0.000000,0.287437)"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000">
|
||||
<text
|
||||
id="text2133"
|
||||
y="502.63025"
|
||||
x="211.58092"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="502.63025"
|
||||
x="211.58092"
|
||||
id="tspan2135"
|
||||
sodipodi:role="line">b</tspan></text>
|
||||
<rect
|
||||
y="481.31339"
|
||||
x="192.05070"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2137"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="477.00504"
|
||||
x="37.857136"
|
||||
height="42.142857"
|
||||
width="252.85715"
|
||||
id="rect2147"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#e93a3a;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="481.23325"
|
||||
x="42.158665"
|
||||
height="33.686447"
|
||||
width="47.111221"
|
||||
id="rect2145"
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2149"
|
||||
y="502.55011"
|
||||
x="61.688877"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="502.55011"
|
||||
x="61.688877"
|
||||
id="tspan2151"
|
||||
sodipodi:role="line">d</tspan></text>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#e93a3a;stroke-width:0.99986458;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2163"
|
||||
width="252.78864"
|
||||
height="42.142857"
|
||||
x="38.244465"
|
||||
y="525.57648"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="109.33745"
|
||||
y="551.20172"
|
||||
id="text2153"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2155"
|
||||
x="109.33745"
|
||||
y="551.20172">b</tspan></text>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2157"
|
||||
width="47.111221"
|
||||
height="33.686447"
|
||||
x="89.807236"
|
||||
y="529.88483"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#009f9d;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#3a57e9;stroke-width:0.54104435;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2165"
|
||||
width="47.111221"
|
||||
height="33.686447"
|
||||
x="42.515812"
|
||||
y="529.80469"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="62.046024"
|
||||
y="551.12158"
|
||||
id="text2167"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2169"
|
||||
x="62.046024"
|
||||
y="551.12158">d</tspan></text>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#bf0000;fill-opacity:0.28961745;fill-rule:evenodd;stroke:#e97500;stroke-width:0.96217525;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2171"
|
||||
width="150.56403"
|
||||
height="33.335033"
|
||||
x="137.73921"
|
||||
y="529.98041"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="209.3181"
|
||||
y="549.92334"
|
||||
id="text2177"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2179"
|
||||
x="209.31810"
|
||||
y="549.92334">e</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="18.364119"
|
||||
y="358.15894"
|
||||
id="text2235"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2237"
|
||||
x="18.364119"
|
||||
y="358.15894">3</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="18.077009"
|
||||
y="406.35583"
|
||||
id="text2239"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2241"
|
||||
x="18.077009"
|
||||
y="406.35583">4</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="18.452009"
|
||||
y="454.46191"
|
||||
id="text2243"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2245"
|
||||
x="18.452009"
|
||||
y="454.46191">5</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="18.15904"
|
||||
y="502.73206"
|
||||
id="text2247"
|
||||
inkscape:export-filename="/tmp/compacting.png"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2249"
|
||||
x="18.159040"
|
||||
y="502.73206">6</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="18.428572"
|
||||
y="551.02197"
|
||||
id="text2251"
|
||||
inkscape:export-xdpi="124.46000"
|
||||
inkscape:export-ydpi="124.46000"
|
||||
inkscape:export-filename="/tmp/compacting.png"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2253"
|
||||
x="18.428572"
|
||||
y="551.02197">7</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 18 KiB |
@@ -1,857 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2324"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.42.2"
|
||||
sodipodi:docbase="/home/miguel/mono/gc"
|
||||
sodipodi:docname="gcmem.svg">
|
||||
<defs
|
||||
id="defs2326">
|
||||
<marker
|
||||
inkscape:stockid="DistanceIn"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="DistanceIn"
|
||||
style="overflow:visible">
|
||||
<g
|
||||
transform="scale(0.6,0.6) translate(8,0)"
|
||||
id="g987">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path974"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none" />
|
||||
<path
|
||||
id="path976"
|
||||
d="M -14.759949,-7 L -14.759949,65"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2pt;marker-start:none" />
|
||||
</g>
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Mstart"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow1Mstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2397"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.4)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Dot_m"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Dot_m"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
id="path39"
|
||||
d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;marker-end:none"
|
||||
transform="scale(0.4) translate(7.125493, 1)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow2Mend"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow2Mend"
|
||||
style="overflow:visible;">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2389"
|
||||
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||
transform="scale(0.6) rotate(180) translate(-5,0)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow2Lend"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow2Lend"
|
||||
style="overflow:visible;">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2392"
|
||||
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||
transform="scale(1.1) rotate(180) translate(-5,0)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="TriangleOutL"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="TriangleOutL"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2462"
|
||||
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.8)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Lstart"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow1Lstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2535"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.8)" />
|
||||
</marker>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.3000000"
|
||||
inkscape:cx="345.54184"
|
||||
inkscape:cy="316.03559"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:window-width="1388"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27" />
|
||||
<metadata
|
||||
id="metadata2329">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g2356"
|
||||
transform="translate(-637.4063,306.0762)">
|
||||
<rect
|
||||
y="582.59204"
|
||||
x="312.92154"
|
||||
height="119.77635"
|
||||
width="198.44141"
|
||||
id="rect2342"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.56134999;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2344"
|
||||
y="699.81897"
|
||||
x="523.83838"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="699.81897"
|
||||
x="523.83838"
|
||||
id="tspan2346"
|
||||
sodipodi:role="line">stack_start</tspan></text>
|
||||
<text
|
||||
id="text2348"
|
||||
y="593.75293"
|
||||
x="523.83838"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="593.75293"
|
||||
x="523.83838"
|
||||
id="tspan2350"
|
||||
sodipodi:role="line">stack_end</tspan></text>
|
||||
<text
|
||||
id="text2352"
|
||||
y="646.71393"
|
||||
x="366.79654"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="646.71393"
|
||||
x="366.79654"
|
||||
id="tspan2354"
|
||||
sodipodi:role="line">Thread N stack</tspan></text>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.54655713;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2392"
|
||||
width="198.44141"
|
||||
height="113.54674"
|
||||
x="-348.07538"
|
||||
y="167.00903" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.39553967;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2367"
|
||||
width="198.44141"
|
||||
height="59.468048"
|
||||
x="-348.22467"
|
||||
y="166.96149" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="-142.24655"
|
||||
y="223.79724"
|
||||
id="text2369"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2371"
|
||||
x="-142.24655"
|
||||
y="223.79724">info->stack_start</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="-142.24655"
|
||||
y="179.88089"
|
||||
id="text2373"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2375"
|
||||
x="-142.24655"
|
||||
y="179.88089">info->stack_end</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="-294.34967"
|
||||
y="201.16916"
|
||||
id="text2388"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2390"
|
||||
x="-294.34967"
|
||||
y="201.16916">Thread 1 stack</tspan></text>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.86822808;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#TriangleOutL);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M -249.00397,238.28619 C -249.00397,269.24665 -249.00397,269.24665 -249.00397,269.24665"
|
||||
id="path2405" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="-142.24655"
|
||||
y="276.65912"
|
||||
id="text2553"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2555"
|
||||
x="-142.24655"
|
||||
y="276.65912">limit: stack bottom</tspan></text>
|
||||
<g
|
||||
id="g2664"
|
||||
transform="translate(-393.8247,105.6316)">
|
||||
<rect
|
||||
y="175.09026"
|
||||
x="45.884109"
|
||||
height="113.54674"
|
||||
width="198.44141"
|
||||
id="rect2666"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.54655713;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="175.04271"
|
||||
x="45.734818"
|
||||
height="59.468048"
|
||||
width="198.44141"
|
||||
id="rect2668"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.39553967;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2670"
|
||||
y="231.87846"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="231.87846"
|
||||
x="251.71294"
|
||||
id="tspan2672"
|
||||
sodipodi:role="line">info->stack_start</tspan></text>
|
||||
<text
|
||||
id="text2674"
|
||||
y="187.96211"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="187.96211"
|
||||
x="251.71294"
|
||||
id="tspan2676"
|
||||
sodipodi:role="line">info->stack_end</tspan></text>
|
||||
<text
|
||||
id="text2678"
|
||||
y="209.25038"
|
||||
x="99.609818"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="209.25038"
|
||||
x="99.609818"
|
||||
id="tspan2680"
|
||||
sodipodi:role="line">Thread 2 stack</tspan></text>
|
||||
<path
|
||||
id="path2682"
|
||||
d="M 144.95552,246.36741 C 144.95552,277.32787 144.95552,277.32787 144.95552,277.32787"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.86822808;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#TriangleOutL);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2684"
|
||||
y="284.74033"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="284.74033"
|
||||
x="251.71294"
|
||||
id="tspan2686"
|
||||
sodipodi:role="line">limit: stack bottom</tspan></text>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#000000;fill-opacity:0.098360606;fill-rule:evenodd;stroke:#000000;stroke-width:0.57452667;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2699"
|
||||
width="198.44141"
|
||||
height="125.46541"
|
||||
x="-347.82306"
|
||||
y="449.85883" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="-312.09747"
|
||||
y="515.71747"
|
||||
id="text2701"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2703"
|
||||
x="-312.09747"
|
||||
y="515.71747">Program, Data, Heap</tspan></text>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect1477"
|
||||
width="496.99463"
|
||||
height="95.744583"
|
||||
x="24.575632"
|
||||
y="255.69751"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:none;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2462"
|
||||
width="369.79077"
|
||||
height="95.629486"
|
||||
x="24.974619"
|
||||
y="255.80048"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<g
|
||||
id="g2549"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000">
|
||||
<rect
|
||||
y="435.98193"
|
||||
x="27.815228"
|
||||
height="104.85226"
|
||||
width="188.03888"
|
||||
id="rect2332"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2234"
|
||||
y="457.2435"
|
||||
x="78.252907"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="78.252907"
|
||||
id="tspan2236"
|
||||
sodipodi:role="line">next_data</tspan></text>
|
||||
<path
|
||||
id="path2223"
|
||||
d="M 27.563951,470.57645 L 215.86873,470.57645 L 215.25735,470.57645"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<path
|
||||
id="path2228"
|
||||
d="M 71.898961,435.92093 L 71.891321,470.94626 L 71.891321,470.94626"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2230"
|
||||
y="457.2435"
|
||||
x="37.966347"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="37.966347"
|
||||
id="tspan2232"
|
||||
sodipodi:role="line">data</tspan></text>
|
||||
<text
|
||||
id="text2238"
|
||||
y="457.2435"
|
||||
x="151.77969"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="151.77969"
|
||||
id="tspan2240"
|
||||
sodipodi:role="line">end_data</tspan></text>
|
||||
<path
|
||||
id="path2244"
|
||||
d="M 146.54159,435.92094 L 146.53395,470.94627 L 146.53395,470.94627"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2246"
|
||||
y="530.07721"
|
||||
x="180.5428"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="530.07721"
|
||||
x="180.54280"
|
||||
id="tspan2248"
|
||||
sodipodi:role="line">next</tspan></text>
|
||||
<text
|
||||
id="text2250"
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
id="tspan2252"
|
||||
sodipodi:role="line">scan_starts</tspan></text>
|
||||
<path
|
||||
id="path2254"
|
||||
d="M 27.385382,505.50503 L 215.69016,505.50503 L 215.07878,505.50503"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.3321546px;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000"
|
||||
d="M 49.940663,435.64439 C 39.609840,395.19706 25.024252,408.49467 24.510938,358.73205"
|
||||
id="path2420"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2130281px;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000"
|
||||
d="M 110.07637,435.66483 C 100.30146,356.87037 395.42132,407.99704 394.99782,357.98613"
|
||||
id="path2424"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2048768px;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000"
|
||||
d="M 178.51727,436.05781 C 177.24799,362.68132 519.42718,442.70358 521.51612,359.00377"
|
||||
id="path2426"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2617185;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 395.11375,255.80101 L 395.10611,351.10915 L 395.10611,351.10915"
|
||||
id="path2443"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2466"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="305.75558"
|
||||
y="473.20383"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2468"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="331.87048"
|
||||
y="473.20383"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2472"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="357.98535"
|
||||
y="473.20383"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2474"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="416.10025"
|
||||
y="473.20383"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 215.70091,485.66660 C 295.43628,485.16153 295.43628,485.16153 295.43628,485.16153"
|
||||
id="path2478"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="392.02042"
|
||||
y="492.73767"
|
||||
id="text2484"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2486"
|
||||
x="392.02042"
|
||||
y="492.73767">...</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="384.86813"
|
||||
y="529.10315"
|
||||
id="text2488"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2490"
|
||||
x="384.86813"
|
||||
y="529.10315">num_scan_starts</tspan></text>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 215.38958,526.54626 C 280.82585,525.11455 240.57890,595.19583 307.86943,597.31997"
|
||||
id="path2492"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<g
|
||||
id="g2494"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"
|
||||
transform="matrix(0.495700,0.000000,0.000000,0.495700,304.0104,357.2198)">
|
||||
<rect
|
||||
y="435.98193"
|
||||
x="27.815228"
|
||||
height="104.85226"
|
||||
width="188.03888"
|
||||
id="rect2496"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2498"
|
||||
y="457.2435"
|
||||
x="78.252907"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="78.252907"
|
||||
id="tspan2500"
|
||||
sodipodi:role="line">next_data</tspan></text>
|
||||
<path
|
||||
id="path2502"
|
||||
d="M 27.563951,470.57645 L 215.86873,470.57645 L 215.25735,470.57645"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<path
|
||||
id="path2504"
|
||||
d="M 71.898961,435.92093 L 71.891321,470.94626 L 71.891321,470.94626"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2506"
|
||||
y="457.2435"
|
||||
x="37.966347"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="37.966347"
|
||||
id="tspan2508"
|
||||
sodipodi:role="line">data</tspan></text>
|
||||
<text
|
||||
id="text2510"
|
||||
y="457.2435"
|
||||
x="151.77969"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="151.77969"
|
||||
id="tspan2512"
|
||||
sodipodi:role="line">end_data</tspan></text>
|
||||
<path
|
||||
id="path2514"
|
||||
d="M 146.54159,435.92094 L 146.53395,470.94627 L 146.53395,470.94627"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2516"
|
||||
y="530.07721"
|
||||
x="180.5428"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="530.07721"
|
||||
x="180.54280"
|
||||
id="tspan2518"
|
||||
sodipodi:role="line">next</tspan></text>
|
||||
<text
|
||||
id="text2520"
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
id="tspan2522"
|
||||
sodipodi:role="line">scan_starts</tspan></text>
|
||||
<path
|
||||
id="path2524"
|
||||
d="M 27.385382,505.50503 L 215.69016,505.50503 L 215.07878,505.50503"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="261.43036"
|
||||
y="234.91617"
|
||||
id="text2528"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2530"
|
||||
x="261.43036"
|
||||
y="234.91617">size</tspan></text>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.3180897;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 32.740631,230.44254 L 242.11872,230.44254 L 241.43892,230.44254"
|
||||
id="path2547"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.3275317;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 515.53150,230.44254 L 303.14294,230.44254 L 303.83251,230.44254"
|
||||
id="path2570"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2582"
|
||||
width="496.99463"
|
||||
height="95.744583"
|
||||
x="96.555573"
|
||||
y="672.34967"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:none;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2584"
|
||||
width="369.79077"
|
||||
height="95.629486"
|
||||
x="96.954559"
|
||||
y="672.45264"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<g
|
||||
id="g2586"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"
|
||||
transform="translate(77.11341,416.8409)">
|
||||
<rect
|
||||
y="435.98193"
|
||||
x="27.815228"
|
||||
height="104.85226"
|
||||
width="188.03888"
|
||||
id="rect2588"
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2590"
|
||||
y="457.2435"
|
||||
x="78.252907"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="78.252907"
|
||||
id="tspan2592"
|
||||
sodipodi:role="line">next_data</tspan></text>
|
||||
<path
|
||||
id="path2594"
|
||||
d="M 27.563951,470.57645 L 215.86873,470.57645 L 215.25735,470.57645"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<path
|
||||
id="path2596"
|
||||
d="M 71.898961,435.92093 L 71.891321,470.94626 L 71.891321,470.94626"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2598"
|
||||
y="457.2435"
|
||||
x="37.966347"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="37.966347"
|
||||
id="tspan2600"
|
||||
sodipodi:role="line">data</tspan></text>
|
||||
<text
|
||||
id="text2602"
|
||||
y="457.2435"
|
||||
x="151.77969"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="457.24350"
|
||||
x="151.77969"
|
||||
id="tspan2604"
|
||||
sodipodi:role="line">end_data</tspan></text>
|
||||
<path
|
||||
id="path2606"
|
||||
d="M 146.54159,435.92094 L 146.53395,470.94627 L 146.53395,470.94627"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2608"
|
||||
y="530.07721"
|
||||
x="180.5428"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="530.07721"
|
||||
x="180.54280"
|
||||
id="tspan2610"
|
||||
sodipodi:role="line">next</tspan></text>
|
||||
<text
|
||||
id="text2612"
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="492.30292"
|
||||
x="140.99677"
|
||||
id="tspan2614"
|
||||
sodipodi:role="line">scan_starts</tspan></text>
|
||||
<path
|
||||
id="path2616"
|
||||
d="M 27.385382,505.50503 L 215.69016,505.50503 L 215.07878,505.50503"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:round;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 390.69768,889.68866 C 331.80602,804.65889 96.803459,874.95173 98.410499,775.69915"
|
||||
id="path2618"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:round;stroke-linejoin:round;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 415.68564,889.74159 C 415.11366,821.91550 190.04004,833.26343 189.29125,775.92074"
|
||||
id="path2620"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 441.13138,889.63261 C 442.23723,818.56405 333.26911,828.85620 330.24174,775.49808"
|
||||
id="path2622"
|
||||
sodipodi:nodetypes="cs"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2617185;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 467.09369,672.45314 L 467.08605,767.76128 L 467.08605,767.76128"
|
||||
id="path2624"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2626"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="377.73553"
|
||||
y="889.85596"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2628"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="403.85040"
|
||||
y="889.85596"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2630"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="429.96527"
|
||||
y="889.85596"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2632"
|
||||
width="22.752682"
|
||||
height="24.214773"
|
||||
x="488.08020"
|
||||
y="889.85596"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 292.81436,902.50755 C 372.54973,902.00248 372.54973,902.00248 372.54973,902.00248"
|
||||
id="path2634"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="464.00037"
|
||||
y="903.38983"
|
||||
id="text2636"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2638"
|
||||
x="464.00037"
|
||||
y="903.38983">...</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="456.84808"
|
||||
y="945.75531"
|
||||
id="text2640"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2642"
|
||||
x="456.84808"
|
||||
y="945.75531">num_scan_starts</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 42 KiB |
@@ -1,282 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="800px"
|
||||
height="600px"
|
||||
id="svg2772"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.42.2"
|
||||
sodipodi:docbase="/home/miguel/mono/gc"
|
||||
sodipodi:docname="overview.svg">
|
||||
<defs
|
||||
id="defs2774">
|
||||
<marker
|
||||
inkscape:stockid="Arrow2Lend"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow2Lend"
|
||||
style="overflow:visible;">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2392"
|
||||
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||
transform="scale(1.1) rotate(180) translate(-5,0)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Lstart"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow1Lstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2400"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.8)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Mstart"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow1Mstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2397"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.4)" />
|
||||
</marker>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.0000000"
|
||||
inkscape:cx="408.00000"
|
||||
inkscape:cy="412.00000"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1388"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27" />
|
||||
<metadata
|
||||
id="metadata2777">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:none;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2584"
|
||||
width="369.79077"
|
||||
height="95.629486"
|
||||
x="-604.89539"
|
||||
y="132.18524"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.094481px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="10.832281"
|
||||
y="76.351082"
|
||||
id="text2798"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2800"
|
||||
x="10.832281"
|
||||
y="76.351082">section_list</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="98.57534"
|
||||
y="38.764957"
|
||||
id="text2804"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2806"
|
||||
x="98.575340"
|
||||
y="38.764957">Old Generations:</tspan></text>
|
||||
<g
|
||||
id="g2814"
|
||||
transform="translate(2.000008,9.000000)">
|
||||
<rect
|
||||
inkscape:export-ydpi="90.000000"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
y="205.35193"
|
||||
x="85.104614"
|
||||
height="85.296158"
|
||||
width="191.79076"
|
||||
id="rect2808"
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2810"
|
||||
y="255.49602"
|
||||
x="134.04068"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="255.49602"
|
||||
x="134.04068"
|
||||
id="tspan2812"
|
||||
sodipodi:role="line">Section 0</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g2830"
|
||||
transform="translate(-11.00000,-92.00000)">
|
||||
<rect
|
||||
inkscape:export-ydpi="90.000000"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
y="211.35191"
|
||||
x="98.104622"
|
||||
height="85.296158"
|
||||
width="191.79076"
|
||||
id="rect2821"
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2823"
|
||||
y="261.496"
|
||||
x="147.30086"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="261.49600"
|
||||
x="147.30086"
|
||||
id="tspan2825"
|
||||
sodipodi:role="line">Section 1</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-start:none;marker-end:url(#Arrow2Lend);stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
d="M 48.000000,83.000000 C 43.000000,149.50000 75.000000,149.00000 75.000000,149.00000"
|
||||
id="path2835"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="340.95966"
|
||||
y="38.764957"
|
||||
id="text2843"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2845"
|
||||
x="340.95966"
|
||||
y="38.764957">New generation:</tspan></text>
|
||||
<g
|
||||
id="g2858"
|
||||
transform="translate(-9.000000,-111.0000)">
|
||||
<rect
|
||||
inkscape:export-ydpi="90.000000"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
y="230.35193"
|
||||
x="337.10461"
|
||||
height="85.296158"
|
||||
width="191.79076"
|
||||
id="rect2849"
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2851"
|
||||
y="278.23788"
|
||||
x="392.74634"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="278.23788"
|
||||
x="392.74634"
|
||||
id="tspan2853"
|
||||
sodipodi:role="line">Nursery</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#Arrow2Lend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 83.203163,178.60032 C 23.635378,197.57995 77.069200,218.39965 77.069200,218.39965"
|
||||
id="path2863"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:20.107187px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="567.95966"
|
||||
y="38.54715"
|
||||
id="text2865"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2867"
|
||||
x="567.95966"
|
||||
y="38.547150">Large Objects</tspan></text>
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2871"
|
||||
width="32.620670"
|
||||
height="29.945086"
|
||||
x="606.68964"
|
||||
y="122.02747"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.094481px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="555.71997"
|
||||
y="76.351082"
|
||||
id="text2881"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2883"
|
||||
x="555.71997"
|
||||
y="76.351082">los_object_list</tspan></text>
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2885"
|
||||
width="32.620670"
|
||||
height="29.945086"
|
||||
x="663.68964"
|
||||
y="122.02747"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2887"
|
||||
width="32.620670"
|
||||
height="29.945086"
|
||||
x="721.68964"
|
||||
y="122.02747"
|
||||
inkscape:export-filename="/tmp/gcmemsection.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.1409233;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#Arrow2Lend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 568.83205,82.879132 C 563.66843,136.52413 596.71567,136.12079 596.71567,136.12079"
|
||||
id="path2889"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.95145077;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#Arrow2Lend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 697.37385,136.93683 C 695.78127,137.13796 713.17398,137.03871 713.17398,137.03871"
|
||||
id="path2891"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.95145077;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#Arrow2Lend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 640.15146,136.93683 C 638.55888,137.13796 655.95159,137.03871 655.95159,137.03871"
|
||||
id="path2893"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,761 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2895"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.42.2"
|
||||
sodipodi:docbase="/home/miguel/mono/gc"
|
||||
sodipodi:docname="roots.svg">
|
||||
<defs
|
||||
id="defs2897">
|
||||
<marker
|
||||
inkscape:stockid="Arrow2Mend"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow2Mend"
|
||||
style="overflow:visible;">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2389"
|
||||
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||
transform="scale(0.6) rotate(180) translate(-5,0)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow2Lend"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow2Lend"
|
||||
style="overflow:visible;">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2392"
|
||||
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||
transform="scale(1.1) rotate(180) translate(-5,0)" />
|
||||
</marker>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.35000000"
|
||||
inkscape:cx="795.16964"
|
||||
inkscape:cy="595.84469"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:window-width="1388"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27" />
|
||||
<metadata
|
||||
id="metadata2900">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.4505868;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2582"
|
||||
width="669.29736"
|
||||
height="95.744583"
|
||||
x="46.683918"
|
||||
y="777.24200"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2584"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="46.834984"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
|
||||
id="rect2908"
|
||||
width="192.52747"
|
||||
height="115.43071"
|
||||
x="56.774403"
|
||||
y="580.48413"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<g
|
||||
id="g2963"
|
||||
transform="translate(0.678249,-1.235298)"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<text
|
||||
id="text2910"
|
||||
y="604.86456"
|
||||
x="72.848167"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="604.86456"
|
||||
x="72.848167"
|
||||
id="tspan2912"
|
||||
sodipodi:role="line">CPU Register References</tspan></text>
|
||||
<text
|
||||
id="text2914"
|
||||
y="631.28149"
|
||||
x="73.557152"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
id="tspan2918"
|
||||
y="631.28149"
|
||||
x="73.557152"
|
||||
sodipodi:role="line">Thread Local Variables</tspan></text>
|
||||
<text
|
||||
id="text2920"
|
||||
y="656.53534"
|
||||
x="72.73098"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
id="tspan2924"
|
||||
y="656.53534"
|
||||
x="72.730980"
|
||||
sodipodi:role="line">Static fields</tspan></text>
|
||||
<text
|
||||
id="text2926"
|
||||
y="680.6261"
|
||||
x="72.344261"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="680.62610"
|
||||
x="72.344261"
|
||||
id="tspan2928"
|
||||
sodipodi:role="line">Runtime object references</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0148686px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
|
||||
d="M 141.15688,696.28653 L 99.281852,736.43697 L 57.406801,776.58742"
|
||||
id="path2939"
|
||||
sodipodi:nodetypes="ccc"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0046772px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
|
||||
d="M 141.42136,696.03556 L 140.41120,776.58585 L 141.42136,696.03556 z "
|
||||
id="path2943"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0069753px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
|
||||
d="M 141.67310,696.54376 L 297.99580,777.59288 L 141.67310,696.54376 z "
|
||||
id="path2945"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
|
||||
d="M 141.42136,695.77833 L 577.80726,776.59054"
|
||||
id="path2947"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2957"
|
||||
width="18.257698"
|
||||
height="95.629486"
|
||||
x="130.87115"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2959"
|
||||
width="50.757698"
|
||||
height="95.629486"
|
||||
x="274.94327"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2961"
|
||||
width="29.686272"
|
||||
height="95.629486"
|
||||
x="563.54974"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2991"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="182.01932"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3004"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="378.19257"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3006"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="482.47830"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21311475;fill-rule:evenodd;stroke:#000000;stroke-width:0.97463667;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3008"
|
||||
width="16.962049"
|
||||
height="95.629486"
|
||||
x="638.66180"
|
||||
y="777.29956"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<g
|
||||
id="g3115"
|
||||
transform="translate(202.3879,-322.8571)"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<g
|
||||
transform="translate(-428.5714,398.5714)"
|
||||
id="g3100">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2985"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="510.61618"
|
||||
y="99.134712"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="534.28992"
|
||||
y="110.82124"
|
||||
id="text2987"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2989"
|
||||
x="534.28992"
|
||||
y="110.82124">Live Objects</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-282.8963,371.4286)"
|
||||
id="g3105">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3010"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="510.61618"
|
||||
y="127.17164"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="534.28992"
|
||||
y="138.85815"
|
||||
id="text3012"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3014"
|
||||
x="534.28992"
|
||||
y="138.85815">Pinned objects</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-118.5714,344.2857)"
|
||||
id="g3110">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3016"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="510.61618"
|
||||
y="155.20856"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="534.9516"
|
||||
y="166.89508"
|
||||
id="text3018"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3020"
|
||||
x="534.95160"
|
||||
y="166.89508">Garbage</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
|
||||
d="M 137.92030,871.86711 C 188.66513,922.95790 194.93685,877.96303 194.93685,877.96303"
|
||||
id="path3022"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.4878695;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
|
||||
d="M 578.24777,873.42803 C 511.53352,930.94739 498.89508,879.52395 498.89508,879.52395"
|
||||
id="path3030"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
|
||||
d="M 579.45614,874.14232 C 638.45729,925.94739 644.82958,878.80967 644.82958,878.80967"
|
||||
id="path3032"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
|
||||
d="M 494.45285,873.73905 C 407.69664,931.25841 391.26142,879.83497 391.26142,879.83497"
|
||||
id="path3034"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.4505868;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3046"
|
||||
width="669.29736"
|
||||
height="95.744583"
|
||||
x="22.945324"
|
||||
y="209.49988"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3048"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="23.096386"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3050"
|
||||
width="18.257698"
|
||||
height="95.629486"
|
||||
x="107.13255"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3052"
|
||||
width="50.757698"
|
||||
height="95.629486"
|
||||
x="251.20467"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3054"
|
||||
width="29.686272"
|
||||
height="95.629486"
|
||||
x="539.81110"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3056"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="158.28072"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3058"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="354.45398"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3060"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="458.73972"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3062"
|
||||
width="67.113373"
|
||||
height="95.629486"
|
||||
x="616.36401"
|
||||
y="209.55743"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3070"
|
||||
width="664.46503"
|
||||
height="95.744583"
|
||||
x="26.226122"
|
||||
y="376.36218"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:17.390287px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="27.714634"
|
||||
y="188.57069"
|
||||
id="text3072"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3074"
|
||||
x="27.714634"
|
||||
y="188.57069">Nursery</tspan></text>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 38.932235,305.42360 C 429.52601,373.97550 429.52601,373.97550 429.52601,373.97550"
|
||||
id="path3080"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3082"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="422.33337"
|
||||
y="376.38739"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3084"
|
||||
width="50.757698"
|
||||
height="95.629486"
|
||||
x="450.34406"
|
||||
y="376.38739"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3086"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="501.12524"
|
||||
y="376.38739"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 278.36297,305.36424 C 467.63468,373.52980 467.63468,373.52980 467.63468,373.52980"
|
||||
id="path3088"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 368.98559,305.36818 C 510.35219,374.03095 510.35219,374.03095 510.35219,374.03095"
|
||||
id="path3090"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3092"
|
||||
width="29.686272"
|
||||
height="95.629486"
|
||||
x="529.02173"
|
||||
y="376.38739"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 556.19390,305.83615 C 543.35713,370.53254 543.35713,370.53254 543.35713,370.53254"
|
||||
id="path3096"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 662.57239,304.85879 C 591.02693,373.02510 591.02693,373.02510 591.02693,373.02510"
|
||||
id="path3098"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<g
|
||||
id="g3135"
|
||||
transform="translate(954.7939,-183.4489)"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<g
|
||||
transform="translate(-460.0000,398.5714)"
|
||||
id="g3137"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3139"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="510.61618"
|
||||
y="99.134712"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="534.28992"
|
||||
y="110.82124"
|
||||
id="text3141"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3143"
|
||||
x="534.28992"
|
||||
y="110.82124">Live Objects</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-312.2437,371.4286)"
|
||||
id="g3145"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3147"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="510.61618"
|
||||
y="127.17164"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="534.28992"
|
||||
y="138.85815"
|
||||
id="text3149"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3151"
|
||||
x="534.28992"
|
||||
y="138.85815">Pinned objects</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g3186"
|
||||
transform="translate(-31.42857,0.000000)"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3155"
|
||||
width="15.082790"
|
||||
height="13.979280"
|
||||
x="392.04477"
|
||||
y="499.49426"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:15.756983px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="416.38019"
|
||||
y="511.18079"
|
||||
id="text3157"
|
||||
inkscape:export-filename="/tmp/roots.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3159"
|
||||
x="416.38019"
|
||||
y="511.18079">Free Memory</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.4505868;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3161"
|
||||
width="669.29736"
|
||||
height="95.744583"
|
||||
x="775.35132"
|
||||
y="348.90802"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3165"
|
||||
width="18.257698"
|
||||
height="95.629486"
|
||||
x="859.53857"
|
||||
y="348.96558"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3171"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="910.68671"
|
||||
y="348.96558"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3175"
|
||||
width="27.900555"
|
||||
height="95.629486"
|
||||
x="1211.1458"
|
||||
y="348.96558"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:17.390287px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="776.12061"
|
||||
y="327.97885"
|
||||
id="text3179"
|
||||
inkscape:export-filename="/tmp/nursery-pinned.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3181"
|
||||
x="776.12061"
|
||||
y="327.97885">Nursery</tspan></text>
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3191"
|
||||
width="67.113373"
|
||||
height="95.629486"
|
||||
x="558.71350"
|
||||
y="376.38739"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.21176471;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect3193"
|
||||
width="396.27408"
|
||||
height="95.629486"
|
||||
x="26.046309"
|
||||
y="376.15903"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:17.390287px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
x="28.444891"
|
||||
y="361.90738"
|
||||
id="text3204"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3206"
|
||||
x="28.444891"
|
||||
y="361.90738">Old generation</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:18.176956px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;stroke-miterlimit:4.0000000;stroke-dasharray:none"
|
||||
x="58.242008"
|
||||
y="430.84366"
|
||||
id="text3208"
|
||||
inkscape:export-filename="/tmp/nursery.png"
|
||||
inkscape:export-xdpi="91.239998"
|
||||
inkscape:export-ydpi="91.239998"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3210"
|
||||
x="58.242008"
|
||||
y="430.84366">Objects from the previous generation</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 35 KiB |
@@ -1,266 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2324"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.42.2"
|
||||
sodipodi:docbase="/home/miguel/mono/gc"
|
||||
sodipodi:docname="stacks.svg">
|
||||
<defs
|
||||
id="defs2326">
|
||||
<marker
|
||||
inkscape:stockid="TriangleOutL"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="TriangleOutL"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2462"
|
||||
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.8)" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Lstart"
|
||||
orient="auto"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
id="Arrow1Lstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2535"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
|
||||
transform="scale(0.8)" />
|
||||
</marker>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="247.73586"
|
||||
inkscape:cy="588.43222"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:window-width="1388"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27" />
|
||||
<metadata
|
||||
id="metadata2329">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#97ff9f;fill-opacity:0.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0371026;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2332"
|
||||
width="198.44141"
|
||||
height="408.83401"
|
||||
x="46.241261"
|
||||
y="174.59003" />
|
||||
<g
|
||||
id="g2356"
|
||||
transform="translate(-27.27417,130.3097)">
|
||||
<rect
|
||||
y="582.59204"
|
||||
x="312.92154"
|
||||
height="119.77635"
|
||||
width="198.44141"
|
||||
id="rect2342"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.56134999;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2344"
|
||||
y="699.81897"
|
||||
x="523.83838"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="699.81897"
|
||||
x="523.83838"
|
||||
id="tspan2346"
|
||||
sodipodi:role="line">stack_start</tspan></text>
|
||||
<text
|
||||
id="text2348"
|
||||
y="593.75293"
|
||||
x="523.83838"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="593.75293"
|
||||
x="523.83838"
|
||||
id="tspan2350"
|
||||
sodipodi:role="line">stack_end</tspan></text>
|
||||
<text
|
||||
id="text2352"
|
||||
y="646.71393"
|
||||
x="366.79654"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="646.71393"
|
||||
x="366.79654"
|
||||
id="tspan2354"
|
||||
sodipodi:role="line">Thread N stack</tspan></text>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.54655713;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2392"
|
||||
width="198.44141"
|
||||
height="113.54674"
|
||||
x="45.884109"
|
||||
y="175.09026" />
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.39553967;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2367"
|
||||
width="198.44141"
|
||||
height="59.468048"
|
||||
x="45.734818"
|
||||
y="175.04271" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="251.71294"
|
||||
y="231.87846"
|
||||
id="text2369"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2371"
|
||||
x="251.71294"
|
||||
y="231.87846">info->stack_start</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="251.71294"
|
||||
y="187.96211"
|
||||
id="text2373"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2375"
|
||||
x="251.71294"
|
||||
y="187.96211">info->stack_end</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="99.609818"
|
||||
y="209.25038"
|
||||
id="text2388"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2390"
|
||||
x="99.609818"
|
||||
y="209.25038">Thread 1 stack</tspan></text>
|
||||
<path
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.86822808;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#TriangleOutL);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
d="M 144.95552,246.36741 C 144.95552,277.32787 144.95552,277.32787 144.95552,277.32787"
|
||||
id="path2405" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="251.71294"
|
||||
y="284.74033"
|
||||
id="text2553"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2555"
|
||||
x="251.71294"
|
||||
y="284.74033">limit: stack bottom</tspan></text>
|
||||
<g
|
||||
id="g2664"
|
||||
transform="translate(0.134777,113.7128)">
|
||||
<rect
|
||||
y="175.09026"
|
||||
x="45.884109"
|
||||
height="113.54674"
|
||||
width="198.44141"
|
||||
id="rect2666"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.54655713;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<rect
|
||||
y="175.04271"
|
||||
x="45.734818"
|
||||
height="59.468048"
|
||||
width="198.44141"
|
||||
id="rect2668"
|
||||
style="opacity:1.0000000;fill:#3a3a3a;fill-opacity:0.20765026;fill-rule:evenodd;stroke:#000000;stroke-width:0.39553967;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2670"
|
||||
y="231.87846"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="231.87846"
|
||||
x="251.71294"
|
||||
id="tspan2672"
|
||||
sodipodi:role="line">info->stack_start</tspan></text>
|
||||
<text
|
||||
id="text2674"
|
||||
y="187.96211"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="187.96211"
|
||||
x="251.71294"
|
||||
id="tspan2676"
|
||||
sodipodi:role="line">info->stack_end</tspan></text>
|
||||
<text
|
||||
id="text2678"
|
||||
y="209.25038"
|
||||
x="99.609818"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="209.25038"
|
||||
x="99.609818"
|
||||
id="tspan2680"
|
||||
sodipodi:role="line">Thread 2 stack</tspan></text>
|
||||
<path
|
||||
id="path2682"
|
||||
d="M 144.95552,246.36741 C 144.95552,277.32787 144.95552,277.32787 144.95552,277.32787"
|
||||
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.86822808;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-end:url(#TriangleOutL);stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
|
||||
<text
|
||||
id="text2684"
|
||||
y="284.74033"
|
||||
x="251.71294"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="284.74033"
|
||||
x="251.71294"
|
||||
id="tspan2686"
|
||||
sodipodi:role="line">limit: stack bottom</tspan></text>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:1.0000000;fill:#000000;fill-opacity:0.098360606;fill-rule:evenodd;stroke:#000000;stroke-width:0.57452667;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
|
||||
id="rect2699"
|
||||
width="198.44141"
|
||||
height="125.46541"
|
||||
x="46.136436"
|
||||
y="457.94003" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12.000000px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
|
||||
x="81.862022"
|
||||
y="523.79871"
|
||||
id="text2701"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2703"
|
||||
x="81.862022"
|
||||
y="523.79871">Program, Data, Heap</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,261 +0,0 @@
|
||||
|
||||
Purpose
|
||||
|
||||
Especially when inlining is active, it can happen that temporary
|
||||
variables add pressure to the register allocator, producing bad
|
||||
code.
|
||||
|
||||
The idea is that some of these temporaries can be totally eliminated
|
||||
my moving the MonoInst tree that defines them directly to the use
|
||||
point in the code (so the name "tree mover").
|
||||
|
||||
Please note that this is *not* an optimization: it is mostly a
|
||||
workaround to issues we have in the regalloc.
|
||||
Actually, with the new linear IR this will not be possible at all
|
||||
(there will be no more trees in the code!).
|
||||
Anyway, this workaround turns out to be useful in the current state
|
||||
of things...
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Base logic
|
||||
|
||||
If a local is defined by a value which is a proper expression (a tree
|
||||
of MonoInst, not just another local or a constant), and this definition
|
||||
is used only once, the tree can be moved directly to the use location,
|
||||
and the definition eliminated.
|
||||
Of course, none of the variables used in the tree must be defined in
|
||||
the code path between the definition and the use, and the tree must be
|
||||
free of side effects.
|
||||
We do not handle the cases when the tree is just a local or a constant
|
||||
because they are handled by copyprop and consprop, respectively.
|
||||
|
||||
To make things simpler, we restrict the tree move to the case when:
|
||||
- the definition and the use are in the same BB, and
|
||||
- the use is followed by another definition in the same BB (it is not
|
||||
possible that the 1st value is used again), or alternatively there
|
||||
is no BB in the whole CFG that contains a use of this local before a
|
||||
definition (so, again, there is no code path that can lead to a
|
||||
subsequent use).
|
||||
|
||||
To handle this, we maintain an ACT array (Available Copy Tree, similar
|
||||
to the ACP), where we store the "state" of every local.
|
||||
Ideally, every local can be in the following state:
|
||||
[E] Undefined (by a tree, it could be in the ACP but we don't care).
|
||||
[D] Defined (by a tree), and waiting for a use.
|
||||
[U] Used, with a tree definition available in the same BB, but still
|
||||
without a definition following the use (always in the same BB).
|
||||
Of course state [E] (empty) is the initial one.
|
||||
|
||||
Besides, there are two sort of "meta states", or flags:
|
||||
[W] Still waiting for a use or definition in this BB (we have seen no
|
||||
occurrence of the local yet).
|
||||
[X] Used without being previously defined in the same BB (note that if
|
||||
there is a definition that precedes the use in the same BB, even if
|
||||
the definition is not a tree or is not available because of side
|
||||
effects or because the tree value has changed the local is not in
|
||||
state [X]).
|
||||
Also note that state [X] is a sort of "global" condition, which if set
|
||||
in one BB will stay valid for the whole CFG, even if the local will
|
||||
otherwise change state. The idea of flagging a local as [X] is that if
|
||||
there is a definition/use pair that reaches the end of a BB, it could
|
||||
be that there is a CFG path that then leads to the BB flagging it as
|
||||
[X] (which contains a use), so the tree cannot be moved.
|
||||
So state [X] will always be set, and never examined in all the state
|
||||
transitions we will describe.
|
||||
In practice, we use flag [W] to set state [X]: if, when traversing a
|
||||
BB, we find a use for a local in state [W], then that local is flagged
|
||||
[X].
|
||||
|
||||
|
||||
For each BB, we initialize all states to [E] and [W], and then we
|
||||
traverse the code one inst at a time, and update the variable states
|
||||
in the ACT in the following ways:
|
||||
|
||||
[Definition]
|
||||
- Flag [W] is cleared.
|
||||
- All "affected trees" are killed (go from state [D] to [E]).
|
||||
The "affected trees" are the trees which contain (use) the defined
|
||||
local, and the rationale is that the tree value changed, so the
|
||||
tree is no longer available.
|
||||
- If the local was in state [U], *that* tree move is marked "safe"
|
||||
(because *this* definition makes us sure that the previous tree
|
||||
cannot be used again in any way).
|
||||
The idea is that "safe" moves can happen even if the local is
|
||||
flagged [X], because the second definition "covers" the use.
|
||||
The tree move is then saved in the "todo" list (and the affecting
|
||||
nodes are cleared).
|
||||
- If the local was defined by a tree, it goes to state [D], the tree
|
||||
is recorded, and all the locals used in it are marked as "affecting
|
||||
this tree" (of course these markers are lists, because each local
|
||||
could affect more than one tree).
|
||||
|
||||
[IndirectDefinition]
|
||||
- All potentially affected trees (in state [D]) are killed.
|
||||
|
||||
[Use]
|
||||
- If the local is still [W], it is flagged [X] (the [W] goes away).
|
||||
- If the local is in state [D], it goes to state [U].
|
||||
The tree move must not yet be recorded in the "todo" list, it still
|
||||
stays in the ACT slot belonging to this local.
|
||||
Anyway, the "affecting" nodes are updated, because now a definition
|
||||
of a local used in this tree will affect only "indirect" (or also
|
||||
"propagated") moves, but not *this* move (see below).
|
||||
- If the local is in state [U], then the tree cannot be moved (it is
|
||||
used two times): the move is canceled, and the state goes [E].
|
||||
- If the local is in state [E], the use is ignored.
|
||||
|
||||
[IndirectUse]
|
||||
- All potentially affected trees (in state [D] or [U]) are killed.
|
||||
|
||||
[SideEffect]
|
||||
- Tree is marked as "unmovable".
|
||||
|
||||
Then, at the end of the BB, for each ACT slot:
|
||||
- If state is [U], the tree move is recorded in the "todo" list, but
|
||||
flagged "unsafe".
|
||||
- Anyway, state goes to [E], the [W] flag is set, and all "affecting"
|
||||
lists are cleared (we get ready to traverse the next BB).
|
||||
Finally, when all BBs has been scanned, we traverse the "todo" list,
|
||||
moving all "safe" entries, and moving "unsafe" ones only if their ACT
|
||||
slot is not flagged [X].
|
||||
|
||||
So far, so good.
|
||||
But there are two issues that make things harder :-(
|
||||
|
||||
The first is the concept of "indirect tree move".
|
||||
It can happen that a tree is scheduled for moving, and its destination
|
||||
is a use that is located in a second tree, which could also be moved.
|
||||
The main issue is that a definition of a variable of the 1st tree on
|
||||
the path between the definition and the use of the 2nd one must prevent
|
||||
the move.
|
||||
But which move? The 1st or the 2nd?
|
||||
Well, any of the two!
|
||||
The point is, the 2nd move must be prevented *only* if the 1st one
|
||||
happens: if it is aborted (for an [X] flag or any other reason), the
|
||||
2nd move is OK, and vice versa...
|
||||
We must handle this in the following way:
|
||||
- The ACT must still remember if a slot is scheduled for moving in
|
||||
this BB, and if it is, all the locals used in the tree.
|
||||
We say that the slot is in state [M].
|
||||
Note that [M] is (like [X] and [W]) a sort of "meta state": a local
|
||||
is flagged [M] when it goes to state [U], and the flag is cleared
|
||||
when the tree move is cancelled
|
||||
- A tree that uses a local whose slot is in state [M] is also using all
|
||||
the locals used by the tree in state [M], but the use is "indirect".
|
||||
These use nodes are also included in the "affecting" lists.
|
||||
- The definition of a variable used in an "indirect" way has the
|
||||
effect of "linking" the two involved tree moves, saying that only one
|
||||
of the two can happen in practice, but not both.
|
||||
- When the 2nd tree is scheduled for moving, the 1st one is *still* in
|
||||
state [M], because a third move could "carry it forward", and all the
|
||||
*three* moves should be mutually exclusive (to be safe!).
|
||||
|
||||
The second tricky complication is the "tree forwarding" that can happen
|
||||
when copyprop is involved.
|
||||
It is conceptually similar to the "indirect tree move".
|
||||
Only, the 2nd tree is not really a tree, it is just the local defined
|
||||
in the 1st tree move.
|
||||
It can happen that copyprop will propagate the definition.
|
||||
We cannot make treeprop do the same job of copyprop, because copyprop
|
||||
has less constraints, and is therefore more powerful in its scope.
|
||||
The main issue is that treeprop cannot propagate a tree to *two* uses,
|
||||
while copyprop is perfectly capable of propagating one definition to
|
||||
two (or more) different places.
|
||||
So we must let copyprop do its job otherwise we'll miss optimizations,
|
||||
but we must also make it play safe with treeprop.
|
||||
Let's clarify with an example:
|
||||
a = v1 + v2; //a is defined by a tree, state [D], uses v2 and v2
|
||||
b = a; //a is used, state [U] with move scheduled, and
|
||||
//b is defined by a, ACP[b] is a, and b is in state [DC]
|
||||
c = b + v3; // b is used, goes to state [U]
|
||||
The real trouble is that copyprop happens *immediately*, while treeprop
|
||||
is deferred to the end of the CFG traversal.
|
||||
So, in the 3rd statement, the "b" is immediately turned into an "a" by
|
||||
copyprop, regardless of what treeprop will do.
|
||||
Anyway, if we are careful, this is not so bad.
|
||||
First of all, we must "accept" the fact that in the 3rd statement the
|
||||
"b" is in fact an "a", as treeprop must happen *after* copyprop.
|
||||
The real problem is that "a" is used twice: in the 2nd and 3rd lines.
|
||||
In our usual setup, the 2nd line would set it to [U], and the 3rd line
|
||||
would kill the move (and set "a" to [E]).
|
||||
I have tried to play tricks, and reason as of copyprop didn't happen,
|
||||
but everything becomes really messy.
|
||||
Instead, we should note that the 2nd line is very likely to be dead.
|
||||
At least in this BB, copyprop will turn all "b"s into "a"s as long as
|
||||
it can, and when it cannot, it will be because either "a" or "b" have
|
||||
been redefined, which would be after the tree move anyway.
|
||||
So, the reasoning gets different: let's pretend that "b" will be dead.
|
||||
This will make the "a" use in the 2nd statement useless, so there we
|
||||
can "reset" "a" to [D], but also take note that if "b" will end up
|
||||
not being dead, the tree move associated to this [D] must be aborted.
|
||||
We can detect this in the following way:
|
||||
- Either "b" is used before being defined in this BB, or
|
||||
- It will be flagged "unsafe".
|
||||
Both things are very easy to check.
|
||||
The only quirk is that the "affecting" lists must not be cleared when
|
||||
a slot goes to state [U], because a "propagation" could put it back
|
||||
to state [D] (where those lists are needed, because it can be killed
|
||||
by a definition to a used slot).
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Implementation notes
|
||||
|
||||
All the implementation runs inside the existing mono_local_cprop
|
||||
function, and a separate memory pool is used to hold the temporary
|
||||
data.
|
||||
|
||||
A struct, MonoTreeMover, contains the pointers to the pool, the ACT,
|
||||
the list of scheduled moves and auxiliary things.
|
||||
This struct is allocated if the tree move pass is requested, and is
|
||||
then passed along to all the involved functions, which are therefore
|
||||
aware of the tree mover state.
|
||||
|
||||
The ACT is an array of slots, obviously one per local.
|
||||
Each slot is of type MonoTreeMoverActSlot, and contains the used and
|
||||
affected locals, a pointer to the pending tree move and the "waiting"
|
||||
and "unsafe" flags.
|
||||
|
||||
The "affecting" lists a built from "dependency nodes", of type
|
||||
MonoTreeMoverDependencyNode.
|
||||
Each of the nodes contains the used and affected local, and is in
|
||||
two lists: the locals used by a slot, and the locals affected by a
|
||||
slot (obviously a different one).
|
||||
So, each node means: "variable x is used in tree t, so a definition
|
||||
of x affects tree t".
|
||||
The "affecting" lists are doubly linked, to allow for O(1) deletion.
|
||||
The "used" lists are simply linked, but when they are mantained there
|
||||
is always a pointer to the last element to allow for O(1) list moving.
|
||||
When a used list is dismissed (which happens often, any time a node is
|
||||
killed), its nodes are unlinked from their respective affecting lists
|
||||
and are then put in a "free" list in the MonoTreeMover to be reused.
|
||||
|
||||
Each tree move is represented by a struct (MonoTreeMoverTreeMove),
|
||||
which contains:
|
||||
- the definition and use points,
|
||||
- the "affected" moves (recall the concept of "indirect tree move"),
|
||||
- the "must be dead" slots (recall "tree forwarding"). and
|
||||
- a few utility flags.
|
||||
The tree moves stays in the relevant ACT slot until it is ready to be
|
||||
scheduled for moving, at which point it is put in a list in the
|
||||
MonoTreeMover.
|
||||
The tree moves structs are reused when they are killed, so there is
|
||||
also a "free" list for them in the MonoTreeMover.
|
||||
|
||||
The tree mover code has been added to all the relevant functions that
|
||||
participate in consprop and copyprop, particularly:
|
||||
- mono_cprop_copy_values takes care of variable uses (transitions from
|
||||
states [D] to [U] and [U] to [E] because of killing),
|
||||
- mono_cprop_invalidate_values takes care of side effects (indirect
|
||||
accesses, calls...),
|
||||
- mono_local_cprop_bb sets up and cleans the traversals for each BB,
|
||||
and for each MonoInst it takes care of variable definitions.
|
||||
To each of them has been added a MonoTreeMover parameter, which is not
|
||||
NULL if the tree mover is running.
|
||||
After mono_local_cprop_bb has run for all BBs, the MonoTreeMover has
|
||||
the list of all the pending moves, which must be walked to actually
|
||||
perform the moves (when possible, because "unsafe" flags, "affected"
|
||||
moves and "must be dead" slots can still have their effects, which
|
||||
must be handled now because they are fully known only at the end of
|
||||
the CFG traversal).
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
Name: Standard libraries in a .NET setup
|
||||
Description: References all the standard .NET libraries for compilation
|
||||
Version: @VERSION@
|
||||
Libs: -r:Accessibility.dll -r:cscompmgd.dll -r:Microsoft.JScript.dll -r:Microsoft.VisualC.dll -r:Microsoft.Vsa.dll -r:System.Configuration.Install.dll -r:System.Data.dll -r:System.Data.OracleClient.dll -r:System.Design.dll -r:System.DirectoryServices.dll -r:System.dll -r:System.Drawing.Design.dll -r:System.Drawing.dll -r:System.EnterpriseServices.dll -r:System.Management.dll -r:System.Messaging.dll -r:System.Runtime.Remoting.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Security.dll -r:System.ServiceProcess.dll -r:System.Web.dll -r:System.Web.Services.dll -r:System.Windows.Forms.dll -r:System.Xml.dll
|
||||
@@ -1,17 +0,0 @@
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-875
@@ -1,875 +0,0 @@
|
||||
2006-10-30 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* src/gutf8.c : several fixes:
|
||||
- fixed incorrect mb_size clear and mb_remain computation.
|
||||
- initialize items_written to 0 for error case.
|
||||
- in utf8_to_utf16_len differentiate error messages completely.
|
||||
- in g_utf8_to_utf16 use guchar instead of gchar.
|
||||
* test/utf8.c : added test case string in test_utf8_seq() to
|
||||
both test_utf8_to_utf16() and test_utf16_to_utf8().
|
||||
|
||||
2006-10-21 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gunicode.c (g_filename_from_utf8): Use g_strlcpy here.
|
||||
|
||||
* src/gmarkup.c (g_markup_parse_context_parse): Do not dereference
|
||||
null values here. This gets things a little bit further in
|
||||
corlib, but not too far.
|
||||
|
||||
* src/gdir.c (g_dir_read_name): Do not return . or ..
|
||||
|
||||
* src/gstr.c (g_ascii_xdigit_value): Make this into a function,
|
||||
thanks to Paolo for pointing the problem with the double macro
|
||||
expansion.
|
||||
|
||||
* src/gmodule.c (g_module_open): Actually return NULL if we fail
|
||||
to load the module (was hiding the real bug in the pinvoke tests).
|
||||
|
||||
(g_module_build_path): Do not prepend "lib" if the "lib" is part
|
||||
of the call.
|
||||
|
||||
* src/gstr.c (g_strsplit): this routine has some non-expected
|
||||
behavior, if the string begins with the delimiter, it will return
|
||||
an empty first string, unlike strtok
|
||||
|
||||
* src/gpath.c (g_path_get_dirname): Return "." as a dirname for
|
||||
paths that do not contain a directory.
|
||||
|
||||
2006-10-18 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/array.c: new test for insertion in the middle of other values.
|
||||
* src/garray.c: fixed destination index.
|
||||
|
||||
2006-10-18 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gpath.c (g_build_path): Do not append terminator if the next
|
||||
string is empty.
|
||||
|
||||
* src/gutf8.c (g_utf8_to_utf16): Include trailing zero as
|
||||
documented.
|
||||
(g_utf16_to_utf8): Include trailing zero as documented.
|
||||
|
||||
2006-10-17 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gstr.c (g_strdown): Actually move.
|
||||
|
||||
* src/gmarkup.c (g_markup_parse_context_parse): Accept dots in the
|
||||
sequence, reset the state after a closing element.
|
||||
|
||||
* src/garray.c (g_array_insert_vals): Shift the elements the
|
||||
correct amount.
|
||||
|
||||
(g_array_insert_vals): Should actually use the
|
||||
number of elements to insert.
|
||||
|
||||
* test/array.c: Add new test case, this was happening in the JIT.
|
||||
|
||||
* Add _GNU_SOURCE at configure time, remove from sources.
|
||||
|
||||
* src/gstr.c (g_strsplit): Empty strings return a 0 value vector.
|
||||
|
||||
* src/glib.h (G_MAXINT64, G_MININT64): Add another set of macros
|
||||
for the support stuff.
|
||||
|
||||
Move private prototypes elsewhere
|
||||
|
||||
* src/glib.h (g_thread_init): Adding missing brace
|
||||
(g_list_next): remove ; from the macro definition.
|
||||
|
||||
2006-10-17 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gutf8.c: internal methods
|
||||
|
||||
* src/ghashtable.c: internal methods.
|
||||
|
||||
2006-10-16 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gerror.c (g_propagate_error): Implement.
|
||||
|
||||
* src/gstr.c (g_strjoinv, g_ascii_strncasecmp): implement.
|
||||
|
||||
* test/string-util.c (test_ascii_strncasecmp): test
|
||||
|
||||
2006-10-15 Miguel de Icaza <[email protected]>
|
||||
|
||||
* configure.in: Fix detection of platforms the [3456] stuff does
|
||||
not work inside autoconf.
|
||||
|
||||
* src/eglib-config.h.in: Make G_BREAKPOINT into a function-macro
|
||||
|
||||
* src/glib.h (offsetof): Mono sources depend on this, bring this
|
||||
from the standard definition. Redefine G_STRUCT_OFFSET in terms
|
||||
of this.
|
||||
|
||||
* src/glib.h (G_STRUCT_OFFSET): fix macro definition.
|
||||
fix typo.
|
||||
|
||||
* src/sizes.c: Add test.
|
||||
|
||||
* src/gshell.c: Make it build
|
||||
|
||||
2006-10-14 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/glib.h: add various _TO_LE and _FROM_LE macros.
|
||||
|
||||
* test/endian.c: tests for endian conversion macros.
|
||||
|
||||
2006-10-09 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gmodule.h: Move definitions of gmodule to gmodule.h because
|
||||
Mono expects it there.
|
||||
|
||||
Mon Oct 9 12:59:16 CEST 2006 Paolo Molaro <[email protected]>
|
||||
|
||||
* src/ghashtable.c: s/to_prime/g_spaced_primes_closest/g
|
||||
and put the array in readonly memory.
|
||||
* src/gstr.c: fixed the build and made array const.
|
||||
* src/gmodule.c: fixed thinko.
|
||||
|
||||
2006-10-08 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gstr.c (g_strdup): should allow NULL as an argument.
|
||||
|
||||
2006-10-08 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/string-util.c:
|
||||
* TODO:
|
||||
* src/gstr.c:
|
||||
* src/glib.h: implemented g_strescape.
|
||||
|
||||
2006-10-08 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/string-util.c:
|
||||
* configure.ac:
|
||||
* TODO:
|
||||
* src/gstr.c:
|
||||
* src/glib.h: implemented g_strlcpy.
|
||||
|
||||
2006-10-08 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/string-util.c:
|
||||
* TODO:
|
||||
* src/gstr.c:
|
||||
* src/glib.h: implemented g_strdelimit.
|
||||
|
||||
2006-10-07 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/spawn.c: add search path flag when running ls.
|
||||
* src/gspawn.c: g_spawn_command_line_sync searches the program in the
|
||||
PATH if it's not an absolute path.
|
||||
|
||||
2006-10-07 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/string-util.c:
|
||||
* src/glib.h: implement g_ascii_xdigit_value and tests.
|
||||
|
||||
2006-10-06 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gstr.c (g_ascii_strdown): Implement.
|
||||
|
||||
* str/glib.c (g_log_set_handler): empty.
|
||||
(g_printerr): empty.
|
||||
(GMemVTable): define, empty, ignored.
|
||||
(G_USEC_PER_SEC) :-)
|
||||
|
||||
* src/gunicode.c (g_convert): Add bytes_read, bytes_written
|
||||
support; Small fixes to avoid valgrind errors.
|
||||
|
||||
(g_utf8_validate): Add, based on the libxml code.
|
||||
|
||||
gstr.c: implement g_strdown.
|
||||
|
||||
2006-10-05 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gunicode.c: Some work in progress to implement g_convert
|
||||
(which is needed by g_locale_to_utf8).
|
||||
|
||||
2006-09-18 Miguel de Icaza <[email protected]>
|
||||
|
||||
* test/string-util.c (test_filename_from_uri): tests for new
|
||||
methods.
|
||||
|
||||
* src/gstr.c (g_filename_to_uri, g_filename_from_uri): implement.
|
||||
|
||||
2006-09-14 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* src/gutf8.c, test/utf8.c : EOL fix.
|
||||
|
||||
2006-09-04 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gmarkup.c: The leak fixing commit.
|
||||
|
||||
* src/gmarkup.c (g_markup_parse_context_end_parse): Add missing
|
||||
method.
|
||||
(g_markup_parse_context_free): Implement.
|
||||
(parse_attributes): Store the value, not the attribute name
|
||||
twice.
|
||||
Properly check the /> section.
|
||||
(g_markup_parse_context_parse): When checking for error, use the
|
||||
"error!=NULL && *error != NULL" upon return from callbacks,
|
||||
it is only then that its valid to check for *error for error
|
||||
conditions.
|
||||
(g_markup_parse_context_parse): Add comment processing.
|
||||
|
||||
Only release one element of the list.
|
||||
|
||||
* test/markup.c: Incorporate the kind of code that is used in Mono
|
||||
for domain loading; Will test the rest later.
|
||||
|
||||
2006-09-01 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gmarkup.c (g_markup_parse_context_parse): Add text parsing
|
||||
support, and end-element support; not tested yet.
|
||||
|
||||
2006-09-01 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* gutf8.c : bad allocation size. multiply sizeof gchar/gunichar2.
|
||||
|
||||
2006-09-01 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* gutf8.c : when error is null, utf8_to_utf16_len() and
|
||||
utf16_to_utf8_len() could return -1, so return NULL for those
|
||||
cases in g_utf8_to_utf16() and g_utf16_to_utf8().
|
||||
|
||||
2006-09-01 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gmarkup.c: Builds and does minimal parsing.
|
||||
|
||||
* test/markup.c: Sample test cases I have been using
|
||||
|
||||
2006-08-31 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* src/gerror.h,
|
||||
src/gerror.c : added g_set_error().
|
||||
* src/gutf8.c :
|
||||
g_utf8_to_utf16() and g_utf16_to_utf8() implementation.
|
||||
* src/glib.h : added all above, and some dependent bits.
|
||||
* src/Makefile.am : added gutf8.c.
|
||||
* TODO: removed above.
|
||||
* test/Makefile.am,
|
||||
test/tests.h : added utf8 tests.
|
||||
* test/utf8.c : test for g_utf8_to_utf16 and g_utf16_to_utf8.
|
||||
It still needs more tests e.g. for multibytes.
|
||||
|
||||
2006-08-31 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/gspawn.c: small touch-ups and make read/write EINTR-proof.
|
||||
|
||||
2006-08-31 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/file.c: remove useless test.
|
||||
|
||||
* test/spawn.c: new g_spawn_async_with_pipes test.
|
||||
* src/glib.h: Modified file.
|
||||
* src/gspawn.c: implemented g_spawn_async_with_pipes. Needs fine tuning.
|
||||
|
||||
2006-08-28 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TODO: Modified file.
|
||||
* test/tests.h:
|
||||
* test/pattern.c:
|
||||
* test/dir.c:
|
||||
* test/Makefile.am:
|
||||
* src/Makefile.am:
|
||||
* src/glib.h:
|
||||
* src/gdir.c:
|
||||
* src/gfile.c: implemented g_dir_*, unix version.
|
||||
|
||||
2006-08-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/glib.h:
|
||||
* test/Makefile.am: Modified file.
|
||||
* test/tests.h:
|
||||
* src/Makefile.am: Modified file.
|
||||
* test/pattern.c:
|
||||
* src/gpattern.c: implemented the 3 pattern matching functions used.
|
||||
|
||||
* test/ptrarray.c: fix the compare function to work with qsort.
|
||||
|
||||
* test/file.c:
|
||||
* test/path.c:
|
||||
* src/gspawn.c:
|
||||
* src/gpath.c: made valgrind happy.
|
||||
|
||||
2006-08-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/file.c:
|
||||
* src/glib.h:
|
||||
* src/gfile.c: implemented g_file_test. Changed the default mask to
|
||||
.XXXXXX. Add tests.
|
||||
|
||||
2006-08-26 Raja R Harinath <[email protected]>
|
||||
|
||||
* src/sort.frag.h (digit): Declare here based on externally
|
||||
provided typedef 'list_node'.
|
||||
(MAX_DIGITS): Use 'sizeof (list_node)'.
|
||||
* src/gslist.c (list_node): Declare instead of 'digit'.
|
||||
* src/glist.c: Likewise.
|
||||
|
||||
* test/slist.c (verify_sort): Verify the length of the list too.
|
||||
(test_slist_sort): Free the correct list.
|
||||
* test/list.c: Likewise.
|
||||
* src/sort.frag.h (MAX_DIGITS): Rename from N_DIGITS.
|
||||
(combine_sort): Change 'max_pos' argument to more natural
|
||||
'n_digits'.
|
||||
(increment): Likewise. Use 'n_digits' to avoid reading at an
|
||||
offset that hasn't been initialized.
|
||||
(do_sort): Remove memset.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TODO:
|
||||
* test/file.c:
|
||||
* src/glib.h:
|
||||
* src/gfile.c: implement g_file_open_tmp.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TODO:
|
||||
* src/glib.h:
|
||||
* src/gdate.c: New file.
|
||||
* src/gfile.c: New file.
|
||||
* src/Makefile.am: implemented g_file_get_contents and
|
||||
g_get_current_time.
|
||||
|
||||
* test/tests.h:
|
||||
* test/file.c: New file.
|
||||
* test/Makefile.am: tests for the above.
|
||||
|
||||
2006-08-26 Raja R Harinath <[email protected]>
|
||||
|
||||
* src/sort.frag.h: Add copyright notice and some explanation.
|
||||
(increment): Remove null check.
|
||||
(combine_digits): Add 'list' argument to seed the summation.
|
||||
(do_sort): Use the empty or singleton tail as the seed, rather
|
||||
than calling 'increment'.
|
||||
|
||||
2006-08-25 Raja R Harinath <[email protected]>
|
||||
|
||||
* TODO: Remove 'List' entries.
|
||||
* src/Makefile.am (libeglib_la_SOURCES): Add sort.frag.h.
|
||||
* src/sort.frag.h: New. Implements a "generic" bottom-up "counting"
|
||||
mergesort that works both on singly- and doubly-linked lists.
|
||||
* src/gslist.c (g_slist_sort): Use it.
|
||||
* src/glist.c (g_list_sort): Likewise.
|
||||
* src/glib.h (g_slist_sort, g_list_sort): Declare.
|
||||
* test/slist.c, test/list.c: Add basic testcases.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/gspawn.c: propagate errors from reads.
|
||||
* src/gpath.c: an empty PATH is like a NULL one.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/tests.h:
|
||||
* test/timer.c:
|
||||
* test/Makefile.am:
|
||||
* TODO:
|
||||
* src/glib.h:
|
||||
* src/gtimer.c:
|
||||
* src/Makefile.am: implemented GTimer.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/tests.h:
|
||||
* test/Makefile.am:
|
||||
* test/spawn.c:
|
||||
* src/gspawn.c:
|
||||
* src/glib.h:
|
||||
* src/Makefile.am: initial implentation of g_spawn_command_line_sync.
|
||||
Still need better error handling, but works for the most part.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/garray.c: grow faster so that the 'big' test does not crawl.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/shell.c:
|
||||
* src/gqueue.c: plugged leaks.
|
||||
|
||||
2006-08-25 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/path.c:
|
||||
* src/gpath.c: when PATH is not defined, the current dir is used.
|
||||
See execvp(3).
|
||||
|
||||
2006-08-25 Alp Toker <[email protected]>
|
||||
|
||||
* src/gstr.c: g_strv_length() should return guint, not gint
|
||||
* src/glib.h: Add g_strv_length() prototype
|
||||
|
||||
2006-08-24 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gpath.c (g_get_home_dir, g_get_tmp_dir, g_get_user_name,
|
||||
g_get_prgname, g_set_prgname): implemented.
|
||||
|
||||
* test/ Fix leaks.
|
||||
|
||||
* src/gpath.c (g_get_current_dir): Implement.
|
||||
|
||||
(g_find_program_in_path, g_path_is_absolute): implement.
|
||||
|
||||
Add g_path_get_dirname, g_path_get_basename
|
||||
|
||||
* src/gpath.c: Path routines
|
||||
|
||||
2006-08-23 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gerror.c: Implement.
|
||||
|
||||
* src/glist.c (g_list_sort): Remove routine instead of hoping that
|
||||
it wont crash when we run it.
|
||||
|
||||
2006-08-23 Raja R Harinath <[email protected]>
|
||||
|
||||
* src/glist.c (g_list_insert_before): Avoid non-head declaration.
|
||||
|
||||
* test/slist.c (test_slist_insert_before): Add.
|
||||
* src/gslist.c (g_slist_insert_before): Append if 'sibling' is null.
|
||||
|
||||
* test/list.c (test_list_insert_before): Add test for return value
|
||||
of g_list_insert_before.
|
||||
* test/Makefile.am (test_eglib_LDADD): Refer to the .la file so as
|
||||
to rebuild test if eglib changes.
|
||||
* src/glist.c (new_node, disconnect_node): New helpers that
|
||||
maintain doubly-linked list invariants.
|
||||
(g_list_prepend, g_list_append): Express in terms of new_node.
|
||||
(g_list_insert_before): Likewise. Fix return value when inserting
|
||||
in the middle of the list.
|
||||
(g_list_concat): Reorganize to make more compact.
|
||||
(g_list_nth): Likewise.
|
||||
(g_list_nth_data): Don't segfault if 'n' is too large.
|
||||
(g_list_remove): Rewrite using _find and disconnect_node.
|
||||
(g_list_remove_link): Don't traverse list: use disconnect_node.
|
||||
(g_list_insert_sorted): Rewrite to make more compact. Use new_node.
|
||||
(g_list_copy): Likewise.
|
||||
(_prepend, _concat): Remove.
|
||||
* src/gslist.c (insert_after, find_prev, find_prev_link):
|
||||
New helpers.
|
||||
(g_slist_copy): Simplify slightly, using insert_after.
|
||||
(g_slist_concat): Reorganize to make more compact.
|
||||
(g_slist_find): Likewise.
|
||||
(g_slist_insert_sorted): Likewise.
|
||||
(g_slist_remove): Rewrite using find_prev.
|
||||
(g_slist_remove_link): Rewrite using find_prev_link.
|
||||
(g_slist_remove_all, g_slist_insert_before): New.
|
||||
|
||||
2006-08-21 Duncan Mak <[email protected]>
|
||||
|
||||
* src/gqueue.c: GQueue implementation.
|
||||
* src/glib.h: Add prototypes.
|
||||
* src/Makefile.am (libeglib_la_SOURCES): Include gqueue.c.
|
||||
|
||||
* test/queue.c:
|
||||
* test/Makefile.am (SOURCES):
|
||||
* test/tests.h (DEFINE_TEST_GROUP_INIT_H): add tests for GQueue.
|
||||
|
||||
2006-08-21 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gstr.c: fixed bug/invalid read/write on malloc-only case (no
|
||||
realloc/delimiter token not found); use memcpy instead of strncpy for
|
||||
better performance
|
||||
|
||||
* test/test.c (run_group): allow running specific tests under a group;
|
||||
added copied g_strsplit/g_strfreev from EGlib source as eg_strsplit
|
||||
and eg_strfreev to avoid performance skews in the driver
|
||||
|
||||
* test/driver.c: allow user-specified group name to contain specific
|
||||
test to run under the group as 'group_name:test1,test2,...testN'
|
||||
|
||||
* test/string-util.c: Added more g_strsplit tests
|
||||
|
||||
* test/slist.c:
|
||||
* test/ptrarray.c:
|
||||
* test/fake.c:
|
||||
* test/string.c:
|
||||
* test/list.c:
|
||||
* test/array.c:
|
||||
* test/hashtable.c: make test names shorter (no need to prefix with
|
||||
the group since it runs under the group)
|
||||
|
||||
2006-08-21 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/glib.h (g_hash_table_new_full): Add missing prototype.
|
||||
Replace g_free(x) with plain free, so it can be used as a function
|
||||
argument.
|
||||
Add ABS
|
||||
|
||||
* src/ghashtable.c: Add rehashing.
|
||||
|
||||
* test/hashtable.c: Add a bunch of extra tests.
|
||||
|
||||
* src/goutput.c: Fix g_log so it actually formats the data.
|
||||
|
||||
* src/ghashtable.c (g_hash_table_new): The glib test suite
|
||||
uncovered a bunch of bugs, the g_hash_table_new should actually
|
||||
have parameters.
|
||||
|
||||
(g_hash_table_remove, g_hash_table_foreach_remove): Fixed bugs
|
||||
uncovered.
|
||||
|
||||
2006-08-20 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gmisc.c: added g_setenv, g_getenv, g_unsetenv
|
||||
|
||||
* src/gstr.c: added g_snprintf, g_sprintf, g_fprintf, g_printf
|
||||
|
||||
* src/glib.h: added macros for above va_args printf functions
|
||||
|
||||
* src/Makefile.am: added gmisc.c
|
||||
|
||||
* test/whats-implemented: script to see what needs to be implemented
|
||||
|
||||
2006-08-20 Chris Toshok <[email protected]>
|
||||
|
||||
* test/array.c (test_array_big): add a test from the glib
|
||||
documentation.
|
||||
|
||||
2006-08-20 Chris Toshok <[email protected]>
|
||||
|
||||
* test/tests.h: add array tests to the mix.
|
||||
|
||||
* test/array.c: a few array tests.
|
||||
|
||||
* src/glib.h: add array prototypes.
|
||||
|
||||
* src/garray.c: initial array foo.
|
||||
|
||||
* test/Makefile.am (SOURCES): add array.c
|
||||
|
||||
* src/Makefile.am (libeglib_la_SOURCES): add garray.c
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gstring.c: optimize and generalize reallocation by providing
|
||||
a GROW_IF_NECESSARY macro, do not use strcpy/strcat as they are
|
||||
very, very slow; GString is now much closer to GLib's implementation
|
||||
in terms of performance
|
||||
|
||||
* test/string.c: added speed-specific tests to beat on reallocation code
|
||||
|
||||
* test/test-both: run make if the test drivers don't exist
|
||||
|
||||
2006-08-19 Jonathan Chambers <[email protected]>
|
||||
|
||||
* src/gmodule.c: Add gmodule support for windows and fix
|
||||
windows build. Contribution is licensed as MIT/X11.
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/driver.c: Added --debug mode that allows for testing all paths
|
||||
of the driver without actually running real tests; runs only the 'fake'
|
||||
test, which does nothing; useful for running the driver through valgrind
|
||||
|
||||
* test/Makefile.am:
|
||||
* test/tests.h:
|
||||
* test/fake.c: Added fake test for valgrinding the driver
|
||||
|
||||
* test/ptrarray.c: update sort test
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test-both: added --help
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/driver.c: added -n mode to show only raw global run times,
|
||||
which is useful for scripts (test-both --speed-compare)
|
||||
|
||||
* test/test-both: added --speed-compare mode
|
||||
|
||||
* test/README: updated with information on --speed-compare
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test.c: do not print times if -t is not passed
|
||||
|
||||
* test/driver.c: removed use of GList from the driver to avoid skews due
|
||||
to performance differences between GLib and EGLib
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test.c: Perform iterations at the test level, only output one
|
||||
report for all iterations of tests in a group to produce more usable
|
||||
output; add timing for the tests and group; added get_timestamp for
|
||||
easy code timing
|
||||
|
||||
* test/test.h: Removed run_test as it should only be called from
|
||||
run_group, added get_timestamp
|
||||
|
||||
* test/Makefile.am: Added -DDRIVER_NAME
|
||||
|
||||
* test/test-both: simple script to run both drivers with the same options
|
||||
|
||||
* test/driver.c: Iterations are now run at the test level, show a global
|
||||
status (OK/FAIL) indicator
|
||||
|
||||
* test/README: Updated
|
||||
|
||||
* configure.ac: Renamed from configure.in as configure.in naming
|
||||
convention is deprecated in favor of configure.ac
|
||||
|
||||
* autogen.sh: s/configure.in/configure.ac/
|
||||
|
||||
2006-08-19 Miguel de Icaza <[email protected]>
|
||||
|
||||
* Makefile.am: Removed MAINTAINERCLEANFILES that was too
|
||||
aggresive, it failed make distcheck and the resulting tarball was
|
||||
not buildable.
|
||||
|
||||
* src/glib.h: remove the various GPOINTER_TO_*, G*_TO_POINTER,
|
||||
GSIZE_FORMAT macros, and move them into src/eglib-config.h
|
||||
|
||||
Moved also gssize and gsize to be arch specific. This should fix
|
||||
the 32/64 problems that Jon Chambers reported.
|
||||
|
||||
* configure.in: test for pointer size, define the various values
|
||||
depending on 32 vs 32/64 worlds, might need further porting in the
|
||||
future.
|
||||
|
||||
Change package name to eglib
|
||||
|
||||
* test/slist.c, test/list.c, test/hashtable.c: Update tests to use
|
||||
FAILURE macro.
|
||||
|
||||
* test/string-util.c: fix leak for valgrind tests.
|
||||
|
||||
* test/tests.h: New size test, for testing datatypes.
|
||||
|
||||
* test/sizes.c: New tests.
|
||||
|
||||
2006-08-19 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/README: Added quick guide on adding new tests/groups to the
|
||||
driver and some examples on how to perform various tests with the driver
|
||||
|
||||
2006-08-18 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/driver.c: Added getopt support and code timing, among other
|
||||
nice features to make testing/profiling easier
|
||||
|
||||
* test/test.c: Add support for suppressing output (quiet) and
|
||||
define RESULT, FAILED, and OK
|
||||
|
||||
* src/glib.h:
|
||||
* src/glist.c: Added g_list_nth_data implementation
|
||||
|
||||
* test/slist.c:
|
||||
* test/string-util.c:
|
||||
* test/ptrarray.c:
|
||||
* test/string.c:
|
||||
* test/hashtable.c:
|
||||
* test/list.c: Use RESULT, FAILURE, and OK for tests
|
||||
|
||||
2006-08-18 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gstring.c (g_string_truncate): Implement truncate.
|
||||
(g_string_prepend): implement.
|
||||
|
||||
Fix various bugs uncovered by new tests.
|
||||
|
||||
* src/glib.h: introduce gssize type, the signed one. Important.
|
||||
|
||||
* src/eglib-config.h (G_OS_): Add the G_OS_UNIX and G_OS_WIN32
|
||||
defines that we can use to check on the host OS.
|
||||
|
||||
2006-08-18 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test.[ch]:
|
||||
* test/driver.c: Support pass/fail logging on tests to show group report
|
||||
|
||||
2006-08-18 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test.c:
|
||||
* test/test.h: Added result() to be used in place of g_strdup_printf(),
|
||||
it's shorter to write and allows the duped string to be freed safely;
|
||||
added license header to file
|
||||
|
||||
* test/driver.c: Added license header to file
|
||||
|
||||
* test/string-util.c:
|
||||
* test/ptrarray.c:
|
||||
* test/string.c:
|
||||
* test/list.c: Use result() in place of g_strdup_printf(), it's nicer
|
||||
|
||||
2006-08-18 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gptrarray.c: Implemented g_ptr_array_sort
|
||||
|
||||
* test/ptrarray.c: Added sort test
|
||||
|
||||
* test/driver.c: Added --help; support running N iterations and allow
|
||||
selecting which test groups to run; uses the test group table in tests.h
|
||||
|
||||
* test/tests.h: Added group table
|
||||
|
||||
* test/test.h:
|
||||
* test/test.c: Using a Group structure and table, removed run_groups
|
||||
as we only need run_group now
|
||||
|
||||
* test/slist.h: Removed, not needed, tests/groups defined in tests.h
|
||||
|
||||
2006-08-18 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/unicode.c: New file, to host unicode code, it will throw as
|
||||
this code is no longer used in the Mono runtime anyways.
|
||||
|
||||
* src/glib.h: Use stdint.h types, a lot of the good stuff is
|
||||
replicated by glib.
|
||||
|
||||
2006-08-18 Duncan Mak <[email protected]>
|
||||
|
||||
* src/glist.c (g_list_remove, g_list_remove_link): Implemented.
|
||||
|
||||
* src/gslist.c (g_slist_remove): Remember to set the next pointer
|
||||
to NULL when the item to remove is the first item in the list.
|
||||
|
||||
2006-08-18 Duncan Mak <[email protected]>
|
||||
|
||||
* src/glist.c: Implemented. Missing remove,
|
||||
remove_link and insert_before.
|
||||
|
||||
* test/list.c: Tests for GList.
|
||||
|
||||
2006-08-17 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gptrarray.c: Implemented g_ptr_array_remove and
|
||||
g_ptr_array_remove_index
|
||||
|
||||
* test/other: Removed, rewritten in Makefile.am
|
||||
|
||||
* test/Makefile.am: Build test-eglib against local eglib and
|
||||
test-glib against GLib 2.0 (replaces 'other')
|
||||
|
||||
* test/ptrarray.c: Added tests for g_ptr_array_remove and
|
||||
g_ptr_array_remove_index
|
||||
|
||||
2006-08-17 Duncan Mak <[email protected]>
|
||||
|
||||
* src/gslist.c: Added MIT license.
|
||||
(g_slist_insert_sorted): Forgot the case where the data is
|
||||
appended to the end of the list.
|
||||
|
||||
* test/slist.c (test_slist_insert_sorted): Fix the test.
|
||||
|
||||
2006-08-17 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gptrarray.c: Added g_ptr_array_set_size implementation
|
||||
|
||||
* test/ptrarray.c: Added test for g_ptr_array_set_size
|
||||
|
||||
2006-08-17 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/glib.h: A handful of extra macros
|
||||
|
||||
* configure.in, src/eglib-config.h.in: Set some system-specific
|
||||
settings that are probed at configure time.
|
||||
|
||||
2006-08-17 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gptrarray.c: Added beginnings of GPtrArray (alloc, free, add, iterate)
|
||||
|
||||
* src/glib.h: Added GPtrArray signatures
|
||||
|
||||
* src/Makefile.am: Added gptrarray.c to build
|
||||
|
||||
* test/ptrarray.c:
|
||||
* test/tests.h:
|
||||
* test/driver.c:
|
||||
* test/Makefile.am: Add ptrarray tests for available functionality
|
||||
|
||||
2006-08-17 Aaron Bockover <[email protected]>
|
||||
|
||||
* test/test.h:
|
||||
* test/test.c: Added group iterator/test driver functionality
|
||||
|
||||
* test/driver.c: Added groups to run using new test functionality
|
||||
|
||||
* test/slist.h:
|
||||
* test/hashtable.h:
|
||||
* test/string-util.h: Test group definitions for string util/hashtable
|
||||
|
||||
* test/slist.c:
|
||||
* test/str.c:
|
||||
* test/hash.c: Added test definition table
|
||||
|
||||
* test/Makefile.am: Added -Wall -Werror -D_FORTIFY_SOURCE=2
|
||||
|
||||
* src/gstr.c: Added implementation for g_str_has_prefix, g_str_has_suffix
|
||||
|
||||
* src/glib.h: Added missing function signatures
|
||||
|
||||
* src/Makefile.am: added -D_FORTIFY_SOURCE=2
|
||||
|
||||
2006-08-17 Duncan Mak <[email protected]>
|
||||
|
||||
* src/gslist.c (g_slist_remove_link): I misread the function
|
||||
signature. Re-implemented.
|
||||
(g_slist_delete_link): Implemented.
|
||||
(g_slist_reverse): Implemented.
|
||||
(g_slist_insert_sorted): Implemented.
|
||||
|
||||
2006-08-17 Duncan Mak <[email protected]>
|
||||
|
||||
* src/gslist.c (g_slist_find):
|
||||
(g_slist_length):
|
||||
(g_slist_remove):
|
||||
(g_slist_remove_link): Implemented.
|
||||
|
||||
* test/slist.c: Tests for GSList.
|
||||
|
||||
2006-08-17 Raja R Harinath <[email protected]>
|
||||
|
||||
* src/gslist.c (g_slist_free_1): New. Free a single list node.
|
||||
(g_slist_free): Use it to free the list nodes. Don't free the
|
||||
data, since the list doesn't own it.
|
||||
(g_slist_append): Convert into a one-liner.
|
||||
(g_slist_foreach): Remove redundant null check.
|
||||
(g_slist_last): Actually return the last node.
|
||||
(g_slist_copy): Simplify.
|
||||
* src/gslist.h (g_slist_free_1): Add.
|
||||
|
||||
2006-08-16 Duncan Mak <[email protected]>
|
||||
|
||||
* src/gslist.c:
|
||||
|
||||
* src/gslist.h: First attempt at implementing GSList, incomplete.
|
||||
|
||||
* src/Makefile.am (libeglib_la_SOURCES): add gslist.c
|
||||
* src/glib.h: Add GFunc definition. #include the new gslist.h.
|
||||
|
||||
2006-08-16 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/Makefile.am: Added -Wall,-Werror, corrected lots of
|
||||
mistakes.
|
||||
|
||||
* src/gstring.c: Gstring implementation.
|
||||
|
||||
* test/str.c (test_gstring): string tests.
|
||||
|
||||
2006-08-16 Aaron Bockover <[email protected]>
|
||||
|
||||
* src/gstr.c: Added g_strsplit implementation
|
||||
|
||||
* test/driver.c: Run the split test
|
||||
|
||||
* test/str.c: Added a test for g_strsplit
|
||||
|
||||
* Makefile.am:
|
||||
* src/Makefile.am:
|
||||
* test/Makefile.am: Added MAINTAINERCLEANFILES
|
||||
|
||||
2006-08-16 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gouput.c: Implement some output routines, update missing
|
||||
progress.
|
||||
|
||||
* test: Add test driver, and initial tests.
|
||||
|
||||
2006-08-15 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/ghashtable.c: Implement most of this, it is completely
|
||||
untested at this point.
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
SUBDIRS = src test
|
||||
|
||||
EXTRA_DIST = autogen.sh README NEWS AUTHORS ChangeLog
|
||||
|
||||
Whitespace-only changes.
@@ -1,40 +0,0 @@
|
||||
|
||||
The purpose of eglib is to be an X11-licensed subset of glib that can
|
||||
be used with Mono when the Mono runtime is explicitly relicensed under
|
||||
a different license by Novell.
|
||||
|
||||
The implementation is done from the public documentation available here:
|
||||
|
||||
http://developer.gnome.org/doc/API/2.0/glib/
|
||||
|
||||
Currently this is only being built standalone, use:
|
||||
|
||||
./autogen.sh --prefix=/tmp/test
|
||||
|
||||
Currently all the definitions go into a single file: glib.h, there are
|
||||
no separate files, please try to follow the convetions in the source code
|
||||
|
||||
* Tests
|
||||
|
||||
Please read the README in tests/
|
||||
|
||||
* Plans: short and long term.
|
||||
|
||||
The short term plans for eglib is to allow Mono to optionally
|
||||
build with it instead of using glib, gmodule and gthread, but
|
||||
the default build will continue to be done against glib 2.0.
|
||||
|
||||
Our first target is to make this work with Linux, other
|
||||
platforms will follow after that.
|
||||
|
||||
In the long-term (Mono 2.0) we are considering dropping glib
|
||||
as a dependency, considering that Mono requires a modern Unix
|
||||
system to run anyways (for its thread support) it would allow
|
||||
us to fix some of the glib API limitations we have to live
|
||||
with (explicit thread support for example), rework the API to
|
||||
use types from stdint.h and we would be able to drop three
|
||||
external shared libraries.
|
||||
|
||||
This would reduce memory usage for the handful of routines
|
||||
that we use from glib, dynamic linker overhead for those and
|
||||
would allow us to tune the implementation to Mono's needs.
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
* Missing code
|
||||
|
||||
* Process launching
|
||||
3 g_shell_quote
|
||||
1 g_shell_unquote
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
* Should implement, for better performance:
|
||||
|
||||
Macros:
|
||||
6 G_UNLIKELY
|
||||
4 G_LIKELY
|
||||
|
||||
* Unimplemented, not supported currently:
|
||||
|
||||
g_unichar_tolower Used for deprecated unmanaged string collation
|
||||
g_unichar_type Used for deprecated unmanaged string collation
|
||||
|
||||
* Dead Code
|
||||
|
||||
The GMainLoop code was no longer in use in Mono.
|
||||
|
||||
* Windows implementations needed
|
||||
|
||||
Directory, File manipulation:
|
||||
|
||||
g_dir_open, g_dir_close, g_dir_read_name
|
||||
|
||||
We're missing a native windows implementation. The unix one is in place.
|
||||
|
||||
* Information retrieval
|
||||
1 g_win32_getlocale
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
# Ripped off from GNOME macros version
|
||||
|
||||
DIE=0
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
if [ -n "$MONO_PATH" ]; then
|
||||
# from -> /mono/lib:/another/mono/lib
|
||||
# to -> /mono /another/mono
|
||||
for i in `echo ${MONO_PATH} | tr ":" " "`; do
|
||||
i=`dirname ${i}`
|
||||
if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
|
||||
ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
|
||||
fi
|
||||
if [ -n "{i}" -a -d "${i}/bin" ]; then
|
||||
PATH="${i}/bin:$PATH"
|
||||
fi
|
||||
done
|
||||
export PATH
|
||||
fi
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`autoconf' installed to compile Mono."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if [ -z "$LIBTOOL" ]; then
|
||||
LIBTOOL=`which glibtool 2>/dev/null`
|
||||
if [ ! -x "$LIBTOOL" ]; then
|
||||
LIBTOOL=`which libtool`
|
||||
fi
|
||||
fi
|
||||
|
||||
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
|
||||
($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`libtool' installed to compile Mono."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
}
|
||||
|
||||
grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
|
||||
grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
|
||||
(gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`gettext' installed to compile Mono."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`automake' installed to compile Mono."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
NO_AUTOMAKE=yes
|
||||
}
|
||||
|
||||
|
||||
# if no automake, don't bother testing for aclocal
|
||||
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
|
||||
echo "installed doesn't appear recent enough."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "**Warning**: I am going to run \`configure' with no arguments."
|
||||
echo "If you wish to pass any to it, please specify them on the"
|
||||
echo \`$0\'" command line."
|
||||
echo
|
||||
fi
|
||||
|
||||
case $CC in
|
||||
xlc )
|
||||
am_opt=--include-deps;;
|
||||
esac
|
||||
|
||||
|
||||
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
|
||||
if test -z "$NO_LIBTOOLIZE" ; then
|
||||
echo "Running libtoolize..."
|
||||
${LIBTOOL}ize --force --copy
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Running aclocal $ACLOCAL_FLAGS ..."
|
||||
aclocal $ACLOCAL_FLAGS || {
|
||||
echo
|
||||
echo "**Error**: aclocal failed. This may mean that you have not"
|
||||
echo "installed all of the packages you need, or you may need to"
|
||||
echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
|
||||
echo "for the prefix where you installed the packages whose"
|
||||
echo "macros were not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
|
||||
echo "Running autoheader..."
|
||||
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
|
||||
fi
|
||||
|
||||
echo "Running automake --gnu $am_opt ..."
|
||||
automake --add-missing --gnu $am_opt ||
|
||||
{ echo "**Error**: automake failed."; exit 1; }
|
||||
echo "Running autoconf ..."
|
||||
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
|
||||
|
||||
|
||||
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||
|
||||
if test x$NOCONFIGURE = x; then
|
||||
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||
$srcdir/configure $conf_flags "$@" \
|
||||
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
|
||||
else
|
||||
echo Skipping configure process.
|
||||
fi
|
||||
@@ -1,82 +0,0 @@
|
||||
AC_INIT(README)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(eglib,0.1)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_LIBTOOL
|
||||
CFLAGS='-g -O0 -D_GNU_SOURCE'
|
||||
AC_SUBST(CFLAGS)
|
||||
GNUC_PRETTY=
|
||||
GNUC_UNUSED=
|
||||
BREAKPOINT="G_STMT_START { } G_STMT_END"
|
||||
if test x$GCC = xyes; then
|
||||
GNUC_UNUSED='__attribute__((__unused__))'
|
||||
GNUC_NORETURN='__attribute__((__noreturn__))'
|
||||
echo targte_cpu=$target_cpu
|
||||
case $target_cpu in
|
||||
i*86) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(GNUC_PRETTY)
|
||||
AC_SUBST(GNUC_UNUSED)
|
||||
AC_SUBST(GNUC_NORETURN)
|
||||
AC_SUBST(BREAKPOINT)
|
||||
|
||||
AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
|
||||
AC_SUBST(ORDER)
|
||||
|
||||
case $host in
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
PATHSEP='\\'
|
||||
SEARCHSEP=';'
|
||||
OS="WIN32"
|
||||
;;
|
||||
*)
|
||||
PATHSEP='/'
|
||||
SEARCHSEP=':'
|
||||
OS="UNIX"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(PATHSEP)
|
||||
AC_SUBST(SEARCHSEP)
|
||||
AC_SUBST(OS)
|
||||
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_FUNCS(strlcpy)
|
||||
|
||||
if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
|
||||
GPOINTER_TO_INT="((gint)(long) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint)(long) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer)(glong) (v))"
|
||||
GUINT_TO_POINTER="((gpointer)(gulong) (v))"
|
||||
GSIZE="long"
|
||||
GSIZE_FORMAT='"lu"'
|
||||
G_GUINT64_FORMAT='"lu"'
|
||||
else
|
||||
GPOINTER_TO_INT="((gint) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer) (v))"
|
||||
GUINT_TO_POINTER="((gpointer) (v))"
|
||||
GSIZE="int"
|
||||
GSIZE_FORMAT='"u"'
|
||||
G_GUINT64_FORMAT='"llu"'
|
||||
fi
|
||||
AC_SUBST(GPOINTER_TO_INT)
|
||||
AC_SUBST(GPOINTER_TO_UINT)
|
||||
AC_SUBST(GINT_TO_POINTER)
|
||||
AC_SUBST(GUINT_TO_POINTER)
|
||||
AC_SUBST(GSIZE)
|
||||
AC_SUBST(GSIZE_FORMAT)
|
||||
AC_SUBST(G_GUINT64_FORMAT)
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/eglib-config.h
|
||||
test/Makefile
|
||||
])
|
||||
@@ -1,41 +0,0 @@
|
||||
noinst_LTLIBRARIES = libeglib.la
|
||||
|
||||
libeglib_la_SOURCES = \
|
||||
eglib-config.h \
|
||||
sort.frag.h \
|
||||
glib.h \
|
||||
garray.c \
|
||||
gerror.c \
|
||||
ghashtable.c \
|
||||
gmem.c \
|
||||
gmodule.c \
|
||||
gmodule.h \
|
||||
goutput.c \
|
||||
gstr.c \
|
||||
gslist.c \
|
||||
gstring.c \
|
||||
gptrarray.c \
|
||||
glist.c \
|
||||
gmisc.c \
|
||||
gqueue.c \
|
||||
gpath.c \
|
||||
gshell.c \
|
||||
gspawn.c \
|
||||
gtimer.c \
|
||||
gdate.c \
|
||||
gfile.c \
|
||||
gpattern.c \
|
||||
gdir.c \
|
||||
gmarkup.c \
|
||||
gutf8.c \
|
||||
gunicode.c
|
||||
|
||||
libeglib_la_CFLAGS = -Wall -Werror -D_FORTIFY_SOURCE=2
|
||||
|
||||
INCLUDES = -I$(srcdir)
|
||||
|
||||
libeglib_la_LIBADD = -lm
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = eglib-config.h.in
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* System-dependent settings
|
||||
*/
|
||||
#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
|
||||
#define G_GNUC_UNUSED @GNUC_UNUSED@
|
||||
#define G_BYTE_ORDER @ORDER@
|
||||
#define G_GNUC_NORETURN @GNUC_NORETURN@
|
||||
#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
|
||||
#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
|
||||
#define G_DIR_SEPARATOR '@PATHSEP@'
|
||||
#define G_DIR_SEPARATOR_S "@PATHSEP@"
|
||||
#define G_BREAKPOINT() @BREAKPOINT@
|
||||
#define G_OS_@OS@
|
||||
#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
|
||||
#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
|
||||
#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
|
||||
#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
|
||||
|
||||
typedef unsigned @GSIZE@ gsize;
|
||||
typedef signed @GSIZE@ gssize;
|
||||
|
||||
#define G_GSIZE_FORMAT @GSIZE_FORMAT@
|
||||
#define G_GUINT64_FORMAT @G_GUINT64_FORMAT@
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Arrays
|
||||
*
|
||||
* Author:
|
||||
* Chris Toshok ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define INITIAL_CAPACITY 16
|
||||
|
||||
#define element_offset(p,i) ((p)->array.data + (i) * (p)->element_size)
|
||||
#define element_length(p,i) ((i) * (p)->element_size)
|
||||
|
||||
typedef struct {
|
||||
GArray array;
|
||||
gboolean clear_;
|
||||
gboolean element_size;
|
||||
gboolean zero_terminated;
|
||||
gint capacity;
|
||||
} GArrayPriv;
|
||||
|
||||
static void
|
||||
ensure_capacity (GArrayPriv *priv,
|
||||
int capacity)
|
||||
{
|
||||
int new_capacity = MAX (priv->capacity, INITIAL_CAPACITY);
|
||||
|
||||
if (capacity < priv->capacity)
|
||||
return;
|
||||
|
||||
while (new_capacity < capacity) {
|
||||
new_capacity <<= 1;
|
||||
}
|
||||
capacity = new_capacity;
|
||||
priv->array.data = (gchar*)g_realloc (priv->array.data, element_length (priv, capacity));
|
||||
|
||||
if (priv->clear_) {
|
||||
memset (element_offset (priv, priv->capacity),
|
||||
0,
|
||||
element_length (priv, capacity - priv->capacity));
|
||||
}
|
||||
priv->capacity = capacity;
|
||||
}
|
||||
|
||||
GArray *
|
||||
g_array_new (gboolean zero_terminated,
|
||||
gboolean clear_,
|
||||
guint element_size)
|
||||
{
|
||||
GArrayPriv *rv = g_new0 (GArrayPriv, 1);
|
||||
rv->zero_terminated = zero_terminated;
|
||||
rv->clear_ = clear_;
|
||||
rv->element_size = element_size;
|
||||
|
||||
ensure_capacity (rv, INITIAL_CAPACITY);
|
||||
|
||||
return (GArray*)rv;
|
||||
}
|
||||
|
||||
gchar*
|
||||
g_array_free (GArray *array,
|
||||
gboolean free_segment)
|
||||
{
|
||||
gchar* rv = NULL;
|
||||
|
||||
g_return_val_if_fail (array != NULL, NULL);
|
||||
|
||||
if (free_segment)
|
||||
g_free (array->data);
|
||||
else
|
||||
rv = array->data;
|
||||
|
||||
g_free (array);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
GArray *
|
||||
g_array_append_vals (GArray *array,
|
||||
gconstpointer data,
|
||||
guint len)
|
||||
{
|
||||
GArrayPriv *priv = (GArrayPriv*)array;
|
||||
|
||||
g_return_val_if_fail (array != NULL, NULL);
|
||||
|
||||
ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
|
||||
|
||||
memmove (element_offset (priv, priv->array.len),
|
||||
data,
|
||||
element_length (priv, len));
|
||||
|
||||
priv->array.len += len;
|
||||
|
||||
if (priv->zero_terminated) {
|
||||
memset (element_offset (priv, priv->array.len),
|
||||
0,
|
||||
priv->element_size);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
GArray*
|
||||
g_array_insert_vals (GArray *array,
|
||||
guint index_,
|
||||
gconstpointer data,
|
||||
guint len)
|
||||
{
|
||||
GArrayPriv *priv = (GArrayPriv*)array;
|
||||
guint extra = (priv->zero_terminated ? 1 : 0);
|
||||
|
||||
g_return_val_if_fail (array != NULL, NULL);
|
||||
|
||||
ensure_capacity (priv, array->len + len + extra);
|
||||
|
||||
/* first move the existing elements out of the way */
|
||||
memmove (element_offset (priv, index_ + len),
|
||||
element_offset (priv, index_),
|
||||
element_length (priv, array->len - index_));
|
||||
|
||||
/* then copy the new elements into the array */
|
||||
memmove (element_offset (priv, index_),
|
||||
data,
|
||||
element_length (priv, len));
|
||||
|
||||
array->len += len;
|
||||
|
||||
if (priv->zero_terminated) {
|
||||
memset (element_offset (priv, priv->array.len),
|
||||
0,
|
||||
priv->element_size);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
GArray*
|
||||
g_array_remove_index (GArray *array,
|
||||
guint index_)
|
||||
{
|
||||
GArrayPriv *priv = (GArrayPriv*)array;
|
||||
|
||||
g_return_val_if_fail (array != NULL, NULL);
|
||||
|
||||
memmove (element_offset (priv, index_),
|
||||
element_offset (priv, index_ + 1),
|
||||
element_length (priv, array->len - index_));
|
||||
|
||||
array->len --;
|
||||
|
||||
if (priv->zero_terminated) {
|
||||
memset (element_offset (priv, priv->array.len),
|
||||
0,
|
||||
priv->element_size);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Date and time utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
void
|
||||
g_get_current_time (GTimeVal *result)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
g_return_if_fail (result != NULL);
|
||||
gettimeofday (&tv, NULL);
|
||||
result->tv_sec = tv.tv_sec;
|
||||
result->tv_usec = tv.tv_usec;
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Directory utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
struct _GDir {
|
||||
#ifdef G_OS_WIN32
|
||||
#else
|
||||
DIR *dir;
|
||||
#endif
|
||||
};
|
||||
|
||||
GDir *
|
||||
g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
return NULL;
|
||||
#else
|
||||
GDir *dir;
|
||||
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
(void) flags; /* this is not used */
|
||||
dir = g_new (GDir, 1);
|
||||
dir->dir = opendir (path);
|
||||
if (dir->dir == NULL) {
|
||||
if (error) {
|
||||
gint err = errno;
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
}
|
||||
g_free (dir);
|
||||
return NULL;
|
||||
}
|
||||
return dir;
|
||||
#endif
|
||||
}
|
||||
|
||||
const gchar *
|
||||
g_dir_read_name (GDir *dir)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
return NULL;
|
||||
#else
|
||||
struct dirent *entry;
|
||||
|
||||
g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
|
||||
do {
|
||||
entry = readdir (dir->dir);
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
} while ((strcmp (entry->d_name, ".") == 0) || (strcmp (entry->d_name, "..") == 0));
|
||||
|
||||
return entry->d_name;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
g_dir_rewind (GDir *dir)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
#else
|
||||
g_return_if_fail (dir != NULL && dir->dir != NULL);
|
||||
rewinddir (dir->dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
g_dir_close (GDir *dir)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
#else
|
||||
g_return_if_fail (dir != NULL && dir->dir != NULL);
|
||||
closedir (dir->dir);
|
||||
dir->dir = NULL;
|
||||
g_free (dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* gerror.c: Error support.
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
GError *
|
||||
g_error_new (gpointer domain, gint code, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
GError *err = g_new (GError, 1);
|
||||
|
||||
err->domain = domain;
|
||||
err->code = code;
|
||||
|
||||
va_start (args, format);
|
||||
if (vasprintf (&err->message, format, args) == -1)
|
||||
err->message = g_strdup_printf ("internal: invalid format string %s", format);
|
||||
va_end (args);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
g_error_free (GError *error)
|
||||
{
|
||||
g_return_if_fail (error != NULL);
|
||||
|
||||
free (error->message);
|
||||
g_free (error);
|
||||
}
|
||||
|
||||
void
|
||||
g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (err) {
|
||||
va_start (args, format);
|
||||
*err = g_error_new (domain, code, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_propagate_error (GError **dest, GError *src)
|
||||
{
|
||||
if (dest == NULL){
|
||||
if (src)
|
||||
g_error_free (src);
|
||||
} else {
|
||||
*dest = src;
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
/*
|
||||
* File utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
GFileError
|
||||
g_file_error_from_errno (gint err_no)
|
||||
{
|
||||
switch (err_no) {
|
||||
case EEXIST:
|
||||
return G_FILE_ERROR_EXIST;
|
||||
case EISDIR:
|
||||
return G_FILE_ERROR_ISDIR;
|
||||
case EACCES:
|
||||
return G_FILE_ERROR_ACCES;
|
||||
case ENAMETOOLONG:
|
||||
return G_FILE_ERROR_NAMETOOLONG;
|
||||
case ENOENT:
|
||||
return G_FILE_ERROR_NOENT;
|
||||
case ENOTDIR:
|
||||
return G_FILE_ERROR_NOTDIR;
|
||||
case ENXIO:
|
||||
return G_FILE_ERROR_NXIO;
|
||||
case ENODEV:
|
||||
return G_FILE_ERROR_NODEV;
|
||||
case EROFS:
|
||||
return G_FILE_ERROR_ROFS;
|
||||
#ifdef ETXTBSY
|
||||
case ETXTBSY:
|
||||
return G_FILE_ERROR_TXTBSY;
|
||||
#endif
|
||||
case EFAULT:
|
||||
return G_FILE_ERROR_FAULT;
|
||||
#ifdef ELOOP
|
||||
case ELOOP:
|
||||
return G_FILE_ERROR_LOOP;
|
||||
#endif
|
||||
case ENOSPC:
|
||||
return G_FILE_ERROR_NOSPC;
|
||||
case ENOMEM:
|
||||
return G_FILE_ERROR_NOMEM;
|
||||
case EMFILE:
|
||||
return G_FILE_ERROR_MFILE;
|
||||
case ENFILE:
|
||||
return G_FILE_ERROR_NFILE;
|
||||
case EBADF:
|
||||
return G_FILE_ERROR_BADF;
|
||||
case EINVAL:
|
||||
return G_FILE_ERROR_INVAL;
|
||||
case EPIPE:
|
||||
return G_FILE_ERROR_PIPE;
|
||||
case EAGAIN:
|
||||
return G_FILE_ERROR_AGAIN;
|
||||
case EINTR:
|
||||
return G_FILE_ERROR_INTR;
|
||||
case EIO:
|
||||
return G_FILE_ERROR_IO;
|
||||
case EPERM:
|
||||
return G_FILE_ERROR_PERM;
|
||||
case ENOSYS:
|
||||
return G_FILE_ERROR_NOSYS;
|
||||
default:
|
||||
return G_FILE_ERROR_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef O_LARGEFILE
|
||||
#define OPEN_FLAGS (O_RDONLY)
|
||||
#else
|
||||
#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
|
||||
#endif
|
||||
gboolean
|
||||
g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
|
||||
{
|
||||
gchar *str;
|
||||
int fd;
|
||||
struct stat st;
|
||||
long offset;
|
||||
int nread;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (contents != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
*contents = NULL;
|
||||
if (length)
|
||||
*length = 0;
|
||||
|
||||
fd = open (filename, OPEN_FLAGS);
|
||||
if (fd == -1) {
|
||||
if (error != NULL) {
|
||||
int err = errno;
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fstat (fd, &st) != 0) {
|
||||
if (error != NULL) {
|
||||
int err = errno;
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()");
|
||||
}
|
||||
close (fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
str = g_malloc (st.st_size + 1);
|
||||
offset = 0;
|
||||
do {
|
||||
nread = read (fd, str + offset, st.st_size - offset);
|
||||
if (nread > 0) {
|
||||
offset += nread;
|
||||
}
|
||||
} while ((nread > 0 && offset < st.st_size) || (nread == -1 && errno == EINTR));
|
||||
|
||||
close (fd);
|
||||
str [st.st_size] = '\0';
|
||||
if (length) {
|
||||
*length = st.st_size;
|
||||
}
|
||||
*contents = str;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
|
||||
{
|
||||
const static gchar *default_tmpl = ".XXXXXX";
|
||||
gchar *t;
|
||||
gint fd;
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, -1);
|
||||
|
||||
if (tmpl == NULL)
|
||||
tmpl = default_tmpl;
|
||||
|
||||
if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
|
||||
if (error) {
|
||||
*error = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strlen (tmpl);
|
||||
if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
|
||||
if (error) {
|
||||
*error = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
|
||||
fd = mkstemp (t);
|
||||
if (fd == -1) {
|
||||
if (error) {
|
||||
int err = errno;
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()");
|
||||
}
|
||||
g_free (t);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (name_used) {
|
||||
*name_used = t;
|
||||
} else {
|
||||
g_free (t);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_file_test (const gchar *filename, GFileTest test)
|
||||
{
|
||||
struct stat st;
|
||||
gboolean have_stat;
|
||||
|
||||
if (filename == NULL || test == 0)
|
||||
return FALSE;
|
||||
|
||||
have_stat = FALSE;
|
||||
#ifdef G_OS_WIN32
|
||||
#else
|
||||
if ((test & G_FILE_TEST_EXISTS) != 0) {
|
||||
if (access (filename, F_OK) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
|
||||
if (access (filename, X_OK) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
|
||||
have_stat = (lstat (filename, &st) == 0);
|
||||
if (have_stat && S_ISLNK (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
|
||||
if (!have_stat)
|
||||
have_stat = (stat (filename, &st) == 0);
|
||||
if (have_stat && S_ISREG (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
if ((test & G_FILE_TEST_IS_DIR) != 0) {
|
||||
if (!have_stat)
|
||||
have_stat = (stat (filename, &st) == 0);
|
||||
if (have_stat && S_ISDIR (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,426 +0,0 @@
|
||||
/*
|
||||
* ghashtable.c: Hashtable implementation
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _Slot Slot;
|
||||
|
||||
struct _Slot {
|
||||
gpointer key;
|
||||
gpointer value;
|
||||
Slot *next;
|
||||
};
|
||||
|
||||
static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
|
||||
|
||||
struct _GHashTable {
|
||||
GHashFunc hash_func;
|
||||
GEqualFunc key_equal_func;
|
||||
|
||||
Slot **table;
|
||||
int table_size;
|
||||
int in_use;
|
||||
int threshold;
|
||||
int last_rehash;
|
||||
GDestroyNotify value_destroy_func, key_destroy_func;
|
||||
};
|
||||
|
||||
static const int prime_tbl[] = {
|
||||
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 gboolean
|
||||
test_prime (int x)
|
||||
{
|
||||
if ((x & 1) != 0) {
|
||||
int n;
|
||||
for (n = 3; n< (int)sqrt (x); n += 2) {
|
||||
if ((x % n) == 0)
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
// There is only one even prime - 2.
|
||||
return (x == 2);
|
||||
}
|
||||
|
||||
static int
|
||||
calc_prime (int x)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
|
||||
if (test_prime (i))
|
||||
return i;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
guint
|
||||
g_spaced_primes_closest (guint x)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (prime_tbl); i++) {
|
||||
if (x <= prime_tbl [i])
|
||||
return prime_tbl [i];
|
||||
}
|
||||
return calc_prime (x);
|
||||
}
|
||||
|
||||
GHashTable *
|
||||
g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func)
|
||||
{
|
||||
GHashTable *hash;
|
||||
|
||||
if (hash_func == NULL)
|
||||
hash_func = g_direct_hash;
|
||||
if (key_equal_func == NULL)
|
||||
key_equal_func = g_direct_equal;
|
||||
hash = g_new0 (GHashTable, 1);
|
||||
|
||||
hash->hash_func = hash_func;
|
||||
hash->key_equal_func = key_equal_func;
|
||||
|
||||
hash->table_size = g_spaced_primes_closest (1);
|
||||
hash->table = g_new0 (Slot *, hash->table_size);
|
||||
hash->last_rehash = hash->table_size;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
GHashTable *
|
||||
g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
|
||||
GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
|
||||
{
|
||||
GHashTable *hash = g_hash_table_new (hash_func, key_equal_func);
|
||||
if (hash == NULL)
|
||||
return NULL;
|
||||
|
||||
hash->key_destroy_func = key_destroy_func;
|
||||
hash->value_destroy_func = value_destroy_func;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
static void
|
||||
do_rehash (GHashTable *hash)
|
||||
{
|
||||
int current_size, i;
|
||||
Slot **table;
|
||||
|
||||
/* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
|
||||
hash->last_rehash = hash->table_size;
|
||||
current_size = hash->table_size;
|
||||
hash->table_size = g_spaced_primes_closest (hash->in_use);
|
||||
/* printf ("New size: %d\n", hash->table_size); */
|
||||
table = hash->table;
|
||||
hash->table = g_new0 (Slot *, hash->table_size);
|
||||
|
||||
for (i = 0; i < current_size; i++){
|
||||
Slot *s, *next;
|
||||
|
||||
for (s = table [i]; s != NULL; s = next){
|
||||
guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
|
||||
next = s->next;
|
||||
|
||||
s->next = hash->table [hashcode];
|
||||
hash->table [hashcode] = s;
|
||||
}
|
||||
}
|
||||
g_free (table);
|
||||
}
|
||||
|
||||
static void
|
||||
rehash (GHashTable *hash)
|
||||
{
|
||||
int diff = ABS (hash->last_rehash, hash->in_use);
|
||||
|
||||
/* These are the factors to play with to change the rehashing strategy */
|
||||
/* I played with them with a large range, and could not really get */
|
||||
/* something that was too good, maybe the tests are not that great */
|
||||
if (!(diff * 0.75 > hash->table_size * 2))
|
||||
return;
|
||||
do_rehash (hash);
|
||||
}
|
||||
|
||||
void
|
||||
g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace)
|
||||
{
|
||||
guint hashcode;
|
||||
Slot *s;
|
||||
GEqualFunc equal;
|
||||
|
||||
g_return_if_fail (hash != NULL);
|
||||
|
||||
equal = hash->key_equal_func;
|
||||
if (hash->in_use >= hash->threshold)
|
||||
rehash (hash);
|
||||
|
||||
hashcode = ((*hash->hash_func) (key)) % hash->table_size;
|
||||
for (s = hash->table [hashcode]; s != NULL; s = s->next){
|
||||
if ((*equal) (s->key, key)){
|
||||
if (replace){
|
||||
if (hash->key_destroy_func != NULL)
|
||||
(*hash->key_destroy_func)(s->key);
|
||||
s->key = key;
|
||||
}
|
||||
if (hash->value_destroy_func != NULL)
|
||||
(*hash->value_destroy_func) (s->value);
|
||||
s->value = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
s = g_new (Slot, 1);
|
||||
s->key = key;
|
||||
s->value = value;
|
||||
s->next = hash->table [hashcode];
|
||||
hash->table [hashcode] = s;
|
||||
hash->in_use++;
|
||||
}
|
||||
|
||||
guint
|
||||
g_hash_table_size (GHashTable *hash)
|
||||
{
|
||||
g_return_val_if_fail (hash != NULL, 0);
|
||||
|
||||
return hash->in_use;
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_hash_table_lookup (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
gpointer orig_key, value;
|
||||
|
||||
if (g_hash_table_lookup_extended (hash, key, &orig_key, &value))
|
||||
return value;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
|
||||
{
|
||||
GEqualFunc equal;
|
||||
Slot *s;
|
||||
guint hashcode;
|
||||
|
||||
g_return_val_if_fail (hash != NULL, FALSE);
|
||||
equal = hash->key_equal_func;
|
||||
|
||||
hashcode = ((*hash->hash_func) (key)) % hash->table_size;
|
||||
|
||||
for (s = hash->table [hashcode]; s != NULL; s = s->next){
|
||||
if ((*equal)(s->key, key)){
|
||||
*orig_key = s->key;
|
||||
*value = s->value;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_return_if_fail (hash != NULL);
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
for (i = 0; i < hash->table_size; i++){
|
||||
Slot *s;
|
||||
|
||||
for (s = hash->table [i]; s != NULL; s = s->next)
|
||||
(*func)(s->key, s->value, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (hash != NULL, NULL);
|
||||
g_return_val_if_fail (predicate != NULL, NULL);
|
||||
|
||||
for (i = 0; i < hash->table_size; i++){
|
||||
Slot *s;
|
||||
|
||||
for (s = hash->table [i]; s != NULL; s = s->next)
|
||||
if ((*predicate)(s->key, s->value, user_data))
|
||||
return s->value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_hash_table_remove (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
GEqualFunc equal;
|
||||
Slot *s, *last;
|
||||
guint hashcode;
|
||||
|
||||
g_return_val_if_fail (hash != NULL, FALSE);
|
||||
equal = hash->key_equal_func;
|
||||
|
||||
hashcode = ((*hash->hash_func)(key)) % hash->table_size;
|
||||
last = NULL;
|
||||
for (s = hash->table [hashcode]; s != NULL; s = s->next){
|
||||
if ((*equal)(s->key, key)){
|
||||
if (hash->key_destroy_func != NULL)
|
||||
(*hash->key_destroy_func)(s->key);
|
||||
if (hash->value_destroy_func != NULL)
|
||||
(*hash->value_destroy_func)(s->value);
|
||||
if (last == NULL)
|
||||
hash->table [hashcode] = s->next;
|
||||
else
|
||||
last->next = s->next;
|
||||
g_free (s);
|
||||
hash->in_use--;
|
||||
return TRUE;
|
||||
}
|
||||
last = s;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
guint
|
||||
g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
|
||||
{
|
||||
int i;
|
||||
int count = 0;
|
||||
|
||||
g_return_val_if_fail (hash != NULL, 0);
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
for (i = 0; i < hash->table_size; i++){
|
||||
Slot *s, *last;
|
||||
|
||||
last = NULL;
|
||||
for (s = hash->table [i]; s != NULL; ){
|
||||
if ((*func)(s->key, s->value, user_data)){
|
||||
Slot *n;
|
||||
|
||||
if (hash->key_destroy_func != NULL)
|
||||
(*hash->key_destroy_func)(s->key);
|
||||
if (hash->value_destroy_func != NULL)
|
||||
(*hash->value_destroy_func)(s->value);
|
||||
if (last == NULL){
|
||||
hash->table [i] = s->next;
|
||||
n = s->next;
|
||||
} else {
|
||||
last->next = s->next;
|
||||
n = last->next;
|
||||
}
|
||||
g_free (s);
|
||||
hash->in_use--;
|
||||
count++;
|
||||
s = n;
|
||||
} else {
|
||||
last = s;
|
||||
s = s->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count > 0)
|
||||
rehash (hash);
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
g_hash_table_destroy (GHashTable *hash)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_return_if_fail (hash != NULL);
|
||||
|
||||
for (i = 0; i < hash->table_size; i++){
|
||||
Slot *s, *next;
|
||||
|
||||
for (s = hash->table [i]; s != NULL; s = next){
|
||||
next = s->next;
|
||||
|
||||
if (hash->key_destroy_func != NULL)
|
||||
(*hash->key_destroy_func)(s->key);
|
||||
if (hash->value_destroy_func != NULL)
|
||||
(*hash->value_destroy_func)(s->value);
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
g_free (hash->table);
|
||||
|
||||
g_free (hash);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_direct_equal (gconstpointer v1, gconstpointer v2)
|
||||
{
|
||||
return v1 == v2;
|
||||
}
|
||||
|
||||
guint
|
||||
g_direct_hash (gconstpointer v1)
|
||||
{
|
||||
return GPOINTER_TO_UINT (v1);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_int_equal (gconstpointer v1, gconstpointer v2)
|
||||
{
|
||||
return GPOINTER_TO_INT (v1) == GPOINTER_TO_INT (v2);
|
||||
}
|
||||
|
||||
guint
|
||||
g_int_hash (gconstpointer v1)
|
||||
{
|
||||
return GPOINTER_TO_UINT(v1);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_str_equal (gconstpointer v1, gconstpointer v2)
|
||||
{
|
||||
return strcmp (v1, v2) == 0;
|
||||
}
|
||||
|
||||
guint
|
||||
g_str_hash (gconstpointer v1)
|
||||
{
|
||||
guint hash = 0;
|
||||
char *p = (char *) v1;
|
||||
|
||||
while (*p++)
|
||||
hash = (hash << 5) - (hash + *p);
|
||||
|
||||
return hash;
|
||||
}
|
||||
@@ -1,738 +0,0 @@
|
||||
#ifndef __GLIB_H
|
||||
#define __GLIB_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include <eglib-config.h>
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
|
||||
#endif
|
||||
|
||||
#define __EGLIB_X11 1
|
||||
/*
|
||||
* Basic data types
|
||||
*/
|
||||
typedef int gboolean;
|
||||
typedef int gint;
|
||||
typedef unsigned int guint;
|
||||
typedef short gshort;
|
||||
typedef unsigned short gushort;
|
||||
typedef long glong;
|
||||
typedef unsigned long gulong;
|
||||
typedef void * gpointer;
|
||||
typedef const void * gconstpointer;
|
||||
typedef char gchar;
|
||||
typedef unsigned char guchar;
|
||||
|
||||
/* Types defined in terms of the stdint.h */
|
||||
typedef int8_t gint8;
|
||||
typedef uint8_t guint8;
|
||||
typedef int16_t gint16;
|
||||
typedef uint16_t guint16;
|
||||
typedef int32_t gint32;
|
||||
typedef uint32_t guint32;
|
||||
typedef int64_t gint64;
|
||||
typedef uint64_t guint64;
|
||||
typedef float gfloat;
|
||||
typedef double gdouble;
|
||||
typedef uint16_t gunichar2;
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define G_N_ELEMENTS(s) (sizeof(s) / sizeof ((s) [0]))
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define G_MAXINT32 INT32_MAX
|
||||
#define G_MININT32 INT32_MIN
|
||||
#define G_MININT64 INT64_MIN
|
||||
#define G_MAXINT64 INT64_MAX
|
||||
|
||||
#define G_LITTLE_ENDIAN 1234
|
||||
#define G_BIG_ENDIAN 4321
|
||||
#define G_STMT_START do
|
||||
#define G_STMT_END while (0)
|
||||
|
||||
#define G_USEC_PER_SEC 1000000
|
||||
|
||||
#define ABS(a,b) (((a)>(b)) ? ((a)-(b)) : ((b)-(a)))
|
||||
|
||||
#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
|
||||
|
||||
#define EGLIB_STRINGIFY(x) #x
|
||||
#define EGLIB_TOSTRING(x) EGLIB_STRINGIFY(x)
|
||||
#define G_STRLOC __FILE__ ":" EGLIB_TOSTRING(__LINE__) ":"
|
||||
|
||||
#define G_BEGIN_DECLS
|
||||
#define G_END_DECLS
|
||||
|
||||
#define G_CONST_RETURN const
|
||||
|
||||
/*
|
||||
* Allocation
|
||||
*/
|
||||
#define g_new(type,size) ((type *) malloc (sizeof (type) * (size)))
|
||||
#define g_new0(type,size) ((type *) calloc (sizeof (type), (size)))
|
||||
#define g_newa(type,size) ((type *) alloca (sizeof (type) * (size)))
|
||||
#define g_realloc(obj,size) realloc((obj), (size))
|
||||
#define g_malloc(x) malloc(x)
|
||||
#define g_try_malloc(x) malloc(x)
|
||||
#define g_try_realloc(obj,size) realloc((obj),(size))
|
||||
#define g_malloc0(x) calloc(1,x)
|
||||
#define g_memmove(dest,src,len) memmove (dest, src, len)
|
||||
#define g_renew(struct_type, mem, n_structs) realloc (mem, sizeof (struct_type) * n_structs)
|
||||
#define g_alloca(size) alloca (size)
|
||||
#define g_free free
|
||||
|
||||
gpointer g_memdup (gconstpointer mem, guint byte_size);
|
||||
gchar *g_strdup (const gchar *str);
|
||||
|
||||
typedef struct {
|
||||
gpointer (*malloc) (gsize n_bytes);
|
||||
gpointer (*realloc) (gpointer mem, gsize n_bytes);
|
||||
void (*free) (gpointer mem);
|
||||
gpointer (*calloc) (gsize n_blocks, gsize n_block_bytes);
|
||||
gpointer (*try_malloc) (gsize n_bytes);
|
||||
gpointer (*try_realloc) (gpointer mem, gsize n_bytes);
|
||||
} GMemVTable;
|
||||
|
||||
#define g_mem_set_vtable(x)
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
#define g_atexit(func) ((void) atexit (func))
|
||||
|
||||
const gchar * g_getenv(const gchar *variable);
|
||||
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
|
||||
void g_unsetenv(const gchar *variable);
|
||||
|
||||
/*
|
||||
* Precondition macros
|
||||
*/
|
||||
#define g_return_if_fail(x) G_STMT_START { if (!(x)) { printf ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return; } } G_STMT_END
|
||||
#define g_return_val_if_fail(x,e) G_STMT_START { if (!(x)) { printf ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return (e); } } G_STMT_END
|
||||
|
||||
/*
|
||||
* Hashtables
|
||||
*/
|
||||
typedef struct _GHashTable GHashTable;
|
||||
typedef void (*GFunc) (gpointer data, gpointer user_data);
|
||||
typedef gint (*GCompareFunc) (gconstpointer a, gconstpointer b);
|
||||
typedef gint (*GCompareDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
|
||||
typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
|
||||
typedef gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data);
|
||||
typedef void (*GDestroyNotify) (gpointer data);
|
||||
typedef guint (*GHashFunc) (gconstpointer key);
|
||||
typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);
|
||||
|
||||
GHashTable *g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func);
|
||||
GHashTable *g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
|
||||
GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
|
||||
void g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace);
|
||||
guint g_hash_table_size (GHashTable *hash);
|
||||
gpointer g_hash_table_lookup (GHashTable *hash, gconstpointer key);
|
||||
gboolean g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value);
|
||||
void g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data);
|
||||
gpointer g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data);
|
||||
gboolean g_hash_table_remove (GHashTable *hash, gconstpointer key);
|
||||
guint g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data);
|
||||
void g_hash_table_destroy (GHashTable *hash);
|
||||
|
||||
guint g_spaced_primes_closest (guint x);
|
||||
|
||||
#define g_hash_table_insert(h,k,v) g_hash_table_insert_replace ((h),(k),(v),FALSE)
|
||||
#define g_hash_table_replace(h,k,v) g_hash_table_insert_replace ((h),(k),(v),TRUE)
|
||||
|
||||
gboolean g_direct_equal (gconstpointer v1, gconstpointer v2);
|
||||
guint g_direct_hash (gconstpointer v1);
|
||||
gboolean g_int_equal (gconstpointer v1, gconstpointer v2);
|
||||
guint g_int_hash (gconstpointer v1);
|
||||
gboolean g_str_equal (gconstpointer v1, gconstpointer v2);
|
||||
guint g_str_hash (gconstpointer v1);
|
||||
|
||||
#define g_assert(x) G_STMT_START { if (!(x)) g_error ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END
|
||||
#define g_assert_not_reached() G_STMT_START { g_error ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } G_STMT_END
|
||||
|
||||
/*
|
||||
* Errors
|
||||
*/
|
||||
typedef struct {
|
||||
/* In the real glib, this is a GQuark, but we dont use/need that */
|
||||
gpointer domain;
|
||||
gint code;
|
||||
gchar *message;
|
||||
} GError;
|
||||
|
||||
void g_error_free (GError *error);
|
||||
GError *g_error_new (gpointer domain, gint code, const char *format, ...);
|
||||
void g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...);
|
||||
void g_propagate_error (GError **dest, GError *src);
|
||||
|
||||
/*
|
||||
* Strings utility
|
||||
*/
|
||||
gchar *g_strdup_printf (const gchar *format, ...);
|
||||
gchar *g_strdup_vprintf (const gchar *format, va_list args);
|
||||
gchar *g_strndup (const gchar *str, gsize n);
|
||||
const gchar *g_strerror (gint errnum);
|
||||
gchar *g_strndup (const gchar *str, gsize n);
|
||||
void g_strfreev (gchar **str_array);
|
||||
gchar *g_strconcat (const gchar *first, ...);
|
||||
gchar **g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
|
||||
gchar *g_strreverse (gchar *str);
|
||||
gboolean g_str_has_prefix (const gchar *str, const gchar *prefix);
|
||||
gboolean g_str_has_suffix (const gchar *str, const gchar *suffix);
|
||||
guint g_strv_length (gchar **str_array);
|
||||
gchar *g_strjoin (const gchar *separator, ...);
|
||||
gchar *g_strjoinv (const gchar *separator, gchar **str_array);
|
||||
gchar *g_strchug (gchar *str);
|
||||
gchar *g_strchomp (gchar *str);
|
||||
void g_strdown (gchar *string);
|
||||
|
||||
gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
|
||||
gchar *g_strescape (const gchar *source, const gchar *exceptions);
|
||||
|
||||
gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error);
|
||||
gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error);
|
||||
|
||||
gint g_printf (gchar const *format, ...);
|
||||
gint g_fprintf (FILE *file, gchar const *format, ...);
|
||||
gint g_sprintf (gchar *string, gchar const *format, ...);
|
||||
gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
|
||||
#define g_vprintf vprintf
|
||||
#define g_vfprintf vfprintf
|
||||
#define g_vsprintf vsprintf
|
||||
#define g_vsnprintf vsnprintf
|
||||
#define g_vasprintf vasprintf
|
||||
|
||||
#ifdef HAVE_STRLCPY
|
||||
#define g_strlcpy strlcpy
|
||||
#else
|
||||
gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size);
|
||||
#endif
|
||||
|
||||
gchar *g_ascii_strdown (const gchar *str, gssize len);
|
||||
gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n);
|
||||
gint g_ascii_xdigit_value (gchar c);
|
||||
#define g_ascii_isspace(c) (isspace (c) != 0)
|
||||
#define g_ascii_isalpha(c) (isalpha (c) != 0)
|
||||
#define g_ascii_isprint(c) (isprint (c) != 0)
|
||||
#define g_ascii_isxdigit(c) (isxdigit (c) != 0)
|
||||
|
||||
/* FIXME: g_strcasecmp supports utf8 unicode stuff */
|
||||
#define g_strcasecmp strcasecmp
|
||||
#define g_ascii_strcasecmp strcasecmp
|
||||
#define g_strncasecmp strncasecmp
|
||||
#define g_strstrip(a) g_strchug (g_strchomp (a))
|
||||
|
||||
#define G_STR_DELIMITERS "_-|> <."
|
||||
|
||||
/*
|
||||
* String type
|
||||
*/
|
||||
typedef struct {
|
||||
char *str;
|
||||
gsize len;
|
||||
gsize allocated_len;
|
||||
} GString;
|
||||
|
||||
GString *g_string_new (const gchar *init);
|
||||
GString *g_string_new_len (const gchar *init, gssize len);
|
||||
GString *g_string_sized_new (gsize default_size);
|
||||
gchar *g_string_free (GString *string, gboolean free_segment);
|
||||
GString *g_string_append (GString *string, const gchar *val);
|
||||
void g_string_printf (GString *string, const gchar *format, ...);
|
||||
void g_string_append_printf (GString *string, const gchar *format, ...);
|
||||
GString *g_string_append_c (GString *string, gchar c);
|
||||
GString *g_string_append (GString *string, const gchar *val);
|
||||
GString *g_string_append_len (GString *string, const gchar *val, gssize len);
|
||||
GString *g_string_truncate (GString *string, gsize len);
|
||||
GString *g_string_prepend (GString *string, const gchar *val);
|
||||
|
||||
#define g_string_sprintfa g_string_append_printf
|
||||
|
||||
/*
|
||||
* Lists
|
||||
*/
|
||||
typedef struct _GSList GSList;
|
||||
struct _GSList {
|
||||
gpointer data;
|
||||
GSList *next;
|
||||
};
|
||||
|
||||
GSList *g_slist_alloc (void);
|
||||
GSList *g_slist_append (GSList *list,
|
||||
gpointer data);
|
||||
GSList *g_slist_prepend (GSList *list,
|
||||
gpointer data);
|
||||
void g_slist_free (GSList *list);
|
||||
void g_slist_free_1 (GSList *list);
|
||||
GSList *g_slist_copy (GSList *list);
|
||||
GSList *g_slist_concat (GSList *list1,
|
||||
GSList *list2);
|
||||
void g_slist_foreach (GSList *list,
|
||||
GFunc func,
|
||||
gpointer user_data);
|
||||
GSList *g_slist_last (GSList *list);
|
||||
GSList *g_slist_find (GSList *list,
|
||||
gconstpointer data);
|
||||
GSList *g_slist_remove (GSList *list,
|
||||
gconstpointer data);
|
||||
GSList *g_slist_remove_all (GSList *list,
|
||||
gconstpointer data);
|
||||
GSList *g_slist_reverse (GSList *list);
|
||||
guint g_slist_length (GSList *list);
|
||||
GSList *g_slist_remove_link (GSList *list,
|
||||
GSList *link);
|
||||
GSList *g_slist_delete_link (GSList *list,
|
||||
GSList *link);
|
||||
GSList *g_slist_insert_sorted (GSList *list,
|
||||
gpointer data,
|
||||
GCompareFunc func);
|
||||
GSList *g_slist_insert_before (GSList *list,
|
||||
GSList *sibling,
|
||||
gpointer data);
|
||||
GSList *g_slist_sort (GSList *list,
|
||||
GCompareFunc func);
|
||||
#define g_slist_next(slist) ((slist) ? (((GSList *) (slist))->next) : NULL)
|
||||
|
||||
typedef struct _GList GList;
|
||||
struct _GList {
|
||||
gpointer data;
|
||||
GList *next;
|
||||
GList *prev;
|
||||
};
|
||||
|
||||
#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
|
||||
|
||||
GList *g_list_alloc (void);
|
||||
GList *g_list_append (GList *list,
|
||||
gpointer data);
|
||||
GList *g_list_prepend (GList *list,
|
||||
gpointer data);
|
||||
void g_list_free (GList *list);
|
||||
void g_list_free_1 (GList *list);
|
||||
GList *g_list_copy (GList *list);
|
||||
guint g_list_length (GList *list);
|
||||
gint g_list_index (GList *list,
|
||||
gconstpointer data);
|
||||
GList *g_list_nth (GList *list,
|
||||
guint n);
|
||||
gpointer g_list_nth_data (GList *list,
|
||||
guint n);
|
||||
GList *g_list_last (GList *list);
|
||||
GList *g_list_concat (GList *list1,
|
||||
GList *list2);
|
||||
void g_list_foreach (GList *list,
|
||||
GFunc func,
|
||||
gpointer user_data);
|
||||
GList *g_list_first (GList *list);
|
||||
GList *g_list_find (GList *list,
|
||||
gconstpointer data);
|
||||
GList *g_list_remove (GList *list,
|
||||
gconstpointer data);
|
||||
GList *g_list_reverse (GList *list);
|
||||
GList *g_list_remove_link (GList *list,
|
||||
GList *link);
|
||||
GList *g_list_delete_link (GList *list,
|
||||
GList *link);
|
||||
GList *g_list_insert_sorted (GList *list,
|
||||
gpointer data,
|
||||
GCompareFunc func);
|
||||
GList *g_list_insert_before (GList *list,
|
||||
GList *sibling,
|
||||
gpointer data);
|
||||
GList *g_list_sort (GList *sort,
|
||||
GCompareFunc func);
|
||||
|
||||
/*
|
||||
* Array
|
||||
*/
|
||||
|
||||
typedef struct _GArray GArray;
|
||||
struct _GArray {
|
||||
gchar *data;
|
||||
gint len;
|
||||
};
|
||||
|
||||
GArray *g_array_new (gboolean zero_terminated, gboolean clear_, guint element_size);
|
||||
gchar* g_array_free (GArray *array, gboolean free_segment);
|
||||
GArray *g_array_append_vals (GArray *array, gconstpointer data, guint len);
|
||||
GArray* g_array_insert_vals (GArray *array, guint index_, gconstpointer data, guint len);
|
||||
GArray* g_array_remove_index (GArray *array, guint index_);
|
||||
|
||||
#define g_array_append_val(a,v) (g_array_append_vals((a),&(v),1))
|
||||
#define g_array_insert_val(a,i,v) (g_array_insert_vals((a),(i),&(v),1))
|
||||
#define g_array_index(a,t,i) *(t*)(((a)->data) + sizeof(t) * (i))
|
||||
|
||||
/*
|
||||
* Pointer Array
|
||||
*/
|
||||
|
||||
typedef struct _GPtrArray GPtrArray;
|
||||
struct _GPtrArray {
|
||||
gpointer *pdata;
|
||||
guint len;
|
||||
};
|
||||
|
||||
GPtrArray *g_ptr_array_new (void);
|
||||
GPtrArray *g_ptr_array_sized_new (guint reserved_size);
|
||||
void g_ptr_array_add (GPtrArray *array, gpointer data);
|
||||
gboolean g_ptr_array_remove (GPtrArray *array, gpointer data);
|
||||
gpointer g_ptr_array_remove_index (GPtrArray *array, guint index);
|
||||
gboolean g_ptr_array_remove_fast (GPtrArray *array, gpointer data);
|
||||
gpointer g_ptr_array_remove_index_fast (GPtrArray *array, gpointer data);
|
||||
void g_ptr_array_sort (GPtrArray *array, GCompareFunc compare_func);
|
||||
void g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare_func, gpointer user_data);
|
||||
void g_ptr_array_set_size (GPtrArray *array, gint length);
|
||||
gpointer *g_ptr_array_free (GPtrArray *array, gboolean free_seg);
|
||||
void g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer user_data);
|
||||
#define g_ptr_array_index(array,index) (array)->pdata[(index)]
|
||||
|
||||
/*
|
||||
* Queues
|
||||
*/
|
||||
typedef struct {
|
||||
GList *head;
|
||||
GList *tail;
|
||||
guint length;
|
||||
} GQueue;
|
||||
|
||||
gpointer g_queue_pop_head (GQueue *queue);
|
||||
void g_queue_push_head (GQueue *queue,
|
||||
gpointer data);
|
||||
gboolean g_queue_is_empty (GQueue *queue);
|
||||
GQueue *g_queue_new (void);
|
||||
void g_queue_free (GQueue *queue);
|
||||
|
||||
/*
|
||||
* Messages
|
||||
*/
|
||||
#ifndef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN ((gchar*) 0)
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
G_LOG_FLAG_RECURSION = 1 << 0,
|
||||
G_LOG_FLAG_FATAL = 1 << 1,
|
||||
|
||||
G_LOG_LEVEL_ERROR = 1 << 2,
|
||||
G_LOG_LEVEL_CRITICAL = 1 << 3,
|
||||
G_LOG_LEVEL_WARNING = 1 << 4,
|
||||
G_LOG_LEVEL_MESSAGE = 1 << 5,
|
||||
G_LOG_LEVEL_INFO = 1 << 6,
|
||||
G_LOG_LEVEL_DEBUG = 1 << 7,
|
||||
|
||||
G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
|
||||
} GLogLevelFlags;
|
||||
|
||||
void g_print (const gchar *format, ...);
|
||||
GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
|
||||
GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);
|
||||
void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args);
|
||||
void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...);
|
||||
|
||||
#define g_error(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format)
|
||||
#define g_critical(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format)
|
||||
#define g_warning(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format)
|
||||
#define g_message(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format)
|
||||
#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
|
||||
|
||||
#define g_log_set_handler(a,b,c,d)
|
||||
#define g_printerr(format...) fprintf (stderr, format)
|
||||
/*
|
||||
* Conversions
|
||||
*/
|
||||
|
||||
gpointer g_convert_error_quark(void);
|
||||
|
||||
|
||||
/*
|
||||
* Unicode Manipulation: most of this is not used by Mono by default, it is
|
||||
* only used if the old collation code is activated, so this is only the
|
||||
* bare minimum to build.
|
||||
*/
|
||||
typedef guint32 gunichar;
|
||||
|
||||
typedef enum {
|
||||
G_UNICODE_LOWERCASE_LETTER,
|
||||
} GUnicodeType;
|
||||
|
||||
gunichar g_unichar_tolower (gunichar c);
|
||||
GUnicodeType g_unichar_type (gunichar c);
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/* FIXME: Implement these two for gcc */
|
||||
#define G_LIKELY(x) (x)
|
||||
#define G_UNLIKELY(x) (x)
|
||||
|
||||
/*
|
||||
* Unicode conversion
|
||||
*/
|
||||
|
||||
#define G_CONVERT_ERROR g_convert_error_quark()
|
||||
|
||||
typedef enum {
|
||||
G_CONVERT_ERROR_NO_CONVERSION,
|
||||
G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
|
||||
G_CONVERT_ERROR_FAILED,
|
||||
G_CONVERT_ERROR_PARTIAL_INPUT,
|
||||
G_CONVERT_ERROR_BAD_URI,
|
||||
G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
|
||||
} GConvertError;
|
||||
|
||||
gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **error);
|
||||
gchar *g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **error);
|
||||
|
||||
/*
|
||||
* Path
|
||||
*/
|
||||
gchar *g_build_path (const gchar *separator, const gchar *first_element, ...);
|
||||
#define g_build_filename(x...) g_build_path(G_DIR_SEPARATOR_S, x)
|
||||
gchar *g_path_get_dirname (const gchar *filename);
|
||||
gchar *g_path_get_basename (const char *filename);
|
||||
gchar *g_find_program_in_path (const gchar *program);
|
||||
gchar *g_get_current_dir (void);
|
||||
gboolean g_path_is_absolute (const char *filename);
|
||||
|
||||
const gchar *g_get_home_dir (void);
|
||||
const gchar *g_get_tmp_dir (void);
|
||||
const gchar *g_get_user_name (void);
|
||||
gchar *g_get_prgname (void);
|
||||
void g_set_prgname (const gchar *prgname);
|
||||
|
||||
/*
|
||||
* Shell
|
||||
*/
|
||||
|
||||
gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error);
|
||||
gchar *g_shell_unquote (const gchar *quoted_string, GError **error);
|
||||
gchar *g_shell_quote (const gchar *unquoted_string);
|
||||
|
||||
/*
|
||||
* Spawn
|
||||
*/
|
||||
typedef enum {
|
||||
G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
|
||||
G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
|
||||
G_SPAWN_SEARCH_PATH = 1 << 2,
|
||||
G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
|
||||
G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
|
||||
G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
|
||||
G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
|
||||
} GSpawnFlags;
|
||||
|
||||
typedef pid_t GPid;
|
||||
|
||||
typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
|
||||
|
||||
gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error);
|
||||
gboolean g_spawn_async_with_pipes (const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup,
|
||||
gpointer user_data, GPid *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
|
||||
|
||||
|
||||
/*
|
||||
* Timer
|
||||
*/
|
||||
typedef struct _GTimer GTimer;
|
||||
|
||||
GTimer *g_timer_new (void);
|
||||
void g_timer_destroy (GTimer *timer);
|
||||
gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds);
|
||||
void g_timer_stop (GTimer *timer);
|
||||
void g_timer_start (GTimer *timer);
|
||||
|
||||
/*
|
||||
* Date and time
|
||||
*/
|
||||
typedef struct {
|
||||
glong tv_sec;
|
||||
glong tv_usec;
|
||||
} GTimeVal;
|
||||
|
||||
void g_get_current_time (GTimeVal *result);
|
||||
|
||||
/*
|
||||
* File
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
G_FILE_ERROR_EXIST,
|
||||
G_FILE_ERROR_ISDIR,
|
||||
G_FILE_ERROR_ACCES,
|
||||
G_FILE_ERROR_NAMETOOLONG,
|
||||
G_FILE_ERROR_NOENT,
|
||||
G_FILE_ERROR_NOTDIR,
|
||||
G_FILE_ERROR_NXIO,
|
||||
G_FILE_ERROR_NODEV,
|
||||
G_FILE_ERROR_ROFS,
|
||||
G_FILE_ERROR_TXTBSY,
|
||||
G_FILE_ERROR_FAULT,
|
||||
G_FILE_ERROR_LOOP,
|
||||
G_FILE_ERROR_NOSPC,
|
||||
G_FILE_ERROR_NOMEM,
|
||||
G_FILE_ERROR_MFILE,
|
||||
G_FILE_ERROR_NFILE,
|
||||
G_FILE_ERROR_BADF,
|
||||
G_FILE_ERROR_INVAL,
|
||||
G_FILE_ERROR_PIPE,
|
||||
G_FILE_ERROR_AGAIN,
|
||||
G_FILE_ERROR_INTR,
|
||||
G_FILE_ERROR_IO,
|
||||
G_FILE_ERROR_PERM,
|
||||
G_FILE_ERROR_NOSYS,
|
||||
G_FILE_ERROR_FAILED
|
||||
} GFileError;
|
||||
|
||||
typedef enum {
|
||||
G_FILE_TEST_IS_REGULAR = 1 << 0,
|
||||
G_FILE_TEST_IS_SYMLINK = 1 << 1,
|
||||
G_FILE_TEST_IS_DIR = 1 << 2,
|
||||
G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
|
||||
G_FILE_TEST_EXISTS = 1 << 4
|
||||
} GFileTest;
|
||||
|
||||
|
||||
gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error);
|
||||
GFileError g_file_error_from_errno (gint err_no);
|
||||
gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error);
|
||||
gboolean g_file_test (const gchar *filename, GFileTest test);
|
||||
|
||||
/*
|
||||
* Pattern matching
|
||||
*/
|
||||
typedef struct _GPatternSpec GPatternSpec;
|
||||
GPatternSpec * g_pattern_spec_new (const gchar *pattern);
|
||||
void g_pattern_spec_free (GPatternSpec *pspec);
|
||||
gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string);
|
||||
|
||||
/*
|
||||
* Directory
|
||||
*/
|
||||
typedef struct _GDir GDir;
|
||||
GDir *g_dir_open (const gchar *path, guint flags, GError **error);
|
||||
const gchar *g_dir_read_name (GDir *dir);
|
||||
void g_dir_rewind (GDir *dir);
|
||||
void g_dir_close (GDir *dir);
|
||||
|
||||
/*
|
||||
* GMarkup
|
||||
*/
|
||||
typedef struct _GMarkupParseContext GMarkupParseContext;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
|
||||
G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1
|
||||
} GMarkupParseFlags;
|
||||
|
||||
typedef struct {
|
||||
void (*start_element) (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void (*end_element) (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void (*text) (GMarkupParseContext *context,
|
||||
const gchar *text,
|
||||
gsize text_len,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void (*passthrough) (GMarkupParseContext *context,
|
||||
const gchar *passthrough_text,
|
||||
gsize text_len,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
void (*error) (GMarkupParseContext *context,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
} GMarkupParser;
|
||||
|
||||
GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
|
||||
GMarkupParseFlags flags,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_data_dnotify);
|
||||
void g_markup_parse_context_free (GMarkupParseContext *context);
|
||||
gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
const gchar *text, gssize text_len,
|
||||
GError **error);
|
||||
gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
|
||||
GError **error);
|
||||
|
||||
/*
|
||||
* Character set conversion
|
||||
*/
|
||||
gboolean g_get_charset (G_CONST_RETURN char **charset);
|
||||
gchar *g_locale_to_utf8 (const gchar *opsysstring, gssize len,
|
||||
gsize *bytes_read, gsize *bytes_written,
|
||||
GError **error);
|
||||
gchar *g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
|
||||
gsize *bytes_written, GError **error);
|
||||
gchar *g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
|
||||
gsize *bytes_written, GError **error);
|
||||
gchar *g_convert (const gchar *str, gssize len,
|
||||
const gchar *to_codeset, const gchar *from_codeset,
|
||||
gsize *bytes_read, gsize *bytes_written, GError **error);
|
||||
gboolean g_utf8_validate (const gchar *str, gssize max_len, const gchar **end);
|
||||
|
||||
/*
|
||||
* Empty thread functions, not used by eglib
|
||||
*/
|
||||
#define g_thread_supported() TRUE
|
||||
#define g_thread_init(x) G_STMT_START { if (x != NULL) { g_error ("No vtable supported in g_thread_init"); } } G_STMT_END
|
||||
|
||||
#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
|
||||
#define GUINT32_SWAP_LE_BE(x) ((guint32) \
|
||||
( (((guint32) (x)) << 24)| \
|
||||
((((guint32) (x)) & 0xff0000) >> 8) | \
|
||||
((((guint32) (x)) & 0xff00) << 8) | \
|
||||
(((guint32) (x)) >> 24)) )
|
||||
|
||||
#define GUINT64_SWAP_LE_BE(x) ((guint64) (((guint64)(GUINT32_SWAP_LE_BE(((guint64)x) & 0xffffffff))) << 32) | \
|
||||
GUINT32_SWAP_LE_BE(((guint64)x) >> 32))
|
||||
|
||||
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
# define GUINT32_TO_LE(x) (x)
|
||||
# define GUINT64_TO_LE(x) (x)
|
||||
# define GUINT16_TO_LE(x) (x)
|
||||
#else
|
||||
# define GUINT32_TO_LE(x) GUINT32_SWAP_LE_BE(x)
|
||||
# define GUINT64_TO_LE(x) GUINT64_SWAP_LE_BE(x)
|
||||
# define GUINT16_TO_LE(x) GUINT16_SWAP_LE_BE(x)
|
||||
#endif
|
||||
|
||||
#define GUINT32_FROM_LE(x) (GUINT32_TO_LE (x))
|
||||
#define GUINT64_FROM_LE(x) (GUINT64_TO_LE (x))
|
||||
#define GUINT16_FROM_LE(x) (GUINT16_TO_LE (x))
|
||||
|
||||
#define _EGLIB_MAJOR 2
|
||||
#define _EGLIB_MIDDLE 4
|
||||
#define _EGLIB_MINOR 0
|
||||
|
||||
#define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b == _EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* glist.c: Doubly-linked list implementation
|
||||
*
|
||||
* Authors:
|
||||
* Duncan Mak ([email protected])
|
||||
* Raja R Harinath ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
GList*
|
||||
g_list_alloc ()
|
||||
{
|
||||
return g_new0 (GList, 1);
|
||||
}
|
||||
|
||||
static inline GList*
|
||||
new_node (GList *prev, gpointer data, GList *next)
|
||||
{
|
||||
GList *node = g_list_alloc ();
|
||||
node->data = data;
|
||||
node->prev = prev;
|
||||
node->next = next;
|
||||
if (prev)
|
||||
prev->next = node;
|
||||
if (next)
|
||||
next->prev = node;
|
||||
return node;
|
||||
}
|
||||
|
||||
static inline GList*
|
||||
disconnect_node (GList *node)
|
||||
{
|
||||
if (node->next)
|
||||
node->next->prev = node->prev;
|
||||
if (node->prev)
|
||||
node->prev->next = node->next;
|
||||
return node;
|
||||
}
|
||||
|
||||
GList *
|
||||
g_list_prepend (GList *list, gpointer data)
|
||||
{
|
||||
return new_node (list ? list->prev : NULL, data, list);
|
||||
}
|
||||
|
||||
void
|
||||
g_list_free_1 (GList *list)
|
||||
{
|
||||
g_free (list);
|
||||
}
|
||||
|
||||
void
|
||||
g_list_free (GList *list)
|
||||
{
|
||||
while (list){
|
||||
GList *next = list->next;
|
||||
g_list_free_1 (list);
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_append (GList *list, gpointer data)
|
||||
{
|
||||
GList *node = new_node (g_list_last (list), data, NULL);
|
||||
return list ? list : node;
|
||||
}
|
||||
|
||||
GList *
|
||||
g_list_concat (GList *list1, GList *list2)
|
||||
{
|
||||
if (list1 && list2) {
|
||||
list2->prev = g_list_last (list1);
|
||||
list2->prev->next = list2;
|
||||
}
|
||||
return list1 ? list1 : list2;
|
||||
}
|
||||
|
||||
guint
|
||||
g_list_length (GList *list)
|
||||
{
|
||||
guint length = 0;
|
||||
|
||||
while (list) {
|
||||
length ++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_remove (GList *list, gconstpointer data)
|
||||
{
|
||||
GList *current = g_list_find (list, data);
|
||||
if (!current)
|
||||
return list;
|
||||
|
||||
if (current == list)
|
||||
list = list->next;
|
||||
g_list_free_1 (disconnect_node (current));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_remove_link (GList *list, GList *link)
|
||||
{
|
||||
if (list == link)
|
||||
list = list->next;
|
||||
|
||||
disconnect_node (link);
|
||||
link->next = NULL;
|
||||
link->prev = NULL;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_delete_link (GList *list, GList *link)
|
||||
{
|
||||
list = g_list_remove_link (list, link);
|
||||
g_list_free_1 (link);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_find (GList *list, gconstpointer data)
|
||||
{
|
||||
while (list){
|
||||
if (list->data == data)
|
||||
return list;
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_reverse (GList *list)
|
||||
{
|
||||
GList *reverse = NULL;
|
||||
|
||||
while (list) {
|
||||
reverse = list;
|
||||
list = reverse->next;
|
||||
|
||||
reverse->next = reverse->prev;
|
||||
reverse->prev = list;
|
||||
}
|
||||
|
||||
return reverse;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_first (GList *list)
|
||||
{
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
while (list->prev)
|
||||
list = list->prev;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_last (GList *list)
|
||||
{
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
while (list->next)
|
||||
list = list->next;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
|
||||
{
|
||||
GList *prev = NULL;
|
||||
GList *current;
|
||||
|
||||
if (!func)
|
||||
return list;
|
||||
|
||||
/* Invariant: !prev || func (prev->data, data) <= 0) */
|
||||
for (current = list; current; current = current->next) {
|
||||
if (func (current->data, data) > 0)
|
||||
break;
|
||||
prev = current;
|
||||
}
|
||||
|
||||
GList *node = new_node (prev, data, current);
|
||||
return list == current ? node : list;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_insert_before (GList *list, GList *sibling, gpointer data)
|
||||
{
|
||||
if (sibling) {
|
||||
GList *node = new_node (sibling->prev, data, sibling);
|
||||
return list == sibling ? node : list;
|
||||
}
|
||||
return g_list_append (list, data);
|
||||
}
|
||||
|
||||
void
|
||||
g_list_foreach (GList *list, GFunc func, gpointer user_data)
|
||||
{
|
||||
while (list){
|
||||
(*func) (list->data, user_data);
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
g_list_index (GList *list, gconstpointer data)
|
||||
{
|
||||
gint index = 0;
|
||||
|
||||
while (list){
|
||||
if (list->data == data)
|
||||
return index;
|
||||
|
||||
index ++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_nth (GList *list, guint n)
|
||||
{
|
||||
for (; list; list = list->next) {
|
||||
if (n == 0)
|
||||
break;
|
||||
n--;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_list_nth_data (GList *list, guint n)
|
||||
{
|
||||
GList *node = g_list_nth (list, n);
|
||||
return node ? node->data : NULL;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_copy (GList *list)
|
||||
{
|
||||
GList *copy = NULL;
|
||||
|
||||
if (list) {
|
||||
GList *tmp = new_node (NULL, list->data, NULL);
|
||||
copy = tmp;
|
||||
|
||||
for (list = list->next; list; list = list->next)
|
||||
tmp = new_node (tmp, list->data, NULL);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
typedef GList list_node;
|
||||
#include "sort.frag.h"
|
||||
|
||||
GList*
|
||||
g_list_sort (GList *list, GCompareFunc func)
|
||||
{
|
||||
GList *current;
|
||||
if (!list || !list->next)
|
||||
return list;
|
||||
list = do_sort (list, func);
|
||||
|
||||
/* Fixup: do_sort doesn't update 'prev' pointers */
|
||||
list->prev = NULL;
|
||||
for (current = list; current->next; current = current->next)
|
||||
current->next->prev = current;
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -1,446 +0,0 @@
|
||||
/*
|
||||
* gmakrup.c: Minimal XML markup reader.
|
||||
*
|
||||
* Unlike the GLib one, this can not be restarted with more text
|
||||
* as the Mono use does not require it.
|
||||
*
|
||||
* Actually, with further thought, I think that this could be made
|
||||
* to restart very easily. The pos == end condition would mean
|
||||
* "return to caller" and only at end parse this would be a fatal
|
||||
* error.
|
||||
*
|
||||
* Not that it matters to Mono, but it is very simple to change, there
|
||||
* is a tricky situation: there are a few places where we check p+n
|
||||
* in the source, and that would have to change to be progressive, instead
|
||||
* of depending on the string to be complete at that point, so we would
|
||||
* have to introduce extra states to cope with that.
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define set_error(msg...) do { if (error != NULL) *error = g_error_new (GINT_TO_POINTER (1), 1, msg); } while (0);
|
||||
|
||||
typedef enum {
|
||||
START,
|
||||
START_ELEMENT,
|
||||
TEXT,
|
||||
FLUSH_TEXT,
|
||||
CLOSING_ELEMENT,
|
||||
COMMENT,
|
||||
SKIP_XML_DECLARATION
|
||||
} ParseState;
|
||||
|
||||
struct _GMarkupParseContext {
|
||||
GMarkupParser parser;
|
||||
gpointer user_data;
|
||||
GDestroyNotify user_data_dnotify;
|
||||
ParseState state;
|
||||
|
||||
/* Stores the name of the current element, so we can issue the end_element */
|
||||
GSList *level;
|
||||
|
||||
GString *text;
|
||||
};
|
||||
|
||||
GMarkupParseContext *
|
||||
g_markup_parse_context_new (const GMarkupParser *parser,
|
||||
GMarkupParseFlags flags,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_data_dnotify)
|
||||
{
|
||||
GMarkupParseContext *context = g_new0 (GMarkupParseContext, 1);
|
||||
|
||||
context->parser = *parser;
|
||||
context->user_data = user_data;
|
||||
context->user_data_dnotify = user_data_dnotify;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
void
|
||||
g_markup_parse_context_free (GMarkupParseContext *context)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
if (context->user_data_dnotify != NULL)
|
||||
(context->user_data_dnotify) (context->user_data);
|
||||
|
||||
if (context->text != NULL)
|
||||
g_string_free (context->text, TRUE);
|
||||
for (l = context->level; l; l = l->next)
|
||||
g_free (l->data);
|
||||
g_slist_free (context->level);
|
||||
g_free (context);
|
||||
}
|
||||
|
||||
static const char *
|
||||
skip_space (const char *p, const char *end)
|
||||
{
|
||||
for (; p < end && isspace (*p); p++)
|
||||
;
|
||||
return p;
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_value (const char *p, const char *end, char **value, GError **error)
|
||||
{
|
||||
const char *start;
|
||||
int l;
|
||||
|
||||
if (*p != '"'){
|
||||
set_error ("Expected the attribute value to start with a quote");
|
||||
return end;
|
||||
}
|
||||
start = ++p;
|
||||
for (; p < end && *p != '"'; p++)
|
||||
;
|
||||
if (p == end)
|
||||
return end;
|
||||
l = p - start;
|
||||
p++;
|
||||
*value = malloc (l + 1);
|
||||
if (*value == NULL)
|
||||
return end;
|
||||
strncpy (*value, start, l);
|
||||
(*value) [l] = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_name (const char *p, const char *end, char **value)
|
||||
{
|
||||
const char *start = p;
|
||||
int l;
|
||||
|
||||
for (; p < end && isalnum (*p); p++)
|
||||
;
|
||||
if (p == end)
|
||||
return end;
|
||||
|
||||
l = p - start;
|
||||
*value = malloc (l + 1);
|
||||
if (*value == NULL)
|
||||
return end;
|
||||
strncpy (*value, start, l);
|
||||
(*value) [l] = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int *full_stop, int state)
|
||||
{
|
||||
int nnames = 0;
|
||||
|
||||
while (TRUE){
|
||||
p = skip_space (p, end);
|
||||
if (p == end)
|
||||
return end;
|
||||
|
||||
if (*p == '>'){
|
||||
*full_stop = 0;
|
||||
return p;
|
||||
}
|
||||
if (state == SKIP_XML_DECLARATION && *p == '?' && ((p+1) < end) && *(p+1) == '>'){
|
||||
*full_stop = 0;
|
||||
return p+1;
|
||||
}
|
||||
|
||||
if (*p == '/' && ((p+1) < end && *(p+1) == '>')){
|
||||
*full_stop = 1;
|
||||
return p+1;
|
||||
} else {
|
||||
char *name, *value;
|
||||
|
||||
p = parse_name (p, end, &name);
|
||||
if (p == end)
|
||||
return p;
|
||||
|
||||
p = skip_space (p, end);
|
||||
if (p == end){
|
||||
free (name);
|
||||
return p;
|
||||
}
|
||||
if (*p != '='){
|
||||
set_error ("Expected an = after the attribute name `%s'", name);
|
||||
free (name);
|
||||
return end;
|
||||
}
|
||||
p++;
|
||||
p = skip_space (p, end);
|
||||
if (p == end){
|
||||
free (name);
|
||||
return end;
|
||||
}
|
||||
|
||||
p = parse_value (p, end, &value, error);
|
||||
if (p == end){
|
||||
free (name);
|
||||
return p;
|
||||
}
|
||||
|
||||
++nnames;
|
||||
*names = g_realloc (*names, sizeof (char **) * (nnames+1));
|
||||
*values = g_realloc (*values, sizeof (char **) * (nnames+1));
|
||||
(*names) [nnames-1] = name;
|
||||
(*values) [nnames-1] = value;
|
||||
(*names) [nnames] = NULL;
|
||||
(*values) [nnames] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_parse_state (GMarkupParseContext *context)
|
||||
{
|
||||
GSList *p;
|
||||
|
||||
for (p = context->level; p != NULL; p = p->next)
|
||||
g_free (p->data);
|
||||
|
||||
g_slist_free (context->level);
|
||||
if (context->text != NULL)
|
||||
g_string_free (context->text, TRUE);
|
||||
context->text = NULL;
|
||||
context->level = NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
const gchar *text, gssize text_len,
|
||||
GError **error)
|
||||
{
|
||||
const char *p, *end;
|
||||
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
g_return_val_if_fail (text != NULL, FALSE);
|
||||
g_return_val_if_fail (text_len >= 0, FALSE);
|
||||
|
||||
end = text + text_len;
|
||||
|
||||
for (p = text; p < end; p++){
|
||||
char c = *p;
|
||||
|
||||
switch (context->state){
|
||||
case START:
|
||||
if (c == ' ' || c == '\t' || c == '\f' || c == '\n')
|
||||
continue;
|
||||
if (c == '<'){
|
||||
if (p+1 < end && p [1] == '?'){
|
||||
context->state = SKIP_XML_DECLARATION;
|
||||
p++;
|
||||
} else
|
||||
context->state = START_ELEMENT;
|
||||
continue;
|
||||
}
|
||||
set_error ("Expected < to start the document");
|
||||
goto fail;
|
||||
|
||||
case SKIP_XML_DECLARATION:
|
||||
case START_ELEMENT: {
|
||||
const char *element_start = p, *element_end;
|
||||
char *ename = NULL;
|
||||
int full_stop = 0, l;
|
||||
gchar **names = NULL, **values = NULL;
|
||||
|
||||
for (; p < end && isspace (*p); p++)
|
||||
;
|
||||
if (p == end){
|
||||
set_error ("Unfinished element");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (*p == '!' && (p+2 < end) && (p [1] == '-') && (p [2] == '-')){
|
||||
context->state = COMMENT;
|
||||
p += 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(isascii (*p) && isalpha (*p))){
|
||||
set_error ("Expected an element name");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (++p; p < end && (isalnum (*p) || (*p == '.')); p++)
|
||||
;
|
||||
if (p == end){
|
||||
set_error ("Expected an element");
|
||||
goto fail;
|
||||
}
|
||||
element_end = p;
|
||||
|
||||
for (; p < end && isspace (*p); p++)
|
||||
;
|
||||
if (p == end){
|
||||
set_error ("Unfinished element");
|
||||
goto fail;
|
||||
}
|
||||
p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state);
|
||||
if (p == end){
|
||||
if (names != NULL) {
|
||||
g_strfreev (names);
|
||||
g_strfreev (values);
|
||||
}
|
||||
/* Only set the error if parse_attributes did not */
|
||||
if (error != NULL && *error == NULL)
|
||||
set_error ("Unfinished sequence");
|
||||
goto fail;
|
||||
}
|
||||
l = element_end - element_start;
|
||||
ename = malloc (l + 1);
|
||||
if (ename == NULL)
|
||||
goto fail;
|
||||
strncpy (ename, element_start, l);
|
||||
ename [l] = 0;
|
||||
|
||||
if (context->state == START_ELEMENT)
|
||||
if (context->parser.start_element != NULL)
|
||||
context->parser.start_element (context, ename,
|
||||
(const gchar **) names,
|
||||
(const gchar **) values,
|
||||
context->user_data, error);
|
||||
|
||||
if (names != NULL){
|
||||
g_strfreev (names);
|
||||
g_strfreev (values);
|
||||
}
|
||||
|
||||
if (error != NULL && *error != NULL){
|
||||
free (ename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (full_stop){
|
||||
if (context->parser.end_element != NULL && context->state == START_ELEMENT){
|
||||
context->parser.end_element (context, ename, context->user_data, error);
|
||||
if (error != NULL && *error != NULL){
|
||||
free (ename);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
free (ename);
|
||||
} else {
|
||||
context->level = g_slist_prepend (context->level, ename);
|
||||
}
|
||||
|
||||
context->state = TEXT;
|
||||
break;
|
||||
} /* case START_ELEMENT */
|
||||
|
||||
case TEXT: {
|
||||
if (c == '<'){
|
||||
context->state = FLUSH_TEXT;
|
||||
break;
|
||||
}
|
||||
if (context->parser.text != NULL){
|
||||
if (context->text == NULL)
|
||||
context->text = g_string_new ("");
|
||||
g_string_append_c (context->text, c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case COMMENT:
|
||||
if (*p != '-')
|
||||
break;
|
||||
if (p+2 < end && (p [1] == '-') && (p [2] == '>')){
|
||||
context->state = TEXT;
|
||||
p += 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case FLUSH_TEXT:
|
||||
if (context->parser.text != NULL){
|
||||
context->parser.text (context, context->text->str, context->text->len,
|
||||
context->user_data, error);
|
||||
if (error != NULL && *error != NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (c == '/')
|
||||
context->state = CLOSING_ELEMENT;
|
||||
else {
|
||||
p--;
|
||||
context->state = START_ELEMENT;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLOSING_ELEMENT: {
|
||||
GSList *current = context->level;
|
||||
char *text;
|
||||
|
||||
if (context->level == NULL){
|
||||
set_error ("Too many closing tags, not enough open tags");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
text = current->data;
|
||||
if (context->parser.end_element != NULL){
|
||||
context->parser.end_element (context, text, context->user_data, error);
|
||||
if (error != NULL && *error != NULL){
|
||||
free (text);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
free (text);
|
||||
|
||||
while (p < end && *p != '>')
|
||||
p++;
|
||||
|
||||
context->level = context->level->next;
|
||||
g_slist_free_1 (current);
|
||||
context->state = TEXT;
|
||||
break;
|
||||
} /* case CLOSING_ELEMENT */
|
||||
|
||||
} /* switch */
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
fail:
|
||||
if (context->parser.error && error != NULL && *error)
|
||||
context->parser.error (context, *error, context->user_data);
|
||||
|
||||
destroy_parse_state (context);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error)
|
||||
{
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
|
||||
/*
|
||||
* In our case, we always signal errors during parse, not at the end
|
||||
* see the notes at the top of this file for details on how this
|
||||
* could be moved here
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* gmem.c: memory utility functions
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
gpointer
|
||||
g_memdup (gconstpointer mem, guint byte_size)
|
||||
{
|
||||
gpointer ptr;
|
||||
|
||||
if (mem == NULL)
|
||||
return NULL;
|
||||
|
||||
ptr = g_malloc (byte_size);
|
||||
if (ptr != NULL)
|
||||
memcpy (ptr, mem, byte_size);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* gmisc.c: Misc functions with no place to go (right now)
|
||||
*
|
||||
* Author:
|
||||
* Aaron Bockover ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
const gchar *
|
||||
g_getenv(const gchar *variable)
|
||||
{
|
||||
return getenv(variable);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
|
||||
{
|
||||
return setenv(variable, value, overwrite) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
g_unsetenv(const gchar *variable)
|
||||
{
|
||||
unsetenv(variable);
|
||||
}
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
/*
|
||||
* gmodule.c: dl* functions, glib style
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
* Jonathan Chambers ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* (C) 2006 Jonathan Chambers
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include <dlfcn.h>
|
||||
|
||||
/* For Linux and Solaris, need to add others as we port this */
|
||||
#define LIBPREFIX "lib"
|
||||
#define LIBSUFFIX ".so"
|
||||
|
||||
struct _GModule {
|
||||
void *handle;
|
||||
};
|
||||
|
||||
GModule *
|
||||
g_module_open (const gchar *file, GModuleFlags flags)
|
||||
{
|
||||
int f = 0;
|
||||
GModule *module;
|
||||
void *handle;
|
||||
|
||||
flags &= G_MODULE_BIND_MASK;
|
||||
if ((flags & G_MODULE_BIND_LAZY) != 0)
|
||||
f |= RTLD_LAZY;
|
||||
if ((flags & G_MODULE_BIND_LOCAL) != 0)
|
||||
f |= RTLD_LOCAL;
|
||||
|
||||
handle = dlopen (file, f);
|
||||
if (handle == NULL)
|
||||
return NULL;
|
||||
|
||||
module = g_new (GModule,1);
|
||||
module->handle = handle;
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
|
||||
{
|
||||
if (symbol_name == NULL || symbol == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (module == NULL || module->handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
*symbol = dlsym (module->handle, symbol_name);
|
||||
return (*symbol != NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
g_module_error (void)
|
||||
{
|
||||
return dlerror ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_close (GModule *module)
|
||||
{
|
||||
void *handle;
|
||||
if (module == NULL || module->handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
handle = module->handle;
|
||||
module->handle = NULL;
|
||||
g_free (module);
|
||||
return (0 == dlclose (handle));
|
||||
}
|
||||
|
||||
#elif defined (G_OS_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
#define LIBSUFFIX ".dll"
|
||||
#define LIBPREFIX
|
||||
|
||||
struct _GModule {
|
||||
HMODULE handle;
|
||||
};
|
||||
|
||||
GModule *
|
||||
g_module_open (const gchar *file, GModuleFlags flags)
|
||||
{
|
||||
GModule *module;
|
||||
module = g_malloc (sizeof (GModule));
|
||||
if (module == NULL)
|
||||
return NULL;
|
||||
|
||||
module->handle = LoadLibrary (file);
|
||||
return module;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
|
||||
{
|
||||
if (symbol_name == NULL || symbol == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (module == NULL || module->handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
*symbol = GetProcAddress (module->handle, symbol_name);
|
||||
return (*symbol != NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
g_module_error (void)
|
||||
{
|
||||
gchar* ret = NULL;
|
||||
TCHAR* buf = NULL;
|
||||
DWORD code = GetLastError ();
|
||||
|
||||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
|
||||
code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
|
||||
|
||||
ret = g_strdup (buf);
|
||||
LocalFree(buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_close (GModule *module)
|
||||
{
|
||||
HMODULE handle;
|
||||
if (module == NULL || module->handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
handle = module->handle;
|
||||
module->handle = NULL;
|
||||
g_free (module);
|
||||
return (0 == FreeLibrary (handle));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define LIBSUFFIX
|
||||
#define LIBPREFIX
|
||||
|
||||
GModule *
|
||||
g_module_open (const gchar *file, GModuleFlags flags)
|
||||
{
|
||||
g_error ("g_module_open not implemented on this platform");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
|
||||
{
|
||||
g_error ("g_module_open not implemented on this platform");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
g_module_error (void)
|
||||
{
|
||||
g_error ("g_module_open not implemented on this platform");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_module_close (GModule *module)
|
||||
{
|
||||
g_error ("g_module_open not implemented on this platform");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
gchar *
|
||||
g_module_build_path (const gchar *directory, const gchar *module_name)
|
||||
{
|
||||
char *lib_prefix = "";
|
||||
|
||||
if (module_name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strncmp (module_name, "lib", 3) != 0)
|
||||
lib_prefix = LIBPREFIX;
|
||||
|
||||
if (directory && *directory){
|
||||
|
||||
return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
|
||||
}
|
||||
return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef __GLIB_GMODULE_H
|
||||
#define __GLIB_GMODULE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
/*
|
||||
* Modules
|
||||
*/
|
||||
typedef enum {
|
||||
G_MODULE_BIND_LAZY = 0x01,
|
||||
G_MODULE_BIND_LOCAL = 0x02,
|
||||
G_MODULE_BIND_MASK = 0x03
|
||||
} GModuleFlags;
|
||||
typedef struct _GModule GModule;
|
||||
|
||||
GModule *g_module_open (const gchar *file, GModuleFlags flags);
|
||||
gboolean g_module_symbol (GModule *module, const gchar *symbol_name,
|
||||
gpointer *symbol);
|
||||
const gchar *g_module_error (void);
|
||||
gboolean g_module_close (GModule *module);
|
||||
gchar * g_module_build_path (const gchar *directory, const gchar *module_name);
|
||||
|
||||
#endif
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Output and debugging functions
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
/* The current fatal levels, error is always fatal */
|
||||
static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
|
||||
|
||||
void
|
||||
g_print (const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
vprintf (format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
GLogLevelFlags
|
||||
g_log_set_always_fatal (GLogLevelFlags fatal_mask)
|
||||
{
|
||||
GLogLevelFlags old_fatal = fatal;
|
||||
|
||||
fatal |= fatal_mask;
|
||||
|
||||
return old_fatal;
|
||||
}
|
||||
|
||||
GLogLevelFlags
|
||||
g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
|
||||
{
|
||||
/*
|
||||
* Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
|
||||
* if we decide to set G_LOG_DOMAIN (we probably should) we should implement
|
||||
* this.
|
||||
*/
|
||||
return fatal_mask;
|
||||
}
|
||||
|
||||
void
|
||||
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
|
||||
{
|
||||
char *msg;
|
||||
|
||||
vasprintf (&msg, format, args);
|
||||
printf ("%s%s%s",
|
||||
log_domain != NULL ? log_domain : "",
|
||||
log_domain != NULL ? ": " : "",
|
||||
msg);
|
||||
free (msg);
|
||||
if (log_level & fatal)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
|
||||
{
|
||||
char *fmt;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
g_logv (log_domain, log_level, format, args);
|
||||
fmt = g_strdup_printf (format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Portable Utility Functions
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
gchar *
|
||||
g_build_path (const gchar *separator, const gchar *first_element, ...)
|
||||
{
|
||||
GString *result;
|
||||
const char *s, *p, *next;
|
||||
int slen;
|
||||
va_list args;
|
||||
|
||||
g_return_val_if_fail (separator != NULL, NULL);
|
||||
g_return_val_if_fail (first_element != NULL, NULL);
|
||||
|
||||
result = g_string_sized_new (48);
|
||||
|
||||
slen = strlen (separator);
|
||||
|
||||
va_start (args, first_element);
|
||||
for (s = first_element; s != NULL; s = next){
|
||||
next = va_arg (args, char *);
|
||||
p = (s + strlen (s));
|
||||
|
||||
if (next && p - slen > s){
|
||||
for (; strncmp (p-slen, separator, slen) == 0; ){
|
||||
p -= slen;
|
||||
}
|
||||
}
|
||||
g_string_append_len (result, s, p - s);
|
||||
|
||||
if (next && *next){
|
||||
g_string_append (result, separator);
|
||||
|
||||
for (; strncmp (next, separator, slen) == 0; )
|
||||
next += slen;
|
||||
}
|
||||
}
|
||||
g_string_append_c (result, 0);
|
||||
va_end (args);
|
||||
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_path_get_dirname (const gchar *filename)
|
||||
{
|
||||
char *p, *r;
|
||||
int count;
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
p = strrchr (filename, G_DIR_SEPARATOR);
|
||||
if (p == NULL)
|
||||
return g_strdup (".");
|
||||
count = p - filename;
|
||||
r = g_malloc (count + 1);
|
||||
strncpy (r, filename, count);
|
||||
r [count] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_path_get_basename (const char *filename)
|
||||
{
|
||||
char *r;
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
/* Empty filename -> . */
|
||||
if (!*filename)
|
||||
return g_strdup (".");
|
||||
|
||||
/* No separator -> filename */
|
||||
r = strrchr (filename, G_DIR_SEPARATOR);
|
||||
if (r == NULL)
|
||||
return g_strdup (filename);
|
||||
|
||||
/* Trailing slash, remove component */
|
||||
if (r [1] == 0){
|
||||
char *copy = g_strdup (filename);
|
||||
copy [r-filename] = 0;
|
||||
r = strrchr (copy, G_DIR_SEPARATOR);
|
||||
|
||||
if (r == NULL){
|
||||
g_free (copy);
|
||||
return g_strdup ("/");
|
||||
}
|
||||
r = g_strdup (&r[1]);
|
||||
g_free (copy);
|
||||
return r;
|
||||
}
|
||||
|
||||
return g_strdup (&r[1]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_path_is_absolute (const char *filename)
|
||||
{
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
return (*filename == '/');
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_find_program_in_path (const gchar *program)
|
||||
{
|
||||
char *p = g_strdup (getenv ("PATH"));
|
||||
char *x = p, *l;
|
||||
gchar *curdir = NULL;
|
||||
char *save;
|
||||
|
||||
g_return_val_if_fail (program != NULL, NULL);
|
||||
|
||||
if (x == NULL || *x == '\0') {
|
||||
curdir = g_get_current_dir ();
|
||||
x = curdir;
|
||||
}
|
||||
|
||||
while ((l = strtok_r (x, G_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
|
||||
char *probe_path;
|
||||
|
||||
x = NULL;
|
||||
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
|
||||
if (access (probe_path, X_OK) == 0){
|
||||
g_free (curdir);
|
||||
g_free (p);
|
||||
return probe_path;
|
||||
}
|
||||
g_free (probe_path);
|
||||
}
|
||||
g_free (curdir);
|
||||
g_free (p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_get_current_dir (void)
|
||||
{
|
||||
int s = 32;
|
||||
char *buffer = NULL, *r;
|
||||
gboolean fail;
|
||||
|
||||
do {
|
||||
buffer = g_realloc (buffer, s);
|
||||
r = getcwd (buffer, s);
|
||||
fail = (r == NULL && errno == ERANGE);
|
||||
if (fail) {
|
||||
s <<= 1;
|
||||
}
|
||||
} while (fail);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static pthread_mutex_t home_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static char *home_dir;
|
||||
|
||||
/* Give preference to /etc/passwd than HOME */
|
||||
const gchar *
|
||||
g_get_home_dir (void)
|
||||
{
|
||||
if (home_dir == NULL){
|
||||
uid_t uid;
|
||||
|
||||
pthread_mutex_lock (&home_lock);
|
||||
if (home_dir == NULL){
|
||||
struct passwd pwbuf, *track;
|
||||
char buf [4096];
|
||||
|
||||
uid = getuid ();
|
||||
|
||||
setpwent ();
|
||||
|
||||
while (getpwent_r (&pwbuf, buf, sizeof (buf), &track) == 0){
|
||||
if (pwbuf.pw_uid == uid){
|
||||
home_dir = g_strdup (pwbuf.pw_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
endpwent ();
|
||||
if (home_dir == NULL)
|
||||
home_dir = getenv ("HOME");
|
||||
pthread_mutex_unlock (&home_lock);
|
||||
}
|
||||
}
|
||||
return home_dir;
|
||||
}
|
||||
|
||||
static char *tmp_dir;
|
||||
static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
const gchar *
|
||||
g_get_tmp_dir (void)
|
||||
{
|
||||
if (tmp_dir == NULL){
|
||||
pthread_mutex_lock (&tmp_lock);
|
||||
if (tmp_dir == NULL){
|
||||
tmp_dir = getenv ("TMPDIR");
|
||||
if (tmp_dir == NULL){
|
||||
tmp_dir = getenv ("TMP");
|
||||
if (tmp_dir == NULL){
|
||||
tmp_dir = getenv ("TEMP");
|
||||
if (tmp_dir == NULL)
|
||||
tmp_dir = "/tmp";
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock (&tmp_lock);
|
||||
}
|
||||
return tmp_dir;
|
||||
}
|
||||
|
||||
const char *
|
||||
g_get_user_name (void)
|
||||
{
|
||||
return getenv ("USER");
|
||||
}
|
||||
|
||||
static char *name;
|
||||
|
||||
void
|
||||
g_set_prgname (const gchar *prgname)
|
||||
{
|
||||
name = g_strdup (prgname);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_get_prgname (void)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* Simple pattern matching
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef enum {
|
||||
MATCH_LITERAL,
|
||||
MATCH_ANYCHAR,
|
||||
MATCH_ANYTHING,
|
||||
MATCH_ANYTHING_END
|
||||
} MatchType;
|
||||
|
||||
typedef struct {
|
||||
MatchType type;
|
||||
gchar *str;
|
||||
} PData;
|
||||
|
||||
struct _GPatternSpec {
|
||||
GSList *pattern;
|
||||
};
|
||||
|
||||
static GSList *
|
||||
compile_pattern (const gchar *pattern)
|
||||
{
|
||||
GSList *list;
|
||||
gint i, len;
|
||||
PData *data;
|
||||
gchar c;
|
||||
MatchType last = -1;
|
||||
GString *str;
|
||||
gboolean free_str;
|
||||
|
||||
if (pattern == NULL)
|
||||
return NULL;
|
||||
|
||||
data = NULL;
|
||||
list = NULL;
|
||||
free_str = TRUE;
|
||||
str = g_string_new ("");
|
||||
for (i = 0, len = strlen (pattern); i < len; i++) {
|
||||
c = pattern [i];
|
||||
if (c == '*' || c == '?') {
|
||||
if (str->len > 0) {
|
||||
data = g_new0 (PData, 1);
|
||||
data->type = MATCH_LITERAL;
|
||||
data->str = g_string_free (str, FALSE);
|
||||
list = g_slist_append (list, data);
|
||||
str = g_string_new ("");
|
||||
}
|
||||
|
||||
if (last == MATCH_ANYTHING && c == '*')
|
||||
continue;
|
||||
|
||||
data = g_new0 (PData, 1);
|
||||
data->type = (c == '*') ? MATCH_ANYTHING : MATCH_ANYCHAR;
|
||||
list = g_slist_append (list, data);
|
||||
last = data->type;
|
||||
} else {
|
||||
g_string_append_c (str, c);
|
||||
last = MATCH_LITERAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (last == MATCH_ANYTHING && str->len == 0) {
|
||||
data->type = MATCH_ANYTHING_END;
|
||||
free_str = TRUE;
|
||||
} else if (str->len > 0) {
|
||||
data = g_new0 (PData, 1);
|
||||
data->type = MATCH_LITERAL;
|
||||
data->str = str->str;
|
||||
free_str = FALSE;
|
||||
list = g_slist_append (list, data);
|
||||
}
|
||||
g_string_free (str, free_str);
|
||||
return list;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PATTERN
|
||||
static void
|
||||
print_pattern (gpointer data, gpointer user_data)
|
||||
{
|
||||
PData *d = (PData *) data;
|
||||
|
||||
printf ("Type: %s", d->type == MATCH_LITERAL ? "literal" : d->type == MATCH_ANYCHAR ? "any char" : "anything");
|
||||
if (d->type == MATCH_LITERAL)
|
||||
printf (" String: %s", d->str);
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
GPatternSpec *
|
||||
g_pattern_spec_new (const gchar *pattern)
|
||||
{
|
||||
GPatternSpec *spec;
|
||||
|
||||
g_return_val_if_fail (pattern != NULL, NULL);
|
||||
spec = g_new0 (GPatternSpec, 1);
|
||||
if (pattern) {
|
||||
spec->pattern = compile_pattern (pattern);
|
||||
#ifdef DEBUG_PATTERN
|
||||
g_slist_foreach (spec->pattern, print_pattern, NULL);
|
||||
printf ("\n");
|
||||
#endif
|
||||
}
|
||||
return spec;
|
||||
}
|
||||
|
||||
static void
|
||||
free_pdata (gpointer data, gpointer user_data)
|
||||
{
|
||||
PData *d = (PData *) data;
|
||||
|
||||
if (d->str)
|
||||
g_free (d->str);
|
||||
g_free (d);
|
||||
}
|
||||
|
||||
void
|
||||
g_pattern_spec_free (GPatternSpec *pspec)
|
||||
{
|
||||
if (pspec) {
|
||||
g_slist_foreach (pspec->pattern, free_pdata, NULL);
|
||||
g_slist_free (pspec->pattern);
|
||||
pspec->pattern = NULL;
|
||||
}
|
||||
g_free (pspec);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
match_string (GSList *list, const gchar *str, gint idx, gint max)
|
||||
{
|
||||
gint len;
|
||||
|
||||
while (list && idx < max) {
|
||||
PData *data = (PData *) list->data;
|
||||
|
||||
if (data->type == MATCH_ANYTHING_END)
|
||||
return TRUE;
|
||||
|
||||
if (data->type == MATCH_LITERAL) {
|
||||
len = strlen (data->str);
|
||||
if (strncmp (&str [idx], data->str, len) != 0)
|
||||
return FALSE;
|
||||
idx += len;
|
||||
list = list->next;
|
||||
if (list) {
|
||||
/*
|
||||
* When recursing, we need this to avoid returning FALSE
|
||||
* because 'list' will not be NULL
|
||||
*/
|
||||
data = (PData *) list->data;
|
||||
if (data->type == MATCH_ANYTHING_END)
|
||||
return TRUE;
|
||||
}
|
||||
} else if (data->type == MATCH_ANYCHAR) {
|
||||
idx++;
|
||||
list = list->next;
|
||||
} else if (data->type == MATCH_ANYTHING) {
|
||||
while (idx < max) {
|
||||
if (match_string (list->next, str, idx++, max))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
return (list == NULL && idx >= max);
|
||||
}
|
||||
gboolean
|
||||
g_pattern_match_string (GPatternSpec *pspec, const gchar *string)
|
||||
{
|
||||
g_return_val_if_fail (pspec != NULL, FALSE);
|
||||
g_return_val_if_fail (string != NULL, FALSE);
|
||||
|
||||
if (pspec->pattern == NULL)
|
||||
return FALSE;
|
||||
return match_string (pspec->pattern, string, 0, strlen (string));
|
||||
}
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Pointer Array
|
||||
*
|
||||
* Author:
|
||||
* Aaron Bockover ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _GPtrArrayPriv {
|
||||
gpointer *pdata;
|
||||
guint len;
|
||||
guint size;
|
||||
} GPtrArrayPriv;
|
||||
|
||||
static void
|
||||
g_ptr_array_grow(GPtrArrayPriv *array, guint length)
|
||||
{
|
||||
gint new_length = array->len + length;
|
||||
|
||||
g_return_if_fail(array != NULL);
|
||||
|
||||
if(new_length <= array->size) {
|
||||
return;
|
||||
}
|
||||
|
||||
array->size = 1;
|
||||
|
||||
while(array->size < new_length) {
|
||||
array->size <<= 1;
|
||||
}
|
||||
|
||||
array->size = MAX(array->size, 16);
|
||||
array->pdata = g_realloc(array->pdata, array->size * sizeof(gpointer));
|
||||
}
|
||||
|
||||
GPtrArray *
|
||||
g_ptr_array_new()
|
||||
{
|
||||
return g_ptr_array_sized_new(0);
|
||||
}
|
||||
|
||||
GPtrArray *
|
||||
g_ptr_array_sized_new(guint reserved_size)
|
||||
{
|
||||
GPtrArrayPriv *array = g_new0(GPtrArrayPriv, 1);
|
||||
|
||||
array->pdata = NULL;
|
||||
array->len = 0;
|
||||
array->size = 0;
|
||||
|
||||
if(reserved_size > 0) {
|
||||
g_ptr_array_grow(array, reserved_size);
|
||||
}
|
||||
|
||||
return (GPtrArray *)array;
|
||||
}
|
||||
|
||||
gpointer *
|
||||
g_ptr_array_free(GPtrArray *array, gboolean free_seg)
|
||||
{
|
||||
gpointer *data = NULL;
|
||||
|
||||
g_return_val_if_fail(array != NULL, NULL);
|
||||
|
||||
if(free_seg) {
|
||||
g_free(array->pdata);
|
||||
} else {
|
||||
data = array->pdata;
|
||||
}
|
||||
|
||||
g_free(array);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_set_size(GPtrArray *array, gint length)
|
||||
{
|
||||
g_return_if_fail(array != NULL);
|
||||
|
||||
if(length > array->len) {
|
||||
g_ptr_array_grow((GPtrArrayPriv *)array, length);
|
||||
memset(array->pdata + array->len, 0, (length - array->len)
|
||||
* sizeof(gpointer));
|
||||
}
|
||||
|
||||
array->len = length;
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_add(GPtrArray *array, gpointer data)
|
||||
{
|
||||
g_return_if_fail(array != NULL);
|
||||
g_ptr_array_grow((GPtrArrayPriv *)array, 1);
|
||||
array->pdata[array->len++] = data;
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_ptr_array_remove_index(GPtrArray *array, guint index)
|
||||
{
|
||||
gpointer removed_node;
|
||||
|
||||
g_return_val_if_fail(array != NULL, NULL);
|
||||
g_return_val_if_fail(index >= 0 || index < array->len, NULL);
|
||||
|
||||
removed_node = array->pdata[index];
|
||||
|
||||
if(index != array->len - 1) {
|
||||
g_memmove(array->pdata + index, array->pdata + index + 1,
|
||||
(array->len - index - 1) * sizeof(gpointer));
|
||||
}
|
||||
|
||||
array->len--;
|
||||
array->pdata[array->len] = NULL;
|
||||
|
||||
return removed_node;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_ptr_array_remove(GPtrArray *array, gpointer data)
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail(array != NULL, FALSE);
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
if(array->pdata[i] == data) {
|
||||
g_ptr_array_remove_index(array, i);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
func(g_ptr_array_index(array, i), user_data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_sort(GPtrArray *array, GCompareFunc compare_func)
|
||||
{
|
||||
g_return_if_fail(array != NULL);
|
||||
qsort(array->pdata, array->len, sizeof(gpointer), compare_func);
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_sort_with_data(GPtrArray *array, GCompareDataFunc compare_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* gqueue.c: Queue
|
||||
*
|
||||
* Author:
|
||||
* Duncan Mak ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
gpointer
|
||||
g_queue_pop_head (GQueue *queue)
|
||||
{
|
||||
gpointer head = NULL;
|
||||
|
||||
if (queue->length != 0){
|
||||
GList *old_head;
|
||||
|
||||
old_head = queue->head;
|
||||
head = old_head->data;
|
||||
queue->head = old_head->next;
|
||||
queue->length--;
|
||||
g_list_free_1 (old_head);
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_queue_is_empty (GQueue *queue)
|
||||
{
|
||||
if (!queue)
|
||||
return TRUE;
|
||||
|
||||
return queue->length == 0;
|
||||
}
|
||||
|
||||
void
|
||||
g_queue_push_head (GQueue *queue, gpointer head)
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
queue->head = g_list_prepend (queue->head, head);
|
||||
|
||||
if (!queue->tail)
|
||||
queue->tail = queue->head;
|
||||
|
||||
queue->length ++;
|
||||
}
|
||||
|
||||
GQueue *
|
||||
g_queue_new (void)
|
||||
{
|
||||
GQueue *queue = g_new0 (GQueue, 1);
|
||||
queue->length = 0;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
void
|
||||
g_queue_free (GQueue *queue)
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
g_list_free (queue->head);
|
||||
g_free (queue);
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Shell utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
static int
|
||||
split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
|
||||
{
|
||||
gchar *ptr;
|
||||
gchar c;
|
||||
gboolean in_quote = FALSE;
|
||||
gboolean escaped = FALSE;
|
||||
gchar quote_char = '\0';
|
||||
GString *str;
|
||||
|
||||
str = g_string_new ("");
|
||||
ptr = (gchar *) cmdline;
|
||||
while ((c = *ptr++) != '\0') {
|
||||
if (escaped) {
|
||||
escaped = FALSE;
|
||||
if (!g_ascii_isspace (c))
|
||||
g_string_append_c (str, c);
|
||||
} else if (in_quote) {
|
||||
if (c == quote_char) {
|
||||
in_quote = FALSE;
|
||||
quote_char = '\0';
|
||||
g_ptr_array_add (array, g_string_free (str, FALSE));
|
||||
str = g_string_new ("");
|
||||
} else {
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
} else if (g_ascii_isspace (c)) {
|
||||
if (str->len > 0) {
|
||||
g_ptr_array_add (array, g_string_free (str, FALSE));
|
||||
str = g_string_new ("");
|
||||
}
|
||||
} else if (c == '\\') {
|
||||
escaped = TRUE;
|
||||
} else if (c == '\'' || c == '"') {
|
||||
in_quote = TRUE;
|
||||
quote_char = c;
|
||||
} else {
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
}
|
||||
|
||||
if (escaped) {
|
||||
if (error)
|
||||
*error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape.");
|
||||
g_string_free (str, TRUE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (in_quote) {
|
||||
if (error)
|
||||
*error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote.");
|
||||
g_string_free (str, TRUE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (str->len > 0) {
|
||||
g_ptr_array_add (array, g_string_free (str, FALSE));
|
||||
} else {
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
g_ptr_array_add (array, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
|
||||
{
|
||||
GPtrArray *array;
|
||||
gint argc;
|
||||
gchar **argv;
|
||||
|
||||
g_return_val_if_fail (command_line, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
array = g_ptr_array_new();
|
||||
if (split_cmdline (command_line, array, error)) {
|
||||
g_ptr_array_add (array, NULL);
|
||||
g_strfreev ((gchar **) array->pdata);
|
||||
g_ptr_array_free (array, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
argc = array->len;
|
||||
argv = (gchar **) array->pdata;
|
||||
|
||||
if (argc == 1) {
|
||||
g_strfreev (argv);
|
||||
g_ptr_array_free (array, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (argcp) {
|
||||
*argcp = array->len - 1;
|
||||
}
|
||||
|
||||
if (argvp) {
|
||||
*argvp = argv;
|
||||
} else {
|
||||
g_strfreev (argv);
|
||||
}
|
||||
|
||||
g_ptr_array_free (array, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_shell_quote (const gchar *unquoted_string)
|
||||
{
|
||||
//g_error ("Not implemented");
|
||||
return g_strdup (unquoted_string);
|
||||
// return NULL;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_shell_unquote (const gchar *quoted_string, GError **error)
|
||||
{
|
||||
// g_error ("Not implemented");
|
||||
return g_strdup (quoted_string);
|
||||
// return NULL;
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
/*
|
||||
* gslist.c: Singly-linked list implementation
|
||||
*
|
||||
* Authors:
|
||||
* Duncan Mak ([email protected])
|
||||
* Raja R Harinath ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
GSList*
|
||||
g_slist_alloc (void)
|
||||
{
|
||||
return g_new0 (GSList, 1);
|
||||
}
|
||||
|
||||
void
|
||||
g_slist_free_1 (GSList *list)
|
||||
{
|
||||
g_free (list);
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_append (GSList *list, gpointer data)
|
||||
{
|
||||
return g_slist_concat (list, g_slist_prepend (NULL, data));
|
||||
}
|
||||
|
||||
/* This is also a list node constructor. */
|
||||
GSList*
|
||||
g_slist_prepend (GSList *list, gpointer data)
|
||||
{
|
||||
GSList *head = g_slist_alloc ();
|
||||
head->data = data;
|
||||
head->next = list;
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert the given data in a new node after the current node.
|
||||
* Return new node.
|
||||
*/
|
||||
static inline GSList *
|
||||
insert_after (GSList *list, gpointer data)
|
||||
{
|
||||
list->next = g_slist_prepend (list->next, data);
|
||||
return list->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the node prior to the node containing 'data'.
|
||||
* If the list is empty, or the first node contains 'data', return NULL.
|
||||
* If no node contains 'data', return the last node.
|
||||
*/
|
||||
static inline GSList*
|
||||
find_prev (GSList *list, gconstpointer data)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
while (list) {
|
||||
if (list->data == data)
|
||||
break;
|
||||
prev = list;
|
||||
list = list->next;
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
/* like 'find_prev', but searches for node 'link' */
|
||||
static inline GSList*
|
||||
find_prev_link (GSList *list, GSList *link)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
while (list) {
|
||||
if (list == link)
|
||||
break;
|
||||
prev = list;
|
||||
list = list->next;
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_insert_before (GSList *list, GSList *sibling, gpointer data)
|
||||
{
|
||||
GSList *prev = find_prev_link (list, sibling);
|
||||
|
||||
if (!prev)
|
||||
return g_slist_prepend (list, data);
|
||||
|
||||
insert_after (prev, data);
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
g_slist_free (GSList *list)
|
||||
{
|
||||
while (list) {
|
||||
GSList *next = list->next;
|
||||
g_slist_free_1 (list);
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_copy (GSList *list)
|
||||
{
|
||||
GSList *copy, *tmp;
|
||||
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
copy = g_slist_prepend (NULL, list->data);
|
||||
tmp = copy;
|
||||
|
||||
for (list = list->next; list; list = list->next)
|
||||
tmp = insert_after (tmp, list->data);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_concat (GSList *list1, GSList *list2)
|
||||
{
|
||||
if (!list1)
|
||||
return list2;
|
||||
|
||||
g_slist_last (list1)->next = list2;
|
||||
return list1;
|
||||
}
|
||||
|
||||
void
|
||||
g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
|
||||
{
|
||||
while (list) {
|
||||
(*func) (list->data, user_data);
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_last (GSList *list)
|
||||
{
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
while (list->next)
|
||||
list = list->next;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_find (GSList *list, gconstpointer data)
|
||||
{
|
||||
for (; list; list = list->next)
|
||||
if (list->data == data)
|
||||
break;
|
||||
return list;
|
||||
}
|
||||
|
||||
guint
|
||||
g_slist_length (GSList *list)
|
||||
{
|
||||
guint length = 0;
|
||||
|
||||
while (list) {
|
||||
length ++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_remove (GSList *list, gconstpointer data)
|
||||
{
|
||||
GSList *prev = find_prev (list, data);
|
||||
GSList *current = prev ? prev->next : list;
|
||||
|
||||
if (current) {
|
||||
if (prev)
|
||||
prev->next = current->next;
|
||||
else
|
||||
list = current->next;
|
||||
g_slist_free_1 (current);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_remove_all (GSList *list, gconstpointer data)
|
||||
{
|
||||
GSList *next = list;
|
||||
GSList *prev = NULL;
|
||||
GSList *current;
|
||||
|
||||
while (next) {
|
||||
GSList *tmp_prev = find_prev (next, data);
|
||||
if (tmp_prev)
|
||||
prev = tmp_prev;
|
||||
current = prev ? prev->next : list;
|
||||
|
||||
if (!current)
|
||||
break;
|
||||
|
||||
next = current->next;
|
||||
|
||||
if (prev)
|
||||
prev->next = next;
|
||||
else
|
||||
list = next;
|
||||
g_slist_free_1 (current);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_remove_link (GSList *list, GSList *link)
|
||||
{
|
||||
GSList *prev = find_prev_link (list, link);
|
||||
GSList *current = prev ? prev->next : list;
|
||||
|
||||
if (current) {
|
||||
if (prev)
|
||||
prev->next = current->next;
|
||||
else
|
||||
list = current->next;
|
||||
current->next = NULL;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_delete_link (GSList *list, GSList *link)
|
||||
{
|
||||
list = g_slist_remove_link (list, link);
|
||||
g_slist_free_1 (link);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_reverse (GSList *list)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
while (list){
|
||||
GSList *next = list->next;
|
||||
list->next = prev;
|
||||
prev = list;
|
||||
list = next;
|
||||
}
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
|
||||
if (!func)
|
||||
return list;
|
||||
|
||||
if (!list || func (list->data, data) > 0)
|
||||
return g_slist_prepend (list, data);
|
||||
|
||||
/* Invariant: func (prev->data, data) <= 0) */
|
||||
for (prev = list; prev->next; prev = prev->next)
|
||||
if (func (prev->next->data, data) > 0)
|
||||
break;
|
||||
|
||||
/* ... && (prev->next == 0 || func (prev->next->data, data) > 0)) */
|
||||
insert_after (prev, data);
|
||||
return list;
|
||||
}
|
||||
|
||||
typedef GSList list_node;
|
||||
#include "sort.frag.h"
|
||||
|
||||
GSList*
|
||||
g_slist_sort (GSList *list, GCompareFunc func)
|
||||
{
|
||||
if (!list || !list->next)
|
||||
return list;
|
||||
return do_sort (list, func);
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* Spawning processes.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/types.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define set_error(msg...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg); } while (0)
|
||||
#define set_error_cond(cond,msg...) do { if ((cond) && error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg); } while (0)
|
||||
#define set_error_status(status,msg...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, status, msg); } while (0)
|
||||
#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
|
||||
#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
|
||||
|
||||
static int
|
||||
safe_read (int fd, gchar *buffer, gint count, GError **error)
|
||||
{
|
||||
int res;
|
||||
|
||||
NO_INTR (res, read (fd, buffer, count));
|
||||
set_error_cond (res == -1, "Error reading from pipe.");
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
|
||||
{
|
||||
fd_set rfds;
|
||||
int res;
|
||||
gboolean out_closed;
|
||||
gboolean err_closed;
|
||||
GString *out = NULL;
|
||||
GString *err = NULL;
|
||||
gchar *buffer = NULL;
|
||||
gint nread;
|
||||
|
||||
out_closed = (outfd < 0);
|
||||
err_closed = (errfd < 0);
|
||||
if (out_str) {
|
||||
*out_str = NULL;
|
||||
out = g_string_new ("");
|
||||
}
|
||||
|
||||
if (err_str) {
|
||||
*err_str = NULL;
|
||||
err = g_string_new ("");
|
||||
}
|
||||
|
||||
do {
|
||||
if (out_closed && err_closed)
|
||||
break;
|
||||
|
||||
FD_ZERO (&rfds);
|
||||
if (!out_closed && outfd >= 0)
|
||||
FD_SET (outfd, &rfds);
|
||||
if (!err_closed && errfd >= 0)
|
||||
FD_SET (errfd, &rfds);
|
||||
|
||||
res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
|
||||
if (res > 0) {
|
||||
if (buffer == NULL)
|
||||
buffer = g_malloc (1024);
|
||||
if (!out_closed && FD_ISSET (outfd, &rfds)) {
|
||||
nread = safe_read (outfd, buffer, 1024, error);
|
||||
if (nread < 0) {
|
||||
close (errfd);
|
||||
close (outfd);
|
||||
return -1;
|
||||
}
|
||||
g_string_append_len (out, buffer, nread);
|
||||
if (nread <= 0) {
|
||||
out_closed = TRUE;
|
||||
close (outfd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!err_closed && FD_ISSET (errfd, &rfds)) {
|
||||
nread = safe_read (errfd, buffer, 1024, error);
|
||||
if (nread < 0) {
|
||||
close (errfd);
|
||||
close (outfd);
|
||||
return -1;
|
||||
}
|
||||
g_string_append_len (err, buffer, nread);
|
||||
if (nread <= 0) {
|
||||
err_closed = TRUE;
|
||||
close (errfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (res > 0 || (res == -1 && errno == EINTR));
|
||||
|
||||
g_free (buffer);
|
||||
if (out_str)
|
||||
*out_str = g_string_free (out, FALSE);
|
||||
|
||||
if (err_str)
|
||||
*err_str = g_string_free (err, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_pipe (int *fds, GError **error)
|
||||
{
|
||||
if (pipe (fds) == -1) {
|
||||
set_error ("Error creating pipe.");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
gchar **standard_error,
|
||||
gint *exit_status,
|
||||
GError **error)
|
||||
{
|
||||
pid_t pid;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
int stdout_pipe [2] = { -1, -1 };
|
||||
int stderr_pipe [2] = { -1, -1 };
|
||||
int status;
|
||||
int res;
|
||||
|
||||
if (!g_shell_parse_argv (command_line, &argc, &argv, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_output && !create_pipe (stdout_pipe, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_error && !create_pipe (stderr_pipe, error)) {
|
||||
if (standard_output) {
|
||||
CLOSE_PIPE (stdout_pipe);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pid = fork ();
|
||||
if (pid == 0) {
|
||||
gint i;
|
||||
|
||||
if (standard_output) {
|
||||
close (stdout_pipe [0]);
|
||||
dup2 (stdout_pipe [1], STDOUT_FILENO);
|
||||
}
|
||||
|
||||
if (standard_error) {
|
||||
close (stderr_pipe [0]);
|
||||
dup2 (stderr_pipe [1], STDERR_FILENO);
|
||||
}
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
|
||||
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
|
||||
if (!g_path_is_absolute (argv [0])) {
|
||||
gchar *arg0;
|
||||
|
||||
arg0 = g_find_program_in_path (argv [0]);
|
||||
if (arg0 == NULL) {
|
||||
exit (1);
|
||||
}
|
||||
//g_free (argv [0]);
|
||||
argv [0] = arg0;
|
||||
}
|
||||
execv (argv [0], argv);
|
||||
exit (1); /* TODO: What now? */
|
||||
}
|
||||
|
||||
g_strfreev (argv);
|
||||
if (standard_output)
|
||||
close (stdout_pipe [1]);
|
||||
|
||||
if (standard_error)
|
||||
close (stderr_pipe [1]);
|
||||
|
||||
if (standard_output || standard_error) {
|
||||
res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error);
|
||||
if (res) {
|
||||
waitpid (pid, &status, WNOHANG); /* avoid zombie */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
NO_INTR (res, waitpid (pid, &status, 0));
|
||||
|
||||
/* TODO: What if error? */
|
||||
if (WIFEXITED (status) && exit_status) {
|
||||
*exit_status = WEXITSTATUS (status);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the only use we have in mono/metadata
|
||||
!g_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &ch_in, &ch_out, NULL, NULL)
|
||||
*/
|
||||
gboolean
|
||||
g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
GSpawnFlags flags,
|
||||
GSpawnChildSetupFunc child_setup,
|
||||
gpointer user_data,
|
||||
GPid *child_pid,
|
||||
gint *standard_input,
|
||||
gint *standard_output,
|
||||
gint *standard_error,
|
||||
GError **error)
|
||||
{
|
||||
pid_t pid;
|
||||
int info_pipe [2];
|
||||
int in_pipe [2] = { -1, -1 };
|
||||
int out_pipe [2] = { -1, -1 };
|
||||
int err_pipe [2] = { -1, -1 };
|
||||
int status;
|
||||
|
||||
g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
|
||||
|
||||
if (!create_pipe (info_pipe, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_output && !create_pipe (out_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (standard_error && !create_pipe (err_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (standard_input && !create_pipe (in_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pid = fork ();
|
||||
if (pid == -1) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
CLOSE_PIPE (in_pipe);
|
||||
set_error ("Error in fork ()");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
/* No zombie left behind */
|
||||
if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
|
||||
pid = fork ();
|
||||
}
|
||||
|
||||
if (pid != 0) {
|
||||
exit (pid == -1 ? 1 : 0);
|
||||
} else {
|
||||
gint i;
|
||||
int fd;
|
||||
gchar *arg0;
|
||||
gchar **actual_args;
|
||||
gint unused;
|
||||
|
||||
close (info_pipe [0]);
|
||||
close (in_pipe [1]);
|
||||
close (out_pipe [0]);
|
||||
close (err_pipe [0]);
|
||||
|
||||
/* when exec* succeeds, we want to close this fd, which will return
|
||||
* a 0 read on the parent. We're not supposed to keep it open forever.
|
||||
* If exec fails, we still can write the error to it before closing.
|
||||
*/
|
||||
fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
|
||||
pid = getpid ();
|
||||
NO_INTR (unused, write (info_pipe [1], &pid, sizeof (pid_t)));
|
||||
}
|
||||
|
||||
if (working_directory && chdir (working_directory) == -1) {
|
||||
int err = errno;
|
||||
NO_INTR (unused, write (info_pipe [1], &err, sizeof (int)));
|
||||
exit (0);
|
||||
}
|
||||
|
||||
if (standard_output) {
|
||||
dup2 (out_pipe [1], STDOUT_FILENO);
|
||||
} else if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
|
||||
fd = open ("/dev/null", O_WRONLY);
|
||||
dup2 (fd, STDOUT_FILENO);
|
||||
}
|
||||
|
||||
if (standard_error) {
|
||||
dup2 (err_pipe [1], STDERR_FILENO);
|
||||
} else if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0) {
|
||||
fd = open ("/dev/null", O_WRONLY);
|
||||
dup2 (fd, STDERR_FILENO);
|
||||
}
|
||||
|
||||
if (standard_input) {
|
||||
dup2 (in_pipe [0], STDERR_FILENO);
|
||||
} else if ((flags & G_SPAWN_CHILD_INHERITS_STDIN) == 0) {
|
||||
fd = open ("/dev/null", O_RDONLY);
|
||||
dup2 (fd, STDERR_FILENO);
|
||||
}
|
||||
|
||||
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
}
|
||||
|
||||
actual_args = ((flags & G_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
|
||||
if (envp == NULL)
|
||||
envp = environ;
|
||||
|
||||
if (child_setup)
|
||||
child_setup (user_data);
|
||||
|
||||
arg0 = argv [0];
|
||||
if (!g_path_is_absolute (arg0) || (flags & G_SPAWN_SEARCH_PATH) != 0) {
|
||||
arg0 = g_find_program_in_path (argv [0]);
|
||||
if (arg0 == NULL) {
|
||||
int err = ENOENT;
|
||||
write (info_pipe [1], &err, sizeof (int));
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
execve (arg0, actual_args, envp);
|
||||
write (info_pipe [1], &errno, sizeof (int));
|
||||
exit (0);
|
||||
}
|
||||
} else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
|
||||
int w;
|
||||
/* Wait for the first child if two are created */
|
||||
NO_INTR (w, waitpid (pid, &status, 0));
|
||||
if (status == 1 || w == -1) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
CLOSE_PIPE (in_pipe);
|
||||
set_error ("Error in fork (): %d", status);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
close (info_pipe [1]);
|
||||
close (in_pipe [0]);
|
||||
close (out_pipe [1]);
|
||||
close (err_pipe [1]);
|
||||
|
||||
if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
|
||||
int x;
|
||||
NO_INTR (x, read (info_pipe [0], &pid, sizeof (pid_t))); /* if we read < sizeof (pid_t)... */
|
||||
}
|
||||
|
||||
if (child_pid) {
|
||||
*child_pid = pid;
|
||||
}
|
||||
|
||||
if (read (info_pipe [0], &status, sizeof (int)) != 0) {
|
||||
close (info_pipe [0]);
|
||||
close (in_pipe [0]);
|
||||
close (out_pipe [1]);
|
||||
close (err_pipe [1]);
|
||||
set_error_status (status, "Error in exec (%d -> %s)", status, strerror (status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
close (info_pipe [0]);
|
||||
if (standard_input)
|
||||
*standard_input = in_pipe [1];
|
||||
if (standard_output)
|
||||
*standard_output = out_pipe [0];
|
||||
if (standard_error)
|
||||
*standard_error = err_pipe [0];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,704 +0,0 @@
|
||||
/*
|
||||
* gstr.c: String Utility Functions.
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
* Aaron Bockover ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
|
||||
/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
|
||||
gchar *
|
||||
g_strndup (const gchar *str, gsize n)
|
||||
{
|
||||
return strndup (str, n);
|
||||
}
|
||||
|
||||
void
|
||||
g_strfreev (gchar **str_array)
|
||||
{
|
||||
gchar **orig = str_array;
|
||||
if (str_array == NULL)
|
||||
return;
|
||||
while (*str_array != NULL){
|
||||
g_free (*str_array);
|
||||
str_array++;
|
||||
}
|
||||
g_free (orig);
|
||||
}
|
||||
|
||||
guint
|
||||
g_strv_length(gchar **str_array)
|
||||
{
|
||||
gint length = 0;
|
||||
g_return_val_if_fail(str_array != NULL, 0);
|
||||
for(length = 0; str_array[length] != NULL; length++);
|
||||
return length;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_str_has_suffix(const gchar *str, const gchar *suffix)
|
||||
{
|
||||
gint str_length;
|
||||
gint suffix_length;
|
||||
|
||||
g_return_val_if_fail(str != NULL, FALSE);
|
||||
g_return_val_if_fail(suffix != NULL, FALSE);
|
||||
|
||||
str_length = strlen(str);
|
||||
suffix_length = strlen(suffix);
|
||||
|
||||
return suffix_length <= str_length ?
|
||||
strncmp(str + str_length - suffix_length, suffix, suffix_length) == 0 :
|
||||
FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_str_has_prefix(const gchar *str, const gchar *prefix)
|
||||
{
|
||||
gint str_length;
|
||||
gint prefix_length;
|
||||
|
||||
g_return_val_if_fail(str != NULL, FALSE);
|
||||
g_return_val_if_fail(prefix != NULL, FALSE);
|
||||
|
||||
str_length = strlen(str);
|
||||
prefix_length = strlen(prefix);
|
||||
|
||||
return prefix_length <= str_length ?
|
||||
strncmp(str, prefix, prefix_length) == 0 :
|
||||
FALSE;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strdup_vprintf (const gchar *format, va_list args)
|
||||
{
|
||||
int n;
|
||||
char *ret;
|
||||
|
||||
n = vasprintf (&ret, format, args);
|
||||
if (n == -1)
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strdup_printf (const gchar *format, ...)
|
||||
{
|
||||
gchar *ret;
|
||||
va_list args;
|
||||
int n;
|
||||
|
||||
va_start (args, format);
|
||||
n = vasprintf (&ret, format, args);
|
||||
va_end (args);
|
||||
if (n == -1)
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
g_strerror (gint errnum)
|
||||
{
|
||||
return strerror (errnum);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strconcat (const gchar *first, ...)
|
||||
{
|
||||
g_return_val_if_fail (first != NULL, NULL);
|
||||
va_list args;
|
||||
int total = 0;
|
||||
char *s, *ret;
|
||||
|
||||
total += strlen (first);
|
||||
va_start (args, first);
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
|
||||
total += strlen (s);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
ret = g_malloc (total + 1);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
ret [total] = 0;
|
||||
strcpy (ret, first);
|
||||
va_start (args, first);
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
|
||||
strcat (ret, s);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar **
|
||||
g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
|
||||
{
|
||||
gchar *string_c;
|
||||
gchar *strtok_save, **vector;
|
||||
gchar *token, *token_c;
|
||||
gint size = 1;
|
||||
gint token_length;
|
||||
|
||||
g_return_val_if_fail(string != NULL, NULL);
|
||||
g_return_val_if_fail(delimiter != NULL, NULL);
|
||||
g_return_val_if_fail(delimiter[0] != 0, NULL);
|
||||
|
||||
token_length = strlen(string);
|
||||
string_c = (gchar *)g_malloc(token_length + 1);
|
||||
memcpy(string_c, string, token_length);
|
||||
string_c[token_length] = 0;
|
||||
|
||||
if (strncmp (string_c, delimiter, strlen (delimiter)) == 0){
|
||||
vector = (gchar **) g_malloc (2 * sizeof (vector));
|
||||
vector [0] = g_strdup ("");
|
||||
size++;
|
||||
} else
|
||||
vector = NULL;
|
||||
token = (gchar *)strtok_r(string_c, delimiter, &strtok_save);
|
||||
|
||||
if (!(max_tokens > 0 && size >= max_tokens)){
|
||||
while(token != NULL) {
|
||||
token_length = strlen(token);
|
||||
token_c = (gchar *)g_malloc(token_length + 1);
|
||||
memcpy(token_c, token, token_length);
|
||||
token_c[token_length] = 0;
|
||||
|
||||
vector = vector == NULL ?
|
||||
(gchar **)g_malloc(2 * sizeof(vector)) :
|
||||
(gchar **)g_realloc(vector, (size + 1) * sizeof(vector));
|
||||
|
||||
vector[size - 1] = token_c;
|
||||
size++;
|
||||
|
||||
if(max_tokens > 0 && size >= max_tokens) {
|
||||
if(size > max_tokens) {
|
||||
break;
|
||||
}
|
||||
|
||||
token = *strtok_save ? strtok_save : NULL;
|
||||
} else {
|
||||
token = (gchar *)strtok_r(NULL, delimiter, &strtok_save);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vector == NULL){
|
||||
vector = (gchar **) g_malloc (2 * sizeof (vector));
|
||||
vector [0] = NULL;
|
||||
} else if (size > 0){
|
||||
vector[size - 1] = NULL;
|
||||
}
|
||||
|
||||
g_free(string_c);
|
||||
string_c = NULL;
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strreverse (gchar *str)
|
||||
{
|
||||
guint len, half;
|
||||
gint i;
|
||||
gchar c;
|
||||
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
len = strlen (str);
|
||||
half = len / 2;
|
||||
len--;
|
||||
for (i = 0; i < half; i++, len--) {
|
||||
c = str [i];
|
||||
str [i] = str [len];
|
||||
str [len] = c;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strjoin (const gchar *separator, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *res, *s;
|
||||
int len, slen;
|
||||
|
||||
if (separator != NULL)
|
||||
slen = strlen (separator);
|
||||
else
|
||||
slen = 0;
|
||||
len = 0;
|
||||
va_start (args, separator);
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
|
||||
len += strlen (s);
|
||||
len += slen;
|
||||
}
|
||||
va_end (args);
|
||||
if (len == 0)
|
||||
return g_strdup ("");
|
||||
|
||||
/* Remove the last separator */
|
||||
if (slen > 0 && len > 0)
|
||||
len -= slen;
|
||||
len++;
|
||||
res = g_malloc (len);
|
||||
va_start (args, separator);
|
||||
s = va_arg (args, char *);
|
||||
strcpy (res, s);
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
|
||||
if (separator != NULL)
|
||||
strcat (res, separator);
|
||||
strcat (res, s);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strjoinv (const gchar *separator, gchar **str_array)
|
||||
{
|
||||
char *res;
|
||||
int slen, len, i;
|
||||
|
||||
if (separator != NULL)
|
||||
slen = strlen (separator);
|
||||
else
|
||||
slen = 0;
|
||||
|
||||
len = 0;
|
||||
for (i = 0; str_array [i] != NULL; i++){
|
||||
len += strlen (str_array [i]);
|
||||
len += slen;
|
||||
}
|
||||
if (len == 0)
|
||||
return g_strdup ("");
|
||||
if (slen > 0 && len > 0)
|
||||
len -= slen;
|
||||
len++;
|
||||
res = g_malloc (len);
|
||||
strcpy (res, str_array [0]);
|
||||
for (i = 1; str_array [i] != NULL; i++){
|
||||
if (separator != NULL)
|
||||
strcat (res, separator);
|
||||
strcat (res, str_array [i]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strchug (gchar *str)
|
||||
{
|
||||
gint len;
|
||||
gchar *tmp;
|
||||
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
tmp = str;
|
||||
while (*tmp && isspace (*tmp)) tmp++;
|
||||
if (str != tmp) {
|
||||
len = strlen (str) - (tmp - str - 1);
|
||||
memmove (str, tmp, len);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strchomp (gchar *str)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
tmp = str + strlen (str) - 1;
|
||||
while (*tmp && isspace (*tmp)) tmp--;
|
||||
*(tmp + 1) = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
gint
|
||||
g_printf(gchar const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gint ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint
|
||||
g_fprintf(FILE *file, gchar const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gint ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vfprintf(file, format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint
|
||||
g_sprintf(gchar *string, gchar const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gint ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsprintf(string, format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint
|
||||
g_snprintf(gchar *string, gulong n, gchar const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gint ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsnprintf(string, n, format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char const hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
|
||||
static gboolean
|
||||
char_needs_encoding (char c)
|
||||
{
|
||||
if (((unsigned char)c) >= 0x80)
|
||||
return TRUE;
|
||||
|
||||
if ((c >= '@' && c <= 'Z') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= '&' && c < 0x3b) ||
|
||||
(c == '!') || (c == '$') || (c == '_') || (c == '=') || (c == '~'))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
|
||||
{
|
||||
int n;
|
||||
char *ret, *rp;
|
||||
const char *p;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
if (hostname != NULL)
|
||||
g_warning ("eglib: g_filename_to_uri: hostname not handled");
|
||||
|
||||
if (*filename != '/'){
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "Not an absolute filename");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = strlen ("file://") + 1;
|
||||
for (p = filename; *p; p++){
|
||||
if (char_needs_encoding (*p))
|
||||
n += 3;
|
||||
else
|
||||
n++;
|
||||
}
|
||||
ret = g_malloc (n);
|
||||
strcpy (ret, "file://");
|
||||
for (p = filename, rp = ret + strlen (ret); *p; p++){
|
||||
if (char_needs_encoding (*p)){
|
||||
*rp++ = '%';
|
||||
*rp++ = hx [((unsigned char)(*p)) >> 4];
|
||||
*rp++ = hx [((unsigned char)(*p)) & 0xf];
|
||||
} else
|
||||
*rp++ = *p;
|
||||
}
|
||||
*rp = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
decode (char p)
|
||||
{
|
||||
if (p >= '0' && p <= '9')
|
||||
return p - '0';
|
||||
if (p >= 'A' && p <= 'F')
|
||||
return p - 'A';
|
||||
if (p >= 'a' && p <= 'f')
|
||||
return p - 'a';
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
|
||||
{
|
||||
const char *p;
|
||||
char *r, *result;
|
||||
int flen = 0;
|
||||
|
||||
g_return_val_if_fail (uri != NULL, NULL);
|
||||
|
||||
if (hostname != NULL)
|
||||
g_warning ("eglib: g_filename_from_uri: hostname not handled");
|
||||
|
||||
if (strncmp (uri, "file:///", 8) != 0){
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "URI does not start with the file: scheme");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (p = uri + 8; *p; p++){
|
||||
if (*p == '%'){
|
||||
if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){
|
||||
p += 2;
|
||||
} else {
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "URI contains an invalid escape sequence");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
flen++;
|
||||
}
|
||||
flen++;
|
||||
|
||||
result = g_malloc (flen + 1);
|
||||
*result = '/';
|
||||
result [flen] = 0;
|
||||
|
||||
for (p = uri + 8, r = result + 1; *p; p++){
|
||||
if (*p == '%'){
|
||||
*r++ = (decode (p [1]) << 4) | decode (p [2]);
|
||||
p += 2;
|
||||
} else
|
||||
*r++ = *p;
|
||||
flen++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
g_strdown (gchar *string)
|
||||
{
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
while (*string){
|
||||
*string = tolower (*string);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_ascii_strdown (const gchar *str, gssize len)
|
||||
{
|
||||
char *ret;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (str != NULL, NULL);
|
||||
|
||||
if (len == -1)
|
||||
len = strlen (str);
|
||||
|
||||
ret = g_malloc (len + 1);
|
||||
for (i = 0; i < len; i++){
|
||||
guchar c = (guchar) str [i];
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += 'a' - 'A';
|
||||
ret [i] = c;
|
||||
}
|
||||
ret [i] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint
|
||||
g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (s1 != NULL, 0);
|
||||
g_return_val_if_fail (s2 != NULL, 0);
|
||||
|
||||
for (i = 0; i < n; i++){
|
||||
gchar c1 = *s1++;
|
||||
gchar c2 = *s2++;
|
||||
|
||||
if (c1 == c2)
|
||||
continue;
|
||||
|
||||
if (c1 == 0)
|
||||
return -1;
|
||||
if (c2 == 0)
|
||||
return 1;
|
||||
return c1-c2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
|
||||
{
|
||||
gchar *ptr;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
if (delimiters == NULL)
|
||||
delimiters = G_STR_DELIMITERS;
|
||||
|
||||
for (ptr = string; *ptr; ptr++) {
|
||||
if (strchr (delimiters, *ptr))
|
||||
*ptr = new_delimiter;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
gsize
|
||||
g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
|
||||
{
|
||||
gchar *d;
|
||||
const gchar *s;
|
||||
gchar c;
|
||||
gsize len;
|
||||
|
||||
g_return_val_if_fail (src != NULL, 0);
|
||||
g_return_val_if_fail (dest != NULL, 0);
|
||||
|
||||
len = dest_size;
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
s = src;
|
||||
d = dest;
|
||||
while (--len) {
|
||||
c = *s++;
|
||||
*d++ = c;
|
||||
if (c == '\0')
|
||||
return (dest_size - len - 1);
|
||||
}
|
||||
|
||||
/* len is 0 i we get here */
|
||||
*d = '\0';
|
||||
/* we need to return the length of src here */
|
||||
while (*s++) ; /* instead of a plain strlen, we use 's' */
|
||||
return s - src - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const gchar escaped_dflt [256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 'b', 't', 'n', 1, 'f', 'r', 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0,
|
||||
0, 0, 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,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
|
||||
gchar *
|
||||
g_strescape (const gchar *source, const gchar *exceptions)
|
||||
{
|
||||
gchar escaped [256];
|
||||
const gchar *ptr;
|
||||
gchar c;
|
||||
int op;
|
||||
gchar *result;
|
||||
gchar *res_ptr;
|
||||
|
||||
g_return_val_if_fail (source != NULL, NULL);
|
||||
|
||||
memcpy (escaped, escaped_dflt, 256);
|
||||
if (exceptions != NULL) {
|
||||
for (ptr = exceptions; *ptr; ptr++)
|
||||
escaped [(int) *ptr] = 0;
|
||||
}
|
||||
result = g_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
|
||||
res_ptr = result;
|
||||
for (ptr = source; *ptr; ptr++) {
|
||||
c = *ptr;
|
||||
op = escaped [(int) c];
|
||||
if (op == 0) {
|
||||
*res_ptr++ = c;
|
||||
} else {
|
||||
*res_ptr++ = '\\';
|
||||
if (op != 1) {
|
||||
*res_ptr++ = op;
|
||||
} else {
|
||||
*res_ptr++ = '0' + ((c >> 6) & 3);
|
||||
*res_ptr++ = '0' + ((c >> 3) & 7);
|
||||
*res_ptr++ = '0' + (c & 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
*res_ptr = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strdup (const gchar *str)
|
||||
{
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
return strdup (str);
|
||||
}
|
||||
|
||||
gint
|
||||
g_ascii_xdigit_value (gchar c)
|
||||
{
|
||||
return ((isxdigit (c) == 0) ? -1 :
|
||||
((c >= '0' && c <= '9') ? (c - '0') :
|
||||
((c >= 'a' && c <= 'f') ? (c - 'a' + 10) :
|
||||
(c - 'A' + 10))));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* String functions
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
* Aaron Bockover ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define GROW_IF_NECESSARY(s,l) { \
|
||||
if(s->len + l >= s->allocated_len) { \
|
||||
s->allocated_len = (s->allocated_len + l + 16) * 2; \
|
||||
s->str = g_realloc(s->str, s->allocated_len); \
|
||||
} \
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_new_len (const gchar *init, gssize len)
|
||||
{
|
||||
GString *ret = g_new (GString, 1);
|
||||
|
||||
ret->len = len < 0 ? strlen(init) : len;
|
||||
ret->allocated_len = MAX(ret->len + 1, 16);
|
||||
ret->str = g_malloc(ret->allocated_len);
|
||||
memcpy(ret->str, init, ret->len);
|
||||
ret->str[ret->len] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_new (const gchar *init)
|
||||
{
|
||||
return g_string_new_len(init, -1);
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_sized_new (gsize default_size)
|
||||
{
|
||||
GString *ret = g_new (GString, 1);
|
||||
|
||||
ret->str = g_malloc (default_size);
|
||||
ret->str [0] = 0;
|
||||
ret->len = 0;
|
||||
ret->allocated_len = default_size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_string_free (GString *string, gboolean free_segment)
|
||||
{
|
||||
gchar *data;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
data = string->str;
|
||||
g_free(string);
|
||||
|
||||
if(!free_segment) {
|
||||
return data;
|
||||
}
|
||||
|
||||
g_free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_append_len (GString *string, const gchar *val, gssize len)
|
||||
{
|
||||
g_return_val_if_fail(string != NULL, NULL);
|
||||
g_return_val_if_fail(val != NULL, string);
|
||||
|
||||
if(len < 0) {
|
||||
len = strlen(val);
|
||||
}
|
||||
|
||||
GROW_IF_NECESSARY(string, len);
|
||||
memcpy(string->str + string->len, val, len);
|
||||
string->len += len;
|
||||
string->str[string->len] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_append (GString *string, const gchar *val)
|
||||
{
|
||||
g_return_val_if_fail(string != NULL, NULL);
|
||||
g_return_val_if_fail(val != NULL, string);
|
||||
|
||||
return g_string_append_len(string, val, -1);
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_append_c (GString *string, gchar c)
|
||||
{
|
||||
g_return_val_if_fail(string != NULL, NULL);
|
||||
|
||||
GROW_IF_NECESSARY(string, 1);
|
||||
|
||||
string->str[string->len] = c;
|
||||
string->str[string->len + 1] = 0;
|
||||
string->len++;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_prepend (GString *string, const gchar *val)
|
||||
{
|
||||
gssize len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
g_return_val_if_fail (val != NULL, string);
|
||||
|
||||
len = strlen (val);
|
||||
|
||||
GROW_IF_NECESSARY(string, len);
|
||||
memmove(string->str + len, string->str, string->len + 1);
|
||||
memcpy(string->str, val, len);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
void
|
||||
g_string_append_printf (GString *string, const gchar *format, ...)
|
||||
{
|
||||
char *ret;
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
va_start (args, format);
|
||||
ret = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
g_string_append (string, ret);
|
||||
|
||||
free (ret);
|
||||
}
|
||||
|
||||
void
|
||||
g_string_printf (GString *string, const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
g_free (string->str);
|
||||
|
||||
va_start (args, format);
|
||||
string->str = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
string->len = strlen (string->str);
|
||||
string->allocated_len = string->len+1;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_truncate (GString *string, gsize len)
|
||||
{
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
|
||||
/* Silent return */
|
||||
if (len < 0 || len >= string->len) {
|
||||
return string;
|
||||
}
|
||||
|
||||
string->len = len;
|
||||
string->str[len] = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Timer
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
struct _GTimer {
|
||||
struct timeval start;
|
||||
struct timeval stop;
|
||||
};
|
||||
|
||||
GTimer *g_timer_new (void)
|
||||
{
|
||||
GTimer *timer;
|
||||
|
||||
timer = g_new0 (GTimer, 1);
|
||||
g_timer_start (timer);
|
||||
return timer;
|
||||
}
|
||||
|
||||
void
|
||||
g_timer_destroy (GTimer *timer)
|
||||
{
|
||||
g_return_if_fail (timer != NULL);
|
||||
g_free (timer);
|
||||
}
|
||||
|
||||
void
|
||||
g_timer_start (GTimer *timer)
|
||||
{
|
||||
g_return_if_fail (timer != NULL);
|
||||
gettimeofday (&timer->start, NULL);
|
||||
memset (&timer->stop, 0, sizeof (struct timeval));
|
||||
}
|
||||
|
||||
void
|
||||
g_timer_stop (GTimer *timer)
|
||||
{
|
||||
g_return_if_fail (timer != NULL);
|
||||
gettimeofday (&timer->stop, NULL);
|
||||
}
|
||||
|
||||
gdouble
|
||||
g_timer_elapsed (GTimer *timer, gulong *microseconds)
|
||||
{
|
||||
struct timeval tv;
|
||||
gulong seconds;
|
||||
gulong usec;
|
||||
gdouble result;
|
||||
|
||||
g_return_val_if_fail (timer != NULL, 0.0);
|
||||
|
||||
if (timer->stop.tv_sec == 0 && timer->stop.tv_usec == 0) {
|
||||
gettimeofday (&tv, NULL);
|
||||
} else {
|
||||
tv = timer->stop;
|
||||
}
|
||||
|
||||
usec = tv.tv_usec - timer->start.tv_usec;
|
||||
seconds = tv.tv_sec - timer->start.tv_sec;
|
||||
if (microseconds) {
|
||||
if (usec < 0) {
|
||||
usec += 1000000;
|
||||
seconds--;
|
||||
}
|
||||
*microseconds = usec;
|
||||
}
|
||||
result = seconds * 1000000 + usec;
|
||||
return (result / 1000000);
|
||||
}
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
* gunicode.c: Some Unicode routines
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* utf8 validation code came from:
|
||||
* libxml2-2.6.26 licensed under the MIT X11 license
|
||||
*
|
||||
* Authors credit in libxml's string.c:
|
||||
* William Brack <[email protected]>
|
||||
* [email protected]
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <langinfo.h>
|
||||
#include <iconv.h>
|
||||
#include <errno.h>
|
||||
|
||||
static char *my_charset;
|
||||
static gboolean is_utf8;
|
||||
|
||||
GUnicodeType
|
||||
g_unichar_type (gunichar c)
|
||||
{
|
||||
g_error ("g_unichar_type is not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
gunichar
|
||||
g_unichar_tolower (gunichar c)
|
||||
{
|
||||
g_error ("g_unichar_type is not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_convert (const gchar *str, gssize len,
|
||||
const gchar *to_codeset, const gchar *from_codeset,
|
||||
gsize *bytes_read, gsize *bytes_written, GError **error)
|
||||
{
|
||||
iconv_t convertor;
|
||||
char *buffer, *result, *output;
|
||||
const char *strptr = (const char *) str;
|
||||
int str_len = len == -1 ? strlen (str) : len;
|
||||
int buffer_size;
|
||||
size_t left, out_left;
|
||||
|
||||
convertor = iconv_open (to_codeset, from_codeset);
|
||||
if (convertor == (iconv_t) -1){
|
||||
*bytes_written = 0;
|
||||
*bytes_read = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer_size = str_len + 1 + 8;
|
||||
buffer = g_malloc (buffer_size);
|
||||
out_left = str_len;
|
||||
output = buffer;
|
||||
left = str_len;
|
||||
while (left > 0){
|
||||
int res = iconv (convertor, (char **) &strptr, &left, &output, &out_left);
|
||||
if (res == (size_t) -1){
|
||||
if (errno == E2BIG){
|
||||
char *n;
|
||||
int extra_space = 8 + left;
|
||||
int output_used = output - buffer;
|
||||
|
||||
buffer_size += extra_space;
|
||||
|
||||
n = g_realloc (buffer, buffer_size);
|
||||
|
||||
if (n == NULL){
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, G_CONVERT_ERROR_FAILED, "No memory left");
|
||||
g_free (buffer);
|
||||
result = NULL;
|
||||
goto leave;
|
||||
}
|
||||
buffer = n;
|
||||
out_left += extra_space;
|
||||
output = buffer + output_used;
|
||||
} else if (errno == EILSEQ){
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "Invalid multi-byte sequence on input");
|
||||
result = NULL;
|
||||
g_free (buffer);
|
||||
goto leave;
|
||||
} else if (errno == EINVAL){
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, G_CONVERT_ERROR_PARTIAL_INPUT, "Partial character sequence");
|
||||
result = NULL;
|
||||
g_free (buffer);
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bytes_read != NULL)
|
||||
*bytes_read = strptr - str;
|
||||
if (bytes_written != NULL)
|
||||
*bytes_written = output - buffer;
|
||||
*output = 0;
|
||||
result = buffer;
|
||||
leave:
|
||||
iconv_close (convertor);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is broken, and assumes an UTF8 system, but will do for eglib's first user
|
||||
*/
|
||||
gchar *
|
||||
g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
|
||||
{
|
||||
char *res;
|
||||
|
||||
if (len == -1)
|
||||
len = strlen (utf8string);
|
||||
|
||||
res = g_malloc (len + 1);
|
||||
g_strlcpy (res, utf8string, len);
|
||||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_get_charset (G_CONST_RETURN char **charset)
|
||||
{
|
||||
if (my_charset == NULL){
|
||||
my_charset = g_strdup (nl_langinfo (CODESET));
|
||||
is_utf8 = strcmp (my_charset, "UTF-8") == 0;
|
||||
}
|
||||
|
||||
if (charset != NULL)
|
||||
*charset = my_charset;
|
||||
|
||||
return is_utf8;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
|
||||
{
|
||||
g_get_charset (NULL);
|
||||
|
||||
return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
|
||||
{
|
||||
g_get_charset (NULL);
|
||||
|
||||
return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
|
||||
}
|
||||
/**
|
||||
* g_utf8_validate
|
||||
* @utf: Pointer to putative UTF-8 encoded string.
|
||||
*
|
||||
* Checks @utf for being valid UTF-8. @utf is assumed to be
|
||||
* null-terminated. This function is not super-strict, as it will
|
||||
* allow longer UTF-8 sequences than necessary. Note that Java is
|
||||
* capable of producing these sequences if provoked. Also note, this
|
||||
* routine checks for the 4-byte maximum size, but does not check for
|
||||
* 0x10ffff maximum value.
|
||||
*
|
||||
* Return value: true if @utf is valid.
|
||||
**/
|
||||
gboolean
|
||||
g_utf8_validate (const gchar *utf, gssize max_len, const gchar **end)
|
||||
{
|
||||
int ix;
|
||||
|
||||
g_return_val_if_fail (utf != NULL, FALSE);
|
||||
|
||||
if (max_len == -1)
|
||||
max_len = strlen (utf);
|
||||
|
||||
/*
|
||||
* utf is a string of 1, 2, 3 or 4 bytes. The valid strings
|
||||
* are as follows (in "bit format"):
|
||||
* 0xxxxxxx valid 1-byte
|
||||
* 110xxxxx 10xxxxxx valid 2-byte
|
||||
* 1110xxxx 10xxxxxx 10xxxxxx valid 3-byte
|
||||
* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte
|
||||
*/
|
||||
for (ix = 0; ix < max_len;) { /* string is 0-terminated */
|
||||
unsigned char c;
|
||||
|
||||
c = utf[ix];
|
||||
if ((c & 0x80) == 0x00) { /* 1-byte code, starts with 10 */
|
||||
ix++;
|
||||
} else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */
|
||||
if (((ix+1) >= max_len) || (utf[ix+1] & 0xc0 ) != 0x80){
|
||||
if (end != NULL)
|
||||
*end = &utf [ix];
|
||||
return FALSE;
|
||||
}
|
||||
ix += 2;
|
||||
} else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */
|
||||
if (((ix + 2) >= max_len) ||
|
||||
((utf[ix+1] & 0xc0) != 0x80) ||
|
||||
((utf[ix+2] & 0xc0) != 0x80)){
|
||||
if (end != NULL)
|
||||
*end = &utf [ix];
|
||||
return FALSE;
|
||||
}
|
||||
ix += 3;
|
||||
} else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */
|
||||
if (((ix + 3) >= max_len) ||
|
||||
((utf[ix+1] & 0xc0) != 0x80) ||
|
||||
((utf[ix+2] & 0xc0) != 0x80) ||
|
||||
((utf[ix+3] & 0xc0) != 0x80)){
|
||||
if (end != NULL)
|
||||
*end = &utf [ix];
|
||||
return FALSE;
|
||||
}
|
||||
ix += 4;
|
||||
} else {/* unknown encoding */
|
||||
if (end != NULL)
|
||||
*end = &utf [ix];
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
* gutf8.c: UTF-8 conversion
|
||||
*
|
||||
* Author:
|
||||
* Atsushi Enomoto <[email protected]>
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
gpointer error_quark = "ERROR";
|
||||
|
||||
static glong utf8_to_utf16_len (const gchar *str, glong len, glong *items_read, GError **error);
|
||||
static glong utf16_to_utf8_len (const gunichar2 *str, glong len, glong *items_read, GError **error);
|
||||
|
||||
gpointer
|
||||
g_convert_error_quark ()
|
||||
{
|
||||
return error_quark;
|
||||
}
|
||||
|
||||
gunichar2*
|
||||
g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **error)
|
||||
{
|
||||
/* The conversion logic is almost identical to UTF8Encoding.GetChars(),
|
||||
but error check is always done at utf8_to_utf16_len() so that
|
||||
the conversion core below simply resets erroreous bits */
|
||||
glong utf16_len;
|
||||
gunichar2 *ret;
|
||||
guchar ch, mb_size, mb_remain;
|
||||
guint32 codepoint;
|
||||
glong in_pos, out_pos;
|
||||
|
||||
utf16_len = 0;
|
||||
mb_size = 0;
|
||||
mb_remain = 0;
|
||||
in_pos = 0;
|
||||
out_pos = 0;
|
||||
|
||||
if (error)
|
||||
*error = NULL;
|
||||
|
||||
if (items_written)
|
||||
*items_written = 0;
|
||||
utf16_len = utf8_to_utf16_len (str, len, items_read, error);
|
||||
if (error)
|
||||
if (*error)
|
||||
return NULL;
|
||||
if (utf16_len < 0)
|
||||
return NULL;
|
||||
|
||||
ret = g_malloc ((1 + utf16_len) * sizeof (gunichar2));
|
||||
|
||||
for (in_pos = 0; len < 0 ? str [in_pos] : in_pos < len; in_pos++) {
|
||||
ch = (guchar) str [in_pos];
|
||||
if (mb_size == 0) {
|
||||
if (ch < 0x80)
|
||||
ret [out_pos++] = ch;
|
||||
else if ((ch & 0xE0) == 0xC0) {
|
||||
codepoint = ch & 0x1F;
|
||||
mb_size = 2;
|
||||
} else if ((ch & 0xF0) == 0xE0) {
|
||||
codepoint = ch & 0x0F;
|
||||
mb_size = 3;
|
||||
} else if ((ch & 0xF8) == 0xF0) {
|
||||
codepoint = ch & 7;
|
||||
mb_size = 4;
|
||||
} else if ((ch & 0xFC) == 0xF8) {
|
||||
codepoint = ch & 3;
|
||||
mb_size = 5;
|
||||
} else if ((ch & 0xFE) == 0xFC) {
|
||||
codepoint = ch & 3;
|
||||
mb_size = 6;
|
||||
} else {
|
||||
/* invalid utf-8 sequence */
|
||||
codepoint = 0;
|
||||
mb_remain = mb_size = 0;
|
||||
}
|
||||
if (mb_size > 1)
|
||||
mb_remain = mb_size - 1;
|
||||
} else {
|
||||
if ((ch & 0xC0) == 0x80) {
|
||||
codepoint = (codepoint << 6) | (ch & 0x3F);
|
||||
if (--mb_remain == 0) {
|
||||
/* multi byte character is fully consumed now. */
|
||||
if (codepoint < 0x10000) {
|
||||
ret [out_pos++] = codepoint % 0x10000;
|
||||
} else if (codepoint < 0x110000) {
|
||||
/* surrogate pair */
|
||||
codepoint -= 0x10000;
|
||||
ret [out_pos++] = (codepoint >> 10) + 0xD800;
|
||||
ret [out_pos++] = (codepoint & 0x3FF) + 0xDC00;
|
||||
} else {
|
||||
/* invalid utf-8 sequence (excess) */
|
||||
codepoint = 0;
|
||||
mb_remain = 0;
|
||||
}
|
||||
mb_size = 0;
|
||||
}
|
||||
} else {
|
||||
/* invalid utf-8 sequence */
|
||||
codepoint = 0;
|
||||
mb_remain = mb_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret [out_pos] = 0;
|
||||
if (items_written)
|
||||
*items_written = out_pos;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static glong
|
||||
utf8_to_utf16_len (const gchar *str, glong len, glong *items_read, GError **error)
|
||||
{
|
||||
/* It is almost identical to UTF8Encoding.GetCharCount() */
|
||||
guchar ch, mb_size, mb_remain;
|
||||
gboolean overlong;
|
||||
guint32 codepoint;
|
||||
glong in_pos, ret;
|
||||
|
||||
mb_size = 0;
|
||||
mb_remain = 0;
|
||||
overlong = 0;
|
||||
in_pos = 0;
|
||||
ret = 0;
|
||||
|
||||
for (in_pos = 0; len < 0 ? str [in_pos] : in_pos < len; in_pos++) {
|
||||
ch = str [in_pos];
|
||||
if (mb_size == 0) {
|
||||
if (ch < 0x80)
|
||||
ret++;
|
||||
else if ((ch & 0xE0) == 0xC0) {
|
||||
codepoint = ch & 0x1F;
|
||||
mb_size = 2;
|
||||
} else if ((ch & 0xF0) == 0xE0) {
|
||||
codepoint = ch & 0x0F;
|
||||
mb_size = 3;
|
||||
} else if ((ch & 0xF8) == 0xF0) {
|
||||
codepoint = ch & 7;
|
||||
mb_size = 4;
|
||||
} else if ((ch & 0xFC) == 0xF8) {
|
||||
codepoint = ch & 3;
|
||||
mb_size = 5;
|
||||
} else if ((ch & 0xFE) == 0xFC) {
|
||||
codepoint = ch & 3;
|
||||
mb_size = 6;
|
||||
} else {
|
||||
/* invalid utf-8 sequence */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-8 sequence at %d (illegal first byte)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} else {
|
||||
codepoint = 0;
|
||||
mb_remain = mb_size = 0;
|
||||
}
|
||||
}
|
||||
if (mb_size > 1)
|
||||
mb_remain = mb_size - 1;
|
||||
} else {
|
||||
if ((ch & 0xC0) == 0x80) {
|
||||
codepoint = (codepoint << 6) | (ch & 0x3F);
|
||||
if (--mb_remain == 0) {
|
||||
/* multi byte character is fully consumed now. */
|
||||
if (codepoint < 0x10000) {
|
||||
switch (mb_size) {
|
||||
case 2:
|
||||
overlong = codepoint < 0x7F;
|
||||
break;
|
||||
case 3:
|
||||
overlong = codepoint < 0x7FF;
|
||||
break;
|
||||
case 4:
|
||||
overlong = codepoint < 0xFFFF;
|
||||
break;
|
||||
case 5:
|
||||
overlong = codepoint < 0x1FFFFF;
|
||||
break;
|
||||
case 6:
|
||||
overlong = codepoint < 0x03FFFFFF;
|
||||
break;
|
||||
}
|
||||
if (overlong) {
|
||||
/* invalid utf-8 sequence (overlong) */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-8 sequence at %d (overlong)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} else {
|
||||
codepoint = 0;
|
||||
mb_remain = 0;
|
||||
overlong = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
ret++;
|
||||
} else if (codepoint < 0x110000) {
|
||||
/* surrogate pair */
|
||||
ret += 2;
|
||||
} else {
|
||||
/* invalid utf-8 sequence (excess) */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-8 sequence at %d (codepoint range excess)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} else {
|
||||
codepoint = 0;
|
||||
mb_remain = 0;
|
||||
}
|
||||
}
|
||||
mb_size = 0;
|
||||
}
|
||||
} else {
|
||||
/* invalid utf-8 sequence */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-8 sequence at %d (illegal following bytes)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} else {
|
||||
codepoint = 0;
|
||||
mb_remain = mb_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar*
|
||||
g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **error)
|
||||
{
|
||||
/* The conversion logic is almost identical to UTF8Encoding.GetBytes(),
|
||||
but error check is always done at utf16_to_utf8_len() so that
|
||||
the conversion core below simply resets erroreous bits */
|
||||
glong utf8_len;
|
||||
gchar *ret;
|
||||
glong in_pos, out_pos;
|
||||
gunichar2 ch;
|
||||
guint32 codepoint;
|
||||
gboolean surrogate;
|
||||
|
||||
in_pos = 0;
|
||||
out_pos = 0;
|
||||
surrogate = FALSE;
|
||||
|
||||
if (items_written)
|
||||
*items_written = 0;
|
||||
utf8_len = utf16_to_utf8_len (str, len, items_read, error);
|
||||
if (error)
|
||||
if (*error)
|
||||
return NULL;
|
||||
if (utf8_len < 0)
|
||||
return NULL;
|
||||
|
||||
ret = g_malloc ((1+utf8_len) * sizeof (gchar));
|
||||
|
||||
while (len < 0 ? str [in_pos] : in_pos < len) {
|
||||
ch = str [in_pos];
|
||||
if (surrogate) {
|
||||
surrogate = 0;
|
||||
if (ch >= 0xDC00 && ch <= 0xDFFF)
|
||||
codepoint = 0x10000 + (ch - 0xDC00) + ((surrogate - 0xD800) << 10);
|
||||
else
|
||||
/* invalid surrogate pair */
|
||||
continue;
|
||||
} else {
|
||||
/* fast path optimization */
|
||||
if (ch < 0x80) {
|
||||
for (; len < 0 ? str [in_pos] : in_pos < len; in_pos++) {
|
||||
if (str [in_pos] < 0x80)
|
||||
ret [out_pos++] = str [in_pos];
|
||||
else
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (ch >= 0xD800 && ch <= 0xDBFF)
|
||||
surrogate = ch;
|
||||
else if (ch >= 0xDC00 && ch <= 0xDFFF) {
|
||||
/* invalid surrogate pair */
|
||||
continue;
|
||||
}
|
||||
else
|
||||
codepoint = ch;
|
||||
}
|
||||
in_pos++;
|
||||
|
||||
if (codepoint < 0x80)
|
||||
ret [out_pos++] = (gchar) codepoint;
|
||||
else if (codepoint < 0x0800) {
|
||||
ret [out_pos++] = (gchar) (0xC0 | (codepoint >> 6));
|
||||
ret [out_pos++] = (gchar) (0x80 | (codepoint & 0x3F));
|
||||
} else if (codepoint < 0x10000) {
|
||||
ret [out_pos++] = (gchar) (0xE0 | (codepoint >> 12));
|
||||
ret [out_pos++] = (gchar) (0x80 | ((codepoint >> 6) & 0x3F));
|
||||
ret [out_pos++] = (gchar) (0x80 | (codepoint & 0x3F));
|
||||
} else {
|
||||
ret [out_pos++] = (gchar) (0xF0 | (codepoint >> 18));
|
||||
ret [out_pos++] = (gchar) (0x80 | ((codepoint >> 12) & 0x3F));
|
||||
ret [out_pos++] = (gchar) (0x80 | ((codepoint >> 6) & 0x3F));
|
||||
ret [out_pos++] = (gchar) (0x80 | (codepoint & 0x3F));
|
||||
}
|
||||
}
|
||||
ret [out_pos] = 0;
|
||||
|
||||
if (items_written)
|
||||
*items_written = out_pos;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static glong
|
||||
utf16_to_utf8_len (const gunichar2 *str, glong len, glong *items_read, GError **error)
|
||||
{
|
||||
glong ret, in_pos;
|
||||
gunichar2 ch;
|
||||
gboolean surrogate;
|
||||
|
||||
ret = 0;
|
||||
in_pos = 0;
|
||||
surrogate = FALSE;
|
||||
|
||||
while (len < 0 ? str [in_pos] : in_pos < len) {
|
||||
ch = str [in_pos];
|
||||
if (surrogate) {
|
||||
if (ch >= 0xDC00 && ch <= 0xDFFF) {
|
||||
ret += 4;
|
||||
} else {
|
||||
/* invalid surrogate pair */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-16 sequence at %d (missing surrogate tail)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} /* otherwise just ignore. */
|
||||
}
|
||||
surrogate = FALSE;
|
||||
} else {
|
||||
/* fast path optimization */
|
||||
if (ch < 0x80) {
|
||||
for (; len < 0 ? str [in_pos] : in_pos < len; in_pos++) {
|
||||
if (str [in_pos] < 0x80)
|
||||
++ret;
|
||||
else
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (ch < 0x0800)
|
||||
ret += 2;
|
||||
else if (ch >= 0xD800 && ch <= 0xDBFF)
|
||||
surrogate = TRUE;
|
||||
else if (ch >= 0xDC00 && ch <= 0xDFFF) {
|
||||
/* invalid surrogate pair */
|
||||
if (error) {
|
||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "invalid utf-16 sequence at %d (missing surrogate head)", in_pos);
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return -1;
|
||||
} /* otherwise just ignore. */
|
||||
}
|
||||
else
|
||||
ret += 3;
|
||||
}
|
||||
in_pos++;
|
||||
}
|
||||
|
||||
if (items_read)
|
||||
*items_read = in_pos;
|
||||
return ret;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* sort.frag.h: Common implementation of linked-list sorting
|
||||
*
|
||||
* Author:
|
||||
* Raja R Harinath ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code requires a typedef named 'list_node' for the list node. It
|
||||
* is assumed that the list type is the type of a pointer to a list
|
||||
* node, and that the node has a field named 'next' that implements to
|
||||
* the linked list. No additional invariant is maintained (e.g. the
|
||||
* 'prev' pointer of a doubly-linked list node is _not_ updated). Any
|
||||
* invariant would require a post-processing pass to fix matters if
|
||||
* necessary.
|
||||
*
|
||||
* Note: We refer to a list fragment as a "digit" because the code for
|
||||
* maintaining the invariants of the core data structure parallels the
|
||||
* code for incrementing the binary representation of a number.
|
||||
*/
|
||||
typedef list_node *digit;
|
||||
|
||||
/*
|
||||
* The maximum possible depth of the merge tree
|
||||
* = ceiling (log2 (maximum number of list nodes))
|
||||
* = ceiling (log2 (maximum possible memory size/size of each list node))
|
||||
* = number of bits in 'size_t' - floor (log2 (sizeof digit))
|
||||
* Also, each "digit" is at least 2 nodes long: we can reduce the depth by 1
|
||||
*/
|
||||
|
||||
#define FLOOR_LOG2(x) (((x)>=2) + ((x)>=4) + ((x)>=8) + ((x)>=16) + ((x)>=32) + ((x)>=64) + ((x)>=128))
|
||||
#define MAX_DIGITS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1)
|
||||
|
||||
static inline digit
|
||||
add_digits (digit first, digit second, GCompareFunc func)
|
||||
{
|
||||
/* merge the two lists */
|
||||
digit list = NULL;
|
||||
digit *pos = &list;
|
||||
while (first && second) {
|
||||
if (func (first->data, second->data) > 0) {
|
||||
*pos = second;
|
||||
second = second->next;
|
||||
} else {
|
||||
*pos = first;
|
||||
first = first->next;
|
||||
}
|
||||
pos = &((*pos)->next);
|
||||
}
|
||||
*pos = first ? first : second;
|
||||
return list;
|
||||
}
|
||||
|
||||
static inline digit
|
||||
combine_digits (digit *digits, digit list, int n_digits, GCompareFunc func)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n_digits; ++i)
|
||||
list = add_digits (digits [i], list, func);
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given: length(list) == k
|
||||
* Invariant: digit[i] == NULL || length(digit[i]) == k * 2**i
|
||||
*/
|
||||
static inline int
|
||||
increment (digit *digits, digit list, int n_digits, GCompareFunc func)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n_digits && digits [i]; i++) {
|
||||
list = add_digits (digits [i], list, func);
|
||||
digits [i] = NULL;
|
||||
}
|
||||
if (i == MAX_DIGITS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */
|
||||
--i;
|
||||
|
||||
if (i == n_digits)
|
||||
++n_digits;
|
||||
digits [i] = list;
|
||||
return n_digits;
|
||||
}
|
||||
|
||||
/*
|
||||
* A mergesort that avoids recursion. The 'digits' array essentially
|
||||
* captures the recursion stack. The actual merge tree is built in a
|
||||
* bottom-up manner. It's "counting", since we "increment" a set of
|
||||
* "digit"s.
|
||||
*/
|
||||
static inline digit
|
||||
do_sort (digit list, GCompareFunc func)
|
||||
{
|
||||
int n_digits = 0;
|
||||
digit digits [MAX_DIGITS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */
|
||||
|
||||
while (list && list->next) {
|
||||
digit next = list->next;
|
||||
digit tail = next->next;
|
||||
|
||||
if (func (list->data, next->data) > 0) {
|
||||
next->next = list;
|
||||
next = list;
|
||||
list = list->next;
|
||||
}
|
||||
next->next = NULL;
|
||||
|
||||
n_digits = increment (digits, list, n_digits, func);
|
||||
|
||||
list = tail;
|
||||
}
|
||||
|
||||
return combine_digits (digits, list, n_digits, func);
|
||||
}
|
||||
|
||||
#undef MAX_DIGITS
|
||||
#undef FLOOR_LOG2
|
||||
@@ -1,47 +0,0 @@
|
||||
noinst_PROGRAMS = test-eglib test-glib
|
||||
|
||||
SOURCES = \
|
||||
test.c \
|
||||
test.h \
|
||||
tests.h \
|
||||
driver.c \
|
||||
hashtable.c \
|
||||
string-util.c \
|
||||
string.c \
|
||||
slist.c \
|
||||
sizes.c \
|
||||
ptrarray.c \
|
||||
list.c \
|
||||
array.c \
|
||||
fake.c \
|
||||
path.c \
|
||||
queue.c \
|
||||
shell.c \
|
||||
spawn.c \
|
||||
timer.c \
|
||||
file.c \
|
||||
pattern.c \
|
||||
dir.c \
|
||||
markup.c \
|
||||
utf8.c \
|
||||
endian.c
|
||||
|
||||
test_eglib_SOURCES = $(SOURCES)
|
||||
test_glib_SOURCES = $(SOURCES)
|
||||
|
||||
test_eglib_CFLAGS = -Wall -Werror -D_FORTIFY_SOURCE=2 -I$(srcdir)/../src -DDRIVER_NAME=\"EGlib\"
|
||||
test_eglib_LDADD = ../src/libeglib.la
|
||||
|
||||
test_glib_CFLAGS = `pkg-config --cflags glib-2.0` -DDRIVER_NAME=\"GLib\"
|
||||
test_glib_LDFLAGS = `pkg-config --libs glib-2.0`
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
run-glib: all
|
||||
./test-glib
|
||||
|
||||
run-eglib: all
|
||||
./test-eglib
|
||||
|
||||
run-both: run-glib run-eglib
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
EGlib Unit Testing
|
||||
===============================================================================
|
||||
|
||||
1. Writing new tests
|
||||
2. Using the test driver
|
||||
|
||||
===============================================================================
|
||||
1. Writing new tests
|
||||
===============================================================================
|
||||
|
||||
Tests are easy to write, but must be grouped in to logical cases. For instance,
|
||||
the GPtrArray group has a number of tests that cover the entire GPtrArray
|
||||
implementation.
|
||||
|
||||
These logical case groups should be in a single C file, and must have
|
||||
three elements:
|
||||
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
...
|
||||
<define test implementations>
|
||||
...
|
||||
|
||||
static Test groupname_tests [] = {
|
||||
{"groupname_test1", groupname_test1},
|
||||
{"groupname_test1", groupname_test2},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)
|
||||
|
||||
A test implementation should look like:
|
||||
|
||||
RESULT groupname_test1()
|
||||
{
|
||||
<perform the test>
|
||||
|
||||
if(test_failed) {
|
||||
return FAILED("reason: %s", "this works like printf");
|
||||
}
|
||||
|
||||
return OK; /* just NULL, but OK is cute */
|
||||
}
|
||||
|
||||
Once a test group is written, it needs to be added to the groups table
|
||||
in tests.h:
|
||||
|
||||
DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl
|
||||
|
||||
static Group test_groups [] = {
|
||||
...
|
||||
{"groupname", groupname_tests_init}
|
||||
...
|
||||
};
|
||||
|
||||
===============================================================================
|
||||
2. Using the test driver
|
||||
===============================================================================
|
||||
|
||||
When tests are written, they are rebuilt with make. Two programs will be
|
||||
built:
|
||||
|
||||
test-eglib: the test driver and tests linked against eglib
|
||||
test-glib: the test driver and tests linked against system glib-2.0
|
||||
|
||||
Each driver program works exactly the same. Running test-eglib will run
|
||||
the tests against eglib, and test-glib against glib-2.0.
|
||||
|
||||
The test driver supports a few options to allow for performance measuring:
|
||||
|
||||
--help show all options and available test groups
|
||||
--time time the overall run and report it, even if --quiet is set
|
||||
--quiet do not print test results, useful for timing
|
||||
--iterations N run all or specified test groups N times
|
||||
|
||||
Run "test-eglib --help" for more details.
|
||||
|
||||
Example: run the ptrarray test group 100000 times and only print the time
|
||||
it took to perform all iterations
|
||||
|
||||
./test-eglib -tqi 100000 ptrarray
|
||||
|
||||
Example: show single iteration of test output for two groups
|
||||
|
||||
./test-eglib ptrarray hashtable
|
||||
|
||||
Example: show test output of all available groups
|
||||
|
||||
./test-eglib
|
||||
|
||||
The 'test-both' script can be used to run both test-eglib and test-glib
|
||||
with the same options back to back:
|
||||
|
||||
$ ./test-both -tqi 100000 ptrarray
|
||||
EGlib Total Time: 1.1961s
|
||||
GLib Total Time: 0.955957s
|
||||
|
||||
test-both also has a nice --speed-compare mode that shows comparison
|
||||
information about EGlib vs GLib. It can run all tests or specific tests
|
||||
with a configurable number of iterations. --speed-compare mode always runs
|
||||
the drivers with -qtni
|
||||
|
||||
The syntax for --speed-compare is:
|
||||
|
||||
./test-both --speed-compare [ITERATIONS] [GROUPS...]
|
||||
|
||||
$ ./test-both --speed-compare Runs all tests with default iterations
|
||||
$ ./test-both --speed-compare 500 Runs all tests with 500 iterations
|
||||
$ ./test-both --speed-compare ptrarray Runs ptrarray test with default
|
||||
iterations
|
||||
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
/* example from glib documentation */
|
||||
RESULT
|
||||
test_array_big ()
|
||||
{
|
||||
GArray *garray;
|
||||
gint i;
|
||||
|
||||
/* We create a new array to store gint values.
|
||||
We don't want it zero-terminated or cleared to 0's. */
|
||||
garray = g_array_new (FALSE, FALSE, sizeof (gint));
|
||||
for (i = 0; i < 10000; i++)
|
||||
g_array_append_val (garray, i);
|
||||
|
||||
for (i = 0; i < 10000; i++)
|
||||
if (g_array_index (garray, gint, i) != i)
|
||||
return FAILED ("array value didn't match");
|
||||
|
||||
g_array_free (garray, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_array_index ()
|
||||
{
|
||||
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
int v;
|
||||
|
||||
v = 27;
|
||||
g_array_append_val (array, v);
|
||||
|
||||
if (27 != g_array_index (array, int, 0))
|
||||
return FAILED ("");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_array_append_zero_terminated ()
|
||||
{
|
||||
GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
|
||||
int v;
|
||||
|
||||
v = 27;
|
||||
g_array_append_val (array, v);
|
||||
|
||||
if (27 != g_array_index (array, int, 0))
|
||||
return FAILED ("g_array_append_val failed");
|
||||
|
||||
if (0 != g_array_index (array, int, 1))
|
||||
return FAILED ("zero_terminated didn't append a zero element");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_array_append ()
|
||||
{
|
||||
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
int v;
|
||||
|
||||
if (0 != array->len)
|
||||
return FAILED ("initial array length not zero");
|
||||
|
||||
v = 27;
|
||||
|
||||
g_array_append_val (array, v);
|
||||
|
||||
if (1 != array->len)
|
||||
return FAILED ("array append failed");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_array_insert_val ()
|
||||
{
|
||||
GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
|
||||
gpointer ptr0, ptr1, ptr2, ptr3;
|
||||
|
||||
g_array_insert_val (array, 0, array);
|
||||
|
||||
if (array != g_array_index (array, gpointer, 0))
|
||||
return FAILED ("1 The value in the array is incorrect");
|
||||
|
||||
g_array_insert_val (array, 1, array);
|
||||
if (array != g_array_index (array, gpointer, 1))
|
||||
return FAILED ("2 The value in the array is incorrect");
|
||||
|
||||
g_array_insert_val (array, 2, array);
|
||||
if (array != g_array_index (array, gpointer, 2))
|
||||
return FAILED ("3 The value in the array is incorrect");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
array = g_array_new (FALSE, FALSE, sizeof (gpointer));
|
||||
ptr0 = array;
|
||||
ptr1 = array + 1;
|
||||
ptr2 = array + 2;
|
||||
ptr3 = array + 3;
|
||||
|
||||
g_array_insert_val (array, 0, ptr0);
|
||||
g_array_insert_val (array, 1, ptr1);
|
||||
g_array_insert_val (array, 2, ptr2);
|
||||
g_array_insert_val (array, 1, ptr3);
|
||||
if (ptr0 != g_array_index (array, gpointer, 0))
|
||||
return FAILED ("4 The value in the array is incorrect");
|
||||
if (ptr3 != g_array_index (array, gpointer, 1))
|
||||
return FAILED ("5 The value in the array is incorrect");
|
||||
if (ptr1 != g_array_index (array, gpointer, 2))
|
||||
return FAILED ("6 The value in the array is incorrect");
|
||||
if (ptr2 != g_array_index (array, gpointer, 3))
|
||||
return FAILED ("7 The value in the array is incorrect");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_array_remove ()
|
||||
{
|
||||
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
int v[] = {30, 29, 28, 27, 26, 25};
|
||||
|
||||
g_array_append_vals (array, v, 6);
|
||||
|
||||
if (6 != array->len)
|
||||
return FAILED ("append_vals fail");
|
||||
|
||||
g_array_remove_index (array, 3);
|
||||
|
||||
if (5 != array->len)
|
||||
return FAILED ("remove_index failed to update length");
|
||||
|
||||
if (26 != g_array_index (array, int, 3))
|
||||
return FAILED ("remove_index failed to update the array");
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Test array_tests [] = {
|
||||
{"big", test_array_big},
|
||||
{"append", test_array_append},
|
||||
{"insert_val", test_array_insert_val},
|
||||
{"index", test_array_index},
|
||||
{"remove", test_array_remove},
|
||||
{"append_zero_term", test_array_append_zero_terminated},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
|
||||
@@ -1,60 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "test.h"
|
||||
|
||||
/* This test is just to be used with valgrind */
|
||||
RESULT
|
||||
test_dir ()
|
||||
{
|
||||
GDir *dir;
|
||||
GError *error;
|
||||
const gchar *name;
|
||||
|
||||
/*
|
||||
dir = g_dir_open (NULL, 0, NULL);
|
||||
*/
|
||||
dir = g_dir_open ("", 0, NULL);
|
||||
if (dir != NULL)
|
||||
return FAILED ("1 Should be an error");
|
||||
|
||||
dir = g_dir_open ("", 9, NULL);
|
||||
if (dir != NULL)
|
||||
return FAILED ("2 Should be an error");
|
||||
|
||||
error = NULL;
|
||||
dir = g_dir_open (".ljasdslakjd", 9, &error);
|
||||
if (dir != NULL)
|
||||
return FAILED ("3 opendir should fail");
|
||||
if (error == NULL)
|
||||
return FAILED ("4 got no error");
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
dir = g_dir_open (g_get_tmp_dir (), 9, &error);
|
||||
if (dir == NULL)
|
||||
return FAILED ("5 opendir should succeed");
|
||||
if (error != NULL)
|
||||
return FAILED ("6 got an error");
|
||||
name = NULL;
|
||||
name = g_dir_read_name (dir);
|
||||
if (name == NULL)
|
||||
return FAILED ("7 didn't read a file name");
|
||||
while ((name = g_dir_read_name (dir)) != NULL) {
|
||||
if (strcmp (name, ".") == 0)
|
||||
return FAILED (". directory found");
|
||||
if (strcmp (name, "..") == 0)
|
||||
return FAILED (".. directory found");
|
||||
}
|
||||
g_dir_close (dir);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test dir_tests [] = {
|
||||
{"g_dir_*", test_dir},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(dir_tests_init, dir_tests)
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* EGLib Unit Test Driver
|
||||
*
|
||||
* Author:
|
||||
* Aaron Bockover ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "test.h"
|
||||
#include "tests.h"
|
||||
|
||||
typedef struct _StringArray {
|
||||
gchar **strings;
|
||||
gint length;
|
||||
} StringArray;
|
||||
|
||||
static StringArray *
|
||||
string_array_append(StringArray *array, gchar *string)
|
||||
{
|
||||
if(array == NULL) {
|
||||
array = g_new0(StringArray, 1);
|
||||
array->length = 1;
|
||||
array->strings = g_malloc(sizeof(gchar *) * 2);
|
||||
} else {
|
||||
array->length++;
|
||||
array->strings = g_realloc(array->strings, sizeof(gchar *)
|
||||
* (array->length + 1));
|
||||
}
|
||||
|
||||
array->strings[array->length - 1] = string;
|
||||
array->strings[array->length] = NULL;
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static void
|
||||
string_array_free(StringArray *array)
|
||||
{
|
||||
g_free(array->strings);
|
||||
g_free(array);
|
||||
}
|
||||
|
||||
static void print_help(char *s)
|
||||
{
|
||||
gint i;
|
||||
|
||||
printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
|
||||
printf("OPTIONS are:\n");
|
||||
printf(" -h, --help show this help\n");
|
||||
printf(" -t, --time time the tests\n");
|
||||
printf(" -i, --iterations number of times to run tests\n");
|
||||
printf(" -q, --quiet do not print test results; "
|
||||
"final time always prints\n");
|
||||
printf(" -n, --no-labels print final time without labels, "
|
||||
"nice for scripts\n");
|
||||
printf(" -d, --debug do not run tests, "
|
||||
"debug the driver itself for valgrind\n\n");
|
||||
printf("TESTGROUPS available:\n");
|
||||
|
||||
for(i = 0; test_groups[i].name != NULL; i++) {
|
||||
if(test_groups[i].handler != fake_tests_init) {
|
||||
printf(" %s\n", test_groups[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
gint main(gint argc, gchar **argv)
|
||||
{
|
||||
gint i, j, c, iterations = 1;
|
||||
StringArray *tests_to_run = NULL;
|
||||
gdouble time_start;
|
||||
gboolean report_time = FALSE;
|
||||
gboolean quiet = FALSE;
|
||||
gboolean global_failure = FALSE;
|
||||
gboolean no_final_time_labels = FALSE;
|
||||
gboolean debug = FALSE;
|
||||
|
||||
static struct option long_options [] = {
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"time", no_argument, 0, 't'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"iterations", required_argument, 0, 'i'},
|
||||
{"debug", no_argument, 0, 'd'},
|
||||
{"no-labels", no_argument, 0, 'n'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) { switch(c) {
|
||||
case 'h':
|
||||
print_help(argv[0]);
|
||||
return 1;
|
||||
case 't':
|
||||
report_time = TRUE;
|
||||
break;
|
||||
case 'i':
|
||||
iterations = atoi(optarg);
|
||||
break;
|
||||
case 'q':
|
||||
quiet = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
no_final_time_labels = TRUE;
|
||||
break;
|
||||
case 'd':
|
||||
debug = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = optind; i < argc; i++) {
|
||||
if(argv[i][0] == '-') {
|
||||
continue;
|
||||
}
|
||||
|
||||
tests_to_run = string_array_append(tests_to_run, argv[i]);
|
||||
}
|
||||
|
||||
time_start = get_timestamp();
|
||||
|
||||
for(j = 0; test_groups[j].name != NULL; j++) {
|
||||
gboolean run = TRUE;
|
||||
gchar *tests = NULL;
|
||||
gchar *group = NULL;
|
||||
|
||||
if(tests_to_run != NULL) {
|
||||
gint k;
|
||||
run = FALSE;
|
||||
|
||||
for(k = 0; k < tests_to_run->length; k++) {
|
||||
gchar *user = tests_to_run->strings[k];
|
||||
const gchar *table = test_groups[j].name;
|
||||
gint user_len = strlen(user);
|
||||
gint table_len = strlen(table);
|
||||
|
||||
if(strncmp(user, table, table_len) == 0) {
|
||||
if(user_len > table_len && user[table_len] != ':') {
|
||||
break;
|
||||
}
|
||||
|
||||
run = TRUE;
|
||||
group = tests_to_run->strings[k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(run) {
|
||||
gchar **split = NULL;
|
||||
|
||||
if(debug && test_groups[j].handler != fake_tests_init) {
|
||||
printf("Skipping %s, in driver debug mode\n",
|
||||
test_groups[j].name);
|
||||
continue;
|
||||
} else if(!debug && test_groups[j].handler == fake_tests_init) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(group != NULL) {
|
||||
split = eg_strsplit(group, ":", -1);
|
||||
if(split != NULL) {
|
||||
gint m;
|
||||
for(m = 0; split[m] != NULL; m++) {
|
||||
if(m == 1) {
|
||||
tests = strdup(split[m]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
eg_strfreev(split);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean passed = run_group(&(test_groups[j]),
|
||||
iterations, quiet, report_time, tests);
|
||||
|
||||
if(tests != NULL) {
|
||||
g_free(tests);
|
||||
}
|
||||
|
||||
if(!passed && !global_failure) {
|
||||
global_failure = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!quiet) {
|
||||
printf("=============================\n");
|
||||
printf("Overall result: %s\n", global_failure ? "FAILED" : "OK");
|
||||
}
|
||||
|
||||
if(report_time) {
|
||||
gdouble duration = get_timestamp() - time_start;
|
||||
if(no_final_time_labels) {
|
||||
printf("%g\n", duration);
|
||||
} else {
|
||||
printf("%s Total Time: %g\n", DRIVER_NAME, duration);
|
||||
}
|
||||
}
|
||||
|
||||
if(tests_to_run != NULL) {
|
||||
string_array_free(tests_to_run);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_swap ()
|
||||
{
|
||||
guint32 a = 0xabcdef01, res32;
|
||||
guint64 b = (((guint64)a) << 32) | a, res64;
|
||||
guint64 b_expect = (((guint64)0x1efcdab) << 32) | 0x01efcdab;
|
||||
guint16 c = 0xabcd, res16;
|
||||
|
||||
res32 = GUINT32_SWAP_LE_BE (a);
|
||||
if (res32 != 0x01efcdab)
|
||||
return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
|
||||
res32 = GUINT32_SWAP_LE_BE (1);
|
||||
if (res32 != 0x1000000)
|
||||
return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
|
||||
|
||||
res64 = GUINT64_SWAP_LE_BE(b);
|
||||
if (res64 != b_expect)
|
||||
return FAILED ("GUINT64_SWAP_LE_BE returned 0x%llx (had=0x%llx)", res64, b);
|
||||
res16 = GUINT16_SWAP_LE_BE(c);
|
||||
if (res16 != 0xcdab)
|
||||
return FAILED ("GUINT16_SWAP_LE_BE returned 0x%x", (guint32) res16);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* test initialization
|
||||
*/
|
||||
|
||||
static Test endian_tests [] = {
|
||||
{"swap", test_swap},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(endian_tests_init, endian_tests)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Fake test allows debugging of the driver itself
|
||||
*/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_fake()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test fake_tests [] = {
|
||||
{"fake", test_fake},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(fake_tests_init, fake_tests)
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_file_get_contents ()
|
||||
{
|
||||
GError *error;
|
||||
gchar *content;
|
||||
gboolean ret;
|
||||
gsize length;
|
||||
|
||||
/*
|
||||
filename != NULL
|
||||
ret = g_file_get_contents (NULL, NULL, NULL, NULL);
|
||||
contents != NULL
|
||||
ret = g_file_get_contents ("", NULL, NULL, NULL);
|
||||
error no such file and fails for 'error' not being null too
|
||||
ret = g_file_get_contents ("", &content, NULL, &error);
|
||||
*/
|
||||
|
||||
error = NULL;
|
||||
ret = g_file_get_contents ("", &content, NULL, &error);
|
||||
if (ret)
|
||||
return FAILED ("HAH!");
|
||||
if (error == NULL)
|
||||
return FAILED ("Got nothing as error.");
|
||||
if (content != NULL)
|
||||
return FAILED ("Content is uninitialized");
|
||||
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
ret = g_file_get_contents ("/etc/hosts", &content, &length, &error);
|
||||
if (!ret)
|
||||
return FAILED ("The error is %d %s\n", error->code, error->message);
|
||||
if (error != NULL)
|
||||
return FAILED ("Got an error returning TRUE");
|
||||
if (content == NULL)
|
||||
return FAILED ("Content is NULL");
|
||||
if (strlen (content) != length)
|
||||
return FAILED ("length is %d but the string is %d", length, strlen (content));
|
||||
g_free (content);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_open_tmp ()
|
||||
{
|
||||
GError *error;
|
||||
gint fd;
|
||||
gchar *name = GINT_TO_POINTER (-1);
|
||||
|
||||
/*
|
||||
* Okay, this works, but creates a .xxx file in /tmp on every run. Disabled.
|
||||
* fd = g_file_open_tmp (NULL, NULL, NULL);
|
||||
* if (fd < 0)
|
||||
* return FAILED ("Default failed.");
|
||||
* close (fd);
|
||||
*/
|
||||
error = NULL;
|
||||
fd = g_file_open_tmp ("invalidtemplate", NULL, &error);
|
||||
if (fd != -1)
|
||||
return FAILED ("The template was invalid and accepted");
|
||||
if (error == NULL)
|
||||
return FAILED ("No error returned.");
|
||||
g_error_free (error);
|
||||
|
||||
error = NULL;
|
||||
fd = g_file_open_tmp ("i/nvalidtemplate", &name, &error);
|
||||
if (fd != -1)
|
||||
return FAILED ("The template was invalid and accepted");
|
||||
if (error == NULL)
|
||||
return FAILED ("No error returned.");
|
||||
if (name == NULL)
|
||||
return FAILED ("'name' is not reset");
|
||||
g_error_free (error);
|
||||
|
||||
error = NULL;
|
||||
fd = g_file_open_tmp ("valid-XXXXXX", &name, &error);
|
||||
if (fd == -1)
|
||||
return FAILED ("This should be valid");
|
||||
if (error != NULL)
|
||||
return FAILED ("No error returned.");
|
||||
if (name == NULL)
|
||||
return FAILED ("No name returned.");
|
||||
close (fd);
|
||||
unlink (name);
|
||||
g_free (name);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_file ()
|
||||
{
|
||||
gboolean res;
|
||||
const gchar *tmp;
|
||||
gchar *path, *sympath;
|
||||
gint ignored;
|
||||
|
||||
res = g_file_test (NULL, 0);
|
||||
if (res)
|
||||
return FAILED ("Should return FALSE HERE");
|
||||
|
||||
res = g_file_test ("file.c", 0);
|
||||
if (res)
|
||||
return FAILED ("Should return FALSE HERE");
|
||||
|
||||
tmp = g_get_tmp_dir ();
|
||||
res = g_file_test (tmp, G_FILE_TEST_EXISTS);
|
||||
if (!res)
|
||||
return FAILED ("tmp does not exist.");
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR);
|
||||
if (res)
|
||||
return FAILED ("tmp is regular");
|
||||
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_DIR);
|
||||
if (!res)
|
||||
return FAILED ("tmp is not a directory");
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE);
|
||||
if (!res)
|
||||
return FAILED ("tmp is not a executable");
|
||||
|
||||
res = g_file_test (tmp, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK);
|
||||
if (!res)
|
||||
return FAILED ("2 tmp does not exist.");
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
|
||||
if (res)
|
||||
return FAILED ("2 tmp is regular");
|
||||
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_SYMLINK);
|
||||
if (!res)
|
||||
return FAILED ("2 tmp is not a directory");
|
||||
res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_SYMLINK);
|
||||
if (!res)
|
||||
return FAILED ("2 tmp is not a executable");
|
||||
|
||||
close (g_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
|
||||
res = g_file_test (path, G_FILE_TEST_EXISTS);
|
||||
if (!res)
|
||||
return FAILED ("3 %s should exist", path);
|
||||
res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
|
||||
/* This is strange. Empty file is reported as not existing! */
|
||||
if (!res)
|
||||
return FAILED ("3 %s IS_REGULAR", path);
|
||||
res = g_file_test (path, G_FILE_TEST_IS_DIR);
|
||||
if (res)
|
||||
return FAILED ("3 %s should not be a directory", path);
|
||||
res = g_file_test (path, G_FILE_TEST_IS_EXECUTABLE);
|
||||
if (res)
|
||||
return FAILED ("3 %s should not be executable", path);
|
||||
res = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
|
||||
if (res)
|
||||
return FAILED ("3 %s should not be a symlink", path);
|
||||
|
||||
sympath = g_strconcat (path, "-link", NULL);
|
||||
ignored = symlink (path, sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_EXISTS);
|
||||
if (!res)
|
||||
return FAILED ("4 %s should not exist", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
|
||||
if (!res)
|
||||
return FAILED ("4 %s should not be a regular file", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
|
||||
if (res)
|
||||
return FAILED ("4 %s should not be a directory", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
|
||||
if (res)
|
||||
return FAILED ("4 %s should not be executable", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
|
||||
if (!res)
|
||||
return FAILED ("4 %s should be a symlink", sympath);
|
||||
|
||||
unlink (path);
|
||||
|
||||
res = g_file_test (sympath, G_FILE_TEST_EXISTS);
|
||||
if (res)
|
||||
return FAILED ("5 %s should exist", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
|
||||
if (res)
|
||||
return FAILED ("5 %s should be a regular file", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
|
||||
if (res)
|
||||
return FAILED ("5 %s should not be a directory", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
|
||||
if (res)
|
||||
return FAILED ("5 %s should not be executable", sympath);
|
||||
res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
|
||||
if (!res)
|
||||
return FAILED ("5 %s should be a symlink", sympath);
|
||||
unlink (sympath);
|
||||
g_free (path);
|
||||
g_free (sympath);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test file_tests [] = {
|
||||
{"g_file_get_contents", test_file_get_contents},
|
||||
{"g_file_open_tmp", test_open_tmp},
|
||||
{"g_file_test", test_file},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(file_tests_init, file_tests)
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
int foreach_count = 0;
|
||||
int foreach_fail = 0;
|
||||
|
||||
void foreach (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
foreach_count++;
|
||||
if (GPOINTER_TO_INT (user_data) != 'a')
|
||||
foreach_fail = 1;
|
||||
}
|
||||
|
||||
RESULT hash_t1 (void)
|
||||
{
|
||||
GHashTable *t = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
foreach_count = 0;
|
||||
foreach_fail = 0;
|
||||
g_hash_table_insert (t, "hello", "world");
|
||||
g_hash_table_insert (t, "my", "god");
|
||||
|
||||
g_hash_table_foreach (t, foreach, GINT_TO_POINTER('a'));
|
||||
if (foreach_count != 2)
|
||||
return FAILED ("did not find all keys, got %d expected 2", foreach_count);
|
||||
if (foreach_fail)
|
||||
return FAILED("failed to pass the user-data to foreach");
|
||||
|
||||
if (!g_hash_table_remove (t, "my"))
|
||||
return FAILED ("did not find known key");
|
||||
if (g_hash_table_size (t) != 1)
|
||||
return FAILED ("unexpected size");
|
||||
g_hash_table_insert(t, "hello", "moon");
|
||||
if (strcmp (g_hash_table_lookup (t, "hello"), "moon") != 0)
|
||||
return FAILED ("did not replace world with moon");
|
||||
|
||||
if (!g_hash_table_remove (t, "hello"))
|
||||
return FAILED ("did not find known key");
|
||||
if (g_hash_table_size (t) != 0)
|
||||
return FAILED ("unexpected size");
|
||||
g_hash_table_destroy (t);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT hash_t2 (void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT hash_default (void)
|
||||
{
|
||||
GHashTable *hash = g_hash_table_new (NULL, NULL);
|
||||
|
||||
if (hash == NULL)
|
||||
return FAILED ("g_hash_table_new should return a valid hash");
|
||||
|
||||
g_hash_table_destroy (hash);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
hash_null_lookup (void)
|
||||
{
|
||||
GHashTable *hash = g_hash_table_new (NULL, NULL);
|
||||
gpointer ok, ov;
|
||||
|
||||
g_hash_table_insert (hash, NULL, GINT_TO_POINTER (1));
|
||||
g_hash_table_insert (hash, GINT_TO_POINTER(1), GINT_TO_POINTER(2));
|
||||
|
||||
if (!g_hash_table_lookup_extended (hash, NULL, &ok, &ov))
|
||||
return FAILED ("Did not find the NULL");
|
||||
if (ok != NULL)
|
||||
return FAILED ("Incorrect key found");
|
||||
if (ov != GINT_TO_POINTER (1))
|
||||
return FAILED ("Got wrong value %p\n", ov);
|
||||
|
||||
if (!g_hash_table_lookup_extended (hash, GINT_TO_POINTER(1), &ok, &ov))
|
||||
return FAILED ("Did not find the 1");
|
||||
if (ok != GINT_TO_POINTER(1))
|
||||
return FAILED ("Incorrect key found");
|
||||
if (ov != GINT_TO_POINTER (2))
|
||||
return FAILED ("Got wrong value %p\n", ov);
|
||||
|
||||
g_hash_table_destroy (hash);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
counter (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
int *counter = (int *) user_data;
|
||||
|
||||
(*counter)++;
|
||||
}
|
||||
|
||||
RESULT hash_grow (void)
|
||||
{
|
||||
GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
int i, count = 0;
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
g_hash_table_insert (hash, g_strdup_printf ("%d", i), g_strdup_printf ("x-%d", i));
|
||||
|
||||
for (i = 0; i < 1000; i++){
|
||||
char buffer [30];
|
||||
gpointer value;
|
||||
|
||||
sprintf (buffer, "%d", i);
|
||||
|
||||
value = g_hash_table_lookup (hash, buffer);
|
||||
sprintf (buffer, "x-%d", i);
|
||||
if (strcmp (value, buffer) != 0){
|
||||
return FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_hash_table_size (hash) != 1000)
|
||||
return FAILED ("Did not find 1000 elements on the hash, found %d\n", g_hash_table_size (hash));
|
||||
|
||||
/* Now do the manual count, lets not trust the internals */
|
||||
g_hash_table_foreach (hash, counter, &count);
|
||||
if (count != 1000){
|
||||
return FAILED ("Foreach count is not 1000");
|
||||
}
|
||||
|
||||
g_hash_table_destroy (hash);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Test hashtable_tests [] = {
|
||||
{"t1", hash_t1},
|
||||
{"t2", hash_t2},
|
||||
{"grow", hash_grow},
|
||||
{"default", hash_default},
|
||||
{"null_lookup", hash_null_lookup},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(hashtable_tests_init, hashtable_tests)
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_list_length ()
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, "foo");
|
||||
|
||||
if (g_list_length (list) != 1)
|
||||
return FAILED ("length failed. #1");
|
||||
|
||||
list = g_list_prepend (list, "bar");
|
||||
if (g_list_length (list) != 2)
|
||||
return FAILED ("length failed. #2");
|
||||
|
||||
list = g_list_append (list, "bar");
|
||||
if (g_list_length (list) != 3)
|
||||
return FAILED ("length failed. #3");
|
||||
|
||||
g_list_free (list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_nth ()
|
||||
{
|
||||
char *foo = "foo";
|
||||
char *bar = "bar";
|
||||
char *baz = "baz";
|
||||
GList *nth, *list;
|
||||
list = g_list_prepend (NULL, baz);
|
||||
list = g_list_prepend (list, bar);
|
||||
list = g_list_prepend (list, foo);
|
||||
|
||||
nth = g_list_nth (list, 0);
|
||||
if (nth->data != foo)
|
||||
return FAILED ("nth failed. #0");
|
||||
|
||||
nth = g_list_nth (list, 1);
|
||||
if (nth->data != bar)
|
||||
return FAILED ("nth failed. #1");
|
||||
|
||||
nth = g_list_nth (list, 2);
|
||||
if (nth->data != baz)
|
||||
return FAILED ("nth failed. #2");
|
||||
|
||||
nth = g_list_nth (list, 3);
|
||||
if (nth)
|
||||
return FAILED ("nth failed. #3: %s", nth->data);
|
||||
|
||||
g_list_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_index ()
|
||||
{
|
||||
int i;
|
||||
char *foo = "foo";
|
||||
char *bar = "bar";
|
||||
char *baz = "baz";
|
||||
GList *list;
|
||||
list = g_list_prepend (NULL, baz);
|
||||
list = g_list_prepend (list, bar);
|
||||
list = g_list_prepend (list, foo);
|
||||
|
||||
i = g_list_index (list, foo);
|
||||
if (i != 0)
|
||||
return FAILED ("index failed. #0: %d", i);
|
||||
|
||||
i = g_list_index (list, bar);
|
||||
if (i != 1)
|
||||
return FAILED ("index failed. #1: %d", i);
|
||||
|
||||
i = g_list_index (list, baz);
|
||||
if (i != 2)
|
||||
return FAILED ("index failed. #2: %d", i);
|
||||
|
||||
g_list_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_append ()
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, "first");
|
||||
if (g_list_length (list) != 1)
|
||||
return FAILED ("Prepend failed");
|
||||
|
||||
list = g_list_append (list, "second");
|
||||
|
||||
if (g_list_length (list) != 2)
|
||||
return FAILED ("Append failed");
|
||||
|
||||
g_list_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_last ()
|
||||
{
|
||||
GList *foo = g_list_prepend (NULL, "foo");
|
||||
GList *bar = g_list_prepend (NULL, "bar");
|
||||
GList *last;
|
||||
|
||||
foo = g_list_concat (foo, bar);
|
||||
last = g_list_last (foo);
|
||||
|
||||
if (last != bar)
|
||||
return FAILED ("last failed. #1");
|
||||
|
||||
foo = g_list_concat (foo, g_list_prepend (NULL, "baz"));
|
||||
foo = g_list_concat (foo, g_list_prepend (NULL, "quux"));
|
||||
|
||||
last = g_list_last (foo);
|
||||
if (strcmp ("quux", last->data))
|
||||
return FAILED ("last failed. #2");
|
||||
|
||||
g_list_free (foo);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_concat ()
|
||||
{
|
||||
GList *foo = g_list_prepend (NULL, "foo");
|
||||
GList *bar = g_list_prepend (NULL, "bar");
|
||||
GList *list = g_list_concat (foo, bar);
|
||||
|
||||
if (g_list_length (list) != 2)
|
||||
return FAILED ("Concat failed. #1");
|
||||
|
||||
if (strcmp (list->data, "foo"))
|
||||
return FAILED ("Concat failed. #2");
|
||||
|
||||
if (strcmp (list->next->data, "bar"))
|
||||
return FAILED ("Concat failed. #3");
|
||||
|
||||
if (g_list_first (list) != foo)
|
||||
return FAILED ("Concat failed. #4");
|
||||
|
||||
if (g_list_last (list) != bar)
|
||||
return FAILED ("Concat failed. #5");
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
compare (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
char *foo = (char *) a;
|
||||
char *bar = (char *) b;
|
||||
|
||||
if (strlen (foo) < strlen (bar))
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_insert_sorted ()
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, "a");
|
||||
list = g_list_append (list, "aaa");
|
||||
|
||||
/* insert at the middle */
|
||||
list = g_list_insert_sorted (list, "aa", compare);
|
||||
if (strcmp ("aa", list->next->data))
|
||||
return FAILED ("insert_sorted failed. #1");
|
||||
|
||||
/* insert at the beginning */
|
||||
list = g_list_insert_sorted (list, "", compare);
|
||||
if (strcmp ("", list->data))
|
||||
return FAILED ("insert_sorted failed. #2");
|
||||
|
||||
/* insert at the end */
|
||||
list = g_list_insert_sorted (list, "aaaa", compare);
|
||||
if (strcmp ("aaaa", g_list_last (list)->data))
|
||||
return FAILED ("insert_sorted failed. #3");
|
||||
|
||||
g_list_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_copy ()
|
||||
{
|
||||
int i, length;
|
||||
GList *list, *copy;
|
||||
list = g_list_prepend (NULL, "a");
|
||||
list = g_list_append (list, "aa");
|
||||
list = g_list_append (list, "aaa");
|
||||
list = g_list_append (list, "aaaa");
|
||||
|
||||
length = g_list_length (list);
|
||||
copy = g_list_copy (list);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
if (strcmp (g_list_nth (list, i)->data,
|
||||
g_list_nth (copy, i)->data))
|
||||
return FAILED ("copy failed.");
|
||||
|
||||
g_list_free (list);
|
||||
g_list_free (copy);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_reverse ()
|
||||
{
|
||||
guint i, length;
|
||||
GList *list, *reverse;
|
||||
list = g_list_prepend (NULL, "a");
|
||||
list = g_list_append (list, "aa");
|
||||
list = g_list_append (list, "aaa");
|
||||
list = g_list_append (list, "aaaa");
|
||||
|
||||
length = g_list_length (list);
|
||||
reverse = g_list_reverse (g_list_copy (list));
|
||||
|
||||
if (g_list_length (reverse) != length)
|
||||
return FAILED ("reverse failed #1");
|
||||
|
||||
for (i = 0; i < length; i++){
|
||||
guint j = length - i - 1;
|
||||
if (strcmp (g_list_nth (list, i)->data,
|
||||
g_list_nth (reverse, j)->data))
|
||||
return FAILED ("reverse failed. #2");
|
||||
}
|
||||
|
||||
g_list_free (list);
|
||||
g_list_free (reverse);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_remove ()
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, "three");
|
||||
char *one = "one";
|
||||
list = g_list_prepend (list, "two");
|
||||
list = g_list_prepend (list, one);
|
||||
|
||||
list = g_list_remove (list, one);
|
||||
|
||||
if (g_list_length (list) != 2)
|
||||
return FAILED ("Remove failed");
|
||||
|
||||
if (strcmp ("two", list->data) != 0)
|
||||
return FAILED ("Remove failed");
|
||||
|
||||
g_list_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_remove_link ()
|
||||
{
|
||||
GList *foo = g_list_prepend (NULL, "a");
|
||||
GList *bar = g_list_prepend (NULL, "b");
|
||||
GList *baz = g_list_prepend (NULL, "c");
|
||||
GList *list = foo;
|
||||
|
||||
foo = g_list_concat (foo, bar);
|
||||
foo = g_list_concat (foo, baz);
|
||||
|
||||
list = g_list_remove_link (list, bar);
|
||||
|
||||
if (g_list_length (list) != 2)
|
||||
return FAILED ("remove_link failed #1");
|
||||
|
||||
if (bar->next != NULL)
|
||||
return FAILED ("remove_link failed #2");
|
||||
|
||||
g_list_free (list);
|
||||
g_list_free (bar);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_insert_before ()
|
||||
{
|
||||
GList *foo, *bar, *baz;
|
||||
|
||||
foo = g_list_prepend (NULL, "foo");
|
||||
foo = g_list_insert_before (foo, NULL, "bar");
|
||||
bar = g_list_last (foo);
|
||||
|
||||
if (strcmp (bar->data, "bar"))
|
||||
return FAILED ("1");
|
||||
|
||||
baz = g_list_insert_before (foo, bar, "baz");
|
||||
if (foo != baz)
|
||||
return FAILED ("2");
|
||||
|
||||
if (strcmp (g_list_nth_data (foo, 1), "baz"))
|
||||
return FAILED ("3: %s", g_list_nth_data (foo, 1));
|
||||
|
||||
g_list_free (foo);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#define N_ELEMS 101
|
||||
|
||||
static int intcompare (gconstpointer p1, gconstpointer p2)
|
||||
{
|
||||
return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
|
||||
}
|
||||
|
||||
static gboolean verify_sort (GList *list, int len)
|
||||
{
|
||||
if (list->prev)
|
||||
return FALSE;
|
||||
|
||||
int prev = GPOINTER_TO_INT (list->data);
|
||||
len--;
|
||||
for (list = list->next; list; list = list->next) {
|
||||
int curr = GPOINTER_TO_INT (list->data);
|
||||
if (prev > curr)
|
||||
return FALSE;
|
||||
prev = curr;
|
||||
|
||||
if (!list->prev || list->prev->next != list)
|
||||
return FALSE;
|
||||
|
||||
if (len == 0)
|
||||
return FALSE;
|
||||
len--;
|
||||
}
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_list_sort ()
|
||||
{
|
||||
int i, j, mul;
|
||||
GList *list = NULL;
|
||||
|
||||
for (i = 0; i < N_ELEMS; ++i)
|
||||
list = g_list_prepend (list, GINT_TO_POINTER (i));
|
||||
list = g_list_sort (list, intcompare);
|
||||
if (!verify_sort (list, N_ELEMS))
|
||||
return FAILED ("decreasing list");
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < N_ELEMS; ++i)
|
||||
list = g_list_prepend (list, GINT_TO_POINTER (-i));
|
||||
list = g_list_sort (list, intcompare);
|
||||
if (!verify_sort (list, N_ELEMS))
|
||||
return FAILED ("increasing list");
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
list = g_list_prepend (NULL, GINT_TO_POINTER (0));
|
||||
for (i = 1; i < N_ELEMS; ++i) {
|
||||
list = g_list_prepend (list, GINT_TO_POINTER (i));
|
||||
list = g_list_prepend (list, GINT_TO_POINTER (-i));
|
||||
}
|
||||
list = g_list_sort (list, intcompare);
|
||||
if (!verify_sort (list, 2*N_ELEMS-1))
|
||||
return FAILED ("alternating list");
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
list = NULL;
|
||||
mul = 1;
|
||||
for (i = 1; i < N_ELEMS; ++i) {
|
||||
mul = -mul;
|
||||
for (j = 0; j < i; ++j)
|
||||
list = g_list_prepend (list, GINT_TO_POINTER (mul * j));
|
||||
}
|
||||
list = g_list_sort (list, intcompare);
|
||||
if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
|
||||
return FAILED ("wavering list");
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test list_tests [] = {
|
||||
{ "length", test_list_length},
|
||||
{ "nth", test_list_nth},
|
||||
{ "index", test_list_index},
|
||||
{ "last", test_list_last},
|
||||
{ "append", test_list_append},
|
||||
{ "concat", test_list_concat},
|
||||
{"insert_sorted", test_list_insert_sorted},
|
||||
{"insert_before", test_list_insert_before},
|
||||
{ "copy", test_list_copy},
|
||||
{ "reverse", test_list_reverse},
|
||||
{ "remove", test_list_remove},
|
||||
{ "remove_link", test_list_remove_link},
|
||||
{ "remove_link", test_list_remove_link},
|
||||
{ "sort", test_list_sort},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
|
||||
@@ -1,234 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
#define do_bad_test(s) do { char *r = markup_test (s); if (r == NULL) return FAILED ("Failed on test " # s); else free (r); } while (0)
|
||||
#define do_ok_test(s) do { char *r = markup_test (s); if (r != NULL) return FAILED ("Could not parse valid " # s); } while (0)
|
||||
|
||||
static char *
|
||||
markup_test (const char *s)
|
||||
{
|
||||
GMarkupParser *parser = g_new0 (GMarkupParser, 1);
|
||||
GMarkupParseContext *context;
|
||||
GError *error = NULL;
|
||||
|
||||
context = g_markup_parse_context_new (parser, 0, 0, 0);
|
||||
|
||||
g_markup_parse_context_parse (context, s, strlen (s), &error);
|
||||
g_markup_parse_context_free (context);
|
||||
|
||||
if (error != NULL){
|
||||
char *msg = g_strdup (error->message);
|
||||
g_error_free (error);
|
||||
|
||||
g_free (parser);
|
||||
return msg;
|
||||
}
|
||||
g_free (parser);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
invalid_documents (void)
|
||||
{
|
||||
/* These should fail */
|
||||
do_bad_test ("<1>");
|
||||
do_bad_test ("<a<");
|
||||
do_bad_test ("</a>");
|
||||
do_bad_test ("<a b>");
|
||||
do_bad_test ("<a b=>");
|
||||
do_bad_test ("<a b=c>");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
valid_documents (void)
|
||||
{
|
||||
/* These should fail */
|
||||
do_ok_test ("<a>");
|
||||
do_ok_test ("<a a=\"b\">");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a test for the kind of files that the code in mono/domain.c
|
||||
* parses; This code comes from Mono
|
||||
*/
|
||||
typedef struct {
|
||||
GSList *supported_runtimes;
|
||||
char *required_runtime;
|
||||
int configuration_count;
|
||||
int startup_count;
|
||||
} AppConfigInfo;
|
||||
|
||||
static char *
|
||||
get_attribute_value (const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
const char *att_name)
|
||||
{
|
||||
int n;
|
||||
for (n=0; attribute_names[n] != NULL; n++) {
|
||||
if (strcmp (attribute_names[n], att_name) == 0)
|
||||
return g_strdup (attribute_values[n]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
start_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
AppConfigInfo* app_config = (AppConfigInfo*) user_data;
|
||||
|
||||
if (strcmp (element_name, "configuration") == 0) {
|
||||
app_config->configuration_count++;
|
||||
return;
|
||||
}
|
||||
if (strcmp (element_name, "startup") == 0) {
|
||||
app_config->startup_count++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (app_config->configuration_count != 1 || app_config->startup_count != 1)
|
||||
return;
|
||||
|
||||
if (strcmp (element_name, "requiredRuntime") == 0) {
|
||||
app_config->required_runtime = get_attribute_value (attribute_names, attribute_values, "version");
|
||||
} else if (strcmp (element_name, "supportedRuntime") == 0) {
|
||||
char *version = get_attribute_value (attribute_names, attribute_values, "version");
|
||||
app_config->supported_runtimes = g_slist_append (app_config->supported_runtimes, version);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
end_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
AppConfigInfo* app_config = (AppConfigInfo*) user_data;
|
||||
|
||||
if (strcmp (element_name, "configuration") == 0) {
|
||||
app_config->configuration_count--;
|
||||
} else if (strcmp (element_name, "startup") == 0) {
|
||||
app_config->startup_count--;
|
||||
}
|
||||
}
|
||||
|
||||
static const GMarkupParser
|
||||
mono_parser = {
|
||||
start_element,
|
||||
end_element,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
AppConfigInfo *
|
||||
domain_test (char *text)
|
||||
{
|
||||
AppConfigInfo *app_config = g_new0 (AppConfigInfo, 1);
|
||||
GMarkupParseContext *context;
|
||||
|
||||
context = g_markup_parse_context_new (&mono_parser, 0, app_config, NULL);
|
||||
if (g_markup_parse_context_parse (context, text, strlen (text), NULL)) {
|
||||
g_markup_parse_context_end_parse (context, NULL);
|
||||
}
|
||||
g_markup_parse_context_free (context);
|
||||
|
||||
return app_config;
|
||||
}
|
||||
|
||||
void
|
||||
domain_free (AppConfigInfo *info)
|
||||
{
|
||||
GSList *l;
|
||||
if (info->required_runtime)
|
||||
g_free (info->required_runtime);
|
||||
for (l = info->supported_runtimes; l != NULL; l = l->next){
|
||||
g_free (l->data);
|
||||
}
|
||||
g_slist_free (info->supported_runtimes);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
RESULT
|
||||
mono_domain (void)
|
||||
{
|
||||
AppConfigInfo *info;
|
||||
|
||||
info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime version=\"v1\"><!--r--></requiredRuntime></startup></configuration>");
|
||||
if (info->required_runtime == NULL)
|
||||
return FAILED ("No required runtime section");
|
||||
if (strcmp (info->required_runtime, "v1") != 0)
|
||||
return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
|
||||
domain_free (info);
|
||||
|
||||
info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/><!--comment--></configuration><!--end-->");
|
||||
if (info->required_runtime == NULL)
|
||||
return FAILED ("No required runtime section on auto-close section");
|
||||
if (strcmp (info->required_runtime, "v1") != 0)
|
||||
return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
|
||||
domain_free (info);
|
||||
|
||||
info = domain_test ("<!--start--><configuration><startup><supportedRuntime version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
|
||||
if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
|
||||
if (info->supported_runtimes->next == NULL)
|
||||
return FAILED ("Expected 2 supported runtimes");
|
||||
|
||||
if ((strcmp ((char*)info->supported_runtimes->next->data, "v2") != 0))
|
||||
return FAILED ("Expected v1, v2, got %s", info->supported_runtimes->next->data);
|
||||
if (info->supported_runtimes->next->next != NULL)
|
||||
return FAILED ("Expected v1, v2, got more");
|
||||
} else
|
||||
return FAILED ("Expected `v1', got %s", info->supported_runtimes->data);
|
||||
domain_free (info);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
mcs_config (void)
|
||||
{
|
||||
return markup_test ("<configuration>\r\n <system.diagnostics>\r\n <trace autoflush=\"true\" indentsize=\"4\">\r\n <listeners>\r\n <add name=\"compilerLogListener\" type=\"System.Diagnostics.TextWriterTraceListener,System\"/> </listeners> </trace> </system.diagnostics> </configuration>");
|
||||
|
||||
}
|
||||
|
||||
RESULT
|
||||
xml_parse (void)
|
||||
{
|
||||
return markup_test ("<?xml version=\"1.0\" encoding=\"utf-8\"?><a></a>");
|
||||
}
|
||||
|
||||
RESULT
|
||||
machine_config (void)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
|
||||
if (g_file_get_contents ("../../data/net_1_1/machine.config", &data, &size, NULL)){
|
||||
return markup_test (data);
|
||||
}
|
||||
printf ("Ignoring this test\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Test markup_tests [] = {
|
||||
{"invalid_documents", invalid_documents},
|
||||
{"good_documents", valid_documents},
|
||||
{"mono_domain", mono_domain},
|
||||
{"mcs_config", mcs_config},
|
||||
{"xml_parse", xml_parse},
|
||||
{"machine_config", machine_config},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(markup_tests_init, markup_tests)
|
||||
|
||||
@@ -1,230 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "test.h"
|
||||
|
||||
/* This test is just to be used with valgrind */
|
||||
RESULT
|
||||
test_buildpath ()
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_build_path ("/", "hola///", "//mundo", NULL);
|
||||
if (strcmp (s, "hola/mundo") != 0)
|
||||
return FAILED ("1 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("/", "hola/", "/mundo", NULL);
|
||||
if (strcmp (s, "hola/mundo") != 0)
|
||||
return FAILED ("2 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("/", "hola/", "mundo", NULL);
|
||||
if (strcmp (s, "hola/mundo") != 0)
|
||||
return FAILED ("3 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("/", "hola", "/mundo", NULL);
|
||||
if (strcmp (s, "hola/mundo") != 0)
|
||||
return FAILED ("4 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("/", "/hello", "world/", NULL);
|
||||
if (strcmp (s, "/hello/world/") != 0)
|
||||
return FAILED ("5 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
/* Now test multi-char-separators */
|
||||
s = g_build_path ("**", "hello", "world", NULL);
|
||||
if (strcmp (s, "hello**world") != 0)
|
||||
return FAILED ("6 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("**", "hello**", "world", NULL);
|
||||
if (strcmp (s, "hello**world") != 0)
|
||||
return FAILED ("7 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("**", "hello**", "**world", NULL);
|
||||
if (strcmp (s, "hello**world") != 0)
|
||||
return FAILED ("8 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("**", "hello**", "**world", NULL);
|
||||
if (strcmp (s, "hello**world") != 0)
|
||||
return FAILED ("9 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("1234567890", "hello", "world", NULL);
|
||||
if (strcmp (s, "hello1234567890world") != 0)
|
||||
return FAILED ("10 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
|
||||
if (strcmp (s, "hello1234567890world") != 0)
|
||||
return FAILED ("11 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
|
||||
if (strcmp (s, "hello1234567890world") != 0)
|
||||
return FAILED ("12 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
/* Multiple */
|
||||
s = g_build_path ("/", "a", "b", "c", "d", NULL);
|
||||
if (strcmp (s, "a/b/c/d") != 0)
|
||||
return FAILED ("13 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_path ("/", "/a", "", "/c/", NULL);
|
||||
if (strcmp (s, "/a/c/") != 0)
|
||||
return FAILED ("14 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
return OK;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_buildfname ()
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_build_filename ("a", "b", "c", "d", NULL);
|
||||
if (strcmp (s, "a/b/c/d") != 0)
|
||||
return FAILED ("1 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
test_dirname ()
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_path_get_dirname ("/home/miguel");
|
||||
if (strcmp (s, "/home") != 0)
|
||||
return FAILED ("Expected /home, got %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_path_get_dirname ("/home/dingus/");
|
||||
if (strcmp (s, "/home/dingus") != 0)
|
||||
return FAILED ("Expected /home/dingus, got %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_path_get_dirname ("dir.c");
|
||||
if (strcmp (s, ".") != 0)
|
||||
return FAILED ("Expected `.', got %s", s);
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
test_basename ()
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_path_get_basename ("");
|
||||
if (strcmp (s, ".") != 0)
|
||||
return FAILED ("Expected `.', got %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_path_get_basename ("/home/dingus/");
|
||||
if (strcmp (s, "dingus") != 0)
|
||||
return FAILED ("1 Expected dingus, got %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_path_get_basename ("/home/dingus");
|
||||
if (strcmp (s, "dingus") != 0)
|
||||
return FAILED ("2 Expected dingus, got %s", s);
|
||||
g_free (s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
gchar *
|
||||
test_ppath ()
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_find_program_in_path ("ls");
|
||||
if (s == NULL)
|
||||
return FAILED ("No shell on this system (This assumes Unix)?");
|
||||
g_free (s);
|
||||
return OK;
|
||||
}
|
||||
|
||||
gchar *
|
||||
test_ppath2 ()
|
||||
{
|
||||
char *s;
|
||||
const char *path = g_getenv ("PATH");
|
||||
|
||||
g_setenv ("PATH", "", TRUE);
|
||||
s = g_find_program_in_path ("ls");
|
||||
if (s != NULL) {
|
||||
g_setenv ("PATH", path, TRUE);
|
||||
return FAILED ("Found something interesting here: %s", s);
|
||||
}
|
||||
g_free (s);
|
||||
s = g_find_program_in_path ("test-glib");
|
||||
if (s == NULL) {
|
||||
g_setenv ("PATH", path, TRUE);
|
||||
return FAILED ("It should find 'test-glib' in the current directory.");
|
||||
}
|
||||
g_free (s);
|
||||
g_setenv ("PATH", path, TRUE);
|
||||
return OK;
|
||||
}
|
||||
|
||||
gchar *
|
||||
test_cwd ()
|
||||
{
|
||||
char *dir = g_get_current_dir ();
|
||||
|
||||
if (dir == NULL)
|
||||
return FAILED ("No current directory?");
|
||||
g_free (dir);
|
||||
|
||||
if (chdir ("/bin") == -1)
|
||||
return FAILED ("No /bin?");
|
||||
|
||||
dir = g_get_current_dir ();
|
||||
if (strcmp (dir, "/bin") != 0)
|
||||
return FAILED("Did not go to /bin?");
|
||||
g_free (dir);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
gchar *
|
||||
test_misc ()
|
||||
{
|
||||
const char *home = g_get_home_dir ();
|
||||
const char *tmp = g_get_tmp_dir ();
|
||||
|
||||
if (home == NULL)
|
||||
return FAILED ("Where did my home go?");
|
||||
|
||||
if (tmp == NULL)
|
||||
return FAILED ("Where did my /tmp go?");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test path_tests [] = {
|
||||
{"g_buildpath", test_buildpath},
|
||||
{"g_build_filename", test_buildfname},
|
||||
{"g_path_get_dirname", test_dirname},
|
||||
{"g_path_get_basename", test_basename},
|
||||
{"g_find_program_in_path", test_ppath},
|
||||
{"g_find_program_in_path2", test_ppath2},
|
||||
{"test_cwd", test_cwd },
|
||||
{"test_misc", test_misc },
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(path_tests_init, path_tests)
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
|
||||
#define MATCH(pat,string,error_if,msg) \
|
||||
spec = g_pattern_spec_new (pat); \
|
||||
res = g_pattern_match_string (spec, string); \
|
||||
if (res == error_if) \
|
||||
return FAILED (msg " returned %s", res ? "TRUE" : "FALSE"); \
|
||||
g_pattern_spec_free (spec);
|
||||
|
||||
#define TEST_MATCH(pat,string,n) MATCH (pat, string, FALSE, "MATCH " #n)
|
||||
#define TEST_NO_MATCH(pat,string,n) MATCH (pat, string,TRUE, "NO_MATCH " #n)
|
||||
|
||||
RESULT
|
||||
test_pattern_spec ()
|
||||
{
|
||||
GPatternSpec *spec;
|
||||
gboolean res;
|
||||
|
||||
/* spec = g_pattern_spec_new (NULL); */
|
||||
TEST_MATCH ("*", "hola", 1);
|
||||
TEST_MATCH ("hola", "hola", 2);
|
||||
TEST_MATCH ("????", "hola", 3);
|
||||
TEST_MATCH ("???a", "hola", 4);
|
||||
TEST_MATCH ("h??a", "hola", 5);
|
||||
TEST_MATCH ("h??*", "hola", 6);
|
||||
TEST_MATCH ("h*", "hola", 7);
|
||||
TEST_MATCH ("*hola", "hola", 8);
|
||||
TEST_MATCH ("*l*", "hola", 9);
|
||||
TEST_MATCH ("h*??", "hola", 10);
|
||||
TEST_MATCH ("h*???", "hola", 11);
|
||||
TEST_MATCH ("?o??", "hola", 12);
|
||||
TEST_MATCH ("*h*o*l*a*", "hola", 13);
|
||||
TEST_MATCH ("h*o*l*a", "hola", 14);
|
||||
TEST_MATCH ("h?*?", "hola", 15);
|
||||
|
||||
TEST_NO_MATCH ("", "hola", 1);
|
||||
TEST_NO_MATCH ("?????", "hola", 2);
|
||||
TEST_NO_MATCH ("???", "hola", 3);
|
||||
TEST_NO_MATCH ("*o", "hola", 4);
|
||||
TEST_NO_MATCH ("h", "hola", 5);
|
||||
TEST_NO_MATCH ("h*????", "hola", 6);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test pattern_tests [] = {
|
||||
{"g_pattern_spec*", test_pattern_spec},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(pattern_tests_init, pattern_tests)
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
/* Redefine the private structure only to verify proper allocations */
|
||||
typedef struct _GPtrArrayPriv {
|
||||
gpointer *pdata;
|
||||
guint len;
|
||||
guint size;
|
||||
} GPtrArrayPriv;
|
||||
|
||||
/* Don't add more than 32 items to this please */
|
||||
static const char *items [] = {
|
||||
"Apples", "Oranges", "Plumbs", "Goats", "Snorps", "Grapes",
|
||||
"Tickle", "Place", "Coffee", "Cookies", "Cake", "Cheese",
|
||||
"Tseng", "Holiday", "Avenue", "Smashing", "Water", "Toilet",
|
||||
NULL
|
||||
};
|
||||
|
||||
static GPtrArray *ptrarray_alloc_and_fill(gint *item_count)
|
||||
{
|
||||
GPtrArray *array = g_ptr_array_new();
|
||||
gint i;
|
||||
|
||||
for(i = 0; items[i] != NULL; i++) {
|
||||
g_ptr_array_add(array, (gpointer)items[i]);
|
||||
}
|
||||
|
||||
if(item_count != NULL) {
|
||||
*item_count = i;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static gint guess_size(gint length)
|
||||
{
|
||||
gint size = 1;
|
||||
|
||||
while(size < length) {
|
||||
size <<= 1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
RESULT ptrarray_alloc()
|
||||
{
|
||||
GPtrArrayPriv *array;
|
||||
gint i;
|
||||
|
||||
array = (GPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
|
||||
|
||||
if(array->size != guess_size(array->len)) {
|
||||
return FAILED("Size should be %d, but it is %d",
|
||||
guess_size(array->len), array->size);
|
||||
}
|
||||
|
||||
if(array->len != i) {
|
||||
return FAILED("Expected %d node(s) in the array", i);
|
||||
}
|
||||
|
||||
g_ptr_array_free((GPtrArray *)array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT ptrarray_for_iterate()
|
||||
{
|
||||
GPtrArray *array = ptrarray_alloc_and_fill(NULL);
|
||||
gint i;
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
char *item = (char *)g_ptr_array_index(array, i);
|
||||
if(item != items[i]) {
|
||||
return FAILED(
|
||||
"Expected item at %d to be %s, but it was %s",
|
||||
i, items[i], item);
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static gint foreach_iterate_index = 0;
|
||||
static char *foreach_iterate_error = NULL;
|
||||
|
||||
void foreach_callback(gpointer data, gpointer user_data)
|
||||
{
|
||||
char *item = (char *)data;
|
||||
const char *item_cmp = items[foreach_iterate_index++];
|
||||
|
||||
if(foreach_iterate_error != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(item != item_cmp) {
|
||||
foreach_iterate_error = FAILED(
|
||||
"Expected item at %d to be %s, but it was %s",
|
||||
foreach_iterate_index - 1, item_cmp, item);
|
||||
}
|
||||
}
|
||||
|
||||
RESULT ptrarray_foreach_iterate()
|
||||
{
|
||||
GPtrArray *array = ptrarray_alloc_and_fill(NULL);
|
||||
|
||||
foreach_iterate_index = 0;
|
||||
foreach_iterate_error = NULL;
|
||||
|
||||
g_ptr_array_foreach(array, foreach_callback, array);
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return foreach_iterate_error;
|
||||
}
|
||||
|
||||
RESULT ptrarray_set_size()
|
||||
{
|
||||
GPtrArray *array = g_ptr_array_new();
|
||||
gint i, grow_length = 50;
|
||||
|
||||
g_ptr_array_add(array, (gpointer)items[0]);
|
||||
g_ptr_array_add(array, (gpointer)items[1]);
|
||||
g_ptr_array_set_size(array, grow_length);
|
||||
|
||||
if(array->len != grow_length) {
|
||||
return FAILED("Array length should be 50, it is %d", array->len);
|
||||
} else if(array->pdata[0] != items[0]) {
|
||||
return FAILED("Item 0 was overwritten, should be %s", items[0]);
|
||||
} else if(array->pdata[1] != items[1]) {
|
||||
return FAILED("Item 1 was overwritten, should be %s", items[1]);
|
||||
}
|
||||
|
||||
for(i = 2; i < array->len; i++) {
|
||||
if(array->pdata[i] != NULL) {
|
||||
return FAILED("Item %d is not NULL, it is %p", i, array->pdata[i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT ptrarray_remove_index()
|
||||
{
|
||||
GPtrArray *array;
|
||||
gint i;
|
||||
|
||||
array = ptrarray_alloc_and_fill(&i);
|
||||
|
||||
g_ptr_array_remove_index(array, 0);
|
||||
if(array->pdata[0] != items[1]) {
|
||||
return FAILED("First item is not %s, it is %s", items[1],
|
||||
array->pdata[0]);
|
||||
}
|
||||
|
||||
g_ptr_array_remove_index(array, array->len - 1);
|
||||
|
||||
if(array->pdata[array->len - 1] != items[array->len]) {
|
||||
return FAILED("Last item is not %s, it is %s",
|
||||
items[array->len - 2], array->pdata[array->len - 1]);
|
||||
}
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT ptrarray_remove()
|
||||
{
|
||||
GPtrArray *array;
|
||||
gint i;
|
||||
|
||||
array = ptrarray_alloc_and_fill(&i);
|
||||
|
||||
g_ptr_array_remove(array, (gpointer)items[7]);
|
||||
|
||||
if(!g_ptr_array_remove(array, (gpointer)items[4])) {
|
||||
return FAILED("Item %s not removed", items[4]);
|
||||
}
|
||||
|
||||
if(g_ptr_array_remove(array, (gpointer)items[4])) {
|
||||
return FAILED("Item %s still in array after removal", items[4]);
|
||||
}
|
||||
|
||||
if(array->pdata[array->len - 1] != items[array->len + 1]) {
|
||||
return FAILED("Last item in GPtrArray not correct");
|
||||
}
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static gint ptrarray_sort_compare(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
gchar *stra = *(gchar **) a;
|
||||
gchar *strb = *(gchar **) b;
|
||||
return strcmp(stra, strb);
|
||||
}
|
||||
|
||||
RESULT ptrarray_sort()
|
||||
{
|
||||
GPtrArray *array = g_ptr_array_new();
|
||||
gint i;
|
||||
gchar *letters [] = { "A", "B", "C", "D", "E" };
|
||||
|
||||
g_ptr_array_add(array, letters[0]);
|
||||
g_ptr_array_add(array, letters[1]);
|
||||
g_ptr_array_add(array, letters[2]);
|
||||
g_ptr_array_add(array, letters[3]);
|
||||
g_ptr_array_add(array, letters[4]);
|
||||
|
||||
g_ptr_array_sort(array, ptrarray_sort_compare);
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
if(array->pdata[i] != letters[i]) {
|
||||
return FAILED("Array out of order, expected %s got %s",
|
||||
(gchar *)array->pdata[i], letters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_free(array, TRUE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test ptrarray_tests [] = {
|
||||
{"alloc", ptrarray_alloc},
|
||||
{"for_iterate", ptrarray_for_iterate},
|
||||
{"foreach_iterate", ptrarray_foreach_iterate},
|
||||
{"set_size", ptrarray_set_size},
|
||||
{"remove_index", ptrarray_remove_index},
|
||||
{"remove", ptrarray_remove},
|
||||
{"sort", ptrarray_sort},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(ptrarray_tests_init, ptrarray_tests)
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_queue_push ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
|
||||
g_queue_push_head (queue, "foo");
|
||||
g_queue_push_head (queue, "bar");
|
||||
g_queue_push_head (queue, "baz");
|
||||
|
||||
if (queue->length != 3)
|
||||
return FAILED ("push failed");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_queue_pop ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
gpointer data;
|
||||
|
||||
g_queue_push_head (queue, "foo");
|
||||
g_queue_push_head (queue, "bar");
|
||||
g_queue_push_head (queue, "baz");
|
||||
|
||||
data = g_queue_pop_head (queue);
|
||||
if (strcmp ("baz", data))
|
||||
return FAILED ("expect baz.");
|
||||
|
||||
data = g_queue_pop_head (queue);
|
||||
if (strcmp ("bar", data))
|
||||
return FAILED ("expect bar.");
|
||||
|
||||
data = g_queue_pop_head (queue);
|
||||
if (strcmp ("foo", data))
|
||||
return FAILED ("expect foo.");
|
||||
|
||||
if (g_queue_is_empty (queue) == FALSE)
|
||||
return FAILED ("expect is_empty.");
|
||||
|
||||
if (queue->length != 0)
|
||||
return FAILED ("expect 0 length .");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_queue_new ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
|
||||
if (queue->length != 0)
|
||||
return FAILED ("expect length == 0");
|
||||
|
||||
if (queue->head != NULL)
|
||||
return FAILED ("expect head == NULL");
|
||||
|
||||
if (queue->tail != NULL)
|
||||
return FAILED ("expect tail == NULL");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_queue_is_empty ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
|
||||
if (g_queue_is_empty (queue) == FALSE)
|
||||
return FAILED ("new queue should be empty");
|
||||
|
||||
g_queue_push_head (queue, "foo");
|
||||
|
||||
if (g_queue_is_empty (queue) == TRUE)
|
||||
return FAILED ("expected TRUE");
|
||||
|
||||
g_queue_free (queue);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test queue_tests [] = {
|
||||
{ "push", test_queue_push},
|
||||
{ "pop", test_queue_pop},
|
||||
{ "new", test_queue_new},
|
||||
{"is_empty", test_queue_is_empty},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(queue_tests_init, queue_tests)
|
||||
|
||||
@@ -1,237 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_shell_argv1 ()
|
||||
{
|
||||
GError *error;
|
||||
gint argc;
|
||||
gchar **argv;
|
||||
gboolean ret;
|
||||
|
||||
/* The next line prints a critical error and returns FALSE
|
||||
ret = g_shell_parse_argv (NULL, NULL, NULL, NULL);
|
||||
*/
|
||||
ret = g_shell_parse_argv ("", NULL, NULL, NULL);
|
||||
if (ret)
|
||||
return FAILED ("1. It should return FALSE");
|
||||
|
||||
ret = g_shell_parse_argv ("hola", NULL, NULL, NULL);
|
||||
if (!ret)
|
||||
return FAILED ("2. It should return TRUE");
|
||||
|
||||
argc = 0;
|
||||
ret = g_shell_parse_argv ("hola", &argc, NULL, NULL);
|
||||
if (!ret)
|
||||
return FAILED ("3. It should return TRUE");
|
||||
if (argc != 1)
|
||||
return FAILED ("4. argc was %d", argc);
|
||||
|
||||
argc = 0;
|
||||
ret = g_shell_parse_argv ("hola bola", &argc, NULL, NULL);
|
||||
if (!ret)
|
||||
return FAILED ("5. It should return TRUE");
|
||||
if (argc != 2)
|
||||
return FAILED ("6. argc was %d", argc);
|
||||
|
||||
argc = 0;
|
||||
ret = g_shell_parse_argv ("hola bola", &argc, &argv, NULL);
|
||||
if (!ret)
|
||||
return FAILED ("7. It should return TRUE");
|
||||
if (argc != 2)
|
||||
return FAILED ("8. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("9. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "bola"))
|
||||
return FAILED ("10. argv[1] was %s", argv [1]);
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola 'bola'", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("11. It should return TRUE");
|
||||
if (argc != 2)
|
||||
return FAILED ("12. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("13. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "bola"))
|
||||
return FAILED ("14. argv[1] was %s", argv [1]);
|
||||
if (error != NULL)
|
||||
return FAILED ("15. error is not null");
|
||||
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola '' 'bola'", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("16. It should return TRUE");
|
||||
if (argc != 3)
|
||||
return FAILED ("17. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("18. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], ""))
|
||||
return FAILED ("19. argv[2] was %s", argv [1]);
|
||||
if (strcmp (argv [2], "bola"))
|
||||
return FAILED ("19. argv[2] was %s", argv [2]);
|
||||
if (error != NULL)
|
||||
return FAILED ("20. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_shell_argv2 ()
|
||||
{
|
||||
GError *error;
|
||||
gint argc;
|
||||
gchar **argv;
|
||||
gboolean ret;
|
||||
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola \"bola\"", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("1. It should return TRUE");
|
||||
if (argc != 2)
|
||||
return FAILED ("2. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("3. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "bola"))
|
||||
return FAILED ("4. argv[1] was %s", argv [1]);
|
||||
if (error != NULL)
|
||||
return FAILED ("5. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola \"\" \"bola \"", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("6. It should return TRUE");
|
||||
if (argc != 3)
|
||||
return FAILED ("7. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("8. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], ""))
|
||||
return FAILED ("9. argv[2] was %s", argv [1]);
|
||||
if (strcmp (argv [2], "bola "))
|
||||
return FAILED ("10. argv[2] was %s", argv [2]);
|
||||
if (error != NULL)
|
||||
return FAILED ("11. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola\n\t \"\t\" \"bola \"", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("10. It should return TRUE");
|
||||
if (argc != 3)
|
||||
return FAILED ("11. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("12. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "\t"))
|
||||
return FAILED ("13. argv[2] was %s", argv [1]);
|
||||
if (strcmp (argv [2], "bola "))
|
||||
return FAILED ("14. argv[2] was %s", argv [2]);
|
||||
if (error != NULL)
|
||||
return FAILED ("15. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola\n\t \\\n \"\t\" \"bola \"", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("16. It should return TRUE");
|
||||
if (argc != 3)
|
||||
return FAILED ("17. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("18. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "\t"))
|
||||
return FAILED ("19. argv[2] was %s", argv [1]);
|
||||
if (strcmp (argv [2], "bola "))
|
||||
return FAILED ("20. argv[2] was %s", argv [2]);
|
||||
if (error != NULL)
|
||||
return FAILED ("21. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_shell_argv3 ()
|
||||
{
|
||||
GError *error;
|
||||
gint argc;
|
||||
gchar **argv;
|
||||
gboolean ret;
|
||||
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola \"bola", &argc, &argv, &error);
|
||||
if (ret)
|
||||
return FAILED ("1. It should return FALSE");
|
||||
if (argc != 0)
|
||||
return FAILED ("2. argc was %d", argc);
|
||||
if (argv != NULL)
|
||||
return FAILED ("3. argv[0] was %s", argv [0]);
|
||||
if (error == NULL)
|
||||
return FAILED ("4. error is null");
|
||||
|
||||
/* Text ended before matching quote was found for ". (The text was 'hola "bola') */
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
ret = g_shell_parse_argv ("hola \\\"bola", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("5. It should return TRUE");
|
||||
if (argc != 2)
|
||||
return FAILED ("6. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("18. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "\"bola"))
|
||||
return FAILED ("18. argv[1] was %s", argv [1]);
|
||||
if (error != NULL)
|
||||
return FAILED ("8. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
ret = g_shell_parse_argv ("hola \"\n\\'bola\"", &argc, &argv, &error);
|
||||
if (!ret)
|
||||
return FAILED ("9. It should return TRUE. %s", error->message);
|
||||
if (argc != 2)
|
||||
return FAILED ("10. argc was %d", argc);
|
||||
if (strcmp (argv [0], "hola"))
|
||||
return FAILED ("11. argv[0] was %s", argv [0]);
|
||||
if (strcmp (argv [1], "\n\\'bola"))
|
||||
return FAILED ("12. argv[1] was %s", argv [1]);
|
||||
if (error != NULL)
|
||||
return FAILED ("13. error is not null");
|
||||
|
||||
g_strfreev (argv);
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test shell_tests [] = {
|
||||
{"g_shell_parse_argv1", test_shell_argv1},
|
||||
{"g_shell_parse_argv2", test_shell_argv2},
|
||||
{"g_shell_parse_argv3", test_shell_argv3},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(shell_tests_init, shell_tests)
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Tests to ensure that our type definitions are correct
|
||||
*
|
||||
* These depend on -Werror, -Wall being set to catch the build error.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_formats ()
|
||||
{
|
||||
char buffer [1024];
|
||||
gsize a = 1;
|
||||
|
||||
sprintf (buffer, "%" G_GSIZE_FORMAT, a);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_ptrconv ()
|
||||
{
|
||||
int iv, iv2;
|
||||
unsigned int uv, uv2;
|
||||
gpointer ptr;
|
||||
|
||||
iv = G_MAXINT32;
|
||||
ptr = GINT_TO_POINTER (iv);
|
||||
iv2 = GPOINTER_TO_INT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
|
||||
|
||||
iv = G_MININT32;
|
||||
ptr = GINT_TO_POINTER (iv);
|
||||
iv2 = GPOINTER_TO_INT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
|
||||
|
||||
iv = 1;
|
||||
ptr = GINT_TO_POINTER (iv);
|
||||
iv2 = GPOINTER_TO_INT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
|
||||
|
||||
iv = -1;
|
||||
ptr = GINT_TO_POINTER (iv);
|
||||
iv2 = GPOINTER_TO_INT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
|
||||
|
||||
iv = 0;
|
||||
ptr = GINT_TO_POINTER (iv);
|
||||
iv2 = GPOINTER_TO_INT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
|
||||
|
||||
uv = 0;
|
||||
ptr = GUINT_TO_POINTER (iv);
|
||||
uv2 = GPOINTER_TO_UINT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
|
||||
|
||||
uv = 1;
|
||||
ptr = GUINT_TO_POINTER (iv);
|
||||
uv2 = GPOINTER_TO_UINT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
|
||||
|
||||
uv = UINT32_MAX;
|
||||
ptr = GUINT_TO_POINTER (iv);
|
||||
uv2 = GPOINTER_TO_UINT (ptr);
|
||||
if (iv != iv2)
|
||||
return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
} my_struct;
|
||||
|
||||
RESULT
|
||||
test_offset ()
|
||||
{
|
||||
if (G_STRUCT_OFFSET (my_struct, a) != 0)
|
||||
return FAILED ("offset of a is not zero");
|
||||
|
||||
if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
|
||||
return FAILED ("offset of b is 4 or 8, macro might be busted");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test size_tests [] = {
|
||||
{"formats", test_formats},
|
||||
{"ptrconv", test_ptrconv},
|
||||
{"g_struct_offset", test_offset},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)
|
||||
@@ -1,254 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "test.h"
|
||||
|
||||
RESULT
|
||||
test_slist_append ()
|
||||
{
|
||||
GSList *foo;
|
||||
GSList *list = g_slist_append (NULL, "first");
|
||||
if (g_slist_length (list) != 1)
|
||||
return FAILED ("append(null,...) failed");
|
||||
|
||||
foo = g_slist_append (list, "second");
|
||||
if (foo != list)
|
||||
return FAILED ("changed list head on non-empty");
|
||||
|
||||
if (g_slist_length (list) != 2)
|
||||
return FAILED ("Append failed");
|
||||
|
||||
g_slist_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_concat ()
|
||||
{
|
||||
GSList *foo = g_slist_prepend (NULL, "foo");
|
||||
GSList *bar = g_slist_prepend (NULL, "bar");
|
||||
|
||||
GSList *list = g_slist_concat (foo, bar);
|
||||
|
||||
if (g_slist_length (list) != 2)
|
||||
return FAILED ("Concat failed.");
|
||||
|
||||
g_slist_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_find ()
|
||||
{
|
||||
GSList *list = g_slist_prepend (NULL, "three");
|
||||
GSList *found;
|
||||
char *data;
|
||||
|
||||
list = g_slist_prepend (list, "two");
|
||||
list = g_slist_prepend (list, "one");
|
||||
|
||||
data = "four";
|
||||
list = g_slist_append (list, data);
|
||||
|
||||
found = g_slist_find (list, data);
|
||||
|
||||
if (found->data != data)
|
||||
return FAILED ("Find failed");
|
||||
|
||||
g_slist_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_remove ()
|
||||
{
|
||||
GSList *list = g_slist_prepend (NULL, "three");
|
||||
char *one = "one";
|
||||
list = g_slist_prepend (list, "two");
|
||||
list = g_slist_prepend (list, one);
|
||||
|
||||
list = g_slist_remove (list, one);
|
||||
|
||||
if (g_slist_length (list) != 2)
|
||||
return FAILED ("Remove failed");
|
||||
|
||||
if (strcmp ("two", list->data) != 0)
|
||||
return FAILED ("Remove failed");
|
||||
|
||||
g_slist_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_remove_link ()
|
||||
{
|
||||
GSList *foo = g_slist_prepend (NULL, "a");
|
||||
GSList *bar = g_slist_prepend (NULL, "b");
|
||||
GSList *baz = g_slist_prepend (NULL, "c");
|
||||
GSList *list = foo;
|
||||
|
||||
foo = g_slist_concat (foo, bar);
|
||||
foo = g_slist_concat (foo, baz);
|
||||
|
||||
list = g_slist_remove_link (list, bar);
|
||||
|
||||
if (g_slist_length (list) != 2)
|
||||
return FAILED ("remove_link failed #1");
|
||||
|
||||
if (bar->next != NULL)
|
||||
return FAILED ("remove_link failed #2");
|
||||
|
||||
g_slist_free (list);
|
||||
g_slist_free (bar);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
char *foo = (char *) a;
|
||||
char *bar = (char *) b;
|
||||
|
||||
if (strlen (foo) < strlen (bar))
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_insert_sorted ()
|
||||
{
|
||||
GSList *list = g_slist_prepend (NULL, "a");
|
||||
list = g_slist_append (list, "aaa");
|
||||
|
||||
/* insert at the middle */
|
||||
list = g_slist_insert_sorted (list, "aa", compare);
|
||||
if (strcmp ("aa", list->next->data))
|
||||
return FAILED("insert_sorted failed #1");
|
||||
|
||||
/* insert at the beginning */
|
||||
list = g_slist_insert_sorted (list, "", compare);
|
||||
if (strcmp ("", list->data))
|
||||
return FAILED ("insert_sorted failed #2");
|
||||
|
||||
/* insert at the end */
|
||||
list = g_slist_insert_sorted (list, "aaaa", compare);
|
||||
if (strcmp ("aaaa", g_slist_last (list)->data))
|
||||
return FAILED ("insert_sorted failed #3");
|
||||
|
||||
g_slist_free (list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_insert_before ()
|
||||
{
|
||||
GSList *foo, *bar, *baz;
|
||||
|
||||
foo = g_slist_prepend (NULL, "foo");
|
||||
foo = g_slist_insert_before (foo, NULL, "bar");
|
||||
bar = g_slist_last (foo);
|
||||
|
||||
if (strcmp (bar->data, "bar"))
|
||||
return FAILED ("1");
|
||||
|
||||
baz = g_slist_insert_before (foo, bar, "baz");
|
||||
if (foo != baz)
|
||||
return FAILED ("2");
|
||||
|
||||
if (strcmp (foo->next->data, "baz"))
|
||||
return FAILED ("3: %s", foo->next->data);
|
||||
|
||||
g_slist_free (foo);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#define N_ELEMS 100
|
||||
|
||||
static int intcompare (gconstpointer p1, gconstpointer p2)
|
||||
{
|
||||
return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
|
||||
}
|
||||
|
||||
static gboolean verify_sort (GSList *list, int len)
|
||||
{
|
||||
int prev = GPOINTER_TO_INT (list->data);
|
||||
len--;
|
||||
for (list = list->next; list; list = list->next) {
|
||||
int curr = GPOINTER_TO_INT (list->data);
|
||||
if (prev > curr)
|
||||
return FALSE;
|
||||
prev = curr;
|
||||
|
||||
if (len == 0)
|
||||
return FALSE;
|
||||
len--;
|
||||
}
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_slist_sort ()
|
||||
{
|
||||
int i, j, mul;
|
||||
GSList *list = NULL;
|
||||
|
||||
for (i = 0; i < N_ELEMS; ++i)
|
||||
list = g_slist_prepend (list, GINT_TO_POINTER (i));
|
||||
list = g_slist_sort (list, intcompare);
|
||||
if (!verify_sort (list, N_ELEMS))
|
||||
return FAILED ("decreasing list");
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < N_ELEMS; ++i)
|
||||
list = g_slist_prepend (list, GINT_TO_POINTER (-i));
|
||||
list = g_slist_sort (list, intcompare);
|
||||
if (!verify_sort (list, N_ELEMS))
|
||||
return FAILED ("increasing list");
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
list = g_slist_prepend (NULL, GINT_TO_POINTER (0));
|
||||
for (i = 1; i < N_ELEMS; ++i) {
|
||||
list = g_slist_prepend (list, GINT_TO_POINTER (-i));
|
||||
list = g_slist_prepend (list, GINT_TO_POINTER (i));
|
||||
}
|
||||
list = g_slist_sort (list, intcompare);
|
||||
if (!verify_sort (list, 2*N_ELEMS-1))
|
||||
return FAILED ("alternating list");
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
list = NULL;
|
||||
mul = 1;
|
||||
for (i = 1; i < N_ELEMS; ++i) {
|
||||
mul = -mul;
|
||||
for (j = 0; j < i; ++j)
|
||||
list = g_slist_prepend (list, GINT_TO_POINTER (mul * j));
|
||||
}
|
||||
list = g_slist_sort (list, intcompare);
|
||||
if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
|
||||
return FAILED ("wavering list");
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static Test slist_tests [] = {
|
||||
{"append", test_slist_append},
|
||||
{"concat", test_slist_concat},
|
||||
{"find", test_slist_find},
|
||||
{"remove", test_slist_remove},
|
||||
{"remove_link", test_slist_remove_link},
|
||||
{"insert_sorted", test_slist_insert_sorted},
|
||||
{"insert_before", test_slist_insert_before},
|
||||
{"sort", test_slist_sort},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DEFINE_TEST_GROUP_INIT(slist_tests_init, slist_tests)
|
||||
|
||||
Loaded 100 of 21375 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user